New release based on our 2010wk02 release
authormikaruus <mika.a.ruuskanen@nokia.com>
Thu, 14 Jan 2010 10:44:58 +0200
changeset 5 8ccc39f9d787
parent 4 510c70acdbf6
child 6 942573423a60
New release based on our 2010wk02 release
_ccmwaid.inf
adaptationlayer/bcaiscadapter/bcatoisc_dll/group/bcatoisc.mmp
adaptationlayer/dataport/dataport_csy/src/dpbreak.cpp
adaptationlayer/dataport/dataport_csy/src/dpcommpep.cpp
adaptationlayer/dataport/dataport_csy/src/dpdatabuffer.cpp
adaptationlayer/dataport/dataport_csy/src/dpdataconfig.cpp
adaptationlayer/dataport/dataport_csy/src/dpdataelement.cpp
adaptationlayer/dataport/dataport_csy/src/dpdataport.cpp
adaptationlayer/dataport/dataport_csy/src/dpdte2tx.cpp
adaptationlayer/dataport/dataport_csy/src/dpescdetect.cpp
adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp
adaptationlayer/dataport/dataport_csy/src/dpmif.cpp
adaptationlayer/dataport/dataport_csy/src/dpobserver.cpp
adaptationlayer/dataport/dataport_csy/src/dpparityhandler.cpp
adaptationlayer/dataport/dataport_csy/src/dppif.cpp
adaptationlayer/dataport/dataport_csy/src/dppn2rx.cpp
adaptationlayer/dataport/dataport_csy/src/dprx2dte.cpp
adaptationlayer/dataport/dataport_csy/src/dptermdetect.cpp
adaptationlayer/dataport/dataport_csy/src/dptx2pn.cpp
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_event_handler_ape_cent.cpp
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_extension.cpp
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_channel.cpp
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_device.cpp
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp
adaptationlayer/devicemodecontroller/dmc_ext/traces/osttracedefinitions.h
adaptationlayer/group/bld.inf
adaptationlayer/modematadaptation/modematcommon_dll/group/modematcommon_dll.mmp
adaptationlayer/modematadaptation/modematcommon_dll/src/modemat_common.cpp
adaptationlayer/modematadaptation/modematcontroller_dll/group/modematcontroller_dll.mmp
adaptationlayer/modematadaptation/modematcontroller_exe/group/modematcontroller_exe.mmp
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h
adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodemathandler.cpp
adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematpipecontroller.cpp
adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsession.cpp
adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp
adaptationlayer/modematadaptation/modematext_dll/group/modematext_dll.mmp
adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp
adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss
adaptationlayer/rom/adaptationlayer.iby
adaptationlayer/systemstatemanageradaptation/group/bld.inf
adaptationlayer/systemstatemanageradaptation/iscservice/doc/sa_common_isc_service_design.doc
adaptationlayer/systemstatemanageradaptation/iscservice/inc/msa_isc_service.h
adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_isc_service.h
adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_isc_service_channel_listener.h
adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_trace.h
adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_isc_service.cpp
adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_isc_service_channel_listener.cpp
adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_trace.cpp
adaptationlayer/systemstatemanageradaptation/rom/sspluginsadaptation.iby
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/bwins/ssm_emergencycallrf_adaptation.def
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/eabi/ssm_emergencycallrf_adaptation.def
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/group/emergencycallrfadaptation.mmp
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_adaptation.h
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_trcommand.h
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_adaptation.cpp
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_trcommand.cpp
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/traces/OstTraceDefinitions.h
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/bwins/ssm_misc_adaptation.def
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/eabi/ssm_misc_adaptation.def
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/group/miscadaptation.mmp
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/inc/ssm_misc_adaptation.h
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/src/ssm_misc_adaptation.cpp
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/traces/osttracedefinitions.h
adaptationlayer/tsy/licenseetsy_dll/src/licenseetsy.cpp
adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp
adaptationlayer/tsy/nokiatsy_dll/group/nokiatsylib.mmp
adaptationlayer/tsy/nokiatsy_dll/inc/cmmbroadmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmenstoremesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmmessagerouter.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationdelete.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread3g_adn.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationlist.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonemesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmsecuritymesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmscache.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmsmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmsupplservmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/muiccoperationbase.h
adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h
adaptationlayer/tsy/nokiatsy_dll/inc/operators.h
adaptationlayer/tsy/nokiatsy_dll/src/cmmbroadmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmconferencecallmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmdatautility.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmdtmfmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmenstoremesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmnetoperatornamehandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketcontextmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketmesshandlercontextlist.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketqosmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketservicemesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread3g_adn.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationlist.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonemesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetreceiver.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetsender.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmpipecontrol.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsecuritymesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsmscache.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsgsmaddress.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmuiccmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/toperatornames.cpp
adaptationlayer/tsy/nokiatsy_dll/src/tssparser.cpp
adaptationlayer/tsy/nokiatsy_dll/traces/osttracedefinitions.h
adaptationlayer/tsy/simatktsy_dll/inc/ber_tlv.h
adaptationlayer/tsy/simatktsy_dll/inc/satcc.h
adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h
adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.inl
adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h
adaptationlayer/tsy/simatktsy_dll/src/ber_tlv.cpp
adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp
adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp
adaptationlayer/tsy/simatktsy_dll/src/sateventdownload.cpp
adaptationlayer/tsy/simatktsy_dll/src/satflightmodestatus.cpp
adaptationlayer/tsy/simatktsy_dll/src/saticon.cpp
adaptationlayer/tsy/simatktsy_dll/src/satmessaging.cpp
adaptationlayer/tsy/simatktsy_dll/src/satmesshandler.cpp
adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp
adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp
adaptationlayer/tsy/simatktsy_dll/src/sattimer.cpp
adaptationlayer/tsy/simatktsy_dll/src/satutil.cpp
connectivitylayer/group/bld.inf
connectivitylayer/isce/group/bld.inf
connectivitylayer/isce/isaaccessextension_dll/eabi/isakernelapiu.def
connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp
connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h
connectivitylayer/isce/isaaccessextension_dll/inc/isakernelchannel.h
connectivitylayer/isce/isaaccessextension_dll/inc/iscnokiadefinitions.h
connectivitylayer/isce/isaaccessextension_dll/inc/misiobjectrouterif.h
connectivitylayer/isce/isaaccessextension_dll/inc/misirouterobjectif.h
connectivitylayer/isce/isaaccessextension_dll/inc/router.h
connectivitylayer/isce/isaaccessextension_dll/src/indicationhandler.cpp
connectivitylayer/isce/isaaccessextension_dll/src/isaaccessextension.cpp
connectivitylayer/isce/isaaccessextension_dll/src/isakernelchannel.cpp
connectivitylayer/isce/isaaccessextension_dll/src/pep.cpp
connectivitylayer/isce/isaaccessextension_dll/src/peptransceiver.cpp
connectivitylayer/isce/isaaccessextension_dll/src/queue.cpp
connectivitylayer/isce/isaaccessextension_dll/src/router.cpp
connectivitylayer/isce/isaaccessldd_ldd/group/isaaccessesldd.mmp
connectivitylayer/isce/isaaccessldd_ldd/inc/isauserchannel.h
connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp
connectivitylayer/isce/iscapi_dll/group/isauserapi.mmp
connectivitylayer/isce/iscapi_dll/src/isaapi.cpp
connectivitylayer/isce/isiapi_dll/src/isiif.cpp
connectivitylayer/isce/isicommunicationmanager_dll/group/isicommunicationmanager.mmp
connectivitylayer/isce/isicommunicationmanager_dll/inc/ape_commgrisi.h
connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanager.h
connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanagertrace.h
connectivitylayer/isce/isicommunicationmanager_dll/inc/isiindicationhandler.h
connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp
connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp
connectivitylayer/isce/isinameservice_dll/eabi/isinameserviceu.def
connectivitylayer/isce/isinameservice_dll/group/isinameservice.mmp
connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h
connectivitylayer/isce/isinameservice_dll/inc/isinameservicetrace.h
connectivitylayer/isce/isinameservice_dll/inc/misicommunicationmanagerif.h
connectivitylayer/isce/isinameservice_dll/inc/namerecords.h
connectivitylayer/isce/isinameservice_dll/inc/nsisi.h
connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp
connectivitylayer/isce/isinameservice_dll/src/namerecords.cpp
connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h
connectivitylayer/isce/isirouter_dll/inc/misilinkrouterif.h
connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp
connectivitylayer/isce/isirouter_dll/src/isiif.cpp
connectivitylayer/isce/ismpmultiplexer_dll/group/ismpmultiplexer.mmp
connectivitylayer/isce/ismpmultiplexer_dll/inc/mux.h
connectivitylayer/isce/memmanager_dll/group/memmanager.mmp
connectivitylayer/isce/memmanager_dll/inc/memmanagertrace.h
connectivitylayer/isce/memmanager_dll/src/memmanager.cpp
connectivitylayer/isce/p2papi_dll/group/p2papi.mmp
connectivitylayer/isce/p2prouter_dll/group/p2prouter.mmp
connectivitylayer/isce/p2prouter_dll/inc/p2pinternaldefs.h
connectivitylayer/isce/p2prouter_dll/src/p2puserchannel.cpp
connectivitylayer/isce/rom/isce.iby
connectivitylayer/isimessage/group/bld.inf
connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp
connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp
connectivitylayer/isimessage/symbianisamacroif/include/variation/modem_infoisi.h
connectivitylayer/isimessage/symbianisamacroif/include/variation/nvdisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/at_modemisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/call_modemisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/comm_extisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/commisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/csdisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpds_sharedisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpdsisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gssisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/location_wmisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/mceisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/modem_infoisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/net_modemisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/nvdisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/pipeisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/smsisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/ss_wmisi.h
connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/uiccisi.h
connectivitylayer/rom/connectivitylayer.iby
connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/inc/usbpnclasscontroller.h
connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/src/usbpnclasscontroller.cpp
connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/traces/osttracedefinitions.h
connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp
connectivitylayer/usbphonetlink/usbpnclient_dll/traces/osttracedefinitions.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpninterface.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnscheduler.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnbufferlistener.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnalt.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpninterface.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnpacket.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnscheduler.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserversession.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/usbpnexe.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/traces/osttracedefinitions.h
--- a/_ccmwaid.inf	Mon Nov 09 10:36:19 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-/nokia/ou_nmp/groups/gscm/dbs/ou1cfspd/db
-5414757
-ou1cfspd#1/project/modemadaptation/MCL_200946_001
--- a/adaptationlayer/bcaiscadapter/bcatoisc_dll/group/bcatoisc.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/bcaiscadapter/bcatoisc_dll/group/bcatoisc.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,6 +20,7 @@
 #include <non_foundation_paths.hrh>
 #include <platform_paths.hrh>
 
+SMPSAFE
 TARGET		bcatoisc.dll
 TARGETTYPE	dll
 UID		0x1000008D 0x102857A0
--- a/adaptationlayer/dataport/dataport_csy/src/dpbreak.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpbreak.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -31,9 +31,9 @@
 #include "dplog.h"          // dataport logging
 
 #include <pipe_sharedisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpbreaktraces.h"
+#include "dpbreakTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dpcommpep.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpcommpep.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -28,9 +28,9 @@
 #include "dplog.h"          // dataport logging
 
 #include "pep_comm_types.h" // structures for isi-message interface
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpcommpeptraces.h"
+#include "dpcommpepTraces.h"
 #endif
 
 // LOCAL FUNCTION PROTOTYPES
--- a/adaptationlayer/dataport/dataport_csy/src/dpdatabuffer.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpdatabuffer.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include    "dpdataelement.h"           // data elements
 #include    "dpdataclient.h"            // data client that access buffer
 #include    "dplog.h"                   // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpdatabuffertraces.h"
+#include "dpdatabufferTraces.h"
 #endif
 
 // LOCAL FUNCTION PROTOTYPES
--- a/adaptationlayer/dataport/dataport_csy/src/dpdataconfig.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpdataconfig.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,9 +30,9 @@
 #include "dplog.h"          // dataport logging
 
 #include <pipe_sharedisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpdataconfigtraces.h"
+#include "dpdataconfigTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dpdataelement.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpdataelement.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,9 +22,9 @@
 #include "dpdataclient.h"  // data client that access buffer
 #include "dpdef.h"         // dataport definitions
 #include "dplog.h"         // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpdataelementtraces.h"
+#include "dpdataelementTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -377,7 +377,8 @@
     TInt ret( KErrNone );
     iSize = aSize;
 
-    if ( iDB.iHead > iDB.iTreshold )
+    if ( iDB.iHead > iDB.iTreshold ||
+        ( iDB.iHead + aSize ) > iDB.iBuf->Length() )
         {
         iDB.iHead = 0;
         }
--- a/adaptationlayer/dataport/dataport_csy/src/dpdataport.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpdataport.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -44,9 +44,9 @@
 #include "dptermdetect.h"        // terminal bytes detection
 #include "pep_comm_types.h"      // structures for isi-message interface
 #include "dplog.h"               // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpdataporttraces.h"
+#include "dpdataportTraces.h"
 #endif
 
 // LOCAL FUNCTION PROTOTYPES
--- a/adaptationlayer/dataport/dataport_csy/src/dpdte2tx.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpdte2tx.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,9 +26,9 @@
 #include "dpescdetect.h"  // escape sequence detection
 #include "dprx2dte.h"     // moves data from rx buffer to client
 #include "dplog.h"        // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpdte2txtraces.h"
+#include "dpdte2txTraces.h"
 #endif
 
 // LOCAL FUNCTION PROTOTYPES
--- a/adaptationlayer/dataport/dataport_csy/src/dpescdetect.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpescdetect.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -37,9 +37,9 @@
 extern RFile DpLogFile;
 #endif // USE_FILE_DEBUG
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpescdetecttraces.h"
+#include "dpescdetectTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "dppif.h"          // dcs pipe interface
 #include <iscdefinitions.h>
 #include "dplog.h"          // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpflowctrltraces.h"
+#include "dpflowctrlTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -170,6 +170,10 @@
             {
             iDataPort.DeleteDataPort();
             }
+        else
+            {
+            RequestIscFlowControlNotification();
+            }
         //no else
         }
     }
--- a/adaptationlayer/dataport/dataport_csy/src/dpmif.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpmif.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -29,9 +29,9 @@
 #include "dppif.h"      // pipe interface pif
 #include "dpcommpep.h"  // comm pep interface. interaction with mif
 #include "dplog.h"      // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpmiftraces.h"
+#include "dpmifTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dpobserver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpobserver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,9 +21,9 @@
 #include    "dpdef.h"                   // dataport definitions
 #include    "dpobserver.h"              // abstract observer class
 #include    "dplog.h"                   // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpobservertraces.h"
+#include "dpobserverTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/dataport/dataport_csy/src/dpparityhandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dpparityhandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,9 +21,9 @@
 #include    "dpdef.h"                   // dataport definitions
 #include    "dpparityhandler.h"         // parity bit handling (7-bit data mode)
 #include    "dplog.h"                   // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dpparityhandlertraces.h"
+#include "dpparityhandlerTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dppif.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dppif.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,9 +26,9 @@
 #include "dpmif.h"      // message inteface (mif)
 #include "dplog.h"      // dataport logging
 #include <pipe_sharedisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dppiftraces.h"
+#include "dppifTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dppn2rx.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dppn2rx.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,9 +26,9 @@
 #include "dpdataconfig.h"    // configuration store
 #include "dpparityhandler.h" // parity bit handling in 7-bit data mode
 #include "dplog.h"           // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dppn2rxtraces.h"
+#include "dppn2rxTraces.h"
 #endif
 
 
--- a/adaptationlayer/dataport/dataport_csy/src/dprx2dte.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dprx2dte.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,9 +26,9 @@
 #include "dpdataconfig.h" // configuration store
 #include "dptermdetect.h" // terminator detection
 #include "dplog.h"        // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dprx2dtetraces.h"
+#include "dprx2dteTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/dataport/dataport_csy/src/dptermdetect.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dptermdetect.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include    "dpstd.h"                   // fault codes etc.
 #include    "dpdataconfig.h"            // configuration store
 #include    "dplog.h"                   // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dptermdetecttraces.h"
+#include "dptermdetectTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/dataport/dataport_csy/src/dptx2pn.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/dataport/dataport_csy/src/dptx2pn.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -29,9 +29,9 @@
 #include "dpparityhandler.h" // parity bit handling in 7-bit data mode
 #include "pep_comm_types.h"  // pep_comm_types
 #include "dplog.h"           // dataport logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "dptx2pntraces.h"
+#include "dptx2pnTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_event_handler_ape_cent.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_event_handler_ape_cent.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -37,7 +37,7 @@
 #include "dmc_mce_isi.h"
 #include "dmc_trace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "dmc_event_handler_ape_centTraces.h"
 #endif
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_extension.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_extension.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -28,7 +28,7 @@
 #include "dmc_trace.h"
 #include "dmc_event_handler_ape_cent.h"
 
-#include "osttracedefinitions.h"    // For Open System Trace
+#include "OstTraceDefinitions.h"    // For Open System Trace
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "dmc_extensionTraces.h"
 #endif
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_channel.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_channel.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,7 +25,7 @@
 #include "dmc_logical_device.h"
 #include "dmc_trace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "dmc_logical_channelTraces.h"
 #endif
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_device.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_logical_device.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,7 +27,7 @@
 
 #include "dmc_trace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "dmc_logical_deviceTraces.h"
 #endif
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -32,7 +32,7 @@
 #include "dmc_mce_isi.h"
 #include "dmc_trace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "dmc_mce_isiTraces.h"
 #endif
--- a/adaptationlayer/devicemodecontroller/dmc_ext/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -17,5 +17,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/adaptationlayer/group/bld.inf	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/group/bld.inf	Thu Jan 14 10:44:58 2010 +0200
@@ -21,19 +21,11 @@
 PRJ_PLATFORMS
 DEFAULT
 
-
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-#include "../dataport/group/bld.inf"
-#endif
-
+#include "../bcaiscadapter/group/bld.inf"
+#include "../devicemodecontroller/group/bld.inf"
 #include "../modematadaptation/group/bld.inf"
-#include "../bcaiscadapter/group/bld.inf"
-
-#ifdef NCP_COMMON_BRIDGE_FAMILY
-#include "../devicemodecontroller/group/bld.inf"
 #include "../systemstatemanageradaptation/group/bld.inf"
 #include "../tsy/group/bld.inf"
-#endif
 
 PRJ_EXPORTS
 ../rom/adaptationlayer.iby					NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(adaptationlayer.iby)
--- a/adaptationlayer/modematadaptation/modematcommon_dll/group/modematcommon_dll.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcommon_dll/group/modematcommon_dll.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,6 +24,7 @@
 
 VENDORID VID_DEFAULT
 
+SMPSAFE
 TARGET      modemat_common.dll
 TARGETTYPE  PLUGIN
 UID         0x10009D8D 0x2001FCB4
--- a/adaptationlayer/modematadaptation/modematcommon_dll/src/modemat_common.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcommon_dll/src/modemat_common.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -121,7 +121,7 @@
         }
     if ( aMask & KModeVerbose )
         {
-        aMode |= iQuietMode * KVerboseModeBase;
+        aMode |= iVerboseMode * KVerboseModeBase;
         C_TRACE((_L("verbosemode %d"), aMode));
         }
     if ( aMask & KModeCarriage )
@@ -426,20 +426,17 @@
 void CModemAtCommon::HandleCommandModeChanged( TInt aErr, TCommandMode aMode )
     {
     C_TRACE((_L("CModemAtCommon::HandleCommandModeChanged( aErr: %d, aMode: %d) "), aErr, aMode));
-    ASSERT_PANIC_ALWAYS( aErr == KErrNone );
-    ASSERT_PANIC_ALWAYS( aMode != EIgnore );
-
-   iCommandMode = aMode;
-   TUint mode( 0 );
-   mode |= KCommandModeChanged;
-   if( aMode != EDataMode)
-       {
-       C_TRACE((_L("Not EDataMode")));
-       mode |= KModeCommand;
-       }
-   C_TRACE((_L("COMMON PLUGIN SendModeStatusChange: 0x%x"), mode));
-   SendModeStatusChange( mode );
-   }
+    iCommandMode = aMode;
+    TUint mode( 0 );
+    mode |= KCommandModeChanged;
+    if( aMode != EDataMode)
+        {
+        C_TRACE((_L("Not EDataMode")));
+        mode |= KModeCommand;
+        }
+    C_TRACE((_L("COMMON PLUGIN SendModeStatusChange: 0x%x"), mode));
+    SendModeStatusChange( mode );
+    }
 
 
 //  End of File
--- a/adaptationlayer/modematadaptation/modematcontroller_dll/group/modematcontroller_dll.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_dll/group/modematcontroller_dll.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,6 +23,7 @@
 
 
 
+SMPSAFE
 TARGET                  modematcontroller.dll
 TARGETTYPE              dll
 UID                     0x1000008d 0x2001FCB0
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/group/modematcontroller_exe.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/group/modematcontroller_exe.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,6 +21,7 @@
 #include <platform_paths.hrh>
 
 
+SMPSAFE
 TARGET                  modematcontroller.exe
 TARGETTYPE              exe
 UID                     0x1000008d 0x2001FCB1
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -87,15 +87,58 @@
      *  @return Disconnect status
      */
     TInt Disconnect( const  TUint8 aDteId );
+    
+    /**
+     *  Check if disconnect is called directly
+     *  @return ETrue if disconnect called directly
+     */
     TBool IsDisconnected();
+    
+    /**
+     *  HandleCommandModeChange
+     *  @param TUint8 aDteId
+     *  @param TCommandMode aMode
+     */
     void HandleCommandModeChange( TInt aDteid, TCommandMode aMode );
     
+    /**
+     *  SendAtModemDataRedirectResultReq
+     *  @param TUint8 aDteId
+     *  @param TUint aResult
+     */
     void SendAtModemDataRedirectResultReq( const TUint8 aDteId, const TUint aResult);
+
+    /**
+     *  SendEscapeSignalDetection
+     *  @param TUint8 aDteId
+     *  @return Symbian error code if error
+     */
     TInt SendEscapeSignalDetection( const TUint8 aDteId );
+
+    /**
+     *  HandleSignalDetectedResp
+     *  @param TIsiReceiveC aMessage
+     */
     void HandleSignalDetectedResp( const TIsiReceiveC& aMessage );
+
+    /**
+     *  RemovePipe
+     *  @param TUint8 aDteId
+     */
     void RemovePipe( const TUint8 aDteId );
+
+    /**
+     *  IsPluginConnected
+     *  @return ETrue if plugin is connected
+     */
     TBool IsPluginConnected();
 
+    /**
+     *  SetModemAtExistsInCmt
+     *  @param TBool aModemAtExistsInCmt
+     */
+    void SetModemAtExistsInCmt( TBool aModemAtExistsInCmt );
+
 protected:
     // from CActive
     void RunL();
@@ -111,25 +154,26 @@
      *  2nd phase constructor
      */
     void ConstructL();
- 
+    /**
+     *  Open ISI channel
+     */
     void OpenChannelL();
+
+    /**
+     *  ISI message handlers
+     */
     void HandleATResponse(const TIsiReceiveC& aMessage);
-
 #ifdef __WINSCW__
     void HandleATResponse( );
 #endif
     void HandleModemConnectResp( const TIsiReceiveC& aMessage);
     void HandleSignalInd(const TIsiReceiveC& aMessage);
     void HandleUnsolicitedData(const TIsiReceiveC& aMessage);
-
-    TInt GetMinSizeDividendByFour( TInt aSize);
-   
     void HandleIntermediateDataInd(const TIsiReceiveC& aMessage);
     void HandleRedirectInd(const TIsiReceiveC& aMessage);
     void HandleRedirectResultResp(const TIsiReceiveC& aMessage);
     void SetDisconnected( TBool aIsDisconnected );
 
-
 private:
     //data
     CModemAtSrv& iServer;
@@ -153,7 +197,7 @@
 #endif
     TUint8 iLastTransactionId[KMaxNumOfTransactionIds];
     TBool iDisconnected;
-    
+    TBool iModemAtExistInCmt;
     };
 
 #endif  // CMODEMATHANDLER_H
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h	Thu Jan 14 10:44:58 2010 +0200
@@ -95,7 +95,7 @@
     /**
      * Queries AT MODEM object id. 
      */
-    void SendTaskIdQuery();
+    void QueryModemAtFromNameService();
 #endif
 private:
     /**
@@ -208,8 +208,6 @@
     TInt  iPipeHandle;              //handle of created pipe 
     TUint iDataportDevId;           //Dataport device-id
     TUint iDataportObjId;           //Dataport obj-id
-    TUint iCellmoDevId;             //AT Modem device-id
-    TUint iCellmoObjId;             //AT Modem obj-id
     TPipeInfo iPipeTable[KMaxDteIdCount];   //created pipes
     CModemAtHandler& iAtHandler;    //forwards AT-commands to the AT MODEM
     CActiveSchedulerWait* iSchedulerWait;
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h	Thu Jan 14 10:44:58 2010 +0200
@@ -76,14 +76,14 @@
      * @return Number of sessions open
      */ 
     TInt SessionCount();
-    
+
     /**
      * Connect session to the modem  
      * @param CModemAtSession* aSession Pointer to the session
      * @return Connection status: KErrNone, KErrAlreadyExists
      */    
-    void ConnectToModem( CModemAtSession* aSession);
-    
+    TInt ConnectToModem( CModemAtSession* aSession);
+
     /**
      * HandleSignalInd  
      * @param aDteId Device Terminal ID
@@ -189,3 +189,4 @@
     };
 
 #endif  // CMODEMATSRV_H
+
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodemathandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodemathandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -97,17 +97,16 @@
     iReceivedMessage( NULL ),
     iPepObjId(0),
     iPipeController(NULL),
-    iDisconnected( EFalse )
+    iDisconnected( EFalse ),
+    iModemAtExistInCmt( EFalse )
     {
     C_TRACE (( _T("CModemAtHandler::CModemAtHandler") ));
-    
     }
 
 void CModemAtHandler::DoCancel()
     {
     C_TRACE (( _T("CModemAtHandler::DoCancel()") ));
     iIscApi->ReceiveCancel();
-    
     }
 
 
@@ -229,7 +228,7 @@
 #ifndef __WINSCW__
       OpenChannelL();
 #ifndef NCP_COMMON_BRIDGE_FAMILY
-      iPipeController->SendTaskIdQuery();
+      iPipeController->QueryModemAtFromNameService();
 #endif
 #else
       iEmulatedValue = 0;
@@ -237,16 +236,6 @@
     
     }
 
-
-TInt CModemAtHandler::GetMinSizeDividendByFour( TInt aSize)
-    {
-     C_TRACE (( _T("CModemAtHandler::GetMinSizeDividendByFour(%d)"),aSize ));
-     aSize += aSize % KAlignToFourBytes;
-      
-     C_TRACE (( _T("CModemAtHandler::GetMinSizeDividendByFour return: %d"),aSize ));
-     return aSize;
-    }
-
 TInt CModemAtHandler::SendATCommand(const TUint8 aDteId,
     const TATPluginInterface aPluginType,
     const TUint8 aMessageType,
@@ -273,7 +262,11 @@
 
     TInt size = ISI_HEADER_SIZE + AT_MODEM_CMD_REQ_OFFSET_CMDLINEBUFFER + aCmd.Length();
     
-    TInt sizeWithFillers = GetMinSizeDividendByFour( size );
+    TInt sizeWithFillers = size;
+    while( sizeWithFillers % KAlignToFourBytes )
+        {
+        sizeWithFillers++;
+        }
     C_TRACE((_L("Message length %d"), sizeWithFillers));
 
     HBufC8* message = HBufC8::New( sizeWithFillers );
@@ -424,7 +417,14 @@
     
 TInt CModemAtHandler::Connect(const TUint8 aDteId)
     {
-   C_TRACE (( _T("CModemAtHandler::Connect()") ));
+    C_TRACE (( _T("CModemAtHandler::Connect()") ));
+
+    if( !iModemAtExistInCmt )
+        {
+        C_TRACE((_T("Connection failed, PN_AT_MODEM is not in CMT")));
+        TRACE_ASSERT_ALWAYS;
+        return KErrNotFound;
+        }
 
     C_TRACE((_L("Connecting with dteid:%d "), aDteId));
     SetDisconnected( EFalse );
@@ -694,3 +694,9 @@
     TRACE_ASSERT( result == AT_MODEM_RESULT_OK );
     }
 
+void CModemAtHandler::SetModemAtExistsInCmt( TBool aModemAtExistsInCmt )
+    {
+    C_TRACE((_T("CModemAtHandler::SetModemAtExistsInCmt(%d)"), (TInt)aModemAtExistsInCmt));
+    iModemAtExistInCmt = aModemAtExistsInCmt;
+    }
+
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematpipecontroller.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematpipecontroller.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -38,8 +38,8 @@
 const TInt KInvalidDteId = -1;
 const TUint8 KFiller = 0;
 const TUint8 KDefaultTrId(0);
-const TUint8 KTaskIdQuerySize(20);
 #endif
+const TInt KLastByteIndex = 3;
 
 CModemAtPipeController* CModemAtPipeController::NewL( RIscApi& aIscApi,
     TUint& aObjId,
@@ -79,8 +79,6 @@
     iPipeHandle( KInvalidPipeHandle ),
     iDataportDevId( 0 ),
     iDataportObjId( 0 ),
-    iCellmoDevId( 0 ),
-    iCellmoObjId( 0 ),
     iAtHandler( aHandler ),
     iSchedulerWait( NULL ),
     iDteId( KInitialDteId )
@@ -111,7 +109,7 @@
             break;
 
         default:
-            ASSERT_PANIC_ALWAYS( EFalse ) ;
+            TRACE_ASSERT_ALWAYS;
             break;
         }
      }
@@ -119,6 +117,7 @@
  void CModemAtPipeController::HandlePipeServiceMessage( const TIsiReceiveC& aReceivedMessage)
      {
      C_TRACE (( _T("CModemAtPipeController::HandlePipeServiceMessage()") ));
+     C_TRACE((_L("message id: %d") , aReceivedMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) ));
      switch( aReceivedMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) )
         {
         case PNS_PIPE_CREATE_RESP:
@@ -147,7 +146,7 @@
             break;
 
         default:
-            ASSERT_PANIC_ALWAYS( EFalse );
+            TRACE_ASSERT_ALWAYS;
             break;
         }                            
      }
@@ -192,23 +191,27 @@
 void CModemAtPipeController::HandleNameAddInd( const TIsiReceiveC& aReceivedMessage )     
      {
      C_TRACE (( _T("CModemAtPipeController::HandleNameAddInd()") ));
-     TInt count = aReceivedMessage.Get16bit( ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG );
+     TInt matchesInThisMsg = aReceivedMessage.Get16bit( ISI_HEADER_SIZE +
+       PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG );
      
-     C_TRACE((_L("Count %d") ,count ));
+     C_TRACE((_L("matchesInThisMsg: %d") ,matchesInThisMsg ));
      TUint name = 0;
     
-     for( TInt i = 1; i <= count ; i++ ) 
+     for( TInt i = 1; i <= matchesInThisMsg; i++ ) 
          {
-         name = aReceivedMessage.Get32bit(ISI_HEADER_SIZE+PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i);
+         name = aReceivedMessage.Get32bit(ISI_HEADER_SIZE +
+           PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i);
          C_TRACE((_L("name [%d] 0x%x"), i ,name));
 
-         if( MatchDataportName(name) )   
+         if( MatchDataportName(name) )
              {
              iDataportDevId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-               PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_DEV );
+               PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i +
+               PN_NAME_SRV_ITEM_STR_OFFSET_DEV );
              iDataportObjId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-               PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_OBJ);
-             
+               PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i +
+               PN_NAME_SRV_ITEM_STR_OFFSET_OBJ);
+
              if( iDataportDevId == THIS_DEVICE )
                 {
                 C_TRACE((_L("CREATE PIPE FROM DATAPORT when ATEXT plugins connect (devid %x  o-bjid %x) "),iDataportDevId,iDataportObjId));
@@ -223,70 +226,70 @@
      }
 
 void CModemAtPipeController::HandleNameRemoveInd( const TIsiReceiveC& aReceivedMessage )     
-     {
-     C_TRACE (( _T("CModemAtPipeController::HandleNameRemoveInd()") ));
-     TInt count = aReceivedMessage.Get16bit( ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG );
-     
-     C_TRACE((_L("Count %d") ,count ));
-     TUint name = 0;
+    {
+    C_TRACE (( _T("CModemAtPipeController::HandleNameRemoveInd()") ));
+    TInt matchesInThisMsg = aReceivedMessage.Get16bit( ISI_HEADER_SIZE +
+      PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG );
     
-     for( TInt i = 1; i <= count ; i++ ) 
-         {
-         name = aReceivedMessage.Get32bit(ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i);
-         C_TRACE((_L("name [%d] 0x%x"), i ,name));
+    C_TRACE((_L("matchesInThisMsg: %d"), matchesInThisMsg ));
+    TUint name = 0;
+
+    for( TInt i = 1; i <= matchesInThisMsg; i++ ) 
+        {
+        name = aReceivedMessage.Get32bit(ISI_HEADER_SIZE +
+          PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i);
+        C_TRACE((_L("name [%d] 0x%x"), i ,name));
 
-         if( MatchDataportName(name) )   
-             {
-             TUint devId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-               PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_DEV );
-             TUint objId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-               PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_OBJ);
+        if( MatchDataportName(name) )
+            {
+            TUint devId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
+              PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i +
+              PN_NAME_SRV_ITEM_STR_OFFSET_DEV );
+            TUint objId = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
+              PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL * i +
+              PN_NAME_SRV_ITEM_STR_OFFSET_OBJ);
 
-             if( iDataportDevId == devId && iDataportObjId == objId )
-                {
-                C_TRACE((_L("Dataport removed from name service (devid %x  o-bjid %x) "),iDataportDevId,iDataportObjId));
-                iDataportDevId = 0;
-                iDataportObjId = 0;
-                }
-             else
-                {
-                C_TRACE((_L("Unused dataport removed from name service. DevId: 0x%x or ObjId 0x%x"), iDataportDevId, iDataportObjId ));
-                TRACE_ASSERT_ALWAYS;
-                }
-             }
-         }
-     }
+            if( iDataportDevId == devId && iDataportObjId == objId )
+               {
+               C_TRACE((_L("Dataport removed from name service (devid %x  o-bjid %x) "), iDataportDevId, iDataportObjId));
+               iDataportDevId = 0;
+               iDataportObjId = 0;
+               }
+            else
+               {
+               C_TRACE((_L("Unused dataport removed from name service. DevId: 0x%x or ObjId 0x%x"), iDataportDevId, iDataportObjId ));
+               TRACE_ASSERT_ALWAYS;
+               }
+            }
+        }
+    }
 
-
-void CModemAtPipeController::HandleNameQueryResp( const TIsiReceiveC& aReceivedMessage ) 
+void CModemAtPipeController::HandleNameQueryResp( const TIsiReceiveC& aReceivedMessage )
     {
     C_TRACE((_L("CModemAtPipeHandler::HandleNameQueryResp")));
-     
-    TInt count = aReceivedMessage.Get16bit( ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG );
-    C_TRACE((_L("Count d%d"), count ));
-    TInt name = 0;
+    TUint16 matchesInThisMsg( aReceivedMessage.Get16bit(
+        ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG ) );
+    C_TRACE((_L("matchesInThisMsg: %d"), matchesInThisMsg ));
+
     TBool found = EFalse;
-     
-    for( TInt i = 0; i < count ; i++ ) 
+    if( 0 < matchesInThisMsg )
         {
-        name = aReceivedMessage.Get32bit( ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL * i );
-        C_TRACE((_L("name [%d]%x"),i ,name ));
-        if(name == PN_AT_MODEM) 
+        for( TInt i = 0; i < matchesInThisMsg; i++ )
             {
-            iCellmoDevId =  aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-              PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_DEV );
-            iCellmoObjId =  aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
-              PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL * i +  PN_NAME_SRV_ITEM_STR_OFFSET_OBJ );
-            found = ETrue;
-            C_TRACE((_L("devid %x  objid %x"),iCellmoDevId,iCellmoObjId));
+            TInt recordIndex( i * SIZE_PN_NAME_SRV_ITEM_STR );
+            TUint8 name( aReceivedMessage.Get8bit(
+                ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL +
+                recordIndex + ( PN_NAME_SRV_ITEM_STR_OFFSET_NAME + KLastByteIndex ) ) );
+            C_TRACE((_L("name [%d] 0x%x"), i, name ));
+            if( PN_AT_MODEM == name )
+                {
+                C_TRACE((_L("PN_AT_MODEM found.")));
+                i = matchesInThisMsg;
+                found = ETrue;
+                }
             }
         }
-     
-    if( !found )
-        {
-        TRACE_ASSERT_ALWAYS;
-        User::Panic( _L("NO AT-MODEM"), KErrNotFound );
-        }
+    iAtHandler.SetModemAtExistsInCmt( found );
     }
 
 
@@ -319,7 +322,7 @@
      C_TRACE(_L("Created ISI-message"));
      DUMP_MESSAGE( messageptr );
      TInt retVal = iIscApi.Send( messageptr );
-     ASSERT_PANIC_ALWAYS( retVal == KErrNone );
+     TRACE_ASSERT( retVal == KErrNone );
      delete message;
      }
 
@@ -362,6 +365,12 @@
     {
     C_TRACE (( _T("CModemAtPipeController::LinkDteIdToPipe(0x%x)"), aDteId ));
     TRACE_ASSERT( aDteId < KMaxDteIdCount );
+    if( !(aDteId < KMaxDteIdCount) )
+        {
+        C_TRACE(( _T("CModemAtPipeController::LinkDteIdToPipe() illegal dteid %d"), aDteId ));
+        return;
+        }
+
     iDteId = aDteId;
     if( iDataportDevId == THIS_DEVICE )
         {
@@ -391,8 +400,21 @@
       PNS_PIPE_REMOVE_RESP_OFFSET_PIPEHANDLE );
 
     TInt dteId = FindDteId( pipehandle );
-    ASSERT_PANIC_ALWAYS( dteId < KMaxDteIdCount )
-    ASSERT_PANIC_ALWAYS( error == PN_PIPE_NO_ERROR )
+    
+    TRACE_ASSERT( dteId < KMaxDteIdCount )
+    if( !(dteId < KMaxDteIdCount) )
+        {
+        C_TRACE(( _T("CModemAtPipeController::HandlePipeRemoveResp() illegal dteid %d"), dteId ));
+        return;
+        }
+    
+    TRACE_ASSERT( error == PN_PIPE_NO_ERROR )
+    if( error != PN_PIPE_NO_ERROR )
+        {
+        C_TRACE(( _T("CModemAtPipeController::HandlePipeRemoveResp() error %d"), error ));
+        return;
+        }
+
     ChangePipeState( dteId, TPipeInfo::EPipeNoPipe );
 
     iPipeTable[ dteId ].iHandle = KInvalidPipeHandle; 
@@ -411,7 +433,14 @@
 void CModemAtPipeController::RemovePipe( const TUint8 aDteId )
     {
     C_TRACE (( _T("CModemAtPipeController::RemovePipe(%d, 0x%x)"), aDteId, this ));
-    ASSERT_PANIC_ALWAYS( aDteId < KMaxDteIdCount );
+
+    TRACE_ASSERT( aDteId < KMaxDteIdCount );
+    if( !(aDteId < KMaxDteIdCount) )
+        {
+        C_TRACE(( _T("CModemAtPipeController::RemovePipe() illegal dteid %d"), aDteId ));
+        return;
+        }
+
     C_TRACE (( _T("iPipeTable[aDteId]:0x%x"), &iPipeTable[aDteId] ));
     C_TRACE (( _T("iHandle: %d"), iPipeTable[aDteId].iHandle ));
     C_TRACE (( _T("i1stDevId: %d"), iPipeTable[aDteId].iFirstDevId ));
@@ -444,7 +473,7 @@
     C_TRACE((_L("Remove pipe handle %d"), aPipeHandle));
     TInt size = ISI_HEADER_SIZE + SIZE_PNS_PIPE_REMOVE_REQ;
     HBufC8* message = HBufC8::New( size );
-    ASSERT_PANIC_ALWAYS( message );
+    TRACE_ASSERT( message );
 
     TPtr8 messageptr = message->Des();
     TIsiSend isimessage( messageptr, size );
@@ -459,7 +488,7 @@
     C_TRACE(_L("Created ISI-message"));
 
     TInt retVal = iIscApi.Send( messageptr );
-    ASSERT_PANIC_ALWAYS( retVal == KErrNone );
+    TRACE_ASSERT( retVal == KErrNone );
     delete message;
     if( !iSchedulerWait )
         {
@@ -477,8 +506,18 @@
     {
     C_TRACE (( _T("CModemAtPipeController::RedirectPipe() dteid %d"), aDteId ));
     C_TRACE((_L("CModemAtPipeController::RedirectPipe() New pep, deviceId: 0x%x objId: 0x%x "), aNewDevId, aNewObjId));
-    ASSERT_PANIC_ALWAYS( aDteId < KMaxDteIdCount ) 
-    ASSERT_PANIC_ALWAYS( iPipeTable[aDteId].iHandle != KInvalidPipeHandle )
+    TRACE_ASSERT( aDteId < KMaxDteIdCount );
+    if( !(aDteId < KMaxDteIdCount) )
+        {
+        C_TRACE(( _T("CModemAtPipeController::RedirectPipe() illegal dteid %d"), aDteId ));
+        return;
+        }
+    TRACE_ASSERT( iPipeTable[aDteId].iHandle != KInvalidPipeHandle );
+    if( iPipeTable[aDteId].iHandle == KInvalidPipeHandle )
+        {
+        C_TRACE(( _T("CModemAtPipeController::RedirectPipe() invalid pipe handle %d"), iPipeTable[aDteId].iHandle ));
+        return;
+        }
 
     if( iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeRemoving || 
         iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeNoPipe ) 
@@ -501,7 +540,7 @@
     C_TRACE(_L("CModemAtPipeController::RedirectPipe() Redirecting pipe"));
 
     HBufC8* message = HBufC8::New( ISI_HEADER_SIZE + SIZE_PNS_PIPE_REDIRECT_REQ );
-    ASSERT_PANIC_ALWAYS( message ) 
+    ASSERT_PANIC_ALWAYS( message );
     TPtr8 messageptr = message->Des();
     TIsiSend isimessage( messageptr, ISI_HEADER_SIZE + SIZE_PNS_PIPE_REDIRECT_REQ );
     isimessage.Set8bit( ISI_HEADER_OFFSET_RESOURCEID,PN_PIPE);
@@ -534,7 +573,7 @@
 
     C_TRACE(_L("Created ISI-message"));
     TInt retVal = iIscApi.Send( messageptr );
-    ASSERT_PANIC_ALWAYS( retVal == KErrNone );
+    TRACE_ASSERT( retVal == KErrNone );
     delete message;
     }
  
@@ -574,15 +613,15 @@
 
     }
 
-void CModemAtPipeController::SendTaskIdQuery() 
+void CModemAtPipeController::QueryModemAtFromNameService() 
     {
-    C_TRACE (( _T("CModemAtPipeController::SendTaskIdQuery()") ));
-    HBufC8* message = HBufC8::New( KTaskIdQuerySize );
+    C_TRACE (( _T("CModemAtPipeController::QueryModemAtFromNameService()") ));
+    HBufC8* message = HBufC8::New( ISI_HEADER_SIZE + SIZE_PNS_NAME_QUERY_REQ );
     TRACE_ASSERT( message );
     if( message )
         {
         TPtr8 messageptr = message->Des();
-        TIsiSend isimessage( messageptr, KTaskIdQuerySize );
+        TIsiSend isimessage( messageptr, ISI_HEADER_SIZE + SIZE_PNS_NAME_QUERY_REQ );
         isimessage.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_NAMESERVICE );       
         isimessage.Set8bit( ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_UTID, KDefaultTrId );
         isimessage.Set8bit( ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_SUBFUNCTION, PNS_NAME_QUERY_REQ );
@@ -594,7 +633,7 @@
 
         DUMP_MESSAGE( messageptr );
         TInt retVal = iIscApi.Send( messageptr );
-        ASSERT_PANIC_ALWAYS( retVal == KErrNone );
+        TRACE_ASSERT( retVal == KErrNone );
         delete message;
         }
     }
@@ -615,7 +654,7 @@
 
     DUMP_MESSAGE( messageptr );
     TInt retVal = iIscApi.Send( messageptr );
-    ASSERT_PANIC_ALWAYS( retVal == KErrNone );
+    TRACE_ASSERT( retVal == KErrNone );
     delete message;
     }
 
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsession.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsession.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -164,7 +164,7 @@
 void CModemAtSession::DoServiceL( const RMessage2& aMessage )
     {
     C_TRACE (( _T("CModemAtSession::DoServiceL() function: %d message: 0x%x handle: 0x%x"), aMessage.Function(), &aMessage, aMessage.Handle() ));
-
+    TInt err( KErrNone );
     if( CheckAndCompleteExistingRequest( aMessage ) )
         {
         C_TRACE (( _T("CModemAtSession::DoServiceL() - return") ));
@@ -175,7 +175,7 @@
         {
         case EATExtSetExtensionInterface:
             C_TRACE(_L("EATExtSetExtensionInterface"));
-            iPluginType=(TATPluginInterface) aMessage.Int0();
+            iPluginType = (TATPluginInterface)aMessage.Int0();
             if(iClientName) 
                {
                 delete iClientName;
@@ -185,7 +185,8 @@
             iClientNamePtr.Set( iClientName->Des() );
             aMessage.Read( KATModemResponseArgumentIndex, iClientNamePtr );
             iConnectReq = aMessage;
-            iServer.ConnectToModem(this);
+            err = iServer.ConnectToModem( this );
+            ModemConnected( err );
             break;
 
         case  EReceiveUnsolicitedResult:
@@ -326,7 +327,7 @@
         {
         C_TRACE (( _T("Complete iConnectReq( %d )"), aErr ));
         iConnectReq.Complete(aErr);
-        }   
+        }
     }
 
 void CModemAtSession::SignalIndReceived() 
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -204,7 +204,7 @@
     C_TRACE ((_T("<<CModemAtSrv::HandleATResponse()") ));
     }
 
-void CModemAtSrv::ConnectToModem(CModemAtSession* aSession) 
+TInt CModemAtSrv::ConnectToModem(CModemAtSession* aSession) 
     {
     C_TRACE ((_T(">>CModemAtSrv::ConnectToModem 0x%x"), aSession));
     TInt type = aSession->GetPluginType();
@@ -224,22 +224,20 @@
                 {
                 TRACE_ASSERT_ALWAYS;
                 aSession->SetDteId( dteid );
-                aSession->ModemConnected((TInt)KErrAlreadyExists);
-                C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
-                return;
+                C_TRACE ((_T("<<CModemAtSrv::ConnectToModem KErrAlreadyExists 0x%x"), aSession));
+                return KErrAlreadyExists;
                 }
             //add current session to route table
             C_TRACE((_L("AddSessionToRouteTable type: %d, dteid: %d"), type, aSession->GetDteId()));
             iRouteTable[aSession->GetPluginType()][dteid] = aSession;
             C_TRACE((_L("Interface exists=> %d"),dteid));
-          
+
             aSession->SetDteId( dteid );
-            aSession->ModemConnected(KErrNone); //connected
-            C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
-            return;
+            C_TRACE ((_T("<<CModemAtSrv::ConnectToModem KErrNone 0x%x"), aSession));
+            return KErrNone;
             }
         }
-             
+
     //no AT-plugin& Common plugin, find first free dteid
     TInt dteId = 0;
     while(iRouteTable[0][dteId] || iRouteTable[1][dteId])
@@ -251,8 +249,8 @@
     C_TRACE((_L("Added new dteid: %d"),dteId));
 
     aSession->SetDteId(dteId);
-    iHandler->Connect(dteId);
-    C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
+    C_TRACE ((_T("<<CModemAtSrv::ConnectToModem session: 0x%x"), aSession));
+    return iHandler->Connect( dteId );
     }
 
 void CModemAtSrv::AddToSendFifo( const TUint8 aDteId,
--- a/adaptationlayer/modematadaptation/modematext_dll/group/modematext_dll.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematext_dll/group/modematext_dll.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,6 +24,7 @@
 
 VENDORID VID_DEFAULT
 
+SMPSAFE
 TARGET      modemat_atext.dll
 TARGETTYPE	PLUGIN
 UID         0x10009D8D 0x2001FCB2 
--- a/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,7 +20,7 @@
 #include "modemat_atext.h"
 #include "modemattrace.h"
 
-const TInt KMaxCommandCount(160);
+const TInt KMaxCommandCount(137);
 
 const char* const atCommands[] =
     {
@@ -158,29 +158,6 @@
     ("AT+CGTFT"),
     ("AT+CGCMOD"),
     ("AT+CBCIE"),
-    ("AT*NAUTODISC"),
-    ("AT*NRLP"),
-    ("AT*NSYNCSEQ"),
-    ("AT*NVTMODE"),
-    ("AT*NTRACE"),
-    ("AT*NNET"),
-    ("AT*NOKIAFBUS"),
-    ("AT*NPTTLOGIN"),
-    ("AT*NPTTLOGOFF"),
-    ("AT*NPTTATTACH"),
-    ("AT*NPTTDETACH"),
-    ("AT*NPTT"),
-    ("AT*NTESTSYSTEM"),
-    ("AT*NLOGGING"),
-    ("AT*NBALOCK"),
-    ("AT*NCHLOCK"),
-    ("AT*NCELLBARR"),
-    ("AT*NEOTD"),
-    ("AT*NTESTAUDIO"),
-    ("AT*NSECLOCK"),
-    ("AT*NSYSLOCK"),
-    ("AT*NUMAMODE"),
-    ("AT*NSMSROUTE"),
     ("AT"),
     ("LAST")
     };
--- a/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss	Thu Jan 14 10:44:58 2010 +0200
@@ -49,7 +49,7 @@
           implementation_uid = 0x20022E86;
           version_no = 1;
           display_name = "Modem AT EXT";
-          default_data = "PAT&S|PAT&S0|PAT&S1|PAT&K|PAT&K0|PAT&K3|PAT&K4|PATZ|PATZ0|PATZ1|PAT&F|PAT&F0|PATI|PAT+GMI|PAT+GMM|PAT+GMR|PAT+GSN|PAT+GCAP|PAT&V|PAT&V0|PAT&V1|PAT&V2|PAT&W|PAT&W0|PAT&W1|PAT&Y|PAT&Y0|PAT&Y1|PAT+CGMI|PAT+CGMM|PAT+CGMR|PAT+CGSN|PAT+CSCS|PAT+CIMI";
+          default_data = "PAT&S|PAT&S0|PAT&S1|PAT&K|PAT&K0|PAT&K3|PAT&K4|PATZ|PATZ0|PATZ1|PAT&F|PAT&F0|PAT+GMI|PAT+GMM|PAT+GMR|PAT+GSN|PAT+GCAP|PAT&V|PAT&V0|PAT&V1|PAT&V2|PAT&W|PAT&W0|PAT&W1|PAT&Y|PAT&Y0|PAT&Y1|PAT+CGMI|PAT+CGMM|PAT+CGMR|PAT+CGSN|PAT+CSCS|PAT+CIMI";
           opaque_data = "";
           rom_only = 0;
           },
@@ -76,16 +76,7 @@
           implementation_uid = 0x20022E89;
           version_no = 1;
           display_name = "Modem AT EXT";
-          default_data = "PAT+CGTFT|PAT+CGCMOD|PAT+CBCIE|PAT*NAUTODISC|PAT*NRLP|PAT*NSYNCSEQ|PAT*NVTMODE|PAT*NTRACE|PAT*NNET|PAT*NOKIAFBUS|PAT*NPTTLOGIN|PAT*NPTTLOGOFF|PAT*NPTTATTACH|PAT*NPTTDETACH|PAT*NPTT|PAT*NTESTSYSTEM|PAT*NLOGGING|PAT*NBALOCK|PAT*NCHLOCK|PAT*NCELLBARR";
-          opaque_data = "";
-          rom_only = 0;
-          },
-        IMPLEMENTATION_INFO
-          {
-          implementation_uid = 0x20022E8A;
-          version_no = 1;
-          display_name = "Modem AT EXT";
-          default_data = "PAT*NEOTD|PAT*NTESTAUDIO|PAT*NSECLOCK|PAT*NSYSLOCK|PAT*NUMAMODE|PAT*NSMSROUTE|PAT|PATD*";
+          default_data = "PAT+CGTFT|PAT+CGCMOD|PAT|PATD*|PATI|PATI0|PATI1|PATI2|PATI3|PATI4|PATI9|PATI10|PATI11";
           opaque_data = "";
           rom_only = 0;
           }
--- a/adaptationlayer/rom/adaptationlayer.iby	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/rom/adaptationlayer.iby	Thu Jan 14 10:44:58 2010 +0200
@@ -19,18 +19,11 @@
 #ifndef ADAPTATIONLAYER_IBY
 #define ADAPTATIONLAYER_IBY
 
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-#include <dataport.iby>
-#endif
-
+#include <bcaiscadapter.iby>
 #include <modematadaptation.iby>
-#include <bcaiscadapter.iby>
-
-#ifdef NCP_COMMON_BRIDGE_FAMILY
+#include <devicemodecontroller.iby>
 #include <sspluginsadaptation.iby>
 #include <tsy.iby>
-#include <devicemodecontroller.iby>
-#endif
 
 #endif // ADAPTATIONLAYER_IBY
 
--- a/adaptationlayer/systemstatemanageradaptation/group/bld.inf	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/group/bld.inf	Thu Jan 14 10:44:58 2010 +0200
@@ -26,15 +26,14 @@
 ../rom/sspluginsadaptation.iby    NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(sspluginsadaptation.iby)
 
 PRJ_MMPFILES
-    ../ssm_misc_adaptation_dll/group/miscadaptationref.mmp
-
+    ../ssm_misc_adaptation_dll/group/miscadaptation.mmp
+    ../ssm_emergencycallrf_adaptation_dll/group/emergencycallrfadaptation.mmp
     /* 
-    Only misc adaptation supported in the first phase. Others are commented out.
+    Only miscadaptation and emergencycallrfadaptation are supported. Others are commented out.
     
     ../ssm_state_adaptation_dll/group/stateadaptationref.mmp
     ../ssm_sim_adaptation_dll/group/simadaptationref.mmp
     ../ssm_rtc_adaptation_dll/group/rtcadaptationref.mmp
-    ../ssm_emergencycallrf_adaptation_dll/group/emergencycallrfadaptationref.mmp
     */
 
 //  End of File
Binary file adaptationlayer/systemstatemanageradaptation/iscservice/doc/sa_common_isc_service_design.doc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/inc/msa_isc_service.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* ==============================================================================
+*  Name:           msa_isc_service.h
+*  Part of:        System adaptation
+*  Description:    Declaration of MSAIscService class. MSAIscService class
+*                  defines an interface to System Adaptation plug-in clients.
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:13 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 MSAIscService class
+*
+*/
+
+
+#ifndef MSA_ISC_SERVICE_H
+#define MSA_ISC_SERVICE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  MSAIscService
+*  Interface class to System adaptation Common Isc service classes
+*
+*/
+class MSAIscService
+    {
+
+    public: // New functions
+        
+        /**
+        * Indicates System adaptation client about received isc message
+        * @param aData              Reference to received data
+        * @return none
+        */
+        virtual void ReceiveIsiMessageL( TDesC8& aData ) = 0;
+
+        /**
+        * Indicates System adaptation client about isc channel status change
+        * @param aErrorCode         Isc channel error code
+        * @return none
+        */
+        virtual void ProcessConnectionClosedL( TInt aErrorCode ) = 0;
+    };
+
+#endif      // MSA_ISC_SERVICE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_isc_service.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* ==============================================================================
+*  Name:           sa_common_isc_service.h
+*  Part of:        System adaptation
+*  Description:    Declaration of CSACommonIscService class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:16 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 CSACommonIscService class
+*
+*/
+
+
+#ifndef SA_COMMON_ISC_SERVICE_H
+#define SA_COMMON_ISC_SERVICE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <iscapi.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSACommonIscServiceChannelListener;
+class MSAIscService;
+
+// CLASS DECLARATION
+
+/**
+*  CSACommonIscService
+*  This class declarates System Adaptation plug-in module, which provides
+*  ISC interface for other System Adaptation plug-in modules.
+*
+*/
+class CSACommonIscService : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CSACommonIscService* NewL( MSAIscService& aAdaptation,
+            const TUint16 aChannelNumber,
+            TDes8* aEvents,
+            const TUint16 aClientISIMessageSize );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CSACommonIscService();
+
+    public: // Functions from base classes
+
+        /**
+        * This function is used to send messages via ISC channel
+        * @param aMessage              Reference to message
+        * @return                      none
+        */
+        void SendMessageL( TDesC8& aMessage );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSACommonIscService( MSAIscService& aAdaptation,
+            const TUint16 aChannelNumber,
+            const TUint16 aClientISIMessageSize );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( TDes8* aEvents );
+
+        /**
+        * From CActive
+        * This function receives messages from ISC API
+        * @return                      none
+        */
+        void RunL();
+
+        /**
+        * From CActive
+        * This function is called by Kernel when an outstading request is
+        * canceled with Cancel() function
+        * @return                      none
+        */
+        void DoCancel();
+
+        /**
+        * This function is used to subscribe reception of events via ISC API
+        * @param aEvents               Pointer to list of subscribed events
+        * @return                      none
+        */
+        void SubscribeEventsL( TDes8 *aEvents );
+
+        /**
+        * This function starts receiving messages via ISC channel
+        * @param aMessageLength        Length of message buffer required for
+        *                              received message
+        * @return                      none
+        */
+        void ReceiveMessageL( TUint16 aMessageLength );
+
+    private:    // Data
+
+        // Reference to Adaptation
+        MSAIscService& iAdaptation;
+
+        // ISC API interface object
+        RIscApi iIscApi;
+
+        // Pointer to ISC Channel lister object
+        CSACommonIscServiceChannelListener* iSACommonIscServiceChannelListener;
+
+        // Used ISC channel
+        TUint16 iChannelNumber;
+
+        // Min size of ISI message
+        TUint16 iClientISIMessageSize;
+
+        // Message data length of pending message 
+        TUint16 iMessageLength;
+
+        // Pointer to buffer descritor where a message data is received from ISC API
+        HBufC8* iBuffer;
+
+        // Modifiable pointer to message data buffer
+        TPtr8 iBufferPtr;
+    };
+
+#endif      // SA_COMMON_ISC_SERVICE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_isc_service_channel_listener.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* ==============================================================================
+*  Name:           sa_common_isc_service_channel_listener.h
+*  Part of:        System adaptation
+*  Description:    Declaration of CSACommonIscServiceChannelListener class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:19 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 CSACommonIscServiceChannelListener class
+*
+*/
+
+
+#ifndef SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_H
+#define SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MSAIscService;
+
+// CLASS DECLARATION
+
+/**
+*  CSACommonIscServiceChannelListener
+*
+*/
+class CSACommonIscServiceChannelListener : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        * @param aAdaptation           Reference to Adaptation
+        * @param aIscApi               Reference to ISC channel
+        * @return                      Pointer to created object
+        */
+        static CSACommonIscServiceChannelListener* NewL(
+            MSAIscService& aAdaptation,
+            RIscApi& aIscApi );
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSACommonIscServiceChannelListener();
+
+
+    private:
+
+        /**
+        * From CActive class
+        * This function receives messages via ISC channel
+        * @return                      none
+        */
+        void RunL();
+
+        /**
+        * From CActive class
+        * This function is called if RunL leaves
+        * @param aError                Leave cause
+        * @return                      KErrNone
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * From CActive class
+        * This function is called from CActive Cancel() method
+        * @return                      none
+        */
+        void DoCancel();
+
+        /**
+        * C++ default constructor.
+        * @param aAdaptation           Reference to Adaptation
+        * @param aIscApi               Reference to ISC channel
+        */
+        CSACommonIscServiceChannelListener(
+            MSAIscService& aAdaptation,
+            RIscApi& aIscApi );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:  // Data
+
+        // Reference to Adaptation
+        MSAIscService& iAdaptation;
+
+        // Reference to monitored ISC channel
+        RIscApi& iIscApi;
+
+        // Connection status to monitored ISC channel
+        TInt iConnectionStatus;
+
+    };
+
+#endif      // SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/inc/sa_common_trace.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 SA_COMMON_TRACE_H
+#define SA_COMMON_TRACE_H
+
+// INCLUDES
+#include <e32svr.h>
+
+// PC-LINT OPTIONS
+// Removes null statement not in line by itself warnings from 
+// COMPONENT_TRACE macros
+//lint -esym(960,54)
+
+// Removes "area too small" pointer cast warnings.
+//lint -e826
+
+// CONSTANTS
+
+// MACROS
+
+#ifdef _DEBUG
+
+    void BuildTraceFunc( const TDesC& aPrefix );
+    void AssertTraceFunc( const TDesC& aPrefix, const TDesC8& aFile, TInt aLine );
+    void DataDumpTraceFunc( const TDesC& aPrefix, const TDesC8& aData );
+    void IsiMsgApiTrace( const TDesC& aPrefix, const TDesC8& aData );
+
+    #define BUILD_TRACE( a ) BuildTraceFunc( a )
+    #define ASSERT_ALWAYS_TRACE( a ) AssertTraceFunc( a, _L8( __FILE__ ), __LINE__ )
+    #define ASSERT_TRACE( a, b) if( !b ) { ASSERT_ALWAYS_TRACE( a ); }
+
+    #define ADD_QUOTES(in) #in
+    #define BUILD_STRING(in) ADD_QUOTES(in)
+
+    #ifdef API_TRACE_FLAG
+
+        #define API_TRACE( a ) RDebug::Print a
+        #define DATA_DUMP_TRACE( a, b ) DataDumpTraceFunc( a, b )
+        #define ISIMSG_API_TRACE( a, b ) IsiMsgApiTrace( a, b )
+
+    #else // API_TRACE_FLAG
+
+        #define API_TRACE( a )
+        #define DATA_DUMP_TRACE( a, b )
+        #define ISIMSG_API_TRACE( a, b )
+
+    #endif // API_TRACE_FLAG
+
+    #ifdef INTERNAL_TRACE_FLAG
+
+        #define INTERNAL_TRACE( a ) RDebug::Print a 
+
+    #else // INTERNAL_TRACE_FLAG
+
+        #define INTERNAL_TRACE( a )
+
+    #endif // INTERNAL_TRACE_FLAG
+
+#else // _DEBUG
+
+    #define BUILD_TRACE( a )
+    #define ASSERT_TRACE( a, b)
+    #define ASSERT_ALWAYS_TRACE( a )
+    #define API_TRACE( a )
+    #define INTERNAL_TRACE( a )
+    #define DATA_DUMP_TRACE( a, b )
+    #define ISIMSG_API_TRACE( a, b )
+
+#endif // _DEBUG
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+#endif //SA_COMMON_TRACE_H
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_isc_service.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,385 @@
+/*
+* ==============================================================================
+*  Name:           sa_common_isc_service.cpp
+*  Part of:        System adaptation
+*  Description:    Implementation of CSACommonIscService class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:32 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 CSACommonIscService class
+*
+*/
+
+
+// INCLUDE FILES
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE 
+#include "sa_common_isc_serviceTraces.h"
+#endif
+#include <iscapi.h>
+#include <iscnokiadefinitions.h>    // For NokiaISC
+#include "sa_common_isc_service.h"
+#include "sa_common_isc_service_channel_listener.h"
+#include "sa_common_trace.h"
+#include "msa_isc_service.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// Minimum received message length
+// ( = Phonet header + ISI transaction id + ISI message id)
+const TUint8 KSASMinIscMessageLength = 10;
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::CSACommonIscService
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscService::CSACommonIscService( 
+    MSAIscService& aAdaptation,
+    const TUint16 aChannelNumber,
+    const TUint16 aClientISIMessageSize )
+    : CActive( CActive::EPriorityStandard )
+    , iAdaptation( aAdaptation )
+    , iChannelNumber( aChannelNumber )
+    , iClientISIMessageSize( aClientISIMessageSize )
+    , iMessageLength( 0 )
+    , iBuffer( NULL )
+    , iBufferPtr( NULL, 0 )
+    {
+    OstTraceExt3( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_1, 
+        "ISCSERVICE # CSACommonIscService::CSACommonIscService(0x%x,0x%x,0x%x)", 
+        (TUint)&aAdaptation, (TUint)aChannelNumber, (TUint)aClientISIMessageSize );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::CSACommonIscService(0x%x,0x%x,0x%x)" ), 
+        &aAdaptation, aChannelNumber, aClientISIMessageSize ) );
+
+    CActiveScheduler::Add( this );
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_2, 
+        "ISCSERVICE # CSACommonIscService::CSACommonIscService - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::CSACommonIscService - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::ConstructL( TDes8* aEvents )
+    {
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_3, 
+        "ISCSERVICE # CSACommonIscService::ConstructL(0x%x)", aEvents );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::ConstructL(0x%x)" ), aEvents ) );
+
+    TRequestStatus status;
+
+    /* Open ISC channel */
+    OstTrace0( TRACE_API, SA_COMMON_ISC_SERVICE_AUTOMATED_4, 
+        "ISCSERVICE - CSACommonIscService::ConstructL() - Opening ISC channel" );
+    API_TRACE( ( _L( "ISCSERVICE - CSACommonIscService::ConstructL() - Opening ISC channel" ) ) );
+    iIscApi.Open( iChannelNumber, status );
+    User::WaitForRequest( status );
+
+    if ( status.Int() != KErrNone )
+        {
+        ASSERT_ALWAYS_TRACE( _L( "ISCSERVICE - CSACommonIscService::ConstructL() - Failed to open ISC channel!") );
+        User::LeaveIfError( status.Int() );
+        }
+
+    if(aEvents)
+        {
+        /* Subscribe reception of events via ISC channel */
+        OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_5, 
+            "ISCSERVICE - CSACommonIscService::ConstructL() - Subscribe events" );
+        INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscService::ConstructL() - Subscribe events" ) ) );
+        SubscribeEventsL( aEvents );
+        }
+
+    /* Start receiving messages via ISC channel */
+    ReceiveMessageL( iClientISIMessageSize );
+
+    /* Create ISC channel listener to monitor the state of ISC channel */
+    iSACommonIscServiceChannelListener = CSACommonIscServiceChannelListener::NewL( iAdaptation, iIscApi );
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_6, 
+        "ISCSERVICE # CSACommonIscService::ConstructL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::ConstructL - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscService* CSACommonIscService::NewL( MSAIscService& aAdaptation,
+    const TUint16 aChannelNumber,
+    TDes8* aEvents,
+    const TUint16 aClientISIMessageSize )
+    {
+    OstTraceExt4( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_7, 
+        "ISCSERVICE # CSACommonIscService::NewL(0x%x,0x%x,0x%x,0x%x)", 
+        (TUint)&aAdaptation, (TUint)aChannelNumber, (TUint)aEvents, (TUint)aClientISIMessageSize );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::NewL(0x%x,0x%x,0x%x,0x%x)" ), 
+        &aAdaptation, aChannelNumber, aEvents, aClientISIMessageSize ) );
+
+    CSACommonIscService* self = new( ELeave ) CSACommonIscService( 
+        aAdaptation, 
+        aChannelNumber, 
+        aClientISIMessageSize );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aEvents );
+    CleanupStack::Pop( self );
+
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_8, 
+        "ISCSERVICE # CSACommonIscService::NewL - return 0x%x", self );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::NewL - return 0x%x" ), self ) );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::~CSACommonIscService
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscService::~CSACommonIscService()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_9, 
+        "ISCSERVICE # CSACommonIscService::~CSACommonIscService()" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::~CSACommonIscService()" ) ) );
+
+    /* Cancel any outstanding request */
+    Cancel();
+
+    /* Delete message buffer */
+    delete iBuffer;
+    iBuffer = NULL;
+
+    /* Cancel monitoring ISC channel state */
+    delete iSACommonIscServiceChannelListener;
+    iSACommonIscServiceChannelListener = NULL;
+
+    /* Close ISC channel */
+    OstTrace0( TRACE_API, SA_COMMON_ISC_SERVICE_AUTOMATED_10, 
+        "ISCSERVICE - CSACommonIscService::~CSACommonIscService - Close ISC channel" );
+    API_TRACE( ( _L( "ISCSERVICE - CSACommonIscService::~CSACommonIscService - Close ISC channel" ) ) );
+    iIscApi.Close();
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_11, 
+        "ISCSERVICE # CSACommonIscService::~CSACommonIscService - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::~CSACommonIscService - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::SendMessageL
+// This function is used to send a message via ISC channel
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::SendMessageL(
+    TDesC8& aMessage )
+    {
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_12, 
+        "ISCSERVICE # CSACommonIscService::SendMessageL(0x%x)", (TUint)&aMessage );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::SendMessageL(0x%x)" ), (TUint)&aMessage ) );
+
+    OstTrace1( TRACE_API, SA_COMMON_ISC_SERVICE_AUTOMATED_13, 
+        "ISCSERVICE - CSACommonIscService::SendMessageL() - Sending ISI Message;aData=%x",
+        (TUint)&aMessage );
+    ISIMSG_API_TRACE( _L("ISCSERVICE # CSACommonIscService::SendMessageL() - Sending ISI Message: "), aMessage);
+
+    User::LeaveIfError( iIscApi.Send( aMessage ) );
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_14, 
+        "ISCSERVICE # CSACommonIscService::SendMessageL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::SendMessageL - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::ReceiveMessageL
+// This function starts receiving messages via ISC channel
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::ReceiveMessageL( TUint16 aMessageLength )
+    {
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_16, 
+        "ISCSERVICE # CSACommonIscService::ReceiveMessageL(0x%x)", aMessageLength );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::ReceiveMessageL(0x%x)" ), 
+        aMessageLength ) );
+
+    if ( !IsActive() )
+        {
+
+        OstTrace0( TRACE_API, SA_COMMON_ISC_SERVICE_AUTOMATED_17, 
+            "ISCSERVICE - CSACommonIscService::ReceiveMessageL() - Receiving message" );
+        API_TRACE( ( _L( "ISCSERVICE - CSACommonIscService::ReceiveMessageL() - Receiving message" ) ) );
+
+        /* Reserve space for the received message buffer */
+        delete iBuffer;
+        iBuffer = NULL;
+        iBuffer = HBufC8::NewL( aMessageLength );
+        iBufferPtr.Set( iBuffer->Des() );
+
+        /* Start receiving messages via ISC channel */
+        iMessageLength = 0;
+        iIscApi.Receive( iStatus, iBufferPtr, iMessageLength );
+        SetActive();
+        }
+    else
+        {
+        /* Receiving request pending */
+        ASSERT_ALWAYS_TRACE( _L( "ISCSERVICE - CSACommonIscService::ReceiveMessageL() - Request pending") );
+        }
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_18, 
+        "ISCSERVICE # CSACommonIscService::ReceiveMessageL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::ReceiveMessageL - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::RunL
+// This function is called when a message is received via ISC channel
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::RunL()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_19, 
+        "ISCSERVICE # CSACommonIscService::RunL()" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::RunL()" ) ) );
+
+    TInt err( KErrNone );
+    TUint16 length( iClientISIMessageSize );
+
+    switch ( iStatus.Int() )
+        {
+        case KErrNone:
+            if ( iBufferPtr.Length() >= KSASMinIscMessageLength )
+                {
+                /* Forward receive message to System Adaptation proxy */
+                OstTrace1( TRACE_API, SA_COMMON_ISC_SERVICE_AUTOMATED_20, 
+                    "ISCSERVICE - CSACommonIscService::RunL() - Receive ISI Message;iBufferPtr=%x", 
+                    (TUint)&(iBufferPtr) );
+                ISIMSG_API_TRACE( _L("ISCSERVICE - CSACommonIscService::RunL() - Receive ISI Message: " ), 
+                    iBufferPtr);
+
+                TRAP( err, iAdaptation.ReceiveIsiMessageL( iBufferPtr ) );
+                ASSERT_TRACE( _L( "ISCSERVICE - CSACommonIscService::RunL() - Processing message failed" ), 
+                    ( err == KErrNone ) );
+                }
+            else
+                {
+                ASSERT_ALWAYS_TRACE( _L( "ISCSERVICE - CSACommonIscService::RunL() - Invalid message" ) );
+                }
+            break;
+
+        case KErrNoMemory:
+            OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_21, 
+                "ISCSERVICE # CSACommonIscService::RunL() - Reallocate message buffer" );
+            INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::RunL() - Reallocate message buffer" ) ) );
+            /* Reserved message buffer overflow -
+               Reallocate message buffer and receive the message again
+               ( iMessageLength contains the required buffer length for the message ) */
+            length = iMessageLength;
+            break;
+
+        default:
+            /* Other errors are ignored - Continue receiving messages via ISC channel */
+            ASSERT_ALWAYS_TRACE( _L( "ISCSERVICE - CSACommonIscService::RunL() - Other error" ) );
+            break;
+        }
+
+    /* Continue receiving messages via ISC channel */
+    TRAP( err, ReceiveMessageL( length ) );
+
+    if ( err != KErrNone )
+        {
+        ASSERT_ALWAYS_TRACE( _L( "ISCSERVICE - CSACommonIscService::RunL() - Memory allocation failed" ) );
+        User::Panic( _L( "ISCSERVICE - CSACommonIscService" ), err );
+        }
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_22, 
+        "ISCSERVICE # CSACommonIscService::RunL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::RunL - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::DoCancel
+// This function cancels the receiving messages via ISC channel
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::DoCancel()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_23, 
+        "ISCSERVICE # CSACommonIscService::DoCancel()" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::DoCancel()" ) ) );
+
+    iIscApi.ReceiveCancel();
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_24, 
+        "ISCSERVICE # CSACommonIscService::DoCancel - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::DoCancel - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscService::SubscribeEvents
+// This function subscribes reception of events via ISC channel
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscService::SubscribeEventsL( TDes8 *aEvents )
+    {
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_25, 
+        "ISCSERVICE # CSACommonIscService::SubscribeEventsL(0x%x)", aEvents );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::SubscribeEventsL(0x%x)" ), aEvents ) );
+
+    User::LeaveIfError( iIscApi.CustomFunction( EIscNokiaEventSubscribe, aEvents ) );
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_AUTOMATED_26, 
+        "ISCSERVICE # CSACommonIscService::SubscribeEventsL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE # CSACommonIscService::SubscribeEventsL - return void" ) ) );
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_isc_service_channel_listener.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* ==============================================================================
+*  Name:           sa_common_isc_service_channel_listener.cpp
+*  Part of:        System adaptation
+*  Description:    Implementation of CSACommonIscServiceChannelListener class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:35 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 CSACommonIscServiceChannelListener class
+*
+*/
+
+
+// INCLUDE FILES
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE 
+#include "sa_common_isc_service_channel_listenerTraces.h"
+#endif
+#include <iscapi.h>
+#include <iscnokiadefinitions.h>    // For NokiaISC
+#include "sa_common_trace.h"
+#include "sa_common_isc_service_channel_listener.h"
+#include "msa_isc_service.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 ===============================
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(
+    MSAIscService& aAdaptation,
+    RIscApi& aIscApi )
+    : CActive( CActive::EPriorityStandard )
+    , iAdaptation( aAdaptation )
+    , iIscApi( aIscApi )
+    {
+    OstTraceExt2( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_1,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(0x%x,0x%x)",
+        (TUint)&aAdaptation, (TUint)&aIscApi );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener(0x%x,0x%x)" ), 
+        &aAdaptation, &aIscApi ) );
+
+    CActiveScheduler::Add( this );
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_2,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener - return void" );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::CSACommonIscServiceChannelListener - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscServiceChannelListener::ConstructL()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_3,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::ConstructL()" );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::ConstructL()" ) ) );
+
+    iIscApi.NotifyConnectionStatus( iStatus, iConnectionStatus );
+    SetActive();
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_4,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::ConstructL - return void" );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::ConstructL - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscServiceChannelListener* CSACommonIscServiceChannelListener::NewL(
+    MSAIscService& aAdaptation, 
+    RIscApi& aIscApi)
+    {
+    OstTraceExt2( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_5,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::NewL(0x%x,0x%x)",
+        (TUint)&aAdaptation, (TUint)&aIscApi );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::NewL(0x%x,0x%x)" ),
+        &aAdaptation, &aIscApi ) );
+
+    CSACommonIscServiceChannelListener* self = new( ELeave ) CSACommonIscServiceChannelListener( 
+        aAdaptation, 
+        aIscApi );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_6,
+        "ISCSERVICE - CSACommonIscServiceChannelListener::NewL - return 0x%x", self );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::NewL - return 0x%x" ),
+        self ) );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_7, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener()" );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener()" ) ) );
+
+    /* Cancel outstanding request */
+    Cancel();
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_8, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener - return void" );
+    INTERNAL_TRACE( ( 
+        _L( "ISCSERVICE - CSACommonIscServiceChannelListener::~CSACommonIscServiceChannelListener - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::RunL
+// This function is called by Kernel when ISC API completes outstanding request
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscServiceChannelListener::RunL()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_9, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::RunL()" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL()" ) ) );
+
+    ASSERT_TRACE( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL" ),
+        ( iStatus.Int() == KErrNone ) );
+    ASSERT_TRACE( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL" ),
+        ( iConnectionStatus == EIscConnectionNotOk ) );
+
+    if(iConnectionStatus != EIscConnectionOk)
+        {
+        iAdaptation.ProcessConnectionClosedL( iConnectionStatus );
+        INTERNAL_TRACE( ( 
+            _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL - Isc channel closed!" ) ) );
+        }
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_10, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::RunL - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::RunError
+// This function is called if RunL leaves
+// -----------------------------------------------------------------------------
+//
+TInt CSACommonIscServiceChannelListener::RunError( TInt aError )
+    {
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_11, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::RunError(ox%x)", aError );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunError(ox%x)" ), 
+        aError ) );
+
+    aError = aError;
+
+    ASSERT_ALWAYS_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunError" ) ) );
+
+    OstTrace1( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_12, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::RunL - return 0x%x", KErrNone );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::RunL - return 0x%x" ), 
+        KErrNone ) );
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CSACommonIscServiceChannelListener::DoCancel
+// This function is called from CActive objects Cancel method.
+// -----------------------------------------------------------------------------
+//
+void CSACommonIscServiceChannelListener::DoCancel()
+    {
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_13, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::DoCancel()" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::DoCancel()" ) ) );
+
+    iIscApi.NotifyConnectionStatusCancel();
+
+    OstTrace0( TRACE_NORMAL, SA_COMMON_ISC_SERVICE_CHANNEL_LISTENER_AUTOMATED_14, 
+        "ISCSERVICE - CSACommonIscServiceChannelListener::DoCancel - return void" );
+    INTERNAL_TRACE( ( _L( "ISCSERVICE - CSACommonIscServiceChannelListener::DoCancel - return void" ) ) );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/iscservice/src/sa_common_trace.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* ==============================================================================
+*  Name:           sa_common_trace.cpp
+*  Part of:        System adaptation
+*  Description:    Implementation of System Adaptation common traces
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:59:38 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 System Adaptation common traces
+*
+*/
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <pn_const.h>
+
+#include "sa_common_trace.h"
+
+#ifdef _DEBUG
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KSASDataDumpTraceBytesPerLine( 10 );
+
+_LIT8( KSATraceBuildDate, __DATE__ );
+_LIT8( KSATraceBuildTime, __TIME__ );
+
+_LIT( KSATraceDataDumpStart, " [ " );
+_LIT( KSATraceDataDumpLineAlign, "   " );
+_LIT( KSATraceDataDumpStop, " ] " );
+
+_LIT( KSATraceDataDumpValue, "%02x " );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= TRACE FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// AssertTraceFunc
+// -----------------------------------------------------------------------------
+void AssertTraceFunc( const TDesC& aPrefix, const TDesC8& aFile, TInt aLine )
+    {
+    HBufC* buffer = HBufC::New( aFile.Length() + 1 );
+    HBufC* date = HBufC::New( 32 );
+    HBufC* time = HBufC::New( 32 );
+
+    if ( ( buffer ) && ( date ) && ( time ) )
+        {
+        buffer->Des().Copy( aFile );
+        date->Des().Copy( KSATraceBuildDate );
+        time->Des().Copy( KSATraceBuildTime );
+        RDebug::Print( _L( "%S Assertion failed: file=%S, line=%d, compiled=%S %S" ),
+            &aPrefix, buffer, aLine, date, time );
+        }
+    else
+        {
+        RDebug::Print( _L( "Assertion and memory allocation failed" ) );
+        }
+
+    delete buffer;
+    delete date;
+    delete time;
+    }
+
+
+// -----------------------------------------------------------------------------
+// BuildTraceFunc
+// -----------------------------------------------------------------------------
+void BuildTraceFunc( const TDesC& aPrefix )
+    {
+    HBufC* buffer = HBufC::New( aPrefix.Length() + 1 );
+    HBufC* date = HBufC::New( 32 );
+    HBufC* time = HBufC::New( 32 );
+
+    if ( ( buffer ) && ( date ) && ( time ) )
+        {
+        buffer->Des().Copy( aPrefix );
+        date->Des().Copy( KSATraceBuildDate );
+        time->Des().Copy( KSATraceBuildTime );
+        RDebug::Print( _L( "%s: compiled=%s %s" ), buffer->Des().PtrZ(),
+            date->Des().PtrZ(), time->Des().PtrZ() );
+
+#ifdef __WINS__
+        RDebug::Print( _L( "%s: __WINS__                            enabled" ),
+            buffer->Des().PtrZ() );
+#else
+        RDebug::Print( _L( "%s: __WINS__                            disabled" ),
+            buffer->Des().PtrZ() );
+#endif
+
+#ifdef _DEBUG
+        RDebug::Print( _L( "%s: _DEBUG                              enabled" ),
+            buffer->Des().PtrZ() );
+#else
+        RDebug::Print( _L( "%s: _DEBUG                              disabled" ),
+            buffer->Des().PtrZ() );
+#endif
+
+#ifdef SA_MODULE_TEST_FLAG
+        RDebug::Print( _L( "%s: SA_MODULE_TEST_FLAG                 enabled" ),
+            buffer->Des().PtrZ() );
+#else
+        RDebug::Print( _L( "%s: SA_MODULE_TEST_FLAG                 disabled" ),
+            buffer->Des().PtrZ() );
+#endif
+        }
+    delete buffer;
+    delete date;
+    delete time;
+    }
+
+
+// -----------------------------------------------------------------------------
+// DataDumpTraceFunc
+// -----------------------------------------------------------------------------
+void DataDumpTraceFunc( const TDesC& aPrefix, const TDesC8& aData )
+    {
+    HBufC* buffer = HBufC::New( 255 ); // TODO: max line length
+
+    if ( buffer )
+        {
+        buffer->Des().Copy( aPrefix );
+        buffer->Des().Append( KSATraceDataDumpStart );
+        for ( TInt i = 0; i < aData.Length(); i++)
+            {
+            buffer->Des().AppendFormat( KSATraceDataDumpValue,  aData[i] );
+
+            if( (i % KSASDataDumpTraceBytesPerLine == ( KSASDataDumpTraceBytesPerLine - 1 ) ) 
+                && (i + 1 < aData.Length()) )
+                {
+                RDebug::Print( buffer->Des() );
+
+                buffer->Des().Copy( aPrefix);
+                buffer->Des().Append( KSATraceDataDumpLineAlign );
+                }
+            }
+        buffer->Des().Append( KSATraceDataDumpStop );
+
+        RDebug::Print( buffer->Des() );
+
+        }
+    delete buffer;
+    }
+
+// -----------------------------------------------------------------------------
+// IsiMsgApiTrace
+// -----------------------------------------------------------------------------
+
+void IsiMsgApiTrace(const TDesC& aPrefix, const TDesC8& aData)
+    {
+    }
+
+#endif
+
+//  End of File  
--- a/adaptationlayer/systemstatemanageradaptation/rom/sspluginsadaptation.iby	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/rom/sspluginsadaptation.iby	Thu Jan 14 10:44:58 2010 +0200
@@ -22,15 +22,15 @@
 
 
 /* 
-Only misc adaptation supported in the first phase. Others are commented out.
+Only miscadaptation and emergencycallrfadaptation are supported. Others are commented out.
 
 file=ABI_DIR\BUILD_DIR\ssm_state_adaptation.dll             sys\bin\ssm_state_adaptation.dll
 file=ABI_DIR\BUILD_DIR\ssm_sim_adaptation.dll               sys\bin\ssm_sim_adaptation.dll
 file=ABI_DIR\BUILD_DIR\ssm_rtc_adaptation.dll               sys\bin\ssm_rtc_adaptation.dll
-file=ABI_DIR\BUILD_DIR\ssm_emergencycallrf_adaptation.dll   sys\bin\ssm_emergencycallrf_adaptation.dll
 */
 
-file=ABI_DIR\BUILD_DIR\miscadaptationref.dll                sys\bin\miscadaptationref.dll
+file=ABI_DIR\BUILD_DIR\miscadaptation.dll                   sys\bin\miscadaptation.dll
+file=ABI_DIR\BUILD_DIR\emergencycallrfadaptation.dll        sys\bin\emergencycallrfadaptation.dll
 
 #endif //__SSPLUGINSADAPTATION_IBY__
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/bwins/ssm_emergencycallrf_adaptation.def	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/eabi/ssm_emergencycallrf_adaptation.def	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z32CreateEmergencyCallRfAdaptationLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/group/emergencycallrfadaptation.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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.
+*
+*/
+
+
+#include        <platform_paths.hrh>
+#include        <non_foundation_paths.hrh>
+
+TARGET          emergencycallrfadaptation.dll 
+TARGETTYPE      dll
+
+// UID2 value from ssmadaptation.h ( KEmergencyCallRfAdaptationDllTypeUidValue 0x2000E657 )
+UID             0x2000E657 0x20022D91 // UID3 emergencycallrfadaptation.dll
+VENDORID        VID_DEFAULT
+
+CAPABILITY      PowerMgmt ReadDeviceData WriteDeviceData ProtServ SwEvent ReadUserData WriteUserData CommDD
+
+// Has a fixed interface emergencycallrfadaptation.def
+NOEXPORTLIBRARY 
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../traces
+
+OS_LAYER_SYSTEMINCLUDE
+NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          ssm_emergencycallrf_adaptation.cpp
+SOURCE          ssm_emergencycallrf_trcommand.cpp
+
+// -u suffix behaviour can be removed by using nostrictdef
+NOSTRICTDEF
+DEFFILE         ssm_emergencycallrf_adaptation.def
+
+USERINCLUDE     ../../iscservice/inc
+SOURCEPATH      ../../iscservice/src
+SOURCE          sa_common_isc_service.cpp
+SOURCE          sa_common_isc_service_channel_listener.cpp
+SOURCE          sa_common_trace.cpp
+
+LIBRARY         euser.lib
+LIBRARY         isimessage.lib
+LIBRARY         iscapi.lib
+
+SMPSAFE
+
+MACRO API_TRACE_FLAG
+MACRO INTERNAL_TRACE_FLAG
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_adaptation.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,178 @@
+/*
+* ==============================================================================
+*  Name:           ssm_emergencycallrf_adaptation.h
+*  Part of:        SSMA EmergencyCallRfAdaptation
+*  Interface:      N/A
+*  Description:    Declaration of CEmergencyCallRfAdaptation class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:37:57 2009 %
+* 
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Emergencycallrf_adaptation class declarations.
+*
+*/
+
+#ifndef SSM_EMERGENCYCALLRF_ADAPTATION_H
+#define SSM_EMERGENCYCALLRF_ADAPTATION_H
+
+//INCLUDES
+#include <ssm/ssmadaptation.h>
+#include <e32debug.h>
+#include "msa_isc_service.h"
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEmergencyCallRfTrCommand;
+class CSACommonIscService;
+
+// CLASS DECLARATION
+
+/**
+ Reference Emergency Call RF adaptation plug-in.
+ Implements MEmergencyCallRfAdaptation to Activate and Deactivate RF for emergency calls.
+
+ @internalComponent
+ @released
+
+ @see MEmergencyCallRfAdaptation
+*/
+class CEmergencyCallRfAdaptation : public CBase, public MEmergencyCallRfAdaptation, public MSAIscService
+    {
+public:
+    static CEmergencyCallRfAdaptation* NewL();
+
+    //from MEmergencyCallRfAdaptation
+    /*
+    * Deletes and frees memory allocated.
+    */
+    void Release();
+
+    /**
+    * Request RF activation so that an emergency call can be made.
+    * @param aStatus to complete when the operation has finished
+    * @see TRequestStatus 
+    */
+    void ActivateRfForEmergencyCall( TRequestStatus& aStatus );
+
+    /**
+    * Request RF deactivation after an emergency call have been made.
+    * @param aStatus to complete when the operation has finished
+    * @see TRequestStatus 
+    */
+    void DeactivateRfForEmergencyCall( TRequestStatus& aStatus );
+
+    /**
+    * Cancel the outstanding request.
+    */
+    void Cancel(); 
+
+private:
+
+    /**
+    * C++ constructor.
+    */
+    CEmergencyCallRfAdaptation();
+
+    /**
+    * 2nd phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Forwards message to an ongoing transaction.
+    * @param aCommandId             Identification of current command
+    * @param aTransId               Unique transaction id
+    * @param aData                  Data associated with the command.
+    * @param aNewTransactionPtr     Pointer to the transaction
+    * @return none
+    */
+    void ForwardMessageL( const TInt aCommandId,
+                          const TUint8 aTransId,
+                          TDesC8& aData,
+                          CEmergencyCallRfTrCommand* aNewTransactionPtr );
+
+    /**
+    * Returns new transaction id
+    *
+    * @since S60 v3.1
+    * @return TInt new transaction id
+    */
+    TInt TransactionId();
+
+    /**
+    * Destructor.
+    */
+    ~CEmergencyCallRfAdaptation();
+
+public: // From MSAIscService
+
+    /**
+    * Sends ISI messages
+    * @return none
+    */
+    void SendIsiMessageL( TDesC8& aData );
+	
+    /**
+    * Indicates SSMA Adaptation client about received response message
+    * @return none
+    */
+    void ReceiveIsiMessageL( TDesC8& aData );
+
+	/**
+    * Indicates System Services client about received error response message
+    * @return none
+    */
+    void ProcessConnectionClosedL( TInt aErrorCode );
+
+public: /* functions */
+
+    /**
+    * Indicates SSMA adaptation client about received response message
+    * @param aErrCode               ErrorCode
+    * @return none
+    */
+    void ProcessResponseL( TInt aErrCode );
+
+
+private: /* Data */
+
+    // Handle for ISC message sending/receiving
+    CSACommonIscService* iCSACommonIscServicePtr;
+
+    // Array of Ongoing Transactions
+    RPointerArray<CEmergencyCallRfTrCommand> iTransactionPtr;
+
+    // Ongoing command
+    TInt iCommandId;
+
+    // Cancel command
+    TBool iCancelCommand;
+
+    // Response Status
+    TRequestStatus* iStatusPtr;
+
+    // Transaction id
+    TInt iTransId;
+
+    };
+
+#endif // SSM_EMERGENCYCALLRF_ADAPTATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_trcommand.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* ==============================================================================
+*  Name:           ssm_emergencycallrf_trcommand.h
+*  Part of:        SSMA EmergencyCallRfAdaptation
+*  Interface:      N/A
+*  Description:    Declaration of CEmergencyCallRfTrCommand class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:38:00 2009 %
+*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* CEmergencyCallRfTrCommand class declarations
+*/
+
+#ifndef SSM_EMERGENCYCALLRF_TRCOMMAND_H
+#define SSM_EMERGENCYCALLRF_TRCOMMAND_H
+
+//  INCLUDES
+#include <e32base.h>
+#include "ssm_emergencycallrf_adaptation.h"
+
+// CONSTANTS
+
+// Constants for iTransactionState
+#define EMERGENCYCALLRF_TR_INIT      0x00
+#define EMERGENCYCALLRF_TR_ONGOING   0x01
+#define EMERGENCYCALLRF_TR_COMPLETED 0x02
+#define EMERGENCYCALLRF_TR_FAILED    0x03
+
+// MACROS 
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEmergencyCallRfAdaptation;
+
+// CLASS DECLARATION
+
+/**
+*  CEmergencyCallRfTrCommand
+*
+*  This class declarates SSM Adaptation plug-in module, which provides
+*  methods for sending Domestic OS messages.
+*/
+class CEmergencyCallRfTrCommand : public CBase
+    {
+    public:
+        
+        /**
+        * Two-phased constructor.
+        * @param iAdaptation                Reference to CHapticsAdaptation
+        * @param aTransactionId             Unique Transaction Id
+        */
+        static CEmergencyCallRfTrCommand* NewL( CEmergencyCallRfAdaptation &iAdaptation,
+                                                TUint8 aTransactionId );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CEmergencyCallRfTrCommand();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CEmergencyCallRfTrCommand( CEmergencyCallRfAdaptation &iAdaptation,
+                                   TUint8 aTransactionId );
+
+    public: // New functions
+
+        /**
+        * Receive messages from Adaptation
+        * @param aCommandId             Identification of current command
+        * @param aData                  Data associated with the command.
+        * @return none 
+        */
+        void ProcessMessageL( const TInt aCommandId, 
+                              TDesC8& aData );
+
+        /**
+        * Returns a current transaction ID
+        * @return     A transaction ID
+        */
+        TUint8 TransactionId() const;
+
+        /**
+        * Returns transaction state value
+        * @return    A current transaction state
+        */
+        TUint8 TransactionState() const;
+       
+    private: // New functions
+
+        /**
+        * Creates and sends MCE_RF_STATE_REQ message
+        * @param aRequestInfo           Requested state info
+        * @return none
+        */
+        void MCE_RF_STATE_REQL( TUint8 aRequestInfo );
+
+        /**
+        * Parses received MCE_RF_STATE_RESP
+        * @param aData                  Reference to received MCE_RF_STATE_RESP
+        * @return none
+        */
+        void ParseMCE_RF_STATE_RESPL( TDesC8 &aData );
+
+    private: // Data
+
+        // Reference to Adaptation
+        CEmergencyCallRfAdaptation &iAdaptation;
+
+        // Transaction ID
+        TUint8 iTransactionId;
+
+        /**
+        * A current transaction states
+        *  - EMERGENCYCALLRF_TR_INIT
+        *  - EMERGENCYCALLRF_TR_ONGOING
+        *  - EMERGENCYCALLRF_TR_COMPLETED
+        *  - EMERGENCYCALLRF_TR_FAILED
+        */
+        TUint8 iTransactionState;
+
+    };
+
+#endif // SSM_EMERGENCYCALLRF_TRCOMMAND_H
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_adaptation.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,694 @@
+/*
+* ==============================================================================
+*  Name:           ssm_emergencycallrf_adaptation.cpp
+*  Part of:        SSMA EmergencyCallRfAdaptation
+*  Interface:      N/A
+*  Description:    Declaration of CEmergencyCallRfAdaptation class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:38:36 2009 %
+*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Implementation of ssm_emergencycallrf_adaptation
+*/
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ssm_emergencycallrf_adaptationtraces.h"
+#endif // OST_TRACE_COMPILER_IN_USE
+#include <ssm/startupadaptationcommands.h>
+#include <iscnokiadefinitions.h>
+#include <mceisi.h>
+#include <tisi.h>
+#include <pn_const.h>
+#include "ssm_emergencycallrf_adaptation.h"
+#include "ssm_emergencycallrf_trcommand.h"
+#include "sa_common_isc_service.h"
+#include "sa_common_trace.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTIONS PROTOTYPES
+
+// CONSTANTS
+#define MIN_ISI_MESSAGE_SIZE    36
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/**
+ Function to create new Emergency Call RF Adaptation Plugin.
+
+ @return	new instance of MEmergencyCallRfAdaptation for Emergency Call RF Adaptations.
+
+ @internalComponent
+ @released
+*/
+EXPORT_C MEmergencyCallRfAdaptation* CreateEmergencyCallRfAdaptationL()
+    {
+    CEmergencyCallRfAdaptation* emergencyCallRfAdaptation = CEmergencyCallRfAdaptation::NewL();
+    return ( static_cast<MEmergencyCallRfAdaptation*> ( emergencyCallRfAdaptation ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::NewL
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfAdaptation* CEmergencyCallRfAdaptation::NewL()
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_NEWL_1,
+               "SSMA # CEmergencyCallRfAdaptation::NewL" );
+    INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::NewL" ) );
+
+    CEmergencyCallRfAdaptation* self = new(ELeave) CEmergencyCallRfAdaptation;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    OstTrace1( TRACE_API, CEMERGENCYCALLRFADAPTATION_NEWL_2,
+               "SSMA # CEmergencyCallRfAdaptation::NewL - return 0x%08x", self );
+    API_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::NewL - return 0x%08x"), self ));
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation()
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CEMERGENCYCALLRFADAPTATION_D1,
+               "SSMA # CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation" );
+    INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation" ) );
+
+    /* Delete the list of ongoing transactions */
+    iTransactionPtr.ResetAndDestroy();  
+
+    /* Delete iCSACommonIscServicePtr */
+    if ( iCSACommonIscServicePtr )
+        {
+        OstTrace0( TRACE_API, CEMERGENCYCALLRFADAPTATION_CEMERGENCYCALLRFADAPTATION_D2,
+                   "SSMA - CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation - Delete iCSACommonIscServicePtr" );
+        API_TRACE((_L( "SSMA - CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation - Delete iCSACommonIscServicePtr" )));
+
+        delete iCSACommonIscServicePtr;
+        iCSACommonIscServicePtr = NULL;
+        }
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CEMERGENCYCALLRFADAPTATION_D3,
+              "SSMA # CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation - return void" );
+   INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation - return void")));
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation()
+    : iTransId(0)
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CEMERGENCYCALLRFADAPTATION_1,
+        "SSMA # CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation()" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation()")));
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CEMERGENCYCALLRFADAPTATION_2, 
+        "SSMA # CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ConstructL()
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CONSTRUCTL_1,
+               "SSMA # CEmergencyCallRfAdaptation::ConstructL()" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ConstructL()")));
+
+    // Minimum isi message size
+    TUint8 isiMessageSize( MIN_ISI_MESSAGE_SIZE );
+
+    iCSACommonIscServicePtr = CSACommonIscService::NewL( *this,
+                                                         EIscNokiaReserved8, 
+                                                         /*(TUint16) KEmergencyCallRfAdaptationDllTypeUidValue,*/
+                                                         NULL, // we are not interested in events, so we send NULL
+                                                         isiMessageSize );
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CONSTRUCTL_2,
+               "SSMA # CEmergencyCallRfAdaptation::ConstructL - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ConstructL - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall
+// Request RF activation so that an emergency call can be made.
+// @param aStatus to complete when the operation has finished
+// @see TRequestStatus
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall( TRequestStatus& aStatus )
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_ACTIVATERFONFOREMERGENCYCALL_1,
+               "SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall" );
+    INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall" ) );
+
+    iCancelCommand= EFalse;
+    aStatus = KRequestPending;
+    iStatusPtr = &aStatus;
+
+    CEmergencyCallRfTrCommand* transactionPtr( NULL );
+    TUint8 transId = TransactionId();
+    iCommandId = StartupAdaptation::EActivateRfForEmergencyCall;
+
+    transactionPtr = CEmergencyCallRfTrCommand::NewL( *this, transId );
+
+    if ( transactionPtr )
+        {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_ACTIVATERFONFOREMERGENCYCALL_2,
+                   "SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - Transaction ptr  created" );
+
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - Transaction ptr created"))); 
+
+        // Modifiable pointer to message data buffer
+        TPtr8 bufferPtr( NULL, 0 );
+
+        ForwardMessageL( iCommandId, transId, bufferPtr, transactionPtr );
+        }
+    else
+       {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_ACTIVATERFONFOREMERGENCYCALL_3,
+                   "SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - transaction ptr not created" );
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - transaction ptr not created ")));
+        User::RequestComplete( iStatusPtr, KErrNoMemory );
+       }
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_ACTIVATERFONFOREMERGENCYCALL_4,
+               "SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ActivateRfForEmergencyCall - return void")));
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall
+// Request RF deactivation so that an emergency call can be made.
+// @param aStatus to complete when the operation has finished
+// @see TRequestStatus
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall( TRequestStatus& aStatus )
+    {
+    iCancelCommand= EFalse;
+    aStatus = KRequestPending;
+    iStatusPtr = &aStatus;
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_DEACTIVATERFONFOREMERGENCYCALL_1,
+               "SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall" );
+    INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall" ) );
+
+    CEmergencyCallRfTrCommand* transactionPtr( NULL );
+    TUint8 transId = TransactionId();
+    iCommandId = StartupAdaptation::EDeactivateRfAfterEmergencyCall;
+
+    transactionPtr = CEmergencyCallRfTrCommand::NewL( *this, transId);
+
+    if ( transactionPtr )
+        {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_DEACTIVATERFONFOREMERGENCYCALL_2,
+                   "SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - Transaction ptr  created" );
+
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - Transaction ptr created"))); 
+
+        // Modifiable pointer to message data buffer
+        TPtr8 bufferPtr( NULL, 0 );
+
+        ForwardMessageL( iCommandId, transId, bufferPtr, transactionPtr );
+        }
+    else
+       {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_DEACTIVATERFONFOREMERGENCYCALL_3,
+                   "SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - transaction ptr not created" );
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - transaction ptr not created ")));
+        User::RequestComplete( iStatusPtr, KErrNoMemory );
+       } 
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_DEACTIVATERFONFOREMERGENCYCALL_4,
+               "SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall - return void")));
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::Release
+// Deletes and frees memory allocated.
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::Release()
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RELEASE,
+               "SSMA # CEmergencyCallRfAdaptation::Release" );
+    INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::Release" ) );
+    delete this;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::Cancel
+// Cancel the outstanding request. Reference implementation completes the 
+// requests immediately so there is nothing to cancel.
+// On a device, Cancel() needs an implementation as the Request might be 
+// outstanding and it needs to be cancelled. 
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::Cancel()
+    {
+    iCancelCommand= ETrue;
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_CANCEL_2,
+               "SSMA # CEmergencyCallRfAdaptation::Cancel - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::Cancel - return void")));
+	}
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ForwardMessageL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ForwardMessageL( const TInt aCommandId,
+                                                  const TUint8 aTransId,
+                                                  TDesC8& aData,
+                                                  CEmergencyCallRfTrCommand* aNewTransactionPtr )
+    {
+    OstTraceExt4( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_0,
+                  "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL(0x%x,0x%x,0x%x,0x%x)",
+                  (TUint)aCommandId, (TUint)aTransId, (TUint)&aData, (TUint)&aNewTransactionPtr );
+
+    INTERNAL_TRACE((_L( "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL(0x%x,0x%x,0x%x,0x%x)"),
+                        (TUint)aCommandId, (TUint)aTransId, (TUint)&aData, (TUint)&aNewTransactionPtr ));
+
+    CEmergencyCallRfTrCommand* transactionPtr( NULL );
+    TInt32 entryToBeRemoved( KErrNotFound );
+
+    if ( aNewTransactionPtr )
+        {
+        TInt32 newTrAppendStatus( KErrGeneral );
+
+        transactionPtr = aNewTransactionPtr;
+
+        // If the transaction is already in array, no need to add it
+        entryToBeRemoved = iTransactionPtr.Find( transactionPtr );
+
+        // It's a new transaction, thus not assigned to the list yet.
+        if ( entryToBeRemoved == KErrNotFound )
+            {
+            newTrAppendStatus = iTransactionPtr.Append( transactionPtr );
+
+            if ( newTrAppendStatus != KErrNone )
+                {
+                OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_1,
+                           "SSMA - CEmergencyCallRfAdaptation::ForwardMessageL - iTransaction.Append FAILED - status %d.",
+                           newTrAppendStatus );
+                INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - iTransaction.Append FAILED - status %d."),
+                                   newTrAppendStatus));
+
+                delete transactionPtr;
+                transactionPtr = NULL;
+                User::Leave( newTrAppendStatus );
+                }
+
+            // Get the index, needed if the entry needs to be removed later on.
+            entryToBeRemoved = iTransactionPtr.Find( transactionPtr );
+            }
+        OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_2, 
+                   "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - entryToBeRemoved %d:",
+                   entryToBeRemoved );
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - entryToBeRemoved %d:"),
+                            entryToBeRemoved));
+
+        if ( entryToBeRemoved == KErrNotFound )
+            {
+            ASSERT_ALWAYS_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Entry not found")));
+
+            delete transactionPtr;
+            transactionPtr = NULL;
+            User::Leave( KErrNotFound );
+            }
+
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_3,
+                   "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - New transactionPtr." );
+        INTERNAL_TRACE(_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - New transactionPtr."));
+        }
+    else
+        {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_4,
+                   "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Search existing transaction from the list." );
+        INTERNAL_TRACE(_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Search existing transaction from the list."));
+
+        // Find an existing transaction if we did not create a new one.
+        for ( TUint32 i = 0; i < iTransactionPtr.Count() && transactionPtr == NULL; i++ )
+            {
+            if ( iTransactionPtr[i]->TransactionId() == aTransId )
+                {
+                transactionPtr   = iTransactionPtr[i];
+                entryToBeRemoved = i;
+
+                OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_5,
+                           "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Transaction found." );
+                INTERNAL_TRACE(_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Transaction found."));
+                }
+            }
+        }
+
+    if ( transactionPtr )
+        {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_6,
+                   "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - forwared to transaction." );
+        INTERNAL_TRACE(_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - forwared to transaction."));
+
+        TRAPD( err, transactionPtr->ProcessMessageL( aCommandId, aData ) );
+
+        OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_7,
+                  "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - TRAP err: %d: ",
+                   err );
+        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - TRAP err: %d: "),
+                            err));
+
+        TUint32 transactionState = transactionPtr->TransactionState();
+
+        // Transaction completed or failed
+        if ( transactionState == EMERGENCYCALLRF_TR_COMPLETED ||
+             transactionState == EMERGENCYCALLRF_TR_FAILED ||
+             err != KErrNone )
+            {
+
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_8, 
+                       "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - delete transaction." );
+            INTERNAL_TRACE(_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - delete transaction."));
+
+            delete transactionPtr;
+            transactionPtr = NULL;
+
+            iTransactionPtr.Remove( entryToBeRemoved );
+
+            User::LeaveIfError( err );
+
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_11,
+                       "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Transaction removed." );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - Transaction removed.")));
+            }
+        }
+    else
+        {
+        ASSERT_ALWAYS_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - unknown message")));
+        User::Leave( KErrGeneral );
+        }
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_FORWARDMESSAGEL_12,
+                   "SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ForwardMessageL - return void")));
+    }
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::SendIsiMessageL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::SendIsiMessageL( TDesC8& aMessageData )
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_SENDISIMESSAGEL_1,
+        "SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL(0x%x)",
+        (TUint)&aMessageData );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL(0x%x)"),
+        (TUint)&aMessageData));
+
+    // Allocate and initialize space for ISI message
+    TUint32 length = ISI_HEADER_SIZE + aMessageData.Length();
+    HBufC8* isiMsgData = HBufC8::NewL( length );
+
+    CleanupStack::PushL( isiMsgData );
+
+    TPtr8 isiMsgDataPtr = isiMsgData->Des();
+
+    // Create an ISI message
+    TIsiSend isiMsg( isiMsgDataPtr, length );
+    isiMsg.Set8bit( ISI_HEADER_OFFSET_RECEIVERDEVICE, PN_DEV_MODEM );
+    isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_MCE );
+    isiMsg.CopyData( ISI_HEADER_OFFSET_TRANSID, aMessageData );
+    isiMsg.Complete();
+
+    // Send ISI message
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_SENDISIMESSAGEL_2,
+        "SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL - iCSACommonIscService->SendMessageL(0x%x)",
+        (TUint)&aMessageData );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL - iCSACommonIscService->SendIsiMessageL(0x%x)"),
+        (TUint)&aMessageData));
+    iCSACommonIscServicePtr->SendMessageL( isiMsgDataPtr );
+
+    // Delete temporary buffers
+    CleanupStack::PopAndDestroy( isiMsgData );
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_SENDISIMESSAGEL_3,
+        "SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL - return void" );
+    INTERNAL_TRACE( ( _L( "SSMA # CEmergencyCallRfAdaptation::SendIsiMessageL - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ReceiveIsiMessageL 
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ReceiveIsiMessageL( TDesC8& aData )
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_1,
+               "SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL(0x%x)",
+               (TUint)&aData );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL(0x%x)"),
+                       (TUint)&aData ));
+
+    TIsiReceiveC isiMsg( aData );
+    TUint8 resourceId( isiMsg.Get8bit( ISI_HEADER_OFFSET_RESOURCEID ) );
+    TUint8 transId( isiMsg.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
+    TUint8 messageId( isiMsg.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
+
+    OstTraceExt3( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_2,
+               "SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL - ISI message Id(0x%x, 0x%x, 0x%x)",
+               resourceId, transId, messageId ); 
+    INTERNAL_TRACE((_L("SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL - ISI message Id(0x%x, 0x%x, 0x%x)"),
+                        resourceId, transId, messageId ));
+
+    if ( resourceId == PN_MODEM_MCE )
+        {
+        switch ( messageId )
+            {
+            case MCE_RF_STATE_RESP:
+                {
+                OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_3,
+                           "SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL - MCE_RF_STATE_RESP" );
+                INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL - MCE_RF_STATE_RESP")));
+
+                CEmergencyCallRfTrCommand* transactionPtr( NULL );
+
+                ForwardMessageL( messageId, transId, aData, transactionPtr );
+                break;
+                }
+            default:
+                {
+                OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_4,
+                           "SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL - Wrong msg Id from Cellmo - MessageId() 0x%x ",
+                           messageId );
+                INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL - Wrong msg Id from Cellmo - MessageId() 0x%x "),
+                                   messageId));
+                break;
+                }
+            }
+        }
+    else
+        {
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_5,
+                   "SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL -resource id NOT SUPPORTED! " );
+        INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL -resource id NOT SUPPORTED! " ) );
+        User::Leave( KErrGeneral );
+        }
+
+        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_6,
+                   "SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL -return void " );
+        INTERNAL_TRACE( _L( "SSMA # CEmergencyCallRfAdaptation::ReceiveIsiMessageL -return void " ) );
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ProcessResponseL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ProcessResponseL( TInt aErrCode )
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_1,
+                  "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL(0x%d)",
+                  (TUint)aErrCode );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL(0x%x)"),
+                       aErrCode ));
+
+    if ( iCancelCommand )
+        {
+        if ( aErrCode == KErrNone )
+            {
+            switch ( iCommandId )
+                {
+                case StartupAdaptation::EActivateRfForEmergencyCall:
+                    {
+                    CEmergencyCallRfTrCommand* transactionPtr( NULL );
+                    TUint8 transId = TransactionId();
+                    transactionPtr = CEmergencyCallRfTrCommand::NewL( *this, transId);
+
+                    if ( transactionPtr )
+                        {
+                        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_2,
+                                   "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Transaction ptr  created" );
+
+                        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Transaction ptr created"))); 
+
+                        // Modifiable pointer to message data buffer
+                        TPtr8 iBufferPtr( NULL, 0 );
+
+                        ForwardMessageL( StartupAdaptation::EDeactivateRfAfterEmergencyCall, transId, iBufferPtr, transactionPtr );
+                        }
+                    else
+                        {
+                        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_3,
+                                   "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - transaction ptr not created" );
+                        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - transaction ptr not created ")));
+                        User::RequestComplete( iStatusPtr, KErrCompletion);
+                        }
+                    iCommandId = KErrCancel;
+                    }
+                    break;
+
+                case StartupAdaptation::EDeactivateRfAfterEmergencyCall:
+                    {
+                    CEmergencyCallRfTrCommand* transactionPtr( NULL );
+                    TUint8 transId = TransactionId();
+                    transactionPtr = CEmergencyCallRfTrCommand::NewL( *this, transId);
+
+                    if ( transactionPtr )
+                        {
+                        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_4,
+                                   "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Transaction ptr  created" );
+
+                        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Transaction ptr created"))); 
+
+                        // Modifiable pointer to message data buffer
+                        TPtr8 iBufferPtr( NULL, 0 );
+
+                        ForwardMessageL( StartupAdaptation::EActivateRfForEmergencyCall, transId, iBufferPtr, transactionPtr );
+                        }
+                    else
+                        {
+                        OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_5,
+                                   "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - transaction ptr not created" );
+                        INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - transaction ptr not created")));
+                        User::RequestComplete( iStatusPtr, KErrCompletion);
+                        }
+                    iCommandId = KErrCancel;
+                    }
+                    break;
+
+                case KErrCancel:
+                    {
+                    User::RequestComplete( iStatusPtr, KErrCancel);
+                    }
+                    break;
+
+                default:
+                    {
+                    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_6, 
+                               "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Unknown CommandId() 0x%x ",
+                                iCommandId );
+                    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - Unknown CommandId() 0x%x "),
+                                        iCommandId ));
+                    }
+                    break;
+                }
+            }
+        else
+            {
+            User::RequestComplete( iStatusPtr, KErrCancel );
+            }
+        }
+    else
+        {
+        User::RequestComplete( iStatusPtr, aErrCode );
+        }
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSRESPONSEL_7, 
+               "SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessResponseL - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::ProcessConnectionClosedL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfAdaptation::ProcessConnectionClosedL( TInt aErrorCode )
+    {
+    OstTrace1( TRACE_NORMAL,CEMERGENCYCALLRFADAPTATION_PROCESSCONNECTIONCLOSEDL_1,
+               "SSMA # CEmergencyCallRfAdaptation::ProcessConnectionClosedL(0x%x)",
+               aErrorCode );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::ProcessConnectionClosedL(0x%x)"),
+                       aErrorCode ));
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_PROCESSCONNECTIONCLOSEDL_2,
+               "SSMA # CEmergencyCallRfAdaptation::ProcessConnectionClosedL - return void" );
+    INTERNAL_TRACE((_L( "SSMA # CEmergencyCallRfAdaptation::ProcessConnectionClosedL - return void" )));
+    }
+
+
+//
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfAdaptation::TransactionId
+// -----------------------------------------------------------------------------
+//
+TInt CEmergencyCallRfAdaptation::TransactionId()
+    { 
+    // check for 255
+    if ( (++iTransId) >= 255 )
+        {
+            iTransId = 0; 
+        }
+		
+    OstTrace1( TRACE_NORMAL,CEMERGENCYCALLRFADAPTATION_TRANSACTIONID_1,
+               "SSMA # CEmergencyCallRfAdaptation::TransactionId(0x%x)",
+               iTransId );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::TransactionId(0x%x)"),
+                       iTransId ));
+    return iTransId;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_trcommand.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,353 @@
+/*
+* ==============================================================================
+*  Name:           ssm_emergencycallrf_trcommand.cpp
+*  Part of:        SSMA EmergencyCallRfAdaptation
+*  Interface:      N/A
+*  Description:    Implementation of CEmergencyCallRfTrCommand class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:38:38 2009 %
+*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Implementation of ssm_emergencycallrf_adaptation
+*/
+// INCLUDE FILES
+#include "OstTraceDefinitions.h" 
+#ifdef OST_TRACE_COMPILER_IN_USE 
+#include "ssm_emergencycallrf_trcommandtraces.h"
+#endif
+#include <ssm/startupadaptationcommands.h>
+#include <mceisi.h>
+#include <tisi.h>
+#include <pn_const.h>
+#include "ssm_emergencycallrf_trcommand.h"
+#include "sa_common_isc_service.h"
+#include "sa_common_trace.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEmergencyCallRfAdaptation;
+
+// ============================= LOCAL FUNCTIONS ===============================
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::TransactionId
+// -----------------------------------------------------------------------------
+//
+TUint8 CEmergencyCallRfTrCommand::TransactionId() const
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_TRANSACTIONID_1,
+               "SSMA # CEmergencyCallRfTrCommand::TransactionId - return 0x%x",
+               iTransactionId );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::TransactionId - return 0x%x"),
+                       iTransactionId));
+
+    return iTransactionId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::TransactionState
+// -----------------------------------------------------------------------------
+//
+TUint8 CEmergencyCallRfTrCommand::TransactionState() const
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_TRANSACTIONSTATE_1,
+               "SSMA # CEmergencyCallRfTrCommand::iTransactionState - return 0x%02x",
+               iTransactionState );
+    INTERNAL_TRACE ((_L("SSMA # CEmergencyCallRfTrCommand::iTransactionState - return 0x%02x"),
+                        iTransactionState));
+
+    return iTransactionState;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::NewL
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfTrCommand* CEmergencyCallRfTrCommand::NewL( CEmergencyCallRfAdaptation &aAdaptation,
+                                                            TUint8 aTransactionId )
+    {
+    OstTraceExt2( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_NEWL_1,
+                  "CEmergencyCallRfTrCommand::NewL(0x%x, %d)",
+                  (TUint)&aAdaptation, aTransactionId);
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::NewL(0x%x, %d)"),
+                        &aAdaptation, aTransactionId));
+
+    CEmergencyCallRfTrCommand* self = new(ELeave) CEmergencyCallRfTrCommand( aAdaptation, aTransactionId);
+        
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_NEWL_2,
+               "SSMA # CEmergencyCallRfTrCommand::NewL() - return 0x%x",
+               self );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::NewL() - return 0x%x"),
+                       self));
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand( CEmergencyCallRfAdaptation &aAdaptation,
+                                                      TUint8 aTransactionId )
+    : iAdaptation(aAdaptation)
+    , iTransactionId( aTransactionId )
+    , iTransactionState( EMERGENCYCALLRF_TR_INIT )
+    {
+    OstTraceExt2( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_CEMERGENCYCALLRFTRCOMMAND_1,
+                  "SSMA # CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand(0x%x ,%d)",
+                  (TUint)&aAdaptation, aTransactionId );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand(0x%x ,%d)"),
+                       &aAdaptation, aTransactionId ));
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_CEMERGENCYCALLRFTRCOMMAND_2,
+               "SSMA # CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::CEmergencyCallRfTrCommand - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::~CEmergencyCallRfTrCommand
+// -----------------------------------------------------------------------------
+//
+CEmergencyCallRfTrCommand::~CEmergencyCallRfTrCommand()
+    {
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_CEMERGENCYCALLRFTRCOMMAND_D1,
+               "SSMA # CEmergencyCallRfTrCommand::~CEmergencyCallRfTrCommand - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::~CEmergencyCallRfTrCommand - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::ProcessMessageL  
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfTrCommand::ProcessMessageL( const TInt aCommandId, TDesC8 &aData )
+    {
+    OstTraceExt2( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_PROCESSMESSAGE_1,
+               "SSMA # CEmergencyCallRfTrCommand::ProcessMessageL(0x%x, 0x%x)",
+               aCommandId, (TUint)&aData );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ProcessMessageL(0x%x,0x%x)"),
+                       aCommandId, (TUint)&aData ));
+
+    switch ( iTransactionState )
+        {
+        case EMERGENCYCALLRF_TR_INIT:
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_PROCESSMESSAGE_2,
+                       "SSMA # CEmergencyCallRfTrCommand::ProcessMessageL - EMERGENCYCALLRF_TR_INIT" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ProcessMessageL - EMERGENCYCALLRF_TR_INIT")));
+
+            // This is the new transaction, so update the state value
+            iTransactionState = EMERGENCYCALLRF_TR_ONGOING;
+
+            switch (aCommandId)
+                {
+                case StartupAdaptation::EActivateRfForEmergencyCall:
+                    {
+                    //Build up the isi message
+                    MCE_RF_STATE_REQL( MCE_RF_ON );
+                    }
+                    break;
+
+                case StartupAdaptation::EDeactivateRfAfterEmergencyCall:
+                    {
+                    //Build up the isi message
+                    MCE_RF_STATE_REQL( MCE_RF_OFF );
+                    }
+                    break;
+
+                default:
+                    {
+                    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_PROCESSMESSAGE_3,
+                               "SSMA - CEmergencyCallRfTrCommand::ProcessMessageL - Wrong command->Transaction failed" );
+                    ASSERT_ALWAYS_TRACE((_L("SSMA - CEmergencyCallRfTrCommand::ProcessMessageL - Wrong command->Transaction failed")));
+                    iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+                    User::Leave( KErrGeneral );
+                    }
+                    break;
+                }
+            }
+            break;
+
+        case EMERGENCYCALLRF_TR_ONGOING:
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_PROCESSMESSAGE_4,
+                       "SSMA # CEmergencyCallRfTrCommand::ProcessMessageL - EMERGENCYCALLRF_TR_ONGOING" );
+            INTERNAL_TRACE((_L("SSMA - CEmergencyCallRfTrCommand::ProcessMessageL - EMERGENCYCALLRF_TR_ONGOING")));
+
+            //Parse the received response
+            ParseMCE_RF_STATE_RESPL( aData );
+            }
+            break; 
+
+        default:
+            {
+            ASSERT_ALWAYS_TRACE((_L("CEmergencyCallRfTrCommand::ProcessMessageL - Wrong state->Transaction failed")));
+            iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+            User::Leave( KErrGeneral );
+            break;
+            }
+        }
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_PROCESSMESSAGE_5,
+               "SSMA # CEmergencyCallRfTrCommand::ProcessMessageL - return void" );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ProcessMessageL - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL
+// -----------------------------------------------------------------------------
+//
+void CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL( TUint8 aRequestInfo )
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_REQL_1,
+               "SSMA # CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL(0x%x)", aRequestInfo );
+    INTERNAL_TRACE((_L( "SSMA # CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL(0x%x)"), aRequestInfo));
+
+    /* Create MCE_RF_STATE_REQ message */
+    TBuf8<SIZE_MCE_RF_STATE_REQ> msgData;
+
+    msgData.Append( iTransactionId );                   // Transaction Id
+    msgData.Append( MCE_RF_STATE_REQ );                 // Message Id
+    msgData.Append( aRequestInfo );                     // Request info high bits
+    msgData.Append( 0x00 );                             // Filler
+
+    /* Send ISI message */
+    iAdaptation.SendIsiMessageL( msgData );
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_REQL_3,
+               "SSMA # CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL - return void" );
+    INTERNAL_TRACE((_L( "SSMA # CEmergencyCallRfTrCommand::MCE_RF_STATE_REQL - return void")));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL
+// ----------------------------------------------------------------------------- 
+void  CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL( TDesC8 &aData )
+    {
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_1,
+               "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - aData is: (%x)",
+               &aData );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - aData is: (%x)"),
+                        &aData));
+
+    TInt   errorCode(KErrNone);
+    TUint8 status( 0 );
+
+    TIsiReceiveC isiMsg( aData );
+
+    // start parsing the message
+
+    //Read status
+    status = isiMsg.Get8bit( ISI_HEADER_SIZE + 
+                              MCE_RF_STATE_RESP_OFFSET_STATUS );
+
+    OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_2,
+               "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status(%d)",
+               status );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status(%d)"),
+                        status));
+
+    switch( status )
+        {
+        case MCE_OK: // 0
+            { 
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_3,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_OK" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_OK")));
+            errorCode = KErrNone;
+            iTransactionState = EMERGENCYCALLRF_TR_COMPLETED;
+            }
+            break;
+
+        case MCE_FAIL: // 0x01
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_4,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_FAIL" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_FAIL")));
+            errorCode = KErrNotFound;
+            iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+            }
+            break;
+
+        case MCE_ALREADY_ACTIVE: // 0x06
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_5,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_ALREADY_ACTIVE" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_ALREADY_ACTIVE")));
+            errorCode = KErrArgument;
+            iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+            }
+            break;
+
+        case MCE_TRANSITION_ONGOING: // 0x16
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_6,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_TRANSITION_ONGOING" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_TRANSITION_ONGOING")));
+            errorCode = KErrServerBusy;
+            iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+            }
+            break;
+
+        case MCE_RESTART_REQUIRED: // 0x17
+            {
+            OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_7,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_RESTART_REQUIRED" );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status = MCE_RESTART_REQUIRED")));
+            errorCode = KErrCompletion;
+            iTransactionState = EMERGENCYCALLRF_TR_FAILED;
+            }
+            break;
+
+        default:
+            {
+            ASSERT_ALWAYS_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - ")));
+            OstTrace1( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_8,
+                       "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status(%d)", 
+                        status );
+            INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL() - Status(%d)"),
+                                status));
+            }
+            break;
+        }
+
+    iAdaptation.ProcessResponseL( errorCode );
+
+    OstTrace0( TRACE_NORMAL, CEMERGENCYCALLRFTRCOMMAND_MCE_RF_STATE_RESP_9,
+               "SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL - return " );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfTrCommand::ParseMCE_RF_STATE_RESPL - return ")));
+    }
+    
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/traces/OstTraceDefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/bwins/ssm_misc_adaptation.def	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/eabi/ssm_misc_adaptation.def	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z21CreateMiscAdaptationLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/group/miscadaptation.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies 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.
+*
+*/
+
+
+#include        <platform_paths.hrh>
+#include        <non_foundation_paths.hrh>
+
+TARGET          miscadaptation.dll
+TARGETTYPE      dll
+
+// UID2 value from ssmadaptation.h ( KMiscAdaptationDllTypeUidValue 0x2000E658 )
+UID             0x2000E658 0x20022D92 // UID3 miscadaptation.dll
+VENDORID        VID_DEFAULT
+
+CAPABILITY      CommDD PowerMgmt ReadDeviceData WriteDeviceData ProtServ SwEvent ReadUserData WriteUserData 
+
+// Has a fixed interface ssm_misc_adaptation.def
+NOEXPORTLIBRARY 
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../traces
+
+OS_LAYER_SYSTEMINCLUDE
+NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE 
+
+USERINCLUDE     ../../iscservice/inc
+SOURCEPATH      ../../iscservice/src
+SOURCE          sa_common_trace.cpp
+
+SOURCEPATH      ../src
+
+SOURCE          ssm_misc_adaptation.cpp
+
+// -u suffix behaviour can be removed by using nostrictdef
+NOSTRICTDEF
+DEFFILE         ssm_misc_adaptation.def
+
+LIBRARY         euser.lib
+LIBRARY         estor.lib 
+
+SMPSAFE
+
+MACRO API_TRACE_FLAG
+MACRO INTERNAL_TRACE_FLAG
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/inc/ssm_misc_adaptation.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* ==============================================================================
+*  Name:           ssm_misc_adaptation.h
+*  Part of:        SSMA MiscAdaptation
+*  Interface:      N/A
+*  Description:    Declaration of CMiscAdaptation class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:31:47 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+* Miscadaptation class declarations.
+*
+*/
+
+
+#ifndef __SSM_MISC_ADAPTATION_H__
+#define __SSM_MISC_ADAPTATION_H__
+
+// INCLUDES
+#include <ssm/ssmadaptation.h>
+
+#include "../../../../adaptationlayer/devicemodecontroller/dmc_ext/inc/dmc_user_if.h"
+
+// CONSTANTS
+// MACROS
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+
+
+/**
+ Collection of different adaptations.
+ Implements MMiscAdaptation for different adaptations.
+
+ @internalComponent
+ @released
+
+ @see MMiscAdaptation
+*/
+class CMiscAdaptation : public CBase, public MMiscAdaptation
+    {
+    public:
+
+        static CMiscAdaptation* NewL();
+
+        //from MMiscAdaptation
+
+        /**
+        * Deletes and frees memory allocated.
+        */
+        void Release();
+
+        /**
+        * Request the next security state.
+        * @param aState next security state
+        * @param aResponsePckg response to state change request on completion
+        * @param aStatus to complete when the operation has finished
+        */
+        void SecurityStateChange( TInt aState, 
+                                  TDes8& aResponsePckg, 
+                                  TRequestStatus& aStatus );
+
+        /**
+        * Get the start-up mode from the Cooperating System.
+        * @param aModePckg should contain start-up of the Cooperating System on completion
+        * @param aStatus to complete when the operation has finished
+        */
+        void GetGlobalStartupMode( TDes8& aModePckg, TRequestStatus& aRequest );
+
+        /**
+        * Prepare language codes stored in the SIM in preferred language lists. 
+        * @param aPriority priority for which the language lists need to be prepared
+        * @param aSizePckg on return contains the size of the buffer, which a client 
+        *   should allocate and pass as the first parameter (TDes8& aListPckg) 
+        *     to GetSimLanguages()
+        * @param aStatus to complete when the operation has finished
+        */
+        void PrepareSimLanguages( TSsmLanguageListPriority aPriority, 
+                                  TDes8& aSizePckg, 
+                                  TRequestStatus& aStatus );
+
+        /**
+        Get language codes stored in the SIM in preferred language lists.
+        PrepareSimLanguages() call should precede this call
+        @param aBuf should contain the language lists on completion
+        @param aCount to contain the count of the languages
+        @see PrepareSimLanguages
+        */
+        void GetSimLanguagesL( CBufBase* aBuf, TInt aCount );
+         
+        /** 
+        * Retrieve information about Hidden reset.
+        * @param aHiddenResetPckg Result package (ETrue or EFalse)
+        * @param aStatus to complete when the operation has finished
+        * @see TRequestStatus
+        */
+        void GetHiddenReset( TDes8& aHiddenResetPckg, TRequestStatus& aStatus );
+              
+        /**
+        * Cancel the outstanding request
+        */
+        void Cancel();
+
+    private:
+        CMiscAdaptation();
+        void ConstructL();  
+        ~CMiscAdaptation();
+
+    private:
+        // Handle to DMC
+        RDmc iDmc;
+    };
+
+#endif // __SSM_MISC_ADAPTATION_H__
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/src/ssm_misc_adaptation.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,439 @@
+/*
+* ==============================================================================
+*  Name:           ssm_misc_adaptation.cpp
+*  Part of:        SSMA MiscAdaptation
+*  Interface:      N/A
+*  Description:    Implementation of CMiscAdaptation class
+*  %version:       1 %
+*  %date_modified: Tue Dec 29 15:31:50 2009 %
+*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 miscadaptation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <s32mem.h>
+#include "ssm_misc_adaptation.h"
+#include "ssm/startupadaptationcommands.h"
+#include "sa_common_trace.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "ssm_misc_adaptationtraces.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES 
+// EXTERNAL FUNCTION PROTOTYPES 
+// FORWARD DECLARATIONS
+// CONSTANTS
+// MACROS
+// LOCAL CONSTANTS AND MACROS
+// MODULE DATA STRUCTURES  
+// LOCAL FUNCTION PROTOTYPES 
+
+
+// ============================ LOCAL FUNCTIONS ================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Function to create new Misc Adaptation Plugin. Used for a collection of 
+// activities.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MMiscAdaptation* CreateMiscAdaptationL()
+    {
+    CMiscAdaptation* miscAdaptation = CMiscAdaptation::NewL();
+    return ( static_cast<MMiscAdaptation*>( miscAdaptation ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::NewL 
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CMiscAdaptation* CMiscAdaptation::NewL()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_NEWL_1,
+               "SSMA # CMiscAdaptation::NewL" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::NewL" ) );
+
+    CMiscAdaptation* self = new( ELeave ) CMiscAdaptation;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    OstTrace1( TRACE_API, CMISCADAPTATION_NEWL_2,
+               "SSMA # CEmergencyCallRfAdaptation::NewL - return 0x%08x", self );
+    INTERNAL_TRACE((_L("SSMA # CEmergencyCallRfAdaptation::NewL - return 0x%08x"), self ));
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::~CMiscAdaptation
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CMiscAdaptation::~CMiscAdaptation()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CMISCADAPTATION_D1,
+               "SSMA # CMiscAdaptation::~CMiscAdaptation" );
+    INTERNAL_TRACE( _L("SSMA # CMiscAdaptation::~CMiscAdaptation" ) );
+
+    // Close and release DMC
+    iDmc.Close();
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CMISCADAPTATION_D2,
+               "SSMA # CMiscAdaptation::~CMiscAdaptation - return void" );
+    INTERNAL_TRACE( _L("SSMA # CMiscAdaptation::~CMiscAdaptation - return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::CMiscAdaptation 
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CMiscAdaptation::CMiscAdaptation()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CMISCADAPTATION,
+               "SSMA # CMiscAdaptation::CMiscAdaptation" );
+    INTERNAL_TRACE( _L("SSMA # CMiscAdaptation::CMiscAdaptation" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::ConstructL()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CONSTRUCTL_1,
+               "SSMA # CMiscAdaptation::ConstructL" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::ConstructL" ) );
+
+    // Open DMC
+    iDmc.Open();
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CONSTRUCTL_2,
+               "SSMA # CMiscAdaptation::ConstructL - return void" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::ConstructL return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::Release
+// Deletes and frees memory allocated.
+// -----------------------------------------------------------------------------
+// 
+void CMiscAdaptation::Release()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_RELEASE,
+               "SSMA # CMiscAdaptation::Release" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::Release" ) );
+
+    delete this;
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::GetGlobalStartupMode
+// Get the start-up mode from the Cooperating System.
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::GetGlobalStartupMode( TDes8& aModePckg, 
+                                            TRequestStatus& aStatus )
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETGLOBALSTARTUPMODE_1,
+               "SSMA # CMiscAdaptation::GetGlobalStartupMode" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetGlobalStartupMode" ) );
+
+    aStatus = KRequestPending;
+    TRequestStatus* status = &aStatus;
+
+    StartupAdaptation::TGlobalStartupMode mode = StartupAdaptation::ENormal;
+
+    // Get start up mode from DMC.
+    RDmc::TTargetStartupMode dmcTargetMode( RDmc::EStartupModeNormal );
+
+    TInt err = iDmc.GetStartUpMode( dmcTargetMode );
+
+    OstTrace1( TRACE_NORMAL, CMISCADAPTATION_GETGLOBALSTARTUPMODE_2, 
+               "SSMA # CMiscAdaptation::GetGlobalStartupMode; dmcTargetMode=%d", 
+               dmcTargetMode );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::GetGlobalStartupMode; dmcTargetMode=%d" ),
+                      dmcTargetMode ) );
+
+    if ( err == KErrNone )
+        {
+        switch( dmcTargetMode )
+            {
+            // Map startup from DMC mode to SSM mode.
+            case RDmc::EStartupModeNormal:
+                {
+                mode = StartupAdaptation::ENormal;
+                break;
+                }
+            case RDmc::EStartupModeAlarm:
+                {
+                mode = StartupAdaptation::EAlarm;
+                break;
+                }
+            case RDmc::EStartupModeCharging:
+                {
+                mode = StartupAdaptation::ECharging;
+                break;
+                }
+            case RDmc::EStartupModeTest:
+                {
+                mode = StartupAdaptation::ETest;
+                break;
+                }
+            case RDmc::EStartupModeNone:
+            case RDmc::EStartupModeFota:
+            default:
+                {
+                err = KErrNotSupported;
+                break;
+                }
+            }
+        }
+    
+    OstTraceExt2( TRACE_NORMAL, CMISCADAPTATION_GETGLOBALSTARTUPMODE_3,
+                  "SSMA # CMiscAdaptation::GetGlobalStartupMode; mode=%d; err=%d", 
+                  mode, err );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::GetGlobalStartupMode; mode=%d; err=%d" ),
+                      mode, err ) );
+    
+    // Startupmode should be returned to SSM at aModePckg param.
+    TPckgBuf<StartupAdaptation::TGlobalStartupMode> startUpMode( mode );
+    aModePckg = startUpMode;
+    User::RequestComplete( status, err );
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETGLOBALSTARTUPMODE_4,
+               "SSMA # CMiscAdaptation::GetGlobalStartupMode - return void" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetGlobalStartupMode - return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::PrepareSimLanguages
+// Prepare language codes stored in the SIM in preferred language lists. 
+// The next call should be GetSimLanguages()
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::PrepareSimLanguages( TSsmLanguageListPriority aPriority, 
+                                           TDes8& aSizePckg, 
+                                           TRequestStatus& aStatus )
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_PREPARESIMLANGUAGES_1,
+               "SSMA # CMiscAdaptation::PrepareSimLanguages" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::PrepareSimLanguages" ) );
+
+    aStatus = KRequestPending;
+    TRequestStatus* status = &aStatus;
+    
+    TInt languageCount(1);
+    
+    switch( aPriority )
+        {
+        case EPrimaryLanguages:
+            break;
+        case ESecondaryLanguages:
+            break;
+        case ETertiaryLanguages:
+            break;
+        default:
+            break;
+        }
+
+    OstTraceExt2( TRACE_NORMAL, CMISCADAPTATION_PREPARESIMLANGUAGES_2,
+               "SSMA # CMiscAdaptation::PrepareSimLanguages - aPriority:%d languageCount:%d",
+               aPriority, languageCount );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::PrepareSimLanguages - aPriority:%d languageCount:%d" ),
+                          aPriority, languageCount ) );
+
+    TPckgBuf<TInt> returnValue(languageCount);
+    aSizePckg = returnValue;
+
+    User::RequestComplete( status, KErrNone );
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_PREPARESIMLANGUAGES_3,
+               "SSMA # CMiscAdaptation::PrepareSimLanguages - return void" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::PrepareSimLanguages - return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::GetSimLanguagesL
+// Get language codes stored in the SIM in preferred language lists. 
+// PrepareSimLanguages() call should precede this call.
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::GetSimLanguagesL( CBufBase* aBuf, 
+                                        TInt aCount )
+    {
+    OstTrace1( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_1,
+               "SSMA # CMiscAdaptation::GetSimLanguages - aCount:%d", aCount );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::GetSimLanguages - aCount:%d" ), aCount ) );
+
+
+    StartupAdaptation::RLanguageList languageList;
+    // only as an example...
+    for( TInt i=0; i<aCount; i++)
+        {
+        languageList.Append(StartupAdaptation::EPrefLangEnglish);
+        }
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_1,
+               "SSMA # CMiscAdaptation::GetSimLanguages - write languages to stream." );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetSimLanguages - write languages to stream." ) );
+
+    RBufWriteStream writeStream(*aBuf);
+    CleanupClosePushL(writeStream); 
+    
+    for (TInt i=0; i<aCount; i++)
+        {
+        writeStream.WriteInt32L(languageList[i]);
+        }
+    writeStream.CommitL();
+    CleanupStack::PopAndDestroy();
+    languageList.Close();
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_2,
+               "SSMA # CMiscAdaptation::GetSimLanguages - return void" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetSimLanguages - return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::GetHiddenReset
+// Retrieve information about Hidden reset.
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::GetHiddenReset( TDes8& aHiddenResetPckg,
+                                      TRequestStatus& aStatus )
+    {
+    TBool iHiddenResetStatus = EFalse;
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETHIDDENRESET_1,
+               "SSMA # CMiscAdaptation::GetHiddenReset" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetHiddenReset" ) );
+
+    aStatus = KRequestPending;
+    TRequestStatus* status = &aStatus;
+
+    TInt err = iDmc.IsHiddenReset( iHiddenResetStatus );
+    
+    OstTraceExt2( TRACE_NORMAL, CMISCADAPTATION_GETHIDDENRESET_2, 
+                   "SSMA # CMiscAdaptation::GetHiddenReset IsHiddenReset; Status = %d; Error = %d",
+                   iHiddenResetStatus, err );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::GetHiddenReset IsHiddenReset Status = %d; Error = %d" ),
+                      iHiddenResetStatus, err ) );
+
+    // Startupmode should be returned to SSM at aHiddenResetPckg param.
+    TPckgBuf<TBool> hiddenReset( iHiddenResetStatus );
+    aHiddenResetPckg = hiddenReset;
+    User::RequestComplete( status, err );
+
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETHIDDENRESET_3,
+               "SSMA # CMiscAdaptation::GetHiddenReset - return void" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetHiddenReset - return void" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::Cancel
+// Cancel the outstanding request. Reference implementation completes the 
+// requests immediately so there is nothing to Cancel.
+// On a device, Cancel() needs an implementation as the Request might be 
+// outstanding and it needs to be cancelled.
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::Cancel()
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_CANCEL,
+               "SSMA # CMiscAdaptation::Cancel" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::Cancel" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMiscAdaptation::SecurityStateChange
+// Request the next security state.
+// -----------------------------------------------------------------------------
+//
+void CMiscAdaptation::SecurityStateChange( TInt aState,
+                                           TDes8& aResponsePckg,
+                                           TRequestStatus& aStatus )
+    {
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_SECURITYSTATECHANGE,
+               "SSMA # CMiscAdaptation::SecurityStateChange" );
+    INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::SecurityStateChange" ) );
+
+    aStatus = KRequestPending;
+    TRequestStatus* status = &aStatus;
+    StartupAdaptation::TSecurityStateInfo info = StartupAdaptation::EYes;
+
+    switch( aState )
+        {
+        case StartupAdaptation::ESIMPresent:
+            info = StartupAdaptation::ENo;
+            break;
+        case StartupAdaptation::ESIMReadable:
+            info = StartupAdaptation::EYes;
+            break;
+        case StartupAdaptation::ESIMInvalid:
+            info = StartupAdaptation::ENo;
+            break;
+        case StartupAdaptation::ESIMRejected:
+            info = StartupAdaptation::ENo;
+            break;
+        case StartupAdaptation::ESIMBlocked:
+            info = StartupAdaptation::ENo;
+            break;
+        case StartupAdaptation::EPINRequired:
+            info = StartupAdaptation::ENo;
+            break;
+        case StartupAdaptation::ESIMCodesOK:
+            info = StartupAdaptation::EYes;
+            break;
+        case StartupAdaptation::ESIMLock:
+            info = StartupAdaptation::ESimLockOk;
+            break;
+        case StartupAdaptation::ESecurityCheckOK:
+            info = StartupAdaptation::EYes; 
+            break;  
+        case StartupAdaptation::ESecurityCheckFailed:
+            info = StartupAdaptation::ENo;
+            break;  
+        case StartupAdaptation::ESIMLessOfflineSupported:
+            info = StartupAdaptation::EYes; 
+            break; 
+        case StartupAdaptation::ESECCodeRequired:
+            info = StartupAdaptation::ENo; 
+            break; 
+        case StartupAdaptation::ESECCodeOK:
+            info = StartupAdaptation::EYes; 
+            break; 
+        default:
+            break;
+        }
+        
+    OstTraceExt2( TRACE_NORMAL, CMISCADAPTATION_SECURITYSTATECHANGE_2,
+               "SSMA # CMiscAdaptation::SecurityStateChange: aState:%d info:%d", aState, info );
+    INTERNAL_TRACE( ( _L( "SSMA # CMiscAdaptation::SecurityStateChange: aState:%d info:%d" ), 
+                          aState, info ) );
+    
+    TPckgBuf<StartupAdaptation::TSecurityStateInfo> result( info );
+    aResponsePckg = result;  
+    User::RequestComplete( status, KErrNone );
+    }
+
+// End of File
+
--- a/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -17,5 +17,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/adaptationlayer/tsy/licenseetsy_dll/src/licenseetsy.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/licenseetsy_dll/src/licenseetsy.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "licenseetsy.h"
 
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "licenseetsytraces.h"
+#include "licenseetsyTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -20,6 +20,7 @@
 #include <non_foundation_paths.hrh>
 #include <platform_paths.hrh>
 
+SMPSAFE
 TARGET        nokiatsy.dll
 TARGETTYPE    dll
 UID           0x1000008D 0x1000A84A
@@ -60,9 +61,14 @@
 SOURCE        cmmphonebookstoreoperationbase.cpp
 SOURCE        cmmphonebookstoreoperationlist.cpp
 SOURCE        cmmphonebookoperationinit.cpp
-SOURCE		  cmmphonebookoperationinit3g_adn.cpp
+SOURCE        cmmphonebookoperationinit3g_adn.cpp
 SOURCE        cmmphonebookoperationread.cpp
 SOURCE        cmmphonebookoperationread3g_adn.cpp
+SOURCE        cmmphonebookoperationcache.cpp
+SOURCE        cmmphonebookoperationwrite.cpp
+SOURCE        cmmenstoremesshandler.cpp
+SOURCE        cmmphonebookoperationdelete.cpp
+
 // SMS & other messaging
 SOURCE        cmmsmsmesshandler.cpp
 SOURCE        cmmsmscache.cpp
--- a/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsylib.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsylib.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,6 +23,7 @@
 
 OS_LAYER_SYSTEMINCLUDE
 
+SMPSAFE
 TARGET NOKIATSY.DLL
 TARGETTYPE IMPLIB
 UID           0x1000008D 0x1000A84A
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmbroadmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmbroadmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -157,6 +157,9 @@
         //Pointer to the message router object
         CMmMessageRouter* iMessageRouter;
 
+        //CB Subscription number.
+        TUint8 iCbSubscriptionNumber;
+
     private: // types
 
         // The broadcast request types are grouped into
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -61,6 +61,10 @@
 const TUint8 KMaskBits1to7 = 0x7F;
 const TUint8 KMaskBit8 = 0x80;
 
+// These OBJ ID is used in pipe direction.
+// Pipe-End-Point, Circuit Switched Data server
+#define PN_OBJ_CSD_SRV       0x31
+
 // MACROS
 //  None
 
@@ -561,7 +565,7 @@
         void CsdMultimediaDataRateInd( const TIsiReceiveC &aIsiMessage );
 
         /**
-        * Creates subblocks for CSD_CALL_CONTROL_REQ 
+        * Creates subblocks for CSD_CALL_CONTROL_REQ
         * @param aTelNumber Phone number to be called
         * @param aIdRestrict Caller id restriction
         * @param aCsdIsiMsg CSD IsiMsg
@@ -631,65 +635,25 @@
         TInt PnsPipeCreateReq( const TUint8 aPipeStateAfter ) const;
 
         /**
-        * Creates PnsPipeEnableReq ISI message and sends it to Phonet.
-		* @return error value: Symbian error code
-        */
-        TInt PnsPipeEnableReq() const;
-
-        /**
-        * Creates PnsPipeResetReq ISI message and sends it to Phonet.
-        * @param aStateAfterReset: pipe state after reset
-		* @return error value: Symbian error code
-        */
-        TInt PnsPipeResetReq( const TUint8 aStateAfterReset );
-
-        /**
         * Creates PnsPipeRemoveReq ISI message and sends it to Phonet.
 		* @return error value: Symbian error code
         */
         TInt PnsPipeRemoveReq();
 
         /**
-        * Creates PnsPipeRedirectReq ISI message and sends it to Phonet.
-		* @return error value: Symbian error code
-        */
-        TInt PnsPipeRedirectReq();
-
-        /**
-        * PnsPipeCreate response. 
+        * PnsPipeCreate response.
         * @param aIsiMessage, reference to the received message.
         * @return void
         */
         void PnsPipeCreateResp( const TIsiReceiveC &aIsiMessage );
 
         /**
-        * PnsPipeEnable response.
-        * @param aIsiMessage, reference to the received message.
-        * @return void
-        */
-        void PnsPipeEnableResp( const TIsiReceiveC& aIsiMessage );
-
-        /**
-        * PnsPipeReset response. 
-        * @param aIsiMessage, reference to the received message.
-        * @return void
-        */
-        void PnsPipeResetResp( const TIsiReceiveC& aIsiMessage );
-
-        /**
-        * PnsPipeRemove response. 
+        * PnsPipeRemove response.
         * @param aIsiMessage, reference to the received message.
         * @return void
         */
         void PnsPipeRemoveResp( const TIsiReceiveC& aIsiMessage );
 
-        /**
-        * PnsPipeRedirect response. 
-        * @param aIsiMessage, reference to the received message.
-        * @return void
-        */
-        void PnsPipeRedirectResp( const TIsiReceiveC& aIsiMessage );
-
     public:     // Data
         // None
 
@@ -798,16 +762,16 @@
 
 		// Video call connected or disconnected
         TUint8 iVideoCallStatus;
-        
+
 		// bearer rate for multimedia call
         TUint8 iDataRateCode;
-        
+
         // Call direction
         RMobileCall:: TMobileCallDirection iCallDirection;
 
         // Mobile call info
         RMobileCall::TMobileCallInfoV1 iMobileCallInfo;
-        
+
         // Is call multimedia/video call
         TBool iIsMultimedia;
 
@@ -817,14 +781,17 @@
         // Pipe handle for video/multimediacall
         TUint8 iPipeHandle;
 
-        TUint8 iSecondPepDeviceId; 
-        TUint8 iSecondPepObjectId;
-        
         // Call Operation ID
         TUint8 iCallOperationID;
 
-        // Video call mt released
-        TBool iVideoCallMtReleased;
+        // Video call mo/mt released
+        TBool iVideoCallReleased;
+
+        // CALL_ID of the call controlled request
+        TUint8 iCallControlCallId;
+
+        // call control result
+        TUint8 iCcResult;
 
     public:     // Friend classes
         // None
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -517,7 +517,7 @@
         * Handles responses to UICC_APDU_RESP
         * @param aStatus Status
         * @param aFileData File data
-        * @param aTraId transaction id 
+        * @param aTraId transaction id
         * @return none
         */
         void UiccSendAPDUResp(
@@ -671,6 +671,7 @@
         TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData );
 
     protected: // New functions
@@ -782,6 +783,13 @@
             RMmCustomAPI::TNetworkModeCaps aNetworkModeCaps );
 
         /**
+        * Request for current RAT
+        * @param TUInt8 aTransId: Transaction Id
+        * @return TInt : result
+        */
+        TInt GssCsServiceReq( TUint8 aTransId );
+
+        /**
         * Breaks received GSS_CS_SERVICE_RESP ISI message
         * @param const TIsiReceiveC& aIsiMessage: The received ISI message
         * @return void : None
@@ -796,26 +804,6 @@
         void GssCsServiceFailResp( const TIsiReceiveC& aIsiMessage );
 
         /**
-        * MtcRat Query
-        * @param TUInt8 aTransId: Transaction Id
-        * @return TInt : result
-        */
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-        // Removed for Bridge camp!
-        TInt MtcRatQueryReq( TUint8 aTransId );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-        /**
-        * MtcRat Query Response
-        * @param TIsiReceiveC& aIsiMessage: ISI message
-        * @return void : None
-        */
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-        // Removed for Bridge camp!
-        void MtcRatQueryResp( const TIsiReceiveC& aIsiMessage );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-        /**
         * Handles the ReadViagHomeZoneParamsResp response message.
         * @param const TIsiReceiveC& aIsiMessage: a pointer to incoming message
         * @return void
@@ -975,13 +963,13 @@
         * read.
         */
         TInt  GetTotalLifeTimerValue();
-        
+
         /**
         * Constructs and sends AUTHENTICATE APDU to the UICC
         * @param aDataPackage: data containing authentication parameters
         * @return TInt: KErrNone / Error value from phonet
         */
-        TInt CMmCustomMessHandler::UiccSendAuthenticateApdu( 
+        TInt CMmCustomMessHandler::UiccSendAuthenticateApdu(
             const CMmDataPackage& aDataPackage );
 
 
@@ -994,7 +982,7 @@
         * @return void: none
         */
         void UiccCreateRunGsmAlgorithmApdu(
-            TUiccSendApdu& aParams, 
+            TUiccSendApdu& aParams,
             const TDesC8& aRand,
             TUiccTrId aTraId );
 
@@ -1016,8 +1004,8 @@
         * @param aDataPackage: data containing authentication parameters
         * @return void: none
         */
-        void UiccCreateGsmSecurityContextApdu( 
-            TUiccSendApdu& params, 
+        void UiccCreateGsmSecurityContextApdu(
+            TUiccSendApdu& params,
             const CMmDataPackage& aDataPackage );
 
         /**
@@ -1040,9 +1028,9 @@
         * @param aTraId: tr id used in UICC request
         * @return void: none
         */
-        void UiccCreate3GSecurityContextApdu( 
-            TUiccSendApdu& aParams, 
-            const TDesC8& aRand, 
+        void UiccCreate3GSecurityContextApdu(
+            TUiccSendApdu& aParams,
+            const TDesC8& aRand,
             const TDesC8& aAuth,
             TUiccTrId aTraId );
 
@@ -1065,11 +1053,11 @@
         * @return void: none
         */
         void UiccCreateGBABootstrappingApdu(
-            TUiccSendApdu& aParams, 
+            TUiccSendApdu& aParams,
             const CMmDataPackage& aDataPackage );
 
         /**
-        * Handles response APDU for GBA security context AUTHENTICATE 
+        * Handles response APDU for GBA security context AUTHENTICATE
         * APDU (bootstrapping mode)
         * @param aTraId: transaction id of received message
         * @param aStatus: status of the response
@@ -1082,7 +1070,7 @@
             const TDesC8& aFileData );
 
         /**
-        * Starts GBA bootstrap operation by reading elementary file EFgba. After reading 
+        * Starts GBA bootstrap operation by reading elementary file EFgba. After reading
         * is done, B-Tid and keylifetime is updated to EFgba
         * @param aDataPackage: data containing parameters going to be written
         *                      to the EFgba
@@ -1109,18 +1097,18 @@
         void UiccGBABootstrapUpdateResp( TInt aStatus );
 
         /**
-        * Constructs GBA security context AUTHENTICATE APDU 
+        * Constructs GBA security context AUTHENTICATE APDU
         * (NAF derivation mode)
         * @param aParams: parameter where the apdu is constructed
         * @param aDataPackage: data containing authentication parameters
         * @return void: none
         */
         void UiccCreateGBABootstrapNafDerivationApdu(
-            TUiccSendApdu& aParams, 
+            TUiccSendApdu& aParams,
             const CMmDataPackage& aDataPackage );
 
         /**
-        * Handles response APDU for GBA security context AUTHENTICATE 
+        * Handles response APDU for GBA security context AUTHENTICATE
         * APDU (NAF derivation mode)
         * @param aTraId: transaction id of received message
         * @param aStatus: status of the response
@@ -1133,18 +1121,18 @@
             const TDesC8& aFileData );
 
         /**
-        * Constructs MBMS security context AUTHENTICATE APDU 
+        * Constructs MBMS security context AUTHENTICATE APDU
         * (MSK Update Mode)
         * @param params: parameter where the apdu is constructed
         * @param aDataPackage: data containing authentication parameters
         * @return void: none
         */
         void UiccCreateMbmsMskUpdateApdu(
-            TUiccSendApdu& params, 
+            TUiccSendApdu& params,
             const CMmDataPackage& aDataPackage );
 
         /**
-        * Handles response APDU for MBMS security context AUTHENTICATE 
+        * Handles response APDU for MBMS security context AUTHENTICATE
         * APDU (MSK Update Mode)
         * @param aTraId: transaction id of received message
         * @param aStatus: status of the response
@@ -1156,18 +1144,18 @@
             const TDesC8& aFileData );
 
         /**
-        * Constructs MBMS security context AUTHENTICATE APDU 
+        * Constructs MBMS security context AUTHENTICATE APDU
         * (MTK Generation Mode)
         * @param params: parameter where the apdu is constructed
         * @param aDataPackage: data containing authentication parameters
         * @return void: none
         */
         void UiccCreateMbmsMtkGenerationApdu(
-            TUiccSendApdu& params, 
+            TUiccSendApdu& params,
             const CMmDataPackage& aDataPackage );
 
         /**
-        * Handles response APDU for MBMS security context AUTHENTICATE 
+        * Handles response APDU for MBMS security context AUTHENTICATE
         * APDU (MTK Generation Mode)
         * @param aStatus: status of the response
         * @param aFileData: response apdu
@@ -1178,18 +1166,18 @@
             const TDesC8& aFileData );
 
         /**
-        * Constructs MBMS security context AUTHENTICATE APDU 
+        * Constructs MBMS security context AUTHENTICATE APDU
         * (MSK Deletion Mode)
         * @param params: parameter where the apdu is constructed
         * @param aDataPackage: data containing authentication parameters
         * @return void: none
         */
         void UiccCreateMbmsMskDeletionApdu(
-            TUiccSendApdu& params, 
+            TUiccSendApdu& params,
             const CMmDataPackage& aDataPackage );
 
         /**
-        * Handles response APDU for MBMS security context AUTHENTICATE 
+        * Handles response APDU for MBMS security context AUTHENTICATE
         * APDU (MSK Deletion Mode)
         * @param aStatus: status of the response
         * @param aFileData: response apdu
@@ -1207,7 +1195,7 @@
         void CMmCustomMessHandler::UiccCreateFirstBlockOfAuthRespApdu( TUiccTrId aTrId );
 
         /**
-        * Maps sw1 and sw2 from response authenticate apdu to result 
+        * Maps sw1 and sw2 from response authenticate apdu to result
         * @param sw1: status of the response
         * @param sw2: response apdu
         * @return TUint8: command result
@@ -1218,17 +1206,17 @@
         * Validates received apdu
         * @param aTraId: Identifies the apdu
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
-        TUint8 ValidateReceivedAuthenticateApdu( 
-            TInt aTraId, 
+        TUint8 ValidateReceivedAuthenticateApdu(
+            TInt aTraId,
             const TDesC8& aApdu );
 
         /**
         * Validates received gsm security context apdu for authenticate
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
         TUint8 ValidateGsmSecurityContextApduResp( const TDesC8& aApdu );
@@ -1236,7 +1224,7 @@
         /**
         * Validates received 3G security context apdu for authenticate
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
         TUint8 Validate3GSecurityContextApduResp( const TDesC8& aApdu );
@@ -1245,7 +1233,7 @@
         * Validates received GBA security context apdu (GBA bootstrapping mode)
         * for authenticate
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
         TUint8 ValidateGBABootstrappingApduResp( const TDesC8& aApdu );
@@ -1254,7 +1242,7 @@
         * Validates received GBA security context apdu (GBA NAF derivation mode)
         * for authenticate
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
         TUint8 ValidateGBANafDerivationApduResp( const TDesC8& aApdu );
@@ -1262,7 +1250,7 @@
         /**
         * Validates received RUN GSM ALGORITHM apdu for authenticate
         * @param aApdu: APDU to be verified
-        * @return TUint8: KApduOk if verified successfully, 
+        * @return TUint8: KApduOk if verified successfully,
         *                 otherwise KApduNok
         */
         TUint8 ValidateRunGsmAlgorithmApduResp( const TDesC8& aApdu );
@@ -1288,7 +1276,7 @@
         * @param aMbmsData: APDU data
         * @return void: none
         */
-        void UiccMskUpdateHandleOMABcastOperationData( 
+        void UiccMskUpdateHandleOMABcastOperationData(
             RMmCustomAPI::TSimAuthenticationMgvMskUpdate& aMskUpdate,
             TDesC8& aMbmsData );
 
@@ -1300,7 +1288,7 @@
         * @param aMbmsData: APDU data
         * @return void: none
         */
-        void UiccMtkGenHandleMbmsOperationData( 
+        void UiccMtkGenHandleMbmsOperationData(
             RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen,
             TDesC8& aMbmsData );
 
@@ -1312,7 +1300,7 @@
         * @param aMbmsData: APDU data
         * @return void: none
         */
-        void UiccMtkGenHandleOMABcastOperationData( 
+        void UiccMtkGenHandleOMABcastOperationData(
             RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen,
             TDesC8& aMbmsData );
 
@@ -1320,7 +1308,7 @@
         * Finds tlv objects from BER TLV object
         * @param aTlvTag: tag of teh tlv object to be search
         * @param aBerTlv: BER TLV object where to search
-        * @param aTlvObject: tlv object data is copied to this 
+        * @param aTlvObject: tlv object data is copied to this
         *                    parameter, if it's found
         * @return TBool: ETrue if tlv object found, otherwise EFalse
         */
@@ -1337,7 +1325,7 @@
         * @param aKc:     Kc which is used in calculation
         * @return void: none
         */
-        void DeriveCkFromKc( 
+        void DeriveCkFromKc(
             TDes8& aCk,
             const TDesC8& aKc );
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmenstoremesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,229 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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
+#ifndef _CMMENSTOREMESSHANDLER_H_
+#define _CMMENSTOREMESSHANDLER_H_
+
+#include <e32def.h>
+#include <ctsy/serviceapi/cmmgsmphonestorageutility.h>
+#include "mmmmesshandlerbase.h"
+#include "cmmphonetsender.h"
+#include "cmmphonetreceiver.h"
+
+//UICC
+#include "muiccoperationbase.h"
+#include "cmmuiccmesshandler.h"
+
+// CONSTANTS
+    // None
+
+// MACROS
+    // None
+
+// DATA TYPES
+    // None
+
+// EXTERNAL DATA STRUCTURES
+    // None
+
+// FUNCTION PROTOTYPES
+    // None
+
+// FORWARD DECLARATIONS
+class CMmPhoNetSender;
+class CMmPhoNetReceiver;
+class CMmENStoreTsy;
+class CMmENStoreExtInterface;
+class TIsiReceiveC;
+class CMmMessageRouter;
+class CMmUiccMessHandler;
+
+// CLASS DECLARATION
+
+/**
+* CMmENStoreMessHandler is used to create and send mode-independent
+* ISI-messages to PhoNet via PhoNetSender. It also receives ISI-messages
+* from PhoNet via PhoNetReceiver. If the message is mode-independent,
+* it will be handled here. Otherwise, the message will be sent to message
+* handler of active mode.
+*/
+class CMmENStoreMessHandler
+        : public CBase,
+        public MMmMessHandlerBase,
+        public MUiccOperationBase
+    {
+    public:
+
+        /**
+        * Destructor
+        */
+        ~CMmENStoreMessHandler();
+
+        /**
+        * Creates a new EN store message handler object
+        * @param CMmPhoNetSender*: pointer to phonet sender
+        * @param CMmPhoNetReceiver*: pointer to phonet receiver
+        * @param CMmMessageRouter*: pointer to message router
+        */
+        static CMmENStoreMessHandler* NewL(
+            CMmMessageRouter* aMessageRouter,
+            CMmUiccMessHandler* aUiccMessHandler );
+
+        /**
+        * Receives ISI messages from phonet receiver
+        * @param const TIsiReceiveC: SIM ISI message
+        */
+        void ReceiveMessageL( const TIsiReceiveC& aIsiMessage );
+
+        /**
+        * Handles errors comes from PhoNetReceiver RunError
+        * @param const TIsiReceiveC& aIsiMessage: The received ISI message
+        * @param TInt aError: Error code
+        */
+        void HandleError(
+            const TIsiReceiveC& aIsiMessage,
+            TInt aError );
+
+        /**
+        * From CMessHandlerBase. This method is the single entry point for
+        * requests coming from the Symbian OS layer to this message handler
+        * @param TInt: aIpc IPC number of the request
+        * @param CMmDataPackage*: aDataPackage
+        * @return TInt: KErrNone or error code
+        */
+        TInt ExtFuncL(
+            TInt aIpc,
+            const CMmDataPackage* aDataPackage );
+
+        /**
+        * Handles a received message by calling the specific
+        * message handling method.
+        *
+        * @param Transaction id
+        * @param Status
+        * @param aFileData reference to Data received in message
+        * @return KErrNone or error code
+        */
+        TInt ProcessUiccMsg(
+                TInt aTransactionId,
+                TInt aStatus,
+                TUint8 aDetails,
+                const TDesC8 &aFileData );
+
+    protected:
+        //None
+
+    private:
+
+        /**
+        * Constructor
+        */
+        CMmENStoreMessHandler();
+
+        /**
+        * Initialises object attributes.
+        */
+        void ConstructL();
+
+        /**
+        * Handles EFecc read responses
+        * @param TInt aStatus: status returned by UICC server
+        * @param const TDesC8& aFileData: data from EFecc file
+        * returned by UICC server
+        * @return TInt: success or failure
+        */
+        TInt UiccReadEmergCodesResp(
+                TInt aStatus,
+                const TDesC8& aFileData );
+
+        /**
+        * Provide UICC application file id
+        * @param const TDesC8&: reference to data
+        * @param TDes8&: reference to buffer where digits are stored
+        */
+        void GetEmergencyNumberDigits(
+                const TDesC8& aReadIn,
+                TDes8& aNumberBuf );
+
+        /**
+        * Handles EFecc file info
+        * @param TInt aStatus: status returned by UICC server
+        * @param const TDesC8& aFileData: data from EFecc file
+        * returned by UICC server
+        * @return TInt: success or failure
+        */
+        TInt CMmENStoreMessHandler::UiccENStoreGetInfoResp(
+                TInt aStatus,
+                const TDesC8& aFileData );
+
+        /**
+        * Create EFecc read request
+        * @param TInt: location to be read
+        * @return TInt: succes or failure
+        */
+        TInt UiccReadEmergCodesReq(
+                TInt aIndex,
+                TUiccTrId traId );
+
+        /**
+        * Create EFecc file info request
+        * @param TInt: transaction id
+        * @return TInt: succes or failure
+        */
+        TInt ReadEfEccFileInfo( TUiccTrId aTraId );
+
+    // ATTRIBUTES
+    public:
+
+    protected:
+
+        // Pointer to the Phonet sender
+        CMmPhoNetSender* iPhoNetSender;
+
+    private:
+
+        //Pointer to the Message router
+        CMmMessageRouter* iMessageRouter;
+
+        // Pointer to the UICC Messhandler
+        CMmUiccMessHandler* iMmUiccMessHandler;
+
+        // ECC entry location index
+        TInt iReadECCLocation;
+
+        // Array for emergency number storing
+        CArrayPtrFlat<TENStoreResponse>* iEnNumberArray;
+
+        // IPC value of the last request
+        TInt iCurrentIpc;
+
+        // Count of used entries
+        TInt iUsedEntries;
+
+        // Count of entries left to be read
+        TInt iEntryCount;
+
+        // record number to be read
+        TInt iRecordNbr;
+    };
+
+#endif // _CMMENSTOREMESSHANDLER_H_
+
+// End of File
+
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmmessagerouter.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmmessagerouter.h	Thu Jan 14 10:44:58 2010 +0200
@@ -56,6 +56,7 @@
 class CMmNetOperatorNameHandler;
 class CMmSupplServMessHandler;
 class CMmPhoneBookStoreMessHandler;
+class CMmENStoreMessHandler;
 class CMmPacketServiceMessHandler;
 class CMmPacketContextMessHandler;
 class CMmPacketQoSMessHandler;
@@ -246,6 +247,9 @@
         // pointer to PhoneBook store message handler
         CMmPhoneBookStoreMessHandler* iMmPhoneBookStoreMessHandler;
 
+        // pointer to emergency number store message handler
+        CMmENStoreMessHandler* iMmENStoreMessHandler;
+
         // pointer to Phonet/ISA interface
         RIscApi iPhoNet;
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -96,7 +96,7 @@
         * @param aFileData Descriptor for file data
         * @return KErrNone or error code
         */
-        TInt ProcessUiccMsg( TInt aTraId, TInt aStatus, const TDesC8& aFileData );
+        TInt ProcessUiccMsg( TInt aTraId, TInt aStatus, TUint8 aDetails, const TDesC8& aFileData );
 
         /**
         * Entry point for request from the message manager
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -26,6 +26,8 @@
 #include <ctsy/rmmcustomapi.h>
 
 #include "cmmnetmesshandler.h"
+#include "muiccoperationbase.h"
+#include "cmmuiccmesshandler.h"
 
 // CONSTANTS
 // Max length of Operator Name String (ONS name).
@@ -65,6 +67,7 @@
 // FORWARD DECLARATIONS
 class TIsiReceiveC;
 class TIsiSubBlock;
+class CMmUiccMessHandler;
 
 // CLASS DECLARATION
 
@@ -73,17 +76,19 @@
 * ISI messages to PhoNet via PhoNetSender. It also receives
 * Operator name handling specific ISI messages from PhoNetReceiver.
 */
-class CMmNetOperatorNameHandler : public CBase
+class CMmNetOperatorNameHandler : public CBase, public MUiccOperationBase
     {
     public: // Constructors and destructor
 
         /**
         * Two-phased constructor.
         * @param aNetMessHandler: Pointer to the NetMessHandler.
+        * @param aUiccMessHandler: Pointer to the UiccMessHandler.
         * @return created message handler object.
         */
         static CMmNetOperatorNameHandler* NewL(
-            CMmNetMessHandler* aNetMessHandler );
+            CMmNetMessHandler* aNetMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler );
 
         /**
         * Destructor.
@@ -139,21 +144,6 @@
         void InfoPpReadResp( const TIsiReceiveC& aIsiMessage );
 
         /**
-        * Creates a SIM_OPERATOR_REQ ISI message with service type
-        * SIM_ST_READ_PNN and sends it to phonet.
-        * Used to read the PLMN Network Name from EFpnn on (U)SIM.
-        * @param aPnnIdentifier is identifier of the record to be read.
-        */
-        void SimOperatorReqReadPnn( TUint8 aPnnIdentifier );
-
-        /**
-        * Breaks a SIM_OPERATOR_RESP ISI message with service type
-        * SIM_ST_READ_PNN.
-        * @param const TIsiReceiveC& aIsiMessage: The received ISI message.
-        */
-        void SimOperatorRespReadPnnL( const TIsiReceiveC& aIsiMessage );
-
-        /**
         * Creates a PERM_PM_RECORD_WRITE_REQ ISI message and sends
         * it to phonet.
         * Used to Write record for PMM.
@@ -185,6 +175,41 @@
         */
         TInt GetPnnRecordIdentifierValue();
 
+        /**
+        * Creates a UICC_APPL_CMD_REQ ISI message with service type
+        * UICC_APPL_FILE_INFO and sends it to phonet.
+        * Used to read the record count of EFopl on (U)SIM.
+        */
+        void UiccReadOplRecordCount();
+
+        /**
+        * Handle UICC response messages
+        * @param aTraId Transaction ID
+        * @param aStatus Status
+        * @param aFileData File data from (U)SIM
+        * @return KErrNone or error code
+        */
+        TInt ProcessUiccMsg(
+            TInt aTraId,
+            TInt aStatus,
+            TUint8 aDetails,
+            const TDesC8& aFileData );
+
+        /**
+        * Read operator name from (U)SIM
+        * @return None
+        */
+        void UiccOperatorReq();
+        
+        /**
+        * Creates a UICC_APPL_CMD_REQ ISI message and sends it to phonet.
+        * Used to read the PLMN Network Name from EFpnn on (U)SIM.
+        * @param aPnnIdentifier is identifier of the record to be read.
+        * @return None.
+        */
+        void UiccOperatorReqReadPnn( TUint8 aPnnIdentifier );
+        
+
     private: // Constructors and destructor
 
         /**
@@ -321,6 +346,63 @@
         */
         void CompleteMobilePhoneGetDetectedNetworksV2Phase1L();
 
+        /**
+        * Response handling for EFopl record count
+        * @param aStatus Status
+        * @param aFileData FCI data containig recored count
+        * @return void
+        */
+        void UiccOplRecordCountResponse(
+            TInt aStatus,
+            const TDesC8& aFileData );
+
+        /**
+        * Request to read a record from EFopl
+        * @return void
+        */
+        void UiccReadOplReq();
+
+        /**
+        * Response handling for received EFopl record
+        * @param aFileData File data
+        * @return void
+        */
+        void UiccReadOplResp( const TDesC8& aFileData );
+
+        /**
+        * Response handling for operator name
+        * @param aStatus Status
+        * @param aFileData File data
+        * @return void
+        */
+        void UiccOperatorResp( TInt aStatus, const TDesC8& aFileData );
+
+        /**
+        * Request to read EFpnn from (U)SIM
+        * @param aMCC is current Mobile Country Code.
+        * @param aMNC is current Mobile Network Code.
+        * @param aPnnIdentifier is PNN record identifier.
+        * @param aLocationAreaData is current LAC data.
+        * @param aNetworkData is Network data.
+        * @return None.
+        */
+        void SendReadPnnReq(
+            TUint aMCC,
+            TUint aMNC,
+            TUint8 aPnnIdentifier,
+            const RMobilePhone::TMobilePhoneLocationAreaV1& aLocationAreaData,
+            const RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkData );
+
+
+        /**
+        * Response handling for PLMN Network Name (EFpnn)
+        * @param aStatus Status
+        * @param aFileData File data
+        * @return None.
+        */
+        void UiccOperatorRespReadPnnL( TInt aStatus, const TDesC8& aFileData );
+
+
     protected: // Constructors and destructor
 
         /**
@@ -382,6 +464,9 @@
         // Pointer to the NetMessHandler.
         CMmNetMessHandler* iNetMessHandler;
 
+        // Pointer to UICC message handler
+        CMmUiccMessHandler* iMmUiccMessHandler;
+
         // Storing Location Area data for later use.
         RMobilePhone::TMobilePhoneLocationAreaV1 iLocationAreaData;
         // Storing Network data for later use.
@@ -434,6 +519,12 @@
         // Manual search data list array.
         RArray<TManualSearchDataList> iManualSearchDataList;
 
+        // Number of records in EFopl
+        TInt iOplRecordCount;
+
+        // Record number of EFopl
+        TUint8 iOplRecordNumber;
+
     protected: // Data
 
     };
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Thu Jan 14 10:44:58 2010 +0200
@@ -61,6 +61,7 @@
         */
         static CMmPhoneBookOperationCache* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler,
             TInt aIpc,
             const CMmDataPackage* aDataPackage );
 
@@ -69,19 +70,6 @@
         */
         ~CMmPhoneBookOperationCache();
 
-        /**
-        * Calculates transaction id from data package
-        * @param aIpc IPC number
-        * @param aDataPackage data package
-        * @param aTransactionId resulting transaction id
-        * @return TInt KErrNotSupported or KErrNone
-        */
-        static TInt CalculateTransactionId(
-            TInt aIpc,
-            const CMmDataPackage* aDataPackage,
-            TUint8& aTransactionId
-            );
-
     private:
 
         /**
@@ -100,92 +88,30 @@
         * @param const CMmDataPackage* aDataPackage: Packaged data.
         * @return TInt: KErrNone or error value.
         */
-        TInt CreateReq( TInt aIpc, const CMmDataPackage* aDataPackage );
-
-        /**
-        * Handles SimPbResp ISI -message
-        * @param TIsiReceiveC& aIsiMessage: Received ISI message
-        * @param TBool& aComplete: Indicates if request can remove from
-        *        operationlist or not.
-        * @return TInt: KErrNone or error value
-        */
-        TInt HandleSimPbRespL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
-
-        /**
-        * Handles SimPbResp ISI -message, Cache.
-        * @param TIsiReceiveC& aIsiMessage: Received ISI message
-        * @param TBool& aComplete: Indicates if request can remove from
-        *        operationlist or not.
-        * @return TInt: KErrNone or error value
-        */
-        TInt HandleSimPbRespLCacheL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage, TUint8 aTransId );
 
         /**
-        * Handles SimPbResp ISI -message, Get info
-        * @param TIsiReceiveC& aIsiMessage: Received ISI message
-        * @param TBool& aComplete: Indicates if request can remove from
-        *        operationlist or not.
-        * @return TInt: KErrNone or error value
+        * Handles Recieved data
+        * @param TBool& aComplete : flag to check operation needs to be removed form the list or not.
+        * @param TInt aStatus : To get the UICC Server response status
+        * @param const TDeC9 &aFileData : Data received in ISI Message
+        * @param TInt aTransId : transaction Id sent in request message
+        * @return TInt: KErrNone or error value.
         */
-        TInt HandleSimPbRespGetInfo(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
-
+        TBool HandleUICCPbRespL ( TInt aStatus, TUint8 aDetails, const TDesC8 &aFileData, TInt aTraId);
+        
+        
         /**
-        * Prepares operation to start caching.
-        * @param const CMmDataPackage* aDataPackage: data
-        * @return TInt: KErrNone or error value
-        */
-        TInt PrepareCacheReq( const CMmDataPackage* aDataPackage );
-
-        /**
-        * Creates and sends ISI message in order to read entry from SIM
-        * @param TUint8 aTransactionId : Transaction id
-        * @param TInt aLocation : Location index
+        * Creates message in order to read entry from SIM
+        * @param aRecordNo entry to be read
         * @return TInt : KErrNone or error value
         */
-        TInt SimPbReqRead( TUint8 aTransactionId, const TInt aLocation );
-
-        /**
-        * Checks if this cacheing operation is prepared to be launched
-        * @return TBool ETrue - operation is ready to be launched
-        */
-        TBool IsPrepared() const;
+        TInt USimPbReqRead( TInt aRecordNo, TUint8 aTransId );
 
         /**
         * Cancels cacheing request
         */
-        void CancelReq();
-
-        /**
-        * Prepares the operation (makes it ready to be launched).
-        * @param aIpc IPC request
-        * @param aDataPackage parameters to prepare request with
-        * @return TInt KErrNotReady on attempt to prepare prepared operation
-        * @return TInt KErrArgument on attempt to create malformed request
-        */
-        TInt PrepareReq(
-            TInt aIpc,
-            const CMmDataPackage* aDataPackage
-            );
-
-        /**
-        * Launches activated operation.
-        * @return TInt KErrNotReady on attempt to launch not prepared operation;
-        * or system-wide error code
-        */
-        TInt LaunchReq();
-
-        /**
-        * Completes the request.
-        * @param aErrorCode error code to be completed with
-        * @return TInt KErrNone or KErrNotSupported if operation is not prepared
-        */
-        TInt CompleteReq( TInt aErrorCode );
+        void CancelReq( TName& aPhoneBook );
 
     public: // Data
         // None
@@ -200,6 +126,19 @@
 
         // Number of used VMBX entries
         TInt iNumOfUsedVMBXEntries;
+        
+        // Flag to store EXT needs to be read or not
+        TBool iExtensionToRead;
+        
+        // To Store the information about no of entries filled in commontsy araay
+        TInt iNumOfEntriesFilled;
+        
+        // Store information about operation has been canceled or not
+        TBool iCancelOperation;
+
+        // Attribute to Store Entry
+        TPBEntry* iStoreEntry;
+
 
 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationdelete.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationdelete.h	Thu Jan 14 10:44:58 2010 +0200
@@ -8,60 +8,79 @@
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-* 
+*
 * Contributors:
-* 
+*
 * Description:
 *
 */
 
-#ifndef _CMMPHONEBOOK_OPERATION_DELETE_H
-#define _CMMPHONEBOOK_OPERATION_DELETE_H
+#ifndef CMMPHONEBOOKOPERATIONDELETE_H
+#define CMMPHONEBOOKOPERATIONDELETE_H
 
-// INCLUDES
+//  INCLUDES
 #include <ctsy/pluginapi/cmmdatapackage.h>
 #include <e32base.h>
+
 #include "cmmphonebookstoreoperationbase.h"
 
-// CONSTANTS
-    // None
+//  CONSTANTS
+    //none
 
-// MACROS
-    // None
+//  MACROS
+    //none
 
-// DATA TYPES
-    // None
+//  DATA TYPES
+    //none
 
-// EXTERNAL DATA STRUCTURES
-    // None
+//  EXTERNAL DATA STRUCTURES
+enum TPBDeletePhases
+    {
+    EPBDeletePhaseReadExtensions,
+    EPBDeletePhaseReadEntry,
+    EPBDeletePhaseDeleteExtension,
+    EPBDeletePhase_Read_MBI_profile,
+    EPBDeletePhase_delete_MBI_profile,
+    EPBDeletePhaseDeleteEntry
+    };
 
-// FUNCTION PROTOTYPES
-    // None
 
-// FORWARD DECLARATION
-    // None
+//  FUNCTION PROTOTYPES
+    //none
 
 // CLASS DECLARATION
 /**
-* CMmPhoneBookOperationDelete is used to create and send GSM-specific
-* PBStore ISI messages to PhoNet via PhoNetSender relating to delete.
+* CMmPhoneBookOperationWrite is used to create and send GSM-specific
+* PBStore ISI messages to PhoNet via PhoNetSender relating to write.
 */
-class CMmPhoneBookOperationDelete : public CMmPhoneBookStoreOperationBase
+class CMmPhoneBookOperationDelete
+    : public CMmPhoneBookStoreOperationBase
     {
-    public: // Constructors and destructor
+    public:  // Constructors and destructor
 
         /**
         * Two-phased constructor.
-        * @return CMmPhoneBookOperationDelete*: created object
         */
         static CMmPhoneBookOperationDelete* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler,
             const CMmDataPackage* aDataPackage );
+
         /**
         * Destructor.
         */
         ~CMmPhoneBookOperationDelete();
 
+        /**
+        * This method creates entry point to correct operation
+        * @param aPhonebookType PhoneBook type
+        * @param aIpc IPC
+        * @return Pointer to operation.
+        */
+        static CMmPhoneBookOperationDelete* Build(
+            TName aPhonebookType,
+            TInt aIpc );
+
   private:
 
         /**
@@ -70,74 +89,153 @@
         CMmPhoneBookOperationDelete();
 
         /**
+        * Class attributes are created in ConstructL.
+        */
+        //void ConstructL();
+
+        /**
         * Separates different IPC requests for each other.
-        * @param TInt aIpc: Identify number of request.
-        * @param const CMmDataPackage* aDataPackage: Packaged data.
-        * @return TInt: KErrNone or error value.
+        *
+        * @param aIpc Identify number of request.
+        * @param aDataPackage Packaged data.
+        * @return KErrNone or error value.
         */
-        TInt CreateReq( TInt aIpc, const CMmDataPackage* aDataPackage );
+        TInt UICCCreateReq(
+            TInt aIpc,
+            const CMmDataPackage* aDataPackage,
+            TUint8 aTransId );
+
+        /**
+        * Handles UICC response ISI -message
+        * @param aStatus Status
+        * @param aFileData File data
+        * @param aTransId Transaction ID
+        * @return Is operation going to be deleted
+        */
+        TBool HandleUICCPbRespL(
+            TInt aStatus,
+            TUint8 aDetails,
+            const TDesC8& aFileData,
+            TInt aTransId );
 
         /**
-        * Handles SimPbResp ISI -message
-        * @param  TIsiReceiveC& aIsiMessage
-        * @param TBool& aComplete: Indicates if request can remove from
-        *    operationlist or not.
-        * @return TInt: KErrNone or error value.
+        * Handles request to delete a phonebook entry
+        * @return KErrNone or error value
         */
-        TInt HandleSimPbRespL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TInt UiccPbReqDelete();
+
+        /**
+        * Creates and sends ISI message in order to delete an entry
+        * @return KErrNone or error value
+        */
+        TInt UiccPbReqDeleteEntry();
 
         /**
-        * Handling delete response
-        * @param TIsiReceiveC& aIsiMessage
-        * @param TBool& aComplete: Indicates if request can remove from
-        *    operationlist or not.
-        * @return TInt: KErrNone or error value.
+        * Creates and sends ISI message in order to delete an extension
+        * @param aExtRecordNum Extension record number
+        * @return KErrNone or error value
+        */
+        TInt UiccPbReqDeleteExt( TInt aExtRecordNum );
+
+        /**
+        * Creates and sends ISI message in order to read an entry
+        * @return KErrNone or error value
         */
-        TInt HandleDeleteResp(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TInt UiccPbReqReadEntry();
+
+        /**
+        * Handles phonebook entry data
+        * @param aFileData File data
+        * @return KErrNone or error value
+        */
+        TInt HandleReadEntryResp( const TDesC8& aFileData );
+
+        /**
+        * Creates and sends ISI message in order to read an extension
+        * @return KErrNone or error value
+        */
+        TInt UiccPbReqReadExt( TUint8 aExtRecordNum );
 
         /**
-        * Creates and sends ISI message in order to delete an entry from SIM
-        * @param TInt16 aIndex: Location index
-        * @return TInt: KErrNone or error value.
+        * Handles phonebook extension data
+        * @param aFileData File data
+        * @return KErrNone or error value
         */
-        TInt SimPbReqDelete( TInt16 aIndex );
-
+        TInt HandleReadExtResp( const TDesC8& aFileData );
+        
         /**
-        * Creates and sends ISI message in order to delete all entries from SIM
-        * @return TInt: KErrNone or error value.
+        * Creates request to read MBI record
+        * @return KErrNone or error value
         */
-        TInt SimPbReqDeleteAll();
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        TInt UiccPbReqReadMBI();
+        
         /**
-        * Creates and sends ISI message in order to delete alphastring from SIM
-        * @return TInt: KErrNone or error value
+        * Handles phonebook extension data
+        * @param aStatus
+        * @param aDetails
+        * @param aFileData File data
+        * @return KErrNone or error value
         */
-        TInt SimDeleteAlphaStringReq();
-
+        TInt HandleWriteMBIReadResp(TInt aStatus, TUint8 aDetails, const TDesC8& aFileData );
+        
         /**
-        * Receives SIM_PB_RESP(SIM_PB_DELETE) ISI messages from phonet receiver
-        * @param TIsiReceiveC: reference to the received message.
-        * @return TInt: KErrNone or error code
+        * Creates request to Delete MBI profile
+        * @return KErrNone or error value
         */
-        TInt SimDeleteAlphaStringRespL( const TIsiReceiveC& aIsiMessage );
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        TInt UiccPBReqDeleteMBIProfile();
 
-    public: // Data
+        
+    public:     // Data
         // None
 
-    protected: // Data
-        // None
+    protected:  // Data
+        // none
+
+    private:    // Data
+
+       // Keep track on current delete phase
+       TPBDeletePhases iCurrentDeletePhase;
+
+       // Phone book entry to be deleted
+       CPhoneBookStoreEntry* iPhoneBookEntry;
+
+       // IPC number of operation
+       TInt iIpc;
+
+       // Number of entries
+       TInt iNumOfEntries;
+
+       // Number of extension records in entry
+       TInt iNumOfExtensions;
+
+       // Elementary file ID
+       TUint16 iFileId;
 
-    private: // Data
-        // None
+       // Extension file ID
+       TUint16 iFileIdExt;
+
+       // Record number in phonebook to be deleted
+       TInt iIndex;
+
+       // Phonebook entry
+       TPBEntry iEntry;
+
+       // Transaction ID used in delete operations
+       TUint8 iTransId;
 
+       // Location index of phonebook type
+       TUint8 iArrayIndex;
+
+       // Information of location already read
+       TBool iLocationFoundInPbList;
+       
+       // Array to store ext rexords to be deletet
+       RArray<TInt> iExtRecordArrayToBeDelete;
+       
+       // Attribute to store MBI Profiletype
+       TUint8 iMBIProfileType;
 };
 
-#endif // _CMMPHONEBOOK_OPERATION_DELETE_H
+#endif // CMMPHONEBOOKOPERATIONDELETE_H
 
-// End of File
+// End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit.h	Thu Jan 14 10:44:58 2010 +0200
@@ -36,7 +36,26 @@
     // None
 
 // EXTERNAL DATA STRUCTURES
-    // None
+    enum TPBIniPhases
+    {
+    EPBInitPhaseADN = 0,
+    EPBInitPhaseFDN,
+    EPBInitPhaseSDN,
+    EPBInitPhaseMBDN,
+    EPBInitPhaseMSISDN,
+    EPBInitPhaseVMBX,
+    EPBInitPhase_File_Info,
+    EPBInitPhase_FIle_Data,
+    EPBInitPhase_Complete,
+    EPBInitPhase_3GADN_PBR,
+    EPBInitPhase_3GADN_Type1,
+    EPBInitPhase_3GADN_Type2,
+    EPBInitPhase_3GADN_Type3,
+    EPBIniPhase_3GADNDone,
+    EPBIniPhase_PBInitialized,
+    EPBIniPhase_Unknown,
+    EPBIniPhase_Internal
+    };
 
 // FUNCTION PROTOTYPES
     // None
@@ -95,7 +114,7 @@
         * Creates phonebook initialize request for UICC card Type
         * @return TInt: KErrNone or error value.
         */
-        TInt UICCInitializeReq();
+        TInt UICCInitializeReq(TUint8 aTransId);
         
         /**
         * Get the next phonebook init Phase
@@ -121,7 +140,7 @@
         * @return TInt: KErrNone or error value.
         */
         TInt HandlePBRespL(
-            const TDesC8& aFileData, TInt aStatus);
+            const TDesC8& aFileData, TInt aStatus, TUint8 aTransId );
 
 
 
@@ -134,7 +153,7 @@
         */
         void ConstructL( );
 
-        TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage );
+        TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage, TUint8 aTransId );
 
         
 
@@ -156,9 +175,9 @@
         * @param TDesC8& aFileData
         * @return TInt: KErrNone or error value.
         */
-        TInt HandleUICCPbRespL(
-            TBool &aComplete,
+        TBool HandleUICCPbRespL(
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8 &aFileData,
             TInt aTransId);
 
@@ -178,8 +197,12 @@
         */
         TInt HandleEXTFileResp(const TDesC8 &aFileData, TInt aStatus);        
 
-        
-
+        /**
+        * Handle FileData of MBI File Response
+        * @param const TDes8& aFileData: UICC Message
+        * @return TInt: KErrNone or error value.
+        */
+        TInt HandleMBIFileResp( const TDesC8 &aFileData , TInt aStatus );
 
         
         
@@ -201,8 +224,11 @@
         TInt iNumOfPBRRecords;
         // Indicates is internal init ongoing or not.
         TBool iInternalInit;
-        // keep track for whihc file has extension file no 
-        TBool iExtensionPresent;
+        // Attribute to check what kind of read is ongoing
+        TTypeOfFileToBeRead iTypeOfReading ;
+        // Attribute to Store MBI recordlength
+        TUint8 iMbiRecLen;
+
         
         // Check for ADN is Initilized or not 
         
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Thu Jan 14 10:44:58 2010 +0200
@@ -92,28 +92,138 @@
         */
         void ConstructL();
 
-        TInt UICCCreateReq(TInt aIpc, const CMmDataPackage* aDataPackage);
-        TInt UICCInitializeReq3GADN();
+        /**
+        * Create request to Start initialization for Phonebook
+        * @param aIpc
+        * @param aDataPackage
+        * @param aTransId
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UICCCreateReq(TInt aIpc, const CMmDataPackage* aDataPackage, TUint8 aTransId);
 
+        /**
+        * Create request to Start initialization for 3G ADN Phonebook
+        * @param aTransId
+        * @return TInt: KErrNone or error value.
+        */
+
+        TInt UICCInitializeReq3GADN( TUint8 aTransId);
+
+        /**
+        * Create request to Start initialization for Type1 , Type2 and Type3 Files in PBR
+        * @param aparams
+        * @param aFiletype
+        * @return TInt: KErrNone or error value.
+        */
         TInt CreateReqFetchTypeFile(
                 TUiccReadLinearFixed &aparams,
                 const TUint8 aFileType);
         
-        TInt HandleUICCPbRespL(TBool &aComplete,TInt aStatus,const TDesC8 &aFileData,TInt aTransId);
-        TInt HandleUICCPbResp3GADN(const TDesC8 &aFileData, TInt aStatus);
+
+        /**
+        * Handles response for PhoneBook Init 
+        * @param aFileData
+        * @param TInt aTraId
+        * @param TInt aStatus
+        * @param TDesC8& aFileData
+        * @return TInt: KErrNone or error value.
+        */
+
+        TBool HandleUICCPbRespL( TInt aStatus,
+                TUint8 aDetails,
+                const TDesC8 &aFileData,
+                TInt aTransId );
+
+        /**
+        * Handles response for 3GADN PhoneBook Init 
+        * @param aFileData
+        * @param TInt aTraId
+        * @param TInt aStatus
+        * @param TDesC8& aFileData
+        * @return TInt: KErrNone or error value.
+        */
+
+        TInt HandleUICCPbResp3GADN(const TDesC8 &aFileData, TInt aStatus, TUint8 aTransId );
+
+        /**
+        * Send Request to read Type 1 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @return TInt: KErrNone or error value.
+        */
 
         TInt FetchType1FileFromPBR(const TDesC8 &aFileData);
+
+        /**
+        * Send Request to read Type 2 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @return TInt: KErrNone or error value.
+        */
+
         TInt FetchType2FileFromPBR(const TDesC8 &aFileData);
+
+        /**
+        * Send Request to read Type 3 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @return TInt: KErrNone or error value.
+        */
+
         TInt FetchType3FileFromPBR(const TDesC8 &aFileData);
 
         
+        /**
+        * Handles FileData of Type 1 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @param TInt aStatus
+        * @return TInt: KErrNone or error value.
+        */
+
         void HandleType1FileResp(const TDesC8& aFileData, TInt aStatus);
+
+        /**
+        * Handles FileData of Type 2 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @param TInt aStatus
+        * @return TInt: KErrNone or error value.
+        */
+
         void HandleType2FileResp(const TDesC8& aFileData, TInt aStatus);
+        
+        /**
+        * Handles FileData of Type 3 file info for ADN 3G initialization
+        * @param TDesC8& aFileData
+        * @param TInt aStatus
+        * @return TInt: KErrNone or error value.
+        */
+
         void HandleType3FileResp(const TDesC8& aFileData, TInt aStatus);
         
+        /**
+        * Check for 2 Files have same File id in PBR TLV Data
+        * @return TInt: KErrNone or error value.
+        */
         TInt CheckForFileId();
+
+        /**
+        * Check for no of recors for Type 1 File SHould be same as EF_ADN file
+        * @param aNoOfRecords
+        * @return TInt: KErrNone or error value.
+        */
+
         TInt CheckForNoOfRecords(TInt aNoOfRecords);
+
+        /**
+        * Check same File id fot Type and Type 2 Files
+        * @return TInt: KErrNone or error value.
+        */
+
         TInt CheckForSameType1AndType2Files();
+
+        /**
+        * Check for fixed recordlegth EF have correct Recordlength
+        * @param aNoOfRecords
+        * @return TInt: KErrNone or error value.
+        */
+
         TInt CheckRecordSizeForFixedLength(TInt aFileType, TInt aFileId, TInt aRecordLength);
 
         
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread.h	Thu Jan 14 10:44:58 2010 +0200
@@ -59,6 +59,7 @@
         */
         static CMmPhoneBookOperationRead* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler,
             const CMmDataPackage* aDataPackage );
 
         /**
@@ -80,14 +81,14 @@
 
 virtual TInt UICCHandleData3gADNReadReq( TInt /*aFileID*/, TInt /*aFileSFI*/)
 {
-	      TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
+        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
         return KErrNotSupported;
 }
 
 
 virtual TInt HandleUICC3gADNRespL(const TInt /*aStatus*/, const TDes8& /*aFileData*/, const TInt /*aTransId*/)
 {
-	      TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
+        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
         return KErrNotSupported;
 }
   private:
@@ -97,8 +98,8 @@
         * Class attributes are created in ConstructL.
         */
         void ConstructL();
-        
-        // Transmit 
+
+        // Transmit
 
         /**
         * Separates different IPC requests for each other.
@@ -106,23 +107,23 @@
         * @param const CMmDataPackage* aDataPackage: Packaged data.
         * @return TInt: KErrNone or error value.
         */
-        TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage );
+        TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage, TUint8 aTransId );
 
         /**
         * Constructs an ISI-message to read entry from SIM
         * @param
         * @return TInt: KErrNone or error value.
         */
-        TInt USimPbReqRead( TInt aRecordNo );
-        
+        TInt USimPbReqRead( TInt aRecordNo, TUint8 aTransId );
+
         /**
         * Constructs Data to read entry from USIM ADN Phonebook
         * @param
         * @return TInt: KErrNone or error value.
         */
         TInt UICCHandleDataADNReadReq( TUiccReadLinearFixed& aParams, TUint16 aFileID, TUint8 aFileSFI );
-        
-        
+
+
         // Receive
 
         /**
@@ -132,14 +133,14 @@
         *        operationlist or not.
         * @return TInt: KErrNone or error value.
         */
-        TInt HandleUICCPbRespL(
-                TBool &aComplete,
+        TBool HandleUICCPbRespL(
                 TInt aStatus,
+                TUint8 aDetails,
                 const TDesC8 &aFileData,
                 TInt aTransId);
 
-        
-        
+
+
         /**
         * Handles SimPbResp ISI -message
         * @param  TInt aTagValue
@@ -147,7 +148,7 @@
         * @return TInt: KErrNone or error value.
         */
         TInt UICCHandleDataADNReadResp( const TDesC8& aFileData);
-        
+
 
     public: // Data
         // None
@@ -160,18 +161,21 @@
         // array
         TInt iNumOfEntriesFilled;
 
+        // To Store the information about first valid Entry Search
+        TBool iLocationSearch;
+
     private: // Data
-        // None
 
-        // Attribute to check if Extension read is going on 
+        // Attribute to check what kind of read is ongoing
+        TTypeOfFileToBeRead iTypeOfReading ;
+
         TBool iExtensionRead ;
         
-        // Attribute to store the service type requested 
-        TInt iServiceType;
+        // Attribute to Store Entry
+        TPBEntry* iStoreEntry;
         
-        // Attribute to store no of records for all EF
-        
-        TInt iNumOfPhoneBookRecords;
+        // Saved IPC for complete
+        TInt iSavedIPCForComplete;
 
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread3g_adn.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread3g_adn.h	Thu Jan 14 10:44:58 2010 +0200
@@ -51,7 +51,12 @@
         * Two-phased constructor.
         * @return CMmPhoneBookOperationRead3g_adn*: created object
         */
-        static CMmPhoneBookOperationRead3g_adn* NewL();
+        static CMmPhoneBookOperationRead3g_adn* NewL
+               (
+                CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+                CMmUiccMessHandler* aUiccMessHandler,
+                const CMmDataPackage* aDataPackage // Data
+               );
 
         /**
         * Destructor.
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Thu Jan 14 10:44:58 2010 +0200
@@ -34,6 +34,18 @@
     //none
 
 //  EXTERNAL DATA STRUCTURES
+enum TPBWritePhases
+    {
+    EPBWritePhase_Read_Entry = 0,
+    EPBWritePhase_Read_Ext_Entry,
+    EPBWritePhase_Search_Ext_Entry,
+    EPBWritePhase_Write_Entry,
+    EPBWritePhase_Write_Ext_Entry,
+    EPBWritePhase_Read_MBI_profile,
+    EPBWritePhase_Write_MBI_profile,
+    EPBWritePhase_complete
+    };
+
 
 //  FUNCTION PROTOTYPES
     //none
@@ -90,9 +102,10 @@
         * @param aDataPackage Packaged data.
         * @return KErrNone or error value.
         */
-        TInt CreateReq(
+        TInt UICCCreateReq(
             TInt aIpc,
-            const CMmDataPackage* aDataPackage );
+            const CMmDataPackage* aDataPackage,
+            TUint8 aTransId );
 
         /**
         * Handles SimPbResp ISI -message
@@ -102,33 +115,130 @@
         *        operationlist or not.
         * @return KErrNone or error value.
         */
-        TInt HandleSimPbRespL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TBool HandleUICCPbRespL(
+                TInt aStatus,
+                TUint8 aDetails,
+                const TDesC8& aFileData,
+                TInt aTransId );
+
+        /**
+        * Handles HandleWriteReadEntryResp aFileData
+        *
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
+        */
+        TInt HandleWriteReadEntryResp(
+            TInt aStatus,
+            const TDesC8& aFileData,
+            TUint8 aTransId,
+            TUint16 aFileId,
+            TUint16 aFileIdExt,
+            TUint8 aArrayIndex );
+
+        /**
+        * Handles HandleWriteReadExtEntryResp aFileData
+        *
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
+        */
+        TInt HandleWriteReadExtEntryResp(
+            TInt aStatus,
+            const TDesC8& aFileData,
+            TUint8 aTransId,
+            TUint16 aFileId,
+            TUint16 aFileIdExt);
 
         /**
-        * Handles HandleWriteResp ISI -message
+        * Handles HandleWriteSearchExtEntryResp aFileData
         *
-        * @param aIsiMessage
-        * @param aComplete Indicates if request can remove from
-        *        operationlist or not.
-        * @return KErrNone or error value.
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
         */
-        TInt HandleWriteResp(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TInt HandleWriteSearchExtEntryResp(
+            TInt aStatus,
+            const TDesC8& aFileData,
+            TUint8 aTransId,
+            TUint16 aFileId,
+            TUint16 aFileIdExt );
+        
+        /**
+        * Handles HandleWriteEntryResp aFileData
+        *
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
+        */
+        TInt HandleWriteEntryResp(
+            TInt aStatus,
+            TUint8 aTransId,
+            TUint16 aFileId,
+            TUint16 aFileIdExt );
 
         /**
-        * Handling write response at delete phase
+        * Handles HandleWriteExtEntryResp aFileData
+        *
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
+        */
+        TInt HandleWriteExtEntryResp(
+            TInt aStatus,
+            TUint8 aTransId,
+            TUint16 aFileId,
+            TUint16 aFileIdExt);
+        
+        /**
+        * Handles HandleWriteMBIReadResp aFileData
         *
-        * @param aIsiMessage
-        * @param aComplete Indicates if request can remove from
-        *        operationlist or not.
-        * @return KErrNone or error value.
+        * @param aFileData
+        * @param aTransId - Transaction id received
+        * @param aFileId - file id for main PB file
+        * @param aFileIdExt - file Id for EXT fiel related to main PB file
+        * @ param aArrayIndex - Array index for the Array in which configuration data Stored
+        * @param aStatus - Response message status
+        * @return complete 
         */
-        TInt HandleWriteDeleteL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
+        TInt HandleWriteMBIReadResp( 
+                TInt aStatus,
+                TUint8 aDetails,
+                TUint8 aTransId,
+                const TDesC8 &aFileData ); 
+        
+        
+        /**
+        * Handles HandleWriteMBIWriteResp aFileData
+        *
+        * @param aStatus
+        * @param aDetails -
+        * @param aTransId - Transaction id received
+        * @return complete 
+        */
+        TInt HandleWriteMBIWriteResp(
+                TInt aStatus,
+                TUint8 aDetails );
 
         /**
         * Creates and sends ISI message in order to wite an entry to SIM
@@ -138,7 +248,7 @@
         * @param aDataToWrite Entry to write
         * @return KErrNone or error value
         */
-        TInt SimPbReqWriteL(
+        TInt UiccPbReqWriteL(
             TUint8 aTraId,
             TInt16 aIndex,
             CPhoneBookStoreEntry& aDataToWrite );
@@ -148,148 +258,89 @@
         *
         * @param aTraId Transaction id
         * @param aIndex Location index
+        * @param aDataToWrite Entry to write
         * @return KErrNone or error value
         */
-        TInt SimPbReqWriteDelete(
-            TUint8 aTraId,
-            const TInt16 aIndex );
-
-        /**
-        * Compose 3G data if available
-        *
-        * @param aDataToWrite Entry
-        * @param aDataPtr Reference to data
-        * @param aErrVal error value
-        * @return KErrNone or error value
-        */
-        TInt Compose3GDataL(
-            CPhoneBookStoreEntry& aDataToWrite,
-            TDes8& aDataPtr
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            ,TInt& aErrVal
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-             );
+        TInt UiccPBReqWriteEntry(
+                TUint16 aFileId,
+                TUint8 aIndex,
+                TUint8 aTraId,
+                CPhoneBookStoreEntry& aDataToWrite );
 
         /**
-        * Count sublock length
-        *
+        * Creates and sends ISI message in order to wite an ext to SIM
+        * @param aFileId File Id
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aFileId 
         * @param aDataToWrite Entry to write
-        * @param aNumOfSubblocks Number of subblocks
-        * @param aMessageLength MessageLength
-        * @return None
+        * @return KErrNone or error value
         */
-        void CountSublocksAndMessLength(
-            CPhoneBookStoreEntry& aDataToWrite,
-            TUint8& aNumOfSubblocks,
-            TInt& aMessageLength );
+        TInt UiccPbReqWriteExt(
+                TUint8 aTraId,
+                TUint8 aIndex,
+                TUint16 aFileId,
+                TUint16 aFileIdExt,
+                CPhoneBookStoreEntry& aDataToWrite );
 
         /**
-        * Create SIM_DATA_SIZE_READ_REQ message.
+        * Creates and sends ISI message in order to read an existing entry Ext record from SIM
         *
-        * @param aTraId Transaction Id
-        * @param aComplete
-        * @return KErrNone or error value.
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aFileId File id
+        * @return KErrNone or error value
         */
-        TInt BuildSimDataSizeReadReqData(
-            TUint8 aTraId,
-            TBool& aComplete );
-
-        /**
-        * Handling error situation
-        *
-        * @param aIsiMessage ISI message
-        * @param aStatus Status from ISI message
-        * @param aSbStartOffSet Offset to data
-        * @return KErrNone or error value.
-        */
-        TInt ErrorStatusHandling(
-            const TIsiReceiveC& aIsiMessage,
-            TUint8 aStatus,
-            TUint& aSbStartOffSet );
+        TInt UiccPbReqWriteReadExt(
+                TUint16 aFileId,
+                TUint16 aFileIdExt,
+                TUint8 aIndex,
+                TUint8 aTraId );
 
         /**
-        * Add tSIM_SB_NAME_NUMBER
+        * Creates and sends ISI message in order to read an existing entry from SIM
         *
-        * @param aSubBlockId Subblock Id
-        * @param aLocation Location
-        * @param aName Reference to data name
-        * @param aNumber Reference to data number
-        * @param aDataToAppend Reference to data
-        * @return None
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aFileId File id
+        * @return KErrNone or error value
         */
-        void AddSimSbNameNumberSubBlock(
-            TUint16& aSubBlockId,
-            TInt16& aLocation,
-            TDesC& aName,
-            TDesC& aNumber,
-            TDes8& aDataToAppend );
-
-        /**
-        * Add tSIM_SB_TEXT_NUMBER
-        *
-        * @param aSubBlockId Reference to subblock data
-        * @param aLocation Location
-        * @param aText Reference to text data
-        * @param aDataToAppend Reference to data
-        * @return None
-        */
-        void AddSimSbTextSubBlock(
-            const TUint16& aSubBlockId,
-            TInt16& aLocation,
-            TDesC& aText,
-            TDes8& aDataToAppend );
+        TInt UiccPbReqWriteRead(
+                TUint16 aFileId,
+                TUint8 aIndex,
+                TUint8 aTraId );
 
         /**
-        * Add tSIM_SB_NUMBER_NUMBER
-        *
-        * @param aLocation Location
-        * @param aNumber Reference to number
-        * @param aAasRecordNumber AAS number
-        * @param aDataToAppend Reference to data
-        * @return None
-        */
-        void AddSimSbNumberSubBlock( const TUint16& aSubBlockId,
-            TInt16& aLocation,
-            TDesC& aNumber,
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            TUint8 aAasRecordNumber,
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            TDes8& aDataToAppend );
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
-        /**
-        * Add tSIM_SB_GROUP_NUMBER
-        *
-        * @param aSubBlockId
-        * @param aGrpLocation
-        * @param aGasLocations
-        * @param aDataToAppend:
-        * @return None
-        */
-        void AddSimSbGroupSubBlock( const TUint16& aSubBlockId,
-            TInt16& aGrpLocation,
-            CArrayFixFlat<TInt>* aGasLocations,
-            TDes8& aDataToAppend );
-
-        /**
-        * Creates and sends ISI message in order to write alphastring to SIM.
-        *
-        * @param None
+        * Creates and sends ISI message in order to delete EXT file record releted to PB entry
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aDataToWrite Entry to write
         * @return KErrNone or error value
         */
-        TInt SimWriteAlphaStringReq();
-
+        TInt UiccPbReqWriteExtDelete(
+                TUint16 aFileId,
+                TUint16 aFileIdExt,
+                TUint8 aIndex,
+                TUint8 aTransId );
+        
         /**
-        * Receives SIM_PB_RESP(SIM_PB_WRITE) ISI messages from phonet receiver
-        *
-        * @param aIsiMessage Reference to the received message.
-        * @return KErrNone or error code
+        * Creates and sends ISI message in order to read MBI Profile form first record
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aDataToWrite Entry to write
+        * @return KErrNone or error value
         */
-        TInt SimWriteAlphaStringRespL( const TIsiReceiveC& aIsiMessage );
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        TInt UiccPbReqReadMBI( TUint8 aIndex, TUint8 aTransId );
 
-
+        
+        /**
+        * Creates and sends ISI message in order to write MBI Profile form first record
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aDataToWrite Entry to write
+        * @return KErrNone or error value
+        */
+        TInt UiccPBReqWriteMBIProfile( TUint8 aTransId, TUint8 aIndex, TUint8 aOperationType );
     public:     // Data
         // None
 
@@ -303,6 +354,33 @@
 
         // Keep track on current write -phase
         TPBWritePhases iCurrentWritePhase;
+        
+        // Array to Store new EXT records
+        RArray<TInt> iExtRecordArrayToBeWrite;
+        
+        // Array to store EXT record nos to be delete
+       RArray<TInt> iExtRecordArrayToBeDelete; 
+       
+       // EXT record number to be read
+       TInt iExtRecordNo;
+       
+       // Store the no of ext records already written
+       TUint8 iExtRecordWritten;
+       
+       // Attribute Store the information if it is location search
+       TBool iLocationSearch;
+       
+       // Attribute to store the information if delete EXT operation going on 
+       TBool iExtDeleteOperation;
+       
+       // For Free Entry Search
+       TInt iEntryToWrite;
+       
+       // To Store Entry to update List
+       TPBEntry* iEntryToUpdateInList; 
+       
+       // to store the MBI operation
+       TUint8 iMBIOperation;
 };
 
 #endif // CMMPHONEBOOKOPERATIONWRITE_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -8,9 +8,9 @@
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-* 
+*
 * Contributors:
-* 
+*
 * Description:
 *
 */
@@ -38,10 +38,96 @@
     //none
 
 //  MACROS
-    //none
+
+#define UICC_MAX_PB_NUM      8
+
+// LOCAL CONSTANTS AND MACROS
+#define TON_NPI_NO_TEL_NBR          0xFF
+#define TON_NPI_INTERNATIONAL       0x91
+#define TON_NPI_UNKNOWN             0x00
+#define TON_INTERNATIONAL           0x10
+
+#define MASK_TON_FROM_TON_NPI_BYTE(a) ((a) & 0x70)
+#define MASK_LOWER_NIBBLE_OF_BCD(a) ((a) & 0x0f)      /* B0000_1111 */
+
+#define UICC_DTMF_CONTROL_DIGIT_CHAR_wait   'w'
+#define UICC_DTMF_CONTROL_DIGIT_CHAR  'p'
+#define UICC_WILD_VALUE_CHAR          '?'
+#define UICC_WILD_VALUE_CHAR_ADN      'w'
+#define UICC_EXPANSION_CHAR           'e'
+#define UICC_INTERNATIONAL_NUM        '+'
+
+#define UICC_EF_MAX_NAME_LEN                241
 
 //  DATA TYPES
-    //none
+    //enum
+
+enum TPBConfData
+    {
+    ADNConfData = 0,
+    FDNConfData,
+    SDNConfData,
+    MBDNConfData,
+    VMBXConfData,
+    MSISDNConfData,
+    };
+
+struct TPBEntry
+    {
+    RArray<TInt> PBEntryExtRecord;
+    TBool iEntryPresent;
+    TUint8 iEntryIndex;
+    };
+
+struct TPBEntryList
+    {
+    RArray< TPBEntry* > iEntryList;
+    };
+
+
+class TPrimitiveInitInfo
+    {
+public:
+    TPrimitiveInitInfo();
+    
+    void GetPBEntryFromUICCData( const TDesC8 &aFileData, TDes8& aNumber, TDes8& aName);
+    
+    
+    TUint16 iNoOfRecords;          // 2 byte long
+    TUint16 iAlphaStringlength;    // 2 byte long
+    TUint16 iNumlength;          // 2 byte long
+    TUint16 iExtNoOfRec;
+    TUint8 iMbiRecLen;          
+    TBool iExtension;
+    };
+
+
+// Struct 
+
+
+// look up table for BCD digits
+
+const TUint8 LookupArray[16]= 
+      {    
+              '0','1','2','3','4','5','6','7','8','9',    /* 0-9 */
+              '*',                                        /* 0xA */
+              '#',                                        /* 0xB */
+              UICC_DTMF_CONTROL_DIGIT_CHAR,            /* 0xC, DTMF control digit * separator  */
+              UICC_WILD_VALUE_CHAR,                    /* 0xD, 'Wild' value */
+              UICC_EXPANSION_CHAR,                     /* 0xE, Expansion digit */
+      };
+
+const TUint8 LookupArrayAdn[16]= 
+      {    
+              '0','1','2','3','4','5','6','7','8','9',    /* 0-9 */
+              '*',                                        /* 0xA */
+              '#',                                        /* 0xB */
+              UICC_DTMF_CONTROL_DIGIT_CHAR,            /* 0xC, DTMF control digit * separator  */
+              UICC_WILD_VALUE_CHAR_ADN,                /* 0xD, 'Wild' value */
+              UICC_EXPANSION_CHAR,                     /* 0xE, Expansion digit */
+      };
+
+
 
 //  EXTERNAL DATA STRUCTURES
 
@@ -107,74 +193,100 @@
         * @param aFileData reference to Data received in message
         * @return KErrNone or error code
         */
-        TInt ProcessUiccMsg( TInt aTransactionId, TInt aStatus, const TDesC8 &aFileData );
+        TInt ProcessUiccMsg( TInt aTransactionId, TInt aStatus, TUint8 aDetails, const TDesC8 &aFileData );
         
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        /**
+        * Creates entry point to correct operation.
+        *
+        * @param aDataPackage Packaged data
+        * @param aIpc Identify number of request.
+        * @return Pointer to operation.
+        */
+        CMmPhoneBookStoreOperationBase* CreateNewOperationL(
+            const CMmDataPackage* aDataPackage,
+            TInt aIpc );
+        
         /**
-        * Gets pointer to list of Group Alpha String
+        * Store Phonebook Entry from UICC -message
         *
-        * @return Pointer to CMmPhoNetSender object.
+        * @param aName Name
+        * @param aNumber Number
+        * @param aEntry Received UICC data
+        * @param aFileId File ID
+        * @param const TInt aIndexToRead Index of file
+        * @param const TBool aMailboxIdExist Is there a mailbox id
+        * @return none
         */
-        CArrayPtrSeg<CMmPhonebookAlphaString>* Gas();
+        static void StorePhonebookEntryL( TDes8& aName,
+                                          TDes8& aNumber,
+                                          CPhoneBookStoreEntry& aEntry,
+                                          const TUint16 aFileId,
+                                          const TInt aIndexToRead,
+                                          const TBool aMailboxIdExist );
 
         /**
-        * Update list of Group Alpha String.
-        *
-        * @param aAas New list.
-        * @return None
+        * Handle number to convert in Ascii Format
+        * @param const TDesC8& aSource: Message to be converted in Ascii
+        * @param TDes16 aTarget : After conversion data to be staored in
+        */
+        static void ConvertToUcs2FromBCD( const TDesC8 &aSource,TDes16 &aTarget, const TUint16 aFileData );
+        
+        /**
+        * Handle number to convert in BCD format from UCS2 Format
+        * @param const TDesC16& aSource: Message to be converted in BCD
+        * @param TDes8 aTarget : After conversion data to be stored in target buffer
         */
-        void SetGas( CArrayPtrSeg<CMmPhonebookAlphaString>* aGas );
-
+        static TInt ConvertToBCDFromUCS2( TDes16 &aSource, TDes8 &aTarget, TUint16 aFileId );
+        
         /**
-        * Gets pointer to list of Additional Alpha String
+        * Handle number to convert in BCD format from UCS2 Format
+        * @param TInt16 aUCSCharacter: Character to be converted
+        * @param const TUint16 aFileId :File id
+        * @return The BCD number
+        */
+        static TInt GetBCDCodeforUCS( TUint16 aUCSCharacter, TUint16 aFileId );
+        
+        /**
+        * Sets PhoneBook Entry to PhoneBook Entry List.
         *
-        * @param None
-        * @return Pointer to CMmPhoNetSender object.
-        */
-        CArrayPtrSeg<CMmPhonebookAlphaString>* Aas();
-
-        /**
-        * Update list of Additional Alpha String
-        *
-        * @param aAas New list.
+        * @param aStoreEntry.
         * @return None
         */
-        void SetAas( CArrayPtrSeg<CMmPhonebookAlphaString>* aAas );
+        void StoreEntryToPhoneBookList( TPBEntry* aStoreEntry, TUint8 aPBIndex );
 
         /**
-        * Gets number of GAS
+        * Reset phonebook entry in phoneBook entry list.
         *
-        * @param None
-        * @return Number of GAS.
+        * @param aPbIndex Phonebook index
+        * @param aPbIndex Entry index
+        * @return None
         */
-        TInt MaxNumberOfGAS();
+        void ResetEntryInPhoneBookList( TUint8 aPbIndex, TInt aEntryIndex );
 
         /**
-        * Sets number of GAS.
+        * Sets PhoneBook Entry to PhoneBook Entry List.
         *
-        * @param aMaxNumberOfGAS Number of GAS
+        * @param aStoreEntry.
         * @return None
         */
-        void SetMaxNumberOfGAS( TInt aMaxNumberOfGAS );
+        TBool IndexCheckInPBList( TUint8 aIndex, TUint8 aPBIndex, TPBEntry& aEntry );
 
         /**
-        * Gets number on AAS entries.
+        * Find Index for Present Entry
         *
-        * @param
-        * @return Number of AAS entries.
+        * @param aIndex
+        * @param aPBIndex
+        * @return Index for Entry
         */
-        TInt MaxNumOfAasEntries();
+        TInt GetIndexForPresentEntry( TUint8 aIndex, TUint8 aPBIndex );
 
         /**
-        * Sets maximum number os AAS entries
+        * Finds free entry in the List.
         *
-        * @param aMaxNumOfAasEntries maximum number os AAS entries
-        * @return None
+        * @param TUint8 Phonebook index for Phonebook confoguration list
+        * @return TInt Index number for free entry
         */
-        void SetMaxNumOfAasEntries( TInt aMaxNumOfAasEntries );
-
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        TInt EmptyEntryCheckInPBList( TUint8 aPBIndex );
 
         /**
         * Gets MBDN phonebook flag.
@@ -201,6 +313,22 @@
         void SetNumberOfFdnInfoResps( TUint8 aNumber );
 
         /**
+        * Remove the main Entry Information from Stored list 
+        *
+        * @param aIndex - Index to be removed.
+        * @return None
+        */
+        void UpdateEntryFromList( TPBEntry* aEntry, TUint8 aIndex , TUint8 aPBIndex);
+
+        /**
+        * Remove the EXT records Information from Stored list 
+        *
+        * @param aIndex - Index of Ext record to be removed.
+        * @return None
+        */
+        void RemoveExtEntryFromList( TUint8 aIndex, TUint8 aPBIndex);
+        
+        /**
         * Gets pointer to CMmMessageRouter class.
         *
         * @param None
@@ -225,15 +353,6 @@
         */
         CMmPhoNetSender* PhoNetSender();
         
-        /**
-        * Gets pointer to CMmUiccMesshandler class.
-        *
-        * @param None
-        * @return Pointer to CMmMessageRouter object.
-        */
-        //CMmUiccMesshandler* UiccMessHandler();
-        
-
     protected:
         // None
 
@@ -260,7 +379,8 @@
         void SimInd( const TIsiReceiveC& aIsiMessage );
 
     public:     // Data
-        // None
+        // table for All phone books Configuration Data
+       TPrimitiveInitInfo  iPBStoreConf[UICC_MAX_PB_NUM];
 
     protected:  //Data
         // None
@@ -285,28 +405,8 @@
         // to store CardType 
         TUint8 iCardType;
         
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
-        // Keeps track of readed location of AAS/GAS
-        TUint16 iCount;
-
-        // Holds information for AAS and GAS
-        RMmCustomAPI::TAlphaStringParams iAlphaStringParams;
-
-        // Max number of GAS
-        TInt iMaxNumberOfGAS;
-
-        // Keeps track of max number of AAS
-        TInt iMaxNumOfAasEntries;
-
-        // Array for storing aas texts
-        CArrayPtrSeg<CMmPhonebookAlphaString>* iAas;
-
-        // Array for storing GAS texts
-        CArrayPtrSeg<CMmPhonebookAlphaString>* iGas;
-
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        // Array to Store PhoneBook Entry Status and EXT record no list
+        TFixedArray< TPBEntryList,UICC_MAX_PB_NUM > iPBEntryList;
 };
 
 #endif // CMMPHONEBOOKSTOREMESSHANDLER_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Thu Jan 14 10:44:58 2010 +0200
@@ -8,9 +8,9 @@
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-* 
+*
 * Contributors:
-* 
+*
 * Description:
 *
 */
@@ -106,12 +106,11 @@
 //File ID
 const TUint16 KMasterFile            = 0x3F00;  // Master File
 const TUint16 KDedicatedFileGSM      = 0x7F20;  // Dedicated File (Gsm)
-const TUint16 KDedicatedFileMBI      = 0x6FC9;  // Dedicated File (MBI)
 
 
 const TUint8 KTagFCIFileDescriptor = 0x82;     // for file descriptor tag in FCI data received from UICC Server
-const TUint8 KTagFCIFileIdentifier = 0x83;       // for File identifier in FCI data
-const TUint8 KTagFCIFileSize       = 0x85;      // for File size data
+const TUint8 KTagFCIFileIdentifier = 0x83;     // for File identifier in FCI data
+const TUint8 KTagFCIFileSize       = 0x80;     // for File size data
 const TUint8 KTagConstructedTagA8  = 0xA8;     // Type 1 files tag in PBR file
 const TUint8 KTagConstructedTagA9  = 0xA9;     // Type 2 files tag in PBR file
 const TUint8 KTagConstructedTagAA  = 0xAA;     // Type 3 files tag in PBR file
@@ -119,19 +118,14 @@
 
 const TUint8 KRecordLength   = 0;
 const TUint8 KNoOfRecords    = 1;
-const TUint8 KFileSize       = 2;
-const TUint8 KFileIdentifier = 3;
-const TUint8 KFileStatus     = 4;
-
-
-
-
-
+const TUint8 KFileSize1       = 2;
+const TUint8 KFileIdentifier1 = 3;
+const TUint8 KFileStatus1     = 4;
 
 // UICC constants
 #define MF_FILE                             0x3F00 //Master file
 #define DF_CURRENT_APP                      0x7FFF //
-#define DF_PHONEBOOK                        0x5F3A  
+#define DF_PHONEBOOK                        0x5F3A
 #define APPL_FILE_ID                        0x7F10  // Address for DFphonebook
 #define UICC_SESSION_ID_NOT_USED            0x00
 #define PB_UICC_SB_APPL_PATH_SB_LENGTH      0x0010
@@ -141,14 +135,16 @@
 #define PB_SDN_FID                          0x6F49
 #define PB_BDN_FID                          0x6F4D
 #define PB_MBDN_FID                         0x6FC7
+#define PB_MBI_FID                          0x6FC9
 #define PB_MSISDN_FID                       0x6F40
 #define PB_VMBX_FID                         0x6F17
 #define PB_EXT1_FID                         0x6F4A
 #define PB_EXT2_FID                         0x6F4B
 #define PB_EXT3_FID                         0x6F4C
-#define PB_EXT4_FID                         0x6F55
-#define PB_EXT5_FID                         0x6F4E
+#define PB_EXT4_FID                         0x6F4E
+#define PB_EXT5_FID                         0x6F55
 #define PB_EXT6_FID                         0x6FC8
+#define PB_EXT7_FID                         0x6FCC
 #define PB_PBR_FID                          0x4F30
 #define DF_PB_FILE_PATH                     0x3F007FFF5F3A
 #define UICC_SFI_NOT_PRESENT                0x00
@@ -157,6 +153,7 @@
 #define DF_PATH_PHONEBOOK                   0x5F3A
 #define UICC_SB_LINEAR_FIXED_SB_LENGTH      0x0008
 #define UICC_APPL_CMD_RESP_OFFSET           0x07
+#define UICC_ILLEGAL_FILE_ID                0xFFFF
 
 #define UICC_SB_FCI_FCP_EF_NO_REC_OFFSET    0x12
 #define UICC_SB_FCI_FCP_EF_REC_L_OFFSET     0x10
@@ -165,8 +162,8 @@
 #define UICC_EF_ANR_EXT_REC_OFFSET          0x15
 #define UICC_EF_FILE_EXT_FILE_NOT_EXIST     0xFF
 #define UICC_EF_FDN_NO_EXT_NUM_LEN          20
+#define UICC_EF_EXT_REC_NUM_LEN             11
 #define UICC_EF_MAX_NUM_LEN_WITH_EXT        2814
-#define UICC_EF_MAX_NAME_LEN                241
 #define UICC_EF_ANR_EXT_OFFSET              14
 #define UICC_EF_MAX_REC_LEN                 255
 
@@ -214,7 +211,7 @@
 #define UICC_EF_EMAIL_TAG                   0xCA
 #define UICC_EF_CCP1_TAG                    0xCB
 
-// UICC Server Service type 
+// UICC Server Service type
 #define UICC_APPL_READ_TRANSPARENT          0x21
 #define UICC_APPL_UPDATE_TRANSPARENT        0x22
 #define UICC_APPL_READ_LINEAR_FIXED         0x23
@@ -260,6 +257,9 @@
 
 
 #define UICC_NO_EXT_MAX_NUM_LEN             0x14
+#define UICC_EXT_REC_NO_OFFSET              12
+#define UICC_EMPTY_ENTRY_PATTERN_1          0xFF
+#define UICC_EMPTY_ENTRY_PATTERN_2          0x00
 
 
 // File types
@@ -279,26 +279,6 @@
     //none
 
 //  EXTERNAL DATA STRUCTURES
-enum TPBIniPhases
-    {
-    EPBInitPhaseADN = 0,
-    EPBInitPhaseFDN,
-    EPBInitPhaseSDN,
-    EPBInitPhaseMBDN,
-    EPBInitPhaseMSISDN,
-    EPBInitPhaseVMBX,
-    EPBInitPhase_File_Info,
-    EPBInitPhase_FIle_Data,
-    EPBInitPhase_Complete,
-    EPBInitPhase_3GADN_PBR,
-    EPBInitPhase_3GADN_Type1,
-    EPBInitPhase_3GADN_Type2,
-    EPBInitPhase_3GADN_Type3,
-    EPBIniPhase_3GADNDone,
-    EPBIniPhase_PBInitialized,
-    EPBIniPhase_Unknown,
-    EPBIniPhase_Internal
-    };
 
 
 enum TPhonebookType
@@ -308,17 +288,18 @@
     EPhonebookTypeSdn,
     EPhonebookTypeBdn,
     EPhonebookTypeVMBX,
-    EPhonebookTypeMBDN
+    EPhonebookTypeMBDN,
+    EPhonebookTypeMSISDN,
+    EPhonebookTypeUnknown
     };
 
-enum TPBWritePhases
+enum TTypeOfFileToBeRead
     {
-    EPBWritePhase_delete = 0,
-    EPBWritePhase_rewrite,
-    EPBWritePhase_complete
+    EBasicEfRead,
+    EExtensionRead,
+    EMailboxIdRead
     };
 
-
 // Struct data
 
 struct TPrimitiveTag
@@ -378,7 +359,7 @@
         /**
         * Cancels the operation.
         */
-        virtual void CancelReq();
+        virtual void CancelReq( TName& aPhoneBook );
 
         /**
         * Prepares the operation (makes it ready to be launched).
@@ -434,10 +415,10 @@
         * @param aFileData KErrNotSupported
         * @return KErrNotSupported.
         */
-        
-        virtual TInt HandleUICCPbRespL( TBool & /*complete*/, TInt /*aStatus*/, const TDesC8& /*aFileData*/, TInt /*aTransId*/)
+
+        virtual TBool HandleUICCPbRespL( TInt /*aStatus*/, TUint8 /*aDetails*/, const TDesC8& /*aFileData*/, TInt /*aTransId*/)
             {TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleUICCPbRespL - Return KErrNotSupported");
-            return KErrNotSupported; 
+            return ETrue;
             };
 
         /**
@@ -449,13 +430,14 @@
         */
         virtual TInt UICCCreateReq(
             TInt /*aIpc*/,
-            const CMmDataPackage* /*aDataPackage*/)
+            const CMmDataPackage* /*aDataPackage*/,
+            TUint8 /*aTransId*/ )
             {
             TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CreateReq - Return KErrNotSupported");
-            return KErrNotSupported; 
+            return KErrNotSupported;
             };
 
-            
+
         /**
         * Converts client phonebook to phonebook mask.
         *
@@ -464,7 +446,33 @@
         */
         static TUint8 ConvertToPBtype( const TName& aPBType );
 
-        
+
+        /**
+        * Converts client phonebook to phonebook mask.
+        *
+        * @param aPBType
+        * @return TUint8
+        */
+        static TUint16 ConvertToPBfileId( const TName& aPBType, TUint16& aFileIdExt );
+
+
+        /**
+        * Converts File ID to Index
+        *
+        * @param aFileId
+        * @return TUint8
+        */
+        static TUint8 ConvertToConfArrayIndex( const TUint16 aFileId );
+        /**
+        * Give return value for the transactio id According to operation and Phoenbook type
+        *
+        * @param aPBType
+        * @param aOperation
+        * @return TUint8
+        */
+        static TUint8 GetTransId( const TName& aPBType, const TUint8 aOperation );
+
+
         /**
         * Converts client phonebook to phonebook mask.
         *
@@ -472,8 +480,8 @@
         * @return TUint8
         */
         static TUint8 ConvertToPBtypeUICC( const TName& aPBType );
-        
-        
+
+
         /**
         * Converts client phonebooktype to client phonebook name.
         *
@@ -491,37 +499,12 @@
         void ConvertToPBname( const TUint8 aTrans, TName& aName );
 
         /**
-        * Separate Phonebook Entry from UICC -message
-        *
-        * @param aFileData Received UICC message
-        * @param aEntry Entry to be separated
-        * @return KErrNone or error value.
-        */
-        TInt SeparatePhoneBookEntryFromUiccMsgL(
-            const TDesC8& aFileData,
-            TDes8& aNameBuf,
-            TUint16 aSimPhonebookType);
-
-
-        /**
-        * Store Phonebook Entry from UICC -message
-        *
-        * @param aFileData Received UICC message
-        * @param aEntry Entry to be separated
-        * @return KErrNone or error value.
-        */
-        void StorePhonebookEntry(
-                TDes8& aName,
-                TDes8& aNumber,
-                CPhoneBookStoreEntry& aEntry);
-
-        /**
-        * Gets transactionId.
+        * Gets PhoneBookName.
         *
         * @param None
-        * @return TransactionId.
+        * @return phonebookname.
         */
-        TUint8 TransId();
+        const TName& GetPhoneBookName()const;
 
         /**
         * Convert number of phonebook type to server's phonebook type
@@ -532,29 +515,19 @@
         TUint16 ConvertToSimPhoneBookType(
             const TUint8 aPbMask );
 
+        /**
+        * Handle number to convert in Ascii Format
+        * @param const TDesC8& aSource: Message to be converted in Ascii
+        * @param TDes16 aTarget : After conversion data to be staored in
+        */
+        //void ConvertToUcs2FromBCD(const TDesC8 &aSource, TDes16 &aTarget );
 
         /**
-        * Gets the required parameter from FCI Data
-        *
-        * @param TDesC8 aFileData FCI Data
-        * @param TInt aValue actual value of parameter to be read
-        * @param TUint8 aParam parameter to be read
-        * @return Error
+        * Handle to Find the Empty Entry
+        * @param const TDesC8& aFileData: Entry data to checked entry is empty or not
+        * @return TInt: KErrNone or KErrNotFound
         */
-        TInt HandleFcpData( 
-                const TDesC8 &aFileData,
-                TInt& aValue,
-                TUint8 aParam);
-
-
-        /**
-        * Handle FileData of Type1File Response
-        * @param const TDes8& aFileData: UICC Message
-        * @return TInt: KErrNone or error value.
-        */
-        void Get16bit(TInt& aTarget, const TDesC8& aSource, TInt aIndex);
-
-
+        TInt EmptyEntryCheck( const TDesC8 &aFileData );
 
     protected:
 
@@ -632,12 +605,12 @@
 
         // Pointer to CMmPhoneBookStoreMessHandler.
         CMmPhoneBookStoreMessHandler* iMmPhoneBookStoreMessHandler;
-        
+
         // Pointer to UICC message handler
         CMmUiccMessHandler* iMmUiccMessHandler;
 
-        // TransactionId that consist with phonebook type and transactionId.
-        TUint8 iTransactionId;
+        // To store Phone Book type
+        TName iPhoneBookTypeName;
 
         // Pointer to array for Caching PB Store <ADN/FDN>.
         // CTSY take care of deleting entries.
@@ -654,22 +627,29 @@
 
         // Attribute to hold the information what index to be read
         TInt iIndexToRead;
+
+        // Is there any mailbox id
+        TBool iMailboxIdExist;
+
         // Attribute to store record length
         TInt iRecordLength;
 
         // Keeps track of error value if write completed only partially.
         TInt iRet;
 
-        // Phonebooktype, ADN, FDN, SDN...
-        TName iPhonebookType;
+        // modifiable Store number if there is extension number also there
+        TBuf8<UICC_EF_MAX_NUM_LEN_WITH_EXT> iNumberBuf;
 
-        // modifiable Store number if there is extension number also there 
-        TBuf8<UICC_EF_MAX_NUM_LEN_WITH_EXT> iNumberBuf;
-        
         // Store entry name
         TBuf8<UICC_EF_MAX_NAME_LEN> iNameBuf;
 
 
+       // Store for Empty Space
+        TUint8 iEmptyIndex;
+
+        // Attribute to check what kind of read is ongoing
+        TTypeOfFileToBeRead iTypeOfReading ;
+
 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
         // Holds information for AAS and GAS
         RMmCustomAPI::TAlphaStringParams iAlphaStringParams;
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationlist.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationlist.h	Thu Jan 14 10:44:58 2010 +0200
@@ -33,8 +33,7 @@
     //none
 
 //  MACROS
-    //none
-
+    // none
 //  DATA TYPES
     //none
 
@@ -72,16 +71,17 @@
         */
         ~CMmPhoneBookStoreOperationList();
 
+
         /**
-        * Creates entry point to correct operation.
+        * Addoperation to operation list
         *
-        * @param aDataPackage Packaged data
-        * @param aIpc Identify number of request.
-        * @return Pointer to operation.
+        * @param aTransId Transaction for index to be filled with operation
+        * @param aOperation operation to be updated in operation list
+        * @return None
         */
-        CMmPhoneBookStoreOperationBase* BuildL(
-            const CMmDataPackage* aDataPackage,
-            TInt aIpc );
+        void AddOperation(
+            TUint8 aTransId,
+            CMmPhoneBookStoreOperationBase* aOperation );
 
         /**
         * Get pointer to correct operation uing identify number.
@@ -91,8 +91,7 @@
         * @return Pointer to operation.
         */
         CMmPhoneBookStoreOperationBase* Find(
-            TUint8 aTrans,
-            const CMmPhoneBookStoreOperationBase* aSearchFrom=NULL );
+            TUint8 aTrans );
 
         /**
         * Remove correct operation from operation list.
@@ -103,24 +102,34 @@
         void RemoveOperationFromList( TUint8 aTrans );
 
         /**
-        * Removes last operation from operation list.
-        * @return TInt KErrNone or KErrNotFound in case list is empty
+        * Remove correct operation from operation list.
+        *
+        * @param aTrans Transaction Id
+        * @return None
+        */
+        void RemoveCacheOperationFromList( TUint8 aTrans );
+
+        /**
+        * Remove correct operation from operation list.
+        *
+        * @param aTrans Transaction Id
+        * @return None
         */
         TInt RemoveLastOperationFromList();
 
         /**
-        * Calculates transaction Id from IPC number and
-        * data package
-        * @param aIpc IPC number
-        * @param aDataPackage data package
-        * @param aTransactionId resulting transaction id
-        * @return TInt KErrNone or KErrNotSupported
+        * Check for empty Index
+        * @param aInd empty index
+        * @return TInt KErrNone or KErrNotFound
         */
-        static TInt CalculateTransactionId(
-            TInt aIpc,
-            const CMmDataPackage* aDataPackage,
-            TUint8& aTransactionId
-            );
+        TInt FindEmptyIndexTransId();
+        
+        /**
+        * Cancel all operation with same phonebook name
+        * @param aPhoneBook phoenbook name for operation
+        */
+        void CancelOperation( TName &aPhoneBook);
+
   private:
 
         /**
@@ -146,9 +155,8 @@
         // Pointer to CMmUiccMessHandler
         CMmUiccMessHandler* iUiccMessHandler;
         
-        //CMmUiccMessHandler* iMmUiccMessHandler;
-        // Array for saving operation(s)
-        RPointerArray<CMmPhoneBookStoreOperationBase> iPtrOperationArray;
+        // new Array for Storing Operation
+        TFixedArray<CMmPhoneBookStoreOperationBase*, KMaxPbTrIdCount> iPtrOperationArrayNew;
 };
 
 #endif // CMMPHONEBOOKOPERATIONLIST_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonemesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonemesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -31,6 +31,7 @@
 #include "cmmphonetreceiver.h"
 #include "nokiatsy_internal_variation.h"
 #include "muiccoperationbase.h"
+#include "cmmuiccmesshandler.h"
 
 // CONSTANTS
     //None
@@ -125,8 +126,46 @@
         TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData );
 
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param TInt aError : Error value during re-reading
+        */
+        void SmsCachingCompleted( TInt aError );
+
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param TInt aError : Error value during re-reading
+        */
+        void ServiceTableCachingCompleted( TInt aError );
+
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param TUint aError : Error value during re-reading
+        */
+        void CallForwFlagsCachingCompleted( TUint aError );
+
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param aError : Error value during re-reading
+        * @return refresh ongoing, True or False.
+        */
+        TBool OplRulesCachingCompleted( TInt aError );
+
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param aError : Error value during re-reading
+        */
+        void PnnRecordCachingCompleted( TUint8 aError );
+
+        /**
+        * Checks if "Refresh Done" will be sent to UICC
+        * @param aError : Error value during re-reading
+        */
+        void OnsNameCachingCompleted( TUint8 aError );
+
     protected:
 
         /**
@@ -194,6 +233,118 @@
         */
         void ConstructL( CMmMessageRouter* aMessageRouter );
 
+        /**
+        * Read request for EFest
+        * @return KErrNone or error code
+        */
+        TInt UiccReadEfEstReq();
+
+        /**
+        * Handles response for EFest reading in case of getting
+        * ACL status       
+        * @param aStatus status of the operation
+        * @param aFileData content of the EFest
+        * @return none
+        */
+        void UiccGetAclStatusReadEfEstResp( 
+            TInt aStatus, 
+            const TDesC8& aFileData );
+
+        /**
+        * Handles response for EFest reading in case of setting
+        * ACL status       
+        * @param aStatus status of the operation
+        * @param aFileData content of the EFest
+        * @return none
+        */
+        void UiccSetAclStatusReadEfEstResp( 
+            TInt aStatus, 
+            const TDesC8& aFileData );
+
+        /**
+        * Write request for EFest
+        * @param aOldAclState old ACL state
+        * @return KErrNone or error code
+        */
+        TInt UiccSetAclStatusWriteEfEstReq( TUint8 aOldAclState );
+
+        /**
+        * Handles response for EFest writing in case of setting
+        * ACL status       
+        * @param aStatus status of the operation
+        * @return none
+        */
+        void UiccSetAclStatusWriteEfEstResp(
+            TInt aStatus );
+
+        /**
+        * Read request for EFacl
+        * @return KErrNone or error code
+        */
+        TInt UiccReadAclReq();
+
+        /**
+        * Handles response for EFacl reading 
+        * @param aStatus status of the operation
+        * @param aFileData content of the EFacl
+        * @return none
+        */
+        void UiccReadAclResp(
+            TInt aStatus, 
+            const TDesC8& aFileData );
+
+        /**
+        * Encrypt from ACL to CDesC8ArrayFlat.
+        * @param const TDesC8& aTlv
+        * @param TInt aTotalEntries
+        * @return CDesC8ArrayFlat*
+        */
+        CDesC8ArrayFlat* DecodeACL(
+            const TDesC8& aTlv,
+            TInt aTotalEntries) const;
+
+        /**
+        * Sends number of ACL index to the client.
+        * @return none
+        */
+        void CompleteEnumerateAPNEntries();
+
+        /**
+        * Completes APN entry reading
+        * @param TUint8 aIndex
+        * @return none
+        */
+        void CompleteGetAPNName( TUint8 aIndex );
+
+        /**
+        * Deletes APN entry from internal cache and writes
+        * the change to EFacl
+        * @param TUint8 aIndex index to be deleted
+        * @return KErrNone or error code
+        */
+        TInt UiccDeleteApnEntry( TInt aIndex );
+
+        /**
+        * Writes APN entries from internal cache to the EFAcl
+        * @param TUint8 aIndex index to be deleted
+        * @return KErrNone or error code
+        */
+        TInt UiccWriteEfAclReq();
+
+        /**
+        * Handles response for EFAcl writing
+        * @param aStatus status of the operation
+        * @return none
+        */
+        void UiccWriteEfAclResp( TInt aStatus );
+
+        /**
+        * Calculate total length of ACL.
+        * @param CDesC8ArrayFlat* aApnList
+        * @return TUint16 Total legtn of ACL.
+        */
+        TUint16 ACLLength( CDesC8ArrayFlat* aApnList ) const;
+
     private:
 
         /**
@@ -205,7 +356,8 @@
             KRefreshCallForwardingFlags = 0x02,
             KRefreshOplRules = 0x04,
             KRefreshPnnRecord = 0x08,
-            KRefreshOnsName = 0x10
+            KRefreshOnsName = 0x10,
+            KRefreshServiceTable = 0x20
             };
 
         /**
@@ -270,6 +422,34 @@
             TInt aStatus,
             const TDesC8& aFileData );
 
+        /**
+         * Handle UICC_REFRESH_IND ISI message
+         * @param aIsiMessage ISI message
+         * @return void
+         */
+        void UiccRefreshInd( const TIsiReceiveC &aIsiMessage );
+
+        /**
+         * Handle UICC_REFRESH_RESP ISI message
+         * @param aIsiMessage ISI message
+         * @return void
+         */
+        void UiccRefreshResp( const TIsiReceiveC &aIsiMessage );
+
+        /**
+         * Create UICC_REFRESH_REQ ISI message
+         * @param aStatus Status
+         * @return Symbian error code
+         */
+        TInt UiccRefreshReq( TUint8 aStatus );
+
+       /** Complete rerfesh handling
+        * @param aIsiMessage ISI message
+        * @return void
+        */
+       void HandleUiccRefresh( const TIsiReceiveC &aIsiMessage );
+
+
     //ATTRIBUTES
     public:
         //none
@@ -335,6 +515,14 @@
 
         // Keeps track if any errors happened during re-reading of cached files
         TBool iRefreshError;
+
+        // Flag for refresh completing
+        TBool iCompleteRefresfDone;
+
+        // Stores temporarily ACL status going to be set
+        RMobilePhone::TAPNControlListServiceStatus iAclStatus;
+
+        TInt iOngoingAclIpc;
     };
 
 #endif // CMMPHONEMESSHANDLER_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsecuritymesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsecuritymesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -414,6 +414,7 @@
         TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData );
 
         /**
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmscache.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmscache.h	Thu Jan 14 10:44:58 2010 +0200
@@ -161,7 +161,16 @@
         */
         void DeleteAll();
 
-    // ATTRIBUTES
+        /**
+        * Changes the storage status of a cached entry
+        * @param aLocation location to change entry at
+        * @param aStorageStatus storage status (TS 31.102, clause 4.2.25)
+        */
+        void SetStorageStatus(
+            TInt aLocation,
+            RMobileSmsStore::TMobileSmsStoreStatus aMsgStatus );
+
+        // ATTRIBUTES
     private:
         // cache error code
         TInt iError;
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmsmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsmsmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -38,12 +38,6 @@
 // "4.2.25   EFSMS (Short messages)"
 const TUint8 KSmsElemetaryFileRecordLength = 176;
 
-// for file descriptor tag in FCI data received from UICC Server
-const TUint8 KTagFCIFileDescriptor = 0x82;
-
-#define UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR   6
-
-
 // MACROS
 //none
 
@@ -98,8 +92,8 @@
             EPhoneStoreWrite,
             EInternalNack,
             ESms2Cache,
-            ESms2WriteReceived
-
+            ESms2WriteReceived,
+            ESmsMessagingNackSmsStoredCapacityExceeded
             };
 
     //METHODS
@@ -162,6 +156,7 @@
         TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData );
 
     private:
@@ -226,21 +221,6 @@
             TInt  aIpc );
 
         /**
-        * Handle internally SIM server response to SimStSmsRead
-        * (ReadAllSms) request
-        * @param TBool aSupportedPduType: Is read PDU's type supported
-        * @param TSmsMsg* aSmsMsg: A pointer to the sms message
-        * @param Int aSmsLocIndex: index of the SIM SMS slot
-        * @param TUint8 aSmsNumOfLoc: number of SIM SMS slots
-        * @return void: None
-        */
-        void InternalRetrieveSmsListReadSmsL(
-            TBool aSupportedPduType,
-            TSmsMsg* aSmsMsg,
-            TInt aSmsLocIndex,
-            TUint8 aSmsNumOfLoc );
-
-        /**
         * Sms gsm received pp report request (Ack or Nack)
         * @param TUint8 aTransactionId: Transaction identifier
         * @param const TDesC8* aMsgData: A pointer to the Message data
@@ -259,12 +239,6 @@
         */
         TUint8 SmsMapCause( TInt aRpCause );
 
-        /* Complete reading of one SMSP set
-        * @param TSmsParameters* aParameters: A pointer to sms parameter
-        * @return: void: None
-        */
-        void InternalRetrieveSmspListL( TSmsParameters* aParameters );
-
         /**
         * Activate, deactivate or query status of SMS receiving
         * @param aAction Reception command
@@ -571,9 +545,11 @@
             const TDesC8& aFileData );
 
         /**
-        * Write Class 2 SMS from SIM/USIM
-        * @param aInfo Flags 2 data
-        * @return void
+        * Write Class 2 SMS to SIM/USIM
+        * @param const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry:
+        *     SIM-stored SMS
+        * @aRecordId SMS entry record id
+        * @return Error code
         */
         TInt UiccWriteSMSReq(
             const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry,
@@ -581,7 +557,7 @@
 
         /**
         * Write Class 2 SMS from SIM/USIM response
-        * @param aInfo Flags 2 data
+        * @param aStatus Status
         * @return void
         */
         void UiccWriteSMSResp( TInt aStatus );
@@ -602,7 +578,78 @@
             TInt aStatus,
             const TDesC8& aFileData );
 
-    //ATTRIBUTES
+        /**
+        * Delete one SMS from SIM/USIM response
+        * @param aStatus Status
+        * @return void
+        */
+        void UiccDeleteSMSResp( TInt aStatus );
+
+        /**
+        * Delete all Class 2 SMSs from SIM/USIM response
+        * @param aStatus Status
+        * @return void
+        */
+        void UiccDeleteAllSMSResp( TInt aStatus );
+
+        /**
+        * Compares the SC timestamp of messages aReadSmsIsiMsg to aScTime.
+        * @param const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry:
+        *     SIM-stored SMS
+        * @param TTime aScTime: Client-side SMSC timestamp
+        * @return TBool: Result of the comparison
+        */
+
+        TBool CMmSmsMessHandler::CheckSCTimestamp(
+            const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry,
+            const TTime& aScTime );
+
+        /**
+        * Update Class 2 SMS status as read to SIM/USIM
+        * @param const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry:
+        *     SIM-stored SMS
+        * @aRecordId SMS entry record id
+        * @return Error code
+        */
+        TInt UiccUpdateSMSStatus( const TUint8 aRecordId );
+
+        /**
+        * Read SMS from SIM for SMS status update
+        * @param aStatus Status
+        * @param aFileData File data to be modified and written back
+        * @return void
+        */
+        void UiccUpdateSMSStatusReadSMSResp(
+            TInt aStatus,
+            const TDesC8& aFileData );
+
+        /**
+        * Written updated SMS to SIM
+        * @param aStatus Status
+        * @return void
+        */
+        void UiccUpdateSMSStatusWriteSMSResp( TInt aStatus );
+
+        /**
+        * Get SMSP entry from (U)SIM
+        * @return Symbian error code
+        */
+        TInt UiccGetSmspEntryReq();
+
+        /**
+        * Store SMSP entry to internal array
+        * @param aFileData Data containig SMSP entry
+        * @return Symbian error code
+        */
+        TInt UiccStoreSmspEntry( const TDesC8& aFileData );
+
+        /**
+        * Write SMSP entry to (U)SIM
+        * @param aDataPackage Data containig SMSP entry
+        * @return Symbian error code
+        */
+        TInt UiccSmsUpdateParameterReq( const CMmDataPackage* aDataPackage );
+        //ATTRIBUTES
     public:
         //none
 
@@ -651,7 +698,7 @@
         // Is SMS Sending ongoing
         TBool iSMSSendingOngoing;
 
-        // Record ID saved during query
+        // Record ID saved during query or deletion.
         TUint8 iRecordId;
 
         // Pointer to UICC message handler
@@ -659,6 +706,12 @@
 
         // Flag to check is the case class 2 SMS write or EMobileStoreWrite
         TBool iSMSClass2Write;
+
+        // Client has no storage to receive anymore SM's
+        TBool iMemoryCapacityExceeded;
+
+        // Record number of EF smsp
+        TUint8 iSmspRecordNumber;
     };
 
 #endif // _CMMSMSMESSHANDLER_H_
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Thu Jan 14 10:44:58 2010 +0200
@@ -232,6 +232,41 @@
         static TUint16 GetUnicodeGsm( TUint8 aCharacter);
 
         /**
+        * Converts data to GSM format
+        * @param aInputString Input string
+        * @param aGsmDataString Output string
+        * @return None
+        */
+        static void ConvertUcs2ToGsmUcs2Data(
+                TDesC16& aInputString,
+                TDes8& aGsmDataString );
+        
+        /**
+        * Gets the coding scheme GSM default or UCS2
+        * @param aInputString Input string
+        * @return ETrue or EFalse
+        */
+        static TBool GetCodingScheme(
+                TDesC16& aInputString );
+        
+        /**
+        * Get gsm unicode character
+        * @param aCharacter Input character
+        * @return Unicode character
+        */
+        static TUint8 GetGsmForUnicode( TUint16 aCharacter);
+
+        /**
+        * Gets 16 bits from the aSource
+        * @param const TDes8& aSource
+        * @param TInt aIndex: Index of the data in aSource
+        * @return TInt
+        */
+        static TInt Get16Bit(
+            const TDesC8& aSource, //Source
+            TInt aIndex );         //Index
+
+        /**
         * Set value for oper info
         * THIS IS ONLY FOR WINSCW TESTING USE
         */
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsupplservmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmsupplservmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -131,6 +131,7 @@
          TInt ProcessUiccMsg(
              TInt aTraId,
              TInt aStatus,
+             TUint8 aDetails,
              const TDesC8& aFileData );
 
     public: // New functions
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -36,6 +36,19 @@
 const TUint8 KFileDataLength( 200 );
 const TUint16 KApduDataLength( 270 );
 
+// Constants for descriptors in 3G SIM
+const TUint8 KFileDescriptor( 0x82 );
+const TUint8 KFileIdentifier( 0x83 );
+const TUint8 KFileSize( 0x80 );
+const TUint8 KPINStatusTemplateDO( 0xC6 );
+
+// Constants for descriptors in 2G SIM
+const TUint8 KFileStatus( 11 );
+const TUint8 KRecordLength2( 14 );
+const TUint8 KFileSize2( 2 );
+const TUint8 KFileId( 4 );
+
+
 // UICC master file
 const TUint16 KMasterFileId( 0x3F00 );
 
@@ -74,11 +87,19 @@
 const TUint16 KElemGba                            ( 0x6FD6 );
 const TUint16 KElemEst                            ( 0x6F56 );
 const TUint16 KElemCphsInformation                ( 0x6F16 );
+const TUint16 KElemFileSmsParams                  ( 0x6F42 );
+const TUint16 KElemFileAcl                        ( 0x6F57 );
+const TUint16 KElemFileOpl                        ( 0x6FC6 );
+const TUint16 KElemFilePlmnNetworkName            ( 0x6FC5 );
+const TUint16 KElemFileFixedDiallingNumbers       ( 0x6F3B );
+const TUint16 KElemEmergencyCallCodes             ( 0x6FB7 );
 
 const TUint8 KEfSstSize (0xFF);
 const TUint8 KEfUstSize (0xFF);
 const TUint8 KEfCphsInfoSize (0xFF);
 
+const TUint8 KMaxPbTrIdCount (20);
+
 // Unique transaction IDs for all UICC operations
 enum TUiccTrId
     {
@@ -149,9 +170,9 @@
     ETrIdReadSMSRecordCount,
     ETrIdReadSMSForComplete,     // 65
     ETrIdPbInit,
-    ETrIdPbInitFDN,
-    ETrIdPbRead,
-    ETrIdPbReadADN,
+    ETrIdPbReadAdn,
+    ETrIdPbReadFdn,
+    ETrIdPbReadSdn,
     ETrIdPbUpdate,              // 70
     ETrIdPbDelete,
     ETrIdSetFdnStateReadEst,
@@ -161,6 +182,27 @@
     ETrIdGetFdnStateReadEst,
     ETrIdGetFdnStateReadFileInfo,
     ETrIdCphsCache,
+    ETrIdDeleteSMS,
+    ETrIdDeleteAllSMSs,
+    ETrIdUpdateSMSStatusReadSMS,
+    ETrIdUpdateSMSStatusWriteSMS,
+    ETrIdGetSmspEntries,
+    ETrIdWriteSmspEntry,
+    ETrIdPbReadMbdn,             //85
+    ETrIdPbReadVmbx,
+    ETrIdPbReadBdn,
+    ETrIdPbOperationStart,       // 88
+    ETrIdPbOperationEnd = ETrIdPbOperationStart+KMaxPbTrIdCount,  // Transaction Id inbetween used by Phonebook operations
+    ETrIdReadOplRecordCount,
+    ETrIdReadOplRecord, // 110
+    ETrIdAclStatusReadEfEst,
+    ETrIdAclStatusWriteEfEst,
+    ETrIdAclReadEfAcl,
+    ETrIdAclWriteEfAcl,
+    ETrIdReadOperatorName, // 115
+    ETrIdReadPnn,
+    ETrIdEnStoreRead,
+    ETrIdEnStoreGetInfo,
     ENumOfUiccTrIds
     };
 
@@ -180,8 +222,7 @@
         TUint16 fileId; // ID of elementary file
         TUint8 fileIdSfi; // Filled only in case SFI is present
         TUint8 serviceType; // UICC service type
-        TBuf8<KFilePathLength> filePath; // Elementary file path, (DF ) + EF
-                                        // If same as fileId, no need to fill
+        TBuf8<KFilePathLength> filePath; // Elementary file path + DF
     } ;
 
 // Parameters needed in UICC_APPL_FILE_INFO
@@ -259,6 +300,77 @@
         TBuf8<KApduDataLength> apduData; // APDU data
     } ;
 
+/**
+*  Class used to handle FCI data.
+*/
+class TFci
+{
+private:
+    const TDesC8& iData; // == aFileData
+
+    /**
+    * Returns length of the FCI sub block
+    * @return TInt
+    */
+    TInt GetLength();
+
+public:
+
+    /**
+    * Returns type of the card
+    * @return TUint8
+    */
+    TUint8 GetTypeOfCard();
+
+    /**
+    * Returns type offset of the TLV in FCI sub block
+    * @param TUint8 aDescription
+    * @return TUint8
+    */
+    TInt GetOffsetOfTLV( TUint8 aDescription );
+
+    /**
+    * Returns number of the records on SIM
+    * @return TInt
+    */
+    TInt GetNumberOfRecords();
+
+    /**
+    * Returns length of the record on SIM
+    * @return TInt
+    */
+    TInt GetRecordLength();
+
+    /**
+    * Returns file size on SIM
+    * @return TInt
+    */
+    TInt GetSizeOfFile();
+
+    /**
+    * Returns file identifier on SIM
+    * @return TInt
+    */
+    TInt GetFileIdentifier();
+
+    /**
+    * Returns file status on SIM (ICC)
+    * @return TInt
+    */
+    TUint8 GetFileStatus();
+
+    // Constructor (the whole FCI sub block is given as the parameter).
+    TFci( const TDesC8& aFCI_sb )
+    :iData( aFCI_sb )
+    {
+    }
+    // Destructor
+    ~TFci()
+    {
+    }
+
+} ;
+
 // FORWARD DECLARATIONS
     class CMmPhoNetSender;
     class CMmPhoNetReceiver;
@@ -374,9 +486,10 @@
         /**
         * Caches SIM service table (EFust or EFsst depending
         * on card type in use)
+        * @param aComplete Information if complete is needed
         * @return none
         */
-        void InitializeSimServiceTableCache();
+        void InitializeSimServiceTableCache( TBool aComplete = ETrue );
 
         /**
         * Gets service status from service table
@@ -402,6 +515,7 @@
         TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData );
 
         /**
@@ -449,6 +563,63 @@
         */
         TBool GetCphsInformationStatus( TUint8 aServiceNo );
 
+        /**
+        * Length of FCI (File Control Info)
+        * @param aFileData Descriptor for file data
+        * @return length
+        */
+        TInt GetUICCFCILength( const TDesC8& aFileData );
+
+        /**
+        * UICC card type
+        * @param aFileData Descriptor for file data
+        * @return UICC card type
+        */
+        TUint8 GetUICCCardType( const TDesC8& aFileData );
+
+        /**
+        * Index of data if searched by the description of file.
+        * @param description Description
+        * @param aFileData Descriptor for file data
+        * @return index, zero is returned if description is not found.
+        */
+        TInt ReturnIndexOfData( const TUint8 aDescription,
+                                const TDesC8& aFileData );
+
+        /**
+        * UICC Get number of records
+        * @param aFileData Descriptor for file data
+        * @return UICC card type
+        */
+        TInt GetUICCNumberOfRecords( const TDesC8& aFileData );
+
+        /**
+        * UICC Get record length
+        * @param aFileData Descriptor for file data
+        * @return UICC card type
+        */
+        TInt GetUICCRecordLength( const TDesC8& aFileData );
+
+        /**
+        * UICC Get size of the file
+        * @param aFileData Descriptor for file data
+        * @return UICC card type
+        */
+        TInt GetUICCFileSize( const TDesC8& aFileData );
+
+        /**
+        * UICC Get file identifier
+        * @param aFileData Descriptor for file data
+        * @return UICC card type
+        */
+        TInt GetUICCFileIdentifier( const TDesC8& aFileData );
+
+        /**
+        * Get UICC client ID
+        * @return UICC client ID
+        */
+        TUint8 GetUiccClientId();
+
     public: // Functions from base classes
 
     protected:  // New functions
@@ -665,6 +836,9 @@
         RMobilePhone::TAID iAid;
         // Store active PIN
         RMobilePhone::TMobilePhoneSecurityCode iActivePin;
+        // Flag to indicate should EMmTsyBootNotifySimStatusReadyIPC be
+        // completed when service table has been cached
+        TBool iCompleteSimStatusReady;
 
     };
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/muiccoperationbase.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/muiccoperationbase.h	Thu Jan 14 10:44:58 2010 +0200
@@ -39,6 +39,7 @@
         virtual TInt ProcessUiccMsg(
             TInt aTraId,
             TInt aStatus,
+            TUint8 aDetails,
             const TDesC8& aFileData ) = 0;
 
     };
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 #define NOKIATSY_RELEASE_H
 
 // UPDATE THIS STRING FOR EVERY RELEASE!!!
-#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> CASW_Adaptation_casw_CoreCom_2009_wk44"
+#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> modemadaptation-MCL_201002"
 #endif // NOKIATSY_RELEASE_H
            
 // End of File
\ No newline at end of file
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/operators.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/operators.h	Thu Jan 14 10:44:58 2010 +0200
@@ -18,7 +18,7 @@
 
 
 // This file is autogenerated from operators.txt
-// Generation date: 27-Oct-2009 14:33:17
+// Generation date: 11-Dec-2009 09:21:25
 
 
 struct TOperator
@@ -117,7 +117,7 @@
 const TOperator operators_218[3] = { // BIH
   { 3, "HT ERONET", NULL },
   { 5, "m:tel", NULL },
-  { 90, "GSMBIH", NULL },
+  { 90, "BHMobile", NULL },
 };
 
 const TOperator operators_219[3] = { // HRV
@@ -151,7 +151,7 @@
 
 const TOperator operators_228[5] = { // CHE
   { 1, "Swisscom", NULL },
-  { 2, "sunrise", NULL },
+  { 2, "Sunrise", NULL },
   { 3, "orange CH", NULL },
   { 7, "In&Phone", NULL },
   { 8, "T2", NULL },
@@ -329,7 +329,7 @@
 const TOperator operators_270[3] = { // LUX
   { 1, "LUXGSM", NULL },
   { 77, "TANGO", NULL },
-  { 99, "L ORANGE-LU", NULL },
+  { 99, "L Orange-LU", NULL },
 };
 
 const TOperator operators_272[4] = { // IRL
@@ -600,7 +600,7 @@
 const TOperator operators_350[4] = { // BDA
   { 0, "CellularOne", NULL },
   { 1, "TELECOM BDA", NULL },
-  { 2, "MOBILITY", NULL },
+  { 2, "M3 WIRELESS", NULL },
   { 10, "Cingular", NULL },
 };
 
@@ -1120,7 +1120,7 @@
 const TOperator operators_457[4] = { // LAO
   { 1, "LAO GSM", NULL },
   { 2, "ETLMNW", NULL },
-  { 3, "LATMOBIL", NULL },
+  { 3, "Unitel", NULL },
   { 8, "TIGO LAO", NULL },
 };
 
@@ -1300,7 +1300,8 @@
   { 1, "IAM", NULL },
 };
 
-const TOperator operators_605[2] = { // TUN
+const TOperator operators_605[3] = { // TUN
+  { 1, "Orange", NULL },
   { 2, "TUNTEL", NULL },
   { 3, "TUNISIANA", NULL },
 };
@@ -1381,9 +1382,10 @@
   { 7, "Celcom GSM", NULL },
 };
 
-const TOperator operators_619[2] = { // SLE
+const TOperator operators_619[3] = { // SLE
   { 1, "CELTEL SL", NULL },
   { 2, "MILLICOM SL", NULL },
+  { 7, "GreenN SL", NULL },
 };
 
 const TOperator operators_620[4] = { // GHA
@@ -1892,7 +1894,7 @@
   { 602, "EGY", 3, operators_602 },
   { 603, "DZA", 3, operators_603 },
   { 604, "MOR", 2, operators_604 },
-  { 605, "TUN", 2, operators_605 },
+  { 605, "TUN", 3, operators_605 },
   { 606, "LBY", 2, operators_606 },
   { 607, "GMB", 4, operators_607 },
   { 608, "SEN", 2, operators_608 },
@@ -1906,7 +1908,7 @@
   { 616, "BEN", 4, operators_616 },
   { 617, "MRU", 2, operators_617 },
   { 618, "LBR", 4, operators_618 },
-  { 619, "SLE", 2, operators_619 },
+  { 619, "SLE", 3, operators_619 },
   { 620, "GHA", 4, operators_620 },
   { 621, "NGA", 5, operators_621 },
   { 622, "TCD", 2, operators_622 },
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmbroadmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmbroadmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -28,9 +28,9 @@
 #include "tsylogger.h"
 #include "cmmphonetsender.h"
 #include "cmmstaticutility.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmbroadmesshandlertraces.h"
+#include "cmmbroadmesshandlerTraces.h"
 #endif
 
 
@@ -84,6 +84,9 @@
 OstTrace0( TRACE_NORMAL, CMMBROADMESSHANDLER_CONSTRUCTL, "CMmBroadMessHandler::ConstructL" );
     // Initialise the array. Maximun of pages in a WCDMA CBS message is 15
     iCbsMsg = new( ELeave ) CArrayPtrFlat< TWcdmaCbsMsg >( 10 );
+
+    // Cb subscription number.
+    iCbSubscriptionNumber = SMS_NEW_SUBSCRIPTION;
     }
 
 // -----------------------------------------------------------------------------
@@ -243,7 +246,18 @@
     // Create a buffer to hold the request
     TBuf8<SIZE_SMS_CB_ROUTING_REQ> dataBuffer;
     dataBuffer.Append( routingCommand ); // Routing command
-    dataBuffer.Append( SMS_NEW_SUBSCRIPTION  ); // Subscription number
+
+    if ( SMS_ROUTING_RELEASE == routingCommand )
+        {
+        // Subscription number
+        dataBuffer.Append( iCbSubscriptionNumber );
+        }
+    else if ( SMS_ROUTING_SET == routingCommand )
+        {
+        // Subscription number
+        dataBuffer.Append( SMS_NEW_SUBSCRIPTION );
+        }
+
     dataBuffer.Append( SMS_TYPE_DEFAULT ); // Subscription type
     dataBuffer.Append( KBroadPadding ); // Filler
     dataBuffer.Append( KBroadPadding ); // Filler
@@ -272,6 +286,9 @@
 OstTrace0( TRACE_NORMAL, CMMBROADMESSHANDLER_SMSGSMCBROUTINGRESP, "CMmBroadMessHandler::SmsCbRoutingResp" );
     TInt ipc( 0 ); // Initialize to zero
 
+    iCbSubscriptionNumber = aSmsCbRoutingResp.Get8bit(
+        ISI_HEADER_SIZE + SMS_CB_ROUTING_RESP_OFFSET_SUBSCRIPTIONNUMBER );
+
     TUint8 isiCause( aSmsCbRoutingResp.Get8bit( ISI_HEADER_SIZE
         + SMS_CB_ROUTING_RESP_OFFSET_SMSCAUSE ) );
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,9 +26,9 @@
 #include "tsylogger.h"
 #include "cmmdataporthandler.h" // dataport includes
 #include "cmmdtmfmesshandler.h" //DTMF includes
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmcallmesshandlertraces.h"
+#include "cmmcallmesshandlerTraces.h"
 #endif
 
 // ISI message coding/decoding functions
@@ -40,6 +40,8 @@
 #include <csdisi.h>
 #include <pipeisi.h>
 #include <pipe_sharedisi.h>
+#include <satcs.h>
+#include <etelsat.h>
 
 // EXTERNAL DATA STRUCTURES
     // None
@@ -83,16 +85,16 @@
 
 // Second PEP
 const TUint8 KSecondPepDevice = PN_DEV_MODEM;    // Device Id of second PEP
-const TUint8 KSecondPepObject = 54; // PN_OBJ_CSD_SRV // Object Id of second PEP
+const TUint8 KSecondPepObject = PN_OBJ_CSD_SRV; // Object Id of second PEP
 const TUint8 KSecondPepType   = PN_PEP_TYPE_GPRS; // Second PEP type
 
-// Redirect PEP
-const TUint8 KRedirectPepObject = 59; //PN_OBJ_CSD_WTB; // Object Id of redirected PEP
-
 const TUint8 KPipeTransID  = EIscNokiaDataport1;
 
 const TUint8 KInvalidPipeHandle = 0xFF;
 
+// From 3GPP TS 31.111, 7.3.1.6 Structure of ENVELOPE (CALL CONTROL)
+const TUint8 KCcResultAllowedNoModification     = 0x00;
+const TUint8 KCcResultNotAllowed                = 0x01;
 // MACROS
     // None
 
@@ -239,11 +241,10 @@
     // Read "HSDPA Disabled" status from product profile
     InfoPpDataReadReq();
 
-    iSecondPepDeviceId = KSecondPepDevice;
-    iSecondPepObjectId = KSecondPepObject;
-
     iCallOperationID = CSD_CALL_CREATE;
-    iVideoCallMtReleased = EFalse;
+    iVideoCallReleased = EFalse;
+    iCallControlCallId = CALL_MODEM_ID_NONE;
+    iCcResult = KCcResultAllowedNoModification;
     }
 
 // -----------------------------------------------------------------------------
@@ -283,8 +284,6 @@
     aPhoNetReceiver->RegisterL( callMessHandler, PN_CSD );
 
     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_CREATE_RESP );
-    aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_ENABLE_RESP );
-    aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_RESET_RESP );
     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_REMOVE_RESP );
 
     callMessHandler->iDtmfMessHandler = aDtmfMessHandler;
@@ -486,25 +485,11 @@
                     PnsPipeCreateResp( aIsiMessage );
                     break;
                     }
-                case PNS_PIPE_ENABLE_RESP:
-                    {
-                    PnsPipeEnableResp( aIsiMessage );
-                    break;
-                    }
-                case PNS_PIPE_RESET_RESP:
-                    {
-                    PnsPipeResetResp( aIsiMessage );
-                    break;
-                    }
                 case PNS_PIPE_REMOVE_RESP:
                     {
                     PnsPipeRemoveResp( aIsiMessage );
                     break;
                     }
-                case PNS_PIPE_REDIRECT_RESP:
-                    {
-                    PnsPipeRedirectResp( aIsiMessage );
-                    }
                 default:
                     {
 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_PIPE, switch messageId - default.\n" );
@@ -545,341 +530,351 @@
     TBool requestDirectedToDataPort( EFalse );
     TBool callCreatedAlready( EFalse );
 
-    const CCallDataPackage* callData(
-        reinterpret_cast<const CCallDataPackage*>( aDataPackage ) );
-
-    // In case of emergency call CMmDataPackage is used and it doesn't contain
-    // call ID or call mode. CCallDataPackage is used in case of normal call.
-    if ( EMobileCallDialEmergencyCall != aIpc )
+    if ( ESatNotifyCallControlRequest == aIpc )
         {
-        callData->GetCallIdAndMode( callId, callMode );
-TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL. CallMode:%d", callMode );
-OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL;callMode=%d", callMode );
-        }
-
-    if ( KSymbianCallIdNone == callId )
-        {
-        dosCallId = CALL_MODEM_ID_NONE;
+        // simatktsy uses this IPC to inform NTSY about call controlled CALL_ID
+        // and call control result
+        aDataPackage->UnPackData ( iCallControlCallId, iCcResult );
         }
     else
         {
-        dosCallId = static_cast<TUint8>( callId );
-        }
-
-    TIsiSend callReq( iPhoNetSender->SendBufferDes() );
-
-    // Resource ID
-    callReq.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_CALL );
-
-    // Transaction ID
-    callReq.Set8bit( ISI_HEADER_OFFSET_TRANSID, KCallTransId );
-
-    switch( aIpc )
-        {
-        case EMobileCallDialEmergencyCall:
+        const CCallDataPackage* callData(
+            reinterpret_cast<const CCallDataPackage*>( aDataPackage ) );
+
+        // In case of emergency call CMmDataPackage is used and it doesn't contain
+        // call ID or call mode. CCallDataPackage is used in case of normal call.
+        if ( EMobileCallDialEmergencyCall != aIpc )
+            {
+            callData->GetCallIdAndMode( callId, callMode );
+TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL. CallMode:%d", callMode );
+OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL;callMode=%d", callMode );
+            }
+
+        if ( KSymbianCallIdNone == callId )
             {
-            aDataPackage->UnPackData( iTelEmergNumber );
+            dosCallId = CALL_MODEM_ID_NONE;
+            }
+        else
+            {
+            dosCallId = static_cast<TUint8>( callId );
+            }
+
+        TIsiSend callReq( iPhoNetSender->SendBufferDes() );
+
+        // Resource ID
+        callReq.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_CALL );
+
+        // Transaction ID
+        callReq.Set8bit( ISI_HEADER_OFFSET_TRANSID, KCallTransId );
+
+        switch( aIpc )
+            {
+            case EMobileCallDialEmergencyCall:
+                {
+                aDataPackage->UnPackData( iTelEmergNumber );
 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - emergency dial number is %S", &iTelEmergNumber);
 OstTraceExt1( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - emergency dial number is=%S", iTelEmergNumber );
 #ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-            if ( iHSDPADisabledInPp )
-                {
-                // HSPDA is disabled in PP; no need to delay the emergency
-                // call setup.
+                if ( iHSDPADisabledInPp )
+                    {
+                    // HSPDA is disabled in PP; no need to delay the emergency
+                    // call setup.
 #endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-                dosCallId = CALL_MODEM_ID_NONE;
-                // In the case when emergency number checking is needed to be ignored
-                // the destination address is delivered
-                EmergencyCallCreateReq( &callReq );
-                // Emergency calls are created immediately, without
-                // setting properties
-                messageId = CALL_MODEM_CREATE_REQ;
-                isiCallId = CALL_MODEM_CREATE_REQ_OFFSET_CALLID;
+                    dosCallId = CALL_MODEM_ID_NONE;
+                    // In the case when emergency number checking is needed to be ignored
+                    // the destination address is delivered
+                    EmergencyCallCreateReq( &callReq );
+                    // Emergency calls are created immediately, without
+                    // setting properties
+                    messageId = CALL_MODEM_CREATE_REQ;
+                    isiCallId = CALL_MODEM_CREATE_REQ_OFFSET_CALLID;
 #ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-                }
-            else
-                {
-                // Destroy all data connections before attempting emergency
-                // call. The call will be set up in GpdsContextsClearResp.
+                    }
+                else
+                    {
+                    // Destroy all data connections before attempting emergency
+                    // call. The call will be set up in GpdsContextsClearResp.
 TFLOGSTRING( "TSY: CMmCallMessHandler::ExtFuncL - HSDPA workaround. Emergency call delayed, data connections have to be closed first." );
 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - HSDPA workaround. Emergency call delayed, data connections have to be closed first." );
-                iEmergCallDelayed = ETrue;
-                GpdsContextsClearReq();
-                }
+                    iEmergCallDelayed = ETrue;
+                    GpdsContextsClearReq();
+                    }
 #endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-            break;
-            }
-        case EEtelCallDial:
-        case EMobileCallDialISV:
-        case EMobileCallDialNoFdnCheck:
-            {
-            // Set iNoFDNDial flag in correct state
-            if ( EMobileCallDialNoFdnCheck == aIpc )
-                {
-                iNoFdnDial = ETrue;
+                break;
                 }
-            else
-                {
-                iNoFdnDial = EFalse;
-                }
-            if ( RMobilePhone::ECircuitDataService == callMode )
-                {
-                iFDNErrorAlredyNotified = EFalse;
-                ret = DialDataCall( callData );
-                requestDirectedToDataPort = ETrue;
-                }
-            else if ( RMobilePhone::EVoiceService == callMode )
-                {
-                iCallMode = CALL_MODEM_MODE_SPEECH;
-                }
-            else
+            case EEtelCallDial:
+            case EMobileCallDialISV:
+            case EMobileCallDialNoFdnCheck:
                 {
-                iCallMode = CALL_MODEM_MODE_ALS_LINE_2;
-                }
-
-            if ( ! requestDirectedToDataPort )
-                {
-                iIs3rdPartyDial = EFalse;
-
-                // If 3rd party client
-                if ( EMobileCallDialISV == aIpc )
+                // Set iNoFDNDial flag in correct state
+                if ( EMobileCallDialNoFdnCheck == aIpc )
+                    {
+                    iNoFdnDial = ETrue;
+                    }
+                else
+                    {
+                    iNoFdnDial = EFalse;
+                    }
+                if ( RMobilePhone::ECircuitDataService == callMode )
                     {
-                    iIs3rdPartyDial = ETrue;
+                    iFDNErrorAlredyNotified = EFalse;
+                    ret = DialDataCall( callData );
+                    requestDirectedToDataPort = ETrue;
+                    }
+                else if ( RMobilePhone::EVoiceService == callMode )
+                    {
+                    iCallMode = CALL_MODEM_MODE_SPEECH;
+                    }
+                else
+                    {
+                    iCallMode = CALL_MODEM_MODE_ALS_LINE_2;
                     }
-                // No else
-
-                // Check if CUG info is needed
-                RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
-                RMobileCall::TMobileCallInfoV1* callInfo( NULL );
-
-                aDataPackage->UnPackData( &callParams, &callInfo );
-
-                RMobileCall::TMobileCallParamsV1Pckg* paramsPckgV1(
-                    reinterpret_cast<RMobileCall::TMobileCallParamsV1Pckg*>
-                        ( callParams ) );
-
-                RMobileCall::TMobileCallParamsV1 recentCallParams(
-                    ( *paramsPckgV1 )() );
-
-                if ( RMmCustomAPI::KETelCustomExtCustomCallParamsV3 ==
-                        recentCallParams.ExtensionId() )
+
+                if ( ! requestDirectedToDataPort )
                     {
+                    iIs3rdPartyDial = EFalse;
+
+                    // If 3rd party client
+                    if ( EMobileCallDialISV == aIpc )
+                        {
+                        iIs3rdPartyDial = ETrue;
+                        }
+                    // No else
+
+                    // Check if CUG info is needed
+                    RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
+                    RMobileCall::TMobileCallInfoV1* callInfo( NULL );
+
+                    aDataPackage->UnPackData( &callParams, &callInfo );
+
+                    RMobileCall::TMobileCallParamsV1Pckg* paramsPckgV1(
+                        reinterpret_cast<RMobileCall::TMobileCallParamsV1Pckg*>
+                            ( callParams ) );
+
+                    RMobileCall::TMobileCallParamsV1 recentCallParams(
+                        ( *paramsPckgV1 )() );
+
+                    if ( RMmCustomAPI::KETelCustomExtCustomCallParamsV3 ==
+                            recentCallParams.ExtensionId() )
+                        {
 TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - Custom API call params in use ");
 OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - Custom API call params in use" );
 
-                    // Unpack custom call parameters
-                    RMmCustomAPI::TCustomCallParamsPckg* customparamsPckgV1(
-                        reinterpret_cast<RMmCustomAPI::TCustomCallParamsPckg*>
-                            ( paramsPckgV1 ) );
-
-                    RMmCustomAPI::TCustomCallParams& aCustomParams(
-                        ( *customparamsPckgV1 )() );
-                    iSubAddress.Copy( aCustomParams.iSubAddress );
-                    iBearer.Copy( aCustomParams.iBearer );
-                    }
-            #if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
-                else if ( RMobileCall::KETelMobileCallParamsV7 == recentCallParams.ExtensionId() )
-                    {
+                        // Unpack custom call parameters
+                        RMmCustomAPI::TCustomCallParamsPckg* customparamsPckgV1(
+                            reinterpret_cast<RMmCustomAPI::TCustomCallParamsPckg*>
+                                ( paramsPckgV1 ) );
+
+                        RMmCustomAPI::TCustomCallParams& aCustomParams(
+                            ( *customparamsPckgV1 )() );
+                        iSubAddress.Copy( aCustomParams.iSubAddress );
+                        iBearer.Copy( aCustomParams.iBearer );
+                        }
+#if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
+                    else if ( RMobileCall::KETelMobileCallParamsV7 == recentCallParams.ExtensionId() )
+                        {
 TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - V7 call params in use ");
 OstTrace0( TRACE_NORMAL, DUP8_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - V7 call params in use" );
 
-                    RMobileCall::TMobileCallParamsV7Pckg* paramsPckgV7(
-                        reinterpret_cast<RMobileCall::TMobileCallParamsV7Pckg*>
-                            ( callParams ) );
-
-                    RMobileCall::TMobileCallParamsV7 recentCallParamsV7(
-                        ( *paramsPckgV7 )() );
-
-                    iSubAddress.Copy( recentCallParamsV7.iSubAddress );
-                    // At the moment only 1 bearer capability is supported in SET UP CALL PCmd
-                    iBearer.Copy( recentCallParamsV7.iBearerCap1 );
-
-                    // Prevent FDN check if call is SIM originated (SET UP CALL)
-                    if ( RMobileCall::EOriginatorSIM == recentCallParamsV7.iCallParamOrigin )
-                        {
-                        iNoFdnCheck = ETrue;
+                        RMobileCall::TMobileCallParamsV7Pckg* paramsPckgV7(
+                            reinterpret_cast<RMobileCall::TMobileCallParamsV7Pckg*>
+                                ( callParams ) );
+
+                        RMobileCall::TMobileCallParamsV7 recentCallParamsV7(
+                            ( *paramsPckgV7 )() );
+
+                        iSubAddress.Copy( recentCallParamsV7.iSubAddress );
+                        // At the moment only 1 bearer capability is supported in SET UP CALL PCmd
+                        iBearer.Copy( recentCallParamsV7.iBearerCap1 );
+
+                        // Prevent FDN check if call is SIM originated (SET UP CALL)
+                        if ( RMobileCall::EOriginatorSIM == recentCallParamsV7.iCallParamOrigin )
+                            {
+                            iNoFdnCheck = ETrue;
+                            }
+                        else
+                            {
+                            iNoFdnCheck = EFalse;
+                            }
                         }
+#endif
                     else
                         {
-                        iNoFdnCheck = EFalse;
+                        iSubAddress.Zero();
+                        iBearer.Zero();
                         }
-                    }
-            #endif
-                else
-                    {
-                    iSubAddress.Zero();
-                    iBearer.Zero();
-                    }
 
 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Cug explicit invoked: %d", recentCallParams.iCug.iExplicitInvoke );
 OstTrace1( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - Cug explicit invoked: %d", recentCallParams.iCug.iExplicitInvoke );
-                // if CUG is explicitly invoked by
-                // the other entries in this structure will be filled in
-                // function CallPropertySetReq.
-                if ( recentCallParams.iCug.iExplicitInvoke )
+                    // if CUG is explicitly invoked by
+                    // the other entries in this structure will be filled in
+                    // function CallPropertySetReq.
+                    if ( recentCallParams.iCug.iExplicitInvoke )
+                        {
+                        // Non-emergency calls set properties first. CallCreateReq will
+                        // be called after CallPropertySetResp response has come.
+                        messageId = CALL_MODEM_PROPERTY_SET_REQ;
+                        dosCallId = CALL_MODEM_PROP_CUG_INFO;
+
+                        CallPropertySetReq( &callReq, callData );
+                        }
+                    else
+                        {
+    //                    RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
+    //                    RMobileCall::TMobileCallInfoV1* callInfo( NULL );
+    //                    aDataPackage->UnPackData( &callParams, &callInfo );
+                        iTelNumber = callInfo->iDialledParty.iTelNumber;
+TFLOGSTRING2("TSY: CMmCallMessHandlerExtFuncL - iTelNumber: %S", &iTelNumber);
+OstTraceExt1( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - iTelNumber=%s", iTelNumber );
+                        iIdRestrict = recentCallParams.iIdRestrict;
+
+                        CallCreateReq();
+                        callCreatedAlready = ETrue;
+                        // Reset information
+                        iSubAddress.Zero();
+                        iBearer.Zero();
+                        }
+                    }
+                // No else
+                break;
+                }
+            case EMobileCallSwap:
+                {
+                // Set special call Id
+                dosCallId = CALL_MODEM_ID_ACTIVE;
+                messageId = CALL_MODEM_CONTROL_REQ;
+                isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
+                CallControlReq( &callReq, aIpc );
+                break;
+                }
+            case EMobileCallHold:
+            case EMobileCallResume:
+            case EMobileCallGoOneToOne:
+            case EMobileCallTransfer:
+            case EMobileCallActivateCCBS:
+            case EMobilePhoneAcceptCCBSRecall:
+                {
+                messageId = CALL_MODEM_CONTROL_REQ;
+                isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
+                CallControlReq( &callReq, aIpc );
+                break;
+                }
+            case EMobileCallAnswerISV:
+            case EEtelCallAnswer:
+                {
+                if ( RMobilePhone::ECircuitDataService == callMode )
                     {
-                    // Non-emergency calls set properties first. CallCreateReq will
-                    // be called after CallPropertySetResp response has come.
-                    messageId = CALL_MODEM_PROPERTY_SET_REQ;
-                    dosCallId = CALL_MODEM_PROP_CUG_INFO;
-
-                    CallPropertySetReq( &callReq, callData );
+                    ret = AnswerIncomingDataCall( callData );
+                    requestDirectedToDataPort = ETrue;
                     }
                 else
                     {
-//                    RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
-//                    RMobileCall::TMobileCallInfoV1* callInfo( NULL );
-//                    aDataPackage->UnPackData( &callParams, &callInfo );
-                    iTelNumber = callInfo->iDialledParty.iTelNumber;
-TFLOGSTRING2("TSY: CMmCallMessHandlerExtFuncL - iTelNumber: %S", &iTelNumber);
-OstTraceExt1( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - iTelNumber=%s", iTelNumber );
-                    iIdRestrict = recentCallParams.iIdRestrict;
-
-                    CallCreateReq();
-                    callCreatedAlready = ETrue;
-                    // Reset information
-                    iSubAddress.Zero();
-                    iBearer.Zero();
+                    iIs3rdPartyAnswerIncomingCall = EFalse;
+
+                    // Is it from a 3rd party client or not
+                    if ( EMobileCallAnswerISV == aIpc )
+                        {
+                        iIs3rdPartyAnswerIncomingCall = ETrue;
+                        }
+                    // No else
+                    messageId = CALL_MODEM_ANSWER_REQ;
+                    isiCallId = CALL_MODEM_ANSWER_REQ_OFFSET_CALLID;
+                    callReq.Set8bit(
+                        ISI_HEADER_SIZE + CALL_MODEM_ANSWER_REQ_OFFSET_SUBBLOCKS,
+                        KCallPadding );
                     }
+                break;
                 }
-            // No else
-            break;
-            }
-        case EMobileCallSwap:
-            {
-            // Set special call Id
-            dosCallId = CALL_MODEM_ID_ACTIVE;
-            messageId = CALL_MODEM_CONTROL_REQ;
-            isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
-            CallControlReq( &callReq, aIpc );
-            break;
-            }
-        case EMobileCallHold:
-        case EMobileCallResume:
-        case EMobileCallGoOneToOne:
-        case EMobileCallTransfer:
-        case EMobileCallActivateCCBS:
-        case EMobilePhoneAcceptCCBSRecall:
-            {
-            messageId = CALL_MODEM_CONTROL_REQ;
-            isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
-            CallControlReq( &callReq, aIpc );
-            break;
-            }
-        case EMobileCallAnswerISV:
-        case EEtelCallAnswer:
-            {
-            if ( RMobilePhone::ECircuitDataService == callMode )
+            case EEtelCallHangUp:
                 {
-                ret = AnswerIncomingDataCall( callData );
-                requestDirectedToDataPort = ETrue;
-                }
-            else
-                {
-                iIs3rdPartyAnswerIncomingCall = EFalse;
-
-                // Is it from a 3rd party client or not
-                if ( EMobileCallAnswerISV == aIpc )
+                // Call mode for emergency call is voice
+                if ( RMobilePhone::EVoiceService == callMode )
+                    {
+                    iEmergCallDelayed = EFalse;
+                    }
+
+                if ( RMobilePhone::ECircuitDataService == callMode )
                     {
-                    iIs3rdPartyAnswerIncomingCall = ETrue;
+                    ret = HangUp( callId );
+                        requestDirectedToDataPort = ETrue;
+                        }
+                else
+                    {
+                    messageId = CALL_MODEM_RELEASE_REQ;
+                    isiCallId = CALL_MODEM_RELEASE_REQ_OFFSET_CALLID;
+                    CallReleaseReq( &callReq, callData );
                     }
                 // No else
-                messageId = CALL_MODEM_ANSWER_REQ;
-                isiCallId = CALL_MODEM_ANSWER_REQ_OFFSET_CALLID;
-                callReq.Set8bit(
-                    ISI_HEADER_SIZE + CALL_MODEM_ANSWER_REQ_OFFSET_SUBBLOCKS,
-                    KCallPadding );
+                break;
+                }
+            case EMobilePhoneClearBlacklist:
+                {
+                messageId = CALL_MODEM_BLACKLIST_CLEAR_REQ;
+                break;
                 }
-            break;
-            }
-        case EEtelCallHangUp:
-            {
-            // Call mode for emergency call is voice
-            if ( RMobilePhone::EVoiceService == callMode )
+            // CSD fearures
+            case EEtelCallLoanDataPort:
+                {
+                if ( iDataPortHandler )
+                    {
+                    ret = iDataPortHandler->LoanDataPort( callData );
+                    }
+                else
+                    {
+                    ret = KErrNotReady;
+                    }
+                requestDirectedToDataPort = ETrue;
+                break;
+                }
+            case EEtelCallRecoverDataPort:
                 {
-                iEmergCallDelayed = EFalse;
-                }
-
-            if ( RMobilePhone::ECircuitDataService == callMode )
-                {
-                ret = HangUp( callId );
+                if ( iDataPortHandler )
+                    {
+                    ret = iDataPortHandler->RecoverDataPort( callData );
+                    }
+                else
+                    {
+                    ret = KErrNotReady;
+                    }
                 requestDirectedToDataPort = ETrue;
+                break;
                 }
-            else
+            case EMobileCallActivateUUS:
+                {
+                ret = ActivateUUS( aDataPackage );
+                break;
+                }
+            default:
                 {
-                messageId = CALL_MODEM_RELEASE_REQ;
-                isiCallId = CALL_MODEM_RELEASE_REQ_OFFSET_CALLID;
-                CallReleaseReq( &callReq, callData );
+TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
+OstTrace1( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL; - Unknown IPC=%d", aIpc );
+                ret = KErrNotSupported;
+                break;
+                }
+            }
+
+        if ( ! requestDirectedToDataPort && !callCreatedAlready
+#ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
+             && !iEmergCallDelayed
+#endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
+             )
+            {
+            // Create ISI message
+            callReq.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, messageId );
+
+            // Every message definition doesn't contains call ID
+            if ( 0 != isiCallId )
+                {
+                callReq.Set8bit( ISI_HEADER_SIZE + isiCallId, dosCallId );
                 }
             // No else
-            break;
-            }
-        case EMobilePhoneClearBlacklist:
-            {
-            messageId = CALL_MODEM_BLACKLIST_CLEAR_REQ;
-            break;
-            }
-        // CSD fearures
-        case EEtelCallLoanDataPort:
-            {
-            if ( iDataPortHandler )
+
+            if ( KErrNone == ret )
                 {
-                ret = iDataPortHandler->LoanDataPort( callData );
-                }
-            else
-                {
-                ret = KErrNotReady;
-                }
-            requestDirectedToDataPort = ETrue;
-            break;
-            }
-        case EEtelCallRecoverDataPort:
-            {
-            if ( iDataPortHandler )
-                {
-                ret = iDataPortHandler->RecoverDataPort( callData );
-                }
-            else
-                {
-                ret = KErrNotReady;
+                // Send message to PhoNet
+                ret = iPhoNetSender->Send( callReq.Complete() );
                 }
-            requestDirectedToDataPort = ETrue;
-            break;
-            }
-        case EMobileCallActivateUUS:
-            {
-            ret = ActivateUUS( aDataPackage );
-            break;
-            }
-        default:
-            {
-TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
-OstTrace1( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL; - Unknown IPC=%d", aIpc );
-            ret = KErrNotSupported;
-            break;
-            }
-        }
-
-    if ( ! requestDirectedToDataPort && !callCreatedAlready
-#ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-         && !iEmergCallDelayed
-#endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
-         )
-        {
-        // Create ISI message
-        callReq.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, messageId );
-
-        // Every message definition doesn't contains call ID
-        if ( 0 != isiCallId )
-            {
-            callReq.Set8bit( ISI_HEADER_SIZE + isiCallId, dosCallId );
-            }
-        // No else
-
-        if ( KErrNone == ret )
-            {
-            // Send message to PhoNet
-            ret = iPhoNetSender->Send( callReq.Complete() );
+            // No else
             }
         // No else
         }
@@ -1184,12 +1179,6 @@
         TUint8 causeValue( aIsiMessage.Get8bit(
             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
 
-        // Map error value to Symbian OS error value
-        mobileCallInfo.iExitCode = CMmStaticUtility::CSCauseToEpocError(
-            PN_MODEM_CALL,
-            causeType,
-            causeValue );
-
         // To prevent FDN error to be completed again from CallServiceDeniedInd
         if ( CALL_MODEM_CAUSE_FDN_NOT_OK == causeValue )
             {
@@ -1202,6 +1191,39 @@
             ISI_HEADER_SIZE + CALL_MODEM_CREATE_RESP_OFFSET_CALLID )
                 & KMaskBits1to3 );
 
+        // Check if the call request has been call controlled
+        if ( iCallControlCallId == mobileCallInfo.iCallId
+            && iCcResult != KCcResultAllowedNoModification )
+            {
+            // call controlled requests have always different call id than
+            // CALL_MODEM_ID_NONE. If the original request is not changed,
+            // no need for specific error values
+            if ( KCcResultNotAllowed == iCcResult )
+                {
+                // call control rejected the request
+                mobileCallInfo.iExitCode =
+                    CMmStaticUtility::EpocErrorCode( KErrGeneral,
+                        KErrGsmCCCallRejected );
+                }
+            else
+                {
+                // call control modified the request
+                mobileCallInfo.iExitCode =
+                    CMmStaticUtility::EpocErrorCode( KErrAccessDenied,
+                        KErrSatControl );
+                }
+            // reset the values
+            iCallControlCallId = CALL_MODEM_ID_NONE;
+            iCcResult = KCcResultAllowedNoModification;
+            }
+        else
+            {
+            // Map error value to Symbian OS error value
+            mobileCallInfo.iExitCode = CMmStaticUtility::CSCauseToEpocError(
+                PN_MODEM_CALL,
+                causeType,
+                causeValue );
+            }
         // Create call package
         CCallDataPackage callData;
         // Pack the data for sending to the manager
@@ -3257,9 +3279,10 @@
     // Check if Video Call is MT Released.
     // Pipe have to remove to make next call possible.
     // Have to wait that Csd videoCall is disconnected.
-    if ( CALL_MODEM_STATUS_MT_RELEASE == callStatusISA )
+    if ( CALL_MODEM_STATUS_MT_RELEASE == callStatusISA ||
+         CALL_MODEM_STATUS_MO_RELEASE == callStatusISA )
         {
-        iVideoCallMtReleased = ETrue;
+        iVideoCallReleased = ETrue;
         }
 
     // Read call mode
@@ -3284,229 +3307,225 @@
     if( CALL_MODEM_STATUS_IDLE == callStatusISA &&
         mobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
         {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:NOTE! Can't complete to CTSY!, because call is terminated before it is indicated to CTSY");
-OstTrace0( TRACE_NORMAL, DUP19_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL:NOTE! Can't complete to CTSY!, because call is terminated before it is indicated to CTSY" );
         // reset temporary call info
         ResetIncomingCallInfo( iIncomingCallInfo );
         }
-    else
-        {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:Normal completion of call status ind (no termination of calls which haven't been indicated to CTSY yet)");
 OstTrace0( TRACE_NORMAL, DUP20_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL:Normal completion of call status ind (no termination of calls which haven't been indicated to CTSY yet)" );
 
-        // Create call package (used for all completions)
-        CCallDataPackage callData;
-        // Pack the data for sending to the manager
-        callData.SetCallIdAndMode(
-            mobileCallInfo.iCallId,
-            mobileCallInfo.iService );
-
-        CheckCallIsaStatus( mobileCallInfo, callStatusISA );
-
-        // Store UUI data when the call is coming
-        if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
-            ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-            CALL_MODEM_SB_USER_TO_USER,
-            EIsiSubBlockTypeId8Len8,
-            sbStartOffSet ) &&
-            ( CALL_MODEM_STATUS_COMING == callStatusISA ) )
-            {
+    // Create call package (used for all completions)
+    CCallDataPackage callData;
+    // Pack the data for sending to the manager
+    callData.SetCallIdAndMode(
+        mobileCallInfo.iCallId,
+        mobileCallInfo.iService );
+
+    CheckCallIsaStatus( mobileCallInfo, callStatusISA );
+
+    // Store UUI data when the call is coming
+    if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
+        CALL_MODEM_SB_USER_TO_USER,
+        EIsiSubBlockTypeId8Len8,
+        sbStartOffSet ) &&
+        ( CALL_MODEM_STATUS_COMING == callStatusISA ) )
+        {
 
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: Receive UUI.");
 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: Receive UUI" );
 
-            // Get data length
-            TUint8 userToUserDataLen( aIsiMessage.Get8bit(
-            sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOULEN ) );
-
-            // Get UUIE data
-            TPtrC8 data( aIsiMessage.GetData(
-                sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOU,
-                userToUserDataLen ) );
-
-            // Copy UUS data to member variable. Receive UUI will be completed
-            // after EEtelLineNotifyIncomingCall is completed.
-            iReceivedUusData.Zero();
-            iReceivedUusData.Copy( data.Left( RMobileCall::KMaxUUISize ) );
+        // Get data length
+        TUint8 userToUserDataLen( aIsiMessage.Get8bit(
+        sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOULEN ) );
+
+        // Get UUIE data
+        TPtrC8 data( aIsiMessage.GetData(
+            sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOU,
+            userToUserDataLen ) );
+
+        // Copy UUS data to member variable. Receive UUI will be completed
+        // after EEtelLineNotifyIncomingCall is completed.
+        iReceivedUusData.Zero();
+        iReceivedUusData.Copy( data.Left( RMobileCall::KMaxUUISize ) );
+        }
+    // No else
+
+    // If status is valid in Symbian OS
+    if ( RMobileCall::EStatusUnknown != statusETel )
+        {
+        TUint8 causeType( 0 );
+        TUint8 causeValue( 0 );
+        // Introduce target
+        TBuf16<RMobilePhone::KMaxMobileTelNumberSize> targetOrig;
+        TBuf16<RMobileCall::KCallingNameSize> targetOrigName;
+
+        // Copy some data previously received to current MobileCallInfo
+        if ( mobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
+            {
+            mobileCallInfo.iForwarded = iIncomingCallInfo.iForwarded;
+            mobileCallInfo.iValid |= RMobileCall::KCallForwarded;
+            mobileCallInfo.iRemoteParty = iIncomingCallInfo.iRemoteParty;
+            mobileCallInfo.iValid |= RMobileCall::KCallRemoteParty;
             }
         // No else
 
-        // If status is valid in Symbian OS
-        if ( RMobileCall::EStatusUnknown != statusETel )
+        // Read gsm redirecting address
+        if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+            ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
+            CALL_MODEM_SB_REDIRECTING_ADDRESS,
+            EIsiSubBlockTypeId8Len8,
+            sbStartOffSet ) )
             {
-            TUint8 causeType( 0 );
-            TUint8 causeValue( 0 );
-            // Introduce target
-            TBuf16<RMobilePhone::KMaxMobileTelNumberSize> targetOrig;
-            TBuf16<RMobileCall::KCallingNameSize> targetOrigName;
-
-            // Copy some data previously received to current MobileCallInfo
-            if ( mobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock");
+OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock" );
+
+            // Get address length
+            TUint8 redirectingAddressLength( aIsiMessage.Get8bit(
+                sbStartOffSet +
+                CALL_MODEM_SB_REDIRECTING_ADDRESS_OFFSET_ADDRLEN ) );
+
+            // If there is a redirection address, the call has been forwarded
+            // (but not vice versa; this information can come with another
+            // indication)
+            if ( 0 != redirectingAddressLength )
                 {
-                mobileCallInfo.iForwarded = iIncomingCallInfo.iForwarded;
+                mobileCallInfo.iForwarded = ETrue;
                 mobileCallInfo.iValid |= RMobileCall::KCallForwarded;
-                mobileCallInfo.iRemoteParty = iIncomingCallInfo.iRemoteParty;
-                mobileCallInfo.iValid |= RMobileCall::KCallRemoteParty;
                 }
+                // No else
+            }
             // No else
 
-            // Read gsm redirecting address
+        // Read CALL_MODEM_SB_LINE_ID
+        if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+            ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
+            CALL_MODEM_SB_LINE_ID,
+            EIsiSubBlockTypeId8Len8,
+            sbStartOffSet ))
+            {
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock");
+OstTrace0( TRACE_NORMAL, DUP21_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock" );
+
+            origPresentInd = aIsiMessage.Get8bit(
+                sbStartOffSet + CALL_MODEM_SB_LINE_ID_OFFSET_LINEID );
+            }
+        // Read all destination address
+        if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+            ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
+            CALL_MODEM_SB_DESTINATION_ADDRESS,
+            EIsiSubBlockTypeId8Len8,
+            sbStartOffSet ) )
+            {
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock");
+OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock" );
+
+            ReadAllAddressDestination( mobileCallInfo, targetOrig, aIsiMessage, sbStartOffSet, origPresentInd );
+            }
+            // No else
+
+        if ( CALL_MODEM_STATUS_CREATE == callStatusISA )
+            {
+            // Reset orginator address information. Destination address
+            // contents in CALL_MODEM_STATUS_IND are same as in CALL_MODEM_CREATE_REQ
+            // when call is in create state.
+            mobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
+            mobileCallInfo.iValid &= ~RMobileCall::KCallRemoteParty;
+            }
+            // No else
+
+            // Read call origin info
             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                CALL_MODEM_SB_REDIRECTING_ADDRESS,
+                CALL_MODEM_SB_ORIGIN_INFO,
                 EIsiSubBlockTypeId8Len8,
                 sbStartOffSet ) )
                 {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock");
-OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock" );
-
-                // Get address length
-                TUint8 redirectingAddressLength( aIsiMessage.Get8bit(
-                    sbStartOffSet +
-                    CALL_MODEM_SB_REDIRECTING_ADDRESS_OFFSET_ADDRLEN ) );
-
-                // If there is a redirection address, the call has been forwarded
-                // (but not vice versa; this information can come with another
-                // indication)
-                if ( 0 != redirectingAddressLength )
-                    {
-                    mobileCallInfo.iForwarded = ETrue;
-                    mobileCallInfo.iValid |= RMobileCall::KCallForwarded;
-                    }
-                    // No else
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock");
+OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock" );
+
+                ReadCallInfo(
+                    mobileCallInfo,
+                    targetOrigName,
+                    aIsiMessage,
+                    sbStartOffSet );
                 }
                 // No else
 
-            // Read CALL_MODEM_SB_LINE_ID
+            // Get error value
             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                CALL_MODEM_SB_LINE_ID,
-                EIsiSubBlockTypeId8Len8,
-                sbStartOffSet ))
-                {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock");
-OstTrace0( TRACE_NORMAL, DUP21_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock" );
-
-                origPresentInd = aIsiMessage.Get8bit(
-                    sbStartOffSet + CALL_MODEM_SB_LINE_ID_OFFSET_LINEID );
-                }
-            // Read all destination address
-            if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
-                ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                CALL_MODEM_SB_DESTINATION_ADDRESS,
+                CALL_MODEM_SB_CAUSE,
                 EIsiSubBlockTypeId8Len8,
                 sbStartOffSet ) )
                 {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock");
-OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock" );
-
-                ReadAllAddressDestination( mobileCallInfo, targetOrig, aIsiMessage, sbStartOffSet, origPresentInd );
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock");
+OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock" );
+
+                // Get cause type and value
+                causeType = aIsiMessage.Get8bit(
+                    sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE );
+
+                // Get call cause value
+                causeValue = aIsiMessage.Get8bit(
+                    sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE );
                 }
                 // No else
 
-            if ( CALL_MODEM_STATUS_CREATE == callStatusISA )
+            // If iDestPostAddressIncluded flag is (ETrue) we don't handle
+            // CALL_MODEM_SB_DESTINATION_POST_ADDRESS subblock here
+            if ( !iDestPostAddressIncluded )
                 {
-                // Reset orginator address information. Destination address
-                // contents in CALL_MODEM_STATUS_IND are same as in CALL_MODEM_CREATE_REQ
-                // when call is in create state.
-                mobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
-                mobileCallInfo.iValid &= ~RMobileCall::KCallRemoteParty;
-                }
-                // No else
-
-                // Read call origin info
+                // CALL_MODEM_SB_DESTINATION_POST_ADDRESS
+                // If Destination post address is found, save it.
+                // It will be sent later when this call is active
                 if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
                     ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                    CALL_MODEM_SB_ORIGIN_INFO,
+                    CALL_MODEM_SB_DESTINATION_POST_ADDRESS,
                     EIsiSubBlockTypeId8Len8,
                     sbStartOffSet ) )
                     {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock");
-OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock" );
-
-                    ReadCallInfo(
-                        mobileCallInfo,
-                        targetOrigName,
-                        aIsiMessage,
-                        sbStartOffSet );
-                    }
-                    // No else
-
-                // Get error value
-                if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
-                    ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                    CALL_MODEM_SB_CAUSE,
-                    EIsiSubBlockTypeId8Len8,
-                    sbStartOffSet ) )
-                    {
-TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock");
-OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock" );
-
-                    // Get cause type and value
-                    causeType = aIsiMessage.Get8bit(
-                        sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE );
-
-                    // Get call cause value
-                    causeValue = aIsiMessage.Get8bit(
-                        sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE );
-                    }
-                    // No else
-
-                // If iDestPostAddressIncluded flag is (ETrue) we don't handle
-                // CALL_MODEM_SB_DESTINATION_POST_ADDRESS subblock here
-                if ( !iDestPostAddressIncluded )
-                    {
-                    // CALL_MODEM_SB_DESTINATION_POST_ADDRESS
-                    // If Destination post address is found, save it.
-                    // It will be sent later when this call is active
-                    if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
-                        ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
-                        CALL_MODEM_SB_DESTINATION_POST_ADDRESS,
-                        EIsiSubBlockTypeId8Len8,
-                        sbStartOffSet ) )
-                        {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:CALL_MODEM_SB_DESTINATION_POST_ADDRESS");
 OstTrace0( TRACE_NORMAL, DUP8_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_POST_ADDRESS" );
 
-                        // Get address length
-                        TUint8 destinationPostAddressLength( aIsiMessage.Get8bit(
-                            sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDRLEN ) );
-
-                        // Get address
-                        TPtrC8 postAddr( aIsiMessage.GetData(
-                            sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDR,
-                            destinationPostAddressLength * 2 ) );
-
-                        // Do not handle post address which lenght is over 15 chars
-                        if ( ( KDestPostAddressMaxLength * 2 ) >= postAddr.Length() )
-                            {
+                    // Get address length
+                    TUint8 destinationPostAddressLength( aIsiMessage.Get8bit(
+                        sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDRLEN ) );
+
+                    // Get address
+                    TPtrC8 postAddr( aIsiMessage.GetData(
+                        sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDR,
+                        destinationPostAddressLength * 2 ) );
+
+                    // Do not handle post address which lenght is over 15 chars
+                    if ( ( KDestPostAddressMaxLength * 2 ) >= postAddr.Length() )
+                        {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:lenght less than 15 char");
 OstTrace0( TRACE_NORMAL, DUP9_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: Lenght less than 15 char" );
-                            // Copy 8-bit name to the 16-bit target using correct endianess
-                            TIsiUtility::CopyFromBigEndian(
-                                postAddr,
-                                iDestPostAddress );
-
-                            TInt postAddrLength( iDestPostAddress.Length() );
-
-                            // Store call ID to identify SIM ATK call
-                            iDtmfPostAddressCallId = mobileCallInfo.iCallId;
-
-                            // Check that there is not "w" char. "w" will mess up internal
-                            // DTMF sending process
-                            for ( TInt i( 0 ); i < postAddrLength; i++ )
+                        // Copy 8-bit name to the 16-bit target using correct endianess
+                        TIsiUtility::CopyFromBigEndian(
+                            postAddr,
+                            iDestPostAddress );
+
+                        TInt postAddrLength( iDestPostAddress.Length() );
+
+                        // Store call ID to identify SIM ATK call
+                        iDtmfPostAddressCallId = mobileCallInfo.iCallId;
+
+                        // Check that there is not "w" char. "w" will mess up internal
+                        // DTMF sending process
+                        for ( TInt i( 0 ); i < postAddrLength; i++ )
+                            {
+                            if ( 'w' == iDestPostAddress[ i ] )
                                 {
-                                if ( 'w' == iDestPostAddress[ i ] )
-                                    {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:w found");
 OstTrace0( TRACE_NORMAL, DUP10_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: w found" );
-                                    iDestPostAddress.SetLength( 0 );
-                                    iDtmfPostAddressCallId = 0;
-                                    break;
-                                    }
+                                iDestPostAddress.SetLength( 0 );
+                                iDtmfPostAddressCallId = 0;
+                                break;
                                 }
                             }
                         }
+                    }
 
 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:callStatusISA: %d", callStatusISA);
 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:mobileCallInfo.iCallId: %d", mobileCallInfo.iCallId);
@@ -3515,38 +3534,38 @@
 OstTraceExt1( TRACE_NORMAL, DUP13_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;mobileCallInfo.iCallId=%hhu", mobileCallInfo.iCallId );
 OstTraceExt1( TRACE_NORMAL, DUP12_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;iDtmfPostAddressCallId=%hhu", iDtmfPostAddressCallId );
 
-                    // When call is active, send post address
-                    // DTMF sending in case this is SIMATK call
-                    if ( CALL_MODEM_STATUS_ACTIVE == callStatusISA &&
-                        iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
-                        0 < iDtmfPostAddressCallId )
-                        {
+                // When call is active, send post address
+                // DTMF sending in case this is SIMATK call
+                if ( CALL_MODEM_STATUS_ACTIVE == callStatusISA &&
+                    iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
+                    0 < iDtmfPostAddressCallId )
+                    {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:Dtmf post address sending (ACTIVE)");
 OstTrace0( TRACE_NORMAL, DUP17_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL, Dtmf post address sending (ACTIVE)" );
-                        iDtmfMessHandler->SendPostAddressL ( &iDestPostAddress );
-
-                        // Reset iDestPostAddress and iDtmfPostAddressCallId to prevent multiple
-                        // requests
-                        iDestPostAddress.SetLength( 0 );
-                        iDtmfPostAddressCallId = 0;
-                        }
-
-                    // If call fails for some reason, and goes to idle, reset
-                    // iDestPostAddress and iDtmfPostAddressCallId
-                    if ( CALL_MODEM_STATUS_IDLE == callStatusISA &&
-                        iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
-                        0 < iDtmfPostAddressCallId )
-                        {
+                    iDtmfMessHandler->SendPostAddressL ( &iDestPostAddress );
+
+                    // Reset iDestPostAddress and iDtmfPostAddressCallId to prevent multiple
+                    // requests
+                    iDestPostAddress.SetLength( 0 );
+                    iDtmfPostAddressCallId = 0;
+                    }
+
+                // If call fails for some reason, and goes to idle, reset
+                // iDestPostAddress and iDtmfPostAddressCallId
+                if ( CALL_MODEM_STATUS_IDLE == callStatusISA &&
+                    iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
+                    0 < iDtmfPostAddressCallId )
+                    {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:If call fails for some reason (IDLE)");
 OstTrace0( TRACE_NORMAL, DUP14_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: If call fails for some reason (IDLE)" );
-                        iDestPostAddress.SetLength( 0 );
-                        iDtmfPostAddressCallId = 0;
-                        }
+                    iDestPostAddress.SetLength( 0 );
+                    iDtmfPostAddressCallId = 0;
+                    }
 
 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:iDtmfPostAddressCallId: %d After value",iDtmfPostAddressCallId);
 OstTraceExt1( TRACE_NORMAL, DUP18_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;iDtmfPostAddressCallId=%hhu After value", iDtmfPostAddressCallId );
-                    }
-                    // No else
+                }
+                // No else
 
             if ( CALL_MODEM_SSD_NO_CUG == ( iDiagnosticOctet & KMaskBits1to7 ) &&
                 CALL_MODEM_NW_CAUSE_FACILITY_REJECTED == causeValue )
@@ -3579,14 +3598,15 @@
             CompleteIncomingCallNotif( mobileCallInfo, statusETel );
             // MT calls which went waiting can alert twice
             // reset stored incoming call information only after they actually rang
-            if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA )
+            // or when MT call is answered
+            if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA || 
+                 CALL_MODEM_STATUS_ANSWERED == callStatusISA )
                 {
                 ResetIncomingCallInfo( iIncomingCallInfo );
                 }
 
         // Update mobile call info to data port handler also
-            if ( ( CALL_MODEM_MODE_MULTIMEDIA == callModeISA ) &&
-                CALL_MODEM_STATUS_WAITING != callStatusISA )
+            if ( CALL_MODEM_MODE_MULTIMEDIA == callModeISA )
                 {
                 TBool isMultimedia( CALL_MODEM_MODE_MULTIMEDIA == callModeISA );
                 TBool isWaitingCall( iWaitingCall == mobileCallInfo.iCallId );
@@ -3659,10 +3679,8 @@
                 iWaitingCall = KSymbianCallIdNone;
                 }
             // No else
-            }
+        }
         // No else
-
-        }//end of if(incoming call && status == idle)
     }
 
 // -----------------------------------------------------------------------------
@@ -4991,9 +5009,6 @@
         {
         result = CMmStaticUtility::CSCauseToEpocError( PN_CSD, 0x00, causeValue );
 
-        //Remove Pipe for wideo telephony
-        PnsPipeRemoveReq();
-
         // set call id and mode
         if ( iMobileCallInfo.iCallId < 0 )
             {
@@ -5033,6 +5048,7 @@
                 break;
                 }
             case CSD_CALL_RELEASE:
+            case CSD_CALL_REJECT:
                 {
                 // Complete failed HangUp request
                 iMessageRouter->Complete(
@@ -5041,7 +5057,6 @@
                         result );
                 break;
                 }
-            case CSD_CALL_REJECT:
             default:
                 {
 TFLOGSTRING("TSY: CMmCallMessHandler::CsdCallControlResp. Switch oper_Id case default.");
@@ -5050,14 +5065,6 @@
                 }
             }
         }
-    else
-        {
-        if ( CSD_CALL_RELEASE == oper_Id )
-            {
-            //Remove Pipe for wideo telephony
-            PnsPipeRemoveReq();
-            }
-        }
     }
 
 // -----------------------------------------------------------------------------
@@ -5098,14 +5105,14 @@
         }
     else
         {
-        // MT video call case we have to remove pipe
-        if ( iVideoCallMtReleased )
+        // MO/MT video call released. we have to remove pipe.
+        if ( iVideoCallReleased )
             {
-TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: call MT releated");
-OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: call MT released" );
+TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: call MO/MT releated");
+OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: call MO/MT released" );
             //Remove Pipe for wideo telephony
             PnsPipeRemoveReq();
-            iVideoCallMtReleased = EFalse;
+            iVideoCallReleased = EFalse;
             }
         }
     // CSD_VIDEO_CALL_STATUS_DISCONNECT arrives also when call establishment
@@ -5316,6 +5323,18 @@
 TFLOGSTRING("TSY: CMmCallMessHandler::DialDataCall. callParams and callInfo ok." );
 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_DIALDATACALL, "CMmCallMessHandler::DialDataCall;callParams and callInfo ok." );
 
+        // if CTSY does not set call id as valid we need to copy it from
+        // data package
+        if ( 0 == callInfo->iValid & RMobileCall::KCallId )
+            {
+TFLOGSTRING("TSY: CMmCallMessHandler::DialDataCall. Copy call mode into call info");
+OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_DIALDATACALL, "CMmCallMessHandler::DialDataCall. Copy call mode into call info" );
+            aDataPackage->GetCallIdAndMode(
+                callInfo->iCallId, callInfo->iService );
+            // service is always valid
+            callInfo->iValid |= RMobileCall::KCallId;
+            }
+
         SetMobileCallInfo( *callInfo );
 
         iIdRestrict = recentCallParams.iIdRestrict;
@@ -5323,6 +5342,7 @@
 
         // Dial the call
         iCallOperationID = CSD_CALL_CREATE;
+        iCallDirection = RMobileCall::EMobileOriginated;
 
         // Create Pipe for wideo telephony
         // If creation succeed, then CsdCallControlReq( CSD_CALL_CREATE )
@@ -5405,7 +5425,15 @@
     if ( 0 < aCallId )
         {
         // Hangup the call
-        ret = CsdCallControlReq( CSD_CALL_RELEASE );
+        if( iMobileCallInfo.iCallId == aCallId &&
+            RMobileCall::EStatusRinging == iMobileCallInfo.iStatus )
+            {
+            ret = CsdCallControlReq( CSD_CALL_REJECT );
+            }
+        else
+            {
+            ret = CsdCallControlReq( CSD_CALL_RELEASE );
+            }
         }
     else if ( RMobileCall::EStatusIdle == iMobileCallInfo.iStatus )
         {
@@ -5422,7 +5450,6 @@
 //
 TInt CMmCallMessHandler::PnsPipeCreateReq( const TUint8 aPipeStateAfter ) const
     {
-
     TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeCreateReq" );
 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPECREATEREQ, "CMmCallMessHandler::PnsPipeCreateReq" );
 
@@ -5439,8 +5466,8 @@
     data.Append( EIscNokiaDataport1 );
     data.Append( KFirstPepType );
     data.Append( KCallPadding );
-    data.Append( iSecondPepDeviceId );
-    data.Append( iSecondPepObjectId );
+    data.Append( KSecondPepDevice );
+    data.Append( KSecondPepObject );
     data.Append( KSecondPepType );
     data.Append( KCallPadding );
 
@@ -5487,161 +5514,34 @@
             // Dial or Answer the call
             CsdCallControlReq( iCallOperationID );
             }
-        else if ( PN_PIPE_ERR_GENERAL == errorCode ) // Check PIPE Error Code
+        else
             {
-            TUint8 pep1ErrorCode( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-                ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_PEP1ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-                ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_PEP1ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-            TUint8 pep2ErrorCode( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-                ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_PEP2ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-                ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_PEP2ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-            // Check PEP Error Codes
-            if ( pep1ErrorCode == PN_PIPE_ERR_PEP_IN_USE ||
-                 pep1ErrorCode == PN_PIPE_ERR_ALL_PIPES_IN_USE ||
-                 pep2ErrorCode == PN_PIPE_ERR_PEP_IN_USE ||
-                 pep2ErrorCode == PN_PIPE_ERR_ALL_PIPES_IN_USE )
+            CCallDataPackage callData;
+            // set call id and mode
+            callData.SetCallIdAndMode(
+                iMobileCallInfo.iCallId, iMobileCallInfo.iService );
+            TInt err = CMmStaticUtility::PacketDataCSCauseToEpocError(
+                 errorCode, PN_PIPE );
+            if ( RMobileCall::EMobileTerminated == iCallDirection )
                 {
-                // PEP can't create more pipes (all pipes in use),
-                // error value is updated here
-TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeCreateResp. ErrorCode changed to PN_PIPE_ERR_ALL_PIPES_IN_USE" );
-OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPECREATERESP, "CMmCallMessHandler::PnsPipeCreateResp, ErrorCode changed to PN_PIPE_ERR_ALL_PIPES_IN_USE" );
+                // answering video call fails
+                iMessageRouter->Complete(
+                    EEtelCallAnswer,
+                    &callData,
+                    err );
                 }
+            else
+                {
+                // dialling video call fails
+                // for MO calls pipe is created before iCallDirection is set
+                iMessageRouter->Complete(
+                    EEtelCallDial,
+                    &callData,
+                    err );
+                }
+            iCallDirection = RMobileCall::EDirectionUnknown;
             }
-        //no else
         }
-    //no else
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeEnableReq
-// Construct a PNS_PIPE_ENABLE_REQ ISI-message.
-// ----------------------------------------------------------------------------
-//
-TInt CMmCallMessHandler::PnsPipeEnableReq() const
-    {
-    TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeEnableReq. PipeHandle: %d", iPipeHandle );
-OstTraceExt1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPEENABLEREQ, "CMmCallMessHandler::PnsPipeEnableReq;pipehandle=%hhu", iPipeHandle );
-
-    // TODO: this method is not called. See TelAd-110
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-    TBuf8<SIZE_PNS_PIPE_ENABLE_REQ> data;
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-    TBuf8<SIZE_CM_PIPE_ENABLE_REQ> data;
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-    data.Append( iPipeHandle );
-    data.Append( KCallPadding );
-
-    // Send Isi message via phonet
-    return iPhoNetSender->Send(
-        PN_PIPE, KPipeTransID, PNS_PIPE_ENABLE_REQ, data );
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeEnableResp
-// Breaks a PNS_PIPE_ENABLE_RESP ISI-message.
-// ----------------------------------------------------------------------------
-//
-void CMmCallMessHandler::PnsPipeEnableResp(
-    const TIsiReceiveC& aIsiMessage )
-    {
-TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeEnableResp");
-OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEENABLERESP, "CMmCallMessHandler::PnsPipeEnableResp" );
-    // Get Transaction Id from the ISI message
-    TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
-
-    // TODO: this code makes no sense. See TelAd-110
-    if ( KPipeTransID == transId )
-        {
-        // Get Errorcode from the ISI message
-        TUint8 errorCode( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-            ISI_HEADER_SIZE + PNS_PIPE_ENABLE_RESP_OFFSET_ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_ENABLE_RESP_OFFSET_ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeEnableResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, iPipeHandle, errorCode );
-OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEENABLERESP, "CMmCallMessHandler::PnsPipeEnableResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
-        }
-    // no else
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeResetReq
-// Construct a PNS_PIPE_RESET_REQ ISI-message.
-// ----------------------------------------------------------------------------
-//
-TInt CMmCallMessHandler::PnsPipeResetReq(
-    const TUint8 aStateAfterReset )
-    {
-    TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeResetReq. PipeHandle: %d", iPipeHandle );
-OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPERESETREQ, "CMmCallMessHandler::PnsPipeResetReq;aPipeHandle=%hhu", iPipeHandle );
-
-    // TODO: this method is not called. See TelAd-110
-    // Create buffer for isi msg data
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-    TBuf8<SIZE_PNS_PIPE_RESET_REQ> data;
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-    TBuf8<SIZE_CM_PIPE_RESET_REQ> data;
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-    data.Append( iPipeHandle );
-    data.Append( aStateAfterReset );
-
-    // Send Isi message via phonet
-    return iPhoNetSender->Send(
-        PN_PIPE, KPipeTransID, PNS_PIPE_RESET_REQ, data );
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeResetResp
-// Breaks a PNS_PIPE_RESET_RESP ISI-message.
-// ----------------------------------------------------------------------------
-//
-void CMmCallMessHandler::PnsPipeResetResp(
-    const TIsiReceiveC& aIsiMessage )
-    {
-TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeResetResp");
-OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp" );
-    // Get Transaction Id from the ISI message
-    TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
-
-    // TODO: this code makes no sense. See TelAd-110
-    if ( KPipeTransID == transId )
-        {
-        // Get Pipehandle from the ISI message
-        TUint8 pipeHandle( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-            ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-        iPipeHandle = pipeHandle;
-
-TFLOGSTRING3("TSY: CMmCallMessHandler::PnsPipeResetResp - traId: %d, pipe handle: %d", transId, pipeHandle);
-OstTraceExt2( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp;transId=%hhu;pipeHandle=%hhu", transId, pipeHandle );
-
-        TUint8 errorCode( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-            ISI_HEADER_SIZE + PNS_PIPE_RESET_RESP_OFFSET_ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_RESET_RESP_OFFSET_ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-TFLOGSTRING3("TSY: CMmCallMessHandler::PnsPipeResetResp. PipeHandle: %d ErrorCode: %d", pipeHandle, errorCode );
-OstTraceExt2( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp;pipeHandle=%hhu;errorCode=%hhu", pipeHandle, errorCode );
-        }
-    // no else
     }
 
 // ----------------------------------------------------------------------------
@@ -5685,7 +5585,6 @@
     // Get Transaction Id from the ISI message
     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
 
-    // TODO: this code makes no sense. See TelAd-110
     if ( KPipeTransID == transId )
         {
         // Get Errorcode from the ISI message
@@ -5698,80 +5597,8 @@
 
 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeRemoveResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, iPipeHandle, errorCode );
 OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREMOVERESP, "CMmCallMessHandler::PnsPipeRemoveResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
-        }
-    // no else
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeRedirectReq
-// Construct a PNS_PIPE_REDIRECT_REQ ISI-message.
-// ----------------------------------------------------------------------------
-//
-TInt CMmCallMessHandler::PnsPipeRedirectReq()
-    {
-    TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeRedirectReq. PipeHandle: %d", iPipeHandle );
-OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREDIRECTREQ, "CMmCallMessHandler::PnsPipeRedirectReq;aPipeHandle=%hhu", iPipeHandle );
-
-    // TODO: this method is not called. See TelAd-110
-    // Create buffer for isi msg data
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-    TBuf8<SIZE_PNS_PIPE_REDIRECT_REQ> data;
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-    TBuf8<SIZE_CM_PIPE_REDIRECT_REQ> data;
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-    data.Append( iPipeHandle );
-    data.Append( PN_PIPE_ENABLE );
-    data.Append( iSecondPepDeviceId );
-    data.Append( iSecondPepObjectId );
-    data.Append( KSecondPepType );
-    data.Append( KCallPadding );
-    data.Append( KSecondPepDevice );
-    data.Append( KRedirectPepObject );
-    data.Append( KSecondPepType );
-
-    // Send Isi message via phonet
-    return iPhoNetSender->Send(
-        PN_PIPE,
-        KPipeTransID,
-        PNS_PIPE_REDIRECT_REQ,
-        data );
-    }
-
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeRedirectResp
-// Breaks a PNS_PIPE_REDIRECT_RESP ISI-message.
-// ----------------------------------------------------------------------------
-//
-void CMmCallMessHandler::PnsPipeRedirectResp(
-    const TIsiReceiveC& aIsiMessage )
-    {
-TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeRedirectResp");
-OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEREDIRECTRESP, "CMmCallMessHandler::PnsPipeRedirectResp" );
-    // Get Transaction Id from the ISI message
-    TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
-
-    if ( KPipeTransID == transId )
-        {
-        // Get Pipehandle from the ISI message
-        TUint8 pipeHandle( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-            ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-        iPipeHandle = pipeHandle;
-
-        // Get Errorcode from the ISI message
-        TUint8 errorCode( aIsiMessage.Get8bit(
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-            ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeRedirectResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, pipeHandle, errorCode );
-OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREDIRECTRESP, "CMmCallMessHandler::PnsPipeRedirectResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, pipeHandle, errorCode );
+
+        iPipeHandle = KInvalidPipeHandle;
         }
     // no else
     }
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmconferencecallmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmconferencecallmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,7 +24,7 @@
 #include "cmmcallmesshandler.h"
 #include "cmmmessagerouter.h"
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 
 #include <etelmm.h>
 #include <tisi.h>
@@ -32,7 +32,7 @@
 #include <ctsy/pluginapi/cmmdatapackage.h>
 
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmconferencecallmesshandlertraces.h"
+#include "cmmconferencecallmesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -32,12 +32,6 @@
 #include <call_modemisi.h>
 #include <csdisi.h>
 #include <gssisi.h>
-
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-// Removed for Bridge camp!
-#include <mtcisi.h>
-#endif
-
 #include <infoisi.h>
 #include <net_modemisi.h>
 #include <uiccisi.h>
@@ -52,9 +46,9 @@
 #include <ctsy/serviceapi/gsmerror.h>
 #include <etelmmerr.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmcustommesshandlertraces.h"
+#include "cmmcustommesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -283,15 +277,6 @@
         PN_GSS,
         GSS_HSXPA_USER_SETTING_IND );
 
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-    // MTC
-    // Removed for Bridge camp
-    aPhoNetReceiver->RegisterL(
-        customMessHandler,
-        PN_MTC,
-        MTC_RAT_QUERY_RESP );
-#endif
-
     // PMM
     /* To be done in CPS
     aPhoNetReceiver->RegisterL( customMessHandler,
@@ -344,7 +329,7 @@
 
     // Initialize Call Life Timer value.
     iCallLifeTimer = KCallLifeTimerNotSet;
-    
+
     // initialize ISim application activation status
     iIsimApplActivated = EFalse;
     }
@@ -510,28 +495,6 @@
             break;
             }
 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-        // Removed for Bridge camp
-        case PN_MTC:
-            {
-            switch( messageId )
-                {
-                case MTC_RAT_QUERY_RESP:
-                    {
-                    MtcRatQueryResp( aIsiMessage );
-                    break;
-                    }
-                default:
-                    {
-TFLOGSTRING("TSY: CMmCustomMessHandler::ReceiveMessageL - switch resource - case PN_MTC, switch messageId - default");
-OstTrace0( TRACE_NORMAL, DUP5_CMMCUSTOMMESSHANDLER_RECEIVEMESSAGEL, "CMmCustomMessHandler::ReceiveMessageL- switch resource - case PN_MTC, switch messageId - default" );
-                    break;
-                    }
-                }
-            break;
-            }
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
         case PN_INFO:
 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
         case PN_MODEM_INFO:
@@ -2019,7 +1982,7 @@
   // packed parameter: TBool result
   CMmDataPackage dataPackage;
   dataPackage.PackData( &result );
-  
+
   TFLOGSTRING2( "TSY: TSY: CMmCustomMessHandler::CallEmergencyNbrCheckResp status: %d", status);
   TFLOGSTRING2( "TSY: TSY: CMmCustomMessHandler::CallEmergencyNbrCheckResp emergency number: %S", &telNumber);
     //we complete with KErrNone as there is always a value to return
@@ -2871,7 +2834,8 @@
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::GssCsServiceResp
 // Breaks a GSS_CS_SERVICE_RESP ISI message.
-// completes ECustomSetSystemNetworkModeIPC, ECustomSetBandSelectionIPC or
+// completes ECustomSetSystemNetworkModeIPC,
+// ECustomGetCurrentSystemNetworkModesIPC, ECustomSetBandSelectionIPC or
 // ECustomGetBandSelectionIPC with KErrNone to SOS layer.
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
@@ -2879,40 +2843,93 @@
 void CMmCustomMessHandler::GssCsServiceResp (
         const TIsiReceiveC& aIsiMessage ) // Received isi message
     {
-    TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceResp" );
+TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceResp" );
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp" );
 
     TUint8 transactId ( aIsiMessage.Get8bit(
         ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_TRANSID ) );
 
-    TUint8 operation ( aIsiMessage.Get8bit(
-        ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_OPERATION ) );
-
-    // GSS_SELECTED_RAT_WRITE (0x0E)
-    if ( KCustomTransId == transactId && GSS_SELECTED_RAT_WRITE == operation )
-        {
-        //completion ResetGssServer method (no packed parameters)
-        TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC");
+    if ( KCustomTransId == transactId )
+        {
+        TUint8 operation ( aIsiMessage.Get8bit(
+            ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_OPERATION ) );
+
+        // GSS_SELECTED_RAT_WRITE (0x0E)
+        if ( GSS_SELECTED_RAT_WRITE == operation )
+            {
+TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC");
 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetSystemNetworkModeIPC" );
-        iMessageRouter->Complete( ECustomSetSystemNetworkModeIPC, KErrNone );
-        }
-
-// not suppoted for S60 ver 3.2
+            //completion ResetGssServer method (no packed parameters)
+            iMessageRouter->Complete( ECustomSetSystemNetworkModeIPC, KErrNone );
+            }
+        // GSS_SELECTED_RAT_READ (0x9C)
+        else if ( GSS_SELECTED_RAT_READ == operation )
+            {
+TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomGetCurrentSystemNetworkModesIPC");
+OstTrace0( TRACE_NORMAL, DUP3_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomGetCurrentSystemNetworkModesIPC" );
+            TInt err( KErrNone );
+            TUint32 ratMode ( RMmCustomAPI::KCapsNetworkModeDual );
+            TUint subblockOffset( 0 );
+            if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+                ISI_HEADER_SIZE + SIZE_GSS_CS_SERVICE_RESP,
+                GSS_RAT_INFO,
+                EIsiSubBlockTypeId8Len8,
+                subblockOffset ) )
+                {
+                TUint8 mode = aIsiMessage.Get8bit( subblockOffset +
+                    GSS_RAT_INFO_OFFSET_FUNCTION );
+                switch ( mode )
+                    {
+                    case GSS_GSM_RAT:
+                        {
+                        ratMode = RMmCustomAPI::KCapsNetworkModeGsm;
+                        break;
+                        }
+                    case GSS_UMTS_RAT:
+                        {
+                        ratMode = RMmCustomAPI::KCapsNetworkModeUmts;
+                        break;
+                        }
+                    case GSS_DUAL_RAT:
+                        {
+                        ratMode = RMmCustomAPI::KCapsNetworkModeDual;
+                        break;
+                        }
+                    default:
+                        {
+TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Unrecognized RAT");
+OstTrace0( TRACE_NORMAL, DUP4_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Unrecognized RAT" );
+                        err = KErrGeneral;
+                        break;
+                        }
+                    }
+                }
+            else
+                {
+                err = KErrGeneral;
+                }
+            CMmDataPackage dataPackage;
+            dataPackage.PackData( &ratMode );
+            //completion ResetNetServer method (packed parameters)
+            iMessageRouter->Complete( ECustomGetCurrentSystemNetworkModesIPC,
+                &dataPackage, err );
+            }
+    // not suppoted for S60 ver 3.2
 #if ( NCP_COMMON_S60_VERSION_SUPPORT != S60_VERSION_32 )
-
-    // GSS_SELECTED_BANDS_WRITE (0x9D)
-    else if ( GSS_SELECTED_BANDS_WRITE == operation )
-        {
-        TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC");
+        // GSS_SELECTED_BANDS_WRITE (0x9D)
+        else if ( GSS_SELECTED_BANDS_WRITE == operation )
+            {
+TFLOGSTRING("TSY: CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC");
 OstTrace0( TRACE_NORMAL, DUP2_CMMCUSTOMMESSHANDLER_GSSCSSERVICERESP, "CMmCustomMessHandler::GssCsServiceResp - Complete ECustomSetBandSelectionIPC" );
-        iMessageRouter->Complete( ECustomSetBandSelectionIPC, KErrNone );
-        }
-    // GSS_SELECTED_BANDS_READ (0x9E)
-    else if ( GSS_SELECTED_BANDS_READ == operation )
-        {
-        CompleteGetBandSelection( aIsiMessage );
-        }
+            iMessageRouter->Complete( ECustomSetBandSelectionIPC, KErrNone );
+            }
+        // GSS_SELECTED_BANDS_READ (0x9E)
+        else if ( GSS_SELECTED_BANDS_READ == operation )
+            {
+            CompleteGetBandSelection( aIsiMessage );
+            }
 #endif // NCP_COMMON_S60_VERSION_SUPPORT
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -3116,6 +3133,30 @@
     }
 
 // -----------------------------------------------------------------------------
+// CMmCustomMessHandler::GssCsServiceReq
+// Constructs GSS_CS_SERVICE_REQ ISI message from input parameters and
+// sends it through phonet.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMmCustomMessHandler::GssCsServiceReq
+        (
+        TUint8 aTransId   //transaction Id
+        )
+    {
+TFLOGSTRING( "TSY: CMmCustomMessHandler::GssCsServiceReq" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_GSSCSSERVICEREQ, "CMmCustomMessHandler::GssCsServiceReq" );
+
+    TBuf8<KTwo> messageData;
+
+    messageData.Append( GSS_SELECTED_RAT_READ );
+    messageData.Append( 0 ); // number of subblocks
+
+    // Sending message to phonet
+    return iPhoNetSender->Send( PN_GSS, aTransId, GSS_CS_SERVICE_REQ, messageData );
+    }
+
+// -----------------------------------------------------------------------------
 // CMmCustomMessHandler::ExtFuncL
 // Forwards requests coming from the Symbian OS layer to the
 // specific method.
@@ -3305,16 +3346,12 @@
             ret = GssCsServiceReq( transId, networkModeCaps  );
             break;
             }
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
         // Current network modes
-        // Removed for Bridge camp!
         case ECustomGetCurrentSystemNetworkModesIPC:
             {
-            ret = MtcRatQueryReq( transId );
-            break;
-            }
-#endif /*  INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
+            ret = GssCsServiceReq( transId );
+            break;
+            }
         // Get GSM/WCDMA cell info
         case ECustomGetCellInfoIPC:
             {
@@ -3504,6 +3541,7 @@
 TInt CMmCustomMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY: CMmCustomMessHandler::ProcessUiccMsg, transaction ID: %d, status: %d", aTraId, aStatus );
@@ -3677,91 +3715,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMmCustomMessHandler::MtcRatQueryReq
-// Constructs MTC_RAT_QUERY_REQ ISI message from input parameters and
-// sends it through phonet.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-// Removed for Bridge camp
-TInt CMmCustomMessHandler::MtcRatQueryReq
-        (
-        TUint8 aTransId   //transaction Id
-        )
-    {
-    TFLOGSTRING("TSY: CMmCustomMessHandler::MtcRatQueryReq.\n" );
-OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_MTCRATQUERYREQ, "CMmCustomMessHandler::MtcRatQueryReq" );
-
-    TBuf8<KTwo> messageData;
-
-    //append padding bytes
-    messageData.Append( 0 );
-    messageData.Append( 0 );
-
-    // Sending message to phonet
-    return iPhoNetSender->Send( PN_MTC, aTransId, MTC_RAT_QUERY_REQ, messageData );
-    }
-
-// -----------------------------------------------------------------------------
-// CMmCustomMessHandler::MtcRatQueryResp
-// Breaks a MTC_RAT_QUERY_RESP ISI message.
-// This method get the ratMode and complete the request with error value
-// to SOS layer.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-// Removed for Bridge camp
-void CMmCustomMessHandler::MtcRatQueryResp
-        (
-        const TIsiReceiveC& aIsiMessage // Received isi message
-        )
-    {
-    TInt ret ( KErrNone );
-
-    TUint32 ratMode ( RMmCustomAPI::KCapsNetworkModeDual );
-    TUint8 mode = aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_RAT_QUERY_RESP_OFFSET_RAT );
-
-TFLOGSTRING3("TSY: CMmCustomMessHandler::MtcRatQueryResp. RatMode:%d, mode:%d", ratMode, mode);
-OstTraceExt2( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_MTCRATQUERYRESP, "CMmCustomMessHandler::MtcRatQueryResp;mode=%hhu;ratMode=%u", mode, ratMode );
-
-    switch ( mode )
-        {
-        case MTC_GSM_RAT:
-            {
-            ratMode = RMmCustomAPI::KCapsNetworkModeGsm;
-            break;
-            }
-        case MTC_UMTS_RAT:
-            {
-            ratMode = RMmCustomAPI::KCapsNetworkModeUmts;
-            break;
-            }
-        case MTC_NO_RAT_SELECTION: //this means dual mode
-            {
-            //value already initalized to dual
-            break;
-            }
-        default: // MTC_UNKNOWN_RAT
-            {
-            TFLOGSTRING("TSY: CMmCustomMessHandler::MtcRatQueryResp, switch mode - default.\n" );
-OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_MTCRATQUERYRESP, "CMmCustomMessHandler::MtcRatQueryResp, switch mode - default" );
-            ret = KErrGeneral;
-            break;
-            }
-        }
-
-    CMmDataPackage dataPackage;
-    dataPackage.PackData( &ratMode );
-
-    //completion ResetNetServer method (packed parameters)
-    iMessageRouter->Complete( ECustomGetCurrentSystemNetworkModesIPC,
-        &dataPackage, ret );
-
-    }
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-// -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccReadViagHomeZoneParametersReq
 // Read home zone parameters from UICC
 // -----------------------------------------------------------------------------
@@ -5961,7 +5914,7 @@
 // Constructs and sends AUTHENTICATE APDU to the UICC server
 // -----------------------------------------------------------------------------
 //
-TInt CMmCustomMessHandler::UiccSendAuthenticateApdu( 
+TInt CMmCustomMessHandler::UiccSendAuthenticateApdu(
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccSendAuthenticateApdu.\n" );
@@ -6024,9 +5977,9 @@
             else if( UICC_CARD_TYPE_UICC == cardType )
                 {
                 // In 3G we need to send command AUTHENTICATE to the UICC
-                UiccCreate3GSecurityContextApdu( 
-                    params, 
-                    eapAka.iRandomParameters, 
+                UiccCreate3GSecurityContextApdu(
+                    params,
+                    eapAka.iRandomParameters,
                     eapAka.iAUTN,
                     ETrIdEEapAkaAuthenticate );
                 apduSendNeeded = ETrue;
@@ -6037,7 +5990,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceGBA );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccCreateGBABootstrappingApdu( params, aDataPackage );
@@ -6056,7 +6009,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceGBA );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccGBABootstrapUpdate( aDataPackage );
@@ -6074,7 +6027,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceGBA );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccCreateGBABootstrapNafDerivationApdu( params, aDataPackage );
@@ -6093,7 +6046,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceMBMSsecurity );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccCreateMbmsMskUpdateApdu( params, aDataPackage );
@@ -6112,7 +6065,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceMBMSsecurity );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccCreateMbmsMtkGenerationApdu( params, aDataPackage );
@@ -6131,7 +6084,7 @@
             {
             serviceStatus = iMmUiccMessHandler->GetServiceStatus( KServiceMBMSsecurity );
 
-            if( UICC_CARD_TYPE_UICC == cardType && 
+            if( UICC_CARD_TYPE_UICC == cardType &&
                 EFalse != serviceStatus )
                 {
                 UiccCreateMbmsMskDeletionApdu( params, aDataPackage );
@@ -6157,7 +6110,7 @@
     if( EFalse != apduSendNeeded )
         {
         // send the apdu to the UICC server
-        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params ); 
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
         }
     else
         {
@@ -6173,8 +6126,8 @@
 // Constructs GSM context AUTHENTICATE APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu( 
-    TUiccSendApdu& aParams, 
+void CMmCustomMessHandler::UiccCreateRunGsmAlgorithmApdu(
+    TUiccSendApdu& aParams,
     const TDesC8& aRand,
     TUiccTrId aTraId )
     {
@@ -6269,8 +6222,8 @@
             {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccRunGsmAlgorithmApduResp: Security conditions not satisfied\n" );
 OstTrace0( TRACE_NORMAL, DUP2_CMMCUSTOMMESSHANDLER_UICCRUNGSMALGORITHMAPDURESP, "CMmCustomMessHandler::UiccRunGsmAlgorithmApduResp: Security conditions not satisfied" );
-            ret = CMmStaticUtility::EpocErrorCode( 
-                KErrAccessDenied, 
+            ret = CMmStaticUtility::EpocErrorCode(
+                KErrAccessDenied,
                 KErrGsm0707SimPin1Required );
             }
         else
@@ -6321,8 +6274,8 @@
 // Constructs GSM context AUTHENTICATE APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu( 
-    TUiccSendApdu& params, 
+void CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu(
+    TUiccSendApdu& params,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGsmSecurityContextApdu.\n" );
@@ -6424,16 +6377,16 @@
 // Constructs 3G security context AUTHENTICATE APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccCreate3GSecurityContextApdu( 
-    TUiccSendApdu& aParams, 
-    const TDesC8& aRand, 
+void CMmCustomMessHandler::UiccCreate3GSecurityContextApdu(
+    TUiccSendApdu& aParams,
+    const TDesC8& aRand,
     const TDesC8& aAuth,
     TUiccTrId aTraId )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreate3GSecurityContextApdu.\n" );
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATE3GSECURITYCONTEXTAPDU, "CMmCustomMessHandler::UiccCreate3GSecurityContextApdu" );
 
-    // len of data is sizeof RAND + sizeof AUTN + two length fields 
+    // len of data is sizeof RAND + sizeof AUTN + two length fields
     // (one for RAND len and one for AUTN len)
     TUint8 lc( aRand.Size() + aAuth.Size() + 2 );
 
@@ -6442,7 +6395,7 @@
     aParams.apdu.Append( KEvenInstructionCode ); // INS
     aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction
     aParams.apdu.Append( K3GAuthenticationContext ); // P2
-    aParams.apdu.Append( lc );                       // Lc 
+    aParams.apdu.Append( lc );                       // Lc
     aParams.apdu.Append( aRand.Size() ); // len of RAND
     aParams.apdu.Append( aRand );        // RAND
     aParams.apdu.Append( aAuth.Size() );             // len of AUTN
@@ -6503,7 +6456,7 @@
                         eapAka.iIK.Copy( aFileData.Mid( index, len ) );
                         index += len;
 
-                        // Kc is not supported at the moment because of 
+                        // Kc is not supported at the moment because of
                         // RMmCustomAPI::TSimAuthenticationEapAka doesn't
                         // have parameter for that
                         }
@@ -6550,7 +6503,7 @@
 OstTrace0( TRACE_NORMAL, DUP1_CMMCUSTOMMESSHANDLER_UICC3GSECURITYCONTEXTAPDURESP, "CMmCustomMessHandler::Uicc3GSecurityContextApduResp: APDU validation failed" );
                 ret = KErrMMEtelAuthenticateFailed;
                 }
-            }            
+            }
         else if( KAppAuthErrorIncorrectMac == result )
             {
 TFLOGSTRING("TSY: CMmCustomMessHandler::Uicc3GSecurityContextApduResp: incorrect MAC\n" );
@@ -6562,8 +6515,8 @@
             {
 TFLOGSTRING("TSY: CMmCustomMessHandler::Uicc3GSecurityContextApduResp: Security conditions not satisfied\n" );
 OstTrace0( TRACE_NORMAL, DUP3_CMMCUSTOMMESSHANDLER_UICC3GSECURITYCONTEXTAPDURESP, "CMmCustomMessHandler::Uicc3GSecurityContextApduResp: Security conditions not satisfied" );
-            ret = CMmStaticUtility::EpocErrorCode( 
-                KErrAccessDenied, 
+            ret = CMmStaticUtility::EpocErrorCode(
+                KErrAccessDenied,
                 KErrGsm0707SimPin1Required );
             }
         else
@@ -6580,8 +6533,8 @@
         ret = ETrIdEEapAkaAuthenticateIms == aTraId ? KErrGeneral : KErrMMEtelAuthenticateFailed;
         }
 
-    if( KErrNone == ret || 
-        KErrMMEtelSqnVerificationFailed == ret || 
+    if( KErrNone == ret ||
+        KErrMMEtelSqnVerificationFailed == ret ||
         KErrMMEtelMacVerificationFailed == ret )
         {
         CMmDataPackage dataPackage;
@@ -6598,7 +6551,7 @@
         iMessageRouter->Complete(
             ipc,
             &dataPackage,
-            ret );	
+            ret );
         }
     else
         {
@@ -6615,7 +6568,7 @@
 // -----------------------------------------------------------------------------
 //
 void CMmCustomMessHandler::UiccCreateGBABootstrappingApdu(
-    TUiccSendApdu& aParams, 
+    TUiccSendApdu& aParams,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrappingApdu.\n" );
@@ -6624,7 +6577,7 @@
     RMmCustomAPI::TSimAuthenticationGbaBootstrap gbaBootstrap;
     aDataPackage.UnPackData( gbaBootstrap );
 
-    // len of data is GBA bootstrapping mode tag (1 byte) + sizeof RAND 
+    // len of data is GBA bootstrapping mode tag (1 byte) + sizeof RAND
     // + sizeof AUTN + two length fields (one for RAND len and one for AUTN len)
     TUint8 lc( 1 + gbaBootstrap.iRandomParameters.Size() + gbaBootstrap.iAUTN.Size() + 2 );
 
@@ -6633,7 +6586,7 @@
     aParams.apdu.Append( KEvenInstructionCode ); // INS
     aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction
     aParams.apdu.Append( KGBAAuthenticationContext ); // P2
-    aParams.apdu.Append( lc );                        // Lc 
+    aParams.apdu.Append( lc );                        // Lc
     aParams.apdu.Append( KGBABootstappingModeTag );   // GBA bootstrapping mode tag
     aParams.apdu.Append( gbaBootstrap.iRandomParameters.Size() ); // len of RAND
     aParams.apdu.Append( gbaBootstrap.iRandomParameters );        // RAND
@@ -6644,7 +6597,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccGBABootstrappingApduResp
-// Handles response APDU for GBA security context AUTHENTICATE APDU 
+// Handles response APDU for GBA security context AUTHENTICATE APDU
 // (bootstrapping mode)
 // -----------------------------------------------------------------------------
 //
@@ -6721,8 +6674,8 @@
         ret = KErrMMEtelAuthenticateFailed;
         }
 
-    if( KErrNone == ret || 
-        KErrMMEtelSqnVerificationFailed == ret || 
+    if( KErrNone == ret ||
+        KErrMMEtelSqnVerificationFailed == ret ||
         KErrMMEtelMacVerificationFailed == ret )
         {
         CMmDataPackage dataPackage;
@@ -6731,7 +6684,7 @@
         iMessageRouter->Complete(
             ECustomGetSimAuthenticationDataIPC,
             &dataPackage,
-            ret );	
+            ret );
         }
     else
         {
@@ -6785,14 +6738,14 @@
     params.filePath.Append( KMasterFileId );
     params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
 
-    iMmUiccMessHandler->CreateUiccApplCmdReq( params ); 
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
     }
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccGBABootstrapReadResp
 // Handles response to elementary file EFgba read operation
 // -----------------------------------------------------------------------------
-//  
+//
 void CMmCustomMessHandler::UiccGBABootstrapReadResp(
     TInt aStatus,
     const TDesC8& aFileData )
@@ -6808,9 +6761,9 @@
         TUint32 index( 0 );
         TUint8 randLen( aFileData[index++] );
 
-        if( aFileData.Length() >= randLen + 
-            iBTidBuf.Length() + 
-            iKeyLifetimeBuf.Length() + 
+        if( aFileData.Length() >= randLen +
+            iBTidBuf.Length() +
+            iKeyLifetimeBuf.Length() +
             3 )
             {
             // store rand temporarily so that we can complete it
@@ -6905,7 +6858,7 @@
 // -----------------------------------------------------------------------------
 //
 void CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu(
-    TUiccSendApdu& aParams, 
+    TUiccSendApdu& aParams,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateGBABootstrapNafDerivationApdu.\n" );
@@ -6914,11 +6867,11 @@
     RMmCustomAPI::TSimAuthenticationGbaNafDerivation gbaBootstrapNafDerivation;
     aDataPackage.UnPackData( gbaBootstrapNafDerivation );
 
-    // len of data is GBA NAF derivation mode tag (1 byte) + sizeof NAFId 
+    // len of data is GBA NAF derivation mode tag (1 byte) + sizeof NAFId
     // + sizeof IMPI + two length fields (one for NAFId len and one for IMPI len)
-    TUint8 lc( 1 + 
-               gbaBootstrapNafDerivation.iNafId.Size() + 
-               gbaBootstrapNafDerivation.iImpi.Size() + 
+    TUint8 lc( 1 +
+               gbaBootstrapNafDerivation.iNafId.Size() +
+               gbaBootstrapNafDerivation.iImpi.Size() +
                2 );
 
     aParams.trId = ETrIdEGbaNafDerivation;
@@ -6926,7 +6879,7 @@
     aParams.apdu.Append( KEvenInstructionCode ); // INS
     aParams.apdu.Append( 0 ); // P1 is set to 0 in case of even instruction
     aParams.apdu.Append( KGBAAuthenticationContext ); // P2
-    aParams.apdu.Append( lc );                        // Lc 
+    aParams.apdu.Append( lc );                        // Lc
     aParams.apdu.Append( KGBANAFDerivationModeTag );   // GBA bootstrapping mode tag
     aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId.Size() ); // len of NAFId
     aParams.apdu.Append( gbaBootstrapNafDerivation.iNafId );        // NAFId
@@ -6938,7 +6891,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccGBABootstrapNafDerivationApduResp
-// Handles response APDU for GBA security context AUTHENTICATE APDU 
+// Handles response APDU for GBA security context AUTHENTICATE APDU
 // (NAF derivation mode)
 // -----------------------------------------------------------------------------
 //
@@ -6966,7 +6919,7 @@
             if( KApduOk == ValidateReceivedAuthenticateApdu( aTraId, aFileData ) )
                 {
                 // Let's skip "Successful GBA operation" tag
-                // and start with Length of Length of Ks ext NAF 
+                // and start with Length of Length of Ks ext NAF
                 TUint32 index( 1 );
 
                 // get the Ks ext NAF
@@ -7006,7 +6959,7 @@
         iMessageRouter->Complete(
             ECustomGetSimAuthenticationDataIPC,
             &dataPackage,
-            ret );	
+            ret );
         }
     else
         {
@@ -7023,7 +6976,7 @@
 // -----------------------------------------------------------------------------
 //
 void CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu(
-    TUiccSendApdu& params, 
+    TUiccSendApdu& params,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskUpdateApdu.\n" );
@@ -7031,7 +6984,7 @@
 
     // Note. MBMS functionality is not tested in real hardware and in real environmen
     //  because of there is no users for this authentication type. So this is implemented
-    // with the best knowledge at the moment and it can contain some bugs which 
+    // with the best knowledge at the moment and it can contain some bugs which
     // can be found when this is tested in real environment.
 
     RMmCustomAPI::TSimAuthenticationMgvMskUpdate mskUpdate;
@@ -7047,7 +7000,7 @@
     params.apdu.Append( KOddInstructionCode );  // INS
     params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1
     params.apdu.Append( KMBMSAuthenticationContext ); // P2
-    params.apdu.Append( lc );                         // Lc 
+    params.apdu.Append( lc );                         // Lc
     params.apdu.Append( KMBMSDataObjectTag );          // MBMS Data object tag
     params.apdu.Append( mskUpdate.iMikey.Size() + 1 ); // MBMS data obj len
     params.apdu.Append( KMskUpdateMode );              // MBMS Security Context Mode
@@ -7057,7 +7010,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccMbmsMskUpdateApduResp
-// Handles response APDU for MBMS security context AUTHENTICATE APDU 
+// Handles response APDU for MBMS security context AUTHENTICATE APDU
 // (MSK Update Mode)
 // -----------------------------------------------------------------------------
 //
@@ -7069,8 +7022,8 @@
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCMBMSMSKUPDATEAPDURESP, "CMmCustomMessHandler::UiccMbmsMskUpdateApduResp" );
 
     // Note. MBMS functionality is not tested in real hardware and in real environment
-    // because of at the moment there is no users for this authentication type. 
-    // So this is implemented with the best knowledge at the moment and it can contain 
+    // because of at the moment there is no users for this authentication type.
+    // So this is implemented with the best knowledge at the moment and it can contain
     // some bugs which can be found when this is tested in real environment.
 
     TInt ret( KErrGeneral );
@@ -7163,7 +7116,7 @@
             iMessageRouter->Complete(
                 ECustomGetSimAuthenticationDataIPC,
                 &dataPackage,
-                ret );	
+                ret );
             }
         else
             {
@@ -7191,13 +7144,13 @@
     TUint32 objLen( aMbmsData.Length() );
 
     if( KSuccessfullMbmsOperationTag == aMbmsData[index] &&
-        1 <= objLen && 
+        1 <= objLen &&
         ( KMaxMbmsMikeyLen + 1 ) >= objLen  ) // + 1 for 0xDB TLV tag
         {
         index++;
 
-        // len of MIKEY is obj len - 1 because of 
-        // obj data contains 1 byte for 
+        // len of MIKEY is obj len - 1 because of
+        // obj data contains 1 byte for
         // Successfull Mbms Operation Tag
         TUint8 mikeyLen = objLen - 1;
         if( 0 < mikeyLen )
@@ -7213,7 +7166,7 @@
 // Handles OMA BCAST operation data from authenticate APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccMskUpdateHandleOMABcastOperationData( 
+void CMmCustomMessHandler::UiccMskUpdateHandleOMABcastOperationData(
                 RMmCustomAPI::TSimAuthenticationMgvMskUpdate& aMskUpdate,
                 TDesC8& aMbmsData )
     {
@@ -7256,15 +7209,15 @@
 // -----------------------------------------------------------------------------
 //
 void CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu(
-    TUiccSendApdu& params, 
+    TUiccSendApdu& params,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu.\n" );
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMTKGENERATIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMtkGenerationApdu" );
 
     // Note. MBMS functionality is not tested in real hardware and in real environment
-    // because of at the moment there is no users for this authentication type. 
-    // So this is implemented with the best knowledge at the moment and it can contain 
+    // because of at the moment there is no users for this authentication type.
+    // So this is implemented with the best knowledge at the moment and it can contain
     // some bugs which can be found when this is tested in real environment.
 
     RMmCustomAPI::TSimAuthenticationMgvMtkGeneration mtkGen;
@@ -7280,7 +7233,7 @@
     params.apdu.Append( KOddInstructionCode );  // INS
     params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1
     params.apdu.Append( KMBMSAuthenticationContext ); // P2
-    params.apdu.Append( lc );                         // Lc 
+    params.apdu.Append( lc );                         // Lc
     params.apdu.Append( KMBMSDataObjectTag );          // MBMS Data object tag
     params.apdu.Append( mtkGen.iMikey.Size() + 1 ); // MBMS data obj len
     params.apdu.Append( KMtkGenerationMode );          // MBMS Security Context Mode
@@ -7290,7 +7243,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp
-// Handles response APDU for MBMS security context AUTHENTICATE APDU 
+// Handles response APDU for MBMS security context AUTHENTICATE APDU
 // (MTK Generation Mode)
 // -----------------------------------------------------------------------------
 //
@@ -7302,8 +7255,8 @@
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCMBMSMTKGENERATIONAPDURESP, "CMmCustomMessHandler::UiccMbmsMtkGenerationApduResp" );
 
     // Note. MBMS functionality is not tested in real hardware and in real environment
-    // because of at the moment there is no users for this authentication type. 
-    // So this is implemented with the best knowledge at the moment and it can contain 
+    // because of at the moment there is no users for this authentication type.
+    // So this is implemented with the best knowledge at the moment and it can contain
     // some bugs which can be found when this is tested in real environment.
 
     TInt ret( KErrGeneral );
@@ -7325,7 +7278,7 @@
                 {
                 TBuf8<KMaxApduSize> mbmsOperationData;
 
-                if( FindTlvObject( KMbmsOperationResponseTag53, aFileData.Mid( 0, aFileData.Length() - 2 ), mbmsOperationData ) || 
+                if( FindTlvObject( KMbmsOperationResponseTag53, aFileData.Mid( 0, aFileData.Length() - 2 ), mbmsOperationData ) ||
                     FindTlvObject( KMbmsOperationResponseTag73, aFileData.Mid( 0, aFileData.Length() - 2 ), mbmsOperationData ) )
                     {
                     ret = KErrNone;
@@ -7390,7 +7343,7 @@
             iMessageRouter->Complete(
                 ECustomGetSimAuthenticationDataIPC,
                 &dataPackage,
-                ret );	
+                ret );
             }
         else
             {
@@ -7407,7 +7360,7 @@
 // Handles MBMS operation data from MTK Generation authenticate APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData( 
+void CMmCustomMessHandler::UiccMtkGenHandleMbmsOperationData(
     RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen,
     TDesC8& aMbmsData )
     {
@@ -7418,13 +7371,13 @@
     TUint32 objLen( aMbmsData.Length() );
 
     if( KSuccessfullMbmsOperationTag == aMbmsData[index] &&
-        1 <= objLen && 
+        1 <= objLen &&
         ( KMaxMbmsSaltLen + 1 ) >= objLen  ) // + 1 for 0xDB TLV tag
         {
         index++;
 
-        // len of SALT is obj len - 1 because of 
-        // obj data contains 1 byte for 
+        // len of SALT is obj len - 1 because of
+        // obj data contains 1 byte for
         // Successfull Mbms Operation Tag
         TUint8 saltLen( objLen - 1 );
         if( 0 < saltLen )
@@ -7440,7 +7393,7 @@
 // Handles OMA BCAST operation data from authenticate APDU
 // -----------------------------------------------------------------------------
 //
-void CMmCustomMessHandler::UiccMtkGenHandleOMABcastOperationData( 
+void CMmCustomMessHandler::UiccMtkGenHandleOMABcastOperationData(
          RMmCustomAPI::TSimAuthenticationMgvMtkGeneration& aMtkGen,
          TDesC8& aMbmsData )
     {
@@ -7466,8 +7419,8 @@
             }
         if( FindTlvObject( KParentalControlTag, omaBcastData, parentalControlData ) )
             {
-            // first parameter of parental control data is "key reference for second 
-            // application PIN defined for parental contol" but it's not supported 
+            // first parameter of parental control data is "key reference for second
+            // application PIN defined for parental contol" but it's not supported
             // at the moment
             aMtkGen.iParentalControl.Append( parentalControlData[1] ); // rating type
             aMtkGen.iParentalControl.Append( parentalControlData[2] ); // rating value
@@ -7487,15 +7440,15 @@
 // -----------------------------------------------------------------------------
 //
 void CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu(
-    TUiccSendApdu& params, 
+    TUiccSendApdu& params,
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu.\n" );
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCCREATEMBMSMSKDELETIONAPDU, "CMmCustomMessHandler::UiccCreateMbmsMskDeletionApdu" );
-    
+
     // Note. MBMS functionality is not tested in real hardware and in real environment
-    // because of at the moment there is no users for this authentication type. 
-    // So this is implemented with the best knowledge at the moment and it can contain 
+    // because of at the moment there is no users for this authentication type.
+    // So this is implemented with the best knowledge at the moment and it can contain
     // some bugs which can be found when this is tested in real environment.
 
     RMmCustomAPI::TSimAuthenticationMgvMskDeletion mskDel;
@@ -7503,19 +7456,19 @@
 
     // len of data is MBMS Data Object tag (1 byte) +
     // MBMS Data Object length (1 byte) +
-    // MBMS Security Context Mode (1 byte) + 
+    // MBMS Security Context Mode (1 byte) +
     // size of Key Domain Id + size of Key Group Id Part
-    TUint8 lc( 1 + 
-               1 + 
-               1 + 
-               mskDel.iKeyDomainId.Size() + 
+    TUint8 lc( 1 +
+               1 +
+               1 +
+               mskDel.iKeyDomainId.Size() +
                mskDel.iKeyGroupIdPart.Size() );
 
     // data size in MBMS Data Object Tag is:
-    // MBMS Security Context Mode (1 byte) + 
+    // MBMS Security Context Mode (1 byte) +
     // size of Key Domain Id + size of Key Group Id Part
-    TUint8 dataSize( 1 + 
-                     mskDel.iKeyDomainId.Size() + 
+    TUint8 dataSize( 1 +
+                     mskDel.iKeyDomainId.Size() +
                      mskDel.iKeyGroupIdPart.Size() );
 
     params.trId = ETrIdEMbmsMskDeletion;
@@ -7523,7 +7476,7 @@
     params.apdu.Append( KOddInstructionCode );  // INS
     params.apdu.Append( KFirstBlockOfAuthenticationData ); // P1
     params.apdu.Append( KMBMSAuthenticationContext ); // P2
-    params.apdu.Append( lc );                         // Lc 
+    params.apdu.Append( lc );                         // Lc
     params.apdu.Append( KMBMSDataObjectTag );       // MBMS Data object tag
     params.apdu.Append( dataSize );                 // MBMS data obj len
     params.apdu.Append( KMskDeletionMode );         // MBMS Security Context Mode
@@ -7534,7 +7487,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::UiccMbmsMskDeletionApduResp
-// Handles response APDU for MBMS security context AUTHENTICATE APDU 
+// Handles response APDU for MBMS security context AUTHENTICATE APDU
 // (MSK Deletion Mode)
 // -----------------------------------------------------------------------------
 //
@@ -7546,8 +7499,8 @@
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_UICCMBMSMSKDELETIONAPDURESP, "CMmCustomMessHandler::UiccMbmsMskDeletionApduResp" );
 
     // Note. MBMS functionality is not tested in real hardware and in real environment
-    // because of at the moment there is no users for this authentication type. 
-    // So this is implemented with the best knowledge at the moment and it can contain 
+    // because of at the moment there is no users for this authentication type.
+    // So this is implemented with the best knowledge at the moment and it can contain
     // some bugs which can be found when this is tested in real environment.
 
     TInt ret( KErrGeneral );
@@ -7612,7 +7565,7 @@
             iMessageRouter->Complete(
                 ECustomGetSimAuthenticationDataIPC,
                 &dataPackage,
-                ret );	
+                ret );
             }
         else
             {
@@ -7650,15 +7603,15 @@
     params.apdu.Append( KOddInstructionCode );  // INS
     params.apdu.Append( KFirstBlockOfAuthenticationResponseData ); // P1
     params.apdu.Append( 0x00 ); // P2
-    params.apdu.Append( 0x00 ); // Le 
-
-    iMmUiccMessHandler->CreateUiccApplCmdReq( params ); 
+    params.apdu.Append( 0x00 ); // Le
+
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
     }
 
 
 // -----------------------------------------------------------------------------
 // CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult
-// Maps sw1 and sw2 from response authenticate apdu to result 
+// Maps sw1 and sw2 from response authenticate apdu to result
 // -----------------------------------------------------------------------------
 //
 TUint8 CMmCustomMessHandler::MapSw1Sw2ToAuthenticateResult( TUint8 sw1, TUint8 sw2 )
@@ -7684,7 +7637,7 @@
                 {
                 ret = KNormalCommandEnding;
                 }
-            else if( 0xF1 == sw2 || 
+            else if( 0xF1 == sw2 ||
                      0xF2 == sw2 )
                 {
                 ret = KWarningMoreDataAvailable;
@@ -7755,8 +7708,8 @@
 // Validates received apdu
 // -----------------------------------------------------------------------------
 //
-TUint8 CMmCustomMessHandler::ValidateReceivedAuthenticateApdu( 
-    TInt aTraId, 
+TUint8 CMmCustomMessHandler::ValidateReceivedAuthenticateApdu(
+    TInt aTraId,
     const TDesC8& aApdu )
     {
     TUint8 ret( KApduOk );
@@ -7813,7 +7766,7 @@
 OstTrace0( TRACE_NORMAL, CMMCUSTOMMESSHANDLER_VALIDATEGSMSECURITYCONTEXTAPDURESP, "CMmCustomMessHandler::ValidateGsmSecurityContextApduResp" );
     TUint8 ret( KApduNok );
 
-    // apdu len is len of aApdu - 2 (because of 
+    // apdu len is len of aApdu - 2 (because of
     // aApdu contains sw1 and sw2)
     TUint apduLen( aApdu.Length() - 2 );
     TUint32 index( 0 );
@@ -7841,7 +7794,7 @@
 
     TUint8 ret( KApduOk );
 
-    // Let's calculate total APDU data len in aApdu. Length is 
+    // Let's calculate total APDU data len in aApdu. Length is
     // decremented by 2 because of aApdu contains also sw1 and sw2
     // and these are total 2 bytes long.
     TUint8 apduLen( aApdu.Length() - 2 );
@@ -7975,7 +7928,7 @@
 
     TUint8 ret( KApduNok );
 
-    // Let's calculate total APDU data len in aApdu. Length is 
+    // Let's calculate total APDU data len in aApdu. Length is
     // decremented by 2 because of aApdu contains also sw1 and sw2
     // and these are total 2 bytes long.
     TUint8 apduLen( aApdu.Length() - 2 );
@@ -8009,7 +7962,7 @@
 
     TUint8 ret = KApduNok;
 
-    // Let's calculate total APDU data len in aApdu. Length is 
+    // Let's calculate total APDU data len in aApdu. Length is
     // decremented by 2 because of aApdu contains also sw1 and sw2
     // and these are total 2 bytes long.
     TUint8 apduLen( aApdu.Length() - 2 );
@@ -8020,10 +7973,10 @@
         {
         if( KSuccessfull3GAuthTag == tag )
             {
-            // response apdu contains only parameter Ks Ext NAF 
+            // response apdu contains only parameter Ks Ext NAF
             // so, let's check that apdu len contains parameter
             // correctly. So apduLen should be len of Ks Ext NAF
-            // + 2 ("Successful GBA operation" field + 
+            // + 2 ("Successful GBA operation" field +
             // Length of Ks_ext_NAF field)
             if( apduLen == aApdu[index] + 2 )
                 {
@@ -8058,7 +8011,7 @@
 // CMmCustomMessHandler::FindTlvObject
 // Finds TLV object
 // -----------------------------------------------------------------------------
-//  
+//
 TBool CMmCustomMessHandler::FindTlvObject(
     TUint8 aTlvTag,
     const TDesC8& aBerTlv,
@@ -8078,7 +8031,7 @@
         tlvLength = aBerTlv[index++];
 
         // let's check if len of tlv object is coded
-        // with one or two bytes        
+        // with one or two bytes
         if( 0x81 == tlvLength ||
             0x82 == tlvLength )
             {
@@ -8135,7 +8088,7 @@
 // CMmCustomMessHandler::DeriveCkFromKc
 // derives Ck from Kc
 // -----------------------------------------------------------------------------
-//  
+//
 void CMmCustomMessHandler::DeriveCkFromKc(
     TDes8& aCk,
     const TDesC8& aKc )
@@ -8217,7 +8170,7 @@
 // derives Ck from Kc
 // -----------------------------------------------------------------------------
 //
-TInt CMmCustomMessHandler::UiccHandleImsAuthentication( 
+TInt CMmCustomMessHandler::UiccHandleImsAuthentication(
     const CMmDataPackage& aDataPackage )
     {
 TFLOGSTRING("TSY: CMmCustomMessHandler::UiccHandleImsAuthentication.\n" );
@@ -8251,7 +8204,7 @@
 
     if( UICC_CARD_TYPE_ICC == cardType )
         {
-        // no need to activate ISIM application, 
+        // no need to activate ISIM application,
         // let's just send the authentication APDU
         UiccCreateRunGsmAlgorithmApdu(
             params,
@@ -8272,9 +8225,9 @@
             // let's check is ISIM application already tried to activate
             if( iIsimApplActivated )
                 {
-                UiccCreate3GSecurityContextApdu( 
-                    params, 
-                    authenticationData.iRAND, 
+                UiccCreate3GSecurityContextApdu(
+                    params,
+                    authenticationData.iRAND,
                     authenticationData.iAUTN,
                     ETrIdEEapAkaAuthenticateIms );
 
@@ -8337,9 +8290,9 @@
     params.filePath.Append( KMasterFileId );
     params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
 
-    UiccCreate3GSecurityContextApdu( 
-        params, 
-        iRandBuf, 
+    UiccCreate3GSecurityContextApdu(
+        params,
+        iRandBuf,
         iAutnBuf,
         ETrIdEEapAkaAuthenticateIms );
 
@@ -8353,7 +8306,7 @@
         }
     else
         {
-        // ISim application activation fails, le'ts send authentication apdu 
+        // ISim application activation fails, le'ts send authentication apdu
         // to the USim application
         iMmUiccMessHandler->CreateUiccApplCmdReq( params );
         }
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,9 +27,9 @@
 #include <commdb.h>
 #include <etelmmerr.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmdataporthandlertraces.h"
+#include "cmmdataporthandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmdatautility.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmdatautility.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,9 +22,9 @@
 #include "cmmdataporthandler.h"
 #include "tsylogger.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmdatautilitytraces.h"
+#include "cmmdatautilityTraces.h"
 #endif
 // EXTERNAL DATA STRUCTURES
     //None
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmdtmfmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmdtmfmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "cmmstaticutility.h"
 #include "cmmmessagerouter.h"
 #include "tsylogger.h" // logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmdtmfmesshandlertraces.h"
+#include "cmmdtmfmesshandlerTraces.h"
 #endif
 
 #include <etelmm.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmenstoremesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,821 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <tisi.h>
+//#include <simisi.h>
+
+#include "cmmenstoremesshandler.h"
+#include "cmmmessagerouter.h"
+#include <ctsy/pluginapi/cmmdatapackage.h>
+#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
+#include "cmmstaticutility.h"
+#include "tsylogger.h"
+#include "osttracedefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmmenstoremesshandlertraces.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+    //None
+
+// EXTERNAL FUNCTION PROTOTYPES
+    //None
+
+// CONSTANTS
+
+// These are doubled from CMmEnStoreTsy.h
+const TUint8 KEccStorageNumberMaxCount = 5; // ETSI 11.11
+const TUint8 KEmergencyNbrLenInBytes = 3;
+const TUint8 KDigitMask = 0x0F;
+
+// MACROS
+    //None
+
+// LOCAL CONSTANTS AND MACROS
+    //None
+
+// MODULE DATA STRUCTURES
+    //None
+
+// LOCAL FUNCTION PROTOTYPES
+    //None
+
+// ==================== LOCAL FUNCTIONS ========================================
+    //None
+
+// ==================== MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::CMmENStoreMessHandler
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CMmENStoreMessHandler::CMmENStoreMessHandler()
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::CMmENStoreMessHandler() - Start");
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_CMMENSTOREMESSHANDLER, "CMmENStoreMessHandler::CMmENStoreMessHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::~CMmENStoreMessHandler
+// C++ destructor.
+// -----------------------------------------------------------------------------
+//
+CMmENStoreMessHandler::~CMmENStoreMessHandler()
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::~CMmENStoreMessHandler() - End");
+OstTrace0( TRACE_NORMAL, DUP1_CMMENSTOREMESSHANDLER_CMMENSTOREMESSHANDLER, "CMmENStoreMessHandler::~CMmENStoreMessHandler" );
+
+    if( iEnNumberArray )
+        {
+        iEnNumberArray->ResetAndDestroy();
+        delete iEnNumberArray;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::NewL
+// Creates a new ENStoreMessageHandler object instance.
+// Create EN store message handler
+// Set internal variables
+// Return Values: CMmENStoreMessHandler*: Pointer to object
+// -----------------------------------------------------------------------------
+//
+CMmENStoreMessHandler* CMmENStoreMessHandler::NewL(
+    CMmMessageRouter* aMessageRouter, // pointer to the message router
+    CMmUiccMessHandler* aUiccMessHandler // pointer to UICC message handler
+    )
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::NewL");
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_NEWL, "CMmENStoreMessHandler::NewL" );
+
+    // Create EN store message handler
+    CMmENStoreMessHandler* enStoreMessHandler =
+        new( ELeave ) CMmENStoreMessHandler();
+
+    // Set internal variables
+    CleanupStack::PushL( enStoreMessHandler );
+    enStoreMessHandler->iMessageRouter = aMessageRouter;
+    enStoreMessHandler->iMmUiccMessHandler = aUiccMessHandler;
+    enStoreMessHandler->ConstructL();
+
+
+    CleanupStack::Pop( enStoreMessHandler );
+
+    return enStoreMessHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::ConstructL
+// Initialises object attributes.
+// -----------------------------------------------------------------------------
+//
+void CMmENStoreMessHandler::ConstructL()
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::ConstructL()");
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_CONSTRUCTL, "CMmENStoreMessHandler::ConstructL" );
+
+    iEnNumberArray = new ( ELeave ) CArrayPtrFlat<TENStoreResponse>( 1 );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::ProcessUiccMsg
+// Handles data received from UICC server
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::ProcessUiccMsg(
+    TInt aTraId,
+    TInt aStatus,
+    TUint8 /*aDetails*/,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING3("TSY:CMmENStoreMessHandler::ProcessUiccMsg, aTraId: %d, status: %d", aTraId, aStatus );
+OstTraceExt2( TRACE_NORMAL, DUP2_CMMENSTOREMESSHANDLER_PROCESSUICCMSG, "CMmENStoreMessHandler::ProcessUiccMsg;aTraId=%d;aStatus=%d", aTraId, aStatus );
+
+
+    TInt ret( KErrNone );
+
+    switch( aTraId )
+        {
+        case ETrIdEnStoreRead:
+            {
+            ret = UiccReadEmergCodesResp( aStatus, aFileData );
+            break;
+            }
+        case ETrIdEnStoreGetInfo:
+            {
+            ret = UiccENStoreGetInfoResp( aStatus, aFileData );
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY:CMmENStoreMessHandler::ProcessUiccMsg - unknown transaction ID" );
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_PROCESSUICCMSG, "CMmENStoreMessHandler::ProcessUiccMsg - unknown transaction ID" );
+            break;
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::UiccReadEmergCodesResp
+// Handles received ISI message from UICC Server.
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::UiccReadEmergCodesResp
+        (
+        TInt aStatus,
+        const TDesC8& aFileData
+        )
+    {
+TFLOGSTRING2("TSY:CMmENStoreMessHandler::UiccReadEmergCodesResp, status: %d", aStatus );
+OstTrace1( TRACE_NORMAL, DUP2_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESRESP, "CMmENStoreMessHandler::UiccReadEmergCodesResp;aStatus=%d", aStatus );
+
+    TInt ret( KErrNone );
+    // Create data package
+    CMmDataPackage numberData;
+
+    // Check the requesting function using transaction type and
+    // process the matching function call
+    switch ( iCurrentIpc )
+        {
+        case EMmTsyENStoreReadAllPhase1IPC:
+            {
+            if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                if ( UICC_STATUS_OK == aStatus )
+                    {
+                    // If we are reading first record,
+                    // iEnNumberArray must be reseted
+                    if ( 1 == iRecordNbr )
+                        {
+                        iEnNumberArray->ResetAndDestroy();
+                        }
+                    TENStoreResponse* enStoreEntry = NULL;
+                    TBuf8<( RMobileENStore::KEmergencyNumberSize )> numberBuf;
+                    TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+                    readIn.Copy( aFileData );
+
+                    GetEmergencyNumberDigits( readIn, numberBuf );
+
+                    if ( 0 < numberBuf.Length() )
+                        {
+                        enStoreEntry = new ( ELeave ) TENStoreResponse();
+                        // Copy the number
+                        enStoreEntry->iECCNumber.Copy( numberBuf );
+                        enStoreEntry->iLocation = ( TUint8 )iRecordNbr;
+                        iEnNumberArray->AppendL( enStoreEntry );
+                        }
+                    iRecordNbr++;
+                    if ( iRecordNbr <= iEntryCount )
+                        {
+                        ret = UiccReadEmergCodesReq(
+                            iRecordNbr,
+                            ETrIdEnStoreRead );
+                        }
+                    else
+                        {
+                        iEntryCount = 0;
+                        }
+                    }
+                else
+                    {
+                    iEntryCount = 0;
+                    iEnNumberArray->ResetAndDestroy();
+
+                    if( UICC_STATUS_NOT_READY == aStatus )
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                            KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                        }
+                    else
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                            KErrGsm0707NotFound );
+                        }
+                    }
+                }
+            else if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                if ( UICC_STATUS_OK == aStatus )
+                    {
+                    iEnNumberArray->ResetAndDestroy();
+
+                    TENStoreResponse* enStoreEntry = NULL;
+
+                    for( TInt index = 1;
+                         index <= ( aFileData.Length() / KEmergencyNbrLenInBytes );
+                         index++ )
+                        {
+                        TBuf8<( RMobileENStore::KEmergencyNumberSize )> numberBuf;
+                        TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+TFLOGSTRING3("TSY: CMmENStoreMessHandler::UiccReadEmergCodesResp. length:%d, index:%d", aFileData.Length(), index);
+OstTraceExt2( TRACE_NORMAL, DUP4_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESRESP, "CMmENStoreMessHandler::UiccReadEmergCodesResp;aFileData.Length()=%d;index=%d", aFileData.Length(), index );
+
+                        readIn.Copy(aFileData.Mid(
+                            ((index * KEmergencyNbrLenInBytes ) - 3),
+                            KEmergencyNbrLenInBytes));
+
+                        GetEmergencyNumberDigits( readIn, numberBuf );
+
+                        if ( 0 < numberBuf.Length() )
+                            {
+                            enStoreEntry = new ( ELeave ) TENStoreResponse();
+                            // Copy the number
+                            enStoreEntry->iECCNumber.Copy( numberBuf );
+                            enStoreEntry->iLocation = ( TUint8 ) index;
+                            iEnNumberArray->AppendL( enStoreEntry );
+                            }
+                        }
+                    }
+                else
+                    {
+                    iEntryCount = 0;
+
+                    if( UICC_STATUS_NOT_READY == aStatus )
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                            KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                        }
+                    else
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                            KErrGsm0707NotFound );
+                        }
+                    }
+                }
+            if ( iEntryCount == 0 )
+                {
+                // Complete response with the array of EN entries with ret
+                // Pack the data for sending to the manager
+                numberData.PackData( &iEnNumberArray );
+
+                // Complete request
+                iMessageRouter->Complete( iCurrentIpc, &numberData, ret );
+
+                // Reset current IPC.
+                iCurrentIpc = 0;
+                }
+            break;
+            }
+
+        // Read ECC from certain location
+        case EMmTsyENStoreReadIPC:
+            {
+            // Create TENStoreResponse structure
+            TENStoreResponse enStoreNumber;
+            if ( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                if ( 1 <= iReadECCLocation )
+                    {
+                    if ( UICC_STATUS_OK == aStatus )
+                        {
+                        TBuf8<( RMobileENStore::KEmergencyNumberSize )> numberBuf;
+                        // Read location
+                        enStoreNumber.iLocation = ( TUint8 )iReadECCLocation;
+
+                        TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+                        readIn.Copy( aFileData );
+
+                        GetEmergencyNumberDigits( readIn, numberBuf );
+                        enStoreNumber.iECCNumber.Copy( numberBuf );
+                        }
+                    else if( UICC_STATUS_NOT_READY == aStatus )
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                            KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                        }
+                    else
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                            KErrGsm0707NotFound );
+                        }
+                    }
+                else
+                    {
+                    // Location index is not valid. Complete request with error.
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::UiccReadEmergCodesResp\
+              - Invalid index: %d", iReadECCLocation);
+OstTrace1( TRACE_NORMAL, DUP1_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESRESP, "CMmENStoreMessHandler::UiccReadEmergCodesResp - Invalid index:;iReadECCLocation=%d", iReadECCLocation );
+
+                    ret = KErrArgument;
+                    }
+                }
+            else if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                // Check that location index is valid
+                if ( 1 <= iReadECCLocation
+                     && KEccStorageNumberMaxCount >= iReadECCLocation )
+                    {
+                    if ( UICC_STATUS_OK == aStatus )
+                        {
+                        TBuf8<( RMobileENStore::KEmergencyNumberSize )> numberBuf;
+                        // Read location
+                        enStoreNumber.iLocation = ( TUint8 )iReadECCLocation;
+
+                        TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+                        readIn.Copy(aFileData.Mid(
+                            ((iReadECCLocation * KEmergencyNbrLenInBytes) - 3),
+                            ((iReadECCLocation * KEmergencyNbrLenInBytes) - 1 )));
+
+                        GetEmergencyNumberDigits( readIn, numberBuf );
+                        enStoreNumber.iECCNumber.Copy( numberBuf );
+                        }
+                    else if( UICC_STATUS_NOT_READY == aStatus )
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                            KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                        }
+                    else
+                        {
+                        ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                            KErrGsm0707NotFound );
+                        }
+                    }
+                else
+                    {
+                    // Location index is not valid. Complete request with error.
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::UiccReadEmergCodesResp - Invalid index: %d", iReadECCLocation);
+OstTrace1( TRACE_NORMAL, CMMENSTOREMESSHANDLER_UICCREADEMERGCODESRESP, "CMmENStoreMessHandler::UiccReadEmergCodesResp - Invalid index:;iReadECCLocation=%d", iReadECCLocation );
+                    ret = KErrArgument;
+                    }
+                }
+            // Complete response with ret
+            // Pack the data for sending to the manager
+            numberData.PackData( &enStoreNumber );
+
+            // Complete failed request
+            iMessageRouter->Complete( iCurrentIpc, &numberData, ret );
+
+            // Reset current IPC.
+            iCurrentIpc = 0;
+            break;
+            }
+
+        // Read function for ECC info purposes
+        case EMmTsyENStoreGetInfoIPC:
+            {
+            if ( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                if ( UICC_STATUS_OK == aStatus )
+                    {
+                    TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+                    readIn.Copy(aFileData.Mid( 0, KEmergencyNbrLenInBytes ));
+
+                    TUint8 read_value = readIn[0] & KDigitMask;
+                    if( KDigitMask != read_value )
+                        {
+                        iUsedEntries++;
+                        }
+                    iRecordNbr++;
+                    if ( iRecordNbr <= iEntryCount )
+                        {
+                        ret = UiccReadEmergCodesReq(
+                            iRecordNbr,
+                            ETrIdEnStoreRead );
+                        }
+                    else
+                        {
+                        iEntryCount = 0;
+                        }
+                    }
+                else if( UICC_STATUS_NOT_READY == aStatus )
+                    {
+                    ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                        KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                    }
+                else
+                    {
+                    ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                        KErrGsm0707NotFound );
+                    }
+                }
+            else if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                iUsedEntries = 0;
+                if( UICC_STATUS_OK == aStatus )
+                    {
+                    for( TInt index = 1;
+                        index <= ( aFileData.Length() / KEmergencyNbrLenInBytes );
+                        index++ )
+                        {
+                        TBuf8< KEmergencyNbrLenInBytes > readIn;
+
+                        readIn.Copy(aFileData.Mid(
+                        ((index * KEmergencyNbrLenInBytes) - 3),
+                        KEmergencyNbrLenInBytes));
+
+                        TUint8 read_value = readIn[0] & KDigitMask;
+                        if( KDigitMask != read_value )
+                            {
+                            iUsedEntries++;
+                            }
+                        }
+                    iEntryCount = 0;
+                    if( 0 == iUsedEntries )
+                        {
+                        ret = KErrNotFound;
+                        }
+                    }
+                else if( UICC_STATUS_NOT_READY == aStatus )
+                    {
+                    ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                        KErrGsmMMServiceOptionTemporaryOutOfOrder );
+                    }
+                else
+                    {
+                    ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                        KErrGsm0707NotFound );
+                    }
+                }
+
+            if ( 0 == iEntryCount )
+                {
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::UiccReadEmergCodesResp. iUsedEntries:%d", iUsedEntries);
+OstTrace1( TRACE_NORMAL, DUP3_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESRESP, "CMmENStoreMessHandler::UiccReadEmergCodesResp;iUsedEntries=%d", iUsedEntries );
+
+                // Complete response with ret
+                // Pack the data for sending to the manager
+                numberData.PackData( &iUsedEntries );
+
+                iMessageRouter->Complete( iCurrentIpc, &numberData, ret );
+
+                // Reset current IPC.
+                iCurrentIpc = 0;
+                // Reset entry count.
+                iEntryCount = 0;
+                }
+            break;
+
+            }
+        }
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::GetEmergencyNumberDigits
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMmENStoreMessHandler::GetEmergencyNumberDigits(
+        const TDesC8& aReadIn,
+        TDes8& aNumberBuf)
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::GetEmergencyNumberDigits" );
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_GETEMERGENCYNUMBERDIGITS, "CMmENStoreMessHandler::GetEmergencyNumberDigits" );
+
+    TUint8 read_value = 0;
+    TBuf8<( RMobileENStore::KEmergencyNumberSize )> numberBuf;
+
+    for( TInt position = 0 ; position < KEmergencyNbrLenInBytes ; position++ )
+        {
+        read_value = aReadIn[position] & KDigitMask;
+        if( read_value != KDigitMask )
+            {
+            // Emergency number will be returned in ASCII
+            aNumberBuf.Append( read_value + '0' );
+
+            read_value = aReadIn[position] >> 4;
+            if( read_value != KDigitMask )
+                {
+                // Emergency number will be returned in ASCII
+                aNumberBuf.Append( read_value + '0' );
+                }
+            else
+                {
+                break;
+                }
+            }
+        else
+            {
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::UiccENStoreGetInfoResp
+// Handles received ISI message from UICC Server.
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::UiccENStoreGetInfoResp
+        (
+        TInt aStatus,
+        const TDesC8& aFileData
+        )
+    {
+TFLOGSTRING2("TSY:CMmENStoreMessHandler::UiccENStoreGetInfoResp, status: %d", aStatus );
+OstTrace1( TRACE_NORMAL, CMMENSTOREMESSHANDLER_UICCENSTOREGETINFORESP, "CMmENStoreMessHandler::UiccENStoreGetInfoResp;aStatus=%d", aStatus );
+
+    TInt ret( KErrNone );
+
+    // To be returned to ENStoreTsy, used entries
+    iUsedEntries = 0;
+    iRecordNbr = 1;
+
+    if ( UICC_STATUS_OK == aStatus )
+        {
+        TFci fci( aFileData );
+        iEntryCount = fci.GetNumberOfRecords();
+
+        ret = UiccReadEmergCodesReq( iRecordNbr, ETrIdEnStoreRead );
+        }
+    else
+        {
+        if( UICC_STATUS_NOT_READY == aStatus )
+            {
+            ret = CMmStaticUtility::EpocErrorCode( KErrNotReady,
+                KErrGsmMMServiceOptionTemporaryOutOfOrder );
+            }
+        else
+            {
+            ret = CMmStaticUtility::EpocErrorCode( KErrNotFound,
+                KErrGsm0707NotFound );
+            }
+        // Create data package
+        CMmDataPackage numberData;
+
+        iUsedEntries = 0;
+        // Complete response with ret
+        // Pack the data for sending to the manager
+        numberData.PackData( &iUsedEntries );
+
+        iMessageRouter->Complete( iCurrentIpc, &numberData, ret );
+
+        // Reset current IPC.
+        iCurrentIpc = 0;
+        // Reset entry count.
+        iEntryCount = 0;
+        }
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::SimReadEmergCodesReq
+// Constructs an ISI-message to read information from SIM
+// Create ECC number request message
+// Set servicetype
+// Set location, -1 used, when get info about used entries
+// Data buffer for service type
+// return call send message via phonet
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::UiccReadEmergCodesReq
+        (
+        TInt aIndex,     // Index of ECC
+        TUiccTrId aTraId
+        )
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::UiccReadEmergCodesReq");
+OstTrace0( TRACE_NORMAL, DUP1_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESREQ, "CMmENStoreMessHandler::UiccReadEmergCodesReq" );
+
+    TInt ret( KErrNone );
+
+    // Store location that is needed while reading single EN entry
+    //iReadECCLocation = aIndex;
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        TUiccReadLinearFixed cmdParams;
+
+        cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        cmdParams.trId = aTraId;
+        cmdParams.fileId = KElemEmergencyCallCodes;
+        cmdParams.fileIdSfi = UICC_ANY_SIZE;
+        cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+
+        // File id path
+        cmdParams.filePath.Append( KMasterFileId >> 8 );
+        cmdParams.filePath.Append( KMasterFileId );
+        cmdParams.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+        cmdParams.record = aIndex;
+        cmdParams.dataAmount = KEmergencyNbrLenInBytes;
+        cmdParams.dataOffset = 0;
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( cmdParams );
+        }
+    else if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
+        {
+
+        TUiccReadTransparent cmdParams;
+
+        cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        cmdParams.trId = aTraId;
+
+        cmdParams.dataAmount = 0;
+        cmdParams.dataOffset = 0;
+        cmdParams.fileId = KElemEmergencyCallCodes;
+        cmdParams.fileIdSfi = UICC_SFI_NOT_PRESENT;
+        cmdParams.serviceType = UICC_APPL_READ_TRANSPARENT;
+
+        // File id path
+        cmdParams.filePath.Append( KMasterFileId >> 8 );
+        cmdParams.filePath.Append( KMasterFileId );
+        cmdParams.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( cmdParams );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::SimReadEmergCodesReq: unknown card type.");
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_UICCREADEMERGCODESREQ, "CMmENStoreMessHandler::UiccReadEmergCodesReq - Unknown card type." );
+        ret = KErrGeneral;
+        }
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::UiccReadEmergCodesReq ret: %d", ret);
+OstTrace1( TRACE_NORMAL, DUP2_CMMENSTOREMESSHANDLER_UICCREADEMERGCODESREQ, "CMmENStoreMessHandler::UiccReadEmergCodesReq;ret=%d", ret );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::ReadEfEccFileInfo
+// Sends file info request for EFecc
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::ReadEfEccFileInfo( TUiccTrId aTraId )
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::ReadEfEccFileInfo");
+OstTrace0( TRACE_NORMAL, DUP3_CMMENSTOREMESSHANDLER_READEFECCFILEINFO, "CMmENStoreMessHandler::ReadEfEccFileInfo" );
+
+    TInt ret( KErrNone );
+
+    TUiccApplFileInfo params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.serviceType = UICC_APPL_FILE_INFO;
+    params.fileId = KElemEmergencyCallCodes;
+    params.fileIdSfi = 1;
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+    params.trId = aTraId;
+
+    ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::ReadEfEccFileInfo ret %d", ret);
+OstTrace1( TRACE_NORMAL, CMMENSTOREMESSHANDLER_READEFECCFILEINFO, "CMmENStoreMessHandler::ReadEfEccFileInfo;ret=%d", ret );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::ExtFuncL
+// -----------------------------------------------------------------------------
+//
+TInt CMmENStoreMessHandler::ExtFuncL
+        (
+        TInt aIpc,
+        const CMmDataPackage* aDataPackage
+        )
+    {
+TFLOGSTRING2("TSY: CMmENStoreMessHandler::ExtFuncL - Ipc: %d", aIpc);
+OstTrace1( TRACE_NORMAL, CMMENSTOREMESSHANDLER_EXTFUNCL, "CMmENStoreMessHandler::ExtFuncL;aIpc=%d", aIpc );
+
+    // Unpack parameters
+    TInt index( 0 );
+    TInt ret( KErrNone );
+    TUiccTrId traId( ETrIdNotDefined );
+    aDataPackage->UnPackData( index );
+
+    // Save IPC value. Will be used to complete the request appropriately
+    iCurrentIpc = aIpc;
+
+    switch ( aIpc )
+        {
+        case EMmTsyENStoreReadAllPhase1IPC:
+            {
+            if ( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                traId = ETrIdEnStoreGetInfo;
+                ret = ReadEfEccFileInfo( traId );
+                }
+            else if ( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                traId = ETrIdEnStoreRead;
+                ret = UiccReadEmergCodesReq( index, traId );
+                }
+            break;
+            }
+        case EMmTsyENStoreReadIPC:
+            {
+            traId = ETrIdEnStoreRead;
+            iReadECCLocation = index;
+            ret = UiccReadEmergCodesReq( index, traId );
+            break;
+            }
+        case EMmTsyENStoreGetInfoIPC:
+            {
+            traId = ETrIdEnStoreGetInfo;
+            if ( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                ret = ReadEfEccFileInfo( traId );
+                }
+            else if ( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                traId = ETrIdEnStoreRead;
+                ret = UiccReadEmergCodesReq( index, traId );
+                }
+            else
+                {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::ExtFuncL: unknown card type.");
+OstTrace0( TRACE_NORMAL, DUP1_CMMENSTOREMESSHANDLER_EXTFUNCL, "CMmENStoreMessHandler::ExtFuncL - unknown card type." );
+               ret = KErrGeneral;
+                }
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::SimReadEmergCodesRespL. Switch aIpc case default");
+OstTrace0( TRACE_NORMAL, DUP2_CMMENSTOREMESSHANDLER_EXTFUNCL, "CMmENStoreMessHandler::ExtFuncL - Switch aIpc case default" );
+           // Do nothing
+            break;
+            }
+        }
+
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmENStoreMessHandler::HandleError
+// Handles CMmENStoreMessHandler's errors that comes via PhoNetReceiver RunError
+// method.
+// -----------------------------------------------------------------------------
+//
+void CMmENStoreMessHandler::HandleError
+        (
+        const TIsiReceiveC& /*aIsiMessage*/,    // Isi message
+        TInt /*aError*/    // Error code
+        )
+    {
+TFLOGSTRING("TSY: CMmENStoreMessHandler::HandleError");
+OstTrace0( TRACE_NORMAL, CMMENSTOREMESSHANDLER_HANDLEERROR, "CMmENStoreMessHandler::HandleError" );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==================================
+    //None
+
+// End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,6 +30,7 @@
 #include "cmmphonemesshandler.h"
 #include "cmmsupplservmesshandler.h"
 #include "cmmphonebookstoremesshandler.h"
+#include "cmmenstoremesshandler.h"
 #include "cmmpacketservicemesshandler.h"
 #include "cmmpacketcontextmesshandler.h"
 #include "cmmpacketqosmesshandler.h"
@@ -50,9 +51,9 @@
 #include <pipe_sharedisi.h>
 #include <ctsy/rmmcustomapi.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmmessageroutertraces.h"
+#include "cmmmessagerouterTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -285,6 +286,10 @@
         this,
         iMmUiccMessHandler);
 
+    iMmENStoreMessHandler = CMmENStoreMessHandler::NewL(
+        this,
+        iMmUiccMessHandler);
+
     iMmPacketServiceMessHandler = CMmPacketServiceMessHandler::NewL(
         iPhoNetSender,
         iPhoNetReceiver,
@@ -390,6 +395,8 @@
             //CSD features
             case EEtelCallLoanDataPort:
             case EEtelCallRecoverDataPort:
+            // for call control purposes
+            case ESatNotifyCallControlRequest:
                 {
                 messHandler = iMmCallMessHandler;
                 break;
@@ -436,10 +443,19 @@
             case EMmTsyPhoneBookStoreInitIPC:
             case EMmTsyPhoneBookStoreCacheCancelIPC:
             case EMobilePhoneGetMailboxNumbers:
+            case EMmTsyONStoreReadIPC:
+            case EMmTsyONStoreReadEntryIPC:
                 {
                 messHandler = iMmPhoneBookStoreMessHandler;
                 break;
                 }
+            case EMmTsyENStoreReadAllPhase1IPC:
+            case EMmTsyENStoreReadIPC:
+            case EMmTsyENStoreGetInfoIPC:
+                {
+                messHandler = iMmENStoreMessHandler;
+                break;
+                }
             case EPacketAttach:
             case EPacketDetach:
             case EPacketGetNtwkRegStatus:
@@ -506,7 +522,7 @@
             case ECustomNotifyIccCallForwardingStatusChangeIPC:
             // Temporary until SAT: ETEL Multimode API
             // usage for SAT has been implemented
-            case ESatNotifyCallControlRequest:
+            case ESatNotifySendSsPCmd:
                 {
                 messHandler = iMmSupplServMessHandler;
                 break;
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -41,9 +41,9 @@
 //#include <permisi.h> To be done in CPS
 #include <uiccisi.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmnetmesshandlertraces.h"
+#include "cmmnetmesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -333,7 +333,9 @@
 TFLOGSTRING("TSY: CMmNetMessHandler::ConstructL()");
 OstTrace0( TRACE_NORMAL, CMMNETMESSHANDLER_CONSTRUCTL, "CMmNetMessHandler::ConstructL" );
 
-    iNetOperatorNameHandler = CMmNetOperatorNameHandler::NewL( this );
+    iNetOperatorNameHandler = CMmNetOperatorNameHandler::NewL(
+        this,
+        iMmUiccMessHandler );
 
     // Delay timer for completion of Packet transfer state
     iDelayTimer = CDelayTimer::NewL( this );
@@ -395,6 +397,7 @@
 TInt CMmNetMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY: CMmNetMessHandler::ProcessUiccMsg, transaction ID: %d, status: %d", aTraId, aStatus );
@@ -701,7 +704,7 @@
                             aIsiMessage );
                         }
                     break;
-                    }  
+                    }
                 default:
                     {
                     // No appropriate handler methods for ISI-message found.
@@ -3077,6 +3080,11 @@
     // Set iNetMessageHandlingOngoing flag to ETrue.
     iNetMessageHandlingOngoing = ETrue;
 
+    // Start Operator Name String (ONS Name) reading.
+    iNetOperatorNameHandler->UiccOperatorReq();
+
+    // Start Operator PLMN List (OPL) rules reading by reading the record count
+    iNetOperatorNameHandler->UiccReadOplRecordCount();
     }
 
 // ---------------------------------------------------------------------------
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetoperatornamehandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetoperatornamehandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -34,9 +34,9 @@
 #include <tisi.h>
 //#include <permisi.h> To be done in CPS
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmnetoperatornamehandlertraces.h"
+#include "cmmnetoperatornamehandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -150,7 +150,8 @@
 //
 CMmNetOperatorNameHandler* CMmNetOperatorNameHandler::NewL
         (
-        CMmNetMessHandler* aNetMessHandler // Pointer to the NetMessHandler.
+        CMmNetMessHandler* aNetMessHandler, // Pointer to the NetMessHandler.
+        CMmUiccMessHandler* aUiccMessHandler
         )
     {
 TFLOGSTRING("TSY: CMmNetOperatorNameHandler::NewL");
@@ -162,6 +163,7 @@
     CleanupStack::PushL( netOperatorNameHandler );
 
     netOperatorNameHandler->iNetMessHandler = aNetMessHandler;
+    netOperatorNameHandler->iMmUiccMessHandler = aUiccMessHandler;
     netOperatorNameHandler->ConstructL();
 
     CleanupStack::Pop( netOperatorNameHandler );
@@ -219,6 +221,8 @@
     iFromGetManualSearchOperatorName = EFalse;
 
     iManualSearchIndexValue = 0;
+    iOplRecordCount = 0;
+    iOplRecordNumber = 1; //Reading starts from record 1
 
     // Initialization of PP bit value, initialized to non used value.
 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
@@ -226,7 +230,7 @@
 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
     // TO BE DONE WITH INFO_PP_DATA_READ_RESP
     iInfoPpEonsFeatValue = INFO_PP_EONS_FEAT_0;
-    
+
     // Read INFO_PP_EONS_FEAT PP bit value.
     InfoPpReadReq();
 
@@ -663,12 +667,20 @@
                 // This flag is needed to handle correct IPC value.
                 iFromGetOperatorName = ETrue;
 
+                // This PNN record has not been read earlier.
+                SendReadPnnReq(
+                    tempMCC,
+                    tempMNC,
+                    tempPnnIdentifier,
+                    aLocationArea,
+                    aNetworkName );
+
                 // No need to check NITZ.
                 checkNitzName = EFalse;
 
                 // Set EFalse as completing will be done after
-                // SimOperatorRespReadPnn message is handled.
-                // completeNow = EFalse;
+                // UiccOperatorRespReadPnn message is handled.
+                completeNow = EFalse;
                 }
             }
         }
@@ -728,11 +740,19 @@
                     // This flag is needed to handle correct IPC value.
                     iFromGetOperatorName = ETrue;
 
+                    // This PNN record has not been read earlier.
+                    SendReadPnnReq(
+                        tempMCC,
+                        tempMNC,
+                        tempPnnIdentifier,
+                        aLocationArea,
+                        aNetworkName );
+
                     // No need to check NITZ.
                     checkNitzName = EFalse;
 
                     // Set EFalse as completing will be done after
-                    // SimOperatorRespReadPnn message is handled.
+                    // UiccOperatorRespReadPnn message is handled.
                     completeNow = EFalse;
                     }
                 }
@@ -1179,9 +1199,17 @@
                     // This flag is needed to handle correct IPC value.
                     iFromGetManualSearchOperatorName = ETrue;
 
+                    // This PNN record has not read been earlier.
+                    SendReadPnnReq(
+                        mcc,
+                        mnc,
+                        tempPnnIdentifier,
+                        locationArea,
+                        networkName );
+
                     // Set EFalse as completing will be done after
-                    // SimOperatorRespReadPnn message is handled.
-                    // completeNow = EFalse;
+                    // UiccOperatorRespReadPnn message is handled.
+                    completeNow = EFalse;
                     }
                 }
             // No else.
@@ -1238,9 +1266,17 @@
                         // This flag is needed to handle correct IPC value.
                         iFromGetManualSearchOperatorName = ETrue;
 
+                        // This PNN record has not been read earlier.
+                        SendReadPnnReq(
+                            mcc,
+                            mnc,
+                            tempPnnIdentifier,
+                            locationArea,
+                            networkName );
+
                         // Set EFalse as completing will be done after
-                        // SimOperatorRespReadPnn message is handled.
-                        // completeNow = EFalse;
+                        // UiccOperatorRespReadPnn message is handled.
+                        completeNow = EFalse;
                         }
                     }
                 // No else.
@@ -1394,7 +1430,7 @@
     {
     // Get status.
 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
-// TO BE DONE WITH INFO_PP_DATA_READ_RESP  
+// TO BE DONE WITH INFO_PP_DATA_READ_RESP
     TUint8 status( aIsiMessage.Get8bit(
         ISI_HEADER_SIZE + INFO_PP_READ_RESP_OFFSET_STATUS ) );
 
@@ -2134,7 +2170,7 @@
         iOplRuleMatch = EFalse;
         }
 TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - OPL Rule Match value T/F: %d", iOplRuleMatch);
-OstTraceExt1( TRACE_NORMAL, DUP5_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - OPL Rule Match value T/F=%hhu", iOplRuleMatch );
+OstTrace1( TRACE_NORMAL, DUP6_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker;iOplRuleMatch=%d", iOplRuleMatch );
     }
 
 // -----------------------------------------------------------------------------
@@ -2576,6 +2612,700 @@
     return iEonsName.iPNNIdentifier;
     }
 
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccReadOplRecordCount
+// Reads record count of EFopl
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccReadOplRecordCount()
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccReadOplRecordCount");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCREADOPLRECORDCOUNT, "CMmNetOperatorNameHandler::UiccReadOplRecordCount" );
+    // Initialize to default value
+    iOplListAvailable = EFalse;
+
+    TUint8 fileIdSfi( 0x1A ); // Default value for 3G
+    // Get card type to define SFI
+    TUint8 cardType( iMmUiccMessHandler->GetCardType() );
+    if ( UICC_CARD_TYPE_ICC == cardType )
+        {
+        fileIdSfi = UICC_SFI_NOT_PRESENT;
+        }
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccParamsBase params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdReadOplRecordCount;
+    params.fileId = KElemFileOpl;
+    params.fileIdSfi = fileIdSfi;
+    params.serviceType = UICC_APPL_FILE_INFO;
+
+    // File path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccOplRecordCountResponse
+// Response handling for record count of EFopl
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccOplRecordCountResponse(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOplRecordCountResponse");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCOPLRECORDCOUNTRESPONSE, "CMmNetOperatorNameHandler::UiccOplRecordCountResponse" );
+
+    TBool checkRefresh( ETrue );
+    if ( UICC_STATUS_OK == aStatus )
+        {
+        TFci fci( aFileData );
+        iOplRecordCount = fci.GetNumberOfRecords();
+
+        // If there is at least one record, start to read EFopl records
+        if ( 0 < iOplRecordCount )
+            {
+            // Reset array that it can be reused.
+            iOperatorPlmnListTable.Reset();
+            // Start reading from the first record
+            UiccReadOplReq();
+            // Don't check refresh yet because reading continues
+            checkRefresh = EFalse;
+            }
+        else
+            {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOplRecordCountResponse - No OPL records on (U)SIM");
+OstTrace0( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_UICCOPLRECORDCOUNTRESPONSE, "CMmNetOperatorNameHandler::UiccOplRecordCountResponse - No OPL records on (U)SIM" );
+            }
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOplRecordCountResponse - Reading of OPL record count failed");
+OstTrace0( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_UICCOPLRECORDCOUNTRESPONSE, "CMmNetOperatorNameHandler::UiccOplRecordCountResponse - Reading of OPL record count failed" );
+        }
+
+    // There was error reading OPL or record number was zero.
+    if ( checkRefresh )
+        {
+        // Complete refresh. Refresh status is checked in complete.
+        TBool retOplRefreshOngoing = iNetMessHandler->
+            GetMessageRouter()->
+            GetPhoneMessHandler()->
+            OplRulesCachingCompleted( KErrNotFound );
+
+        // If OPL request is done in boot phase we need handle possible
+        // queued Net messages. In refresh situation this is not
+        // allowed to call.
+        if ( !retOplRefreshOngoing )
+            {
+            // OPL Rules read in boot, start handle queued messsages.
+            iNetMessHandler->ContinueHandlingNetModemRegStatusMessages();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccReadOplReq
+// Request ro read a record of EFopl
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccReadOplReq()
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccReadOplResp");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCREADOPLREQ, "CMmNetOperatorNameHandler::UiccReadOplReq" );
+
+    TUint8 fileIdSfi( 0x1A ); // Default value for 3G
+    // Get card type to define SFI
+    TUint8 cardType( iMmUiccMessHandler->GetCardType() );
+    if ( UICC_CARD_TYPE_ICC == cardType )
+        {
+        fileIdSfi = UICC_SFI_NOT_PRESENT;
+        }
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdReadOplRecord;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = iOplRecordNumber;
+    params.fileId = KElemFileOpl;
+    params.fileIdSfi = fileIdSfi;
+    params.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+
+    // File path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccReadOplResp
+// Request ro read a record of EFopl
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccReadOplResp( const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccReadOplResp");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp" );
+    if ( 8 == aFileData.Length() )
+        {
+        // Temp data
+        TOperatorPLMNList tempOperatorPlmnList;
+
+        // See structure of EFopl from 3GPP TS 31.102 V8.3.0
+        // Chapter 4.2.59   EFOPL (Operator PLMN List)
+        // Get the operator code BCD string. Length is 3 bytes.
+        tempOperatorPlmnList.iOperCodeBCD = aFileData.Mid( 0, 3 );
+
+        // Get the lower limit of location area code.
+        tempOperatorPlmnList.iLACLowerLimit =
+            ( aFileData[3] << 8 ) | aFileData[4];
+
+        // Get the upper limit of location area code.
+        tempOperatorPlmnList.iLACUpperLimit =
+            ( aFileData[5] << 8 ) | aFileData[6];
+
+        // Get the PNN Identifier.
+        tempOperatorPlmnList.iPNNIdentifier = aFileData[7];
+
+        // Add operator PLMN list data to record list.
+        iOperatorPlmnListTable.Append( tempOperatorPlmnList );
+
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::SimOperatorRespReadOpl, OPL Record saved to OPL List index: %d", (iOplRecordNumber - 2 ) );
+TFLOGSTRING4("TSY: CMmNetOperatorNameHandler::SimOperatorRespReadOpl, Operator Code BCD string: %02X %02X %02X", tempOperatorPlmnList.iOperCodeBCD[0], tempOperatorPlmnList.iOperCodeBCD[1], tempOperatorPlmnList.iOperCodeBCD[2]);
+TFLOGSTRING3("TSY: CMmNetOperatorNameHandler::SimOperatorRespReadOpl, LAC between: %d - %d", tempOperatorPlmnList.iLACUpperLimit, tempOperatorPlmnList.iLACLowerLimit);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::SimOperatorRespReadOpl, PNN Identifier: %d", tempOperatorPlmnList.iPNNIdentifier);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp;iOplRecordNumber=%hhu", iOplRecordNumber );
+OstTraceExt3( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp;tempOperatorPlmnList.iOperCodeBCD[0]=%hhx;tempOperatorPlmnList.iOperCodeBCD[1]=%hhx;tempOperatorPlmnList.iOperCodeBCD[2]=%hhx", tempOperatorPlmnList.iOperCodeBCD[0], tempOperatorPlmnList.iOperCodeBCD[1], tempOperatorPlmnList.iOperCodeBCD[2] );
+OstTraceExt2( TRACE_NORMAL, DUP3_CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp;tempOperatorPlmnList.iLACUpperLimit=%u;tempOperatorPlmnList.iLACLowerLimit=%u", tempOperatorPlmnList.iLACUpperLimit, tempOperatorPlmnList.iLACLowerLimit );
+OstTraceExt1( TRACE_NORMAL, DUP4_CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp;tempOperatorPlmnList.iPNNIdentifier=%hhd", tempOperatorPlmnList.iPNNIdentifier );
+
+        // Clear buffer before next round
+        tempOperatorPlmnList.iOperCodeBCD.Zero();
+
+        // At least one record was saved successfully
+        iOplListAvailable = ETrue;
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccReadOplResp - Invalid data in OPL record");
+OstTrace0( TRACE_NORMAL, DUP5_CMMNETOPERATORNAMEHANDLER_UICCREADOPLRESP, "CMmNetOperatorNameHandler::UiccReadOplResp - Invalid data in OPL record" );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccOperatorReq
+// Read operator name from (U)SIM
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccOperatorReq()
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorReq" );
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCOPERATORREQ, "CMmNetOperatorNameHandler::UiccOperatorReq" );
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccReadTransparent params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdReadOperatorName;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.fileId = KElemFileOperatorName;
+    params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+    params.serviceType = UICC_APPL_READ_TRANSPARENT;
+
+    // File id path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccOperatorResp
+// Handle response for operator neme reading
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccOperatorResp(
+    TInt aStatus,
+    const TDesC8& aFileData
+    )
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorResp");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESP, "CMmNetOperatorNameHandler::UiccOperatorResp" );
+
+    if ( UICC_STATUS_OK == aStatus )
+        {
+        // Reset ONS name.
+        iOperatorNameString.Zero();
+
+        // Get length of operator name. Coded as SMS default 7-bit coded alphabet
+        // as defined in GSM 03.38 with bit 8 set to 0
+        TInt nameLength( aFileData.Length() );
+        if ( KOnsNameMaxLength < nameLength )
+            {
+            nameLength = KOnsNameMaxLength;
+            }
+
+        // Save operator name string to internal buffer as 16-bit
+        for ( TUint8 i( 0 ); i < nameLength; i++ )
+            {
+            iOperatorNameString.Append( static_cast<TUint16> ( aFileData[i] ) );
+            }
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorResp, ONS Name: %S", &iOperatorNameString);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESP, "CMmNetOperatorNameHandler::UiccOperatorResp;iOperatorNameString=%S", iOperatorNameString );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorResp - Error occured, data not available");
+OstTrace0( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESP, "CMmNetOperatorNameHandler::UiccOperatorResp- Error occured, data not available" );
+        // Data not available.
+        iOperatorNameString.Zero();
+        }
+
+    // Complete refresh.
+    // Refresh status is checked in complete.
+    iNetMessHandler->
+        GetMessageRouter()->
+        GetPhoneMessHandler()->
+        OnsNameCachingCompleted( aStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::ProcessUiccMsg
+// Handles data received from UICC server
+// -----------------------------------------------------------------------------
+//
+TInt CMmNetOperatorNameHandler::ProcessUiccMsg(
+    TInt aTraId,
+    TInt aStatus,
+    TUint8 /*aDetails*/,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING3("TSY:CMmNetOperatorNameHandler::ProcessUiccMsg, aTraId: %d, status: %d", aTraId, aStatus );
+OstTraceExt2( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_PROCESSUICCMSG, "CMmNetOperatorNameHandler::ProcessUiccMsg;aTraId=%d;aStatus=%d", aTraId, aStatus );
+
+    TInt ret( KErrNone );
+    TInt status( KErrNone );
+
+    switch ( aTraId )
+        {
+        case ETrIdReadOplRecordCount:
+            {
+            UiccOplRecordCountResponse( aStatus, aFileData );
+            break;
+            }
+        case ETrIdReadOplRecord:
+            {
+            // Decrease amount of records left and increase record number
+            // to be read next
+            iOplRecordCount--;
+            iOplRecordNumber++;
+
+            // OPL record was read successfully, handle response data
+            if ( UICC_STATUS_OK == aStatus )
+                {
+                UiccReadOplResp( aFileData );
+                }
+            else
+                {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::ProcessUiccMsg(ETrIdReadOplRecord) - Error occured when reading OPL record");
+OstTrace0( TRACE_NORMAL, DUP3_CMMNETOPERATORNAMEHANDLER_PROCESSUICCMSG, "CMmNetOperatorNameHandler::ProcessUiccMsg - - Error occured when reading OPL record" );
+                }
+
+            // There are still records left. Continue reading regardless of
+            // the previous read was failed or not
+            if ( 0 < iOplRecordCount)
+                {
+                UiccReadOplReq();
+                }
+            else // All records were read
+                {
+                iOplRulesRead = ETrue;
+                iOplRecordNumber = 1; // Default value
+
+                // None of the records was read successfully
+                if ( ! iOplListAvailable )
+                    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::ProcessUiccMsg(ETrIdReadOplRecord) - No OPL records available");
+OstTrace0( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_PROCESSUICCMSG, "CMmNetOperatorNameHandler::ProcessUiccMsg - No OPL records available" );
+                    // Reset array
+                    iOperatorPlmnListTable.Reset();
+                    status = KErrNotFound;
+                    }
+
+                // Complete refresh. Refresh status is checked in complete.
+                TBool retOplRefreshOngoing = iNetMessHandler->
+                    GetMessageRouter()->
+                    GetPhoneMessHandler()->
+                    OplRulesCachingCompleted( status );
+
+                // If OPL request is done in boot phase we need handle possible
+                // queued Net messages. In refresh situation this is not
+                // allowed to call.
+                if ( !retOplRefreshOngoing )
+                    {
+                    // OPL Rules read in boot, start handle queued messsages.
+                    iNetMessHandler->ContinueHandlingNetModemRegStatusMessages();
+                    }
+                }
+            break;
+            }
+        case ETrIdReadOperatorName:
+            {
+            UiccOperatorResp( aStatus, aFileData );
+            break;
+            }
+        case ETrIdReadPnn:
+            {
+            UiccOperatorRespReadPnnL( aStatus, aFileData );
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY:CMmNetOperatorNameHandler::ProcessUiccMsg - unknown transaction ID" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_PROCESSUICCMSG, "CMmNetOperatorNameHandler::ProcessUiccMsg - unknown transaction ID" );
+            break;
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::SendReadPnnReq
+//
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::SendReadPnnReq
+        (
+        TUint aMCC, // Mobile Country Code
+        TUint aMNC, // Mobile Network Code
+        TUint8 aPnnIdentifier, // PNN record identifier
+        const RMobilePhone::TMobilePhoneLocationAreaV1& aLocationAreaData, // LAC
+        const RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkData // Network data
+        )
+    {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::SendReadPnnReq");
+OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_SENDREADPNNREQ, "CMmNetOperatorNameHandler::SendReadPnnReq" );
+
+    // Store Country code and Network code.
+    iEonsName.iMCC = aMCC;
+    iEonsName.iMNC = aMNC;
+    // Store PNN record number.
+    iEonsName.iPNNIdentifier = aPnnIdentifier;
+
+    // Storing Location Area data for later use.
+    iLocationAreaData = aLocationAreaData;
+
+    // Storing Network data for later use.
+    iNetworkData = aNetworkData;
+
+    // Read PNN record from (U)SIM for getting EONS name
+    // for network.
+    UiccOperatorReqReadPnn( iEonsName.iPNNIdentifier );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccOperatorReqReadPnn
+// Creates UICC_APPL_CMD_REQ ISI message and sends it through phonet.
+// This request is used to read the PLMN Network Name from EFpnn on (U)SIM.
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccOperatorReqReadPnn( TUint8 aPnnIdentifier )
+    {
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorReqReadPnn, PNN Identifier: %d", aPnnIdentifier);
+OstTraceExt1( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCOPERATORREQREADPNN, "CMmNetOperatorNameHandler::UiccOperatorReqReadPnn;aPnnIdentifier=%hhu", aPnnIdentifier );
+
+    TUint8 fileIdSfi( 0x19 ); // Default value for 3G
+    // Get card type to define SFI
+    TUint8 cardType( iMmUiccMessHandler->GetCardType() );
+    if ( UICC_CARD_TYPE_ICC == cardType )
+        {
+        fileIdSfi = UICC_SFI_NOT_PRESENT;
+        }
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdReadPnn;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = aPnnIdentifier;
+    params.fileId = KElemFilePlmnNetworkName;
+    params.fileIdSfi = fileIdSfi;
+    params.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+
+    // File path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL
+// Handles the PLMN Network Name from EFpnn on (U)SIM.
+// -----------------------------------------------------------------------------
+//
+void CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Status value: %d", aStatus);
+OstTrace1( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_UICCOPERATORREQREADPNN, "CMmNetOperatorNameHandler::UiccOperatorReqReadPnn;aStatus=%d", aStatus );
+
+    // Is there PNN record available. Value initialize to EFalse.
+    TBool pnnRecordAvailable( EFalse );
+
+    // Get length of the record.
+    TInt dataLength( aFileData.Length() );
+
+    // See structure of EF 6FC5 from 3GPP TS 31.102 V8.3.0 Chapter 4.2.58.
+    if ( UICC_STATUS_OK == aStatus && dataLength > 2 && aFileData[0] == 0x43 )
+        {
+        // Reset EONS names.
+        iEonsName.iLongName.Zero();
+        iEonsName.iShortName.Zero();
+
+        // Temporary buffer for full EONS name. Full name is mandatory.
+        TBuf<KMaxLengthOfOperatorName> longEonsName;
+        // Get the length of full EONS name
+        TUint8 lengthOfFullName( aFileData[1] );
+        // Get full EONS name from the record. Name string starts from index 2
+        TPtrC8 eonsFullNameData( aFileData.Mid( 2, lengthOfFullName ) );
+        // Convert EONS data field to EONS operator name.
+        ConvertOperatorName(
+            ENetEonsName,
+            iEonsName.iMCC,
+            eonsFullNameData,
+            longEonsName );
+        // Store EONS long name.
+        iEonsName.iLongName.Copy( longEonsName.Left(
+            iEonsName.iLongName.MaxLength() ) );
+        // Check if long name was read succesfully.
+        if ( 0 < iEonsName.iLongName.Length() )
+            {
+            // PNN record read successfully.
+            pnnRecordAvailable = ETrue;
+            }
+
+        // Short name is optional. If it exists file data length is more
+        // than full name bytes
+        TUint8 fullNameBytes( lengthOfFullName + 2 );
+        if ( dataLength > fullNameBytes && aFileData[fullNameBytes] == 0x45 )
+            {
+            // Temporary buffer for short EONS name.
+            TBuf<KMaxLengthOfOperatorName> shortEonsName;
+            // Get length of short EONS name.
+            TUint8 lengthOfShortName( aFileData[fullNameBytes + 1] );
+            // Get EONS short name string from the record.
+            TPtrC8 eonsShortNameData(
+                aFileData.Mid( fullNameBytes + 2, lengthOfShortName ) );
+            // Convert EONS data field to EONS operator name.
+            ConvertOperatorName(
+                ENetEonsName,
+                iEonsName.iMCC,
+                eonsShortNameData,
+                shortEonsName );
+            // Store EONS Short name.
+            iEonsName.iShortName.Copy( shortEonsName.Left(
+                iEonsName.iShortName.MaxLength() ) );
+            }
+
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iEonsName.iMCC: %d", iEonsName.iMCC);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iEonsName.iMNC: %d", iEonsName.iMNC);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iEonsName.iLongName: %S", &iEonsName.iLongName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iEonsName.iShortName: %S", &iEonsName.iShortName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iEonsName.iPNNIdentifier: %d", iEonsName.iPNNIdentifier);
+OstTrace1( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iMCC=%u", iEonsName.iMCC );
+OstTrace1( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iMNC=%u", iEonsName.iMNC );
+OstTraceExt1( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iLongName=%S", iEonsName.iLongName );
+OstTraceExt1( TRACE_NORMAL, DUP3_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iShortName=%S", iEonsName.iShortName );
+OstTraceExt1( TRACE_NORMAL, DUP4_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iPNNIdentifier=%hhu", iEonsName.iPNNIdentifier );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Error occured, data not available");
+OstTrace0( TRACE_NORMAL, DUP5_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- Error occured, data not available" );
+
+        // Data not available. Cause may be that file does not exist
+        // on (U)SIM card, or requested record does not exist in file.
+        // Reset EONS names.
+        iEonsName.iLongName.Zero();
+        iEonsName.iShortName.Zero();
+        }
+
+    // This completes NetModemRegStatusInd method IPC
+    // EMobilePhoneNotifyCurrentNetworkChange value with EONS name.
+    if ( iFromGetOperatorName )
+        {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, continue to complete NotifyCurrentNetworkChange");
+OstTrace0( TRACE_NORMAL, DUP6_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnLcontinue to complete NotifyCurrentNetworkChange" );
+
+        // Set flag back to EFalse.
+        iFromGetOperatorName = EFalse;
+
+        // If the EONS long or/and short names doesn't exist
+        // then NITZ long or/and short names will be added if
+        // NITZ data match current network.
+        // Otherwise long and short names will be left empty as
+        // there are no names for them. Only hard coded name
+        // will be sent (iDisplayTag).
+
+        // Is PNN record available.
+        if ( pnnRecordAvailable )
+            {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - EONS name available");
+OstTrace0( TRACE_NORMAL, DUP7_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- EONS name available" );
+            // EONS names found.
+            CopyEonsName( iNetworkData );
+            }
+        else
+            {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - EONS name not available, NITZ name will checked");
+OstTrace0( TRACE_NORMAL, DUP8_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- EONS name not available, NITZ name will checked" );
+
+            // Need to check NITZ name as EONS name not available.
+
+            // Initialize.
+            TUint tempMCC( 0 ); // Country Code.
+            TUint tempMNC( 0 ); // Network Code.
+            // Convert descriptor contained number to integer.
+            CMmStaticUtility::GetIntFromDescriptor(
+                tempMCC,
+                iNetworkData.iCountryCode );
+            CMmStaticUtility::GetIntFromDescriptor(
+                tempMNC,
+                iNetworkData.iNetworkId );
+
+            // Check if NITZ long/short name exist and will match for
+            // current Country and Network codes.
+            NitzNameChecker( tempMCC, tempMNC, iNetworkData );
+            }
+
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Completing");
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, Operator display tag: %S", &iNetworkData.iDisplayTag);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, Operator long name: %S", &iNetworkData.iLongName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, Operator short name: %S", &iNetworkData.iShortName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, RMmCustomAPI::TOperatorNameInfo, Name: %S", &iOperNameInfo.iName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, RMmCustomAPI::TOperatorNameInfo, Type: %d", iOperNameInfo.iType);
+OstTrace0( TRACE_NORMAL, DUP9_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Completing" );
+OstTraceExt1( TRACE_NORMAL, DUP10_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iNetworkData.iDisplayTag=%S", iNetworkData.iDisplayTag );
+OstTraceExt1( TRACE_NORMAL, DUP11_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iNetworkData.iLongName=%S", iNetworkData.iLongName );
+OstTraceExt1( TRACE_NORMAL, DUP12_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iNetworkData.iShortName=%S", iNetworkData.iShortName );
+OstTraceExt1( TRACE_NORMAL, DUP13_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iOperNameInfo.iName=%S", iOperNameInfo.iName );
+OstTrace1( TRACE_NORMAL, DUP14_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iOperNameInfo.iType=%d", iOperNameInfo.iType );
+
+        // Complete ECustomGetOperatorNameIPC.
+        // Packed parameter: a RMmCustomAPI::TOperatorNameInfo.
+        CMmDataPackage dataPackage;
+        dataPackage.PackData( &iOperNameInfo );
+
+        iNetMessHandler->GetMessageRouter()->Complete(
+            ECustomGetOperatorNameIPC,
+            &dataPackage,
+            KErrNone );
+
+        // Complete EMobilePhoneNotifyCurrentNetworkChange with
+        // operator names.
+        iNetMessHandler->CompleteMobilePhoneNotifyCurrentNetworkChange(
+            iLocationAreaData,
+            iNetworkData );
+
+        // Reset operator name info data as these are completed.
+        iOperNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
+        iOperNameInfo.iName.Zero();
+        }
+
+    // Add EONS names to correct index and then continue
+    // handling of manual network search list.
+    if ( iFromGetManualSearchOperatorName )
+        {
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL, continue handling Manual Network search - Index value: %d", iManualSearchIndexValue);
+OstTraceExt1( TRACE_NORMAL, DUP15_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iManualSearchIndexValue=%hhu", iManualSearchIndexValue );
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator display tag: %S", &iNetworkData.iDisplayTag);
+OstTraceExt1( TRACE_NORMAL, DUP16_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator display tag;iNetworkData.iDisplayTag=%S", iNetworkData.iDisplayTag );
+
+        // Set flag back to EFalse.
+        iFromGetManualSearchOperatorName = EFalse;
+
+        // Is PNN record available.
+        if ( pnnRecordAvailable )
+            {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Manual search - EONS name available");
+OstTrace0( TRACE_NORMAL, DUP17_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- Manual search - EONS name available" );
+
+            // Check is EONS Long name exist.
+            // If no Long EONS name there is no short EONS name either.
+            if ( 0 < iEonsName.iLongName.Length() )
+                {
+                // Copy EONS Long name to correct index.
+                iManualSearchNetworkList[iManualSearchIndexValue].iLongName.Copy(
+                    iEonsName.iLongName );
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator long name: %S", &iEonsName.iLongName);
+OstTraceExt1( TRACE_NORMAL, DUP18_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- Operator long name;iEonsName.iLongName=%S", iEonsName.iLongName );
+
+
+                // Check is EONS Short name exist.
+                if ( 0 < iEonsName.iShortName.Length() )
+                    {
+                    // Copy EONS Short name to correct index.
+                    iManualSearchNetworkList[iManualSearchIndexValue].iShortName.Copy(
+                        iEonsName.iShortName );
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator short name: %S", &iEonsName.iShortName);
+OstTraceExt1( TRACE_NORMAL, DUP19_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iEonsName.iShortName=%S", iEonsName.iShortName );
+                    }
+                }
+            }
+        else
+            {
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Manual search, No EONS name available, DisplayTag name added to Long and Short names");
+OstTrace0( TRACE_NORMAL, DUP20_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL- Manual search, No EONS name available, DisplayTag name added to Long and Short names" );
+
+            // If no EONS name, copy DisplayTag to long and short name
+            // buffers.
+            iNetworkData.iLongName.Copy(
+                iNetworkData.iDisplayTag.Left(
+                iNetworkData.iLongName.MaxLength() ) );
+            iNetworkData.iShortName.Copy(
+                iNetworkData.iDisplayTag.Left(
+                iNetworkData.iShortName.MaxLength() ) );
+
+            iManualSearchNetworkList[iManualSearchIndexValue].iLongName.Copy(
+                iNetworkData.iLongName );
+            iManualSearchNetworkList[iManualSearchIndexValue].iShortName.Copy(
+                iNetworkData.iShortName );
+
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator long name: %S", &iNetworkData.iLongName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - Operator short name: %S", &iNetworkData.iShortName);
+OstTraceExt1( TRACE_NORMAL, DUP21_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iNetworkData.iLongName=%S", iNetworkData.iLongName );
+OstTraceExt1( TRACE_NORMAL, DUP22_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iNetworkData.iLongName=%S", iNetworkData.iLongName );
+            }
+
+        // Update index value.
+        iManualSearchIndexValue++;
+
+        // Continue handling of Manual network search list.
+        GetManualSearchOperatorNameL();
+        }
+
+    // Complete refresh.
+    // Refresh status is checked in complete.
+    iNetMessHandler->
+        GetMessageRouter()->
+        GetPhoneMessHandler()->
+        PnnRecordCachingCompleted( aStatus );
+    }
+
+
 // ========================== OTHER EXPORTED FUNCTIONS =========================
     //None
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketcontextmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketcontextmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -43,9 +43,9 @@
 #if (NCP_COMMON_S60_VERSION_SUPPORT==S60_VERSION_32)
 #include <cmmcommonstaticutility.h>
 #endif // (NCP_COMMON_S60_VERSION_SUPPORT==S60_VERSION_32)
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmpacketcontextmesshandlertraces.h"
+#include "cmmpacketcontextmesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketmesshandlercontextlist.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketmesshandlercontextlist.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,9 +23,9 @@
 #include "cmmpacketservicemesshandler.h"
 #include <gpdsisi.h>
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmpacketmesshandlercontextlisttraces.h"
+#include "cmmpacketmesshandlercontextlistTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketqosmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketqosmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -33,9 +33,9 @@
 
 #include <gpds_sharedisi.h>
 #include <ctsy/pluginapi/cmmdatapackage.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmpacketqosmesshandlertraces.h"
+#include "cmmpacketqosmesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketservicemesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketservicemesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -32,9 +32,9 @@
 #include <gpds_sharedisi.h>
 #include <ctsy/serviceapi/gsmerror.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmpacketservicemesshandlertraces.h"
+#include "cmmpacketservicemesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,601 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <etelmm.h>
+#include <tisi.h>
+#include <pn_const.h>
+#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
+#include "cmmmessagerouter.h"
+#include "cmmphonebookoperationcache.h"
+#include "osttracedefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmmphonebookoperationcachetraces.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+    // None
+
+// EXTERNAL FUNCTION PROTOTYPES
+    // None
+
+// CONSTANTS
+
+// MACROS
+    // None
+
+// LOCAL CONSTANTS AND MACROS
+    // None
+
+// MODULE DATA STRUCTURES
+    // None
+
+// LOCAL FUNCTION PROTOTYPES
+    // None
+
+// ==================== LOCAL FUNCTIONS =====================================
+    // None
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::CMmPhoneBookOperationCache
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMmPhoneBookOperationCache::CMmPhoneBookOperationCache
+    (
+    // None
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CMmPhoneBookOperationCache");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CMMPHONEBOOKOPERATIONCACHE, "CMmPhoneBookOperationCache::CMmPhoneBookOperationCache" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache
+// C++ destructor.
+// -----------------------------------------------------------------------------
+//
+CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache
+    (
+    // None
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_CMMPHONEBOOKOPERATIONCACHE, "CMmPhoneBookOperationCache::~CMmPhoneBookOperationCache" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::NewL
+// Two-phased constructor.
+// Creates a new CmmPhonebookOperatorInit object instance.
+// -----------------------------------------------------------------------------
+//
+CMmPhoneBookOperationCache* CMmPhoneBookOperationCache::NewL
+    (
+    CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+    CMmUiccMessHandler* /*aUiccMessHandler*/,
+    TInt /*aIpc*/,
+    const CMmDataPackage* aDataPackage // Data
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::NewL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_NEWL, "CMmPhoneBookOperationCache::NewL" );
+
+    TName phonebookTypeName ;
+
+    CMmPhoneBookOperationCache* mmPhoneBookOperationCache =
+            new( ELeave ) CMmPhoneBookOperationCache();
+
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+    phoneBookData->GetPhoneBookName( phonebookTypeName );
+
+    mmPhoneBookOperationCache->iPhoneBookTypeName = phonebookTypeName;
+
+    mmPhoneBookOperationCache->iMmPhoneBookStoreMessHandler =
+        aMmPhoneBookStoreMessHandler;
+
+    return mmPhoneBookOperationCache;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::UiccCreateReq
+// Separate request
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationCache::UICCCreateReq
+    (
+    TInt aIpc,
+    const CMmDataPackage* aDataPackage,
+    TUint8 aTransId
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CreateReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CREATEREQ, "CMmPhoneBookOperationCache::CreateReq" );
+
+    TInt ret( KErrNotSupported );
+
+    switch( aIpc )
+        {
+        case EMmTsyPhoneBookStoreGetInfoIPC:
+            {
+            iNumOfUsedSDNEntries = 0;
+            iNumOfUsedVMBXEntries = 0;
+            break;
+            }
+        case EMmTsyPhoneBookStoreCacheIPC:
+            {
+            const CPhoneBookDataPackage* phoneBookData(
+                static_cast<const CPhoneBookDataPackage*>( aDataPackage ) );
+
+            CArrayPtrSeg<CPhoneBookStoreEntry>* prtToCacheArray;
+            phoneBookData->UnPackData( prtToCacheArray );
+
+            if ( prtToCacheArray )
+                {
+                iPhoneBookStoreCacheArray = prtToCacheArray;
+                ret = KErrNone;
+                iIndexToRead = 1 ; // Strat from 1st Record to read
+                // Start Reading records from 1st record
+                ret = USimPbReqRead( iIndexToRead, aTransId );
+                }
+            else
+                {
+                ret = KErrArgument;
+                }
+
+            break;
+            }
+        default:
+            {
+            // Nothing to do here
+TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::CreateReq - Unknown IPC: %d", aIpc);
+OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_UICCCREATEREQ, "CMmPhoneBookOperationCache::UiccCreateReq; Unknown IPC =%hd", aIpc );
+            break;
+            }
+        }//switch-case
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::HandleUICCPbRespL
+// Handle response
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationCache::HandleUICCPbRespL (
+      TInt aStatus,
+      TUint8 /*aDetails*/,
+      const TDesC8 &aFileData,
+      TInt aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL,"CMmPhoneBookOperationCache::HandleUICCPbRespL" );
+
+    TInt ret( KErrNone );
+    TInt retExt( KErrNone );
+    TBool complete ( EFalse );
+
+// IF UICC Serever response is not OK
+    if ( ( UICC_STATUS_OK != aStatus ) && ( !iExtensionToRead) )
+        {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleSimPbResp:Unsuccessfully completed by UICC");
+OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL - Unsuceesfully completed by UICC" );
+
+        ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
+        }
+
+
+    if( !iCancelOperation )
+        {
+        // Convert Phone Book name to file id
+        TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
+        TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+        TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
+        
+        switch(pbFileId)
+            {
+            case PB_ADN_FID:
+            case PB_FDN_FID:
+            case PB_SDN_FID:
+                {
+                // Start Caching for ADN Phone Book
+                if(!iExtensionToRead)
+                    {
+                    // Check for UICC_SERVER_OK 
+                    if( UICC_STATUS_OK == aStatus)
+                        {
+                        iStoreEntry = new ( ELeave ) TPBEntry();
+                        // update Entry Data
+                        iStoreEntry->iEntryIndex = iIndexToRead;
+
+                        // check if Entry is valid Entry or Empty Entry
+                        TInt retval = EmptyEntryCheck(aFileData);
+                        
+                        // if Entry is not empty
+                        if( KErrNone == retval)
+                            {
+                            // Update Entry Status 
+                            iStoreEntry->iEntryPresent = ETrue;
+                            // Seperate Entry data form UICC Server response message
+                            // Case: <Data available to be filled into array>
+                            iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].
+                            GetPBEntryFromUICCData( 
+                                aFileData,
+                                iNumberBuf,
+                                iNameBuf);
+                                
+                            // Check for Is there any extension data
+                            // And the Extension data record number is valid
+                            // Index to read Extension file Data is Alpha string
+                            // Length + 14 , minus 1 is for Array index Calculation 
+                            //(it starts from 0)
+                            if ( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
+                                         iPBStoreConf[EPhonebookTypeAdn].
+                                         iAlphaStringlength + 13]  )
+                                {
+                                // Append Entry to list
+                                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                              iStoreEntry,
+                                              pbArrayIndex );
+
+                                // the there is no extension data
+                                CPhoneBookStoreEntry* phoneBookStoreMsg =
+                                new( ELeave ) CPhoneBookStoreEntry;
+                                CleanupStack::PushL( phoneBookStoreMsg );
+                                phoneBookStoreMsg->ConstructL();
+                                
+                                iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                                    iNameBuf,
+                                    iNumberBuf,
+                                    *phoneBookStoreMsg,
+                                    pbFileId,
+                                    iIndexToRead,
+                                    EFalse );
+                                TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+                                iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
+                                CleanupStack::Pop( phoneBookStoreMsg );
+                                iNumOfEntriesFilled++;
+TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL - Append entries into array %d",iNumOfEntriesFilled);
+OstTraceExt1( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL;iNumOfEntriesFilled=%hd", iNumOfEntriesFilled );
+                                
+                                } // End of if Ext Data is not Present
+                            else
+                                {
+                                iExtensionToRead = ETrue;
+                                // Record no to be read from EXT File
+                                TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler->
+                                               iPBStoreConf[EPhonebookTypeAdn].
+                                               iAlphaStringlength + 13];
+                                
+                                // Append EXT record no.
+                                iStoreEntry->PBEntryExtRecord.Append( recordNo );
+
+                                retExt = USimPbReqRead( recordNo, aTransId );
+                                // if while reading EXT error comes 
+                                //(for invalid Entry)than read next entry
+                                if(( KErrNone != retExt ))
+                                    {
+                                    iExtensionToRead = EFalse;
+                                    }
+                                } // End for EXT File data present
+                            } // end for case when entry is not empty
+                        else
+                            {
+                            //Update Entry Status
+                            iStoreEntry->iEntryPresent = EFalse;
+                            // Reset Entry andd Append to the List 
+                            iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                 iStoreEntry,
+                                 pbArrayIndex );
+                            }
+
+                        // to read next record
+                        iIndexToRead++;
+
+                        } // end of check for UICC status
+                    } // End of without EXT File Data Case
+                else  // Handling for Extension Numbers
+                    {
+                    if( UICC_STATUS_OK == aStatus )
+                        {
+                        // Check for next extension data record
+                        if(0xFF != aFileData[UICC_EXT_REC_NO_OFFSET])    
+                            {
+                            // Again Append the EXT no to Array
+                            iStoreEntry->PBEntryExtRecord.Append(
+                                  aFileData[UICC_EXT_REC_NO_OFFSET] );
+
+                            // Store Number upto last byte
+                            iNumberBuf.Append(aFileData.Mid(1,UICC_EF_EXT_REC_NUM_LEN ));
+                            // Again Send request to read next record number 
+                            //and append it in number 
+                            retExt = USimPbReqRead( 
+                                aFileData[UICC_EXT_REC_NO_OFFSET], aTransId );
+                            if( KErrNone != retExt)
+                                {
+                                iExtensionToRead = EFalse;
+                                }
+                            }  // end for checking next record number in EXT
+                        else
+                            {
+                            // Append Entry to list and reset all the EXT data
+                            iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                                          iStoreEntry,
+                                                          pbArrayIndex );
+                            // Reset Extension File record
+                            iExtensionToRead = EFalse;
+                            
+                            // Check for Extended Data is Addition number 
+                            if( 0x02 == aFileData[0])
+                                {
+                                // Check for length upto which no is stored
+                                TInt offset = aFileData.Find(&KTagUnusedbyte,1);
+                                // store Data
+                                iNumberBuf.Append(aFileData.Mid(1,( offset - 1 )));
+                                
+                                // the there is extension data
+                                CPhoneBookStoreEntry* phoneBookStoreMsg =
+                                new( ELeave ) CPhoneBookStoreEntry;
+                                CleanupStack::PushL( phoneBookStoreMsg );
+                                phoneBookStoreMsg->ConstructL();
+                                
+                                iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                                                              iNameBuf,
+                                                              iNumberBuf,
+                                                              *phoneBookStoreMsg,
+                                                              pbFileId,
+                                                              iIndexToRead,
+                                                              EFalse );
+                                TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+                                iPhoneBookStoreCacheArray->AppendL( 
+                                                           phoneBookStoreMsg );
+                                CleanupStack::Pop( phoneBookStoreMsg );
+                                iNumOfEntriesFilled++;
+TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUSimPbRespL - Append entries into array %d",iNumOfEntriesFilled);
+OstTraceExt1( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL;iNumOfEntriesFilled=%hd", iNumOfEntriesFilled );
+                                } // end for checking Data type in EXT
+                            } // end for Entry store
+                        }
+                    else
+                        {
+                        // To read next Entry
+                        iExtensionToRead = EFalse;
+                        }
+                    } // end for EXT file handling
+                break;
+                } // end for ADN phone book cache
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL. PhoneBook operation not supported ");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL. PhoneBook Operation not supported" );
+                break;
+                }
+            } // End of switch case
+        
+        // Check for next location be read when its not for EXT Data
+        
+        if( ( !iExtensionToRead ) &&( iIndexToRead <= 
+              iMmPhoneBookStoreMessHandler->iPBStoreConf[pbArrayIndex].iNoOfRecords ) )
+            {
+            // Send request to read next Entry
+            USimPbReqRead( iIndexToRead, aTransId );
+            }
+
+        // Complete IPC if error is there OR all Entries are read
+        if( ((KErrNone != ret) || 
+             ( iIndexToRead > iMmPhoneBookStoreMessHandler->
+                              iPBStoreConf[pbArrayIndex].iNoOfRecords )) 
+             && ( !iExtensionToRead ))
+            {
+            // Check if any entries are filled in commonTSY Array
+            if( 0 == iNumOfEntriesFilled )
+                {
+                ret = KErrNotFound;
+                }
+            // Complete
+            CPhoneBookDataPackage phoneBookData;
+            phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+
+            iPhoneBookStoreCacheArray = NULL;
+
+            iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                EMmTsyPhoneBookStoreCacheIPC,
+                &phoneBookData,
+                ret );
+            // Set flag to indicate that we can remove this operation from array
+            complete = ETrue;
+            }
+        }
+    else
+        { // Operation has been canceled
+        complete = ETrue;
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL; operation was canceled");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL; operation was canceled" );
+        }
+    return complete;
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::USimPbReqRead
+// Constructs Data to read entry from SIM
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationCache::USimPbReqRead
+    (
+    TInt aRecordNo,
+    TUint8 aTransId
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead" );
+
+
+    TInt ret( KErrNone );
+    TInt appFileID ( APPL_FILE_ID );   // Application File id for DFphonebook
+    // get the index to be read from phonebook
+    TInt index( iIndexToRead );
+
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( appFileID>>8);
+    cmdParams.filePath.Append( appFileID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    // Convert Phone Book name to file id
+    TUint16 fileIdExt ( 0x0000 );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    
+    // get the corect Location to be read from phone book
+    if( PB_MBDN_FID == pbFileId)
+        {
+        // Index to be read contains two types of information.
+        // The least significant byte contains the profile number
+        // and the most significant byte contains the type.
+        index = index || 0x0100; // Only subscriber profile number 1 is supported
+        }
+
+        switch( pbFileId )
+            {
+            case PB_ADN_FID:
+                {
+                // For 2G ADN Phonebook EXT1 will be the extension number store
+                cmdParams.trId = static_cast<TUiccTrId> ( aTransId );
+                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                cmdParams.record = aRecordNo;
+                
+                // Check for Extension Data is Present or not
+                if(!iExtensionToRead)
+                    {
+                    // Check for the record Number to be 
+                    //read is valid record number
+                    if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                                   iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords)
+                        {
+                        // Start from first location and Search for First Valid 
+                        //Entry in the Stored List And if some Entry is invalid
+                        // then Read From Sim and Check the Staus its Free 
+                        // or not till end of the records
+                        
+                        cmdParams.fileId = PB_ADN_FID;
+                        cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                        cmdParams.record = aRecordNo;
+                        // till End of Record
+                        cmdParams.dataAmount = 0;
+                        // Start from begining of record
+                        cmdParams.dataOffset = 0;
+                        }
+                    else
+                        {
+                        ret = KErrNotFound;
+                        }
+                    } // end of if case for checking extension data
+                else
+                    {
+                    // Send Request to Read Extension Data
+                    // Check for UST Table supports for EXT File
+                    if( iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iExtension )
+                        {
+                        // Check for Extension data record in valid
+                        if(iMmPhoneBookStoreMessHandler->
+                           iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec > aRecordNo)
+                            {
+                            // Read Request to read that index
+                            cmdParams.fileId = PB_EXT1_FID;
+                            cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                            cmdParams.record = aRecordNo;
+                            // till End of Record
+                            cmdParams.dataAmount = 0;
+                            // Start from begining of record
+                            cmdParams.dataOffset = 0;
+                            }
+                        else
+                            {
+                            ret = KErrGeneral;
+                            }
+                        }
+                    else
+                        {
+                        ret = KErrGeneral;
+                        }
+                    }
+                break;
+                }
+            case PB_FDN_FID:
+                {
+                // For FDN Phonebook EXT2 will be the extension number store
+                cmdParams.trId = ETrIdPbReadFdn;
+                cmdParams.fileId = PB_EXT2_FID;
+
+                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                cmdParams.record = aRecordNo;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead - PhoenBook Not supported");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead - PhoneBook not supported" );
+                break;
+                }
+            }
+        
+
+        if( KErrNone == ret )
+            {
+            ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+                CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead;ret=%hd", ret );
+            }
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::CancelReq
+// Cancels cacheing request
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationCache::CancelReq( TName& aPhoneBook )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CancelReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CANCELREQ, "CMmPhoneBookOperationCache::CancelReq" );
+    if( iPhoneBookTypeName == aPhoneBook )
+        {
+        iPhoneBookStoreCacheArray = NULL;
+        iCancelOperation = ETrue;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,833 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   ?Description
+*
+*/
+
+//  INCLUDE FILES
+#include <etelmm.h>
+#include <tisi.h>
+#include <pn_const.h>
+#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
+#include "tsylogger.h"
+#include "cmmmessagerouter.h"
+#include "cmmphonebookoperationdelete.h"
+#include "osttracedefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmmphonebookoperationdeletetraces.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+    // None
+
+// EXTERNAL FUNCTION PROTOTYPES
+    // None
+
+// CONSTANTS
+
+
+// MACROS
+    // None
+
+// LOCAL CONSTANTS AND MACROS
+const TUint8 KExtensionDataBytes( 13 );
+const TUint8 KEfAdnDataBytes( 14 );
+const TUint8 KMaxAlphaStringBytes( 241 );
+
+// MODULE DATA STRUCTURES
+    // None
+
+// LOCAL FUNCTION PROTOTYPES
+    // None
+
+// ==================== LOCAL FUNCTIONS =====================================
+    // None
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::CMmPhoneBookOperationDelete
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMmPhoneBookOperationDelete::CMmPhoneBookOperationDelete()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::CMmPhoneBookOperationDelete");
+OstTrace0( TRACE_NORMAL, CMmPhoneBookOperationDelete_CMmPhoneBookOperationDelete, "CMmPhoneBookOperationDelete::CMmPhoneBookOperationDelete" );
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::~CMmPhoneBookOperationDelete
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//
+CMmPhoneBookOperationDelete::~CMmPhoneBookOperationDelete()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::~CMmPhoneBookOperationDelete");
+OstTrace0( TRACE_NORMAL, DUP1_CMmPhoneBookOperationDelete_CMmPhoneBookOperationDelete, "CMmPhoneBookOperationDelete::~CMmPhoneBookOperationDelete" );
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::NewL
+// Creates a new CMmPhoneBookOperationDelete object instance.
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+
+CMmPhoneBookOperationDelete* CMmPhoneBookOperationDelete::NewL(
+    CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+    CMmUiccMessHandler* aUiccMessHandler,
+    const CMmDataPackage* aDataPackage ) // Data
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::NewL");
+OstTrace0( TRACE_NORMAL, CMmPhoneBookOperationDelete_NEWL, "CMmPhoneBookOperationDelete::NewL" );
+
+    CMmPhoneBookOperationDelete* mmPhoneBookOperationDelete =
+        new( ELeave ) CMmPhoneBookOperationDelete();
+
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+    // Store phonebook name
+    TName phonebookTypeName;
+    phoneBookData->GetPhoneBookName( phonebookTypeName );
+    mmPhoneBookOperationDelete->iPhoneBookTypeName = phonebookTypeName;
+
+    mmPhoneBookOperationDelete->iMmPhoneBookStoreMessHandler =
+        aMmPhoneBookStoreMessHandler;
+
+    mmPhoneBookOperationDelete->iMmUiccMessHandler = aUiccMessHandler;
+
+    mmPhoneBookOperationDelete->iNumOfExtensions = 0;
+    mmPhoneBookOperationDelete->iFileIdExt = 0;
+    mmPhoneBookOperationDelete->iIndex = 0;
+    mmPhoneBookOperationDelete->iEntry.iEntryIndex = 0;
+    mmPhoneBookOperationDelete->iEntry.iEntryPresent = EFalse;
+    mmPhoneBookOperationDelete->iTransId = 0xFF;
+    mmPhoneBookOperationDelete->iArrayIndex = 0;
+    mmPhoneBookOperationDelete->iLocationFoundInPbList = EFalse;
+    mmPhoneBookOperationDelete->iExtRecordArrayToBeDelete.Reset();
+    mmPhoneBookOperationDelete->iNumOfEntries = 0;
+
+    return mmPhoneBookOperationDelete;
+    }
+
+// ---------------------------------------------------------------------------
+// TInt CMmPhoneBookOperationDelete::UICCCreateReq
+// Separate requests
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UICCCreateReq(
+    TInt aIpc,
+    const CMmDataPackage* aDataPackage,
+    TUint8 aTransId )
+    {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationDelete::UICCCreateReq Ipc: %d", aIpc);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMmPhoneBookOperationDelete_UICCCREATEREQ, "CMmPhoneBookOperationDelete::UICCCreateReq;aIpc=%hd", aIpc );
+
+    TInt ret( KErrNotSupported );
+    iIpc = aIpc;
+    iTransId = aTransId;
+    // Convert phone book name to file id
+    iFileId = ConvertToPBfileId( iPhoneBookTypeName, iFileIdExt );
+    // Find location from internal array
+    iArrayIndex = ConvertToConfArrayIndex( iFileId );
+
+    const CPhoneBookDataPackage* phoneBookData(
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage ) );
+
+    switch( aIpc )
+        {
+        case EMmTsyPhoneBookStoreDeleteIPC:
+            {
+            phoneBookData->UnPackData( iIndex );
+
+            if( PB_MBDN_FID == iFileId )
+                {
+                // For MBDN PhoneBook first read MBI file 
+                // Check if the mailbox inidcation type is correct
+                if( iIndex <= iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[iArrayIndex].iMbiRecLen )
+                    {
+                    iCurrentDeletePhase = EPBDeletePhase_Read_MBI_profile;
+                    // read MBDN record number from MBI first record Profile number
+                    ret = UiccPbReqReadMBI();
+                    }
+                else
+                    {
+                    ret = KErrArgument;
+                    }
+                }
+            else
+                {
+                ret = UiccPbReqDelete();
+                }
+            break;
+            }
+        case EMmTsyPhoneBookStoreDeleteAllIPC:
+            {
+            iNumOfEntries = iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].iNoOfRecords;
+            if ( iNumOfEntries )
+                {
+                // Start to delete entries from the last one
+                iIndex = iNumOfEntries;
+                ret = UiccPbReqDelete();
+                iNumOfEntries--;
+                }
+            break;
+            }
+#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        case ECustomDeleteAlphaStringIPC:
+            {
+            break;
+            }
+#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        default:
+            {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationDelete::CreateReq - Unknown IPC: %d", aIpc);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONDELETE_CREATEREQ, "CMmPhoneBookOperationDelete::CreateReq;aIpc=%d", aIpc );
+            break;
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPbReqDelete
+// Constructs an ISI-message to read entry from SIM
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqDelete()
+    {
+TFLOGSTRING3("TSY: CMmPhoneBookOperationDelete::UiccPbReqDelete, iTransId:%d,index:%d", iTransId, iIndex);
+OstTraceExt2( TRACE_NORMAL, CMmPhoneBookOperationDelete_UICCPBREQWRITEL, "CMmPhoneBookOperationDelete::UiccPbReqDelete;iTransId=%hhu;iIndex=%hd", iTransId, iIndex );
+
+    TInt ret( KErrNotSupported );
+
+    switch ( iFileId )
+        {
+        case PB_ADN_FID:
+        case PB_FDN_FID:
+        case PB_MBDN_FID:
+        case PB_VMBX_FID:
+            {
+            // Check if the location to be deleted is valid
+            if( iIndex <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].iNoOfRecords )
+                {
+                // Check if entry can be found in list
+                if( iMmPhoneBookStoreMessHandler->IndexCheckInPBList(
+                    iIndex,
+                    iArrayIndex,
+                    iEntry ) )
+                    {
+                    iLocationFoundInPbList = ETrue;
+                    // Check if there are extension records for this entry
+                    iNumOfExtensions = iEntry.PBEntryExtRecord.Count();
+                    // Entry is present and there is at least one extension
+                    if( iEntry.iEntryPresent && iNumOfExtensions )
+                        {
+                        // Start to delete the last extension (write 'FF')
+                        iCurrentDeletePhase = EPBDeletePhaseDeleteExtension;
+                        TInt record(
+                            iEntry.PBEntryExtRecord[iNumOfExtensions - 1] );
+                        ret = UiccPbReqDeleteExt( record );
+                        iNumOfExtensions--;
+                        }
+                    // Entry is not present -> fill by 'FF' just in case
+                    // or entry is present but no extensions -> delete entry
+                    else
+                        {
+                        iCurrentDeletePhase = EPBDeletePhaseDeleteEntry;
+                        ret = UiccPbReqDeleteEntry();
+                        }
+                    }
+                // Index has not been read yet. At first it must be read to
+                // define number of possible extensions
+                else
+                    {
+                    iCurrentDeletePhase = EPBDeletePhaseReadEntry;
+                    ret = UiccPbReqReadEntry();
+                    }
+                }
+            }
+        default:
+            {
+            break;
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPBReqDeleteEntry
+// Constructs an ISI-message to Write main Entry data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqDeleteEntry()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPBReqDeleteEntry");
+OstTrace0( TRACE_NORMAL, CMmPhoneBookOperationDelete_UICCPBREQWRITEENTRY, "CMmPhoneBookOperationDelete::UiccPBReqDeleteEntry" );
+
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr =
+        static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ) );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ) );
+    cmdParams.filePath.Append( APPL_FILE_ID >> 8 );
+    cmdParams.filePath.Append( APPL_FILE_ID );
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+
+    cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+    cmdParams.fileId = iFileId;
+    cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+
+    cmdParams.record = iIndex;
+    // Buffer for data to be written, max size is 241 bytes for alpha
+    // string and 14 mandatory data bytes. See 3GPP TS 51.011 V4.15.0
+    // Chapter 10.5.1
+    TBuf8<KEfAdnDataBytes+KMaxAlphaStringBytes> dataBuffer;
+    // Check if alphastring exists
+    TUint16 alphaStringLength( iMmPhoneBookStoreMessHandler->
+        iPBStoreConf[ iArrayIndex ].iAlphaStringlength );
+    // Filel buffer (alpha string bytes + mandatory bytes) by 'FF'
+    dataBuffer.AppendFill( 0xFF, alphaStringLength + KEfAdnDataBytes );
+    cmdParams.fileData.Append( dataBuffer );
+    return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPbReqDeleteExt
+// Constructs an ISI-message to delete extension record
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqDeleteExt( TInt aExtRecordNum )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPbReqDeleteExt");
+OstTrace0( TRACE_NORMAL, CMmPhoneBookOperationDelete_UICCPBWRITEEXT, "CMmPhoneBookOperationDelete::UiccPbReqDeleteExt" );
+
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr =
+        static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID >> 8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+
+    cmdParams.fileId = iFileIdExt;
+    cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+    cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+    cmdParams.record = aExtRecordNum;
+
+    // File Data
+    TBuf8<KExtensionDataBytes>extFileData;
+    extFileData.Append( 0x00 ); // Type of record ( 0x00 == unknown )
+    // Rest of data is set by 'FF'
+    extFileData.AppendFill( 0xFF, ( KExtensionDataBytes - 1 ) ); 
+    cmdParams.fileData.Append( extFileData );
+
+    return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPbReqReadEntry
+// Constructs an ISI-message to read main entry data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqReadEntry()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPBReqDeleteEntry");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_UICCPBREQREADENTRY, "CMmPhoneBookOperationDelete::UiccPbReqReadEntry" );
+
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr =
+        static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ) );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ) );
+    cmdParams.filePath.Append( APPL_FILE_ID >> 8 );
+    cmdParams.filePath.Append( APPL_FILE_ID );
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+    
+    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    cmdParams.fileId = iFileId;
+    cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+    cmdParams.record = iIndex;
+    
+    return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPbReqReadMBI
+// Constructs an ISI-message to Read MBI profile from first record 
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqReadMBI( )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPbReqReadMBI");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_UICCPBREQREADMBI, "CMmPhoneBookOperationDelete::UiccPbReqReadMBI" );
+        
+        TInt ret ( KErrNone );
+        TUiccReadLinearFixed cmdParams;
+        cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                                   ( iMmPhoneBookStoreMessHandler );
+        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+        cmdParams.filePath.Append( APPL_FILE_ID>>8);
+        cmdParams.filePath.Append( APPL_FILE_ID);
+        
+        if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+            {
+            cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+            cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+            }
+
+        cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+        cmdParams.fileId = PB_MBI_FID;
+        cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
+        cmdParams.dataAmount = 1;
+        cmdParams.dataOffset = iIndex;
+        cmdParams.record = 1;   // only first profile number is supported
+        
+        
+        if( KErrNone == ret )
+            {
+            ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+                CreateUiccApplCmdReq( cmdParams );
+            }
+        return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPBReqDeleteMBIProfile
+// Send Request for MBBI Profile Write
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPBReqDeleteMBIProfile()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPBReqWriteMBIProfile");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_UICCPBREQDELETEMBIPROFILE, "CMmPhoneBookOperationDelete::UiccPBReqDeleteMBIProfile" );
+
+    TInt ret ( KErrNone );
+    
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+    cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+    cmdParams.fileId = PB_MBI_FID;
+    cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
+    cmdParams.dataAmount = 1;
+    cmdParams.dataOffset = iIndex;
+    cmdParams.record = 1;   // only first profile number is supported
+
+    // Append FileData needs to be write
+    cmdParams.fileData.Append( 0 );
+    
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+        }
+
+    return ret;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::HandleReadEntryResp
+// Handles phonebook entry data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::HandleReadEntryResp(
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleReadEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEREADENTRYRESP, "CMmPhoneBookOperationDelete::HandleReadEntryResp" );
+
+    TInt ret( KErrNotFound );
+
+    // Check if alphastring exists
+    TUint16 alphaStringLength( iMmPhoneBookStoreMessHandler->
+        iPBStoreConf[ iArrayIndex ].iAlphaStringlength );
+
+    // File contains possible alpha string and 14 mandatory bytes
+    TUint8 index( alphaStringLength + KEfAdnDataBytes - 1 );
+
+    if ( index < aFileData.Length() )
+        {
+        TUint8 extRecord( aFileData[index] );
+        // Check if this entry has extension records
+        if ( 0xFF == extRecord ) // No extension records, just delete entry
+            {
+            iCurrentDeletePhase = EPBDeletePhaseDeleteEntry;
+            ret = UiccPbReqDeleteEntry();
+            }
+        else // Start to read extensions
+            {
+            iExtRecordArrayToBeDelete.Append( extRecord ); // Store records
+            iCurrentDeletePhase = EPBDeletePhaseReadExtensions;
+            ret = UiccPbReqReadExt( extRecord );
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::UiccPbReqDeleteExt
+// Constructs an ISI-message to delete extension record
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::UiccPbReqReadExt( TUint8 aExtRecordNum )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::UiccPbReqDeleteExt");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_UICCPBREQREADEXT, "CMmPhoneBookOperationDelete::UiccPbReqReadExt" );
+
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr =
+        static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID >> 8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+
+    cmdParams.fileId = iFileIdExt;
+    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    cmdParams.trId = static_cast<TUiccTrId>( iTransId );
+    cmdParams.record = aExtRecordNum;
+
+    return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::HandleReadExtResp
+// Handles phonebook entry data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::HandleReadExtResp(
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleReadExtResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEREADEXTRESP, "CMmPhoneBookOperationDelete::HandleReadExtResp" );
+
+    TInt ret( KErrNotFound );
+
+    // Read next record
+    if ( KExtensionDataBytes == aFileData.Length() )
+        {
+        // Next record is located in the last byte
+        TUint8 nextRecord( aFileData[KExtensionDataBytes - 1] );
+        if ( 0xFF == nextRecord ) // No more extension records left
+            {
+            iCurrentDeletePhase = EPBDeletePhaseDeleteExtension;
+            iNumOfExtensions = iExtRecordArrayToBeDelete.Count();
+            if ( iNumOfExtensions )
+                {
+                // Start to delete extensions in reverse order
+                ret = UiccPbReqDeleteExt(
+                    iExtRecordArrayToBeDelete[iNumOfExtensions - 1] );
+                iExtRecordArrayToBeDelete.Remove( iNumOfExtensions - 1 );
+                iExtRecordArrayToBeDelete.Compress();
+                }
+            }
+        else // Read the next extension
+            {
+            iExtRecordArrayToBeDelete.Append( nextRecord );
+            ret = UiccPbReqReadExt( nextRecord );
+            }
+        }
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TBool CMmPhoneBookOperationDelete::HandleWriteMBIReadResp
+// Handle write response for MBI profile read
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::HandleWriteMBIReadResp(
+        TInt aStatus,
+        TUint8 aDetails,
+        const TDesC8 &aFileData ) 
+    {
+    TInt ret ( KErrNone );
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleWriteMBIReadResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEWRITEMBIREADRESP, "CMmPhoneBookOperationDelete::HandleWriteMBIReadResp" );
+
+    // Store MBI Profile
+    iMBIProfileType = iIndex;
+    if( UICC_STATUS_OK  == aStatus )
+        {
+        iIndex = aFileData[0];
+        ret = UiccPbReqDelete();
+        }
+    else
+        {
+        if( UICC_SECURITY_CONDITIONS_NOT_SATISFIED == aDetails )
+            {
+            ret = KErrAccessDenied;
+            }
+        else
+            {
+            ret = KErrArgument;
+            }
+        }
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::HandleUICCPbRespL
+// Separate response
+// ---------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationDelete::HandleUICCPbRespL(
+    TInt aStatus,
+    TUint8 aDetails,
+    const TDesC8& aFileData,
+    TInt /*aTransId*/ )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleUICCPbRespL");
+OstTrace0( TRACE_NORMAL, CMmPhoneBookOperationDelete_HANDLEUICCPBRESPL, "CMmPhoneBookOperationDelete::HandleUICCPbRespL" );
+
+    TInt ret( KErrNone );
+    TBool complete( EFalse );
+
+    TInt maxNumLength( 0 );
+    TInt location( 0 );
+
+    if ( UICC_STATUS_OK == aStatus )
+        {
+        switch ( iCurrentDeletePhase )
+            {
+            case EPBDeletePhaseReadExtensions:
+                {
+                ret = HandleReadExtResp( aFileData );
+                break;
+                }
+            case EPBDeletePhaseReadEntry:
+                {
+                ret = HandleReadEntryResp( aFileData );
+                break;
+                }
+            case EPBDeletePhaseDeleteExtension:
+                {
+                // Entry was read earlier and extension records saved
+                if ( iLocationFoundInPbList )
+                    {
+                    // Check if there are extensions left, in that case
+                    // continue deleting extensions
+                    if ( iNumOfExtensions )
+                        {
+                        ret = UiccPbReqDeleteExt(
+                            iEntry.PBEntryExtRecord[iNumOfExtensions-1] );
+                        iNumOfExtensions--;
+                        }
+                    // All extensions were deleted, next delete the main entry
+                    else
+                        {
+                        iCurrentDeletePhase = EPBDeletePhaseDeleteEntry;
+                        ret = UiccPbReqDeleteEntry();
+                        }
+                    }
+                // Extensions were read from SIM and saved to internal buffer
+                else
+                    {
+                    iNumOfExtensions = iExtRecordArrayToBeDelete.Count();
+                    if ( iNumOfExtensions )
+                        {
+                        ret = UiccPbReqDeleteExt(
+                            iExtRecordArrayToBeDelete[iNumOfExtensions - 1] );
+                        iExtRecordArrayToBeDelete.Remove(
+                            iNumOfExtensions - 1 );
+                        iExtRecordArrayToBeDelete.Compress();
+                        }
+                    else // It is time to delete the main entry
+                        {
+                        iCurrentDeletePhase = EPBDeletePhaseDeleteEntry;
+                        ret = UiccPbReqDeleteEntry();
+                        }
+                    }
+                break;
+                }
+            case EPBDeletePhaseDeleteEntry:
+                {
+                if ( iLocationFoundInPbList ) // Entry already in list, reset
+                    {
+                    iMmPhoneBookStoreMessHandler->ResetEntryInPhoneBookList(
+                        iArrayIndex,
+                        iIndex );
+                    }
+                else
+                    {
+                    // This location has not been read earlier, add it to list
+                    TPBEntry* storeEntry = new ( ELeave ) TPBEntry();
+                    storeEntry->iEntryPresent = EFalse;
+                    storeEntry->iEntryIndex = iIndex;
+                    storeEntry->PBEntryExtRecord.Reset();
+                    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                        storeEntry,
+                        iArrayIndex );
+                    }
+
+                // If it is MBDN Phone Book then update MBI File also
+                if( PB_MBDN_FID == iFileId)
+                    {
+                    // Start Writing MBI file
+                    iCurrentDeletePhase = EPBDeletePhase_delete_MBI_profile;
+                    ret = UiccPBReqDeleteMBIProfile();
+                    }
+                else
+                    {
+                        // Ready for complete
+                        complete = ETrue;
+                        maxNumLength = iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[iArrayIndex].iNumlength;
+                    if ( EMmTsyPhoneBookStoreDeleteAllIPC == iIpc &&
+                        iNumOfEntries )
+                        {
+                        // Continue deleting entries
+                        iIndex = iNumOfEntries;
+                        ret = UiccPbReqDelete();
+                        iNumOfEntries--;
+                        }
+                    else
+                        {
+                        // Ready for complete
+                        complete = ETrue;
+                        maxNumLength = iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[iArrayIndex].iNumlength;
+                        // In case of delete all location is 0
+                        if ( EMmTsyPhoneBookStoreDeleteIPC == iIpc )
+                            {
+                            location = iIndex;
+                            }
+                        }
+                    }
+                break;
+                }
+            case EPBDeletePhase_Read_MBI_profile:
+                {
+                ret = HandleWriteMBIReadResp( aStatus, aDetails, aFileData );
+                break;
+                }
+            case EPBDeletePhase_delete_MBI_profile:
+                {
+                if( UICC_STATUS_OK  != aStatus )
+                    {
+                    if( UICC_SECURITY_CONDITIONS_NOT_SATISFIED == aDetails )
+                        {
+                        ret = KErrAccessDenied;
+                        }
+                    else
+                        {
+                        ret = KErrArgument;
+                        }
+                    }
+                else
+                    {
+                    // Ready for complete
+                    complete = ETrue;
+                    maxNumLength = iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[iArrayIndex].iNumlength;
+                    location = iMBIProfileType;
+                    }
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleSimPbRespL - No such delete operation phase supported ");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONDELETE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationDelete::HandleUICCPbRespL- No such delete operation phase supported" );
+                break;
+                }
+            } // End of switch( iCurrentDeletePhase )
+        } // End of if ( UICC_STATUS_OK == aStatus )
+    else // Request failed, complete and remove operation
+        {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationDelete::HandleUICCPbRespL, Request failed, ret = %d", aStatus );
+OstTrace1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationDelete::HandleUICCPbRespL;aStatus=%d", aStatus );
+        complete = ETrue;
+        ret = KErrNotFound;
+        }
+
+    // Error occured in some phase, stop operation and complete
+    if ( ret != KErrNone )
+        {
+        complete = ETrue;
+        }
+
+    if ( complete )
+        {
+        TPBEntryInfo pbEntryInfo;
+        pbEntryInfo.iMaxNumLength = maxNumLength;
+        pbEntryInfo.iLocation = location;
+
+        CPhoneBookDataPackage phoneBookData;
+        phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+        phoneBookData.PackData( &pbEntryInfo );
+
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+            iIpc,
+            &phoneBookData,
+            ret );
+        }
+
+    return complete;
+    }
+
+
+// End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,9 +22,9 @@
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationinit.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookoperationinittraces.h"
+#include "cmmphonebookoperationinitTraces.h"
 #include "cmmphonebookoperationinit3G_adn.h"
 #endif
 
@@ -67,6 +67,8 @@
     {
     TFLOGSTRING("TSY: CmmPhonebookOperatorInit::CmmPhonebookOperatorInit");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_CMMPHONEBOOKOPERATIONINIT, "CMmPhoneBookOperationInit::CMmPhoneBookOperationInit" );
+
+    iTypeOfReading = EBasicEfRead;
     }
 
 // -----------------------------------------------------------------------------
@@ -112,7 +114,7 @@
 
     phoneBookData->GetPhoneBookName( phonebookTypeName );
     //Store phonebook name
-    mmPhoneBookOperationInit->iPhonebookType = phonebookTypeName;
+    mmPhoneBookOperationInit->iPhoneBookTypeName = phonebookTypeName;
 
     if( 0 == phonebookTypeName.CompareF( KInternalPhoneBookType ) )
         {
@@ -120,7 +122,6 @@
         }
     else // Full construction is not needed in case of internal initilization
         {
-        mmPhoneBookOperationInit->iTransactionId = ETrIdPbInit;
         mmPhoneBookOperationInit->ConstructL( );
         }
 
@@ -184,7 +185,8 @@
 TInt CMmPhoneBookOperationInit::UICCCreateReq
     (
     TInt aIpc,
-    const CMmDataPackage* /*aDataPackage*/
+    const CMmDataPackage* /*aDataPackage*/,
+    TUint8 aTransId
     )
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCCreateReq");
@@ -204,7 +206,6 @@
                     iInternalInit = ETrue;
                     }
                 iServiceType = UICC_APPL_FILE_INFO;
-                iExtensionPresent = EFalse; // Default EXT File is not present
 
                 // Start Initialization for 2G phonebooks
                 // Check for ADN Phonebook is available and activated
@@ -216,7 +217,7 @@
                     {
                     iIniPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
                     }
-                ret = UICCInitializeReq();
+                ret = UICCInitializeReq(aTransId);
                 }
             else  // else for if internalInit goign on
                 {
@@ -243,7 +244,7 @@
 // Creates phonebook initialize request data for SIM
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationInit::UICCInitializeReq()
+TInt CMmPhoneBookOperationInit::UICCInitializeReq( TUint8 aTransId )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq");
 OstTrace0( TRACE_FATAL, CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq" );
@@ -252,9 +253,8 @@
         TInt appFileID ( APPL_FILE_ID );   // Application File id for DFphonebook
         TUiccReadLinearFixed cmdParams;
 
-        cmdParams.messHandlerPtr =
-            static_cast<MUiccOperationBase*>(iMmPhoneBookStoreMessHandler);
-        cmdParams.trId = ETrIdPbInit;
+        cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*>(iMmPhoneBookStoreMessHandler);
+        cmdParams.trId = static_cast<TUiccTrId>( aTransId );
 
         cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE >> 8 ));
         cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE ));
@@ -268,7 +268,7 @@
             case EPBInitPhaseADN:
                 {
                 // Create Data for ADN EF read
-                if( !iExtensionPresent )
+                if( EBasicEfRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - ADN Init for Fileinfo OR FileData");
                     OstTrace0( TRACE_FATAL, DUP1_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - ADN Init for Fileinfo OR FileData" );
@@ -277,7 +277,7 @@
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if( EExtensionRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - ADN Phonebook Init Extension request");
                     OstTrace0( TRACE_FATAL, DUP2_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - ADN Phonebook Init Extension request" );
@@ -292,7 +292,7 @@
             case EPBInitPhaseFDN:
                 {
                 // Create Data for FDN EF read
-                if( !iExtensionPresent )
+                if( EBasicEfRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init FileInfo OR FileData request");
                     OstTrace0( TRACE_FATAL, DUP3_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq -  FDN Init FileInfo OR FileData request" );
@@ -301,7 +301,7 @@
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if( EExtensionRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init Extension request");
                     OstTrace0( TRACE_FATAL, DUP4_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init Extension request" );
@@ -315,7 +315,7 @@
                 }
             case EPBInitPhaseSDN:
                 {
-                if( !iExtensionPresent )
+                if( EBasicEfRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init FileInfo OR FileData request");
                     OstTrace0( TRACE_FATAL, DUP5_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init FileInfo OR FileData request" );
@@ -324,7 +324,7 @@
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if(  EExtensionRead == iTypeOfReading )
                     {
                     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init Extension request");
                     OstTrace0( TRACE_FATAL, DUP6_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init Extension request" );
@@ -338,43 +338,62 @@
                 }
             case EPBInitPhaseMBDN:
                 {
-                if( !iExtensionPresent )
+                // Start with MBI reading
+                if( EBasicEfRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request");
-                    OstTrace0( TRACE_FATAL, DUP7_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request");
+OstTrace0( TRACE_FATAL, DUP7_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request" );
 
                     cmdParams.fileId = PB_MBDN_FID;
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if( EExtensionRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request");
-                    OstTrace0( TRACE_FATAL, DUP8_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request");
+OstTrace0( TRACE_FATAL, DUP8_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request" );
 
                     cmdParams.fileId = PB_EXT6_FID;
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
+                else if( EMailboxIdRead == iTypeOfReading )
+                    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init MBI request");
+OstTrace0( TRACE_FATAL, DUP14_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init MBI request" );
+
+                    cmdParams.fileId = PB_MBI_FID;
+                    cmdParams.serviceType = iServiceType;
+                    cmdParams.record = 0;
+                    }
                 break;
                 }
             case EPBInitPhaseMSISDN:
                 {
-                if( !iExtensionPresent )
+                if( EBasicEfRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request");
-                    OstTrace0( TRACE_FATAL, DUP9_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request");
+OstTrace0( TRACE_FATAL, DUP9_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request" );
 
                     cmdParams.fileId = PB_MSISDN_FID;
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if( EExtensionRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init Extension request");
-                    OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init Extension request");
+OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq" );
 
-                    cmdParams.fileId = PB_EXT5_FID;
+                    if ( UICC_CARD_TYPE_ICC == 
+                    	       iMmUiccMessHandler->GetCardType() )
+                        {
+                        cmdParams.fileId = PB_EXT1_FID;
+                        }
+                    else if ( UICC_CARD_TYPE_UICC == 
+                    	            iMmUiccMessHandler->GetCardType() )
+                    	  {                    
+                        cmdParams.fileId = PB_EXT5_FID;
+                        }
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
@@ -382,19 +401,19 @@
                 }
             case EPBInitPhaseVMBX:
                 {
-                if( !iExtensionPresent )
+                if( EBasicEfRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request");
-                    OstTrace0( TRACE_FATAL, DUP11_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request");
+OstTrace0( TRACE_FATAL, DUP11_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request" );
 
                     cmdParams.fileId = PB_VMBX_FID;
                     cmdParams.serviceType = iServiceType;
                     cmdParams.record = 0;
                     }
-                else
+                else if( EExtensionRead == iTypeOfReading )
                     {
-                    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request");
-                    OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request");
+OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request" );
 
                     cmdParams.fileId = PB_EXT1_FID;
                     cmdParams.serviceType = iServiceType;
@@ -404,8 +423,8 @@
                 }
             default:
                 {
-                TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported ");
-                OstTrace0( TRACE_NORMAL, DUP12_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported ");
+OstTrace0( TRACE_NORMAL, DUP12_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ, "CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported" );
                 break;
                 }
             }
@@ -416,7 +435,7 @@
     if( EPBIniPhase_PBInitialized != iIniPhase )
         {
         ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->CreateUiccApplCmdReq( cmdParams );
-        TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
         }
     return ret;
     }
@@ -434,38 +453,39 @@
 // Handle Response for SIM
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationInit::HandleUICCPbRespL
+TBool CMmPhoneBookOperationInit::HandleUICCPbRespL
     (
-    TBool &aComplete,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8 &aFileData,
-    TInt /*aTransId*/
+    TInt aTransId
     )
     {
     TInt ret( KErrNone );
+    TBool complete( EFalse );
     // break immediatelly in case of internal init
     if ( iInternalInit )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleUICCPbRespL. Internal Init->Break");
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleUICCPbRespL. Internal Init->Break");
 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit::HandleUICCPbRespL, Internal Init->Break" );
 
         iIniPhase = EPBIniPhase_Unknown;
 
         // set flag to indicate that we can remove this operation from array
-        aComplete = ETrue;
+        complete = ETrue;
         iInternalInit = EFalse;
         return KErrNone;
         }
 
     // Handle recponse from UICC server
-        ret = HandlePBRespL(aFileData,aStatus);
+        ret = HandlePBRespL(aFileData,aStatus, aTransId);
 
 
          // Complete, if phonebook initalization is complete or there is some error in UICC server
          if (KErrNone != ret || EPBIniPhase_PBInitialized == iIniPhase )
              {
              CPhoneBookDataPackage phoneBookData;
-             phoneBookData.SetPhoneBookName( iPhonebookType );
+             phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
              phoneBookData.PackData( iPBStoreInfoData );
 
              if ( KErrNone != ret )
@@ -477,9 +497,9 @@
                      EMmTsyPhoneBookStoreInitIPC,
                      &phoneBookData,
                      ret );
-             aComplete = ETrue;
+             complete = ETrue;
              }
-    return ret;
+    return complete;
     }
 
 
@@ -490,26 +510,30 @@
 // Further Handle Response for SIM
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationInit::HandlePBRespL(const TDesC8& aFileData, TInt aStatus )
+TInt CMmPhoneBookOperationInit::HandlePBRespL(const TDesC8& aFileData, TInt aStatus, TUint8 aTransId )
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandlePBRespL");
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEPBRESPL, "CMmPhoneBookOperationInit::HandlePBRespL" );
 
     TInt ret(KErrNone);
 
-    if(!iExtensionPresent)
+    if( EBasicEfRead == iTypeOfReading )
         {
         ret = HandleFileResp(aFileData, aStatus);
         }
+    else if( EExtensionRead == iTypeOfReading )
+        {
+        // For Extension File
+        ret = HandleEXTFileResp( aFileData, aStatus );
+        }
     else
         {
-        // For Extension File
-        ret = HandleEXTFileResp(aFileData, aStatus);
+        ret = HandleMBIFileResp( aFileData, aStatus );
         }
 
     if(KErrNone == ret)
         {
-        ret = UICCInitializeReq();
+        ret = UICCInitializeReq( aTransId );
         }
 
     return ret;
@@ -538,12 +562,11 @@
         {
         if(UICC_APPL_FILE_INFO == iServiceType)
             {
-            // get the ecord length
-            HandleFcpData(aFileData,recordLength,KRecordLength);
-
-            // Get the no of entries
-            HandleFcpData(aFileData,numOfEntries,KNoOfRecords);
-
+            // get the record length and number of entries
+            TFci fci( aFileData );
+            recordLength = fci.GetRecordLength();
+            numOfEntries = fci.GetNumberOfRecords();
+ 
             // get Text length
             textLength = (recordLength - 14);
 
@@ -551,15 +574,6 @@
             // IF EXT2 is not present then only 20 BCD digits can be stored
             numLength =  UICC_NO_EXT_MAX_NUM_LEN;
             }
-        else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
-            {
-            TUint8 infoEXT ( aFileData[(textLength + 14)] );
-            if( 0xFF != infoEXT)
-                {
-                // Send Request to read File info from EXT file
-                iExtensionPresent = ETrue;
-                }
-            }
         }
 
         switch(iIniPhase)
@@ -574,7 +588,8 @@
                         OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for ADN Phonebook" );
                         // Check for ADN phone book is incalidated by Fdn phonebook or not
                         TInt status(0);
-                        HandleFcpData(aFileData,status,KFileStatus);
+                        TFci fci( aFileData );
+                        status = fci.GetFileStatus();
 
                         // check for ADN is invalidated or not
                         if(!(status & 0x01))
@@ -585,8 +600,6 @@
                                 iPBStoreInfoData->iADNNumOfEntries = numOfEntries;
                                 iPBStoreInfoData->iADNNumberLengthMax = numLength;
                                 iPBStoreInfoData->iADNTextLengthMax = textLength;
-                                // Change ServiceType to read File Data to get final number length
-                                iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                                 }
                             else   // when ADN is not updatable
                                 {
@@ -599,25 +612,29 @@
                             iPBStoreInfoData->iADNNumOfEntries = numOfEntries;
                             iPBStoreInfoData->iADNNumberLengthMax = numLength;
                             iPBStoreInfoData->iADNTextLengthMax = textLength;
-                            // Change ServiceType to read File Data to get final number length
-                            iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                             }
                         }
-                    else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
+                    if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM))
                         {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for ADN Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for ADN Phonebook" );
+                        // Store ADN Phone book configuration in local array if EXT is not present
+                        TPrimitiveInitInfo primConfAdn;
+                        primConfAdn.iAlphaStringlength = iPBStoreInfoData->iADNTextLengthMax;
+                        primConfAdn.iExtension = EFalse;
+                        primConfAdn.iNumlength = iPBStoreInfoData->iADNNumberLengthMax;
+                        primConfAdn.iNoOfRecords = iPBStoreInfoData->iADNNumOfEntries;
 
-                        iServiceType = UICC_APPL_FILE_INFO;
+                        iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeAdn] = primConfAdn;
 
-                        if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM) || (!iExtensionPresent) )
-                            {
-                            iExtensionPresent = EFalse;
-                            iIniPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
-                            }
-                        // ADN Phonebook is initilized
-                        iADNPbInitilized = ETrue;
+                        iTypeOfReading = EBasicEfRead;
+                        iIniPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
                         }
+                    else
+                        {
+                        // When Service is available
+                        iTypeOfReading = EExtensionRead;
+                        }
+                    // ADN Phonebook is initilized
+                    iADNPbInitilized = ETrue;
                     }
                 else
                     {
@@ -626,8 +643,7 @@
                     iPBStoreInfoData->iADNNumberLengthMax = -1;
                     iPBStoreInfoData->iADNTextLengthMax = -1;
 
-                    // Set ADn intialized flag to False
-
+                    // Set ADN intialized flag to False
                     iADNPbInitilized = EFalse;
                     }
                 }
@@ -644,36 +660,54 @@
                         iPBStoreInfoData->iFDNNumOfEntries = numOfEntries;
                         iPBStoreInfoData->iFDNNumberLengthMax = numLength;
                         iPBStoreInfoData->iFDNTextLengthMax = textLength;
-                        // Change ServiceType to read File Data to get final number length
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
-                    else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
+                    if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                         {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for FDN Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for ADN Phonebook" );
+                        // Check for Exension
+                        // Check for EXT2 Service is present or not
+                        if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT2_SERVICE_NUM ) )
+                            {
+                            // Store FDN Phone book configuration in local array if EXT is not present in ICC Card
+                            TPrimitiveInitInfo primConfFdn;
+                            primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
+                            primConfFdn.iExtension = EFalse;
+                            primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
+                            primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
 
-                        if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
+                            iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
+
+                            iTypeOfReading = EBasicEfRead;
+                            iIniPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
+                            }
+                        else
                             {
-                            // Check for Exension
-                            // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT2_SERVICE_NUM) || (!iExtensionPresent))
-                                {
-                                iExtensionPresent = EFalse;
-                                iIniPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
-                                }
+                            iTypeOfReading = EExtensionRead ;
                             }
-                        else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                        }
+                    else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                        {
+                        // Chekc for Extension
+                        // Check for EXT1 Service is present or not
+                        if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT2_SERVICE_NUM ) )
                             {
-                            // Chekc for Extension
-                            // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT2_SERVICE_NUM) || (!iExtensionPresent))
-                                {
-                                iExtensionPresent = EFalse;
-                                iIniPhase = GetNextAvailablePbUicc(UICC_FDN_SERVICE_NUM);
-                                }
+                            // Store FDN Phone book configuration in local array if EXT is not present in UICC Card
+                            TPrimitiveInitInfo primConfFdn;
+                            primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
+                            primConfFdn.iExtension = EFalse;
+                            primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
+                            primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
+
+                            iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
+
+                            iTypeOfReading = EBasicEfRead;
+                            iIniPhase = GetNextAvailablePbUicc(UICC_FDN_SERVICE_NUM);
                             }
-                        iServiceType = UICC_APPL_FILE_INFO;
+                        else
+                            {
+                            iTypeOfReading = EExtensionRead;
+                            }
                         }
+                    iServiceType = UICC_APPL_FILE_INFO;
                     }
                 else
                     {
@@ -702,36 +736,54 @@
                         iPBStoreInfoData->iSDNNumOfEntries = numOfEntries;
                         iPBStoreInfoData->iSDNNumberLengthMax = numLength;
                         iPBStoreInfoData->iSDNTextLengthMax = textLength;
-                        // Change ServiceType to read File Data to get final number length
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
-                    else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
+                    if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                         {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for SDN Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for ADN Phonebook" );
+                        // Check for Exension
+                        // Check for EXT1 Service is present or not
+                        if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT3_SERVICE_NUM ) )
+                            {
+                            // Store SDN Phone book configuration in local array if EXT is not present in UICC Card
+                            TPrimitiveInitInfo primConfSdn;
+                            primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
+                            primConfSdn.iExtension = EFalse;
+                            primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
+                            primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
 
-                        if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
+                            iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
+
+                            iTypeOfReading = EBasicEfRead;
+                            iIniPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
+                            }
+                        else
                             {
-                            // Check for Exension
-                            // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT3_SERVICE_NUM) || (!iExtensionPresent))
-                                {
-                                iExtensionPresent = EFalse;
-                                iIniPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
-                                }
+                            iTypeOfReading = EExtensionRead;
                             }
-                        else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                        }
+                    else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                        {
+                        // Chekc for Extension
+                        // Check for EXT3 Service is present or not
+                        if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT3_SERVICE_NUM ) )
                             {
-                            // Chekc for Extension
-                            // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT3_SERVICE_NUM ) || (!iExtensionPresent))
-                                {
-                                iExtensionPresent = EFalse;
-                                iIniPhase = GetNextAvailablePbUicc(UICC_SDN_SERVICE_NUM);
-                                }
+                            // Store SDN Phone book configuration in local array if EXT is not present in UICC Card
+                            TPrimitiveInitInfo primConfSdn;
+                            primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
+                            primConfSdn.iExtension = EFalse;
+                            primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
+                            primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
+
+                            iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
+
+                            iTypeOfReading = EBasicEfRead;
+                            iIniPhase = GetNextAvailablePbUicc(UICC_SDN_SERVICE_NUM);
                             }
-                        iServiceType = UICC_APPL_FILE_INFO;
+                        else
+                            {
+                            iTypeOfReading = EExtensionRead;
+                            }
                         }
+                    iServiceType = UICC_APPL_FILE_INFO;
                     }
                 else
                     {
@@ -754,23 +806,9 @@
                         iPBStoreInfoData->iMBDNNumOfEntries = numOfEntries;
                         iPBStoreInfoData->iMBDNNumberLengthMax = numLength;
                         iPBStoreInfoData->iMBDNTextLengthMax = textLength;
-                        // Change ServiceType to read File Data to get final number length
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
-                    else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType)
-                        {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for MBDN Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP8_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for MBDN Phonebook" );
-
-                        if(!iExtensionPresent)
-                            {
-                            if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
-                                iIniPhase = GetNextAvailablePbIcc(ICC_MBDN_SERVICE_NUM);
-                            else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
-                                iIniPhase = GetNextAvailablePbUicc(UICC_MBDN_SERVICE_NUM);
-                            }
-                        iServiceType = UICC_APPL_FILE_INFO;
-                        }
+                    iTypeOfReading = EExtensionRead;
+                    iServiceType = UICC_APPL_FILE_INFO;
                     }
                 else
                     {
@@ -793,36 +831,54 @@
                         iPBStoreInfoData->iMSISDNNumOfEntries = numOfEntries;
                         iPBStoreInfoData->iMSISDNNumberLengthMax = numLength;
                         iPBStoreInfoData->iMSISDNTextLengthMax = textLength;
-                        // Change ServiceType to read File Data to get final number length
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
-                    else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
-                        {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for MSISDN Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for MSISDN Phonebook" );
-
                         if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                             {
                             // Check for Exension
                             // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM ) || (!iExtensionPresent))
+                            if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM ) )
                                 {
-                                iExtensionPresent= EFalse;
+                                // Store MSISDN Phone book configuration in local array if EXT is not present in ICC Card
+                                TPrimitiveInitInfo primConfMsisdn;
+                                primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
+                                primConfMsisdn.iExtension = EFalse;
+                                primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
+                                primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
+
+                                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
+
+                                iTypeOfReading = EBasicEfRead;
                                 iIniPhase = GetNextAvailablePbIcc(ICC_MSISDN_SERVICE_NUM);
                                 }
+                            else
+                                {
+                                iTypeOfReading = EExtensionRead;
+                                }
                             }
                         else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
                             {
                             // Chekc for Extension
                             // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT5_SERVICE_NUM ) || (!iExtensionPresent))
+                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT5_SERVICE_NUM ) || ( iTypeOfReading  == EBasicEfRead ))
                                 {
-                                iExtensionPresent = EFalse;
+                                // Store MSISDN Phone book configuration in local array if EXT is not present in UICC Card
+                                TPrimitiveInitInfo primConfMsisdn;
+                                primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
+                                primConfMsisdn.iExtension = EFalse;
+                                primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
+                                primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
+
+                                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
+
+                                iTypeOfReading = EBasicEfRead;
                                 iIniPhase = GetNextAvailablePbUicc(UICC_MSISDN_SERVICE_NUM);
                                 }
+                            else
+                                {
+                                iTypeOfReading = EExtensionRead;
+                                }
                             }
                         iServiceType = UICC_APPL_FILE_INFO;
-                        }
                     }
                 else
                     {
@@ -842,26 +898,32 @@
                         TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for VMBX Phonebook");
                         OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for VMBX Phonebook" );
 
+                        // update Data in CommonTSY buffer
                         iPBStoreInfoData->iVMBXNumOfEntries = numOfEntries;
                         iPBStoreInfoData->iVMBXNumberLengthMax = numLength;
                         iPBStoreInfoData->iVMBXTextLengthMax = textLength;
-                        // Change ServiceType to read File Data to get final number length
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
-                    else if(UICC_APPL_READ_LINEAR_FIXED == iServiceType)
+                    // Check for Exension
+                    // Check for EXT1 Service is present or not
+                    if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM))
                         {
-                        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for VMBX Phonebook");
-                        OstTrace0( TRACE_NORMAL, DUP11_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Data for VMBX Phonebook" );
+                        // Store VMBX Phone book configuration in local array if EXT is not present
+                        TPrimitiveInitInfo primConfVmbx;
+                        primConfVmbx.iAlphaStringlength = iPBStoreInfoData->iVMBXTextLengthMax;
+                        primConfVmbx.iExtension = EFalse;
+                        primConfVmbx.iNumlength = iPBStoreInfoData->iVMBXNumberLengthMax;
+                        primConfVmbx.iNoOfRecords = iPBStoreInfoData->iVMBXNumOfEntries;
 
-                            // Check for Exension
-                            // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM) || ( !iExtensionPresent ))
-                                {
-                                iExtensionPresent = EFalse;
-                                iIniPhase = EPBIniPhase_PBInitialized;
-                                }
-                        iServiceType = UICC_APPL_FILE_INFO;
+                        iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeVMBX] = primConfVmbx;
+                                
+                        iTypeOfReading = EBasicEfRead;
+                        iIniPhase = EPBIniPhase_PBInitialized;
                         }
+                    else
+                        {
+                        iTypeOfReading = EExtensionRead;
+                        }
+                    iServiceType = UICC_APPL_FILE_INFO;
                     }
                 else
                     {
@@ -910,7 +972,8 @@
         // no of records in EXT2 EF
         TInt noOfRecords(0);
         // get the no of records
-        HandleFcpData(aFileData,noOfRecords,KNoOfRecords);
+        TFci fci( aFileData );
+        noOfRecords = fci.GetNumberOfRecords();
 
         // To get the total length of number
         // Where multiply by 11 is the no of bytes in extension data and multiply by 2 is for BCD coding while
@@ -918,7 +981,7 @@
         TInt numLength =  UICC_NO_EXT_MAX_NUM_LEN + (11*noOfRecords*2);
 
         // Change Extension present to read PhoneBook EF file info
-        iExtensionPresent = EFalse;
+        iTypeOfReading = EBasicEfRead;
         iServiceType = UICC_APPL_FILE_INFO;
 
         switch(iIniPhase)
@@ -929,6 +992,17 @@
                 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP, "CMmPhoneBookOperationInit::HandleEXTFileResp - For ADN Phone book" );
 
                 iPBStoreInfoData->iADNNumberLengthMax = numLength;
+                
+                // Store ADN Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfAdn;
+                primConfAdn.iAlphaStringlength = iPBStoreInfoData->iADNTextLengthMax;
+                primConfAdn.iExtension = ETrue;
+                primConfAdn.iNumlength = iPBStoreInfoData->iADNNumberLengthMax;
+                primConfAdn.iNoOfRecords = iPBStoreInfoData->iADNNumOfEntries;
+                primConfAdn.iExtNoOfRec = noOfRecords;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeAdn] = primConfAdn;
+
                 // Change the Initialization Phase to next
                 // Get next available phonebook in UST table
                 iIniPhase =  GetNextAvailablePbIcc(UICC_FDN_SERVICE_NUM);
@@ -941,6 +1015,16 @@
 
                 iPBStoreInfoData->iFDNNumberLengthMax = numLength;
 
+                // Store FDN Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfFdn;
+                primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
+                primConfFdn.iExtension = ETrue;
+                primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
+                primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
+                primConfFdn.iExtNoOfRec = noOfRecords;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
+
                 if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                     {
                     iIniPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
@@ -958,6 +1042,16 @@
 
                 iPBStoreInfoData->iSDNNumberLengthMax = numLength;
 
+                // Store SDN Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfSdn;
+                primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
+                primConfSdn.iExtension = ETrue;
+                primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
+                primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
+                primConfSdn.iExtNoOfRec = noOfRecords;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
+
                 if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                     {
                     iIniPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
@@ -976,6 +1070,17 @@
 
                 iPBStoreInfoData->iMBDNNumberLengthMax = numLength;
 
+                // Store MBDN Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfMbdn;
+                primConfMbdn.iAlphaStringlength = iPBStoreInfoData->iMBDNTextLengthMax;
+                primConfMbdn.iExtension = ETrue;
+                primConfMbdn.iNumlength = iPBStoreInfoData->iMBDNNumberLengthMax;
+                primConfMbdn.iNoOfRecords = iPBStoreInfoData->iMBDNNumOfEntries;
+                primConfMbdn.iExtNoOfRec = noOfRecords;
+                primConfMbdn.iMbiRecLen = iMbiRecLen;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMBDN] = primConfMbdn;
+
                 if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                     {
                     iIniPhase = GetNextAvailablePbIcc(ICC_MBDN_SERVICE_NUM);
@@ -992,6 +1097,17 @@
                 OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP, "CMmPhoneBookOperationInit::HandleEXTFileResp - for MSISDN Phonebook" );
 
                 iPBStoreInfoData->iMSISDNNumberLengthMax = numLength;
+                
+                // Store MSISDN Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfMsisdn;
+                primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
+                primConfMsisdn.iExtension = ETrue;
+                primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
+                primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
+                primConfMsisdn.iExtNoOfRec = noOfRecords;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
+
 
                 if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                     {
@@ -1009,6 +1125,18 @@
                 OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP, "CMmPhoneBookOperationInit::HandleEXTFileResp - For VMBX PhoneBook" );
 
                 iPBStoreInfoData->iVMBXNumberLengthMax = numLength;
+                
+                // Store VMBX Phone book configuration in local array if EXT is present
+                TPrimitiveInitInfo primConfVmbx;
+                primConfVmbx.iAlphaStringlength = iPBStoreInfoData->iVMBXTextLengthMax;
+                primConfVmbx.iExtension = ETrue;
+                primConfVmbx.iNumlength = iPBStoreInfoData->iVMBXNumberLengthMax;
+                primConfVmbx.iNoOfRecords = iPBStoreInfoData->iVMBXNumOfEntries;
+                primConfVmbx.iExtNoOfRec = noOfRecords;
+                
+                iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeVMBX] = primConfVmbx;
+
+                
                 iIniPhase = EPBIniPhase_PBInitialized;
                 }
                 break;
@@ -1031,7 +1159,28 @@
 
 
 
-
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationInit::HandleMBIFileResp
+// Handle MBI File response
+// by index
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationInit::HandleMBIFileResp( const TDesC8 &aFileData , TInt aStatus )
+    {
+    
+    TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleMBIFileResp");
+    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEMBIFILERESP, "CMmPhoneBookOperationInit::HandleMBIFileResp" );
+    
+    TInt ret(KErrNone);
+    if(UICC_STATUS_OK == aStatus)
+        {
+        // get the no of records
+        TFci fci( aFileData );
+        iMbiRecLen = fci.GetRecordLength();
+        iTypeOfReading = EBasicEfRead;
+        }
+    return ret ;
+    }
 
 // -----------------------------------------------------------------------------
 // CMmPhoneBookOperationInit::GetNextAvailablePbUicc
@@ -1158,6 +1307,11 @@
             }
             break;
         }
+    
+    if( EPBInitPhaseMBDN == aPBook )
+        {
+        iTypeOfReading = EMailboxIdRead;
+        }
     return aPBook;
     }
 
@@ -1232,6 +1386,12 @@
         default:
             break;
         }
+    
+    if( EPBInitPhaseMBDN == aPBook )
+        {
+        iTypeOfReading = EMailboxIdRead;
+        }
+
     return aPBook;
     }
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,9 +22,9 @@
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationinit3G_adn.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookoperationinittraces.h"
+#include "cmmphonebookoperationinitTraces.h"
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookoperationinit3g_adnTraces.h"
@@ -118,7 +118,7 @@
 
     phoneBookData->GetPhoneBookName( phonebookTypeName );
     // Store phonebook name
-    mmPhoneBookOperationInit3G_adn->iPhonebookType = phonebookTypeName;
+    mmPhoneBookOperationInit3G_adn->iPhoneBookTypeName = phonebookTypeName;
 
     if( 0 == phonebookTypeName.CompareF( KInternalPhoneBookType ) )
         {
@@ -126,7 +126,6 @@
         }
     else // Full construction is not needed in case of internal initilization
         {
-        mmPhoneBookOperationInit3G_adn->iTransactionId = ETrIdPbInit;
         mmPhoneBookOperationInit3G_adn->ConstructL();
         }
     mmPhoneBookOperationInit3G_adn->iMmPhoneBookStoreMessHandler =
@@ -192,7 +191,8 @@
 TInt CMmPhoneBookOperationInit3G_adn::UICCCreateReq
     (
     TInt aIpc,
-    const CMmDataPackage* /*aDataPackage*/
+    const CMmDataPackage* /*aDataPackage*/,
+    TUint8 aTransId
     )
     {
     TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCCreateReq" );
@@ -215,11 +215,10 @@
                     }
 
                 iServiceType = UICC_APPL_FILE_INFO;
-                iExtensionPresent = EFalse; // Default Extension is not present
 
                 // Start Initialization for ADN phonebook 3G
                 iIniPhase = EPBInitPhase_3GADN_PBR;
-                ret = UICCInitializeReq3GADN();
+                ret = UICCInitializeReq3GADN( aTransId );
                 }
             else  // else for if internalInit goign on
                 {
@@ -249,7 +248,7 @@
 // For USIM Separate different request to correct function
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN()
+TInt CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN( TUint8 aTransId)
     {
     TInt ret(KErrNone);
 
@@ -260,7 +259,7 @@
         TUiccReadLinearFixed cmdParams;
         cmdParams.messHandlerPtr =
             static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
-        cmdParams.trId = ETrIdPbInit;
+        cmdParams.trId = static_cast<TUiccTrId>( aTransId );
 
         cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
         cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
@@ -394,15 +393,16 @@
 // -----------------------------------------------------------------------------
 //
 
-TInt CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL
+TBool CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL
         (
-        TBool &aComplete,
         TInt aStatus,
+        TUint8 /*aDetails*/,
         const TDesC8 &aFileData,
-        TInt /*aTransId*/
+        TInt aTransId
         )
     {
     TInt ret( KErrNone );
+    TBool complete( EFalse );
 
     // break immediatelly in case of internal init
     if ( iInternalInit )
@@ -414,7 +414,7 @@
         iIniPhase = EPBIniPhase_Unknown;
 
         iInternalInit = EFalse;
-        aComplete = ETrue;
+        complete = ETrue;
         return KErrNone;
         }
 
@@ -428,7 +428,7 @@
             TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN PhoneBook Init" );
             OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN Phonebook init" );
 
-            ret = HandleUICCPbResp3GADN( aFileData, aStatus );
+            ret = HandleUICCPbResp3GADN( aFileData, aStatus, aTransId );
             }
             break;
             case EPBInitPhaseFDN:
@@ -440,7 +440,7 @@
             OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Other Phonebook Init" );
 
             // For all other phoenbook handling is same as 2g Phonebook
-            ret = HandlePBRespL( aFileData, aStatus );
+            ret = HandlePBRespL( aFileData, aStatus, aTransId );
             }
             break;
             default:
@@ -453,7 +453,7 @@
          if ( KErrNone != ret || EPBIniPhase_PBInitialized == iIniPhase )
              {
              CPhoneBookDataPackage phoneBookData;
-             phoneBookData.SetPhoneBookName( iPhonebookType );
+             phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
              phoneBookData.PackData( iPBStoreInfoData );
 
              if ( UICC_STATUS_OK != aStatus )
@@ -466,9 +466,9 @@
                      &phoneBookData,
                      ret );
 
-             aComplete = ETrue;
+             complete = ETrue;
              }
-    return ret;
+    return complete;
 
     }
 // -----------------------------------------------------------------------------
@@ -479,7 +479,8 @@
 TInt CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN
     (
     const TDesC8& aFileData,
-    TInt aStatus)
+    TInt aStatus,
+    TUint8 aTransId )
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN");
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESP3GADN, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN" );
@@ -496,17 +497,10 @@
                     // For File Info , get the no of records in PBR file to get the total no of entries in 3G ADN phonebook
                     if( UICC_APPL_FILE_INFO == iServiceType )
                         {
-                        // Extract Number of records in PBR EF
-                        offSet = aFileData.Find( &KTagFCIFileDescriptor,1 );
-                        if( offSet != KErrNotFound )
-                            {
-                            // Number of entries is 1 byte long
-                            //iNumOfPBRRecords = aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR];
-                            // get the no of records in PBR file
-                            HandleFcpData(aFileData, iNumOfPBRRecords, KNoOfRecords);
+                        TFci fci( aFileData );
+                        iNumOfPBRRecords = fci.GetNumberOfRecords();
 
-                            ret = KErrNone;
-                            }
+                        ret = KErrNone;
                         iServiceType = UICC_APPL_READ_LINEAR_FIXED;
                         }
                     else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
@@ -585,12 +579,12 @@
                 iIniPhase = GetNextAvailablePbUicc( UICC_FDN_SERVICE_NUM );
                 }
             iServiceType = UICC_APPL_FILE_INFO;
-            ret = UICCInitializeReq();
+            ret = UICCInitializeReq( aTransId );
             }
         else
             {
             // Call Create request for next phase
-            ret = UICCInitializeReq3GADN();
+            ret = UICCInitializeReq3GADN( aTransId );
             }
         }
 
@@ -627,7 +621,7 @@
         primTag.tagValue = aFileData[offset + i];
 
         // get the File ID which is 2byte long
-        Get16bit(primTag.tagFID, aFileData, ( offset+i+2 ));
+        primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData, ( offset+i+2 ));
 
         // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
         if(KLengthWithSFI == aFileData[offset + i+1])
@@ -681,7 +675,7 @@
         // Get the Tag name
         primTag.tagValue = aFileData[offset+i];
         // get the File ID which is 2byte long
-        Get16bit(primTag.tagFID, aFileData, ( offset+i+2 ));
+        primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData, ( offset+i+2 ));
 
         // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
         if(KLengthWithSFI == aFileData[offset+i+1])
@@ -737,7 +731,8 @@
             primTag.tagValue = aFileData[offset+i];
 
             // get the File ID which is 2byte long
-            Get16bit( primTag.tagFID, aFileData, ( offset+i+2 ));
+            primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData,
+            	                                          ( offset + i + 2 ));
 
             // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
             if(KLengthWithSFI == aFileData[offset+i+1])
@@ -785,11 +780,10 @@
     if( UICC_STATUS_OK  == aStatus )
         {
         // Get the Record length for all linear fixed and circular EF's
-        HandleFcpData(aFileData, recordLength, KRecordLength);
-
-        // Get the no of records
-        HandleFcpData(aFileData, noOfRecords, KNoOfRecords);
-
+        TFci fci( aFileData );
+        recordLength = fci.GetRecordLength();
+        noOfRecords = fci.GetNumberOfRecords();
+			
         // Check for No of records in Type 1 file
         if( UICC_EF_ADN_TAG != tagValue )
             {
@@ -963,12 +957,11 @@
     if( UICC_STATUS_OK  == aStatus )
         {
         // Get the Record length for all linear fixed and circular EF's
-        HandleFcpData(aFileData, recordLength, KRecordLength);
+        TFci fci( aFileData );
+        recordLength = fci.GetRecordLength();
+        noOfRecords = fci.GetNumberOfRecords();
+        }
 
-        // get no of records
-        HandleFcpData(aFileData, noOfRecords, KNoOfRecords);
-
-        }
     // Get the tag value for current File
     TUint tagValue = iType2FileArray[iCurrentArrayCounter].tagValue;
 
@@ -1072,10 +1065,9 @@
 
     if( UICC_STATUS_OK  == aStatus )
         {
-        // Get the Record length for all linear fixed and circular EF's
-        HandleFcpData(aFileData, recordLength, KRecordLength);
-
-        HandleFcpData(aFileData, noOfRecords, KNoOfRecords);
+        TFci fci( aFileData );
+        recordLength = fci.GetRecordLength();
+        noOfRecords = fci.GetNumberOfRecords();
         }
 
     // Get the tag value for current File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationread.h"
 #include "cmmphonebookoperationread3g_adn.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookoperationreadtraces.h"
+#include "cmmphonebookoperationreadTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -64,12 +64,13 @@
 
 CMmPhoneBookOperationRead::CMmPhoneBookOperationRead()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::CMmPhoneBookOperationRead");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::CMmPhoneBookOperationRead");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_CMMPHONEBOOKOPERATIONREAD, "CMmPhoneBookOperationRead::CMmPhoneBookOperationRead" );
 
     iNumOfEntriesToRead = 0;
     iNumOfEntriesFilled = 0;
     iIndexToRead = 0;
+    iTypeOfReading = EBasicEfRead;
     }
 
 // -----------------------------------------------------------------------------
@@ -82,7 +83,7 @@
     // None
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_CMMPHONEBOOKOPERATIONREAD, "CMmPhoneBookOperationRead::~CMmPhoneBookOperationRead" );
     }
 
@@ -95,10 +96,11 @@
 CMmPhoneBookOperationRead* CMmPhoneBookOperationRead::NewL
     (
     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+    CMmUiccMessHandler* aUiccMessHandler,
     const CMmDataPackage* aDataPackage // Data
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::NewL");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::NewL");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_NEWL, "CMmPhoneBookOperationRead::NewL" );
 
     TName phonebookTypeName;
@@ -110,12 +112,16 @@
         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
 
     phoneBookData->GetPhoneBookName( phonebookTypeName );
-
-    mmPhoneBookOperationRead->iTransactionId = ETrIdPbRead;
-
+    
+    // Store phoen Book name 
+    mmPhoneBookOperationRead->iPhoneBookTypeName = phonebookTypeName;
+    // get the Transaction id for Phone book and operation combination
+    mmPhoneBookOperationRead->iLocationSearch = EFalse;
     mmPhoneBookOperationRead->iMmPhoneBookStoreMessHandler =
         aMmPhoneBookStoreMessHandler;
 
+    mmPhoneBookOperationRead->iMmUiccMessHandler = aUiccMessHandler;
+
     return mmPhoneBookOperationRead;
     }
 
@@ -129,7 +135,7 @@
     // None
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::ConstructL");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::ConstructL");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_CONSTRUCTL, "CMmPhoneBookOperationRead::ConstructL" );
     }
 
@@ -144,10 +150,11 @@
 TInt CMmPhoneBookOperationRead::UICCCreateReq
     (
     TInt aIpc,
-    const CMmDataPackage* aDataPackage
+    const CMmDataPackage* aDataPackage,
+    TUint8 aTransId
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::UICCCreateReq");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::UICCCreateReq");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_UICCCREATEREQ, "CMmPhoneBookOperationRead::UICCCreateReq" );
 
     TInt ret( KErrNotSupported );
@@ -155,9 +162,13 @@
     const CPhoneBookDataPackage* phoneBookData =
         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
 
+    iSavedIPCForComplete = aIpc;
+    
     switch( aIpc )
         {
         case EMmTsyPhoneBookStoreReadIPC:
+        case EMmTsyONStoreReadIPC:
+        case EMmTsyONStoreReadEntryIPC:
             {
             CArrayPtrSeg<CPhoneBookStoreEntry>* prtToReadEntriesArray;
             RMobilePhoneBookStore::TPBIndexAndNumEntries* ptrToIndexAndEntries;
@@ -172,38 +183,14 @@
                 iNumOfEntriesFilled = 0;
                 iIndexToRead = ptrToIndexAndEntries->iIndex;
 
-                // get the Service type to be read
-                iServiceType = UICC_APPL_FILE_INFO;
-
-
-                // Handle ADN Phonebook
-
-
-                    switch(iMmUiccMessHandler->GetCardType())
-                        {
-                        case UICC_CARD_TYPE_ICC:
-                            {
-                            ret = USimPbReqRead( 0 );
-                            }
-                            break;
-                        case UICC_CARD_TYPE_UICC:
-                            {
-                            }
-                            break;
-                        case UICC_CARD_TYPE_UNKNOWN:
-                            break;
-                        default:
-                            break;
-                        }
+                ret = USimPbReqRead( iIndexToRead, aTransId );
                 }
-
             break;
             }
         default:
             {
             // Nothing to do here
-            TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::UICCCreateReq - \
-            Unknown IPC: %d", aIpc);
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::UICCCreateReq - Unknown IPC: %d", aIpc);
 OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_UICCCREATEREQ, "CMmPhoneBookOperationRead::UICCCreateReq;aIpc=%d", aIpc );
             break;
             }
@@ -220,184 +207,162 @@
 //
 TInt CMmPhoneBookOperationRead::USimPbReqRead
     (
-    TInt aRecordNo
+    TInt aRecordNo,
+    TUint8 aTransId
     )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead" );
 
     TInt ret( KErrNone );
-    // Get phonebook type from transactionId and convert it to USim pbtype
-    TUint16 simPhonebookType( ConvertToSimPhoneBookType(
-        iTransactionId & KMaskPhonebookType ) ); // Service type
-
     // get the index to be read from phonebook
     TInt index( iIndexToRead );
 
     TUiccReadLinearFixed cmdParams;
-    //cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> iMmPhoneBookStoreMessHandler;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
 
-    cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE >> 8 ));
-    cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE ));
-    //cmdParams.filePath.Copy(aApplFieldId);
-    cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK ));
-
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    cmdParams.record = aRecordNo;
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    // Convert Phone Book name to file id
+    TUint16 fileIdExt ( 0x0000 );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
+    
     // get the corect Location to be read from phone book
-    if( PB_MBDN_FID == simPhonebookType)
+    if( PB_MBDN_FID == pbFileId)
         {
         // Index to be read contains two types of information.
         // The least significant byte contains the profile number
         // and the most significant byte contains the type.
         index = index || 0x0100; // Only subscriber profile number 1 is supported
-        }
 
-    // Read phonebook elementary file to get the Entry information
-    if( !iExtensionRead )
-        {
-        cmdParams.trId = ETrIdPbRead;
-        cmdParams.fileId = simPhonebookType;
-
-        if( iServiceType == UICC_APPL_READ_LINEAR_FIXED )
-            {
-            cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-            // Least significant byte gives the actual record no. to be read
-            cmdParams.record = aRecordNo;
-            }
-        else if(iServiceType == UICC_APPL_FILE_INFO)
-            {
-            cmdParams.serviceType = UICC_APPL_FILE_INFO;
-            }
-        }
-    else
-        {
-        switch( simPhonebookType )
+        if ( EMailboxIdRead == iTypeOfReading )
             {
-            case PB_ADN_FID:
-                {
-                // For 2G ADN Phonebook EXT1 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT1_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_FDN_FID:
-                {
-                // For FDN Phonebook EXT2 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT2_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_SDN_FID:
-                {
-                // For SDN Phonebook EXT3 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT3_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_BDN_FID:
-                {
-                // For BDN Phonebook EXT4 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT4_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_MBDN_FID:
-                {
-                // For MBDN Phonebook EXT6 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT6_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_MSISDN_FID:
-                {
-                // For MSISDN Phonebook EXT5 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT5_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
-            case PB_VMBX_FID:
-                {
-                // For VMBX Phonebook EXT2 will be the extension number store
-                cmdParams.trId = ETrIdPbRead;
-                cmdParams.fileId = PB_EXT2_FID;
-
-                if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                    cmdParams.record = aRecordNo;
-                    }
-                else if( UICC_APPL_FILE_INFO == iServiceType )
-                    {
-                    cmdParams.serviceType = UICC_APPL_FILE_INFO;
-                    }
-                break;
-                }
+            iTypeOfReading = EBasicEfRead;
+            }
+        else
+            {
+            iTypeOfReading = EMailboxIdRead;
             }
         }
 
-    ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
-        CreateUiccApplCmdReq( cmdParams );
-    TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+    // Check for Extension Data is Present or not
+    if ( EBasicEfRead == iTypeOfReading )
+        {
+        cmdParams.fileId = pbFileId;
+        // Check for the record Number to be read is valid record number
+        if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[arrayIndex].iNoOfRecords)
+            {
+            // Check for Number of Slots To be Read
+            if( iNumOfEntriesToRead > 0)
+                {
+                // Check for Valid PhoneBook Entry no.
+                if( iIndexToRead > 0)
+                    {
+                    // Read Request to read that index
+                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                    cmdParams.record = iIndexToRead;
+                    // till End of Record
+                    cmdParams.dataAmount = 0;
+                    // Start from begining of record
+                    cmdParams.dataOffset = 0;
+                    }
+                else
+                    {
+                    // Start from first location and Search for First Valid
+                    // Entry in the Stored List and if some Entry is invalid
+                    // then Read From Sim and Check the Staus its Free
+                    // or not till Number of slots to be read equals to 0
+
+                    // Read Request to read that index
+                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                    // read First record
+                    iIndexToRead = 1;
+                    cmdParams.record = iIndexToRead;
+                    // till End of Record
+                    cmdParams.dataAmount = 0;
+                    // Start from begining of record
+                    cmdParams.dataOffset = 0;
+
+                    // Set Flag for first valid Entry location Search
+                    iLocationSearch = ETrue;
+                    }
+                }
+            }
+        else
+            {
+            // return error for invalid Entry (Out of max range idf entries)
+            ret = KErrArgument;
+            }
+        }// end of if case for checking extension data
+    else if  ( EExtensionRead == iTypeOfReading )
+        {
+        // Send Request to Read Extension Data
+        // Check for UST Table supports for EXT File
+        if ( iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtension )
+            {
+            // Check for Extension data record in valid
+            if ( iMmPhoneBookStoreMessHandler->
+                     iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo )
+                {
+                // Read Request to read that index
+                cmdParams.fileId = fileIdExt;
+                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                cmdParams.record = aRecordNo;
+                // till End of Record
+                cmdParams.dataAmount = 0;
+                // Start from begining of record
+                cmdParams.dataOffset = 0;
+                }
+            else
+                {
+                ret = KErrGeneral;
+                }
+            }
+        else
+            {
+            ret = KErrGeneral;
+            }
+        }
+
+    else
+        {
+        // Read mailbox ID
+        if ( iMmPhoneBookStoreMessHandler->
+                 iPBStoreConf[arrayIndex].iExtNoOfRec >= aRecordNo )
+            {
+            // Read Request to read MBI file
+            cmdParams.fileId = PB_MBI_FID;
+            cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+            cmdParams.record = aRecordNo;
+            // till End of Record
+            cmdParams.dataAmount = 0;
+            // Start from begining of record
+            cmdParams.dataOffset = 0;
+            }
+        else
+            {
+            ret = KErrGeneral;
+            }
+        }
+
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead;ret=%d", ret );
+        }
+    
     return ret;
     }
 
@@ -407,210 +372,272 @@
 
 
 // -----------------------------------------------------------------------------
-// CMmPhoneBookOperationRead::CreateReq
+// CMmPhoneBookOperationRead::HandleUICCPbRespL
 // Separate request
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationRead::HandleUICCPbRespL
+TBool CMmPhoneBookOperationRead::HandleUICCPbRespL
     (
-    TBool & /*aComplete*/,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8 &aFileData,
     TInt aTransId
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL" );
 
+    TBool complete( EFalse );
     TInt ret(KErrNone);
+    TInt retExt(KErrNone);
     // Initialize Application file ID to send in next request
     TBuf8<2> applFieldId;
-    applFieldId.Append(0x7F);
-    applFieldId.Append(0x10);
-
-    // Check for Error if returned from UICC Server
+    
 
     // Handle possible error case
     if ( UICC_STATUS_OK != aStatus )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespRead-\
-            Unsuccessfully completed by SIMSON");
-//OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL, Unsuccessfully completed by UICC Server" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL-Unsuccessfully completed by UICC");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL.  Unsuccessfully completed by UICC" );
+        
         ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus );
         }
 
-
-    // Get phonebook type from transactionId and convert it to USim pbtype
-    TUint16 simPhonebookType( ConvertToSimPhoneBookType(
-        iTransactionId & KMaskPhonebookType ) ); // Service type
+    // Convert Phone Book name to file id
+    TUint16 fileIdExt( 0x0000 );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
 
-    if(UICC_STATUS_OK == aStatus)
+    if ( UICC_STATUS_OK == aStatus )
         {
-        switch(aTransId)
+        if ( EBasicEfRead == iTypeOfReading )
             {
-            case ETrIdPbReadADN:
+            iStoreEntry = new ( ELeave ) TPBEntry();
+            // update Entry Data
+            iStoreEntry->iEntryIndex = iIndexToRead;
+
+            // check if Entry is valid Entry or Empty Entry
+            TInt retval = EmptyEntryCheck(aFileData);
+            
+            // if Entry is not empty
+            if( KErrNone == retval)
                 {
-                // handle USIM ADN phonebook read
-                //HandleUICC3gADNRespL(aStatus, aFileData, aTransId);
-                }
-                break;
-            case ETrIdPbRead:   // Same Read for all phonebook Type extension EF's
-                {
-                if(!iExtensionRead)
-                    {
-                    if(iServiceType == UICC_APPL_FILE_INFO)
-                        {
-                        // Check for the record no. to read is valid or not
-                        TInt offSet ( aFileData.Find(&KTagFCIFileDescriptor,1) );
-                        if(KErrNotFound != offSet )
-                            {
-                            // Number of entries is 1 byte long
-                            iNumOfPhoneBookRecords = aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR];
-                            // Get the record length
-                            // -14 is for data other than alpha string
-                            //Get16bit(iRecordLength, aFileData, (offSet+4) );
+                // Update Entry Status 
+                iStoreEntry->iEntryPresent = ETrue;
 
-                            if((iNumOfPhoneBookRecords*255) >= (iIndexToRead & 0x00FF))
-                                {
-                                // read that entry no
-                                iServiceType = UICC_APPL_UPDATE_LINEAR_FIXED;
-                                if(iNumOfEntriesToRead > 0)
-                                  {
-                                    // Mask iIndexToRead lower byte to get the entry no need to be read
-                                    USimPbReqRead( iIndexToRead && 0x00FF );
-                                  }
-                                else
-                                  {
-                                    ret = KErrNotSupported;
-                                  }
-                                }
-                            else
-                                {
-                                // invalid location to read
-                                ret = KErrGeneral;
-                                }
-                            }
-                        }
-                    else if(iServiceType == UICC_APPL_UPDATE_LINEAR_FIXED)
-                        {
-                        // to read next record
-                        iIndexToRead++;
-                        iNumOfEntriesToRead--;
-                        // Seperate Entry data form UICC Server response message
-                        // Case: <Data available to be filled into array>
-                        if ( UICC_STATUS_OK == aStatus )
-                            {
-                           TInt retval ( SeparatePhoneBookEntryFromUiccMsgL(
-                                   aFileData,
-                                   iNameBuf,
-                                   simPhonebookType) );
+                // Reset Flag for location Search when first Entry is found
+                iLocationSearch = EFalse;
+                
+                // Seperate Entry data form UICC Server response message
+                // Case: <Data available to be filled into array>
+                iMmPhoneBookStoreMessHandler->
+                    iPBStoreConf[arrayIndex].GetPBEntryFromUICCData( aFileData,
+                                                                 iNumberBuf,
+                                                                 iNameBuf);
+                
+                // Check for Is there any extension data
+                // And the Extension data record number is valid
+                // Index to read Extension file Data is Alpha string Length + 14
+                // minus 1 is for Array index Calculation (it starts from 0)
+                
+                if ( 0xFF == aFileData[ iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[arrayIndex].iAlphaStringlength+ 13]  )
+                    {
+                    // Append Entry to list
+                    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                  iStoreEntry,
+                                  arrayIndex );
+
+                    // Decrement the number of entries to be read when it is
+                    // stored in commonTSY Array
+                    iNumOfEntriesToRead--;
 
-                            if ( 0xFF == aFileData[iRecordLength] )  // Check for Is there any extension data
-                                {
-                                // the there is no extension data
-                                CPhoneBookStoreEntry* phoneBookStoreMsg =
-                                    new( ELeave ) CPhoneBookStoreEntry;
-                                CleanupStack::PushL( phoneBookStoreMsg );
-                                phoneBookStoreMsg->ConstructL();
+                    // the there is no extension data
+                    CPhoneBookStoreEntry* phoneBookStoreMsg =
+                    new( ELeave ) CPhoneBookStoreEntry;
+                    CleanupStack::PushL( phoneBookStoreMsg );
+                    phoneBookStoreMsg->ConstructL();
+                    iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                        iNameBuf,
+                        iNumberBuf,
+                        *phoneBookStoreMsg,
+                        pbFileId,
+                        iIndexToRead,
+                        iMailboxIdExist );
+                    TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
 
-                                if(KErrNone == retval)
-                                    {
-                                    StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg);
-                                    TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
-                                    iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
-                                    CleanupStack::Pop( phoneBookStoreMsg );
-                                    iNumOfEntriesFilled++;
-                                    TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
-                                    }
-                                else
-                                {
-                                    CleanupStack::PopAndDestroy( phoneBookStoreMsg );
-                                }
+                    iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
+                    CleanupStack::Pop( phoneBookStoreMsg );
+                    iNumOfEntriesFilled++;
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
+OstTrace1( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled );
+                    } // End of if Ext Data is not Present
+                else
+                    {
+                    iTypeOfReading = EExtensionRead;
+                    // Record no to be read from EXT File
+                    TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[arrayIndex].iAlphaStringlength + 13];
+                    
+                    // Append EXT record no.
+                    iStoreEntry->PBEntryExtRecord.Append( recordNo );
 
-                                // Check for Extension number present or not
-                                }
-                            else
-                                {
-                                USimPbReqRead( aFileData[iRecordLength] );
-                                iExtensionRead = ETrue;
-                                iServiceType = UICC_APPL_READ_LINEAR_FIXED;
-                                }
-                            }
+                    retExt = USimPbReqRead( recordNo, aTransId );
+                    // if while reading EXT error comes (for invalid Entry)than
+                    // read next entry
+                    if(( KErrNone != retExt ))
+                        {
+                        iNumOfEntriesToRead--;
+                        iTypeOfReading = EBasicEfRead;
                         }
+                    }                        
+                }
+            else
+                {
+                //Update Entry Status
+                iStoreEntry->iEntryPresent = EFalse;
+                // Reset Entry andd Append to the List 
+                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                     iStoreEntry,
+                     arrayIndex );
+
+                // Entry is Empty read next Entry
+                if(!iLocationSearch)
+                    {
+                    // Decrement the no of Entries to be read
+                    iNumOfEntriesToRead--;
                     }
-                else  // Handling for Extension Numbers
-                    {
-                    if(UICC_APPL_UPDATE_LINEAR_FIXED == iServiceType)
-                        {
-                        if(0xFF != aFileData[13])    // Check for next extension data record
-                            {
-                            // Store Number upto last byte
-                             iNumberBuf.Append(aFileData.Mid(1,11));
-                            // Again Send request to read next record number and appenf it in number
-                            iServiceType = UICC_APPL_READ_LINEAR_FIXED;
-                            USimPbReqRead( aFileData[13] );
-                           }
-                        else
-                            {
-                            // Check for length upto which no is stored
-                            TInt offset = aFileData.Find(&KTagUnusedbyte,1);
-                            // store Data
-                            iNumberBuf.Append(aFileData.Mid(1,offset));
+                }
+
+            // to read next record
+            iIndexToRead++;
+
+            }// End of without EXT File Data Case
 
-                            // the there is no extension data
-                            CPhoneBookStoreEntry* phoneBookStoreMsg =
-                                new( ELeave ) CPhoneBookStoreEntry;
-                            CleanupStack::PushL( phoneBookStoreMsg );
-                            phoneBookStoreMsg->ConstructL();
-
-                            StorePhonebookEntry(iNameBuf,iNumberBuf,*phoneBookStoreMsg);
-
-                            TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
-                            iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
-                            CleanupStack::Pop( phoneBookStoreMsg );
-                            iNumOfEntriesFilled++;
-                            TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - \
-                            Append entries into array %i",iNumOfEntriesFilled);
-                //OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD_HANDLEUSIMPBRESPL, "CMmPhoneBookOperationRead::HandleUSimPbRespL;Append entries into array=%d", iNumOfEntriesFilled );
+         // Handling for Extension Numbers
+        else if  ( EExtensionRead == iTypeOfReading )
+            {
+            // Check for next extension data record
+            if ( 0xFF != aFileData[UICC_EXT_REC_NO_OFFSET] )    
+                {
+                // Again Append the EXT no to Array
+                iStoreEntry->PBEntryExtRecord.Append(
+                      aFileData[UICC_EXT_REC_NO_OFFSET] );
 
 
-                            }
-                        }
+                // Store Number upto last byte
+                iNumberBuf.Append(aFileData.Mid(1,11));
+                // Again Send request to read next record number and appenf it
+                // in number
+                retExt = USimPbReqRead( 
+                    aFileData[UICC_EXT_REC_NO_OFFSET], aTransId );
+                if( KErrNone != retExt)
+                    {
+                    iNumOfEntriesToRead--;
+                    iTypeOfReading = EBasicEfRead;
                     }
                 }
-                break;
-            default:
-                // There is no such phonebook exist
-                ret = KErrGeneral;
-                break;
+            else
+                {
+                // Append Entry to list and reset all the EXT data
+                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                              iStoreEntry,
+                                              arrayIndex );
+
+                // Reset Extension File record
+                iExtensionRead = EFalse;
+
+                // Check for Extended Data is Addition number 
+                if( 0x02 == aFileData[0])
+                    {
+                    // Check for length upto which no is stored
+                    TInt offset = aFileData.Find(&KTagUnusedbyte,1);
+                    // store Data
+                    iNumberBuf.Append(aFileData.Mid(1,( offset - 1 )));
+                    // Decrement no of Entries to be read after Storing it to
+                    // CommonTSY Array in EXT data case
+                    iNumOfEntriesToRead--;
+
+                    // the there is extension data
+                    CPhoneBookStoreEntry* phoneBookStoreMsg =
+                    new( ELeave ) CPhoneBookStoreEntry;
+                    CleanupStack::PushL( phoneBookStoreMsg );
+                    phoneBookStoreMsg->ConstructL();
+
+                    iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                        iNameBuf,
+                        iNumberBuf,
+                        *phoneBookStoreMsg,
+                        pbFileId,
+                        iIndexToRead,
+                        iMailboxIdExist );
+
+                    TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+                    iPhoneBookStoreCacheArray->AppendL( phoneBookStoreMsg );
+                    CleanupStack::Pop( phoneBookStoreMsg );
+                    iNumOfEntriesFilled++;
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
+OstTrace1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled );
+
+                    }
+                }
+            }
+        else
+            {
+            // Read mailbox ID
+
+            // There are 4 bytes describing mailbox id and one of them can
+            // be valid at a time
+            // 1 Mailbox Dialling Number Identifier – Voicemail
+            // 2 Mailbox Dialling Number Identifier – Fax
+            // 3 Mailbox Dialling Number Identifier – Electronic Mail
+            // 4 Mailbox Dialling Number Identifier – Other
+
+            for ( TUint8 i( 0 ); i < 4; i++ )
+                {
+                iMailboxIdExist = EFalse;
+                if ( 0 != aFileData[i] )
+                    {
+                    iMailboxIdExist = ETrue;
+                    iIndexToRead = aFileData[i];
+                    break;
+                    }
+                }
+
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
+            }
+
+        if( ( ( EBasicEfRead == iTypeOfReading ) ||
+              ( EMailboxIdRead == iTypeOfReading ) ) &&
+              ( 0 != iNumOfEntriesToRead ) )
+            {
+            ret = USimPbReqRead( iIndexToRead, aTransId );
             }
         }
 
-        // Case: <complete request>
-        if ( KErrNone != ret || 0 == iNumOfEntriesToRead )
+    // Complete request
+    if( ( KErrNone != ret )|| ( 0 == iNumOfEntriesToRead ))
+        {
+        // Check fo Any Entries Found
+        if( ( UICC_STATUS_OK == aStatus )&& ( 0 == iNumOfEntriesFilled ) )
             {
-            // If no entries found
-            if ( 0 == iNumOfEntriesFilled )
-                {
-                ret = KErrNotFound;
-                }
-
-            TName phoneBookName;
-            CPhoneBookDataPackage phoneBookData;
+            ret = KErrNotFound;
+            }
+        
+        CPhoneBookDataPackage phoneBookData;
+        phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+        iNumOfEntriesFilled = 0;
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+            iSavedIPCForComplete,
+            &phoneBookData,
+            ret );
 
-            // Convert number of phonebook type to Sim pbtype
-            ConvertToPBname( aTransId, phoneBookName );
-            phoneBookData.SetPhoneBookName( phoneBookName );
-            iNumOfEntriesFilled = 0;
-            iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
-                EMmTsyPhoneBookStoreReadIPC,
-                &phoneBookData,
-                ret );
-
-            iPhoneBookStoreCacheArray = NULL;
-            // Set flag to indicate that we can remove this operation from array
-            }
-    return ret;
+        iPhoneBookStoreCacheArray = NULL;
+        // Set flag to indicate that we can remove this operation from array
+        complete = ETrue;
+        }
+        
+    return complete;
     }
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread3g_adn.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread3g_adn.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,9 +22,9 @@
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "tsylogger.h"
 #include "cmmphonebookoperationread3g_adn.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookoperationreadtraces.h"
+#include "cmmphonebookoperationreadTraces.h"
 #include "OstTraceDefinitions.h"
 #include "cmmphonebookoperationread3g_adnTraces.h"
 #endif
@@ -93,7 +93,9 @@
 //
 CMmPhoneBookOperationRead3g_adn* CMmPhoneBookOperationRead3g_adn::NewL
     (
-// NONE
+            CMmPhoneBookStoreMessHandler* /*aMmPhoneBookStoreMessHandler*/,
+            CMmUiccMessHandler* /*aUiccMessHandler*/,
+            const CMmDataPackage* /*aDataPackage*/ // Data
     )
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::NewL");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,1762 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <etelmm.h>
+#include <tisi.h>
+#include <pn_const.h>
+#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
+#include <etelmmerr.h>      // For error code
+#include <ctsy/serviceapi/gsmerror.h>       // For error code
+#include "tsylogger.h"
+#include "cmmmessagerouter.h"
+#include "cmmphonebookoperationwrite.h"
+#include "cmmphonebookalphastring.h"
+#include "osttracedefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmmphonebookoperationwritetraces.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+    // None
+
+// EXTERNAL FUNCTION PROTOTYPES
+    // None
+
+// CONSTANTS
+
+// MACROS
+    // None
+
+// LOCAL CONSTANTS AND MACROS
+    // None
+
+// MODULE DATA STRUCTURES
+    // None
+
+// LOCAL FUNCTION PROTOTYPES
+    // None
+
+// ==================== LOCAL FUNCTIONS =====================================
+    // None
+
+
+// ================= MEMBER FUNCTIONS =======================================
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::\
+        CMmPhoneBookOperationWrite");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_CMMPHONEBOOKOPERATIONWRITE, "CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite" );
+    iPhoneBookEntry = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//
+CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::\
+        ~CMmPhoneBookOperationWrite");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_CMMPHONEBOOKOPERATIONWRITE, "CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite" );
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::NewL
+// Creates a new CMmPhonebookOperationWrite object instance.
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+
+CMmPhoneBookOperationWrite* CMmPhoneBookOperationWrite::NewL(
+    CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+    const CMmDataPackage* aDataPackage ) // Data
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::NewL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_NEWL, "CMmPhoneBookOperationWrite::NewL" );
+
+    TName phonebookTypeName;
+
+    CMmPhoneBookOperationWrite* mmPhoneBookOperationWrite =
+        new( ELeave ) CMmPhoneBookOperationWrite();
+
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+    phoneBookData->GetPhoneBookName( phonebookTypeName );
+    // Store phonebook name 
+    mmPhoneBookOperationWrite->iPhoneBookTypeName = phonebookTypeName;
+
+    mmPhoneBookOperationWrite->iMmPhoneBookStoreMessHandler =
+        aMmPhoneBookStoreMessHandler;
+
+    return mmPhoneBookOperationWrite;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::ConstructL
+// Initialises object attributes.
+// ---------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationWrite::ConstructL()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::ConstructL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_CONSTRUCTL, "CMmPhoneBookOperationWrite::ConstructL" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// TInt CMmPhoneBookOperationWrite::CreateReq
+// Separate request
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UICCCreateReq
+        (
+        TInt aIpc,
+        const CMmDataPackage* aDataPackage,
+        TUint8 aTransId
+        )
+    {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationWrite::UICCCreateReq Ipc: %d", aIpc);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCCREATEREQ, "CMmPhoneBookOperationWrite::UICCCreateReq;aIpc=%hd", aIpc );
+    
+    TInt ret (KErrNone);
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+        if( aIpc == EMmTsyPhoneBookStoreWriteIPC )
+            {
+                TInt16 index( 0 );
+                // Store Entry to the operation which needs to be write in SIM
+                phoneBookData->UnPackData( index, iPhoneBookEntry );
+
+                if ( iPhoneBookEntry )
+                    {
+                    // get the index Number needs to be write
+                    iPhoneBookEntry->iLocation = static_cast<TUint16>( index );
+                    
+                    // Convert Phone Book name to file id
+                    TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
+                    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+                    TUint8 pbArrayIndex ( ConvertToConfArrayIndex( pbFileId ) );
+
+                    if( PB_MBDN_FID == pbFileId )
+                        {
+                        // For MBDN PhoneBook first read MBI file 
+                        // Check if the mailbox inidcation type is correct
+                        if( index <= iMmPhoneBookStoreMessHandler->
+                                iPBStoreConf[pbArrayIndex].iMbiRecLen )
+                            {
+                            iCurrentWritePhase = EPBWritePhase_Read_MBI_profile;
+                            // read MBDN record number from MBI first record Profile number
+                            ret = UiccPbReqReadMBI( index, aTransId );
+                            }
+                        else
+                            {
+                            ret = KErrArgument;
+                            }
+                        }
+                    else
+                        {
+                        ret = UiccPbReqWriteL( aTransId, index, *iPhoneBookEntry );
+                        }
+                    }
+            }
+        else
+            {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationWrite::UICCCreateReq Unknown Ipc: %d", aIpc);
+OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONWRITE_UICCCREATEREQ, "CMmPhoneBookOperationWrite::UICCCreateReq;Unknown aIpc =%hd", aIpc );
+            }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqWriteL
+// Constructs an ISI-message to read entry from SIM
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqWriteL(
+        TUint8 aTransId,
+        TInt16 aIndex,
+        CPhoneBookStoreEntry& aDataToWrite )
+    {
+TFLOGSTRING3("TSY: CMmPhoneBookOperationWrite::SimPbReqWriteL, aTransId:%d,index:%d", aTransId,  aIndex);
+OstTraceExt2( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEL, "CMmPhoneBookOperationWrite::UiccPbReqWriteL;aTransId=%hhu;aIndex=%hd", aTransId, aIndex );
+    
+    TInt ret( KErrNone );
+    // Check for no of EXT records required for Writing this Entry
+    TUint8 extRecordNo ( 0 ); 
+
+    if( UICC_EF_FDN_NO_EXT_NUM_LEN < iPhoneBookEntry->iNumber->Length() )
+        {
+        extRecordNo++;
+        TInt extDataLength = iPhoneBookEntry->iNumber->Length() - 
+                             UICC_EF_FDN_NO_EXT_NUM_LEN;
+        while ( extDataLength > UICC_EF_EXT_REC_NUM_LEN)
+            {
+            extRecordNo++;
+            extDataLength = extDataLength - UICC_EF_EXT_REC_NUM_LEN;
+            }
+        }
+        
+    // reserve Space for ext record no
+    iExtRecordArrayToBeWrite.ReserveL( extRecordNo );
+    // File reserved memory with 0
+    for( TInt count = 0; count < extRecordNo; count++ )
+        {
+        iExtRecordArrayToBeWrite.Insert( 0 , count );
+        }
+
+    // Convert Phone Book name to file id
+    TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+
+    if( UICC_ILLEGAL_FILE_ID != pbFileId )
+        {
+        TUint8 pbArrayIndex ( ConvertToConfArrayIndex( pbFileId ) );
+
+        // Check if the index To read is valid
+        if(  aIndex <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[pbArrayIndex].iNoOfRecords )
+            {
+            // if Entry present in list Store it locally
+            TPBEntry entry;
+            if( 0 < aIndex )
+                {
+                // Check for index present the store list
+                if( iMmPhoneBookStoreMessHandler->IndexCheckInPBList(
+                        aIndex,
+                        pbArrayIndex,
+                        entry ) )
+                    {
+                    // Check if Entry is present or not 
+                    if( entry.iEntryPresent )
+                        {
+                        // Check if no if ext records are sufficient from previous Entry
+                        if( extRecordNo  > entry.PBEntryExtRecord.Count() )
+                            {
+                            // Update old record number which needs to be updated by new entry
+                            if( entry.PBEntryExtRecord.Count() > 0 )
+                                {
+                                for( TInt i=0; i <  entry.PBEntryExtRecord.Count(); i++ )
+                                    {
+                                    // Append record number to be write from old Entry
+                                    iExtRecordArrayToBeWrite.Append( 
+                                            entry.PBEntryExtRecord[i] );
+                                    iExtRecordArrayToBeDelete.Append( 
+                                            entry.PBEntryExtRecord[i] );
+                                    }
+                                }
+                            // Search for more free records
+                            iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                            
+                            // Send request to read first entry in Ext
+                            iExtRecordNo = 1 ;
+                            ret = UiccPbReqWriteReadExt(
+                                    pbFileId,
+                                    fileIdExt,
+                                    iExtRecordNo,
+                                    aTransId);
+                            }
+                        else  // when reocrds to be delete and write are 0 or to be write record less
+                            {
+                            // Check of both records are 0
+                            if( ( extRecordNo == 0 ) && 
+                                    ( entry.PBEntryExtRecord.Count() == 0 ))
+                                {
+                                // Start Writing Entry
+                                iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                                ret = UiccPBReqWriteEntry( 
+                                        pbFileId,
+                                        aIndex,
+                                        aTransId,
+                                        aDataToWrite );
+                                }
+                            else
+                                {
+                                // Start copy Ext record number to be write array
+                                for( TInt i=0; i <  extRecordNo; i++ )
+                                    {
+                                    // Append record number to be write from old Entry
+                                    iExtRecordArrayToBeWrite.Append(
+                                            entry.PBEntryExtRecord[i]);
+                                    iExtRecordArrayToBeDelete.Append(
+                                            entry.PBEntryExtRecord[i]);
+                                    }
+                                // Update records needs to be deleted
+                                // From old Entry
+                                for( TInt i=extRecordNo; i <  entry.PBEntryExtRecord.Count(); i++ )
+                                    {
+                                    // Append record number to be deleted from old Entry
+                                    iExtRecordArrayToBeDelete.Append( 
+                                            entry.PBEntryExtRecord[i]);
+                                    }
+                                // Start Deleting the EXT Records
+                                iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+                                iExtDeleteOperation = ETrue;
+                                TUint8 index ( iExtRecordArrayToBeDelete[0] );
+                                // Send request to Write main Entry
+                                ret = UiccPbReqWriteExtDelete(
+                                        pbFileId,
+                                        fileIdExt,
+                                        index,
+                                        aTransId );
+                                }
+                            }
+                        }
+                    else
+                        {
+                        // If entry not present
+                        // Check if EXT Records are needed for Entry to be written
+                        if( 0 < extRecordNo )
+                            {
+                            // Search for free ext records 
+                            iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                            
+                            // Send request To read First EXT record
+                            iExtRecordNo = 1;
+                            ret = UiccPbReqWriteReadExt(
+                                    pbFileId,
+                                    fileIdExt,
+                                    iExtRecordNo,
+                                    aTransId );
+                            }
+                        else
+                            {
+                            // Start Writting Entry
+                            iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                            TUint8 indexToWrite = iPhoneBookEntry->iLocation;
+                            ret = UiccPBReqWriteEntry(
+                                    pbFileId,
+                                    indexToWrite,
+                                    aTransId,
+                                    aDataToWrite );
+                            }
+                        }
+                    }   // end of if Entry is present in the list
+                else
+                    {
+                    // First Read that Entry from SIM and then delete that entry with EXT records if there are Any
+                    iCurrentWritePhase = EPBWritePhase_Read_Entry;
+                    ret = UiccPbReqWriteRead( pbFileId, aIndex, aTransId );
+                    
+                    // read Main entry with given index number
+                    }
+                }
+            else
+                {
+                // Start Serching For first free Entry in the Stored list
+                TInt index = iMmPhoneBookStoreMessHandler->
+                EmptyEntryCheckInPBList( pbArrayIndex );
+                if( 0 < index )
+                    {
+                    //Check if EXT records Are needed or not
+                    if( 0 < extRecordNo )
+                        {
+                        // Start Serching for EXT records
+                        // Search for free ext records 
+                        iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                            
+                        // Send request To read First EXT record
+                        iExtRecordNo = 1;
+                        ret = UiccPbReqWriteReadExt(
+                                pbFileId,
+                                fileIdExt,
+                                iExtRecordNo,
+                                aTransId );
+                        }
+                    else
+                        {
+                        // Start Writing Entry on given Index
+                        // Start Writting Entry
+                        iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                        ret = UiccPBReqWriteEntry(
+                                pbFileId,
+                                index,
+                                aTransId,
+                                aDataToWrite );
+                        }
+                    }
+                else
+                    {
+                    // Start searching for first free Entry from SIM
+                    iCurrentWritePhase = EPBWritePhase_Read_Entry;
+                    iLocationSearch = ETrue;
+                    iEntryToWrite = 1;
+                    ret = UiccPbReqWriteRead(
+                            pbFileId,
+                            iEntryToWrite,
+                            aTransId );
+                    }
+                }
+            }
+        else
+            {
+            ret = KErrArgument;
+            }            
+        }
+    else
+        {
+        ret = KErrArgument;
+        }
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPBReqWriteEntry
+// Constructs an ISI-message to Write main Entry data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPBReqWriteEntry( TUint16 aFileId, TUint8 aIndex, TUint8 aTransId, CPhoneBookStoreEntry& aDataToWrite )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPBReqWriteEntry");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEENTRY, "CMmPhoneBookOperationWrite::UiccPBReqWriteEntry" );
+
+    TInt ret( KErrNone );
+    
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+    cmdParams.fileId = aFileId;
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    // Check for valid record number
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iNoOfRecords )
+        {
+        cmdParams.record = aIndex;
+        }
+    else
+        {
+        ret = KErrArgument;
+        }
+    
+    
+    TBuf8<241>nameBuf;
+    
+    TPtr16 ptrToName = aDataToWrite.iText->Des();
+    // Convert the Entry Name from ASCII format to UCS2
+    CMmStaticUtility::ConvertUcs2ToGsmUcs2Data( ptrToName, nameBuf );
+    if( nameBuf.Length() < iMmPhoneBookStoreMessHandler->
+                           iPBStoreConf[ arrayIndex ].iAlphaStringlength )
+        {
+        // Fill rest of the Bytes 
+        for( TInt count = nameBuf.Length(); count < ( iMmPhoneBookStoreMessHandler->
+                      iPBStoreConf[ arrayIndex ].iAlphaStringlength ); count++ )
+            {
+            nameBuf.Append( KTagUnusedbyte );
+            }
+        }
+    TBuf8<300>numberBuf;
+    TPtr16 ptrToNumber = aDataToWrite.iNumber->Des();
+    iMmPhoneBookStoreMessHandler->ConvertToBCDFromUCS2(
+                                  ptrToNumber,
+                                  numberBuf,
+                                  aFileId );
+    
+    // Store number length
+    TUint8 numLength ( numberBuf.Length() );
+    
+    if( numberBuf.Length() < UICC_EF_EXT_REC_NUM_LEN )
+        {
+        // fill  rest of the bytes
+        for( TInt count = numberBuf.Length(); count < UICC_EF_EXT_REC_NUM_LEN; count++)
+            {
+            numberBuf.Append( KTagUnusedbyte );
+            }
+        }
+    
+    TBuf8<200>fileDataWrite;
+    fileDataWrite.Append( nameBuf.Mid( 0, iMmPhoneBookStoreMessHandler->
+                          iPBStoreConf[ arrayIndex ].iAlphaStringlength ) );
+    fileDataWrite.Append( numLength );
+    fileDataWrite.Append( numberBuf.Mid( 0, UICC_EF_EXT_REC_NUM_LEN ) );
+    // Append Capability configuration byte as not used
+    fileDataWrite.Append( KTagUnusedbyte );
+
+    // Chekc for EXT Data is present or not
+    if( 0 < iExtRecordArrayToBeWrite.Count() )
+        {
+        // Append Extension recorNo from iExtRecordArray to be write
+        fileDataWrite.Append( iExtRecordArrayToBeWrite[0] );
+        }
+    else
+        {
+        // there is no EXT record
+        fileDataWrite.Append( KTagUnusedbyte );
+        }
+    
+    // Append 
+    cmdParams.fileData.Append( fileDataWrite );
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEENTRY, "CMmPhoneBookOperationWrite::UiccPBReqWriteEntry;ret=%hd", ret );
+        
+        }
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqWriteExt
+// Constructs an ISI-message to Write EXT Data 
+// ---------------------------------------------------------------------------
+//
+
+TInt CMmPhoneBookOperationWrite::UiccPbReqWriteExt(
+        TUint8 aTransId,
+        TUint8 aIndex,
+        TUint16 aFileId,
+        TUint16 aFileIdExt,
+        CPhoneBookStoreEntry& aDataToWrite )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqWriteExt");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBWRITEEXT, "CMmPhoneBookOperationWrite::UiccPbReqWriteExt" );
+    
+    TInt ret( KErrNone );
+    
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                                ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.fileId = aFileIdExt;
+    cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    
+    // File Data
+    TBuf8<255>numBuf;
+    TBuf8<13>extFileData;
+    TPtr16 ptrToNumber = aDataToWrite.iNumber->Des();
+
+    iMmPhoneBookStoreMessHandler->ConvertToBCDFromUCS2(
+                                  ptrToNumber,
+                                  numBuf,
+                                  aFileId );
+    
+        if( numBuf.Length() > ( 10 + ( iExtRecordWritten* 11 ) ))
+            {
+            // form EXt file Data
+            // Append Record type
+            extFileData.Append( 0x02 );
+            // Append Data
+            extFileData.Append( numBuf.Mid( 11 + ( iExtRecordWritten* 11 ), 
+                     ( numBuf.Length() - ( 11 + ( iExtRecordWritten* 11 ) ) ) ) );
+            // Check if Data ids less than 11
+            if( extFileData.Length() < 12 )
+                {
+                extFileData.AppendFill( 0xFF, ( 12 - extFileData.Length() ) );
+                }
+            // Check if there is more Ext Record to be write
+            if( iExtRecordArrayToBeWrite.Count() > 0 )
+                {
+                // Append record Number
+                extFileData.Append( iExtRecordArrayToBeWrite[0] );
+                }
+            else
+                {
+                extFileData.Append( 0xFF );
+                }
+            }
+        else
+            {
+            // Append Record type
+            extFileData.Append( 0x02 );
+            // Append Data
+            extFileData.Append( numBuf.Mid( 11 + ( iExtRecordWritten* 11 ), 11 ) );
+            
+            // Check if there is more Ext Record to be write
+            if( iExtRecordArrayToBeWrite.Count() > 0 )
+                {
+                // Append record Number
+                extFileData.Append( iExtRecordArrayToBeWrite[0] );
+                }
+            else
+                {
+                extFileData.Append( 0xFF );
+                }
+            }
+        
+        cmdParams.fileData.Append( extFileData );
+
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ));
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec )
+        {
+        cmdParams.record = aIndex;
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEEXT, "CMmPhoneBookOperationWrite::UiccPbReqWriteExt;ret=%hd", ret );
+        }
+    
+    return ret;
+    }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqWriteReadExt
+// Constructs an ISI-message to Read The existing Entry EXT record
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqWriteReadExt(
+             TUint16 aFileId,
+             TUint16 aFileIdExt,
+             TUint8 aIndex,
+             TUint8 aTransId)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqWriteEXTDelete");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEREADEXT, "CMmPhoneBookOperationWrite::UiccPbReqWriteReadExt" );
+    
+    TInt ret ( KErrNone );
+    
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    // Append transaction id 
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    
+    // Append File id
+    cmdParams.fileId = aFileIdExt;
+    
+    // Append serviceType
+    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    
+    
+    TUint8 arrayIndex( ConvertToConfArrayIndex( aFileId ) );
+    // Check for the valid index neds to be read
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec )
+        {
+        // Append recor number
+        cmdParams.record = aIndex;
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEREADEXT, "CMmPhoneBookOperationWrite::UiccPbReqWriteReadExt;ret=%hd", ret );
+        }
+
+    return ret;
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqWriteRead
+// Constructs an ISI-message to Read The existing Entry
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqWriteRead(
+                     TUint16 aFileId,
+                     TUint8 aIndex,
+                     TUint8 aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqWriteRead");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEREAD, "CMmPhoneBookOperationWrite::UiccPbReqWriteRead" );
+    
+    TInt ret ( KErrNone );
+    
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    cmdParams.fileId = aFileId;
+    cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iNoOfRecords )
+        {
+        cmdParams.record = aIndex;
+        }
+    else
+        {
+        ret = KErrOverflow;
+        }
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEREAD, "CMmPhoneBookOperationWrite::UiccPbReqWriteRead;ret=%hd", ret );
+        }
+
+    return ret;
+
+    }
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqWriteEXTDelete
+// Constructs an ISI-message to delete EXT File Data
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqWriteExtDelete(
+                  TUint16 aFileId,
+                  TUint16 aFileIdExt,
+                  TUint8 aIndex,
+                  TUint8 aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqWriteEXTDelete");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEEXTDELETE, "CMmPhoneBookOperationWrite::UiccPbReqWriteEXTDelete" );
+    
+    TInt ret ( KErrNone );
+    TBuf8<13>deleteEntryData;
+    
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    cmdParams.fileId = aFileIdExt;
+    cmdParams.serviceType =  UICC_APPL_UPDATE_LINEAR_FIXED ;
+    
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
+
+    
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec)
+        {
+        cmdParams.record = aIndex;
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+    
+    
+    // Append record Type Byte
+    deleteEntryData.Append( 0x00 );
+    // Fill Empty record Data
+    deleteEntryData.AppendFill( 0xFF, 11 );
+    // Fill the next record number
+    deleteEntryData.Append( 0xFF );
+    
+    cmdParams.fileData.Append( deleteEntryData );
+
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEEXTDELETE, "CMmPhoneBookOperationWrite::UiccPbReqWriteExtDelete;ret=%hd", ret );
+        }
+
+    return ret ;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqReadMBI
+// Constructs an ISI-message to Read MBI profile from first record 
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqReadMBI( TUint8 aIndex, TUint8 aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqReadMBI");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQREADMBI, "CMmPhoneBookOperationWrite::UiccPbReqReadMBI" );
+        
+        TInt ret ( KErrNone );
+        TUiccReadLinearFixed cmdParams;
+        cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                                   ( iMmPhoneBookStoreMessHandler );
+        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+        cmdParams.filePath.Append( APPL_FILE_ID>>8);
+        cmdParams.filePath.Append( APPL_FILE_ID);
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+        cmdParams.fileId = PB_MBI_FID;
+        cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
+        cmdParams.dataAmount = 1;
+        cmdParams.dataOffset = aIndex;
+        cmdParams.record = 1;   // only first profile number is supported
+        
+        
+        if( KErrNone == ret )
+            {
+            ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+                CreateUiccApplCmdReq( cmdParams );
+            }
+        return ret;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile
+// Send Request for MBBI Profile Write
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile( 
+        TUint8 aTransId,
+        TUint8 aIndex,
+        TUint8 aOperationType)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile");
+OstTrace0( TRACE_FATAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEMBIPROFILE, "CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile" );
+
+    TInt ret ( KErrNone );
+    
+    TUiccWriteLinearFixed cmdParams;
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+                               ( iMmPhoneBookStoreMessHandler );
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    cmdParams.filePath.Append( APPL_FILE_ID>>8);
+    cmdParams.filePath.Append( APPL_FILE_ID);
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    cmdParams.fileId = PB_MBI_FID;
+    cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
+    cmdParams.dataAmount = 1;
+    cmdParams.dataOffset = aIndex;
+    cmdParams.record = 1;   // only first profile number is supported
+    
+    if( KOperationDelete == aOperationType )
+        {
+        cmdParams.fileData.Append( 0 );
+        }
+    else
+        {
+        cmdParams.fileData.Append( iEntryToWrite );
+        }
+    
+    
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( cmdParams );
+        }
+
+    return ret;
+    
+    }
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::HandleUICCPbRespL
+// Separate response
+// ---------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationWrite::HandleUICCPbRespL(
+    TInt aStatus,
+    TUint8 aDetails,
+    const TDesC8& aFileData,
+    TInt aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleUICCPbRespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationWrite::HandleUICCPbRespL" );
+    
+    TBool complete ( EFalse );
+    TInt ret ( KErrNone );
+    
+    TUint16 fileIdExt ( 0x0000 );
+    TUint16 fileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    //// Check for PhoenBook Index for which needs to checked
+    TUint8 pbArrayIndex = ConvertToConfArrayIndex( fileId );
+
+    switch( iCurrentWritePhase )
+        {
+        case EPBWritePhase_Read_Entry:
+            {
+            ret = HandleWriteReadEntryResp(
+                  aStatus,
+                  aFileData,
+                  aTransId,
+                  fileId,
+                  fileIdExt,
+                  pbArrayIndex );
+            break;
+            }
+        case EPBWritePhase_Read_Ext_Entry:
+            {
+            ret = HandleWriteReadExtEntryResp(
+                  aStatus,
+                  aFileData,
+                  aTransId,
+                  fileId,
+                  fileIdExt );
+            break;
+            }
+        case EPBWritePhase_Search_Ext_Entry:
+            {
+            ret = HandleWriteSearchExtEntryResp(
+                  aStatus,
+                  aFileData,
+                  aTransId,
+                  fileId,
+                  fileIdExt );
+            break;
+            }
+        case EPBWritePhase_Write_Entry:
+            {
+            ret = HandleWriteEntryResp(
+                  aStatus,
+                  aTransId,
+                  fileId,
+                  fileIdExt );
+            break;
+            }
+        case EPBWritePhase_Write_Ext_Entry:
+            {
+            ret = HandleWriteExtEntryResp(
+                  aStatus,
+                  aTransId,
+                  fileId,
+                  fileIdExt );
+            break;
+            }
+        case EPBWritePhase_Read_MBI_profile:
+            {
+            ret = HandleWriteMBIReadResp(
+                    aStatus,
+                    aDetails,
+                    aTransId,
+                    aFileData );
+            break;
+            }
+        case EPBWritePhase_Write_MBI_profile:
+            {
+            ret = HandleWriteMBIWriteResp(
+                    aStatus,
+                    aDetails);
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleSimPbRespL - NO such Write operation Phase supported ");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationWrite::HandleUICCPbRespL - No such write operation phase supported" );
+            break;
+            }
+        }
+    
+    if( ( KErrNone != ret ) || ( iCurrentWritePhase == EPBWritePhase_complete ))
+        {
+        // Complete the to common TSY
+        CPhoneBookDataPackage phoneBookData;
+
+        //create a struct
+        TPBEntryInfo pbEntryInfo;
+        // Set the structure as it has failed, we don't care of following
+        // information so set to 0
+        pbEntryInfo.iMaxNumLength = 0;
+        pbEntryInfo.iLocation = 0;
+        if( KErrNone == ret )
+            {
+            pbEntryInfo.iLocation = iPhoneBookEntry->iLocation;
+            }
+        // For EXT file Errors need not to pass to commontsy
+        if( KErrGeneral == ret )
+            {
+            ret = KErrNone;
+            }
+        phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+
+        //Pack Data and complete
+        phoneBookData.PackData( &pbEntryInfo );
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+            EMmTsyPhoneBookStoreWriteIPC,
+            &phoneBookData,
+            ret );
+
+        // set flag to indicate that we can remove this operation from array
+        complete = ETrue;
+        }
+    return complete;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::HandleWriteReadEntryResp
+// Handle response for Read Entry Phase
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteReadEntryResp(
+    TInt aStatus,
+    const TDesC8& aFileData,
+    TUint8 aTransId,
+    TUint16 aFileId,
+    TUint16 aFileIdExt,
+    TUint8 aArrayIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteReadEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEREADENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteReadEntryResp" );
+    TInt ret ( KErrNone );
+    
+    if( UICC_STATUS_OK == aStatus )
+        {
+        // Check for Emtry Entry
+        if( KErrNone == EmptyEntryCheck( aFileData ) )
+            {
+            // if entry is present
+            // Check if its a location search
+            if( !iLocationSearch )
+                {
+                
+                // Check for Ext data present or not
+                if( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13] )
+                    {
+                    // No EXT Records 
+                    // Check if EXT reords needed for Entry to be write
+                    if( ( KErrNotFound != iExtRecordArrayToBeWrite.Find( 0 ) ))
+                        {
+                        // Start Search for Ext record
+                        // Search for more free records
+                        iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                        
+                        // Send request to read first entry in Ext
+                        iExtRecordNo = 1;
+                        ret = UiccPbReqWriteReadExt(
+                              aFileId,
+                              aFileIdExt,
+                              iExtRecordNo,
+                              aTransId );
+                        }
+                    else
+                        {
+                        // Start Write main Entry
+                        iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                        TUint8 indexToWrite ( 0 );
+                        if( PB_MBDN_FID == aFileId )
+                            {
+                            indexToWrite = iEntryToWrite;
+                            }
+                        else
+                            {
+                            indexToWrite = iPhoneBookEntry->iLocation;
+                            }
+                        ret = UiccPBReqWriteEntry(
+                              aFileId,
+                              indexToWrite,
+                              aTransId,
+                              *iPhoneBookEntry );
+                        }
+                    }
+                else
+                    {
+                    // Append this Record number to be Delete record Array
+                    iExtRecordArrayToBeDelete.Append(
+                                    iMmPhoneBookStoreMessHandler->
+                                    iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13 );
+                    
+                    // Start Reading EXT Record
+                    iCurrentWritePhase = EPBWritePhase_Read_Ext_Entry;
+                    TUint8 indexToRead = iMmPhoneBookStoreMessHandler->
+                               iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13;
+                    ret = UiccPbReqWriteReadExt(
+                          aFileId,
+                          aFileIdExt,
+                          indexToRead,
+                          aTransId );
+                    }
+                }
+            else
+                {
+                // Serach for next location
+                // Start searching for first free Entry
+                iCurrentWritePhase = EPBWritePhase_Read_Entry;
+                iEntryToWrite++;
+                ret = UiccPbReqWriteRead(
+                      aFileId,
+                      iEntryToWrite,
+                      aTransId );
+                }
+            }
+        else
+            {
+            // entry not found and
+            // Check if EXT reords needed for Entry to be write
+            iLocationSearch = EFalse;
+            if( 0 < iExtRecordArrayToBeWrite.Count() )
+                {
+                // Start Search for Ext record
+                // Search for more free records
+                iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                
+                // Send request to read first entry in Ext
+                iExtRecordNo = 1;
+                ret = UiccPbReqWriteReadExt(
+                      aFileId,
+                      aFileIdExt,
+                      iExtRecordNo,
+                      aTransId);
+                }
+            else
+                {
+                // For MBDN PhoneBook First update MBI File
+                
+                // Start Write Entry
+                iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                TUint8 index ( 0 ); 
+                if( ( PB_MBDN_FID == aFileId )|| ( 0 == iPhoneBookEntry->iLocation ))
+                    {
+                    index = iEntryToWrite; 
+                    }
+                else
+                    {
+                    index = iPhoneBookEntry->iLocation;
+                    }
+                ret = UiccPBReqWriteEntry(
+                        aFileId,
+                        index,
+                        aTransId,
+                        *iPhoneBookEntry );
+                }
+            }
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+
+    return ret;
+    }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp
+// Handle Read EXt fiel response
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp(
+    TInt aStatus,
+    const TDesC8& aFileData,
+    TUint8 aTransId,
+    TUint16 aFileId,
+    TUint16 aFileIdExt)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEREADEXTENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp" );
+    TInt ret ( KErrNone );
+    
+    if( UICC_STATUS_OK == aStatus )
+        {
+        // Check if There is further records for this Entry
+        if( 0xFF == aFileData[UICC_EXT_REC_NO_OFFSET] )
+            {
+            // There is no Further records
+            if( 0 < iExtRecordArrayToBeWrite.Count() )
+                {
+                // Check if to be delete records are sufficient to write new entry
+                if( iExtRecordArrayToBeWrite.Count() <= 
+                    iExtRecordArrayToBeDelete.Count())
+                    {
+                    // NO need to search for new records
+                    // Copy record nos
+                    for( TInt i = 0; i<iExtRecordArrayToBeWrite.Count(); i++)
+                        {
+                        iExtRecordArrayToBeWrite[i] = iExtRecordArrayToBeDelete[i];
+                        }
+                    // Start Deleting Ext data
+                    iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+                    iExtDeleteOperation= ETrue;
+                    //last index
+                    TUint8 index = iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
+                    ret = UiccPbReqWriteExtDelete(
+                          aFileId,
+                          aFileIdExt,
+                          index,
+                          aTransId );
+                    }
+                else
+                    {
+                    // Copy the records
+                    for( TInt i = 0; i<iExtRecordArrayToBeDelete.Count(); i++)
+                        {
+                        iExtRecordArrayToBeWrite[i] = iExtRecordArrayToBeDelete[i];
+                        }
+                    // Start Searching for remaining records
+                    iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                    // Start Searching for first location
+                    iExtRecordNo = 1;
+                    ret = UiccPbReqWriteReadExt(
+                          aFileId,
+                          aFileIdExt,
+                          iExtRecordNo,
+                          aTransId );
+                    }
+                }
+            else
+                {
+                // Start Writing EXT Data delete
+                if( 0 < iExtRecordArrayToBeDelete.Count() )
+                    {
+                    // Start Writing Ext data
+                    iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+                    iExtDeleteOperation = ETrue;
+                    //last index
+                    TUint8 index = 
+                      iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
+                    ret = UiccPbReqWriteExtDelete(
+                          aFileId,
+                          aFileIdExt,
+                          index,
+                          aTransId );
+                    }
+                else
+                    {
+                    // Start Writing main Entry
+                    iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                    //last index
+                    TUint8 index (0 );
+                    if( PB_MBDN_FID == aFileId )
+                        {
+                        index = iEntryToWrite;
+                        }
+                    else
+                        {
+                        index = iPhoneBookEntry->iLocation;
+                        }
+                    ret = UiccPBReqWriteEntry(
+                          aFileId,
+                          index,
+                          aTransId,
+                          *iPhoneBookEntry );
+                    }
+                }
+            }
+        else
+            {
+            // Append Current record no to the Array
+            iExtRecordArrayToBeDelete.Append( aFileData[UICC_EXT_REC_NO_OFFSET] );
+            // Raed Next 
+            iCurrentWritePhase = EPBWritePhase_Read_Ext_Entry;
+            ret = UiccPbReqWriteReadExt(
+                  aFileId,
+                  aFileIdExt,
+                  aFileData[UICC_EXT_REC_NO_OFFSET],
+                  aTransId );
+            }
+        }
+    else
+        {
+            ret = KErrGeneral;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::HandleWriteSearchExtEntryResp
+// Handle Search for Ext record response
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteSearchExtEntryResp(
+    TInt aStatus,
+    const TDesC8& aFileData,
+    TUint8 aTransId,
+    TUint16 aFileId,
+    TUint16 aFileIdExt)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteSearchExtEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITESEARCHEXTENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteSearchExtEntryResp" );
+    TInt ret ( KErrNone );
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
+    
+    if( UICC_STATUS_OK == aStatus)
+        {
+        // Check if Entry is Free
+        if( KErrNotFound == EmptyEntryCheck( aFileData ) )
+            {
+            TInt location ( iExtRecordArrayToBeWrite.Find ( 0 ) );
+            // Append this Record no in Array
+            iExtRecordArrayToBeWrite[location] = iExtRecordNo;
+            // Check if there is any record no 0 in to be write record array
+            if( KErrNotFound == iExtRecordArrayToBeWrite.Find ( 0 ) )
+                {
+                // Start Writing to EXT records
+                // first do the delete records
+                if( iExtRecordArrayToBeDelete.Count() > 0 )
+                    {
+                    // Start Writing or deleting the Entry
+                    iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+                    iExtDeleteOperation = ETrue;
+                    TUint8 index = 
+                    iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
+                    ret = UiccPbReqWriteExtDelete( 
+                            aFileId,
+                            aFileIdExt,
+                            index,
+                            aTransId );
+                    iExtRecordArrayToBeDelete.Remove( 
+                            iExtRecordArrayToBeDelete.Count() -1 );
+                    iExtRecordArrayToBeDelete.Compress();
+                    }
+                else 
+                    {
+                    // Start Writing the Entry
+                    iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                    TUint8 index ( 0 );
+                        // Start writing main Entry
+                    if( ( iPhoneBookEntry->iLocation == 0 )||( PB_MBDN_FID == aFileId ) )
+                        {
+                        index = iEntryToWrite;
+                        }
+                    else
+                        {
+                        index = iPhoneBookEntry->iLocation;
+                        }
+                    if( 0 < index )
+                        {
+                        ret = UiccPBReqWriteEntry(
+                                aFileId,
+                                index,
+                                aTransId,
+                                *iPhoneBookEntry );
+                        }
+                    else
+                        {
+                        ret = KErrNotFound;
+                        }
+                    }
+                }
+            else
+                {
+                // further search for free records
+                iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                TUint8 index = iExtRecordNo++;
+                if( index < iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[ arrayIndex ].iExtNoOfRec )
+                    {
+                    ret = UiccPbReqWriteReadExt(
+                          aFileId,
+                          aFileIdExt,
+                          index,
+                          aTransId );
+                    }
+                else
+                    {
+                    ret = KErrGeneral;
+                    }
+                }
+            }
+        else
+            {
+            // further search for free records
+            iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+            TUint8 index = iExtRecordNo++;
+            if( index < iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[ arrayIndex ].iExtNoOfRec )
+                {
+                ret = UiccPbReqWriteReadExt(
+                      aFileId,
+                      aFileIdExt,
+                      index,
+                      aTransId );
+                }
+            else
+                {
+                ret = KErrGeneral;
+                }
+            }
+        }
+    else
+        {
+        ret = KErrGeneral;
+        }
+
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// TBool CMmPhoneBookOperationWrite::HandleWriteEntryResp
+// Handle write response for EXT part of Entry
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteEntryResp(
+    TInt aStatus,
+    TUint8 aTransId,
+    TUint16 aFileId,
+    TUint16 aFileIdExt) 
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteEntryResp" );
+    TInt ret ( KErrNone );
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ));
+    
+    if( UICC_STATUS_OK == aStatus )
+        {
+        iEntryToUpdateInList = new ( ELeave ) TPBEntry();
+        
+        // Update the Entry needs to be Stored
+        if( ( 0 == iPhoneBookEntry->iLocation )|| ( PB_MBDN_FID == aFileId ) )
+            {
+            iEntryToUpdateInList->iEntryIndex = iEntryToWrite;
+            iEntryToUpdateInList->iEntryPresent = ETrue;
+            }
+        else
+            {
+            iEntryToUpdateInList->iEntryIndex = iPhoneBookEntry->iLocation;
+            iEntryToUpdateInList->iEntryPresent = ETrue;
+            }
+
+        // Check there is ant EXT Data to be Write or Delete
+        if( iExtRecordArrayToBeWrite.Count() > 0 )
+            {
+            // Update Entry
+            iEntryToUpdateInList->PBEntryExtRecord.Append( iExtRecordArrayToBeWrite[0] );
+            iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+            // Start Writing to EXT records
+            TUint8 index = iExtRecordArrayToBeWrite[0];
+            ret = UiccPbReqWriteExt(
+                    aTransId,
+                    index,
+                    aFileId,
+                    aFileIdExt,
+                    *iPhoneBookEntry );
+            }
+        else
+            {
+            // Remove old Entry from the list 
+            TInt index = iMmPhoneBookStoreMessHandler->
+                         GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+            if( 0 <= index )
+                {
+                iMmPhoneBookStoreMessHandler->UpdateEntryFromList( iEntryToUpdateInList, index, arrayIndex );
+                }
+            else
+                {
+                // Append the Entry to the List
+                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( iEntryToUpdateInList, arrayIndex );
+                }
+            // If it is MBDN Phone Book then update MBI File also
+            if( PB_MBDN_FID == aFileId)
+                {
+                // Start Writing MBI file
+                iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
+                ret = UiccPBReqWriteMBIProfile( 
+                        aTransId,
+                        iPhoneBookEntry->iLocation,
+                        KOperationWrite);
+                iMBIOperation = KOperationWrite;
+                }
+            else
+                {
+                iCurrentWritePhase = EPBWritePhase_complete;
+                }
+            }
+        }
+    else
+        {
+        // If it is a MBDN PhoneBook Then delete MBI profile by writin 0
+        if( PB_MBDN_FID == aFileId)
+            {
+            // Start Writing MBI file
+            iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
+            ret = UiccPBReqWriteMBIProfile( 
+                    aTransId,
+                    iPhoneBookEntry->iLocation,
+                    KOperationDelete );
+            iMBIOperation = KOperationDelete;
+            }
+        else
+            {
+            ret = KErrArgument;
+            }
+        }
+    return ret;
+    
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// TBool CMmPhoneBookOperationWrite::HandleWriteExtEntryResp
+// Handle write response for EXT part of Entry
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteExtEntryResp(
+    TInt aStatus,
+    TUint8 aTransId,
+    TUint16 aFileId,
+    TUint16 aFileIdExt) 
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteExtEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEEXTENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteExtEntryResp" );
+    TInt ret ( KErrNone );
+    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ));
+    
+    if( UICC_STATUS_OK  == aStatus )
+        {
+        if( iExtDeleteOperation )
+            {
+            if( iExtRecordArrayToBeDelete.Count() > 0 )
+                {
+                // remove the Entry Which has been deleted
+                iExtRecordArrayToBeDelete.Remove(
+                                          iExtRecordArrayToBeDelete.Count() - 1 );
+                iExtRecordArrayToBeDelete.Compress();
+                }
+            // Remove old Entry from the list 
+            TInt index = iMmPhoneBookStoreMessHandler->GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+            if( 0 <= index )
+                {
+                iMmPhoneBookStoreMessHandler->RemoveExtEntryFromList( index, arrayIndex);
+                }
+            
+            if( iExtRecordArrayToBeDelete.Count() > 0 )
+                {
+                iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
+                iExtDeleteOperation = ETrue;
+                TUint8 index = iExtRecordArrayToBeDelete[
+                               iExtRecordArrayToBeDelete.Count() -1 ];
+                ret = UiccPbReqWriteExtDelete( aFileId, aFileIdExt, index, aTransId );
+                }
+            else
+                {
+                // Start Writing the Entry
+                iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                TUint8 index ( 0 );
+                // Start writing main Entry
+                if( ( iPhoneBookEntry->iLocation == 0 )||( PB_MBDN_FID == aFileId ) )
+                    {
+                    index = iEntryToWrite;
+                    }
+                else
+                    {
+                    index = iPhoneBookEntry->iLocation;
+                    }
+                if( 0 < index )
+                    {
+                    ret = UiccPBReqWriteEntry(
+                          aFileId,
+                          index,
+                          aTransId,
+                          *iPhoneBookEntry );
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+                }
+            }
+        else
+            {
+            // Append the record number to the Entry
+            iEntryToUpdateInList->PBEntryExtRecord.Append( iExtRecordArrayToBeWrite[0] );
+            // remove the Entry Which has been Written
+            iExtRecordArrayToBeWrite.Remove( 0 );
+            iExtRecordArrayToBeWrite.Compress();
+            
+            // Start Writing to EXT records
+            // first do the delete records
+            if( iExtRecordArrayToBeWrite.Count() > 0 )
+                {
+                iEntryToUpdateInList->PBEntryExtRecord.Append( iExtRecordArrayToBeWrite[0] );
+                TUint8 index = iExtRecordArrayToBeWrite[0];
+                ret = UiccPbReqWriteExt(
+                      aTransId,
+                      index,
+                      aFileId,
+                      aFileIdExt,
+                      *iPhoneBookEntry );
+                }
+            else
+                {
+                // Overwrite old Entry from the list 
+                TInt index = iMmPhoneBookStoreMessHandler->
+                             GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+                if( 0 <= index )
+                    {
+                    iMmPhoneBookStoreMessHandler->UpdateEntryFromList( iEntryToUpdateInList, index, arrayIndex );
+                    }
+                else
+                    {
+                    // Append the Entry to the List
+                    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( iEntryToUpdateInList, arrayIndex );
+                    }
+                // If it is MBDN PhoenBook then update MBI Profile also
+                if( PB_MBDN_FID == aFileId)
+                    {
+                    // Start Writing MBI file
+                    iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
+                    ret = UiccPBReqWriteMBIProfile( 
+                            aTransId,
+                            iPhoneBookEntry->iLocation,
+                            KOperationWrite);
+                    iMBIOperation = KOperationWrite;
+                    }
+                else
+                    {
+                    // Complete the Task
+                    iCurrentWritePhase = EPBWritePhase_complete;
+                    }
+                }
+            }
+        }
+    else
+        {
+        if( PB_MBDN_FID == aFileId )
+            {
+            // Start Writing MBI File
+            iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
+            ret = UiccPBReqWriteMBIProfile( 
+                    aTransId,
+                    iPhoneBookEntry->iLocation,
+                    KOperationWrite);
+            iMBIOperation = KOperationWrite;
+            }
+        else
+            {
+            ret = KErrGeneral;
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TBool CMmPhoneBookOperationWrite::HandleWriteMBIReadResp
+// Handle write response for MBI profile read
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteMBIReadResp(
+        TInt aStatus,
+        TUint8 aDetails,
+        TUint8 aTransId,
+        const TDesC8 &aFileData ) 
+    {
+    TInt ret ( KErrNone );
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteMBIReadResp");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEMBIREADRESP, "CMmPhoneBookOperationWrite::HandleWriteMBIReadResp" );
+
+
+    if( UICC_STATUS_OK  == aStatus )
+        {
+        iEntryToWrite = aFileData[0];
+        ret = UiccPbReqWriteL( aTransId, iEntryToWrite, *iPhoneBookEntry );
+        }
+    else
+        {
+        if( UICC_SECURITY_CONDITIONS_NOT_SATISFIED == aDetails )
+            {
+            ret = KErrAccessDenied;
+            }
+        else
+            {
+            ret = KErrArgument;
+            }
+        }
+
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TBool CMmPhoneBookOperationWrite::HandleWriteMBIWriteResp
+// Handle write response for MBI profile write
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::HandleWriteMBIWriteResp(
+        TInt aStatus,
+        TUint8 aDetails )
+    {
+    TInt ret ( KErrNone );
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteMBIWriteResp");
+OstTrace0( TRACE_FATAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEMBIWRITERESP, "CMmPhoneBookOperationWrite::HandleWriteMBIWriteResp" );
+
+    if( UICC_STATUS_OK  == aStatus )
+        {
+        // Check for Which operation this response was 
+        if ( KOperationDelete == iMBIOperation )
+            {
+            ret = KErrAccessDenied;
+            }
+        // Send Request to write entry on MBDN file        
+        iCurrentWritePhase = EPBWritePhase_complete;
+        }
+    else
+        {
+        if( UICC_SECURITY_CONDITIONS_NOT_SATISFIED == aDetails )
+            {
+            ret = KErrAccessDenied;
+            }
+        else
+            {
+            ret = KErrArgument;
+            }
+        }
+
+
+    return ret;
+    }
+
+// End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,12 +30,17 @@
 #include "cmmphonebookalphastring.h"
 #include "cmmphonebookoperationinit.h"
 #include "cmmphonebookoperationinit3g_adn.h"
+#include "cmmphonebookoperationread.h"
+#include "cmmphonebookoperationread3g_adn.h"
+#include "cmmphonebookoperationcache.h"
+#include "cmmphonebookoperationwrite.h"
+#include "cmmphonebookoperationdelete.h"
 #include "cmmphonebookstoreoperationlist.h"
 #include "cmmphonebookstoreoperationbase.h"
 #include "cmmmessagerouter.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookstoremesshandlertraces.h"
+#include "cmmphonebookstoremesshandlerTraces.h"
 #endif
 
 
@@ -68,6 +73,82 @@
 // ================= MEMBER FUNCTIONS ========================================
 
 // ---------------------------------------------------------------------------
+// TPrimitiveInitInfo::TPrimitiveInitInfo
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+TPrimitiveInitInfo::TPrimitiveInitInfo()
+    {
+TFLOGSTRING("TSY: TPrimitiveInitInfo::TPrimitiveInitInfo");
+OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_TPRIMITIVEINITINFO, "TPrimitiveInitInfo::TPrimitiveInitInfo" );
+
+
+    iNoOfRecords = 0;          // 2 byte long
+    iAlphaStringlength = 0;    // 2 byte long
+    iNumlength = 0;          // 2 byte long
+    iExtNoOfRec = 0;
+    iExtension = EFalse;
+
+    }
+
+// ---------------------------------------------------------------------------
+// TPrimitiveInitInfo::GetPBEntryFromUICCData
+// Separate phonebook entry from ISI message
+// ---------------------------------------------------------------------------
+//
+
+void TPrimitiveInitInfo::GetPBEntryFromUICCData(
+     const TDesC8& aFileData,
+     TDes8& aNumber,
+     TDes8& aName)
+    {
+    TUint8 nameLength (0);
+    TUint8 numLength(0);
+
+    // Maximum record length will be RecordLength -14
+    // Actual string length can be find the first FF , which indicates that after
+    // that its empty
+    nameLength = aFileData.Find(&KTagUnusedbyte,1);
+    // Check if MAX length is smaller than the MAX alpha string length
+    if( iAlphaStringlength < nameLength)
+        {
+        // Max lenght wil be the valid alpha string Length
+        nameLength = iAlphaStringlength;
+        }
+
+    numLength = aFileData[iAlphaStringlength];
+
+    // Chekc for number Length also
+    if( iNumlength < numLength)
+        {
+        numLength = iNumlength;
+        }
+
+    // Save name
+    if ( KMinLength < nameLength )
+        {
+TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving name.");
+OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving Name" );
+
+        aName.Copy(aFileData.Mid(0,nameLength));
+        }
+    //no else
+    // Save number
+    if ( KMinLength < numLength )
+        {
+TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving number.");
+OstTrace0( TRACE_NORMAL, DUP1_TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Save Number" );
+
+        // Store number in buffer4
+        // Start for number
+        TInt offset = iAlphaStringlength + 1;
+        aNumber.Append(aFileData.Mid(offset,numLength));
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
 // CMmPhoneBookStoreMessHandler::CMmPhoneBookStoreMessHandler
 // C++ default constructor can NOT contain any code, that
 // might leave.
@@ -75,8 +156,7 @@
 //
 CMmPhoneBookStoreMessHandler::CMmPhoneBookStoreMessHandler()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::\
-        CMmPhoneBookStoreMessHandler.");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::CMmPhoneBookStoreMessHandler.");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_CMMPHONEBOOKSTOREMESSHANDLER, "CMmPhoneBookStoreMessHandler::CMmPhoneBookStoreMessHandler" );
     }
 
@@ -87,9 +167,19 @@
 //
 CMmPhoneBookStoreMessHandler::~CMmPhoneBookStoreMessHandler()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::\
-        ~CMmPhoneBookStoreMessHandler.");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::~CMmPhoneBookStoreMessHandler.");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREMESSHANDLER_CMMPHONEBOOKSTOREMESSHANDLER, "CMmPhoneBookStoreMessHandler::~CMmPhoneBookStoreMessHandler" );
+
+// Delete all the entries
+    for( TInt pbCount = 0; pbCount < iPBEntryList.Count(); pbCount++ )
+        {
+        for( TInt count = 0; count < iPBEntryList[pbCount].iEntryList.Count(); count++)
+            {
+            delete iPBEntryList[pbCount].iEntryList[count];
+            }
+        iPBEntryList[pbCount].iEntryList.Close();
+        }
+
     delete iOperationlist;
 
 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
@@ -116,7 +206,7 @@
     CMmMessageRouter* aMessageRouter,  // Pointer to message router
     CMmUiccMessHandler* aUiccMessHandler) //Pointer to the Uicc Message handler
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::NewL.");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::NewL.");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_NEWL, "CMmPhoneBookStoreMessHandler::NewL" );
 
     // Create PhoneBookStore messagehandler
@@ -147,7 +237,7 @@
     CMmPhoneBookStoreMessHandler* /*mmPhoneBookStoreMessHandler*/,
     CMmUiccMessHandler* aUiccMessHandler)
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ConstructL");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ConstructL");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_CONSTRUCTL, "CMmPhoneBookStoreMessHandler::ConstructL" );
 
     iOperationlist = CMmPhoneBookStoreOperationList::NewL( this , aUiccMessHandler );
@@ -163,162 +253,54 @@
     TInt aIpc,
     const CMmDataPackage* aDataPackage )
     {
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - arrived. \
-        IPC: %d", aIpc);
+TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - arrived. IPC: %d", aIpc);
 OstTrace1( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;aIpc=%d", aIpc );
 
-    TInt ret( KErrNotSupported );
+    TInt ret( KErrNone );
     CMmPhoneBookStoreOperationBase* operation( NULL );
 
+
     if ( EMmTsyPhoneBookStoreCacheCancelIPC == aIpc )
         {
+        // get the phonebook name
+        TName phonebookTypeName;
+        const CPhoneBookDataPackage* phoneBookData =
+            static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+        phoneBookData->GetPhoneBookName( phonebookTypeName );
+
         // processing cache cancel IPC
-        TUint8 trans( 0 );
-        ret = CMmPhoneBookStoreOperationList::CalculateTransactionId(
-                  EMmTsyPhoneBookStoreCacheIPC, aDataPackage, trans );
-        if ( KErrNone == ret )
+        iOperationlist->CancelOperation( phonebookTypeName ); // seek from the beginning
+        }  // end of EMmTsyPhoneBookStoreCacheCancelIPC
+    else
+        { // all other IPC's
+        // Check for Empty Index
+         TInt transId = iOperationlist->FindEmptyIndexTransId();
+
+        if( 0 <= transId )
             {
-            operation = iOperationlist->Find( trans ); // seek from the beginning
-            if ( NULL != operation )
+            // create operation on the basis of IPC
+            operation = CreateNewOperationL( aDataPackage, aIpc );
+
+            // Add operation to the operation list
+            iOperationlist->AddOperation( transId, operation );
+
+            // Start operation request
+            ret = operation->UICCCreateReq(aIpc,aDataPackage, transId );
+
+            if ( KErrNone != ret)
                 {
-                if ( operation->IsPrepared() )
-                    { // found running operation - cancel it
-                    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - cancel running cache operation");
-                    OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - cancel running cache operation" );
-                    operation->CancelReq();
-                    ret = KErrNone;
-                    }
-                else
-                    { // look for pending operation
-                    operation = iOperationlist->Find( trans, operation );
-                    if ( NULL != operation && operation->IsPrepared() )
-                        { // pending operation is found - cancel it
-                        TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - cancel pending cacheing");
-                        OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - cancel pending cacheing" );
-                        operation->CancelReq();
-                        ret = KErrNone;
-                        }
-                    else
-                        { // pending operation is either not found or already canceled
-                          // this is error situation: multiple cancel requests
-                        TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - error: nothing to cancel");
-                        OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - error: nothing to cancel" );
-                        ret = KErrServerBusy;
-                        }
-                    }
-                }
-            else
-                {
-                TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - already canceled");
-                OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - already canceled" );
+TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL;CreateReq returns %d", ret);
+OstTrace1( TRACE_NORMAL, DUP11_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;CreateReq returns %d", ret );
+
+                iOperationlist->RemoveOperationFromList( transId );
                 }
             }
-        }
-    else if ( EMmTsyPhoneBookStoreCacheIPC == aIpc )
-        {
-        // processing cache IPC
-        TUint8 trans( 0 );
-        ret = CMmPhoneBookStoreOperationList::CalculateTransactionId(
-                  aIpc, aDataPackage, trans );
-        if ( KErrNone == ret )
+        else
             {
-            operation = iOperationlist->Find( trans );
-            if ( NULL != operation )
-                { // found running cacheing operation - look for pending
-                  // we can not reactivate this one, because even if it is canceled
-                  // it is waiting for the response from CellMo
-                TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - cacheing already running");
-                OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - cacheing already running" );
-                if ( !operation->IsPrepared() )
-                    { // pending operation creation/reactivation is allowed
-                      // only if running one is canceled
-                    operation = iOperationlist->Find( trans, operation );
-                    if ( NULL != operation )
-                        {
-                        TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - pending cacheing is found");
-                        OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - pending cacheing is found" );
-                        ret = operation->PrepareReq( aIpc, aDataPackage );
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - Server Busy ");
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - Server Busy " );
 
-                        if ( KErrArgument == ret )
-                            {
-                            // request preparation fails - needs to be removed
-TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns %d", ret);
-OstTrace1( TRACE_NORMAL, DUP14_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns %d", ret );
-                            iOperationlist->RemoveLastOperationFromList();
-                            }
-                        else if ( KErrNone != ret )
-                            { // this happens when there are 2 consequent
-                              // cache requests without cancellation:
-                              // cache-cancel-cache-cache
-                            TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - error: pending operation is active");
-                            OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - error: pending operation is active" );
-                            ret = KErrServerBusy;
-                            }
-                        else
-                            {
-                            TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - pending operation reactivated");
-                            OstTrace0( TRACE_NORMAL, DUP7_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - pending operation reactivated" );
-                            }
-                        }
-                    else
-                        { // no pending operation - create and prepare
-                        TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - preparing pending cacheing");
-                        OstTrace0( TRACE_NORMAL, DUP8_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL - preparing pending cacheing" );
-                        operation = iOperationlist->BuildL( aDataPackage, aIpc );
-                        ret = operation->PrepareReq( aIpc, aDataPackage );
-
-                        if ( KErrArgument == ret )
-                            {
-TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns %d", ret);
-OstTrace1( TRACE_NORMAL, DUP13_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns %d", ret );
-                            // here we remove the newly created operation
-                            // we could turn it back into non-prepared state,
-                            // but this breaks the concept
-                            iOperationlist->RemoveLastOperationFromList();
-                            }
-                        }
-                    }
-                else
-                    { // operation was not canceled:
-                      // cache-cache
-                    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL; running operation was not canceled");
-                    OstTrace0( TRACE_NORMAL, DUP9_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL; running operation was not canceled" );
-                    ret = KErrServerBusy;
-                    }
-                }
-            else
-                { // no cacheing is running - create, prepare & launch
-                operation = iOperationlist->BuildL( aDataPackage, aIpc );
-                ret = operation->PrepareReq( aIpc, aDataPackage );
-
-                if ( KErrNone == ret )
-                    {
-                    ret = operation->LaunchReq();
-                    }
-
-                if ( KErrNone != ret )
-                    {
-                    // in case request preparation or phonetsender fail
-TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns  %d", ret);
-OstTrace1( TRACE_NORMAL, DUP12_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;PrepareReq returns  %d", ret );
-                    // it is safe to ignore return value here
-                    iOperationlist->RemoveLastOperationFromList();
-                    }
-                }
-            }
-        }
-    else
-        { // all other IPC's
-        
-        operation = iOperationlist->BuildL( aDataPackage, aIpc );
-            ret = operation->UICCCreateReq(aIpc,aDataPackage );
-
-        if ( KErrNone != ret)
-            {
-TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL;CreateReq returns %d", ret);
-OstTrace1( TRACE_NORMAL, DUP11_CMMPHONEBOOKSTOREMESSHANDLER_EXTFUNCL, "CMmPhoneBookStoreMessHandler::ExtFuncL;CreateReq returns %d", ret );
-            // it is safe to ignore return value here
-            iOperationlist->RemoveLastOperationFromList();
+            ret = KErrServerBusy;
             }
         }
 
@@ -328,52 +310,698 @@
 
 
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreMessHandler::ReceiveMessageL
+// CMmPhoneBookStoreMessHandler::ProcessUiccMsg
 // Called when an ISI message has been received.
 // ---------------------------------------------------------------------------
 //
 TInt CMmPhoneBookStoreMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 aDetails,
     const TDesC8 &aFileData  ) // received data in UICC Server Message
     {
     TInt ret(KErrNone);
-   
-    TBool complete( EFalse );
-    
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ProcessUiccMsg. transactId:%d", aTraId);
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg" );
-    
+
+
+TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ProcessUiccMsg. transactId:%d", aTraId);
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg" );
 
-    switch(aTraId)
+
+    // Check for operation with transaction id
+    CMmPhoneBookStoreOperationBase* operation;
+    operation = iOperationlist->Find( aTraId );
+    if( operation )
         {
-        case ETrIdPbInit:
-            // Check for operation with transaction id
-            CMmPhoneBookStoreOperationBase* operation;
-            operation = iOperationlist->Find( aTraId );
-            if( operation )
-                {
-                ret = operation->HandleUICCPbRespL(complete, aStatus, aFileData, aTraId);
-                }
+        if( operation->HandleUICCPbRespL( aStatus, aDetails, aFileData, aTraId ))
+            {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ProcessUiccMsg. Remove Operation from the list ");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg. Remove operation from the list " );
 
-            break;
-        case ETrIdPbRead:
-            break;
-        case ETrIdPbUpdate:
-            break;
-        case ETrIdPbDelete:
-            
-            break;
-        default:
-            TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::\
-                ProcessUiccMsg. switch case -> default");
-            OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg. switch case -> default" );
-            break;
+            // remove operation From the list
+            iOperationlist->RemoveOperationFromList( aTraId );
+            } // End of operation remove from thelist
         }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ProcessUiccMsg. Operation not Found ");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg. Operation not found " );
+        }
+
     return(ret);
     }
 
 
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreOperationList::CreateNewOperation
+// Separate request and create correct object
+// ---------------------------------------------------------------------------
+//
+CMmPhoneBookStoreOperationBase* CMmPhoneBookStoreMessHandler::CreateNewOperationL(
+    const CMmDataPackage* aDataPackage,
+    TInt aIpc
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::CreateNewOperation");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_CREATENEWOPERATION, "CMmPhoneBookStoreOperationList::CreateNewOperation" );
+
+    CMmPhoneBookStoreOperationBase* pointer( NULL );
+
+    switch( aIpc )
+        {
+        case EMmTsyPhoneBookStoreInitIPC:
+            {
+
+            // Get Card type from uiccmesshandler
+            // if SIM, phonebook is 2G and located under DFtelecom and ADN pb contains only name/number entries
+            // if USIM, phonebook can be 3G local or 3G private. ADN pb entry can contain additional entries
+            // 3G local is located under DFtelecom and 3G private under ADFusim, both have same structure however
+            // only the path is different? 7F10 vs. 7FFF
+            // Here in UICCCreateReq only 3G local has been handled
+            // So for both SIM and USIM Phonebook will be under DFtelecom (whose address is 7F10)
+
+
+            // Chekc for Card type to Create Class for Phonebook Init
+            if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                {
+                //call CmmPhonebookOperatorInit3G_ADN Phonebook
+                pointer = CMmPhoneBookOperationInit3G_adn::NewL(
+                        this,
+                        iMmUiccMessHandler,
+                        aDataPackage
+                        );
+                }
+            else if(UICC_CARD_TYPE_ICC ==  iMmUiccMessHandler->GetCardType())
+                {
+                //call CmmPhonebookOperatorInit
+                pointer = CMmPhoneBookOperationInit::NewL(
+                    this,
+                    iMmUiccMessHandler,
+                    aDataPackage
+                    );
+                }
+            break;
+            }
+
+        case EMmTsyPhoneBookStoreGetInfoIPC:
+        case EMmTsyPhoneBookStoreCacheIPC:
+            {
+
+            if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                {
+                //call CmmPhonebookOperationCache Phonebook
+                pointer = CMmPhoneBookOperationCache::NewL(
+                        this,
+                        iMmUiccMessHandler,
+                        aIpc,
+                        aDataPackage );
+                }
+            else if(UICC_CARD_TYPE_ICC ==  iMmUiccMessHandler->GetCardType())
+                {
+                //call CmmPhonebookOperatorInit
+                pointer = CMmPhoneBookOperationCache::NewL(
+                    this,
+                    iMmUiccMessHandler,
+                    aIpc,
+                    aDataPackage );
+                }
+            break;
+            }
+        case EMmTsyPhoneBookStoreReadIPC:
+        case EMmTsyONStoreReadIPC:
+        case EMmTsyONStoreReadEntryIPC:
+#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        case ECustomReadAlphaStringIPC:
+#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+            {
+            //call CmmPhonebookOperatorRead
+            if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
+                {
+                pointer = CMmPhoneBookOperationRead::NewL(
+                    this,
+                    iMmUiccMessHandler,
+                    aDataPackage );
+                }
+            else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+                {
+                pointer = CMmPhoneBookOperationRead3g_adn::NewL(
+                        this,
+                        iMmUiccMessHandler,
+                        aDataPackage );
+                }
+            break;
+            }
+        case EMmTsyPhoneBookStoreWriteIPC:
+            {
+            if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
+                {
+                //call CmmPhonebookOperationWrite
+                pointer = CMmPhoneBookOperationWrite::NewL(
+                    this,
+                    aDataPackage );
+                }
+            else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                //call CmmPhonebookOperationWrite
+                pointer = CMmPhoneBookOperationWrite::NewL(
+                    this,
+                    aDataPackage );
+                }
+            break;
+            }
+        case EMmTsyPhoneBookStoreDeleteIPC:
+        case EMmTsyPhoneBookStoreDeleteAllIPC:
+#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        case ECustomDeleteAlphaStringIPC:
+#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+            {
+            if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType() )
+                {
+                // Create CmmPhoneBookOperationDelete
+                pointer = CMmPhoneBookOperationDelete::NewL(
+                    this,
+                    iMmUiccMessHandler,
+                    aDataPackage );
+                }
+            else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+                {
+                // To be implemented for 3G
+                }
+            break;
+            }
+        /*
+        case EMobilePhoneGetMailboxNumbers:
+            {
+            pointer =  new ( ELeave )CMmPhonebookOperationCustom(
+                iMmPhoneBookStoreMessHandler );
+            CleanupStack::PushL( pointer );
+            // Add pointer to array
+            iPtrOperationArray.AppendL( pointer );
+            CleanupStack::Pop( pointer );
+            break;
+            }
+            */
+        default:
+            {
+            // Nothing to do here
+TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
+OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONLIST_BUILDL, "CMmPhoneBookStoreOperationList::BuildL;Unknown aIpc=%d", aIpc );
+            break;
+            }
+        }
+
+    //return pointer to right operation
+    return pointer;
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::StorePhonebookEntryL
+// Store phonebook entry to Array received from commonTSY
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::StorePhonebookEntryL(
+        TDes8& aName,
+        TDes8& aNumber,
+        CPhoneBookStoreEntry& aEntry,
+        const TUint16 aFileId,
+        const TInt aIndexToRead,
+        const TBool aMailboxIdExist )
+    {
+    // Save Name
+
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::SeparatePhoneBookEntryFromIsiMsgL. Saving name in commonTSY Array.");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_STOREPHONEBOOKENTRY, "CMmPhoneBookStoreOperationBase::StorePhonebookEntry. Save name to commonTSY Array" );
+
+
+    aEntry.iText = HBufC::NewL( aName.Length() );
+    TPtr ptrToName = aEntry.iText->Des();
+
+    TBuf8<UICC_EF_MAX_NAME_LEN> aNameString;
+    TUint16 nameLength = aName.Length();
+    if(KMinLength < nameLength)
+        {
+        // Convert String to 8 bit format
+        CMmStaticUtility::ConvertGsmDataToUcs2(aName, nameLength , aNameString );
+        TIsiUtility::CopyFromBigEndian(
+                aNameString,
+                ptrToName );
+        }
+
+    // Store Number
+
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::SeparatePhoneBookEntryFromIsiMsgL. Saving number in commonTSY Array.");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_STOREPHONEBOOKENTRY, "CMmPhoneBookStoreOperationBase::StorePhonebookEntry. Save number to commonTSY Array" );
+
+    TInt numLength = aNumber.Length();
+    if(KMinLength < numLength)
+        {
+        // Check for last lower nibble if " F " then terminate it
+            if( 0x0F == ( aNumber[numLength-1]& 0x0F ))
+                {
+                // Decrement the memory allocated by 1
+                aEntry.iNumber = HBufC::NewL( ( 2*numLength ) - 1 );
+                }
+            else
+                {
+                // Allocate memory for double the number Length
+                aEntry.iNumber = HBufC::NewL( 2*numLength );
+                }
+            TPtr ptrToNumber = aEntry.iNumber->Des();
+
+            // Convert Number to Ascii Code
+            ConvertToUcs2FromBCD(aNumber, ptrToNumber,aFileId);
+
+        }
+
+
+    // If mailbox exists set 1 into higher 8 bits (iLocation is TUint16)
+    if ( aMailboxIdExist )
+        {
+        aEntry.iLocation = 0x0100;
+        }
+
+    // Set record index
+    aEntry.iLocation = aEntry.iLocation | aIndexToRead;
+
+    // reset both buffers after storing data to commonTSY buffer
+    aName.Zero();
+    aNumber.Zero();
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::CopyToUcs2FromBCD
+// Copies unsigned BCD coded digits to Ascii code
+// by index
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookStoreMessHandler::ConvertToUcs2FromBCD
+       (
+        const TDesC8 &aSource,
+        TDes16 &aTarget,
+        const TUint16 aFileId
+        )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToUcs2FromBCD");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_CONVERTTOUCS2FROMBCD, "CMmPhoneBookStoreMessHandler::ConvertToUcs2FromBCD" );
+
+    TInt maxLength(0);
+    TUint8 data;
+    TBool plus_in_middle = EFalse;
+    TBool first_occurance = ETrue;
+    TUint8 nibble = 0;
+
+    // Check for the Valid Length for Target
+    if( aTarget.MaxSize() < (aSource.Length()* 2))
+        {
+        // Assign Target length to Max Length
+        maxLength = ( aTarget.MaxSize()/2 );
+
+        // Chekc for if target Max length is Odd number
+        if( 1 == ( aTarget.MaxLength()% 2 ))
+            {
+            maxLength++;
+            }
+        }
+    else
+        {
+        maxLength = aSource.Length();
+        }
+
+    // Check for first Byte which is TON/NPI nit equal to 0xFF, which is unused
+    if(aSource[0] != TON_NPI_NO_TEL_NBR)
+        {
+        // Check for International number
+        if( MASK_TON_FROM_TON_NPI_BYTE(aSource[0]) == TON_INTERNATIONAL)
+            {
+            data = MASK_LOWER_NIBBLE_OF_BCD(aSource[1]);
+
+            // Check for first lower nibble if first byte is '*' and '#'
+            if(( 0xA != data) && ( 0xB != data))
+                {
+                // if not then Append + in Start
+                aTarget.Append('+');
+                }
+            else
+                {
+                // Stiore the informtion that '+' could be in between
+                plus_in_middle = ETrue;
+                }
+            }
+        }
+
+
+    // Read lower nibble
+        nibble = 0;
+    // Store rest of the digits
+    for( TInt count = 1; count < maxLength ; )
+        {
+        // Check if it's higher nibble
+        if(1 == nibble)
+            {
+            // Shift higher nibble dayta to lower nibble
+            data = aSource[count]>>4;
+            count++;
+            }
+        else
+            {
+            data = aSource[count];
+            }
+        data = data & 0x0f;
+        // Check for higher nibble to End Mark for odd numbers
+        if(0x0F != data)
+            {
+            // Check for the phonebook type to decide which
+            //lookup table should be checked
+            if( PB_ADN_FID == aFileId )
+                {
+                // Chek for lookup table LookUptable ADN
+                aTarget.Append(LookupArrayAdn[data]);
+                }
+            else
+                {
+                // for all other phonebooks
+                aTarget.Append(LookupArray[data]);
+                }
+            }
+        // Change the nibble to read next digit
+        if(0 == nibble)
+            {
+            nibble = 1;
+            }
+        else
+            {
+            nibble = 0;
+            }
+        }
+
+    TInt offset = 0;
+    // start from higher nibble
+    nibble = 1;
+    // Check if its a international number and plus in middle is present
+    if( plus_in_middle )
+        {
+        for(TInt count = 1; count < maxLength; )
+            {
+            // Check if it's higher nibble
+            if(1 == nibble)
+                {
+                // Shift higher nibble dayta to lower nibble
+                data = aSource[count]>>4;
+                count++;
+                }
+            else
+                {
+                data = aSource[count];
+                }
+            data = data & 0x0f;
+            // Check for higher nibble to End Mark for odd numbers
+            if((0xA == data) || (0xB == data))
+                {
+                first_occurance = EFalse;
+                }
+            if(!first_occurance)
+                {
+                // Check for if data is some digit or cahracter
+                if((data!=0xA) && ( data!=0xB))
+                    {
+                    offset = 2 * (count - 1);
+                    if(1 == nibble)
+                        {
+                        offset = offset -1;
+                        }
+                    break;
+                    }
+                }
+
+            // Change the nibble to read next digit
+            if(0 == nibble)
+                {
+                nibble = 1;
+                }
+            else
+                {
+                nibble = 0;
+                }
+            }// End of checking offset for insert '+'
+        }
+    // To insert '+' in between the number
+    TBuf16<1> insertBuffer;
+    insertBuffer.Append('+');
+    if(plus_in_middle)
+        {
+        // Insert '+'
+        aTarget.Insert(offset,insertBuffer);
+        }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::CopyToUcs2FromBCD
+// Copies unsigned BCD coded digits to Ascii code
+// by index
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreMessHandler::ConvertToBCDFromUCS2
+       (
+        TDes16 &aSource,
+        TDes8 &aTarget,
+        TUint16 aFileId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToBCDFromUCS2");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_CONVERTTOBCDFROMUCS2, "CMmPhoneBookStoreMessHandler::ConvertToBCDFromUCS2" );
+
+    TInt ret ( KErrNone );
+    TInt count( 0 );
+    TUint8 plusCount( 0 );
+    TBool internationalNumber ( EFalse );
+
+        // Search if more than 1 '+' is present then its a illegal number
+    for( TInt i=0; i<aSource.Length(); i++ )
+        {
+        if( '+' == aSource[i] )
+            {
+            plusCount++;
+            }
+        }
+
+
+    if( plusCount <= 1 )
+        {
+        if( UICC_INTERNATIONAL_NUM == aSource[count] )
+            {
+            aTarget.Append( TON_NPI_INTERNATIONAL );
+            internationalNumber = ETrue;
+            }
+        if( ( '*' == aSource[count] ) || ( '#' == aSource[count] ))
+            {
+            if( plusCount == 1)
+                {
+                aTarget.Append( TON_NPI_INTERNATIONAL );
+                internationalNumber = ETrue;
+                }
+            }
+        if( ! internationalNumber )
+            {
+            aTarget.Append( TON_NPI_UNKNOWN );
+            }
+        }
+    else
+        {
+        // its a Illegal number
+        ret = KErrGeneral;
+        aTarget.Append( TON_NPI_NO_TEL_NBR );
+        }
+
+    count = 0;
+    while ( count < aSource.Length() )
+    {
+    if( 0 <= GetBCDCodeforUCS( aSource[count], aFileId ) )
+        {
+        TInt lo = GetBCDCodeforUCS( aSource[count++], aFileId ); // low nibble
+        TInt hi = ( count < aSource.Length() ) ? aSource[count++] : 0xf; // high nibble
+        aTarget.Append( (hi<<4)|lo );
+        }
+    }
+
+    return ret;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetBCDCodeforUCS
+// Convert UCS String to BCD coding
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreMessHandler::GetBCDCodeforUCS(
+         TUint16 aUCSCharacter,
+         TUint16 aFileId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetBCDCodeforUCS");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETBCDCODEFORUCS, "CMmPhoneBookStoreMessHandler::GetBCDCodeforUCS" );
+    TInt bcdNumber( -1 );
+
+    if ( aUCSCharacter >= '0' && aUCSCharacter <='9')
+        bcdNumber = aUCSCharacter - '0';
+     else if (aUCSCharacter == 'w' && aFileId == PB_ADN_FID)
+         bcdNumber = 0xd;
+     else if (aUCSCharacter == '?')
+         bcdNumber = 0xd;
+     else
+         bcdNumber = -1;
+    return bcdNumber;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::StoreEntryToPhoenBookList
+// Stores PhoneBook Entry in PhoneBook list
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::StoreEntryToPhoneBookList( TPBEntry* aStoreEntry, TUint8 aPBIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::StoreEntryToPhoenBookList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_STOREENTRYTOPHOENBOOKLIST, "CMmPhoneBookStoreMessHandler::StoreEntryToPhoenBookList" );
+
+    iPBEntryList[aPBIndex].iEntryList.Append( aStoreEntry );
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::ResetEntryInPhoneBookList
+// Resets a phonebook entry in phonebook list
+// ---------------------------------------------------------------------------
+//
+void CMmPhoneBookStoreMessHandler::ResetEntryInPhoneBookList(
+    TUint8 aPbIndex,
+    TInt aEntryIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::ResetEntryInPhoneBookList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_RESETENTRYINPHONEBOOKLIST, "CMmPhoneBookStoreMessHandler::ResetEntryInPhoneBookList" );
+    TInt numOfEntries( iPBEntryList[aPbIndex].iEntryList.Count() );
+    for( TInt i( 0 ); i < numOfEntries; i++)
+        {
+        if ( aEntryIndex == iPBEntryList[aPbIndex].iEntryList[i]->iEntryIndex )
+            {
+            // Reset values
+            iPBEntryList[aPbIndex].iEntryList[i]->iEntryPresent = EFalse;
+            iPBEntryList[aPbIndex].iEntryList[i]->PBEntryExtRecord.Reset();
+            // Exit loop
+            i = numOfEntries;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::IndexCheckInPBList
+// Gets pointer to CMmMessageRouter object.
+// ---------------------------------------------------------------------------
+//
+
+TBool CMmPhoneBookStoreMessHandler::IndexCheckInPBList( TUint8 aIndex, TUint8 aPBIndex, TPBEntry& aEntry )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::IndexCheckInPBList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_INDEXCHECKINPBLIST, "CMmPhoneBookStoreMessHandler::IndexCheckInPBList" );
+
+    TBool entryFound( EFalse );
+
+    for( TInt count = 0; count < iPBEntryList[aPBIndex].iEntryList.Count(); count++)
+        {
+        if( aIndex == iPBEntryList[aPBIndex].iEntryList[count]->iEntryIndex )
+            {
+            entryFound = ETrue;
+            aEntry = *( iPBEntryList[aPBIndex].iEntryList[count] );
+            }
+        }
+    return entryFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry
+// Gets the index for present entry in the Stored list
+// ---------------------------------------------------------------------------
+//
+
+TInt CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry( TUint8 aIndex, TUint8 aPBIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETINDEXFORPRESENTENTRY, "CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry" );
+
+    TInt count( -1 );
+    for( ;( count+1 ) < iPBEntryList[aPBIndex].iEntryList.Count(); count++)
+        {
+        if( aIndex == iPBEntryList[aPBIndex].iEntryList[count+1]->iEntryIndex )
+            {
+            return (count+1);
+            }
+        }
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList
+// Checks for Empty entry in the stored list
+// ---------------------------------------------------------------------------
+//
+
+TInt CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList( TUint8 aPBIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_EMPTYENTRYCHECKINPBLIST, "CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList" );
+
+    TInt entryNumber( 0 );
+
+    for( TInt count = 0; count < iPBEntryList[aPBIndex].iEntryList.Count(); count++)
+        {
+        if( !iPBEntryList[aPBIndex].iEntryList[count]->iEntryPresent )
+            {
+            entryNumber = iPBEntryList[aPBIndex].iEntryList[count]->iEntryIndex;
+            break;
+            }
+        }
+    return entryNumber;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::EmptyEntryCheckInPBList
+// Gets pointer to CMmMessageRouter object.
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::UpdateEntryFromList( TPBEntry* aEntry, TUint8 aIndex , TUint8 aPBIndex)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveEntryFromList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveEntryFromList" );
+
+    iPBEntryList[aPBIndex].iEntryList[aIndex] = aEntry;
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList
+// REmove the EXt record form the stored list
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList( TUint8 aIndex , TUint8 aPBIndex)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEEXTENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList" );
+
+    TInt count = iPBEntryList[aPBIndex].iEntryList[aIndex]->PBEntryExtRecord.Count();
+    if( 0 < count )
+        {
+        iPBEntryList[aPBIndex].iEntryList[aIndex]->PBEntryExtRecord.Remove( count-1 );
+        iPBEntryList[aPBIndex].iEntryList[aIndex]->PBEntryExtRecord.Compress();
+        }
+    }
 
 
 // ---------------------------------------------------------------------------
@@ -383,7 +1011,7 @@
 //
 CMmMessageRouter* CMmPhoneBookStoreMessHandler::MessageRouter()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::MessageRouter");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::MessageRouter");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_MESSAGEROUTER, "CMmPhoneBookStoreMessHandler::MessageRouter" );
 
     return iMessageRouter;
@@ -398,7 +1026,7 @@
 //
 CMmUiccMessHandler* CMmPhoneBookStoreMessHandler::UiccMessHandler()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::UiccMessHandler");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::UiccMessHandler");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_UICCMESSHANDLER, "CMmPhoneBookStoreMessHandler::UiccMessHandler" );
 
     return iMmUiccMessHandler;
@@ -412,64 +1040,11 @@
 //
 CMmPhoNetSender* CMmPhoneBookStoreMessHandler::PhoNetSender()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::PhoNetSender");
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::PhoNetSender");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PHONETSENDER, "CMmPhoneBookStoreMessHandler::PhoNetSender" );
 
     return iPhoNetSender;
     }
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreMessHandler::Gas
-// Gets pointer to list of Group Alpha String
-// ---------------------------------------------------------------------------
-//
-CArrayPtrSeg<CMmPhonebookAlphaString>* CMmPhoneBookStoreMessHandler::Gas()
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::Gas");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GAS, "CMmPhoneBookStoreMessHandler::Gas" );
-
-    return iGas;
-    }
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreMessHandler::SetGas
-// Sets pointer to list of Group Alpha String
-// ---------------------------------------------------------------------------
-//
-void CMmPhoneBookStoreMessHandler::SetGas(
-    CArrayPtrSeg<CMmPhonebookAlphaString>* aGas )
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::SetGas");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_SETGAS, "CMmPhoneBookStoreMessHandler::SetGas" );
-    iGas = aGas;
-    }
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreMessHandler::Aas
-// Gets pointer to list of Additional Alpha String
-// ---------------------------------------------------------------------------
-//
-CArrayPtrSeg<CMmPhonebookAlphaString>* CMmPhoneBookStoreMessHandler::Aas()
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::Aas");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_AAS, "CMmPhoneBookStoreMessHandler::Aas" );
-
-    return iAas;
-    }
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreMessHandler::SetGas
-// Sets pointer to list of Additional Alpha String
-// ---------------------------------------------------------------------------
-//
-void CMmPhoneBookStoreMessHandler::SetAas(
-    CArrayPtrSeg<CMmPhonebookAlphaString>* aAas )
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::SetAas");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_SETAAS, "CMmPhoneBookStoreMessHandler::SetAas" );
-    iAas = aAas;
-    }
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,14 +24,15 @@
 #include "cmmphonebookstoreoperationbase.h"
 #include "cmmphonemesshandler.h"
 #include "cmmuiccmesshandler.h"
+#include "cmmstaticutility.h"
 
 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 #include "cmmphonebookalphastring.h"
 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookstoreoperationbasetraces.h"
+#include "cmmphonebookstoreoperationbaseTraces.h"
 #endif
 // EXTERNAL DATA STRUCTURES
     // None
@@ -46,9 +47,6 @@
 // MACROS
     // None
 
-// LOCAL CONSTANTS AND MACROS
-    // None
-
 // MODULE DATA STRUCTURES
     // None
 
@@ -69,8 +67,7 @@
 //
 CMmPhoneBookStoreOperationBase::CMmPhoneBookStoreOperationBase()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::\
-        CMmPhoneBookStoreOperationBase");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CMmPhoneBookStoreOperationBase");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CMMPHONEBOOKSTOREOPERATIONBASE, "CMmPhoneBookStoreOperationBase::CMmPhoneBookStoreOperationBase" );
 
     iRet = KErrNone;
@@ -87,8 +84,7 @@
 //
 CMmPhoneBookStoreOperationBase::~CMmPhoneBookStoreOperationBase()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::\
-        ~CMmPhoneBookStoreOperationBase");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::~CMmPhoneBookStoreOperationBase");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_CMMPHONEBOOKSTOREOPERATIONBASE, "CMmPhoneBookStoreOperationBase::~CMmPhoneBookStoreOperationBase" );
     }
 
@@ -97,10 +93,10 @@
 // Cancels the operation. Canceling of canceled operation is allowed.
 // ---------------------------------------------------------------------------
 //
-void CMmPhoneBookStoreOperationBase::CancelReq()
+void CMmPhoneBookStoreOperationBase::CancelReq( TName& /*aPhoneBook*/ )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CancelReq - does nothing");
-    OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CANCELREQ, "CMmPhoneBookStoreOperationBase::CancelReq - does nothing" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CancelReq - does nothing");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CANCELREQ, "CMmPhoneBookStoreOperationBase::CancelReq - does nothing" );
     }
 
 // ---------------------------------------------------------------------------
@@ -113,8 +109,8 @@
         const CMmDataPackage* /*aDataPackage*/
         )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::PrepareReq - not supported");
-    OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_PREPAREREQ, "CMmPhoneBookStoreOperationBase::PrepareReq - not supported" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::PrepareReq - not supported");
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_PREPAREREQ, "CMmPhoneBookStoreOperationBase::PrepareReq - not supported" );
     return KErrNotSupported;
     }
 
@@ -125,8 +121,8 @@
 //
 TBool CMmPhoneBookStoreOperationBase::IsPrepared() const
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::IsPrepared");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_ISPREPARED, "CMmPhoneBookStoreOperationBase::IsPrepared" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::IsPrepared");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_ISPREPARED, "CMmPhoneBookStoreOperationBase::IsPrepared" );
     return EFalse;
     }
 
@@ -137,8 +133,8 @@
 //
 TInt CMmPhoneBookStoreOperationBase::LaunchReq()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::LaunchReq - not supported");
-    OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_LAUNCHREQ, "CMmPhoneBookStoreOperationBase::LaunchReq - not supported" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::LaunchReq - not supported");
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_LAUNCHREQ, "CMmPhoneBookStoreOperationBase::LaunchReq - not supported" );
     return KErrNotSupported;
     }
 
@@ -149,26 +145,26 @@
 //
 TInt CMmPhoneBookStoreOperationBase::CompleteReq( TInt /*aErrorCode*/ )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CompleteReq - not supported");
-    OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_COMPLETEREQ, "CMmPhoneBookStoreOperationBase::CompleteReq - not supported" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::CompleteReq - not supported");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_COMPLETEREQ, "CMmPhoneBookStoreOperationBase::CompleteReq - not supported" );
     return KErrNotSupported;
     }
 
+
 // ---------------------------------------------------------------------------
-// TUint8 CMmPhoneBookStoreOperationBase::TransId
-// Gets transactionId
+// CMmPhoneBookStoreOperationBase::GetPhoneBookName
+// Cancels the operation. Canceling of canceled operation is allowed.
 // ---------------------------------------------------------------------------
 //
-TUint8 CMmPhoneBookStoreOperationBase::TransId()
+const TName& CMmPhoneBookStoreOperationBase::GetPhoneBookName()const
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::TransId");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_TRANSID, "CMmPhoneBookStoreOperationBase::TransId" );
-
-    return iTransactionId;
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetPhoneBookName - PhoenbookName");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_GETPHONEBOOKNAME, "CMmPhoneBookStoreOperationBase::GetPhoneBookName - PhoneBookName" );
+    
+    return iPhoneBookTypeName;
     }
 
 
-
 // ---------------------------------------------------------------------------
 // CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType
 // Converts internal phonebook number to server phonebook number
@@ -177,8 +173,7 @@
 TUint16 CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType(
     const TUint8 aPbMask )
     {
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::\
-        ConvertToSimPhoneBookType SourcePBType: 0x%x", aPbMask);
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType SourcePBType: 0x%x", aPbMask);
 OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOSIMPHONEBOOKTYPE, "CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType;aPbMask=%hhx", aPbMask );
 
     TUint16 phoneBookType( KMaskUnspecifiedType );
@@ -222,9 +217,7 @@
             break;
             }
         }
-
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::\
-        ConvertToSimPhoneBookType phoneBookType: 0x%x" ,phoneBookType );
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType phoneBookType: 0x%x" ,phoneBookType );
 OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOSIMPHONEBOOKTYPE, "CMmPhoneBookStoreOperationBase::ConvertToSimPhoneBookType;phoneBookType=%x", phoneBookType );
 
     return phoneBookType;
@@ -303,13 +296,325 @@
         pbMask = KMaskUnspecifiedType;
         }
 
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBtype \
-        phonebooktype: %d", pbMask);
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBtype : phonebooktype: %d", pbMask);
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBTYPE, "CMmPhoneBookStoreOperationBase::ConvertToPBtype;pbMask=%hhx", pbMask );
 
     return pbMask;
     }
 
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreOperationBase::ConvertToPBfileId
+// Converts client phonebook type to internal phonebook mask
+// ---------------------------------------------------------------------------
+//
+TUint16 CMmPhoneBookStoreOperationBase::ConvertToPBfileId(
+    const TName& aPBType, TUint16 &aFileIdExt )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBfileId");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBFILEID, "CMmPhoneBookStoreOperationBase::ConvertToPBfileId" );
+
+    TUint16 fileId( 0 );
+
+    if ( 0 == aPBType.CompareF( KETelIccAdnPhoneBook ) )
+        {
+        fileId = PB_ADN_FID;
+        aFileIdExt = PB_EXT1_FID;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccBdnPhoneBook ) )
+        {
+        fileId = PB_BDN_FID;
+        aFileIdExt = 0x0000;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccSdnPhoneBook ) )
+        {
+        fileId = PB_SDN_FID;
+        aFileIdExt = PB_EXT3_FID;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccFdnPhoneBook ) )
+        {
+        fileId = PB_FDN_FID;
+        aFileIdExt = PB_EXT2_FID;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccVoiceMailBox ) )
+        {
+        fileId = PB_VMBX_FID;
+        aFileIdExt = PB_EXT1_FID;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccMbdnPhoneBook ) )
+        {
+        fileId = PB_MBDN_FID;
+        aFileIdExt = PB_EXT6_FID;
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccMsisdnPhoneBook ) )
+        {
+        fileId = PB_MSISDN_FID;
+        aFileIdExt = PB_EXT1_FID;
+        }
+    else
+        {
+        // none
+        fileId = UICC_ILLEGAL_FILE_ID;
+        }
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBfileId phonebookfileid: %d", fileId);
+OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBFILEID, "CMmPhoneBookStoreOperationBase::ConvertToPBfileId;fileId=%hu", fileId );
+    
+
+    return fileId;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreOperationBase::ConvertToConfArrayIndex
+// Converts File id to Array index, in which Initialization configuration data stored
+// ---------------------------------------------------------------------------
+//
+TUint8 CMmPhoneBookStoreOperationBase::ConvertToConfArrayIndex(
+    const TUint16 aFileId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToConfArrayIndex");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOCONFARRAYINDEX, "CMmPhoneBookStoreOperationBase::ConvertToConfArrayIndex" );
+    TUint8 index( 0 );
+    switch(aFileId)
+        {
+        case PB_ADN_FID:
+            index = EPhonebookTypeAdn;
+            break;
+        case PB_FDN_FID:
+            index = EPhonebookTypeFdn;
+            break;
+        case PB_SDN_FID:
+            index = EPhonebookTypeSdn;
+            break;
+        case PB_MBDN_FID:
+            index = EPhonebookTypeMBDN;
+            break;
+        case PB_MSISDN_FID:
+            index = EPhonebookTypeMSISDN;
+            break;
+        case PB_VMBX_FID:
+            index = EPhonebookTypeVMBX;
+            break;
+        }
+    return index;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreOperationBase::GetTransId
+// Converts client phonebook type to internal phonebook mask
+// needds to be remove after dynamis transaction ID allocation
+// ---------------------------------------------------------------------------
+//
+TUint8 CMmPhoneBookStoreOperationBase::GetTransId(
+    const TName& aPBType, const TUint8 aOperation  )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId" );
+    
+
+    TUint8 transId( 0 );
+
+    if ( 0 == aPBType.CompareF( KETelIccAdnPhoneBook ) )
+        {
+        switch( aOperation)
+            {
+            case KOperationRead:
+                {
+                transId = ETrIdPbReadAdn;
+                break;
+                }
+            case KOperationWrite:
+                {
+                //transId = ETrIdPbWriteAdn;
+                break;
+                }
+            case KOperationDelete:
+                {
+                //transId = ETrIdPbDeleteAdn;
+                break;
+                }
+            case KOperationDeleteAll:
+                {
+                //transId = ETrIdPbDeleteAllAdn;
+                break;
+                }
+            case KOperationDeleteWrite:
+                {
+                //transId = ETrIdPbDeleteWriteAdn;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for ADN PhoneBook");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId - No Operation supported for ADN PhoneBook" );
+                break;
+                }
+            }
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccBdnPhoneBook ) )
+        {
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccSdnPhoneBook ) )
+        {
+        switch( aOperation)
+            {
+            case KOperationRead:
+                {
+                transId = ETrIdPbReadSdn;
+                break;
+                }
+            case KOperationWrite:
+                {
+                //transId = ETrIdPbWriteSdn;
+                break;
+                }
+            case KOperationDelete:
+                {
+                //transId = ETrIdPbDeleteSdn;
+                break;
+                }
+            case KOperationDeleteAll:
+                {
+                //transId = ETrIdPbDeleteAllSdn;
+                break;
+                }
+            case KOperationDeleteWrite:
+                {
+                //transId = ETrIdPbDeleteWriteSdn;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for SDN PhoneBook ");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId - No operation supported for SDN PhoneBook" );
+
+                }
+                break;
+            }
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccFdnPhoneBook ) )
+        {
+        switch( aOperation)
+            {
+            case KOperationRead:
+                {
+                transId = ETrIdPbReadFdn;
+                break;
+                }
+            case KOperationWrite:
+                {
+                //transId = ETrIdPbWriteFdn;
+                break;
+                }
+            case KOperationDelete:
+                {
+                //transId = ETrIdPbDeleteFdn;
+                break;
+                }
+            case KOperationDeleteAll:
+                {
+                //transId = ETrIdPbDeleteAllFdn;
+                break;
+                }
+            case KOperationDeleteWrite:
+                {
+                //transId = ETrIdPbDeleteWriteFdn;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for FDN PhoneBook ");
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for FDN PhoneBook" );
+                
+                break;
+                }
+            }
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccVoiceMailBox ) )
+        {
+        switch( aOperation)
+            {
+            case KOperationRead:
+                {
+                transId = ETrIdPbReadVmbx;
+                break;
+                }
+            case KOperationWrite:
+                {
+                //transId = ETrIdPbWriteVmbx;
+                break;
+                }
+            case KOperationDelete:
+                {
+                //transId = ETrIdPbDeleteVmbx;
+                }
+                break;
+            case KOperationDeleteAll:
+                {
+                //transId = ETrIdPbDeleteAllVmbx;
+                break;
+                }
+            case KOperationDeleteWrite:
+                {
+                //transId = ETrIdPbDeleteWriteVmbx;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for VMBX PhoneBook ");
+OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for VMBX Phonebook" );
+                break;
+                }
+            }
+        }
+    else if ( 0 == aPBType.CompareF( KETelIccMbdnPhoneBook ) )
+        {
+        switch( aOperation)
+            {
+            case KOperationRead:
+                {
+                transId = ETrIdPbReadMbdn;
+                break;
+                }
+            case KOperationWrite:
+                {
+                //transId = ETrIdPbWriteMbdn;
+                break;
+                }
+            case KOperationDelete:
+                {
+                //transId = ETrIdPbDeleteMbdn;
+                break;
+                }
+            case KOperationDeleteAll:
+                {
+                //transId = ETrIdPbDeleteAllMbdn;
+                break;
+                }
+            case KOperationDeleteWrite:
+                {
+                //transId = ETrIdPbDeleteWriteMbdn;
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId - NO operation supported for MBDN PhoneBook ");
+OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId - No operation supported for MBDN Phoenbook" );
+                break;
+                }
+            }
+        }
+
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::GetTransId : Get transaction id: %d", transId);
+OstTraceExt1( TRACE_NORMAL, DUP4_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId;transId=%hhu", transId );
+    
+    return transId;
+    }
+
+
+
 // ---------------------------------------------------------------------------
 // CMmPhoneBookStoreOperationBase::ConvertToPBname
 // Converts internal phonebook mask to client phonebook type
@@ -319,8 +624,7 @@
     const TUint8 aTrans,
     TName& aName )
     {
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-        source: %d" ,aTrans );
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname : source: %d" ,aTrans );
 OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname;source=%hhu", aTrans );
 
     // get number of phonebook type from transaction Id
@@ -328,50 +632,43 @@
 
     if ( KMaskAdnType == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - ADN");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - ADN");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - ADN" );
         aName = KETelIccAdnPhoneBook;
         }
     else if ( KMaskFdnType == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - FDN");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - FDN");
 OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - FDN" );
         aName = KETelIccFdnPhoneBook;
         }
     else if ( KMaskSdnType == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - SDN");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - SDN");
 OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - SDN" );
         aName = KETelIccSdnPhoneBook;
         }
     else if ( KMaskBdnType == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - BDN");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - BDN");
 OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - BDN" );
         aName = KETelIccBdnPhoneBook;
         }
     else if ( KMaskVoiceMailBox == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - VMBX");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - VMBX");
 OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - VMBX" );
         aName = KETelIccVoiceMailBox;
         }
     else if ( KMaskMbdnType == numOfPbType )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - MBDN");
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - MBDN");
 OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - MBDN" );
         aName = KETelIccMbdnPhoneBook;
         }
     else
         {
-        TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname \
-            - unknown -> Error situation!" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBname - unknown -> Error situation!" );
 OstTrace0( TRACE_NORMAL, DUP7_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBNAME, "CMmPhoneBookStoreOperationBase::ConvertToPBname - unknown -> Error situation!" );
         //Nothing can do.
         }
@@ -381,81 +678,6 @@
 
 
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::SeparatePhoneBookEntryFromIsiMsgL
-// Separate phonebook entry from ISI message
-// ---------------------------------------------------------------------------
-//
-TInt CMmPhoneBookStoreOperationBase::SeparatePhoneBookEntryFromUiccMsgL(
-    const TDesC8& aFileData,      // ISI message
-    TDes8& aNameBuf,
-    TUint16 aSimPhonebookType)        // Entry to be filled
-    {
-    TInt ret( KErrNone );
-    TBool nameNumberFound (ETrue);
-    TUint8 nameLength (0);
-    TUint8 numLength(0);
-    
-    // Maximum record length will be RecordLength -14 
-    // Actual string length can be find the first FF , which indicates that after
-    // that its empty
-    nameLength = aFileData.Find(&KTagUnusedbyte,1);
-    // minus 1 is for TON/NPI digit , which is 1 byte long
-    numLength = aFileData[iRecordLength -14 + 1] - 1;
-    
-    if(nameLength == 1 && numLength == 1)
-        nameNumberFound = EFalse;
-    
-    switch(aSimPhonebookType)
-        {
-        case PB_FDN_FID:
-        case PB_BDN_FID:
-        case PB_MBDN_FID:
-        case PB_MSISDN_FID:
-        case PB_VMBX_FID:
-            {
-            // Save name
-            if ( KMinLength < nameLength )
-                {
-                TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::\
-                    SeparatePhoneBookEntryFromIsiMsgL. Saving name.");
-        OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_SEPARATEPHONEBOOKENTRYFROMISIMSGL, "CMmPhoneBookStoreOperationBase::SeparatePhoneBookEntryFromIsiMsgL, Saving name" );
-
-                aNameBuf.Copy(aFileData.Mid(0,nameLength));
-                }
-            //no else
-
-            // Save number
-            if ( KMinLength < numLength )
-                {
-                // Store number in buffer
-                iNumberBuf.Append(aFileData.Mid(10,numLength));
-                }
-            //no else
-
-            }
-            break;
-        default:
-            // None
-            break;
-        }
-    
-    if(!nameNumberFound)
-        ret = KErrNotFound;
-
-    return ret;
-            
-        }
-
-
-void CMmPhoneBookStoreOperationBase::StorePhonebookEntry(
-        TDes8& /*aName*/,
-        TDes8& /*aNumber*/,
-        CPhoneBookStoreEntry& /*aEntry*/)
-    {
-    
-    }
-
-// ---------------------------------------------------------------------------
 // CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType
 // Converts internal request mask to client ipc request.
 // ---------------------------------------------------------------------------
@@ -464,8 +686,7 @@
     TInt& aDestination,
     const TUint8 aSource )
     {
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::\
-        ConvertOperationToClientIPCType - source: %d", aSource );
+TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType - source: %d", aSource );
 OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTOPERATIONTOCLIENTIPCTYPE, "CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType;aSource=%hhu", aSource );
 
     switch( aSource )
@@ -509,8 +730,7 @@
             }
         default: //KOperationUnknown
             {
-            TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::\
-                ConvertOperationToClientIPCType - Default case" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType - Default case" );
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTOPERATIONTOCLIENTIPCTYPE, "CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType, Default case" );
             aDestination = KErrNotFound;
             break;
@@ -520,135 +740,25 @@
 
 
 
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::HandleFcpData
-// Handles FCP data for both SIm and USIM card
-// to get the different parameters
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::EmptyEntryCheck
+// Check for Entry is Empty or not
+// -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookStoreOperationBase::HandleFcpData( const TDesC8 &aFileData, TInt& aValue , TUint8 aParam )
+TInt CMmPhoneBookStoreOperationBase::EmptyEntryCheck( const TDesC8 &aFileData)
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleFcpData");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_HANDLEFCPDATA, "CMmPhoneBookStoreOperationBase::HandleFcpData" );
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::EmptyEntryCheck");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_EMPTYENTRYCHECK, "CMmPhoneBookStoreOperationBase::EmptyEntryCheck" );
     
+
+    TInt ret( KErrNone);
     
-    TInt ret(KErrNone);
-    if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
+    if(( 0xFF == aFileData[0]) 
+       || (0xFF == aFileData[1]))
         {
-        switch(aParam)
-            {
-            case KRecordLength:
-                {
-                // get the offset for File Descriptor for all EF's
-                TUint8 offset = aFileData.Find(&KTagFCIFileDescriptor,1);
-                Get16bit(aValue, aFileData, (offset+4) );
-                }
-                break;
-            case KNoOfRecords:
-                {
-                // get the no of records
-                TUint8 offset = aFileData.Find(&KTagFCIFileDescriptor,1);
-                aValue = aFileData[offset + 6];
-                }
-                break;
-            case KFileSize:
-                {
-                // get the file size tith tag value "85"
-                TUint8 offset = aFileData.Find(&KTagFCIFileSize,1);
-                aValue = aFileData[offset + 2];
-                }
-                break;
-            case KFileIdentifier:
-                {
-                TUint8 offset = aFileData.Find(&KTagFCIFileIdentifier,1);
-                Get16bit(aValue, aFileData, (offset+2) );
-                }
-                break;
-            default:
-                {
-                TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleFcpData - No such parameter exist in UICC");
-OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_HANDLEFCPDATA, "CMmPhoneBookStoreOperationBase::HandleFcpData - No such parameter exist in UICC" );
-                }
-                break;
-            }
-        }
-    else if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
-        {
-        switch(aParam)
-            {
-            case KRecordLength:
-                {
-                // 14 is the index for record length Data
-                aValue = aFileData[14];
-                }
-                break;
-            case KNoOfRecords:
-                {
-                // 2 is the index value for File Size Data
-                TInt fileSize(0);
-                Get16bit(fileSize, aFileData, 2 );
-                
-                // 14 is the index for record Length Data
-                TInt recordLength(0);
-                recordLength = aFileData[14];
-                
-                // get the No of records
-                
-                aValue = (fileSize/recordLength);
-                }
-                break;
-            case KFileSize:
-                {
-                // 2 is the index location for File Size which is 2 bytes long
-                Get16bit(aValue, aFileData, 2 );
-                }
-                break;
-            case KFileIdentifier:
-                {
-                // 4 is the index location for File ID which is 2 bytes long
-                Get16bit(aValue, aFileData, 4 );
-                }
-                break;
-            case KFileStatus:
-                {
-                // 11 is index value for File Status
-                aValue = aFileData[11];
-                }
-            default:
-                TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleFcpData - No such parameter exist in ICC");
-OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_HANDLEFCPDATA, "CMmPhoneBookStoreOperationBase::HandleFcpData - No such parameter exist in ICC Card" );
-                break;
-            }
+        ret = KErrNotFound;
         }
     return ret;
     }
 
-
-
-// -----------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::Get16bit
-// Copies unsigned 16-bit word from source descriptor from location pointed
-// by index
-// -----------------------------------------------------------------------------
-//
-void CMmPhoneBookStoreOperationBase::Get16bit
-        (
-        TInt& aTarget,   //Target
-        const TDesC8& aSource,    //Source
-        TInt aIndex         //Index
-        )
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::Get16bit");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_GET16BIT, "CMmPhoneBookStoreOperationBase::Get16bit" );
-    
-    
-    if ( aIndex + 1 < aSource.Length() )
-        {
-        aTarget = TUint16( aSource[aIndex] ) << 8;
-        aTarget = TUint16( aTarget | aSource[aIndex + 1] );
-        }
-    }
-
-
-
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationlist.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationlist.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,15 +25,16 @@
 #include "cmmphonebookoperationinit3G_adn.h"
 #include "cmmphonebookoperationcache.h"
 #include "cmmphonebookoperationread.h"
+#include "cmmphonebookoperationread3g_adn.h"
 #include "cmmphonebookoperationwrite.h"
 #include "cmmphonebookoperationdelete.h"
 #include "cmmphonebookoperationcustom.h"
 
 //For CMmPhoneMessHandler::EServiceTableRequestTypePhonebookMBI
 #include "cmmphonemesshandler.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonebookstoreoperationlisttraces.h"
+#include "cmmphonebookstoreoperationlistTraces.h"
 #endif
 
 
@@ -86,10 +87,12 @@
     {
     TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::\
         ~CMmPhoneBookStoreOperationList");
-OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONLIST_CMMPHONEBOOKSTOREOPERATIONLIST, "CMmPhoneBookStoreOperationList::~CMmPhoneBookStoreOperationList" );
+    OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONLIST_CMMPHONEBOOKSTOREOPERATIONLIST, "CMmPhoneBookStoreOperationList::~CMmPhoneBookStoreOperationList" );
 
-    iPtrOperationArray.Reset();
-    iPtrOperationArray.Close();
+    iPtrOperationArrayNew.DeleteAll();
+    // resets all elements to 
+    iPtrOperationArrayNew.Reset();
+
     }
 
 // ---------------------------------------------------------------------------
@@ -128,152 +131,25 @@
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_CONSTRUCTL, "CMmPhoneBookStoreOperationList::ConstructL" );
     }
 
+
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationList::Build
-// Separate request and create correct object
+// CMmPhoneBookStoreOperationList::AddOperation
+// Add Creted operation to List
 // ---------------------------------------------------------------------------
 //
-CMmPhoneBookStoreOperationBase* CMmPhoneBookStoreOperationList::BuildL(
-    const CMmDataPackage* aDataPackage,
-    TInt aIpc
-    )
+void CMmPhoneBookStoreOperationList::AddOperation(
+    TUint8 aTrans,
+    CMmPhoneBookStoreOperationBase* aOperation )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::Build");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_BUILDL, "CMmPhoneBookStoreOperationList::BuildL" );
-
-    CMmPhoneBookStoreOperationBase* pointer( NULL );
-
-    switch( aIpc )
-        {
-        case EMmTsyPhoneBookStoreInitIPC:
-            {
-            
-            // Get Card type from uiccmesshandler
-            // if SIM, phonebook is 2G and located under DFtelecom and ADN pb contains only name/number entries
-            // if USIM, phonebook can be 3G local or 3G private. ADN pb entry can contain additional entries
-            // 3G local is located under DFtelecom and 3G private under ADFusim, both have same structure however
-            // only the path is different? 7F10 vs. 7FFF
-            // Here in UICCCreateReq only 3G local has been handled
-            // So for both SIM and USIM Phonebook will be under DFtelecom (whose address is 7F10)
-            
+    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::AddOperation");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_ADDOPERATION, "CMmPhoneBookStoreOperationList::AddOperation" );
 
-            // Chekc for Card type to Create Class for Phonebook Init
-            if(UICC_CARD_TYPE_UICC == iUiccMessHandler->GetCardType())
-                {
-                //call CmmPhonebookOperatorInit3G_ADN Phonebook
-                pointer = CMmPhoneBookOperationInit3G_adn::NewL(
-                        iMmPhoneBookStoreMessHandler,
-                        iUiccMessHandler,
-                        aDataPackage
-                        );
-                CleanupStack::PushL( pointer );
-                // Add pointer to array
-                iPtrOperationArray.AppendL( pointer );
-                CleanupStack::Pop( pointer );
-                
-                }
-            else if(UICC_CARD_TYPE_ICC ==  iUiccMessHandler->GetCardType())
-                {
-                //call CmmPhonebookOperatorInit
-                pointer = CMmPhoneBookOperationInit::NewL(
-                    iMmPhoneBookStoreMessHandler,
-                    iUiccMessHandler,
-                    aDataPackage
-                    );
-                CleanupStack::PushL( pointer );
-                // Add pointer to array
-                iPtrOperationArray.AppendL( pointer );
-                CleanupStack::Pop( pointer );
-                }
-            break;
-            }
-            /*
-        case EMmTsyPhoneBookStoreGetInfoIPC:
-        case EMmTsyPhoneBookStoreCacheIPC:
-            {
-            //call CmmPhonebookOperatorCache
-            pointer = CMmPhoneBookOperationCache::NewL(
-                iMmPhoneBookStoreMessHandler,
-                aIpc, aDataPackage );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
-            break;
-            }
-            */
-        case EMmTsyPhoneBookStoreReadIPC:
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-        case ECustomReadAlphaStringIPC:
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            {
-            //call CmmPhonebookOperatorRead
-            pointer = CMmPhoneBookOperationRead::NewL(
-                iMmPhoneBookStoreMessHandler,
-                aDataPackage );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
-            break;
-            }
-            /*
-        case EMmTsyPhoneBookStoreWriteIPC:
+    if( (( aTrans - ETrIdPbOperationStart ) >= 0)&& ((aTrans - ETrIdPbOperationStart) < KMaxPbTrIdCount ))
+        {
+        iPtrOperationArrayNew[aTrans - ETrIdPbOperationStart] = aOperation;
+        }
+    }
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-        case ECustomWriteAlphaStringIPC:
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            {
-            //call CmmPhonebookOperationWrite
-            pointer = CMmPhoneBookOperationWrite::NewL(
-                iMmPhoneBookStoreMessHandler,
-                aDataPackage );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
-            break;
-            }
-        case EMmTsyPhoneBookStoreDeleteIPC:
-        case EMmTsyPhoneBookStoreDeleteAllIPC:
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-        case ECustomDeleteAlphaStringIPC:
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            {
-            //call CmmPhonebookOperatorDelete
-            pointer = CMmPhoneBookOperationDelete::NewL(
-                iMmPhoneBookStoreMessHandler,
-                aDataPackage );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
-            break;
-            }
-        case EMobilePhoneGetMailboxNumbers:
-            {
-            pointer =  new ( ELeave )CMmPhonebookOperationCustom(
-                iMmPhoneBookStoreMessHandler );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
-            break;
-            }
-            */
-        default:
-            {
-            // Nothing to do here
-            TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ExtFuncL - \
-                Unknown IPC: %d", aIpc);
-OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONLIST_BUILDL, "CMmPhoneBookStoreOperationList::BuildL;Unknown aIpc=%d", aIpc );
-            break;
-            }
-        }
-
-    //return pointer to right operation
-    return pointer;
-    }
 
 // ---------------------------------------------------------------------------
 // CMmPhoneBookStoreOperationList::Find
@@ -281,37 +157,19 @@
 // ---------------------------------------------------------------------------
 //
 CMmPhoneBookStoreOperationBase* CMmPhoneBookStoreOperationList::Find(
-    TUint8 aTrans,
-    const CMmPhoneBookStoreOperationBase* aSearchFrom/*=NULL*/ )
+    TUint8 aTrans )
     {
     TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::Find");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_FIND, "CMmPhoneBookStoreOperationList::Find" );
 
     CMmPhoneBookStoreOperationBase* basePointer( NULL );
-
-    // search correct pointer from array using aTrans
-    TUint ind( 0 );
-    if ( NULL != aSearchFrom )
+    //transaction id is basically just an index to operation array + start offset
+    //of phonebook operations
+    TInt ind ( aTrans - ETrIdPbOperationStart );
+    
+    if( (ind >= 0)&& (ind < KMaxPbTrIdCount ))
         {
-        // if object to search from specified, find its index at first
-        for ( ; ind < iPtrOperationArray.Count(); ind++ )
-            {
-            if ( aSearchFrom == iPtrOperationArray[ind] )
-                {
-                ind++;
-                break;
-                }
-            }
-        }
-    // looking for object with given transaction id
-    // starting index may be not 0 if aSearchFrom is specified
-    for ( ; ind < iPtrOperationArray.Count(); ind++)
-        {
-        if( ( iPtrOperationArray[ind] )->TransId() == aTrans )
-            {
-            basePointer = iPtrOperationArray[ind];
-            break;
-            }
+        basePointer = iPtrOperationArrayNew[aTrans - ETrIdPbOperationStart];
         }
     // return pointer if found otherwise NULL
     return basePointer;
@@ -325,94 +183,64 @@
 void CMmPhoneBookStoreOperationList::RemoveOperationFromList(
     TUint8 aTrans )  // transactionId
     {
-    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::\
-        RemoveOperationFromList");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_REMOVEOPERATIONFROMLIST, "CMmPhoneBookStoreOperationList::RemoveOperationFromList" );
-
-    TUint ind( 0 );
-    TUint operationCount( iPtrOperationArray.Count() );
+    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::RemoveOperationFromList");
+    OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONLIST_REMOVEOPERATIONFROMLIST, "CMmPhoneBookStoreOperationList::RemoveOperationFromList" );
+    
 
-    // search correct pointer from array using aTrans
-    while ( ind < operationCount )
-        {
-        if( ( iPtrOperationArray[ind] )->TransId() == aTrans )
-            {
-            delete iPtrOperationArray[ind];
-            iPtrOperationArray.Remove( ind );
-            iPtrOperationArray.Compress();
-            TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationList -Phonebook \
-                operation removed succesfully from index: %d" ,ind );
-            break;
-            }
-        ind++;
-        }
-    TF_ASSERT( ind < operationCount );
+    delete iPtrOperationArrayNew[aTrans - ETrIdPbOperationStart];
+    iPtrOperationArrayNew[aTrans - ETrIdPbOperationStart] = NULL;
+            
+    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationList -Phonebook operation removed succesfully from index: %d" , ( aTrans - ETrIdPbOperationStart ) );
+
+    TF_ASSERT( ( aTrans - ETrIdPbOperationStart ) < KMaxPbTrIdCount );
     }
 
+
+
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationList::RemoveLastOperationFromList
-// Removes last operation from operation list.
+// CMmPhoneBookStoreOperationList::FindEmptyIndexTransId
+// Check for the empty Index available in operation array
 // ---------------------------------------------------------------------------
 //
-TInt CMmPhoneBookStoreOperationList::RemoveLastOperationFromList()
+TInt CMmPhoneBookStoreOperationList::FindEmptyIndexTransId()
     {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::RemoveLastOperationFromList");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_REMOVELASTOPERATIONFROMLIST, "CMmPhoneBookStoreOperationList::RemoveLastOperationFromList" );
-
-    TInt ret( KErrNone );
-    TInt count( iPtrOperationArray.Count() );
-
-    if ( 0 < count )
+    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::FindEmptyIndexTransId");
+    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_FINDEMPTYINDEXTRANSID, "CMmPhoneBookStoreOperationList::FindEmptyIndexTransId" );
+    
+    TInt transId = -1;
+    for( TInt count = 0 ; count < KMaxPbTrIdCount ; count++)
         {
-        iPtrOperationArray.Remove( count - 1 );
+        if( iPtrOperationArrayNew[count] == NULL )
+            {
+            transId = count + ETrIdPbOperationStart ;
+            break;
+            }
         }
-    else
-        {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::RemoveLastOperationFromList - no operation to remove");
-OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONLIST_REMOVELASTOPERATIONFROMLIST, "CMmPhoneBookStoreOperationList::RemoveLastOperationFromList - no operation to remove" );
-
-        ret = KErrNotFound;
-        }
-
-    return ret;
+    return transId;
     }
 
+
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationList::CalculateTransactionId
-// Calculates transaction Id from IPC number and data package
+// CMmPhoneBookStoreOperationList::CancelOperation
+// Cancel all operation with same phonebook name
 // ---------------------------------------------------------------------------
 //
-TInt CMmPhoneBookStoreOperationList::CalculateTransactionId(
-    TInt aIpc,
-    const CMmDataPackage* /*aDataPackage*/,
-    TUint8& /*aTransactionId*/
-    )
+void CMmPhoneBookStoreOperationList::CancelOperation( TName &aPhoneBook)
     {
-    TInt ret( KErrNone );
-
-    TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationList::CalculateTransactionId;aIpc=%d", aIpc);
-OstTrace1( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_CALCULATETRANSACTIONID, "CMmPhoneBookStoreOperationList::CalculateTransactionId;aIpc=%d", aIpc );
-
-    switch ( aIpc )
+    TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::CancelOperation");
+    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONLIST_CANCELOPERATION, "CMmPhoneBookStoreOperationList::CancelOperation" );
+  
+    // Chekc for all operation which have the same phonebook name
+    for( TInt count = 0 ; count < KMaxPbTrIdCount ; count++)
         {
-        	/*
-        case EMmTsyPhoneBookStoreGetInfoIPC:
-        case EMmTsyPhoneBookStoreCacheIPC:
+        if( iPtrOperationArrayNew[count]!= NULL )
             {
-            ret = CMmPhoneBookOperationCache::CalculateTransactionId(
-                      aIpc, aDataPackage, aTransactionId );
-            break;
-            }
-            */
-        default:
-            {
-            TFLOGSTRING("TSY: CMmPhoneBookStoreOperationList::CalculateTransactionId;unknown ipc");
-OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONLIST_CALCULATETRANSACTIONID, "CMmPhoneBookStoreOperationList::CalculateTransactionId; unknown ipc" );
-            ret = KErrNotSupported;
+            // Call Cancel function for that operation
+            iPtrOperationArrayNew[count]->CancelReq( aPhoneBook );
             }
         }
-
-    return ret;
     }
 
+
+
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonemesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonemesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -27,7 +27,7 @@
 #include "cmmnetmesshandler.h"
 #include "cmmnetoperatornamehandler.h"
 #include "tsylogger.h"
-#include "cmmuiccmesshandler.h"
+#include "cmmphonebookoperationinit.h"
 
 #include <call_modemisi.h>
 #include <ctsy/pluginapi/cmmdatapackage.h>
@@ -49,9 +49,9 @@
 #include <tisi.h>
 #include <uiccisi.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonemesshandlertraces.h"
+#include "cmmphonemesshandlerTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -70,6 +70,11 @@
 const TUint8 KServiceProviderSize = 36;
 const TUint8 KSpnFileSize = 16;
 
+const TUint8 KServiceAcl( 35 );
+const TUint8 KAclStateMask( 4 );
+const TUint8 KNumOfApnsIndex( 0 );
+const TUint8 KApnDataIndex( 1 );
+
 // ------------------------------------------------------
 // --- Alternate Line Service (ALS)-related constants ---
 // ------------------------------------------------------
@@ -153,6 +158,16 @@
 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
         INFO_SERIAL_NUMBER_READ_RESP );
 
+    aPhoNetReceiver->RegisterL(
+        phoneMessHandler,
+        PN_UICC,
+        UICC_REFRESH_RESP );
+
+    aPhoNetReceiver->RegisterL(
+        phoneMessHandler,
+        PN_UICC,
+        UICC_REFRESH_IND );
+
     CleanupStack::Pop( phoneMessHandler );
 
     return phoneMessHandler;
@@ -180,7 +195,7 @@
 
     iCommonTSYRefreshPending = EFalse;
     iRefreshError = EFalse;
-
+    iCompleteRefresfDone = EFalse;
     iInternalRefreshFiles = 0;
 
     SubscribeEventsFromPhoNet();
@@ -284,6 +299,7 @@
         // UICC SERVER INDICATIONS
             PN_UICC, UICC_CARD_IND,
             PN_UICC, UICC_IND,
+            PN_UICC, UICC_REFRESH_IND,
 
 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
         // MTC SERVER INDICATIONS
@@ -389,6 +405,148 @@
             ret = UiccReadServiceProviderName();
             break;
             }
+        case EMmTsySimRefreshDoneIPC:
+            {
+            iCommonTSYRefreshPending = EFalse;
+            TBool readError;
+            aDataPackage->UnPackData( readError );
+
+            if ( ! readError )
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::ExtFuncL: commontsy refresh successfully completed ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_EXTFUNCL, "CMmPhoneMessHandler::ExtFuncL: commontsy refresh successfully completed ==> REFRESH_DONE" );
+                ret = UiccRefreshReq( UICC_REFRESH_DONE );
+                }
+            else
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::ExtFuncL: commontsy refresh completed with an error ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEMESSHANDLER_EXTFUNCL, "CMmPhoneMessHandler::ExtFuncL: commontsy refresh completed with an error ==> REFRESH_DONE" );
+                ret = UiccRefreshReq( UICC_REFRESH_NOT_OK );
+                }
+            break;
+            }
+
+        case EMobilePhoneGetAPNControlListServiceStatus:
+            {
+            if( !iACLIsProgress )
+                {
+                iOngoingAclIpc = EMobilePhoneGetAPNControlListServiceStatus;
+                iACLIsProgress = ETrue;
+                ret = UiccReadEfEstReq();
+                }
+            else
+                {
+                ret = KErrInUse;
+                }
+            break;
+            }
+        case EMobilePhoneSetAPNControlListServiceStatus:
+            {
+            if( !iACLIsProgress )
+                {
+                iOngoingAclIpc = EMobilePhoneSetAPNControlListServiceStatus;
+                iACLIsProgress = ETrue;
+                aDataPackage->UnPackData( iAclStatus );
+                ret = UiccReadEfEstReq();
+                }
+            else
+                {
+                ret = KErrInUse;
+                }
+            break;
+            }
+        case EMobilePhoneDeleteAPNName:
+            {
+            if( !iACLIsProgress )
+                {
+                iACLIsProgress = ETrue;
+                iOngoingAclIpc = EMobilePhoneDeleteAPNName;
+                aDataPackage->UnPackData( iAPNReadOrDeleteIndex );
+                if( !iAPNList )
+                    {
+                    ret = UiccReadAclReq();
+                    }
+                else
+                    {
+                    ret = UiccDeleteApnEntry( iAPNReadOrDeleteIndex );
+                    }
+                }
+            else
+                {
+                ret = KErrInUse;
+                }
+            break;
+            }
+        case EMobilePhoneAppendAPNName:
+            {
+            if( !iACLIsProgress )
+                {
+                iACLIsProgress = ETrue;
+                iOngoingAclIpc = EMobilePhoneAppendAPNName;
+                RMobilePhone::TAPNEntryV3* apnEntryName( NULL );
+                aDataPackage->UnPackData( &apnEntryName );
+                iAPNDataBuffer =  *apnEntryName;
+
+                if( !iAPNList )
+                    {
+                    ret = UiccReadAclReq();
+                    }
+                else
+                    {
+                    iAPNList->AppendL( iAPNDataBuffer.iApn );
+                    ret = UiccWriteEfAclReq();
+                    }
+                }
+            else
+                {
+                ret = KErrInUse;
+                }
+            break;
+            }
+        case EMobilePhoneEnumerateAPNEntries:
+            {
+            if( !iAPNList )
+                {
+                if( !iACLIsProgress )
+                    {
+                    iACLIsProgress = ETrue;
+                    iOngoingAclIpc = EMobilePhoneEnumerateAPNEntries;
+                    ret = UiccReadAclReq();
+                    }
+                else
+                    {
+                    ret = KErrInUse;
+                    }
+                }
+            else
+                {
+                CompleteEnumerateAPNEntries();
+                }
+            break;
+            }
+        case EMobilePhoneGetAPNname:
+            {
+            aDataPackage->UnPackData( iAPNReadOrDeleteIndex );
+            if( !iAPNList )
+                {
+                if( !iACLIsProgress )
+                    {
+                    iACLIsProgress = ETrue;
+                    iOngoingAclIpc = EMobilePhoneGetAPNname;
+                    ret = UiccReadAclReq();
+                    }
+                else
+                    {
+                    ret = KErrInUse;
+                    }
+                }
+            else
+                {
+                CompleteGetAPNName( iAPNReadOrDeleteIndex );
+                }
+            break;
+            }
+
         default:
             {
 TFLOGSTRING2("TSY: CMmPhoneMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
@@ -442,6 +600,27 @@
                 }
             break; // end case PN_MODEM_INFO
             }
+        case PN_UICC:
+            {
+            switch( messageId )
+                {
+                case UICC_REFRESH_IND:
+                    {
+                    UiccRefreshInd( aIsiMessage );
+                    break;
+                    }
+                case UICC_REFRESH_RESP:
+                    {
+                    UiccRefreshResp( aIsiMessage );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            break;
+            }
         default:
             {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::ReceiveMessageL, switch resource - default.\n" );
@@ -966,6 +1145,7 @@
 TInt CMmPhoneMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY: CMmPhoneMessHandler::ProcessUiccMsg, transaction ID: %d, status %d", aTraId, aStatus );
@@ -1002,6 +1182,33 @@
             UiccWriteDynamicFlagsResp( aStatus );
             break;
             }
+        case ETrIdAclStatusReadEfEst:
+            {
+            if( EMobilePhoneGetAPNControlListServiceStatus == iOngoingAclIpc )
+                {
+                UiccGetAclStatusReadEfEstResp( aStatus, aFileData );
+                }
+            else if( EMobilePhoneSetAPNControlListServiceStatus == iOngoingAclIpc )
+                {
+                UiccSetAclStatusReadEfEstResp( aStatus, aFileData );
+                }
+            break;
+            }
+        case ETrIdAclStatusWriteEfEst:
+            {
+            UiccSetAclStatusWriteEfEstResp( aStatus );
+            break;
+            }
+        case ETrIdAclReadEfAcl:
+            {
+            UiccReadAclResp( aStatus, aFileData );
+            break;
+            }
+        case ETrIdAclWriteEfAcl:
+            {
+            UiccWriteEfAclResp( aStatus );
+            break;
+            }
         default:
             {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::ProcessUiccMsg - unknown transaction ID" );
@@ -1214,4 +1421,1087 @@
     iServiceProviderName.iPLMNField.Zero();
     }
 
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccRefreshInd
+//
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccRefreshInd( const TIsiReceiveC &aIsiMessage )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccRefreshInd");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREFRESHIND, "CMmPhoneMessHandler::UiccRefreshInd" );
+    TUint8 serviceType( aIsiMessage.Get8bit(
+        ISI_HEADER_SIZE + UICC_REFRESH_IND_OFFSET_SERVICETYPE ) );
+    if ( UICC_REFRESH_PERMISSION == serviceType )
+        {
+        UiccRefreshReq( UICC_REFRESH_OK );
+        }
+    else if ( UICC_REFRESH_NOW == serviceType )
+        {
+        HandleUiccRefresh( aIsiMessage );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccRefreshResp
+//
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccRefreshResp( const TIsiReceiveC &aIsiMessage )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccRefreshResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREFRESHRESP, "CMmPhoneMessHandler::UiccRefreshResp" );
+    if ( iCompleteRefresfDone )
+        {
+        TUint8 status( aIsiMessage.Get8bit(
+            ISI_HEADER_SIZE + UICC_REFRESH_RESP_OFFSET_STATUS ) );
+        TInt err( KErrNone );
+        if ( UICC_STATUS_OK != status )
+            {
+            err = KErrGeneral;
+            }
+        iMessageRouter->Complete( EMmTsySimRefreshDoneIPC, err );
+        iCompleteRefresfDone = EFalse;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccRefreshReq
+//
+// --------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccRefreshReq( TUint8 aStatus )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccRefreshReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREFRESHREQ, "CMmPhoneMessHandler::UiccRefreshReq" );
+    TInt ret( KErrNone );
+
+    // If there was error in cacheing some file, set internal flag
+    if ( UICC_REFRESH_NOT_OK == aStatus )
+        {
+        iRefreshError = ETrue;
+        }
+
+    // If NTSY or CTSY cacheing is ongoing, message is not sent
+    if ( ! iCommonTSYRefreshPending && ! iInternalRefreshFiles )
+        {
+        if ( iRefreshError ) // Some cacheing was failed, set error status
+            {
+            aStatus = UICC_REFRESH_NOT_OK;
+            }
+
+        TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
+        isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
+        isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KPhoneTransId );
+        isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_REFRESH_REQ );
+        isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REFRESH_REQ_OFFSET_SERVICETYPE,
+            UICC_REFRESH_STATUS );
+        isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REFRESH_REQ_OFFSET_STATUS,
+            aStatus );
+        isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REFRESH_REQ_OFFSET_CLIENTID,
+            iMmUiccMessHandler->GetUiccClientId() );
+        isiMsg.Set16bit( ISI_HEADER_SIZE + UICC_REFRESH_REQ_OFFSET_FILLERBYTE1,
+            KPadding );
+        isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REFRESH_REQ_OFFSET_NSB,
+            0 ); // No subblocks
+
+        ret = iPhoNetSender->Send( isiMsg.Complete() );
+        iRefreshError = EFalse;
+
+        // When NTSY/CTSY refresh was performed, set iCompleteRefresfDone flag
+        // that IPC EMmTsySimRefreshDoneIPC will be completed to CTSY
+        if ( UICC_REFRESH_DONE == aStatus || UICC_REFRESH_NOT_OK == aStatus )
+            {
+            iCompleteRefresfDone = ETrue;
+            }
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::HandleUiccRefresh
+//
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::HandleUiccRefresh( const TIsiReceiveC &aIsiMessage )
+    {
+TFLOGSTRING("TSY:CMmPhoneMessHandler::HandleUiccRefresh" );
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh" );
+
+    TUint16 refreshFiles( 0 );
+    TBool enabledServicesChanged( EFalse );
+    TUint startIndex( ISI_HEADER_SIZE + SIZE_UICC_REFRESH_IND );
+
+    // There is one subblock UICC_SB_APPL_PATH per refreshed file
+    TUint uiccSbApplPathOffset( 0 );
+    while ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+        startIndex,
+        UICC_SB_APPL_PATH,
+        EIsiSubBlockTypeId16Len16,
+        uiccSbApplPathOffset ) )
+        {
+        TUint16 sbLen( aIsiMessage.Get16bit(
+            uiccSbApplPathOffset + UICC_SB_APPL_PATH_OFFSET_SBLEN ) );
+
+        // Get file id
+        TUint16 fileId( aIsiMessage.Get16bit(
+            uiccSbApplPathOffset + UICC_SB_APPL_PATH_OFFSET_EF ) );
+
+        switch( fileId )
+            {
+            case KElemFileSmsParams: // 6F42, SMS parameters
+                {
+TFLOGSTRING("TSY:CMmPhoneMessHandler::HandleUiccRefresh: SMSP refresh.");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: SMSP refresh" );
+                refreshFiles |= KCacheSmsParams;
+                break;
+                }
+            case KElemFileFixedDiallingNumbers: // 6F3B, Storage FDN
+                {
+TFLOGSTRING("TSY:CMmPhoneMessHandler::HandleUiccRefresh: FDN refresh");
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: FDN refresh" );
+                refreshFiles |= KCacheFdn;
+                break;
+                }
+            case KElemSimServiceTable: // 6F38, Service table
+                {
+TFLOGSTRING("TSY:CMmPhoneMessHandler::HandleUiccRefresh: ServiceTable refresh");
+OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: ServiceTable refresh" );
+                refreshFiles |= KCacheServiceTable;
+                // Also internal service table cacheing is needed. EFalse means
+                // no complete to CTSY.
+                iInternalRefreshFiles |= KRefreshServiceTable;
+                iMmUiccMessHandler->InitializeSimServiceTableCache( EFalse );
+                break;
+                }
+            case KElemFileDynFlagsOrange: // 6F9F, ALS
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: ALS line refresh");
+OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: ALS line." );
+                refreshFiles |= KCacheALSline;
+                break;
+                }
+            case KElemFileShortMessages: // 6F3C, SMS
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: SMS refresh");
+OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: SMS refresh" );
+                iInternalRefreshFiles |= KRefreshSms;
+                iMessageRouter->GetSmsMessHandler()->InitializeSmsCache();
+                break;
+                }
+            case KElemFileAcl: // 6F57, ACL
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: APN refresh");
+OstTrace0( TRACE_NORMAL, DUP7_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: APN refresh" );
+                iMessageRouter->Complete(
+                    EMobilePhoneNotifyAPNListChanged,
+                    KErrNone );
+
+                // Clear and delete cache
+                if ( iAPNList )
+                    {
+                    iAPNList->Reset();
+                    delete iAPNList;
+                    iAPNList = NULL;
+                    }
+                break;
+                }
+            case KElemEst: // 6F56, Enabled service table
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: ServiceTable enabled");
+OstTrace0( TRACE_NORMAL, DUP8_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: ServiceTable enabled" );
+                enabledServicesChanged = ETrue;
+                break;
+                }
+            case KElemFileCallFwdFlagsCphs:
+            case KElemFileCallFwdIndicationStatus:
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: Call forwarding flags refresh ");
+OstTrace0( TRACE_NORMAL, DUP9_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: Call forwarding flags refresh" );
+                // Re-read call forwarding flags
+                iInternalRefreshFiles |= KRefreshCallForwardingFlags;
+
+                iMessageRouter->GetSupplServHandler()->ExtFuncL(
+                    ECustomNotifyIccCallForwardingStatusChangeIPC,
+                    NULL );
+                break;
+                }
+            case KElemFileOpl: // 6FC6, Operator PLMN List
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: OPL list refresh");
+OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: OPL list refresh" );
+
+                iInternalRefreshFiles |= KRefreshOplRules;
+
+                iMessageRouter->
+                    GetNetMessHandler()->
+                    GetNetOperatorNameHandler()->
+                    UiccReadOplRecordCount();
+                break;
+                }
+            case KElemFilePlmnNetworkName: // 6FC5, PLMN Network Name
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: PNN refresh");
+OstTrace0( TRACE_NORMAL, DUP11_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: PNN refresh" );
+
+                iInternalRefreshFiles |= KRefreshPnnRecord;
+
+                // Get PNN record to be cached.
+                TUint8 pnnIdentifier(
+                    iMessageRouter->
+                    GetNetMessHandler()->
+                    GetNetOperatorNameHandler()->
+                    GetPnnRecordIdentifierValue() );
+
+                iMessageRouter->
+                    GetNetMessHandler()->
+                    GetNetOperatorNameHandler()->
+                    UiccOperatorReqReadPnn( pnnIdentifier );
+                break;
+                }
+            case KElemFileOperatorName: // 6F14, Operator name
+                {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::HandleUiccRefresh: ONS name refresh");
+OstTrace0( TRACE_NORMAL, DUP12_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: ONS name refresh" );
+
+                iInternalRefreshFiles |= KRefreshOnsName;
+
+                iMessageRouter->
+                    GetNetMessHandler()->
+                    GetNetOperatorNameHandler()->
+                    UiccOperatorReq();
+                break;
+                }
+            default:
+                {
+TFLOGSTRING2("TSY:CMmPhoneMessHandler::HandleUiccRefresh:Unknown type: 0x%x", fileId);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh;fileId=%hu", fileId );
+                break;
+                }
+            }
+
+        // Abbreviated dialling numbers, EFadn 4FXX
+        if ( 0x4F == ( fileId >> 8 ) )
+            {
+TFLOGSTRING("TSY:CMmPhoneMessHandler::HandleUiccRefresh: ADN refresh.");
+OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh: ADN refresh" );
+
+            refreshFiles |= KCacheAdn;
+            }
+
+        startIndex = uiccSbApplPathOffset + sbLen;
+        }
+
+    // If Enabled Services table has been changed during the refresh,
+    // we need to make phonebook init phase 1 to enable UICC to send
+    // indication about FDN.
+    if ( enabledServicesChanged )
+        {
+        // In case of ADN or FDN phonebook refresh, CommonTSY is
+        // responsible of making phonebook initialization. => No need for
+        // internal initialization.
+        if ( !( refreshFiles & KCacheAdn )
+            && !( refreshFiles & KCacheFdn ) )
+            {
+            // Creating buffer for phonebook's name
+            TName phonebookName;
+            phonebookName.Copy( KInternalPhoneBookType );
+
+            CPhoneBookDataPackage package;
+            package.SetPhoneBookName( phonebookName );
+
+            iMessageRouter->PhoneBookStoreMessHandler()->ExtFuncL(
+                EMmTsyPhoneBookStoreInitIPC,
+                &package );
+            }
+        }
+
+    // Check if we have any files to refresh in CommonTSY.
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::HandleUiccRefresh: refreshFiles = %d", refreshFiles );
+OstTraceExt1( TRACE_NORMAL, DUP14_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh;refreshFiles=%hu", refreshFiles );
+    if ( 0 < refreshFiles )
+        {
+        iCommonTSYRefreshPending = ETrue;
+
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::HandleUiccRefresh: CommonTSY Refresh Pending = %d", iCommonTSYRefreshPending );
+OstTrace1( TRACE_NORMAL, DUP15_CMMPHONEMESSHANDLER_HANDLEUICCREFRESH, "CMmPhoneMessHandler::HandleUiccRefresh;iCommonTSYRefreshPending=%d", iCommonTSYRefreshPending );
+
+        // Packed parameter: List of files needed to be refreshed.
+        CMmDataPackage dataPackage;
+        dataPackage.PackData( &refreshFiles );
+
+        // Complete. This will start the cache update process.
+        iMessageRouter->Complete(
+            EMmTsySimRefreshNowIPC,
+            &dataPackage,
+            KErrNone );
+        }
+
+    // Send refresh done to UICC only if there's no CTSY/NTSY
+    // caching ongoing.
+    if ( ! iCommonTSYRefreshPending && ! iInternalRefreshFiles )
+        {
+        UiccRefreshReq( UICC_REFRESH_DONE );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::SmsCachingCompleted
+// Checks if "Refresh Done" will be sent to UICC now or later.
+// Counterpart is CMmPhoneMessHandler::ExtFuncL, case
+// EMmTsySimRefreshDoneIPC.
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::SmsCachingCompleted( TInt aError )
+    {
+    iInternalRefreshFiles ^= KRefreshSms;
+
+    if ( KErrNone == aError )
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::SmsCachingCompleted: nokiatsy sms caching completed");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_SMSCACHINGCOMPLETED, "CMmPhoneMessHandler::SmsCachingCompleted: nokiatsy sms caching completed" );
+        UiccRefreshReq( UICC_REFRESH_DONE );
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::SmsCachingCompleted: nokiatsy sms caching completed with error %d", aError);
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_SMSCACHINGCOMPLETED, "CMmPhoneMessHandler::SmsCachingCompleted: nokiatsy sms caching completed with error" );
+        UiccRefreshReq( UICC_REFRESH_NOT_OK );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::ServiceTableCachingCompleted
+// Checks if "Refresh Done" will be sent to UICC now or later.
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::ServiceTableCachingCompleted( TInt aError )
+    {
+    iInternalRefreshFiles ^= KRefreshServiceTable;
+
+    if ( UICC_STATUS_OK == aError )
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::ServiceTableCachingCompleted: nokiatsy service table caching completed");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_SERVICETABLECACHINGCOMPLETED, "CMmPhoneMessHandler::ServiceTableCachingCompleted: nokiatsy service table caching completed" );
+        UiccRefreshReq( UICC_REFRESH_DONE );
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::ServiceTableCachingCompleted: nokiatsy service table caching completed with error %d", aError);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_SERVICETABLECACHINGCOMPLETED, "CMmPhoneMessHandler::ServiceTableCachingCompleted: nokiatsy service table caching completed with error;aError=%d", aError );
+        UiccRefreshReq( UICC_REFRESH_NOT_OK );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::CallForwFlagsCachingCompleted
+// Checks if "Refresh Done" will be sent to UICC.
+// Counterpart is CMmPhoneMessHandler::ExtFuncL, case
+// EMmTsySimRefreshDoneIPC.
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::CallForwFlagsCachingCompleted( TUint aError )
+    {
+    iInternalRefreshFiles ^= KRefreshCallForwardingFlags;
+
+    if ( UICC_STATUS_OK == aError )
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::CallForwFlagsCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_CALLFORWFLAGSCACHINGCOMPLETED, "CMmPhoneMessHandler::CallForwFlagsCachingCompleted: nokiatsy refresh successfully completed" );
+        UiccRefreshReq( UICC_REFRESH_DONE );
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::CallForwFlagsCachingCompleted: nokiatsy refresh completed with error %d ==> REFRESH_DONE", aError);
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_CALLFORWFLAGSCACHINGCOMPLETED, "CMmPhoneMessHandler::CallForwFlagsCachingCompleted: nokiatsy refresh completed with error" );
+        UiccRefreshReq( UICC_REFRESH_NOT_OK );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::OplRulesCachingCompleted
+// Checks if "Refresh Done" will be sent to UICC.
+// ----------------------------------------------------------------------------
+//
+TBool CMmPhoneMessHandler::OplRulesCachingCompleted( TInt aError )
+    {
+    // Initialize OPL refresh ongoing value.
+    TBool oplRefreshOngoing( EFalse );
+
+    // Check if refresh is ongoing.
+    if ( iInternalRefreshFiles & KRefreshOplRules )
+        {
+        iInternalRefreshFiles ^= KRefreshOplRules;
+
+        oplRefreshOngoing = ETrue;
+
+        if ( KErrNone == aError )
+            {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::OplRulesCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_OPLRULESCACHINGCOMPLETED, "CMmPhoneMessHandler::OplRulesCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE" );
+            UiccRefreshReq( UICC_REFRESH_DONE );
+            }
+        else
+            {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::OplRulesCachingCompleted: nokiatsy refresh completed with error %d ==> REFRESH_DONE", aError);
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_OPLRULESCACHINGCOMPLETED, "CMmPhoneMessHandler::OplRulesCachingCompleted: nokiatsy refresh completed with error" );
+            UiccRefreshReq( UICC_REFRESH_NOT_OK );
+            }
+        }
+
+    return oplRefreshOngoing;
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::PnnRecordCachingCompleted
+// Checks if "Refresh Done" will be sent to UICC.
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::PnnRecordCachingCompleted( TUint8 aError )
+    {
+    // Check if refresh is ongoing.
+    if ( iInternalRefreshFiles & KRefreshPnnRecord )
+        {
+        iInternalRefreshFiles ^= KRefreshPnnRecord;
+
+        if ( UICC_STATUS_OK == aError )
+            {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::PnnRecordCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_PNNRECORDCACHINGCOMPLETED, "CMmPhoneMessHandler::PnnRecordCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE" );
+            UiccRefreshReq( UICC_REFRESH_DONE );
+            }
+        else
+            {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::PnnRecordCachingCompleted: nokiatsy refresh completed with error %d ==> REFRESH_DONE", aError);
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_PNNRECORDCACHINGCOMPLETED, "CMmPhoneMessHandler::PnnRecordCachingCompleted: nokiatsy refresh completed with error" );
+            UiccRefreshReq( UICC_REFRESH_NOT_OK );
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::OnsNameCachingCompleted
+// Checks if "Refresh Done" will be sent to SIMSON.
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::OnsNameCachingCompleted( TUint8 aError )
+    {
+    // Check if refresh is ongoing.
+    if ( iInternalRefreshFiles & KRefreshOnsName )
+        {
+        iInternalRefreshFiles ^= KRefreshOnsName;
+
+        if ( UICC_STATUS_OK == aError )
+            {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::OnsNameCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_ONSNAMECACHINGCOMPLETED, "CMmPhoneMessHandler::OnsNameCachingCompleted: nokiatsy refresh successfully completed ==> REFRESH_DONE" );
+            UiccRefreshReq( UICC_REFRESH_DONE );
+            }
+        else
+            {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::OnsNameCachingCompleted: nokiatsy refresh completed with error %d ==> REFRESH_DONE", aError);
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_ONSNAMECACHINGCOMPLETED, "CMmPhoneMessHandler::OnsNameCachingCompleted: nokiatsy refresh completed with error" );
+            UiccRefreshReq( UICC_REFRESH_NOT_OK );
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccReadEfEstReq
+// reads EFest
+// ----------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccReadEfEstReq()
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadEfEstReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADEFESTREQ, "CMmPhoneMessHandler::UiccReadEfEstReq" );
+
+    TInt ret( KErrNone );
+
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() &&
+        iMmUiccMessHandler->GetServiceStatus( KServiceAcl ) )
+        {
+        // Set parameters for UICC_APPL_CMD_REQ message
+        TUiccReadTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = ETrIdAclStatusReadEfEst;
+        params.dataAmount = 0;
+        params.dataOffset = 0;
+        params.fileId = KElemEst;
+        params.fileIdSfi = 0x05;
+        params.serviceType = UICC_APPL_READ_TRANSPARENT;
+
+        // File id path
+        params.filePath.Append( KMasterFileId >> 8 );
+        params.filePath.Append( KMasterFileId );
+        params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadEfEstReq: card type is NOT UICC or ACL not supported in EFust");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCREADEFESTREQ, "CMmPhoneMessHandler::UiccReadEfEstReq: card type is NOT UICC or ACL not supported in EFust" );
+        iACLIsProgress = EFalse;
+        ret = KErrNotFound;
+        }
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp
+// Handles EFest read response in case of getting ACL status
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCGETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp" );
+
+    TInt ret( KErrNone );
+    RMobilePhone::TAPNControlListServiceStatus aclStatus;
+
+    if( UICC_STATUS_OK == aStatus )
+        {
+        TUint8 aclState( aFileData[0] & KAclStateMask );
+        if( aclState )
+            {
+            aclStatus = RMobilePhone::EAPNControlListServiceEnabled;
+            }
+        else
+            {
+            aclStatus = RMobilePhone::EAPNControlListServiceDisabled;
+            }
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp: EFest reading failed: 0x%x", aStatus);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCGETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccGetAclStatusReadEfEstResp: EFest reading failed: 0x%x", aStatus );
+        ret = KErrAccessDenied;
+        }
+
+    // complete with packed parameter
+    CMmDataPackage dataPackage;
+
+    if( KErrNone == ret )
+        {
+        dataPackage.PackData( &aclStatus );
+        }
+
+    iACLIsProgress = EFalse; //set ACL flag
+    iMessageRouter->Complete(
+        EMobilePhoneGetAPNControlListServiceStatus,
+        &dataPackage,
+        ret );
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp
+// Handles EFest read response in case of setting ACL status
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCSETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp" );
+
+    TInt ret( KErrNone );
+    TBool completeNeeded( ETrue );
+
+    if( UICC_STATUS_OK == aStatus )
+        {
+        TUint8 aclState( aFileData[0] );
+        if( aclState & KAclStateMask )
+            {
+            if( RMobilePhone::EAPNControlListServiceDisabled == iAclStatus )
+                {
+                // ACL state is enabled and we need to set it to disabled .
+                // So EFest needs to be updated
+                completeNeeded = EFalse;
+                UiccSetAclStatusWriteEfEstReq( aclState );
+                }
+            else
+                {
+                // ACL status already correct, let's complete
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: ACL status already correct, let's complete");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCSETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: ACL status already correct, let's complete" );
+                }
+            }
+        else
+            {
+            if( RMobilePhone::EAPNControlListServiceEnabled == iAclStatus )
+                {
+                // EFest needs to be updated
+                completeNeeded = EFalse;
+                UiccSetAclStatusWriteEfEstReq( aclState );
+                }
+            else
+                {
+                // ACL status already correct, let's complete
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: ACL status already correct, let's complete");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEMESSHANDLER_UICCSETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: ACL status already correct, let's complete" );
+                }
+            }
+        }
+    else
+        {
+        // EFest reading failed
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: EFest reading failed: 0x%x", aStatus );
+OstTrace1( TRACE_NORMAL, DUP3_CMMPHONEMESSHANDLER_UICCSETACLSTATUSREADEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusReadEfEstResp: EFest reading failed: 0x%x", aStatus );
+        ret = KErrAccessDenied;
+        }
+
+    if( completeNeeded )
+        {
+        // set flag and complete
+        iACLIsProgress = EFalse; //set ACL flag
+        iMessageRouter->Complete(
+            EMobilePhoneSetAPNControlListServiceStatus,
+            ret );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq
+// Writes ACL status to EFest
+// ----------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq(  TUint8 aOldAclState )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCSETACLSTATUSWRITEEFESTREQ, "CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq" );
+
+    TInt ret( KErrNone );
+    TUint8 newState;
+    if( RMobilePhone::EAPNControlListServiceDisabled == iAclStatus )
+        {
+        // ACL status is going to be disabled and status is in 3rd
+        // bit of 1st byte, so let's set 3rd bit in 1st byte to 0
+        newState = aOldAclState & 0xFB;
+        }
+    else
+        {
+        // ACL status is going to be enabled and status is in 3rd
+        // bit of 1st byte, so let's set 3rd bit in 1st byte to 1
+        newState = aOldAclState + 0x04;
+        }
+
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() &&
+        iMmUiccMessHandler->GetServiceStatus( KServiceAcl ) )
+        {
+        TUiccWriteTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = ETrIdAclStatusWriteEfEst;
+        params.dataOffset = 0;
+        params.dataAmount = 1; // only one byte is update
+        params.fileId = KElemEst;
+        params.fileIdSfi = 0x05;
+        params.serviceType = UICC_APPL_UPDATE_TRANSPARENT;
+        // File id path
+        params.filePath.Append( KMasterFileId >> 8 );
+        params.filePath.Append( KMasterFileId );
+        params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+        params.fileData.Append( newState );
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq: card type is NOT UICC or ACL not supported in EFust");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCSETACLSTATUSWRITEEFESTREQ, "CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq: card type is NOT UICC or ACL not supported in EFust" );
+        iACLIsProgress = EFalse;
+        ret = KErrGeneral;
+        }
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp
+// Handles EFest write response in case of setting ACL status
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp(
+    TInt aStatus )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCSETACLSTATUSWRITEEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp" );
+    TInt ret( KErrAccessDenied );
+
+    if( UICC_STATUS_OK == aStatus )
+        {
+        ret = KErrNone;
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp: writing failed: 0x%x", aStatus);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCSETACLSTATUSWRITEEFESTRESP, "CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstResp: writing failed: 0x%x", aStatus );
+        }
+
+    iACLIsProgress = EFalse; //set ACL flag
+    iMessageRouter->Complete(
+        EMobilePhoneSetAPNControlListServiceStatus,
+        ret );
+
+    if ( KErrNone == ret )
+        {
+        iMessageRouter->Complete(
+            EMobilePhoneNotifyAPNControlListServiceStatusChange,
+            KErrNone );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccReadAclReq
+// reads ACL list from EFacl
+// ----------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccReadAclReq()
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadAclReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADACLREQ, "CMmPhoneMessHandler::UiccReadAclReq" );
+
+    TInt ret( KErrNone );
+
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() &&
+        iMmUiccMessHandler->GetServiceStatus( KServiceAcl ) )
+        {
+        // Set parameters for UICC_APPL_CMD_REQ message
+        TUiccReadTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = ETrIdAclReadEfAcl;
+        params.dataAmount = 0;
+        params.dataOffset = 0;
+        params.fileId = KElemFileAcl;
+        params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+        params.serviceType = UICC_APPL_READ_TRANSPARENT;
+
+        // File id path
+        params.filePath.Append( KMasterFileId >> 8 );
+        params.filePath.Append( KMasterFileId );
+        params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadAclReq: card type is NOT UICC or ACL not supported in EFust");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCREADACLREQ, "CMmPhoneMessHandler::UiccReadAclReq: card type is NOT UICC or ACL not supported in EFust" );
+        iACLIsProgress = EFalse;
+        ret = KErrNotFound;
+        }
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccReadAclResp
+// Handles response for ACL list reading from EFacl
+// ----------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccReadAclResp(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadAclResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADACLRESP, "CMmPhoneMessHandler::UiccReadAclResp" );
+    TInt ret( KErrNone );
+    if( UICC_STATUS_OK == aStatus )
+        {
+        if( iAPNList )
+            {
+            delete iAPNList;
+            iAPNList = 0;
+            }
+
+        TPtrC8 dataPoint;
+        dataPoint.Set( &aFileData[KApnDataIndex], aFileData.Length() - 1 );
+        iAPNList = DecodeACL( dataPoint, aFileData[KNumOfApnsIndex] );
+
+        switch( iOngoingAclIpc )
+            {
+            case EMobilePhoneEnumerateAPNEntries:
+                {
+                CompleteEnumerateAPNEntries();
+                break;
+                }
+            case EMobilePhoneGetAPNname:
+                {
+                CompleteGetAPNName( iAPNReadOrDeleteIndex );
+                break;
+                }
+            case EMobilePhoneDeleteAPNName:
+                {
+                ret = UiccDeleteApnEntry( iAPNReadOrDeleteIndex );
+                break;
+                }
+            case EMobilePhoneAppendAPNName:
+                {
+                iAPNList->AppendL( iAPNDataBuffer.iApn );
+                ret = UiccWriteEfAclReq();
+                break;
+                }
+            default:
+                {
+TFLOGSTRING2( "TSY: CMmPhoneMessHandler::UiccReadAclResp: unknown IPC (%d)", iOngoingAclIpc );
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCREADACLRESP, "CMmPhoneMessHandler::UiccReadAclResp: unknown IPC (%d)", iOngoingAclIpc );
+                iACLIsProgress = EFalse;
+                break;
+                }
+            }
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::UiccReadAclResp: reading failed: 0x%x", aStatus);
+OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEMESSHANDLER_UICCREADACLRESP, "CMmPhoneMessHandler::UiccReadAclResp: reading failed: 0x%x", aStatus );
+        ret = KErrAccessDenied;
+        }
+
+    if( KErrNone != ret )
+        {
+        iACLIsProgress = EFalse;
+        iMessageRouter->Complete( iOngoingAclIpc, ret );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::DecodeACL
+// Encrypt from ACL to CDesC8ArrayFlat
+// --------------------------------------------------------------------------
+//
+CDesC8ArrayFlat* CMmPhoneMessHandler::DecodeACL
+        (
+        const TDesC8& aTlv,
+        TInt aTotalEntries
+        ) const
+    {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::DecodeACL. Number of total entries: %d", aTotalEntries);
+OstTrace1( TRACE_NORMAL, CMMPHONEMESSHANDLER_DECODEACL, "CMmPhoneMessHandler::DecodeACL. Number of total entries: %d", aTotalEntries );
+
+    // allocate new array, 1 is granularity
+    CDesC8ArrayFlat* apnList = new( ELeave ) CDesC8ArrayFlat( 1 );
+    CleanupStack::PushL( apnList );
+
+    TInt offset( 0 );
+
+    //check length before using
+    if ( 0 < aTlv.Length() )
+        {
+        // decode TLV entries to CDesC8ArrayFlat
+        for ( TInt i = 0; i < aTotalEntries; i++ )
+            {
+            TInt tag( aTlv[offset++] );
+
+            // spec: The tag value of the APN-TLV shall be 'DD'
+            TF_ASSERT( tag == 0xdd );
+
+            TInt len( aTlv[offset++] );
+            TF_ASSERT( len <= 100 );   // spec: APN max length is 100
+
+            TPtrC8 data = aTlv.Mid( offset, len );
+            apnList->InsertL( i, data );
+
+            offset += len; // advance to next TLV
+            }
+        }
+
+    CleanupStack::Pop( apnList );
+    return apnList;
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::CompleteEnumerateAPNEntries
+// send number of ACL index to the client.
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::CompleteEnumerateAPNEntries()
+    {
+    TInt indexCount( iAPNList->MdcaCount() );
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::CompleteEnumerateAPNEntries. Number of APN's: %d",indexCount);
+OstTrace1( TRACE_NORMAL, CMMPHONEMESSHANDLER_COMPLETEENUMERATEAPNENTRIES, "CMmPhoneMessHandler::CompleteEnumerateAPNEntries. Number of APN's: %d", indexCount );
+
+    //package index of TLV's to the client
+    CMmDataPackage dataPackage;
+    dataPackage.PackData( &indexCount );
+
+    // set flag and complete
+    iACLIsProgress = EFalse; //set ACL flag
+    iMessageRouter->Complete(
+        EMobilePhoneEnumerateAPNEntries,
+        &dataPackage,
+        KErrNone );
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::CompleteGetAPNName
+// send APN name to the client.
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::CompleteGetAPNName( TUint8 aIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::CompleteGetAPNName ");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_COMPLETEGETAPNNAME, "CMmPhoneMessHandler::CompleteGetAPNName" );
+
+    CMmDataPackage dataPackage;
+    RMobilePhone::TAPNEntryV3 aclEntry;
+    TInt err( KErrNone );
+
+    //check if index is valid or not.
+    if ( iAPNList->MdcaCount() <= aIndex )
+        {
+        err = KErrOverflow;
+        }
+    else
+        {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::CompleteGetAPNName. Copy entry from index %d",aIndex);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_COMPLETEGETAPNNAME, "CMmPhoneMessHandler::CompleteGetAPNName. Copy entry from index %d", aIndex );
+        aclEntry.iApn.Copy( iAPNList->MdcaPoint( aIndex ) );
+        }
+
+    dataPackage.PackData( &aclEntry );
+
+    // set flag and complete
+    iACLIsProgress = EFalse; //set ACL flag
+    iMessageRouter->Complete( EMobilePhoneGetAPNname, &dataPackage, err );
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccDeleteApnEntry
+// Deletes APN entry from internal cache and writes the change to EFacl
+// --------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccDeleteApnEntry( TInt aIndex )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccDeleteApnEntry ");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCDELETEAPNENTRY, "CMmPhoneMessHandler::UiccDeleteApnEntry" );
+
+    TInt ret;
+    //check if aIndex is valid or not.
+    if ( iAPNList->MdcaCount() <= aIndex )
+        {
+        //error occurs
+        ret = KErrOverflow;
+        }
+    else
+        {
+        //data is valid
+        //delete data from cache
+        iAPNList->Delete( aIndex );
+        iAPNList->Compress();
+
+        //write new list to the SIM
+        ret = UiccWriteEfAclReq();
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccWriteEfAclReq
+// Writes APN entries from internal cache to the EFAcl
+// --------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccWriteEfAclReq()
+    {
+TFLOGSTRING( "TSY: CMmPhoneMessHandler::UiccWriteEfAclReq" );
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCWRITEEFACLREQ, "CMmPhoneMessHandler::UiccWriteEfAclReq" );
+
+    TInt ret( KErrNone );
+
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() &&
+        iMmUiccMessHandler->GetServiceStatus( KServiceAcl ) )
+        {
+        TInt dataLen( ACLLength( iAPNList ) );
+        TUint8 apnCount( iAPNList->MdcaCount() );
+
+        TUiccWriteTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = ETrIdAclWriteEfAcl;
+        params.dataOffset = 0;
+        params.dataAmount = dataLen;
+        params.fileId = KElemFileAcl;
+        params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+        params.serviceType = UICC_APPL_UPDATE_TRANSPARENT;
+        // File id path
+        params.filePath.Append( KMasterFileId >> 8 );
+        params.filePath.Append( KMasterFileId );
+        params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+        params.fileData.Append( apnCount );
+        for ( TInt i = 0; i < apnCount; i++ )
+            {
+            TPtrC8 apn = iAPNList->MdcaPoint( i );
+            // spec: The tag value of the APN-TLV shall be 'DD'
+            params.fileData.Append( 0xdd );
+            params.fileData.Append( apn.Length() );
+            params.fileData.Append( apn );
+            }
+
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccWriteEfAclReq: card type is NOT UICC or ACL not supported in EFust");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCWRITEEFACLREQ, "CMmPhoneMessHandler::UiccWriteEfAclReq: card type is NOT UICC or ACL not supported in EFust" );
+        iACLIsProgress = EFalse;
+        ret = KErrNotFound;
+        }
+    return ret;
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccWriteEfAclResp
+// Handles response for EFAcl writing
+// --------------------------------------------------------------------------
+//
+void CMmPhoneMessHandler::UiccWriteEfAclResp( TInt aStatus )
+    {
+TFLOGSTRING( "TSY: CMmPhoneMessHandler::UiccWriteEfAclResp" );
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCWRITEEFACLRESP, "CMmPhoneMessHandler::UiccWriteEfAclResp" );
+
+    TInt ret( KErrNone );
+    if( UICC_STATUS_OK != aStatus )
+        {
+TFLOGSTRING2( "TSY: CMmPhoneMessHandler::UiccWriteEfAclResp: EFacl writing failed: 0x%x", aStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_UICCWRITEEFACLRESP, "CMmPhoneMessHandler::UiccWriteEfAclResp: EFacl writing failed: 0x%x", aStatus );
+
+        ret = KErrAccessDenied;
+        }
+
+    iACLIsProgress = EFalse; //set ACL flag
+    iMessageRouter->Complete(
+        iOngoingAclIpc,
+        ret );
+    }
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::ACLLength
+// calculate total length of ACL
+// --------------------------------------------------------------------------
+//
+TUint16 CMmPhoneMessHandler::ACLLength( CDesC8ArrayFlat* aApnList ) const
+    {
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::ACLLength. Count: %d", aApnList->MdcaCount());
+OstTrace1( TRACE_NORMAL, CMMPHONEMESSHANDLER_ACLLENGTH, "CMmPhoneMessHandler::ACLLength. Count: %d", aApnList->MdcaCount() );
+
+    TUint16 length( 0 );
+
+    for ( TInt i = 0; i < aApnList->MdcaCount(); i++ )
+        {
+        TPtrC8 apn = aApnList->MdcaPoint( i );
+        length += apn.Length() + 2;
+        }
+
+    // result is incremented by one because of EFacl contains number of tlv objects
+    // as first byte of the file data
+    length++;
+
+TFLOGSTRING2("TSY: CMmPhoneMessHandler::ACLLength. ACL len: %d", length);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_ACLLENGTH, "CMmPhoneMessHandler::ACLLength. ACL len: %d", length );
+
+    return length;
+    }
+
 // End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetreceiver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetreceiver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,9 +27,9 @@
 
 // ISA CellMo ATK server
 #include <pn_const.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonetreceivertraces.h"
+#include "cmmphonetreceiverTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetsender.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonetsender.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,9 +23,9 @@
 #include "cmmphonetreceiver.h"
 #include <ctsy/serviceapi/mmtsy_defaults.h>
 #include "tsylogger.h" // for logging purposes
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmphonetsendertraces.h"
+#include "cmmphonetsenderTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpipecontrol.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpipecontrol.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,9 +27,9 @@
 #include <nsisi.h>
 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmpipecontroltraces.h"
+#include "cmmpipecontrolTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -683,7 +683,6 @@
     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
 
     // pipe control handles only messages for NIF pipes
-    // TODO: See TelAd-110
     TInt ret = iContextList->PipeCreateTransIdOkByTransId( transId );
 
     if ( KErrNone == ret )
@@ -771,7 +770,6 @@
     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
 
     // pipe control handles only messages for NIF pipes
-    // TODO: See TelAd-110
     TInt ret = iContextList->PipeCreateTransIdOkByTransId( transId );
 
     if ( KErrNone == ret )
@@ -887,7 +885,6 @@
     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
 
     // pipe control handles only messages for NIF pipes
-    // TODO: See TelAd-110
     TInt ret = iContextList->PipeCreateTransIdOkByTransId( transId );
 
     if ( KErrNone == ret )
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsecuritymesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsecuritymesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,9 +23,9 @@
 #include "cmmnetmesshandler.h"
 #include "cmmcallmesshandler.h"
 #include "tsylogger.h" // logging
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmsecuritymesshandlertraces.h"
+#include "cmmsecuritymesshandlerTraces.h"
 #endif
 
 #include <etelmm.h>
@@ -64,7 +64,6 @@
 const TUint8 KFdnStateMask        = 0x01;
 const TUint8 KServiceActivated    = 0x01;
 const TUint8 KServiceNotActivated = 0x00;
-const TUint8 KFileStatusIndex     = 0x0B;
 const TUint8 KInvalidated         = 0x00;
 const TUint8 KNotInvalidated      = 0x01;
 const TUint8 KInvalidateFlagMask  = 0x01;
@@ -2059,6 +2058,7 @@
 TInt CMmSecurityMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING("TSY: CMmSecurityMessHandler::ProcessUiccMsg");
@@ -2403,7 +2403,8 @@
             // let's check the current FDN status. 
             // If EFadn is invalidated, FDN is enabled, otherwise FDN
             // is disabled
-            TUint8 invalidationFlag( aFileData[KFileStatusIndex] & KInvalidateFlagMask );
+            TFci fci( aFileData );
+            TUint8 invalidationFlag( fci.GetFileStatus() & KInvalidateFlagMask );
 
             if( ( KInvalidated == invalidationFlag && 
                   RMobilePhone::EFdnSetOn == iFdnSetting ) ||
@@ -2459,7 +2460,8 @@
         if( iMmUiccMessHandler->GetServiceStatus( KIccServiceFdn ) &&
             iMmUiccMessHandler->GetServiceStatus( KIccServiceAdn ) )
             {
-            TUint8 invalidationFlag( aFileData[KFileStatusIndex] & KInvalidateFlagMask );
+            TFci fci( aFileData );
+            TUint8 invalidationFlag( fci.GetFileStatus() & KInvalidateFlagMask );
 
             if( KInvalidated == invalidationFlag )
                 {
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmscache.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmscache.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,9 +25,9 @@
 #include "tsylogger.h"
 #include "tisi.h"
 #include <smsisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmsmscachetraces.h"
+#include "cmmsmscacheTraces.h"
 #endif
 
 //  External Data Structures
@@ -328,4 +328,24 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CMmSmsCache::SetStorageStatus
+// Changes the storage status of a cached entry (TS 31.102, clause 4.2.25)
+// -----------------------------------------------------------------------------
+//
+void CMmSmsCache::SetStorageStatus(
+    TInt aLocation,
+    RMobileSmsStore::TMobileSmsStoreStatus aMsgStatus )
+    {
+TFLOGSTRING2("TSY: CMmSmsCache::SetStorageStatus(loc=%d)", aLocation);
+OstTrace1( TRACE_NORMAL, CMMSMSCACHE_SETSTORAGESTATUS, "CMmSmsCache::SetStorageStatus;aLocation=%d", aLocation );
+
+    if ( aLocation <= iElements.Count()
+        && aLocation >= 1
+        && iElements[aLocation-1] )
+        {
+        // Entry exists, update status.
+        iElements[aLocation-1]->iMsgStatus = aMsgStatus;
+        }
+    }
 //  End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsgsmaddress.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsgsmaddress.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,9 +21,9 @@
 #include "cmmsmsgsmaddress.h"
 #include <ctsy/serviceapi/cmmsmsutility.h> // for kmaxamountofdigits
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmsmsgsmaddresstraces.h"
+#include "cmmsmsgsmaddressTraces.h"
 #endif
       // for logging purposes
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -39,9 +39,9 @@
 #include "cmmphonemesshandler.h"
 #include "tsylogger.h"
 #include "cmmphonetsender.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmsmsmesshandlertraces.h"
+#include "cmmsmsmesshandlerTraces.h"
 #endif
 
 //  External Data Structures
@@ -83,6 +83,17 @@
 // const TUint8 KSizeOfAlphaTag( 34 ); Compiler warning removal
 const TUint8 KSmsScTimeStampMaxLength( 7 );
 
+// Constanst for SMS parameters
+const TUint8 KSmsMandatoryParamsLength( 28 );
+const TUint8 KSmsMaxAddressLength( 12 );
+const TUint8 KSmsParamsParamIndicatorOffset( 0 );
+const TUint8 KSmsParamsDestAddressOffset( 1 );
+const TUint8 KSmsParamsScAddressOffset( 13 );
+const TUint8 KSmsParamsProtocolIdOffset( 25 );
+const TUint8 KSmsParamsDcsOffset( 26 );
+const TUint8 KSmsParamsValidityPeriodOffset( 27 );
+const TUint8 KSizeOfAlphaTag( 62 );
+
 //  MODULE DATA STRUCTURES
 
 //  Local Data Structures
@@ -175,6 +186,11 @@
     iReceivedClass2ToBeReSent = EFalse;
     // default bearer setting is "CS preferred"
     iMobileSmsBearer = RMobileSmsMessaging::ESmsBearerCircuitPreferred;
+
+    iMemoryCapacityExceeded = EFalse;
+
+    // Reading of SMSP entries starts from record 1
+    iSmspRecordNumber = 1;
     }
 
 // -----------------------------------------------------------------------------
@@ -297,6 +313,26 @@
     if ( RMobileSmsMessaging::KGsmTpduSize >= sendData.iMsgData->Length() )
         {
         msgData.Append( *sendData.iMsgData );
+
+        // Get TP-MTI (TP-Message-Type-Indicator) from first octet of TPDU
+        TUint8 tpMti( msgData[KTpduIndexMessageParameters] &
+            TSmsFirstOctet::ESmsMTIMask );
+        if ( TSmsFirstOctet::ESmsMTISubmitOrSubmitReport == tpMti )
+            {
+            subBlockId = SMS_SB_SUBMIT;
+            }
+        else if ( TSmsFirstOctet::ESmsMTIStatusReportOrCommand == tpMti )
+            {
+            subBlockId = SMS_SB_COMMAND;
+            }
+        else // Message type not supported
+            {
+            ret = CMmStaticUtility::EpocErrorCode(
+                KErrArgument,
+                KErrGsmSMSTpduNotSupported );
+TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! SMS type not supported: %d", tpMti);
+OstTraceExt1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error! SMS type not supported;tpMti=%hhu", tpMti );
+            }
         }
     else
         {
@@ -319,26 +355,6 @@
 OstTraceExt2( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error!;msgAttr->iFlags=%d;msgAttr->iDataFormat=%hhu", msgAttr->iFlags, msgAttr->iDataFormat );
         }
 
-    // Get TP-MTI (TP-Message-Type-Indicator) from first octet of TPDU
-    TUint8 tpMti( msgData[KTpduIndexMessageParameters] &
-        TSmsFirstOctet::ESmsMTIMask );
-    if ( TSmsFirstOctet::ESmsMTISubmitOrSubmitReport == tpMti )
-        {
-        subBlockId = SMS_SB_SUBMIT;
-        }
-    else if ( TSmsFirstOctet::ESmsMTIStatusReportOrCommand == tpMti )
-        {
-        subBlockId = SMS_SB_COMMAND;
-        }
-    else // Message type not supported
-        {
-        ret = CMmStaticUtility::EpocErrorCode(
-            KErrArgument,
-            KErrGsmSMSTpduNotSupported );
-TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsMessageSendReq. Error! SMS type not supported: %d", tpMti);
-OstTraceExt1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_SMSMESSAGESENDREQ, "CMmSmsMessHandler::SmsMessageSendReq.Error! SMS type not supported;tpMti=%hhu", tpMti );
-        }
-
 #if (NCP_COMMON_S60_VERSION_SUPPORT>S60_VERSION_32)
     // Check whether there is SMS sending ongoing.
     if ( iSMSSendingOngoing )
@@ -592,13 +608,11 @@
                 tpUdl,
                 tpUserDataIndex,
                 defaultAlphabet,
-                msgOffset
-                );
+                msgOffset );
             numOfSubblocks++;
-            msgOffset += lengthOfSMSUserDataSb + 1; // Add one byte to put offset into
-                                                    // next free position.
-TFLOGSTRING("TSY: CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created." );
-OstTrace0( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CREATESMSMESSAGESENDREQ, "CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created." );
+            msgOffset += lengthOfSMSUserDataSb;
+TFLOGSTRING2("TSY: CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created. Message offset: %d", msgOffset );
+OstTraceExt1( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CREATESMSMESSAGESENDREQ, "CMmSmsMessHandler::CreateSmsMessageSendReq. SMS_SB_USER_DATA created.;msgOffset=%hhu", msgOffset );
             }
 
         // Create SMS_SB_CHECK_INFO subblock if user data exists
@@ -649,6 +663,7 @@
         {
         trId = ESmsMessagingResumeSmsReception;
         }
+
     TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
     isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_SMS );
     isiMsg.Set8bit(
@@ -1215,6 +1230,15 @@
         smsServerCauseType,
         smsServerCauseValue ) );
 
+    if ( KErrNone == epocError )
+        {
+        // even if client deactivates reception, next time it is activated
+        // SMS server will ask network to resend all NACKed MT SMs
+        // only query status does not affect this flag, but this action
+        // is not used
+        iMemoryCapacityExceeded = EFalse;
+        }
+
     // Compete active reception status
     if ( SMS_RECEPTION_ACTIVE == receptionStatus )
         {
@@ -1412,38 +1436,52 @@
     {
 TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedMsgInd");
 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd" );
-    TInt ret( KErrNone );
-    // Create a package
-    CMmDataPackage package;
-
-    TUint8 replaceTpPid( 0 ); // IsSmsClass2 also fills this
-    TBool receivedSmsClass2( IsSmsClass2( aIsiMsg, replaceTpPid ) );
-
-    // SIM SMS cache: incoming class 2 SMS
-    if ( receivedSmsClass2 )
+
+    if ( iMemoryCapacityExceeded )
         {
-        ret = SmsClass2ReceivedMsgInd( aIsiMsg, replaceTpPid );
+TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedMsgInd no storage - internal NACK");
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDMSGIND, "CMmSmsMessHandler::SmsReceivedMsgInd no storage - internal NACK" );
+        // error is ignored
+        SmsReceivedMsgReportReq(
+            EInternalNack,
+            NULL,
+            KErrGsmSMSMemoryCapacityExceeded );
         }
-    // Received SMS is not a class 2 SMS (it is a normal SMS)
     else
         {
-        ret = SmsClass1ReceivedMsgInd( aIsiMsg );
-        }
-    // There was an error, complete to upper level
-    if ( KErrNone != ret )
-        {
+        TInt ret( KErrNone );
+        // Create a package
+        CMmDataPackage package;
+
+        TUint8 replaceTpPid( 0 ); // IsSmsClass2 also fills this
+        TBool receivedSmsClass2( IsSmsClass2( aIsiMsg, replaceTpPid ) );
+
+        // SIM SMS cache: incoming class 2 SMS
+        if ( receivedSmsClass2 )
+            {
+            ret = SmsClass2ReceivedMsgInd( aIsiMsg, replaceTpPid );
+            }
+        // Received SMS is not a class 2 SMS (it is a normal SMS)
+        else
+            {
+            ret = SmsClass1ReceivedMsgInd( aIsiMsg );
+            }
+        // There was an error, complete to upper level
+        if ( KErrNone != ret )
+            {
 TFLOGSTRING2("TSY: CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret);
 OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSPPROUTINGNTF, "CMmSmsMessHandler::SmsReceivedMsgInd;ret=%d", ret );
-        TBool smsInd( ETrue );
-        TSmsMsg* nullSms = NULL;
-
-        package.PackData( &smsInd, &nullSms );
-
-        // Complete request to client
-        iMessageRouter->Complete(
-            EMobileSmsMessagingReceiveMessage,
-            &package,
-            ret );
+            TBool smsInd( ETrue );
+            TSmsMsg* nullSms = NULL;
+
+            package.PackData( &smsInd, &nullSms );
+
+            // Complete request to client
+            iMessageRouter->Complete(
+                EMobileSmsMessagingReceiveMessage,
+                &package,
+                ret );
+            }
         }
     }
 
@@ -1463,52 +1501,72 @@
 TFLOGSTRING3("TSY: CMmSmsMessHandler::SmsReceivedPpReportResp - traId: %d, cause: %d", traId, cause);
 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;traId=%hhu;cause=%hhu", traId, cause );
 
-    // Response for SmsReceivedPpReportReq (Ack)
-    if ( ESmsMessagingAckSmsStored == traId )
+    if ( iMemoryCapacityExceeded )
         {
-        iMessageRouter->Complete(
-            EMobileSmsMessagingAckSmsStored,
-            CMmStaticUtility::CSCauseToEpocError(
-                PN_SMS,
-                SMS_CAUSE_TYPE_COMMON,
-                cause ) );
-        }
-    // Response for SmsReceivedPpReportReq (Nack)
-    else if ( ESmsMessagingNackSmsStored == traId )
-        {
-        iMessageRouter->Complete(
-            EMobileSmsMessagingNackSmsStored,
-            CMmStaticUtility::CSCauseToEpocError(
-                PN_SMS,
-                SMS_CAUSE_TYPE_COMMON,
-                cause ) );
+        // ignore the response, this is response to self-NACK
+        // caused by client not having anymore storage space
+TFLOGSTRING("TSY: CMmSmsMessHandler::SmsReceivedPpReportResp - self-NACK");
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_SMSRECEIVEDMSGREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp - self-NACK" );
         }
     else
         {
+        // Response for SmsReceivedPpReportReq (Ack)
+        if ( ESmsMessagingAckSmsStored == traId )
+            {
+            iMessageRouter->Complete(
+                EMobileSmsMessagingAckSmsStored,
+                CMmStaticUtility::CSCauseToEpocError(
+                    PN_SMS,
+                    SMS_CAUSE_TYPE_COMMON,
+                    cause ) );
+            }
+        // Response for SmsReceivedPpReportReq (Nack)
+        else if ( ESmsMessagingNackSmsStored == traId ||
+            ESmsMessagingNackSmsStoredCapacityExceeded == traId )
+            {
+            iMessageRouter->Complete(
+                EMobileSmsMessagingNackSmsStored,
+                CMmStaticUtility::CSCauseToEpocError(
+                    PN_SMS,
+                    SMS_CAUSE_TYPE_COMMON,
+                    cause ) );
+            }
+        else
+            {
 TFLOGSTRING2("TSY:CMmSmsMessHandler::SmsReceivedPpReportResp:Unexpected transaction ID %d.",traId);
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_SMSRECEIVEDPPREPORTRESP, "CMmSmsMessHandler::SmsReceivedPpReportResp;Unexpected  transaction ID=%hhu", traId );
-        }
-
-    if ( KErrNone != cause )
-        {
-        //Acknowledging failed.
-        //Complete possible receive message request with KErrGeneral and
-        //set routing activity to false. SMS Stack makes new ReceiveMessage
-        //request.
-        TBool smsInd( EFalse );
-        TSmsMsg* nullSms = NULL;
-
-        //Complete request to client
-        CMmDataPackage package;
-        package.PackData( &smsInd, &nullSms );
-        iSmsSlotLocation = 0;
-
-        // ISI message construction failed or phonet sender
-        // returned error
-        iMessageRouter->Complete(
-            EMobileSmsMessagingReceiveMessage,
-            &package,
-            KErrGeneral );
+            }
+
+        if ( SMS_OK != cause )
+            {
+            //Acknowledging failed.
+            //Complete possible receive message request with KErrGeneral and
+            //set routing activity to false. SMS Stack makes new ReceiveMessage
+            //request.
+            //Client continues receiving MT SM indications if NACKing failed
+            iMemoryCapacityExceeded = EFalse;
+
+            TBool smsInd( EFalse );
+            TSmsMsg* nullSms = NULL;
+
+            //Complete request to client
+            CMmDataPackage package;
+            package.PackData( &smsInd, &nullSms );
+            iSmsSlotLocation = 0;
+
+            // ISI message construction failed or phonet sender
+            // returned error
+            iMessageRouter->Complete(
+                EMobileSmsMessagingReceiveMessage,
+                &package,
+                KErrGeneral );
+            }
+        else if ( ESmsMessagingNackSmsStoredCapacityExceeded == traId )
+            {
+            // client succeeded NACKing MT SM
+            // it wont receive any further MT SM indications
+            iMemoryCapacityExceeded = ETrue;
+            }
         }
     }
 
@@ -1748,12 +1806,15 @@
             }
         case EMobileSmsMessagingGetSmspListPhase1:
             {
-            // Lets delete TSY's internal temporary SMSP storage
+            // Reset internal temporary SMSP storage
             iSmspListArray->ResetAndDestroy();
+            // Start reading SMSP entries
+            ret = UiccGetSmspEntryReq();
             break;
             }
         case EMobileSmsMessagingStoreSmspList:
             {
+            ret = UiccSmsUpdateParameterReq( aDataPackage );
             break;
             }
         case EMobileSmsMessagingAckSmsStored:
@@ -1790,8 +1851,12 @@
 OstTrace0( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_EXTFUNCL, "CMmSmsMessHandler::ExtFuncL, Internal Nack handling started" );
                 }
 
+            // NACK due to lack of storage space causes NTSY to reject further
+            // MT SMs until client resumes SMS reception
+            TUint8 traId = KErrGsmSMSMemoryCapacityExceeded == rpCause ?
+                ESmsMessagingNackSmsStoredCapacityExceeded : ESmsMessagingNackSmsStored;
             ret = SmsReceivedMsgReportReq(
-                ESmsMessagingNackSmsStored,
+                traId,
                 msgData,
                 rpCause );
             break;
@@ -1803,6 +1868,7 @@
             }
         case EMobilePhoneStoreDeleteAll:
             {
+            iRecordId = 1; // Start fron 1st location
             ret = DeleteAllSms();
             break;
             }
@@ -1853,7 +1919,13 @@
 
                 if ( smsFromCache )
                     {
-                    delete smsFromCache;
+                    if ( CheckSCTimestamp( *smsFromCache, scTime ) )
+                        {
+                        // Message with the same timestamp found,
+                        // update SIM flag.
+                        UiccUpdateSMSStatus( currentSlot );
+                        currentSlot = totalSlots; // we're done, exit loop
+                        }
                     }
                 currentSlot++;
                 }
@@ -1880,41 +1952,6 @@
     return ret;
     }
 
-// -----------------------------------------------------------------------------
-// CMmSmsMessHandler::InternalRetrieveSmspListL
-// Complete SmsParametersReadREQuest and call GetSmspList
-// or CompleteReadSmsp method
-// (other items were commented in header)
-// -----------------------------------------------------------------------------
-//
-void CMmSmsMessHandler::InternalRetrieveSmspListL( TSmsParameters* aParameters )
-    {
-TFLOGSTRING("TSY: CMmSmsMessHandler::InternalRetrieveSmspListL");
-OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_INTERNALRETRIEVESMSPLISTL, "CMmSmsMessHandler::InternalRetrieveSmspListL" );
-    // Add parameter sets information to the TSY's internal storage
-    iSmspListArray->AppendL( aParameters );
-
-    // Lets read next SMSP set
-    if ( iLocationOfSmspSet <= iAmountOfSmspSets )
-        {
-        iLocationOfSmspSet++;
-        }
-    else    // All SMSP sets read
-        {
-        //Pack data
-        CMmDataPackage package;
-        package.PackData( iSmspListArray );
-
-        //complete the request,
-        iMessageRouter->Complete(
-            EMobileSmsMessagingGetSmspListPhase1,
-            &package,
-            KErrNone );
-
-        //Delete array
-        iSmspListArray->ResetAndDestroy();
-        }
-    }
 
 // -----------------------------------------------------------------------------
 // CMmSmsMessHandler::CheckTpPidAndSenderAndServiceCenter
@@ -1939,9 +1976,11 @@
 
     // Destination address length is integer representation
     // of the number of useful semi-octets of address field
-    messageReference = ( messageReference + 1 ) / 2;
+    // Add two mandatory bytes of TP-OA, too.
+
+    messageReference = ( ( messageReference + 1 ) / 2) + 2;
     offset += messageReference;
-    offset += 2; // Set offset to Protocol Id
+
     TUint8 protocolId( aSMSOnSIM->iMsgData[offset] );
     if ( protocolId == aReceivedTpPid )
         {
@@ -2127,7 +2166,43 @@
         TInt index( 0 );
         //unpack data
         aDataPackage->UnPackData( index );
-        iSmsCache.SetDeleteLocation( index );
+        RMobileSmsStore::TMobileGsmSmsEntryV1* smsData(
+            iSmsCache.GetEntry( index ) );
+
+        if ( smsData )
+            {
+            iSmsCache.SetDeleteLocation( index );
+
+            // Set parameters for UICC_APPL_CMD_REQ message
+            TUiccWriteLinearFixed params;
+            params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+            params.trId = ETrIdDeleteSMS;
+            params.dataOffset = 0;
+            params.dataAmount = 0;
+            params.record = index;
+
+            params.fileId = KElemFileShortMessages;
+            params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+            params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+
+            // File id path
+            params.filePath.Append( KMasterFileId >> 8 );
+            params.filePath.Append( KMasterFileId );
+            params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+            // Update file data with 0xFF
+            TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf;
+            fileDataBuf.AppendFill( 0xFF, KSmsElemetaryFileRecordLength );
+
+            params.fileData.Append( fileDataBuf );
+
+            return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+            }
+        else
+            {
+            // Location empty or not in use.
+            iMessageRouter->Complete( EMobilePhoneStoreDelete, KErrNone );
+            }
         }
     else
         {
@@ -2151,6 +2226,50 @@
     // SIM SMS cache: -- EMobilePhoneStoreDeleteAll
     if ( KErrNone == iSmsCache.Status() )
         {
+        if ( 0 < iSmsCache.TotalEntries() )
+            {
+            RMobileSmsStore::TMobileGsmSmsEntryV1* smsData(
+                iSmsCache.GetEntry( iRecordId ) );
+
+            if ( smsData )
+                {
+                iSmsCache.SetDeleteLocation( iRecordId );
+
+                // Set parameters for UICC_APPL_CMD_REQ message
+                TUiccWriteLinearFixed params;
+                params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+                params.trId = ETrIdDeleteAllSMSs;
+                params.dataOffset = 0;
+                params.dataAmount = 0;
+                params.record = iRecordId;
+
+                params.fileId = KElemFileShortMessages;
+                params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+                params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+
+                // File id path
+                params.filePath.Append( KMasterFileId >> 8 );
+                params.filePath.Append( KMasterFileId );
+                params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+                // Update file data with 0xFF
+                TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf;
+                fileDataBuf.AppendFill( 0xFF, KSmsElemetaryFileRecordLength );
+
+                params.fileData.Append( fileDataBuf );
+
+                return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+                }
+            else
+                {
+                // Location is empty. Check next location
+                UiccDeleteAllSMSResp( KErrNone );
+                }
+            }
+        else
+            {
+            iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, KErrNone );
+            }
         }
     else
         {
@@ -2959,6 +3078,7 @@
 OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData" );
 
     TUint8 dataLengthInOctets( 0 );
+    TUint8 subblockLength( 0 );
 
     // If data is 7-bit, then TP-UDL is integer representation of
     // the number of septets within the TP-UD field
@@ -2980,19 +3100,23 @@
         userDataBuf,
         SMS_SB_USER_DATA,
         EIsiSubBlockTypeId16Len16 );
-    userDataBuf.Append( KSmsPadding  );
+    userDataBuf.Append( KSmsPadding );
     userDataBuf.Append( dataLengthInOctets );
-    userDataBuf.Append( KSmsPadding  );
-    userDataBuf.Append( aTpUdl  );
+    userDataBuf.Append( KSmsPadding );
+    userDataBuf.Append( aTpUdl );
     userDataBuf.Append( dataBytes );
 
     aIsiMsg.CopyData( aMsgOffset, userData.CompleteSubBlock() );
 
+    subblockLength = userDataBuf.Length();
+
 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data length in octets: %d", dataLengthInOctets );
 TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. User data character count: %d", aTpUdl );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData;dataLengthInOctets=%hhu;aTpUdl=%hhu", dataLengthInOctets, aTpUdl );
-
-    return dataLengthInOctets + 8; // 8 bytes sub block header data before data bytes
+TFLOGSTRING2( "TSY:CMmSmsMessHandler::BuildSmsSbUserData. Length of subblock: %d", subblockLength );
+OstTraceExt1( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_BUILDSMSSBUSERDATA, "CMmSmsMessHandler::BuildSmsSbUserData;subblockLength=%hhu", subblockLength );
+
+    return subblockLength;
     }
 
 
@@ -3069,6 +3193,7 @@
 TInt CMmSmsMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY:CMmSmsMessHandler::ProcessUiccMsg, aTraId: %d, status: %d", aTraId, aStatus );
@@ -3099,6 +3224,70 @@
             GetNumOfEFSMSRecordsResp( aStatus, aFileData );
             break;
             }
+        case ETrIdDeleteSMS:
+            {
+            UiccDeleteSMSResp( aStatus );
+            break;
+            }
+        case ETrIdDeleteAllSMSs:
+            {
+            UiccDeleteAllSMSResp( aStatus );
+            break;
+            }
+        case ETrIdUpdateSMSStatusReadSMS:
+            {
+            UiccUpdateSMSStatusReadSMSResp( aStatus, aFileData );
+            break;
+            }
+        case ETrIdUpdateSMSStatusWriteSMS:
+            {
+            UiccUpdateSMSStatusWriteSMSResp( aStatus );
+            break;
+            }
+        case ETrIdGetSmspEntries:
+            {
+            // If status is OK, save the entry and then try to read next record
+            if ( UICC_STATUS_OK == aStatus )
+                {
+                // Store the entry to the list
+                ret = UiccStoreSmspEntry( aFileData );
+                }
+
+            // If the first record was tried to read, but UICC server returned
+            // error or data was invalid, error is completed to commontsy
+            if ( 1 == iSmspRecordNumber &&
+                ( UICC_STATUS_OK != aStatus || KErrNone != ret ) )
+                {
+                iMessageRouter->Complete(
+                    EMobileSmsMessagingGetSmspListPhase1,
+                    KErrNotFound );
+                // Reset internal array
+                iSmspListArray->ResetAndDestroy();
+                }
+            // At least one SMS entry was read and stored successfully
+            else if( UICC_STATUS_OK != aStatus || KErrNone != ret )
+                {
+                CMmDataPackage package;
+                package.PackData( iSmspListArray );
+                iMessageRouter->Complete(
+                    EMobileSmsMessagingGetSmspListPhase1,
+                    &package,
+                    KErrNone );
+                // Reset internal array
+                iSmspListArray->ResetAndDestroy();
+                }
+            break;
+            }
+        case ETrIdWriteSmspEntry:
+            {
+            TInt error( KErrNone );
+            if ( UICC_STATUS_OK != aStatus )
+                {
+                error = KErrNotFound;
+                }
+            iMessageRouter->Complete( EMobileSmsMessagingStoreSmspList, error );
+            break;
+            }
         default:
             {
 TFLOGSTRING("TSY:CMmSmsMessHandler::ProcessUiccMsg - unknown transaction ID" );
@@ -3287,8 +3476,8 @@
             iSmsCache.Status() );
 
         // it is possible that re-caching was done due to sim refresh.
-//        iMessageRouter->GetPhoneMessHandler()->
-//            SmsCachingCompleted( iSmsCache.Status() );
+        iMessageRouter->GetPhoneMessHandler()->
+            SmsCachingCompleted( iSmsCache.Status() );
 
         // if cache is up and a message was received while cacheing then resume
         if ( KErrNone == iSmsCache.Status() && iReceivedClass2ToBeReSent )
@@ -3637,9 +3826,8 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMmSmsMessHandler::SimStSmsGetNumOfLocReq
-// Construct a SIM_ST_SMS_GET_NUM_OF_LOC_REQ ISI message
-// to the SIM Server
+// CMmSmsMessHandler::GetNumOfEFSMSRecords
+//
 // -----------------------------------------------------------------------------
 //
 void CMmSmsMessHandler::GetNumOfEFSMSRecords( void )
@@ -3666,19 +3854,13 @@
 TFLOGSTRING("TSY: CMmSmsMessHandler::GetNumOfEFSMSRecordsResp" );
 OstTraceExt2( TRACE_NORMAL, CMMSMSMESSHANDLER_GETNUMOFEFSMSRECORDSRESP, "CMmSmsMessHandler::GetNumOfEFSMSRecordsResp;aStatus=%d;aFileData=%s", aStatus, aFileData );
 
-    TInt offSet( 0 );
-
     //Save number of SMS locations on SIM card
     TInt smsNumOfLoc( 0 );
 
     if ( KErrNone == aStatus )
         {
-        offSet = aFileData.Find( &KTagFCIFileDescriptor, 1 );
-        if( offSet != KErrNotFound )
-            {
-            smsNumOfLoc =
-                aFileData[offSet + UICC_FCI_EF_FDESC_OFFSET_NUM_ENTR];
-            }
+        TFci fci( aFileData );
+        smsNumOfLoc = fci.GetNumberOfRecords();
         }
 
     // Continue with reading all sms entries from sim
@@ -3712,4 +3894,594 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccDeleteSMSResp
+//
+// -----------------------------------------------------------------------------
+//
+void CMmSmsMessHandler::UiccDeleteSMSResp( TInt aStatus )
+    {
+TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccDeleteSMSResp aStatus: %d", aStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCDELETESMSRESP, "CMmSmsMessHandler::UiccDeleteSMSResp;aStatus=%d", aStatus );
+
+    // Create Package
+    CMmDataPackage package;
+
+    TInt error( CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) );
+
+    if ( KErrNone == error )
+        {
+        iSmsCache.Delete();
+        }
+    iMessageRouter->Complete( EMobilePhoneStoreDelete, error );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccDeleteAllSMSResp
+//
+// -----------------------------------------------------------------------------
+//
+void CMmSmsMessHandler::UiccDeleteAllSMSResp( TInt aStatus )
+    {
+TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccDeleteSMSResp aStatus: %d", aStatus );
+OstTrace1( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCDELETEALLSMSRESP, "CMmSmsMessHandler::UiccDeleteAllSMSResp;aStatus=%d", aStatus );
+
+    // Create Package
+    CMmDataPackage package;
+
+    TInt error( CMmStaticUtility::UICCCSCauseToEpocError( aStatus ) );
+
+    // Delete SMS from SIM one by one and then all from cache.
+    if ( ( iRecordId < iSmsCache.TotalEntries() ) &&
+         ( KErrNone == error ) )
+        {
+        iRecordId++; // Next record
+        error = DeleteAllSms();
+
+        if ( KErrNone != error )
+            {
+            iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, error );
+            }
+        }
+    else
+        {
+        iSmsCache.DeleteAll();
+        iMessageRouter->Complete( EMobilePhoneStoreDeleteAll, error );
+        }
+
+    }
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::CheckSCTimestamp
+// Returns ETrue if the SC timestamp in this message is equal to
+// the client's timestamp in aScTime.
+// -----------------------------------------------------------------------------
+//
+TBool CMmSmsMessHandler::CheckSCTimestamp(
+    const RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry,
+    const TTime& aScTime )
+    {
+TFLOGSTRING("TSY: CMmSmsMessHandler::CheckSCTimestamp");
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp" );
+    TBool matchFound( EFalse );
+
+    TInt offset( 1 ); // Message Reference position
+    TInt messageReference( aEntry.iMsgData[offset] );
+    // Destination address length is integer representation
+    // of the number of useful semi-octets of address field
+    messageReference = ( messageReference + 1 ) / 2;
+    offset += messageReference;
+    offset += 4; // Service Centre Time Stamp
+
+    TBuf8<KSmsScTimeStampMaxLength> scTimeStamp;
+    scTimeStamp = aEntry.iMsgData.Mid( offset, KSmsScTimeStampMaxLength );
+
+    // Convert from the semi-octet representation to decimals.
+    for ( TUint8 i ( 0 ); i < KSmsScTimeStampMaxLength; i++ )
+        {
+        TUint8 lowDigit( static_cast<TUint8>( (
+            scTimeStamp[i] & 0xf0 ) >> 4 ) );
+        TUint8 highDigit( static_cast<TUint8>( scTimeStamp[i] & 0xf ) );
+        scTimeStamp[i] = static_cast<TUint8>( (10 * highDigit) + lowDigit );
+        }
+
+    // Ignore this messsage if month or day are zero (should not happen)
+    if ( ( 0 == scTimeStamp[1] ) || ( 0 == scTimeStamp[2] ) )
+        {
+TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Invalid timestamp found, ignored.");
+OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Invalid timestamp found, ignored" );
+        matchFound = ETrue;
+        }
+
+    if ( !matchFound )
+        {
+        // Construct a string of the form YYYYMMDD:HHMMSS
+        TBuf<15> timeString;
+        // This is the same way Symbian GSMU does it,
+        // see GSMU's method TSmsServiceCenterTimeStamp::DecodeL.
+        if ( scTimeStamp[0]>95 )
+            {
+            timeString.Append( _L( "19" ) );
+            }
+        else
+            {
+            timeString.Append( _L( "20" ) );
+            }
+        //two digits for year, month, day, hour, minute, second
+        _LIT( KDateFormat, "%02d" );
+        //year
+        timeString.AppendFormat( KDateFormat,scTimeStamp[0] );
+        //month, starting at 0
+        timeString.AppendFormat( KDateFormat,scTimeStamp[1]-1 );
+        //day, starting at 0
+        timeString.AppendFormat( KDateFormat,scTimeStamp[2]-1 );
+        timeString.Append( _L(":" ) );
+        //hour
+        timeString.AppendFormat( KDateFormat,scTimeStamp[3] );
+        //minute
+        timeString.AppendFormat( KDateFormat,scTimeStamp[4] );
+        //second
+        timeString.AppendFormat( KDateFormat,scTimeStamp[5] );
+
+        TTime simStoredTime( 0 );
+        TInt err( simStoredTime.Set( timeString ) );
+
+        if ( KErrNone == err )
+            {
+            // Handle the timezone difference. The timezone is found in the
+            // last byte of the SC timestamp buffer.
+            TUint8 simTimezoneDiffRaw( scTimeStamp[6] );
+            // Highest bit is the algebraic sign (0=positive, 1=negative).
+            // Timezone is defined in 'quarters of an hour', but we allow
+            // only whole numbers.
+            TInt8 simTimezoneSign( ( simTimezoneDiffRaw & 0x80 ) ? -1 : 1 );
+            TInt8 simTimezoneDiff( static_cast<TInt8>(
+                simTimezoneSign * ( simTimezoneDiffRaw & 0x7F) / 4 ) );
+            // Substract timezone difference
+            TTimeIntervalHours simTimezoneInterval( simTimezoneDiff );
+            simStoredTime -= simTimezoneInterval;
+
+#ifdef _DEBUG
+            // debug print
+            TDateTime dt = simStoredTime.DateTime();
+TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Message stored on SIM:");
+OstTrace0( TRACE_NORMAL, DUP2_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Message stored on SIM:" );
+TFLOGSTRING2("    year=%d",dt.Year());
+OstTrace1( TRACE_NORMAL, DUP3_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Year=%d", dt.Year() );
+TFLOGSTRING2("    month=%d",dt.Month()+1);
+OstTrace1( TRACE_NORMAL, DUP4_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Month=%d", ( dt.Month() + 1 ) );
+TFLOGSTRING2("    day=%d",dt.Day()+1);
+OstTrace1( TRACE_NORMAL, DUP5_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Day=%d", ( dt.Day() + 1 ) );
+TFLOGSTRING2("    hour=%d",dt.Hour());
+OstTrace1( TRACE_NORMAL, DUP6_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Hour=%d", dt.Hour() );
+TFLOGSTRING2("    minute=%d",dt.Minute());
+OstTrace1( TRACE_NORMAL, DUP7_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Minute=%d", dt.Minute() );
+TFLOGSTRING2("    second=%d",dt.Second());
+OstTrace1( TRACE_NORMAL, DUP8_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Second=%d", dt.Second() );
+TFLOGSTRING2("    timezone difference=%d",simTimezoneDiff);
+OstTraceExt1( TRACE_NORMAL, DUP9_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;simTimezoneDiff=%hhd", simTimezoneDiff );
+            dt = aScTime.DateTime();
+TFLOGSTRING("TSY:CMmSmsMessHandler::CheckSCTimestamp:Message opened on client side:");
+OstTrace0( TRACE_NORMAL, DUP10_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp, Message opened on client side:" );
+TFLOGSTRING2("    year=%d",dt.Year());
+OstTrace1( TRACE_NORMAL, DUP11_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Year=%d", ( dt.Year() + 1 ) );
+TFLOGSTRING2("    month=%d",dt.Month()+1);
+OstTrace1( TRACE_NORMAL, DUP12_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Month=%d", ( dt.Month() + 1 ) );
+TFLOGSTRING2("    day=%d",dt.Day()+1);
+OstTrace1( TRACE_NORMAL, DUP13_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Day=%d", ( dt.Day() + 1 ) );
+TFLOGSTRING2("    hour=%d",dt.Hour());
+OstTrace1( TRACE_NORMAL, DUP14_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Hour=%d", dt.Hour() );
+TFLOGSTRING2("    minute=%d",dt.Minute());
+OstTrace1( TRACE_NORMAL, DUP15_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Minute=%d", dt.Minute() );
+TFLOGSTRING2("    second=%d",dt.Second());
+OstTrace1( TRACE_NORMAL, DUP16_CMMSMSMESSHANDLER_CHECKSCTIMESTAMP, "CMmSmsMessHandler::CheckSCTimestamp;Second=%d", dt.Second() );
+            // debug print
+#endif // _DEBUG
+
+            if ( simStoredTime == aScTime )
+                {
+                matchFound = ETrue;
+                }
+            }
+        }
+
+    return matchFound;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccUpdateSMSStatus
+// Write SMS to SIM
+// -----------------------------------------------------------------------------
+//
+TInt CMmSmsMessHandler::UiccUpdateSMSStatus(
+    const TUint8 aRecordId
+    )
+    {
+TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccUpdateSMSStatusReq aRecordId: %d", aRecordId );
+OstTraceExt1( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCUPDATESMSSTATUS, "CMmSmsMessHandler::UiccUpdateSMSStatus;aRecordId=%hhu", aRecordId );
+
+    // Read parameters from SIM
+    // Set parameters for UICC_APPL_CMD_REQ message
+    iRecordId = aRecordId;
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdUpdateSMSStatusReadSMS;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = aRecordId;
+
+    params.fileId = KElemFileShortMessages;
+    params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+    params.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+
+    // File id path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp
+//
+// -----------------------------------------------------------------------------
+//
+void CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp(
+    TInt aStatus,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmSmsMessHandler::UiccReadSMSResp" );
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCUPDATESMSSTATUSREADSMSRESP, "CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp" );
+
+    if ( KErrNone == aStatus )
+        {
+        if ( 0 != aFileData.Length() )
+            {
+           // Set parameters for UICC_APPL_CMD_REQ message
+            TUiccWriteLinearFixed params;
+            params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+            params.trId = ETrIdUpdateSMSStatusWriteSMS;
+            params.dataOffset = 0;
+            params.dataAmount = 0;
+            params.record = iRecordId;
+
+            params.fileId = KElemFileShortMessages;
+            params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+            params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+
+            // File id path
+            params.filePath.Append( KMasterFileId >> 8 );
+            params.filePath.Append( KMasterFileId );
+            params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+            // Update status as read
+            // File data to be updated.
+            TBuf8<KSmsElemetaryFileRecordLength> fileDataBuf;
+            fileDataBuf = aFileData.Left( aFileData.Length() );
+            fileDataBuf[0] = KSimSmsMtRead;
+
+            TInt unfilledLength( fileDataBuf.MaxLength() - aFileData.Length() );
+            // Fill unused fields with FF
+            if ( 0 <  unfilledLength )
+                {
+                fileDataBuf.AppendFill( 0xFF, unfilledLength );
+                }
+
+            params.fileData.Append( fileDataBuf );
+
+            TInt ret( iMmUiccMessHandler->CreateUiccApplCmdReq( params ) );
+
+            if ( KErrNone != ret )
+                {
+                iMessageRouter->Complete(
+                    ECustomSetSimMessageStatusReadIPC,
+                    ret );
+                }
+            }
+        }
+    else
+        {
+        iMessageRouter->Complete(
+            ECustomSetSimMessageStatusReadIPC,
+            CMmStaticUtility::UICCCSCauseToEpocError( aStatus )  );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccUpdateSMSStatusWriteSMSResp
+//
+// -----------------------------------------------------------------------------
+//
+void CMmSmsMessHandler::UiccUpdateSMSStatusWriteSMSResp( TInt aStatus )
+    {
+TFLOGSTRING2("TSY: CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp aStatus: %d", aStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCUPDATESMSSTATUSREADSMSRESP, "CMmSmsMessHandler::UiccUpdateSMSStatusReadSMSResp;aStatus=%d", aStatus );
+
+    iMessageRouter->Complete(
+        ECustomSetSimMessageStatusReadIPC,
+        CMmStaticUtility::UICCCSCauseToEpocError( aStatus )  );
+
+    // Update the same flag also in TSY's cache.
+    if ( KErrNone == aStatus )
+        {
+        iSmsCache.SetStorageStatus( iRecordId, RMobileSmsStore::EStoredMessageRead );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccGetSmspEntryReq
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMmSmsMessHandler::UiccGetSmspEntryReq()
+    {
+TFLOGSTRING("TSY: CMmSmsMessHandler::UiccGetSmspEntryReq" );
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCREADNUMOFSMSPENTRIES, "CMmSmsMessHandler::UiccGetSmspEntryReq" );
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdGetSmspEntries;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = iSmspRecordNumber;
+    params.fileId = KElemFileSmsParams;
+    params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+    params.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+
+    // File id path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccStoreSmspEntry
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMmSmsMessHandler::UiccStoreSmspEntry( const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmSmsMessHandler::UiccStoreSmspEntry" );
+OstTrace0( TRACE_NORMAL, CMMSMSMESSHANDLER_UICCSTORESMSPENTRY, "CMmSmsMessHandler::UiccStoreSmspEntry" );
+
+    TInt ret( KErrNone );
+    TInt dataLength( aFileData.Length() );
+    TPtrC8 data( KNullDesC8 );
+    TSmsParameters* smsParam = new ( ELeave ) TSmsParameters();
+    CleanupStack::PushL( smsParam );
+
+    // SMS parameters are located in EF smsp, see 3GPP TS 31.102
+    // V8.3.0 chapter 4.2.27 EFSMSP (Short message service parameters)
+
+    // Alpha identifier is optional. Check if it exists.
+    if ( KSmsMandatoryParamsLength < dataLength )
+        {
+        // Copy mandatory fields to different buffer for later use
+        data.Set( aFileData.Right( KSmsMandatoryParamsLength ) );
+        smsParam->iAlphaTagPresent = ETrue;
+
+        // Alpha identifier length
+        TInt alphaLength( dataLength - KSmsMandatoryParamsLength );
+        if ( RMobileSmsMessaging::KMaxSmspTextSize < alphaLength )
+            {
+            alphaLength = RMobileSmsMessaging::KMaxSmspTextSize;
+            }
+
+        // Copy alpha identifier data as it is in SIM elementary file
+        TBuf8<RMobileSmsMessaging::KMaxSmspTextSize> alphaIdentifier;
+        alphaIdentifier.Copy( aFileData.Left( alphaLength ) );
+
+        // Coding of alpha identifier may be 7-bit default of one of UCS2 code
+        // options. At first convert data to 16-bit format
+        TBuf8<RMobileSmsMessaging::KMaxSmspTextSize> alphaIdentifierOutput;
+        CMmStaticUtility::ConvertGsmDataToUcs2(
+            alphaIdentifier,
+            alphaIdentifier.Length(),
+            alphaIdentifierOutput );
+
+        // Convert to 16-bit UNICODE string and copy to SMS parameters buffer
+        TBuf16<RMobileSmsMessaging::KMaxSmspTextSize> alphaBuf;
+        TIsiUtility::CopyFromBigEndian( alphaIdentifierOutput, alphaBuf );
+        smsParam->iAlphaTagData.Copy( alphaBuf );
+        }
+    // Only mandatory 28 bytes are included, no alpha identifier
+    else if ( KSmsMandatoryParamsLength == dataLength )
+        {
+        smsParam->iAlphaTagPresent = EFalse;
+        // Copy all the data
+        data.Set( aFileData );
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+
+    if ( KErrNone == ret )
+        {
+        // Parameters indicator.
+        // In SIM card bit value "0" means that parameter is present,
+        // in S60 vice versa
+        TUint8 paramIndicators( data[0] );
+        paramIndicators = ~paramIndicators;
+        paramIndicators &= KSmsGsmParametersIndMask; // Mask 5 LSB
+        smsParam->iParameterIndicator = paramIndicators;
+
+        // Location where SMS parameters in EFsms were fetched
+        smsParam->iLocationNumber = iSmspRecordNumber;
+
+        // Service center address
+        if ( paramIndicators & KServiceCentreAddress )
+            {
+            TBuf8<KSmsMaxAddressLength>scAddress( data. Mid(
+                KSmsParamsScAddressOffset, KSmsMaxAddressLength ) );
+            CMmSmsGsmAddress::GsmConv0411AddrToUnicode(
+                smsParam->iServiceCenterAddress,
+                scAddress,
+                smsParam->iMobileScTON,
+                smsParam->iMobileScNPI );
+            }
+
+        // Destination address
+        if ( paramIndicators & KDestinationAddress )
+            {
+            TBuf8<KSmsMaxAddressLength>destAddress( data.Mid(
+                KSmsParamsDestAddressOffset, KSmsMaxAddressLength ) );
+            CMmSmsGsmAddress::GsmConv0340AddrToUnicode(
+                 smsParam->iDestinationAddress,
+                 destAddress,
+                 smsParam->iMobileDeTON,
+                 smsParam->iMobileDeNPI );
+            }
+
+        // Protocol ID
+        if ( paramIndicators & KProtocolID )
+            {
+            smsParam->iProtocolId = data[KSmsParamsProtocolIdOffset];
+            }
+
+        // Data coding scheme
+        if ( paramIndicators & KDataCodingScheme )
+            {
+            smsParam->iDataCodingScheme = data[KSmsParamsDcsOffset];
+            }
+
+        // Validity period
+        if ( paramIndicators & KValidityPeriod )
+            {
+            smsParam->iValidityPeriod = data[KSmsParamsValidityPeriodOffset];
+            }
+
+        // Add this parameter set to array
+        iSmspListArray->AppendL( smsParam );
+        // Read the next entry
+        iSmspRecordNumber++;
+        ret = UiccGetSmspEntryReq();
+        }
+    // Don't reset struct because it may be stored to CArrayPtrFlat.
+    // All structs will be reseted when request is completed.
+    CleanupStack::Pop( smsParam );
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmSmsMessHandler::UiccSmsUpdateParameterReq
+// -----------------------------------------------------------------------------
+//
+TInt CMmSmsMessHandler::UiccSmsUpdateParameterReq(
+    const CMmDataPackage* aDataPackage )
+    {
+TFLOGSTRING("TSY: CMmSmsMessHandler::UiccSmsUpdateParameterReq");
+OstTrace0( TRACE_NORMAL, DUP1_CMMSMSMESSHANDLER_UICCSTORESMSPENTRY, "CMmSmsMessHandler::UiccStoreSmspEntry" );
+
+    RMobileSmsMessaging::TMobileSmspEntryV1* smsParameters;
+    // Unpack data
+    aDataPackage->UnPackData( &smsParameters );
+
+    // Buffer for all the file data to be written to UICC
+    // (possible alpha tag + params )
+    TBuf8<KSmsMandatoryParamsLength + KSizeOfAlphaTag> smspBuffer;
+
+    // Check if there is alpha tag
+    TInt alphaTagLength( smsParameters->iText.Length() );
+    // Buffer for alpha tag
+    if ( 0 < alphaTagLength )
+        {
+        // Temporary buffer for alpha tag
+        TBuf8<KSizeOfAlphaTag> alphaTagData;
+        TIsiUtility::CopyToBigEndian( smsParameters->iText, alphaTagData );
+        smspBuffer.Append( 0x80 ); // First byte 0x80 means 16-bit UCS coding
+        smspBuffer.Append( alphaTagData );
+        }
+
+    // Temporary buffer for mandatory data, filled by FF (unused bytes)
+    TBuf8<KSmsMandatoryParamsLength> paramsData;
+    paramsData.Fill( 0xFF, KSmsMandatoryParamsLength );
+
+    // Fill SMS parameters to data buffer ( see 3GPP TS 31.102 V8.3.0
+    // 4.2.27  EFSMSP (Short message service parameters). Unused parameters
+    // are filled by 0xFF
+
+    // Parameter indicator
+    TUint8 paramInd( static_cast<TUint8>( smsParameters->iValidParams ) );
+    paramsData[KSmsParamsParamIndicatorOffset] = paramInd;
+
+    // Destination address
+    if ( KDestinationAddress & paramInd )
+        {
+        TBuf8<KSmsMaxAddressLength> deAddr;
+        // Fill address by 0x00 at first
+        BuildDeAddress( smsParameters->iDestination, deAddr );
+        // Add address data to buffer
+        paramsData.Replace(
+            KSmsParamsDestAddressOffset,
+            deAddr.Length(),
+            deAddr );
+        }
+
+    // Service center address
+    if ( KServiceCentreAddress & paramInd )
+        {
+        TBuf8<KSmsMaxAddressLength> scAddr;
+        // Fill address by 0x00 at first
+        BuildScAddress( smsParameters->iServiceCentre, scAddr );
+        // Add address data to buffer
+        paramsData.Replace(
+            KSmsParamsScAddressOffset,
+            scAddr.Length(),
+            scAddr );
+        }
+
+    // Protocol ID
+    if ( KProtocolID & paramInd )
+        {
+        paramsData[KSmsParamsProtocolIdOffset] = smsParameters->iProtocolId;
+        }
+
+    // Data coding scheme
+    if ( KDataCodingScheme & paramInd )
+        {
+        paramsData[KSmsParamsDcsOffset] = smsParameters->iDcs;
+        }
+
+    // If validity period is valid, set value
+    if ( KValidityPeriod & paramInd )
+        {
+        paramsData[KSmsParamsValidityPeriodOffset] =
+            smsParameters->iValidityPeriod;
+        }
+
+    smspBuffer.Append( paramsData );
+
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccWriteLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdWriteSmspEntry;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = smsParameters->iIndex;
+
+    params.fileId = KElemFileSmsParams;
+    params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+    params.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
+
+    // File id path
+    params.filePath.Append( KMasterFileId >> 8 );
+    params.filePath.Append( KMasterFileId );
+    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+
+    // File data
+    params.fileData.Append( smspBuffer );
+
+    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    }
+
 //  End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -39,9 +39,9 @@
 #include <in_sock.h>
 #include <f32file.h>
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmstaticutilitytraces.h"
+#include "cmmstaticutilityTraces.h"
 #endif
 
 #include "cmmuiccmesshandler.h"
@@ -3352,6 +3352,807 @@
     return ret;
     }
 
+
+
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::ConvertUcs2ToGsmUcs2Data
+// Convert data to UCS2 format. See ETSI TS 102.221 Annex A
+// -----------------------------------------------------------------------------
+//
+void CMmStaticUtility::ConvertUcs2ToGsmUcs2Data(
+    TDesC16& aInputString,
+    TDes8& aGsmDataString )
+    {
+TFLOGSTRING("TSY: CMmStaticUtility::ConvertUcs2ToGsmData");
+OstTrace0( TRACE_NORMAL, CMMSTATICUTILITY_CONVERTUCS2TOGSMDATA, "CMmStaticUtility::ConvertUcs2ToGsmData" );
+
+    if ( 0 < aInputString.Length() )
+        {
+        // Check if there is any GSM default alphabet
+        if( GetCodingScheme( aInputString ))
+            {
+            // Store as one of the UCS2 Coding scheme
+            // Append the GSM data with 0x80
+            aGsmDataString.Append( 0x80 );
+            for( TInt count = 0; count < aInputString.Length(); count++)
+                {
+                // get MSB Byte in the first place
+                aGsmDataString.Append( aInputString[count]>>8);
+                aGsmDataString.Append( aInputString[count] );
+                }
+            }  // End of check the encoding type
+        else
+            {
+            // Store string in GSM default coding scheme
+            for( TInt count = 0; count < aInputString.Length(); count++)
+                {
+                // get the GSM defalut Character for UCS character
+                TUint8 gsmChar = GetGsmForUnicode( aInputString[count] );
+                if( gsmChar > 0x7F )
+                    {
+                    aGsmDataString.Append( 0x1B );
+                    }
+                aGsmDataString.Append(gsmChar & 0x7F);
+                }
+            // Append 0xFF for End of the String
+            aGsmDataString.Append( 0xFF );
+            }
+        }   // End of if there is no Input String
+    } // End of function
+
+
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::GetCodingScheme
+// GEt the Coding scheme GSM default or UCS2
+// -----------------------------------------------------------------------------
+//
+TBool CMmStaticUtility::GetCodingScheme( TDesC16& aInputString )
+    {
+    TFLOGSTRING("TSY: CMmStaticUtility::GetCodingScheme");
+    OstTrace0( TRACE_NORMAL, CMMSTATICUTILITY_GETCODINGSCHEME, "CMmStaticUtility::GetCodingScheme" );
+    TInt ret ( ETrue );
+    TInt count(0);
+    
+    while( count < aInputString.Length() )
+        {
+        TUint16 unicodeChar = aInputString[count];
+        TUint8 gsmCode = GetGsmForUnicode( unicodeChar );
+        if( gsmCode > 0x80 )
+            {
+            ret = EFalse;
+            }
+        count++;
+        }
+    return ret;
+    
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::GetGsmForUnicode
+// convert from Unicode character to GSM unicode character
+// -----------------------------------------------------------------------------
+//
+TUint8 CMmStaticUtility::GetGsmForUnicode( TUint16 aUniCode )
+    {
+    TUint8 ret ( 0 );
+    switch ( aUniCode )
+        {
+        case 0x0040:
+            {
+            ret = 0x00;
+            break;
+            }
+        case 0x00A3:
+            {
+            ret = 0x01;
+            break;
+            }
+        case 0x0024:
+            {
+            ret = 0x02;
+            break;
+            }
+        case 0x00A5:
+            {
+            ret = 0x03;
+            break;
+            }
+        case 0x00E8:
+            {
+            ret = 0x04;
+            break;
+            }
+        case 0x00E9:
+            {
+            ret = 0x05;
+            break;
+            }
+        case 0x00F9:
+            {
+            ret = 0x06;
+            break;
+            };
+        case 0x00EC:
+            {
+            ret = 0x07;
+            break;
+            }
+        case 0x00F2:
+            {
+            ret = 0x08;
+            break;
+            }
+        case 0x00C7:
+            {
+            ret = 0x09;
+            break;
+            }
+        case 0x000A:
+            {
+            ret = 0x0A;
+            break;
+            }
+        case 0x00D8:
+            {
+            ret = 0x0B;
+            break;
+            }
+        case 0x00F8:
+            {
+            ret = 0x0C;
+            break;
+            }
+        case 0x000D:
+            {
+            ret = 0x0D;
+            break;
+            }
+        case 0x00C5:
+            {
+            ret = 0x0E;
+            break;
+            }
+        case 0x00E5:
+            {
+            ret = 0x0F;
+            break;
+            }
+        case 0x0394:
+            {
+            ret = 0x10;
+            break;
+            }
+        case 0x005F:
+            {
+            ret = 0x11;
+            break;
+            }
+        case 0x03A6:
+            {
+            ret = 0x12;
+            break;
+            }
+        case 0x0393:
+            {
+            ret = 0x13;
+            break;
+            }
+        case 0x039B:
+            {
+            ret = 0x14;
+            break;
+            }
+        case 0x03A9:
+            {
+            ret = 0x15;
+            break;
+            }
+        case 0x03A0:
+            {
+            ret = 0x16;
+            break;
+            }
+        case 0x03A8:
+            {
+            ret = 0x17;
+            break;
+            }
+        case 0x03A3:
+            {
+            ret = 0x18;
+            break;
+            }
+        case 0x0398:
+            {
+            ret = 0x19;
+            break;
+            }
+        case 0x039E:
+            {
+            ret = 0x1A;
+            break;
+            }
+        case 0x00C6:
+            {
+            ret = 0x1C;
+            break;
+            }
+        case 0x00E6:
+            {
+            ret = 0x1D;
+            break;
+            }
+        case 0x00DF:
+            {
+            ret = 0x1E;
+            break;
+            }
+        case 0x00C9:
+            {
+            ret = 0x1F;
+            break;
+            }
+        case 0x0020:
+            {
+            ret = 0x20;
+            break;
+            }
+        case 0x0021:
+            {
+            ret = 0x21;
+            break;
+            }
+        case 0x0022:
+            {
+            ret = 0x22;
+            break;
+            }
+        case 0x0023:
+            {
+            ret = 0x23;
+            break;
+            }
+        case 0x00A4:
+            {
+            ret = 0x24;
+            break;
+            }
+        case 0x0025:
+            {
+            ret = 0x25;
+            break;
+            }
+        case 0x0026:
+            {
+            ret = 0x26;
+            break;
+            }
+        case 0x0027:
+            {
+            ret = 0x27;
+            break;
+            }
+        case 0x0028:
+            {
+            ret = 0x28;
+            break;
+            }
+        case 0x0029:
+            {
+            ret = 0x29;
+            break;
+            }
+        case 0x002A:
+            {
+            ret = 0x2A;
+            break;
+            }
+        case 0x002B:
+            {
+            ret = 0x2B;
+            break;
+            }
+        case 0x002C:
+            {
+            ret = 0x2C;
+            break;
+            }
+        case 0x002D:
+            {
+            ret = 0x2D;
+            break;
+            }
+        case 0x002E:
+            {
+            ret = 0x2E;
+            break;
+            }
+        case 0x002F:
+            {
+            ret = 0x2F;
+            break;
+            }
+        case 0x0030:
+            {
+            ret = 0x30;
+            break;
+            }
+        case 0x0031:
+            {
+            ret = 0x31;
+            break;
+            }
+        case 0x0032:
+            {
+            ret = 0x32;
+            break;
+            }
+        case 0x0033:
+            {
+            ret = 0x33;
+            break;
+            }
+        case 0x0034:
+            {
+            ret = 0x34;
+            break;
+            }
+        case 0x0035:
+            {
+            ret = 0x35;
+            break;
+            }
+        case 0x0036:
+            {
+            ret = 0x36;
+            break;
+            }
+        case 0x0037:
+            {
+            ret = 0x37;
+            break;
+            }
+        case 0x0038:
+            {
+            ret = 0x38;
+            break;
+            }
+        case 0x0039:
+            {
+            ret = 0x39;
+            break;
+            }
+        case 0x003A:
+            {
+            ret = 0x3A;
+            break;
+            }
+        case 0x003B:
+            {
+            ret = 0x3B;
+            break;
+            }
+        case 0x003C:
+            {
+            ret = 0x3C;
+            break;
+            }
+        case 0x003D:
+            {
+            ret = 0X3D;
+            break;
+            }
+        case 0x003E:
+            {
+            ret = 0X3E;
+            break;
+            }
+        case 0x003F:
+            {
+            ret = 0X3F;
+            break;
+            }
+        case 0x00A1:
+            {
+            ret = 0X40;
+            break;
+            }
+        case 0x0041:
+            {
+            ret = 0X41;
+            break;
+            }
+        case 0x0042:
+            {
+            ret = 0X42;
+            break;
+            }
+        case 0x0043:
+            {
+            ret = 0X43;
+            break;
+            }
+        case 0x0044:
+            {
+            ret = 0X44;
+            break;
+            }
+        case 0x0045:
+            {
+            ret = 0X45;
+            break;
+            }
+        case 0x0046:
+            {
+            ret = 0X46;
+            break;
+            }
+        case 0x0047:
+            {
+            ret = 0X47;
+            break;
+            }
+        case 0x0048:
+            {
+            ret = 0X48;
+            break;
+            }
+        case 0x0049:
+            {
+            ret = 0X49;
+            break;
+            }
+        case 0x004A:
+            {
+            ret = 0X4A;
+            break;
+            }
+        case 0x004B:
+            {
+            ret = 0X4B;
+            break;
+            }
+        case 0x004C:
+            {
+            ret = 0X4C;
+            break;
+            }
+        case 0x004D:
+            {
+            ret = 0X4D;
+            break;
+            }
+        case 0x004E:
+            {
+            ret = 0X4E;
+            break;
+            }
+        case 0x004F:
+            {
+            ret = 0X4F;
+            break;
+            }
+        case 0x0050:
+            {
+            ret = 0X50;
+            break;
+            }
+        case 0x0051:
+            {
+            ret = 0X51;
+            break;
+            }
+        case 0x0052:
+            {
+            ret = 0X52;
+            break;
+            }
+        case 0x0053:
+            {
+            ret = 0X53;
+            break;
+            }
+        case 0x0054:
+            {
+            ret = 0X54;
+            break;
+            }
+        case 0x0055:
+            {
+            ret = 0X55;
+            break;
+            }
+        case 0x0056:
+            {
+            ret = 0X56;
+            break;
+            }
+        case 0x0057:
+            {
+            ret = 0X57;
+            break;
+            }
+        case 0x0058:
+            {
+            ret = 0X58;
+            break;
+            }
+        case 0x0059:
+            {
+            ret = 0X59;
+            break;
+            }
+        case 0x005A:
+            {
+            ret = 0X5A;
+            break;
+            }
+        case 0x00C4:
+            {
+            ret = 0X5B;
+            break;
+            }
+        case 0x00D6:
+            {
+            ret = 0X5C;
+            break;
+            }
+        case 0x00D1:
+            {
+            ret = 0X5D;
+            break;
+            }
+        case 0x00DC:
+            {
+            ret = 0X5E;
+            break;
+            }
+        case 0x00A7:
+            {
+            ret = 0X5F;
+            break;
+            }
+        case 0x00BF:
+            {
+            ret = 0X60;
+            break;
+            }
+        case 0x0061:
+            {
+            ret = 0X61;
+            break;
+            }
+        case 0x0062:
+            {
+            ret = 0X62;
+            break;
+            }
+        case 0x0063:
+            {
+            ret = 0X63;
+            break;
+            }
+        case 0x0064:
+            {
+            ret = 0X64;
+            break;
+            }
+        case 0x0065:
+            {
+            ret = 0X65;
+            break;
+            }
+        case 0x0066:
+            {
+            ret = 0X66;
+            break;
+            }
+        case 0x0067:
+            {
+            ret = 0X67;
+            break;
+            }
+        case 0x0068:
+            {
+            ret = 0X68;
+            break;
+            }
+        case 0x0069:
+            {
+            ret = 0X69;
+            break;
+            }
+        case 0x006A:
+            {
+            ret = 0X6A;
+            break;
+            }
+        case 0x006B:
+            {
+            ret = 0X6B;
+            break;
+            }
+        case 0x006C:
+            {
+            ret = 0X6C;
+            break;
+            }
+        case 0x006D:
+            {
+            ret = 0X6D;
+            break;
+            }
+        case 0x006E:
+            {
+            ret = 0X6E;
+            break;
+            }
+        case 0x006F:
+            {
+            ret = 0X6F;
+            break;
+            }
+        case 0x0070:
+            {
+            ret = 0X70;
+            break;
+            }
+        case 0x0071:
+            {
+            ret = 0X71;
+            break;
+            }
+        case 0x0072:
+            {
+            ret = 0X72;
+            break;
+            }
+        case 0x0073:
+            {
+            ret = 0X73;
+            break;
+            }
+        case 0x0074:
+            {
+            ret = 0X74;
+            break;
+            }
+        case 0x0075:
+            {
+            ret = 0X75;
+            break;
+            }
+        case 0x0076:
+            {
+            ret = 0X76;
+            break;
+            }
+        case 0x0077:
+            {
+            ret = 0X77;
+            break;
+            }
+        case 0x0078:
+            {
+            ret = 0X78;
+            break;
+            }
+        case 0x0079:
+            {
+            ret = 0X79;
+            break;
+            }
+        case 0x007A:
+            {
+            ret = 0X7A;
+            break;
+            }
+        case 0x00E4:
+            {
+            ret = 0X7B;
+            break;
+            }
+        case 0x00F6:
+            {
+            ret = 0X7C;
+            break;
+            }
+        case 0x00F1:
+            {
+            ret = 0X7D;
+            break;
+            }
+        case 0x00FC:
+            {
+            ret = 0X7E;
+            break;
+            }
+        case 0x00E0:
+            {
+            ret = 0X7F;
+            break;
+            }
+        case 0x005E:
+            {
+            ret = 0X94;  /* ^ */
+            break;
+            }
+        case 0x007B:
+            {
+            ret = 0XA8; /* { */
+            break;
+            }
+        case 0x007D:
+            {
+            ret = 0XA9; /* } */
+            break;
+            }
+        case 0x005C:
+            {
+            ret = 0XAF; /* \ */
+            break;
+            }
+        case 0x007E:
+            {
+            ret = 0XBD; /* ~ */
+            break;
+            }
+        case 0x005B:
+            {
+            ret = 0XBC; /* [ */
+            break;
+            }
+        case 0x005D:
+            {
+            ret = 0XBE; /* ] */
+            break;
+            }
+        case 0x007C:
+            {
+            ret = 0XC0; /* | */
+            break;
+            }
+        case 0x20AC:
+            {
+            ret = 0XE5; /* The euro character */
+            break;
+            }
+        default:
+            {
+            ret = 0X9B; /* If illegal gsm char return space */
+            break;
+            }
+       }
+
+    return ret;
+    }
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::Get16Bit
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMmStaticUtility::Get16Bit
+    (
+    const TDesC8& aSource, //Source
+    TInt aIndex            //Index
+    )
+ {
+ TFLOGSTRING("TSY: CMmStaticUtility::Get16bit");
+ OstTrace0( TRACE_NORMAL, CMMSTATICUTILITY_GET16BIT, "CMmStaticUtility::Get16Bit" );
+
+ TInt target( 0 );
+
+ if ( aIndex + 1 < aSource.Length() )
+     {
+     target = TUint16( aSource[aIndex] ) << 8;
+     target = TUint16( target | aSource[aIndex + 1] );
+     }
+     
+ return target;
+ }
+
 // ==================== OTHER EXPORTED FUNCTIONS ===============================
     //None
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -38,10 +38,11 @@
 #include "cmmsupplservmesshandler.h"
 #include "tssparser.h" // for parsing service string
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #include "cmmuiccmesshandler.h"
+#include "cmmphonemesshandler.h"  // for CallForwFlagsCachingCompleted
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmsupplservmesshandlertraces.h"
+#include "cmmsupplservmesshandlerTraces.h"
 #endif
  // logging
 #include <satcs.h>
@@ -597,7 +598,7 @@
             UiccReadCallFwdFlagsRel4Req();
             break;
             }
-        case ESatNotifyCallControlRequest:
+        case ESatNotifySendSsPCmd:
             {
             // SIM ATK TSY has informed that next SS request coming from
             // Etel is SAT originated and FDN check should not be done.
@@ -633,6 +634,7 @@
 TInt CMmSupplServMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY: CMmSupplServMessHandler::ProcessUiccMsg, transaction ID: %d, status: %d", aTraId, aStatus );
@@ -3973,6 +3975,9 @@
             &customDataPackage,
             KErrNone );
 
+TFLOGSTRING("TSY: CMmSupplServMessHandler::SimCallFwdRespL - Check possible refresh status");
+OstTrace0( TRACE_NORMAL, DUP1_CMMSUPPLSERVMESSHANDLER_UICCHANDLECALLFWDFLAGSRESP, "CMmSupplServMessHandler::UiccHandleCallFwdFlagsResp - Check possible refresh status" );
+        iMessageRouter->GetPhoneMessHandler()->CallForwFlagsCachingCompleted( aStatus );
         }
     else if ( !iGetCallForwardingNumber ) // EMobilePhoneSetCallForwardingStatus
         {
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmuiccmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmuiccmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,6 +22,8 @@
 #include "cmmphonetsender.h"
 #include "tsylogger.h"
 #include "cmmmessagerouter.h"
+#include "cmmstaticutility.h"
+#include "cmmphonemesshandler.h"
 
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include <e32cmn.h>
@@ -215,6 +217,7 @@
     iIsimApplicationId = UICC_APPL_ID_UNKNOWN;
     iIsimApplicationStatus = UICC_STATUS_APPL_NOT_ACTIVE;
     iIsimApplicationFound = EFalse;
+    iCompleteSimStatusReady = ETrue;
     iPin1Id = 0;
     iPin2Id = 0;
     iActivePin = RMobilePhone::ESecurityCodePin1;
@@ -266,6 +269,7 @@
 void CMmUiccMessHandler::ReceiveMessageL( const TIsiReceiveC& aIsiMsg )
     {
     TInt status( KErrNone );
+    TUint8 details ( UICC_NO_DETAILS );
     TUint8 messageId( aIsiMsg.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
     TUint8 trId( aIsiMsg.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
     TUint8 serviceType( 0 );
@@ -351,6 +355,10 @@
             {
             status = aIsiMsg.Get8bit(
                 ISI_HEADER_SIZE + UICC_APPL_CMD_RESP_OFFSET_STATUS );
+            
+            details = aIsiMsg.Get8bit(
+                    ISI_HEADER_SIZE + UICC_APPL_CMD_RESP_OFFSET_DETAILS );
+            
             TInt8 serviceType( aIsiMsg.Get8bit(
                 ISI_HEADER_SIZE + UICC_APPL_CMD_RESP_OFFSET_SERVICETYPE ) );
 
@@ -458,7 +466,7 @@
             {
             iMessHandlerPrtList[trId] = NULL;
             }
-        messHandler->ProcessUiccMsg( trId, status, fileData );
+        messHandler->ProcessUiccMsg( trId, status, details, fileData );
         }
     else
         {
@@ -1272,15 +1280,23 @@
                     EIsiSubBlockTypeId16Len16,
                     uiccSbFciOffset ) )
                     {
-                    TInt fileDataLength( aIsiMsg.Get16bit(
-                        uiccSbFciOffset + UICC_SB_FCI_OFFSET_FCILENGTH ) );
-                    if ( 0 < fileDataLength )
+                    // Check is the SIM UICC
+                    TPtrC8 data( KNullDesC8 );
+
+                    // The whole sub block is returned
+                    TInt sbLength( aIsiMsg.Get16bit(
+                        uiccSbFciOffset + UICC_SB_FCI_OFFSET_SBLEN ) );
+                    data.Set( aIsiMsg.GetData(
+                        uiccSbFciOffset,
+                        sbLength ) );
+
+                    TFci fci( data );
+                    if( UICC_CARD_TYPE_UICC == fci.GetTypeOfCard() )
                         {
-                        StorePinKeyReferences( aIsiMsg.GetData(
-                            uiccSbFciOffset + UICC_SB_FCI_OFFSET_FCI,
-                            fileDataLength ) );
+                        StorePinKeyReferences( data );
                         }
                     }
+
                 // In case of ICC there is two UICC_SB_CHV subblocks
                 // that contain PIN IDs for ICC application
                 TUint uiccSbChvOffset( 0 );
@@ -1341,11 +1357,12 @@
         EIsiSubBlockTypeId16Len16,
         uiccSbFileDataOffset ) )
         {
-        TInt fileDataLength( aIsiMsg.Get16bit(
-            uiccSbFileDataOffset + UICC_SB_FCI_OFFSET_FCILENGTH ) );
+        // The whole sub block is returned
+        TInt sbLength( aIsiMsg.Get16bit(
+            uiccSbFileDataOffset + UICC_SB_FCI_OFFSET_SBLEN ) );
         data.Set( aIsiMsg.GetData(
-            uiccSbFileDataOffset + UICC_SB_FCI_OFFSET_FCI,
-            fileDataLength ) );
+            uiccSbFileDataOffset,
+            sbLength ) );
         }
     return data;
     }
@@ -1647,11 +1664,15 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CMmUiccMessHandler::InitializeSimServiceTableCache()
+void CMmUiccMessHandler::InitializeSimServiceTableCache( TBool aComplete )
     {
 TFLOGSTRING("TSY: CMmUiccMessHandler::InitializeSimServiceTableCache" );
 OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_INITIALIZESIMSERVICETABLECACHE, "CMmUiccMessHandler::InitializeSimServiceTableCache" );
 
+    // Service table internal cacheing is done during strtup  and SIM refresh.
+    // Completing of IPC EMmTsyBootNotifySimStatusReadyIPC is done only
+    // in case of startup.
+    iCompleteSimStatusReady = aComplete;
     // Set parameters for UICC_APPL_CMD_REQ message
     TUiccReadTransparent params;
     params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
@@ -1710,10 +1731,20 @@
 OstTrace1( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_SIMSERVICETABLECACHERESP, "CMmUiccMessHandler::SimServiceTableCacheResp: reading failed (%x)", aStatus );
         }
 
-    //Complete Notify SIM Ready
-    iMessageRouter->Complete(
-        EMmTsyBootNotifySimStatusReadyIPC,
-        KErrNone );
+    // Cacheing during startup
+    if ( iCompleteSimStatusReady )
+        {
+        //Complete Notify SIM Ready
+        iMessageRouter->Complete(
+            EMmTsyBootNotifySimStatusReadyIPC,
+            KErrNone );
+        }
+    else // Cacheing from SIM refresh
+        {
+        iMessageRouter->GetPhoneMessHandler()->
+            ServiceTableCachingCompleted( aStatus );
+        iCompleteSimStatusReady = ETrue; // Default value
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -1807,6 +1838,7 @@
 TInt CMmUiccMessHandler::ProcessUiccMsg(
     TInt aTraId,
     TInt aStatus,
+    TUint8 /*aDetails*/,
     const TDesC8& aFileData )
     {
 TFLOGSTRING3("TSY: CMmUiccMessHandler::ProcessUiccMsg, transaction ID: %d, status: %d", aTraId, aStatus );
@@ -1847,36 +1879,40 @@
     {
 TFLOGSTRING("TSY: CMmUiccMessHandler::StorePinKeyReferences" );
 OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_STOREPINKEYREFERENCES, "CMmUiccMessHandler::StorePinKeyReferences" );
+
+    // Get offset for PIN Status Template DO
+    TFci fci( aFileData );
+    TInt pSTDoOffset( fci.GetOffsetOfTLV( KPINStatusTemplateDO ) );
+
     // See ETSI TS 102 221 V7.11.0 (2008-07)chapter 9.5.2
     // There is only one PIN1/PIN2/UPIN per application
-    TUint8 lengthOfPs( aFileData[3] ); // Number of PS bytes is in index 3
+    TUint8 lengthOfPs( aFileData[( pSTDoOffset + 3 )] ); // Number of PS bytes is in index 3
 
     // Get PS_DO for PIN statuses
     TPtrC8 psDo;
-    psDo.Set( aFileData.Mid( 4, lengthOfPs ) );
+    psDo.Set( aFileData.Mid( ( pSTDoOffset + 4 ), lengthOfPs ) );
 
     // Update index to point the first PIN
-    TUint8 index( 4 + lengthOfPs );
-    // Copy PIN related data to new buffer
-    TPtrC8 pinDataBuffer;
-    pinDataBuffer.Set( aFileData.Mid( index ) );
-    TInt length( pinDataBuffer.Length() );
+    TUint8 index( pSTDoOffset + 4 + lengthOfPs );
     TUint8 pinId( 0 );
     TUint8 orderNum( 0 ); // Used for shifting PIN status byte
     TBool upinExists( EFalse );
     TBool pin1Active( EFalse );
 
-    index = 0; // Start of new buffer
-    while( length )
+    TInt totalLength( aFileData[( pSTDoOffset + 1 )]);
+    // Length of PIN data is total length - PS_DO tag - PS_DO tag length -
+    // PS_DO tag bytes.
+    TInt length( totalLength - 1 - 1 - lengthOfPs );
+    for ( TInt i( 0 ); i < length; i++ )
         {
         // Check if usage qualifier exists ( tag '95'). In that case skip it
-        if ( 0x95 == pinDataBuffer[index] )
+        if ( 0x95 == aFileData[index] )
             {
             index += 3;
             length -= 3;
             }
         // PIN key reference
-        pinId = pinDataBuffer[index + 2];
+        pinId = aFileData[index + 2];
         index += 3; // Skip PIN key reference data element
         length -= 3;
 
@@ -2014,7 +2050,7 @@
     if ( UICC_STATUS_OK == aStatus )
         {
         // First byte of CPHS information is for CPHS phase, lbut
-        // we are interested in only CPHS table, so we skip the 
+        // we are interested in only CPHS table, so we skip the
         // first byte and we just copy the CPHS table data
         TUint8 dataSize( aFileData.Length() - 1 );
         if( KEfCphsInfoSize >= dataSize )
@@ -2084,5 +2120,331 @@
     return ret;
     }
 
+// -----------------------------------------------------------------------------
+// TFci::GetLength
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetLength()
+    {
+    TInt lengthOfFCISb( 0 );
+
+    lengthOfFCISb = CMmStaticUtility::Get16Bit( iData,
+                                                UICC_SB_FCI_OFFSET_SBLEN );
+TFLOGSTRING2("TSY: TFci::GetLength lengthOfFCISb = %d", lengthOfFCISb );
+OstTrace1( TRACE_NORMAL, TFCI_GETLENGTH, "TFci::GetLength;lengthOfFCISb=%d", lengthOfFCISb );
+
+    return lengthOfFCISb;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetTypeOfCard
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 TFci::GetTypeOfCard()
+    {
+    TUint8 uiccCardType( iData[UICC_SB_FCI_OFFSET_CARDTYPE] );
+TFLOGSTRING2("TSY: TFci::GetTypeOfCard uiccCardType = %d", uiccCardType );
+OstTraceExt1( TRACE_NORMAL, TFCI_GETTYPEOFCARD, "TFci::GetTypeOfCard;uiccCardType=%hhu", uiccCardType );
+
+    return uiccCardType;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::::GetOffsetOfTLV
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetOffsetOfTLV( const TUint8 aDescription )
+    {
+TFLOGSTRING("TSY: TFci::::GetOffsetOfTLV" );
+OstTrace0( TRACE_NORMAL, TFCI_GETOFFSETOFTLV, "TFci::GetOffsetOfTLV" );
+
+    TInt indexOfData( 0 );
+    TInt length( GetLength() );
+
+    // Length is    1 or 2 bytes long
+    // (see TS 102 221 11.1.1.3 Response Data)
+    // If the 1st byte of length is 0x81 the length is 2 bytes long
+
+    // Length starts from the 2nd byte of the FCI
+    indexOfData = UICC_SB_FCI_OFFSET_FCI + 1;
+
+    // Length is 2 bytes ? Skip the 1st byte
+    if ( 0x81 == iData[indexOfData] )
+        {
+        indexOfData++;
+        }
+    // Skip the length (1st or 2nd byte depending on the length)
+    indexOfData++;
+
+    while ( indexOfData < length )
+        {
+        if ( aDescription == iData[indexOfData] )
+            {
+            // Return indexOfData
+            break;
+            }
+        else
+            {
+            // Move index to the start of next descriptor
+            indexOfData++; // Length of current descriptor
+            indexOfData += iData[indexOfData] + 1;
+            }
+        }
+
+    // Not found
+    if ( indexOfData >= length )
+        {
+        indexOfData = 0;
+        }
+
+    return indexOfData;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetNumberOfRecords
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetNumberOfRecords()
+    {
+TFLOGSTRING("TSY: TFci::GetNumberOfRecords" );
+OstTrace0( TRACE_NORMAL, TFCI_GETNUMBEROFRECORDS, "TFci::GetNumberOfRecords" );
+
+    TInt numberOfRecords( 0 );
+    TUint8 uiccCardType( GetTypeOfCard());
+
+    if ( UICC_CARD_TYPE_UICC == uiccCardType )
+        {
+        // Get 3G SIM data see TS 102 221 11.1.1.4.3 File Descriptor
+        TInt indexOfData( GetOffsetOfTLV( KFileDescriptor ) );
+
+        if ( 0 != indexOfData )
+            {
+            indexOfData++; // index of the data length
+            // if data length is 5 there is record count in the 6th byte
+            if ( 5 == iData[indexOfData] )
+                {
+                indexOfData += 5;
+                numberOfRecords = iData[indexOfData];
+                }
+            }
+        }
+    else if ( UICC_CARD_TYPE_ICC == uiccCardType )
+        {
+        TInt fileSize( 0 );
+        fileSize = CMmStaticUtility::Get16Bit(
+                         iData,
+                         ( UICC_SB_FCI_OFFSET_FCI + KFileSize2 ) );
+
+        TInt recordLength( 0 );
+        recordLength = iData[( UICC_SB_FCI_OFFSET_FCI + KRecordLength2 )];
+
+        // get the No of records
+        numberOfRecords = ( fileSize/recordLength );
+        }
+    else
+        {
+TFLOGSTRING("TSY: TFci::GetNumberOfRecords: UNKNOWN CARD TYPE" );
+OstTrace0( TRACE_NORMAL, DUP2_TFCI_GETNUMBEROFRECORDS, "TFci::GetNumberOfRecords: UNKNOWN CARD TYPE" );
+        }
+
+TFLOGSTRING2("TSY: TFci::GetNumberOfRecords numberOfRecords = %d", numberOfRecords );
+OstTrace1( TRACE_NORMAL, DUP1_TFCI_GETNUMBEROFRECORDS, "TFci::GetNumberOfRecords;numberOfRecords=%d", numberOfRecords );
+
+    return numberOfRecords;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetRecordLength
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetRecordLength()
+    {
+TFLOGSTRING("TSY: TFci::GetRecordLength" );
+OstTrace0( TRACE_NORMAL, TFCI_GETRECORDLENGTH, "TFci::GetRecordLength" );
+
+    TInt recordLength( 0 );
+    TUint8 uiccCardType( GetTypeOfCard());
+
+    if ( UICC_CARD_TYPE_UICC == uiccCardType )
+        {
+        // Get 3G SIM data see TS 102 221 11.1.1.4.3 File Descriptor
+        TInt indexOfData( GetOffsetOfTLV( KFileDescriptor ) );
+
+        if ( 0 != indexOfData )
+            {
+            indexOfData++; // index of the data length
+            // if data length is 5 there is record length in the
+            // 4th and 5th byte
+            if ( 5 == iData[indexOfData] )
+                {
+                indexOfData += 3;
+                recordLength = CMmStaticUtility::Get16Bit( iData,
+                                                           indexOfData );
+                }
+            }
+        }
+    else if ( UICC_CARD_TYPE_ICC == uiccCardType )
+        {
+        recordLength = iData[( UICC_SB_FCI_OFFSET_FCI + KRecordLength2 )];
+        }
+    else
+        {
+TFLOGSTRING("TSY: TFci::GetRecordLength: UNKNOWN CARD TYPE" );
+OstTrace0( TRACE_NORMAL, DUP2_TFCI_GETRECORDLENGTH, "TFci::GetRecordLength: UNKNOWN CARD TYPE" );
+        }
+
+TFLOGSTRING2("TSY: TFci::GetRecordLength recordLength = %d", recordLength );
+OstTrace1( TRACE_NORMAL, DUP1_TFCI_GETRECORDLENGTH, "TFci::GetRecordLength;recordLength=%d", recordLength );
+
+    return recordLength;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetSizeOfFile
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetSizeOfFile()
+    {
+TFLOGSTRING("TSY: TFci::GetSizeOfFile" );
+OstTrace0( TRACE_NORMAL, TFCI_GETSIZEOFFILE, "TFci::GetSizeOfFile" );
+
+    TInt fileSize( 0 );
+    TUint8 uiccCardType( GetTypeOfCard() );
+
+    if ( UICC_CARD_TYPE_UICC == uiccCardType )
+        {
+        // Get 3G SIM data see TS 102 221 11.1.1.4.1 File Size
+        TInt indexOfData( GetOffsetOfTLV( KFileSize ) );
+
+        if ( 0 != indexOfData )
+            {
+            indexOfData++; // index of the data length
+            // Data length must be 2 !
+            if ( 2 == iData[indexOfData] )
+                {
+                indexOfData++;
+                fileSize = CMmStaticUtility::Get16Bit( iData, indexOfData );
+                }
+            }
+        }
+    else if ( UICC_CARD_TYPE_ICC == uiccCardType )
+        {
+        fileSize = CMmStaticUtility::Get16Bit(
+                         iData,
+                         ( UICC_SB_FCI_OFFSET_FCI + KFileSize2 ) );
+        }
+    else
+        {
+TFLOGSTRING("TSY: TFci::GetFileSize: UNKNOWN CARD TYPE" );
+OstTrace0( TRACE_NORMAL, DUP2_TFCI_GETSIZEOFFILE, "TFci::GetSizeOfFile: UNKNOWN CARD TYPE" );
+        }
+
+
+TFLOGSTRING2("TSY: TFci::GetSizeOfFile fileSize = %d", fileSize );
+OstTrace1( TRACE_NORMAL, DUP1_TFCI_GETSIZEOFFILE, "TFci::GetSizeOfFile;fileSize=%d", fileSize );
+
+    return fileSize;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetFileIdentifier
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt TFci::GetFileIdentifier()
+    {
+TFLOGSTRING("TSY: TFci::GetFileIdentifier" );
+OstTrace0( TRACE_NORMAL, TFCI_GETFILEIDENTIFIER, "TFci::GetFileIdentifier" );
+
+    TInt fileIdentifier( 0 );
+    TUint8 uiccCardType( GetTypeOfCard());
+
+    if ( UICC_CARD_TYPE_UICC == uiccCardType )
+        {
+        // Get 3G SIM data see TS 102 221 11.1.1.4.4 File Identifier
+        TInt indexOfData( GetOffsetOfTLV( KFileIdentifier ) );
+
+        if ( 0 != indexOfData )
+            {
+            indexOfData++; // index of the data length
+            // Data length must be 2 !
+            if ( 2 == iData[indexOfData] )
+                {
+                indexOfData++;
+                fileIdentifier = CMmStaticUtility::Get16Bit( iData,
+                                                               indexOfData );
+                }
+            }
+        }
+    else if ( UICC_CARD_TYPE_ICC == uiccCardType )
+        {
+        // 4 is the index location for File ID which is 2 bytes long
+        fileIdentifier =
+            CMmStaticUtility::Get16Bit( iData,
+                                          ( UICC_SB_FCI_OFFSET_FCI + KFileId ) );
+        }
+    else
+        {
+TFLOGSTRING("TSY: TFci::GetFileIdentifier: UNKNOWN CARD TYPE" );
+OstTrace0( TRACE_NORMAL, DUP2_TFCI_GETFILEIDENTIFIER, "TFci::GetFileIdentifier: UNKNOWN CARD TYPE" );
+        }
+
+TFLOGSTRING2("TSY: TFci::GetFileIdentifier fileIdentifier = %d", fileIdentifier );
+OstTrace1( TRACE_NORMAL, DUP1_TFCI_GETFILEIDENTIFIER, "TFci::GetFileIdentifier;fileIdentifier=%d", fileIdentifier );
+
+    return fileIdentifier;
+    }
+
+// -----------------------------------------------------------------------------
+// TFci::GetFileStatus
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 TFci::GetFileStatus()
+    {
+TFLOGSTRING("TSY: TFci::GetFileStatus" );
+OstTrace0( TRACE_NORMAL, TFCI_GETFILESTATUS, "TFci::GetFileStatus" );
+
+    TUint8 fileStatus( 0 );
+    TUint8 uiccCardType( GetTypeOfCard());
+
+    if ( UICC_CARD_TYPE_UICC == uiccCardType )
+        {
+        TFLOGSTRING("TSY: TFci::GetFileStatus: NOT IN UICC" );
+        }
+    else if ( UICC_CARD_TYPE_ICC == uiccCardType )
+        {
+        // Get 2G SIM data
+        fileStatus = iData[( UICC_SB_FCI_OFFSET_FCI + KFileStatus )];
+        }
+    else
+        {
+TFLOGSTRING("TSY: TFci::GetFileStatus: UNKNOWN CARD TYPE" );
+OstTrace0( TRACE_NORMAL, DUP1_TFCI_GETFILESTATUS, "TFci::GetFileStatus: UNKNOWN CARD TYPE" );
+        }
+
+TFLOGSTRING2("TSY: TFci::GetFileStatus fileStatus = %d", fileStatus );
+OstTraceExt1( TRACE_NORMAL, DUP2_TFCI_GETFILESTATUS, "TFci::GetFileStatus;fileStatus=%hhu", fileStatus );
+
+    return fileStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmUiccMessHandler::GetUiccClientId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8 CMmUiccMessHandler::GetUiccClientId()
+    {
+TFLOGSTRING("TSY: CMmUiccMessHandler::GetUiccClientId" );
+OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETUICCCLIENTID, "CMmUiccMessHandler::GetUiccClientId" );
+    return iUiccClientId;
+    }
 
 //  End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -31,9 +31,9 @@
 #include "cmmstaticutility.h"
 #include "cmmussdmesshandler.h"
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "cmmussdmesshandlertraces.h"
+#include "cmmussdmesshandlerTraces.h"
 #endif
 
 //  External Data Structures
--- a/adaptationlayer/tsy/nokiatsy_dll/src/toperatornames.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/toperatornames.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "cmmstaticutility.h"
 #include "tsylogger.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "toperatornamestraces.h"
+#include "toperatornamesTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/tssparser.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/tssparser.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,9 +20,9 @@
 // INCLUDE FILES
 #include "tssparser.h" // class definition file
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "tssparsertraces.h"
+#include "tssparserTraces.h"
 #endif
  // for TSY logging
 
--- a/adaptationlayer/tsy/nokiatsy_dll/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/nokiatsy_dll/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -19,5 +19,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/adaptationlayer/tsy/simatktsy_dll/inc/ber_tlv.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/ber_tlv.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -24,7 +24,7 @@
 #include <e32base.h>        // base class cbase
 
 
-//  CONSTANTS 
+//  CONSTANTS
 const TUint8 KTlvLengthStartPosition                            = 0x01;
 const TUint8 KTlvDataAreaStartPosition                          = 0x02;
 const TUint8 KTlvHeaderLength                                   = 0x02;
@@ -165,6 +165,7 @@
 const TUint8 KTlvESNTag                                         = 0x46;
 const TUint8 KTlvNetworkAccessNameTag                           = 0x47;
 const TUint8 KTlvPdpContextActivationParametersTag              = 0x52;
+const TUint8 KTlvImeisvTag                                      = 0x62;
 
 const TUint8 KTlvTimerIdentifierTagCRBitOn                      = 0xA4;
 
@@ -288,7 +289,7 @@
 const TUint8 KHelpInformationRequiredByTheUser                          = 0x13;
 const TUint8 KUssdOrSsTransactionTerminatedByTheUser                    = 0x14;
 
-//Results '2X' Indicate To The SIM That It May Be Worth Re-Trying The Command 
+//Results '2X' Indicate To The SIM That It May Be Worth Re-Trying The Command
 //At A Later Opportunity.
 const TUint8 KMeCurrentlyUnableToProcessCommand                         = 0x20;
 const TUint8 KNetworkCurrentlyUnableToProcessCommand                    = 0x21;
@@ -298,8 +299,8 @@
 const TUint8 KInteractionWithCallControlBySimTemporaryProblem           = 0x25;
 const TUint8 KLaunchBrowserGenericErrorCode                             = 0x26;
 
-//Results '3X' Indicate That It Is Not Worth The SIM Re-Trying With An 
-//Identical Command, As It Will Only Get The Same Response. However, The 
+//Results '3X' Indicate That It Is Not Worth The SIM Re-Trying With An
+//Identical Command, As It Will Only Get The Same Response. However, The
 //Decision To Retry Lies With The SIM Application.
 const TUint8 KCommandBeyondMeCapabilities                               = 0x30;
 const TUint8 KCommandTypeNotUnderstoodByMe                              = 0x31;
@@ -314,15 +315,15 @@
 const TUint8 KBearerIndependentProtocolError                            = 0x3a;
 
 //Additional information
-//Contents: For the general result "Command performed successfully", some 
-// proactive commands require additional information in the command result. 
-// This is defined in the subclauses below. For the general results '20', '21', 
-// '26', '34', '35', '37', '38' and '39' and '3A', it is mandatory for the ME 
-// to provide a specific cause value as additional information, as defined in 
-// the subclauses below. For the other general results, the ME may optionally 
-// supply additional information. If additional information is not supplied, 
-// then the length of the value part of the data object need only contain the 
-// general result. See 3GPP TS 11.14 V8.8.0, chapters 12.12.1 - 12.12.11 for 
+//Contents: For the general result "Command performed successfully", some
+// proactive commands require additional information in the command result.
+// This is defined in the subclauses below. For the general results '20', '21',
+// '26', '34', '35', '37', '38' and '39' and '3A', it is mandatory for the ME
+// to provide a specific cause value as additional information, as defined in
+// the subclauses below. For the other general results, the ME may optionally
+// supply additional information. If additional information is not supplied,
+// then the length of the value part of the data object need only contain the
+// general result. See 3GPP TS 11.14 V8.8.0, chapters 12.12.1 - 12.12.11 for
 // more details.
 
 //Additional information for ME problem
@@ -391,7 +392,7 @@
 const TUint8 KNetwork                                           = 0x83;
 
 
-//  DATA TYPES  
+//  DATA TYPES
 
 // Tlv Specific Data Types
 enum TTlvSpesificDataType
@@ -497,7 +498,7 @@
 *  TTlvBase
 *  TLV type: Tag Length Value(s)
 *  Generic BER-TLV constructor class, can be used to create TLVs
-*  You do not need to worry about lenghts; Example usage: 
+*  You do not need to worry about lenghts; Example usage:
 *                  TTlv tlv;
 *                  tlv.Begin( KxxBerTag);  <--- top level tag
 *                  tlv.AddTag( KxxxTag )   <--- simple tags
@@ -566,7 +567,7 @@
         /**
         * Return data, calculated without
         * top level tag.
-        * @since Series 60 Series60_2.6 
+        * @since Series 60 Series60_2.6
         * @param None
         * @return TDesC8& descriptor containing BER-TLV
         */
@@ -574,7 +575,7 @@
 
 
     protected: // Data
-    
+
         TInt        iLenIndex;
         TDes8&      iData;
     };
@@ -616,16 +617,16 @@
 class TTlv : public TTlvBase
     {
     public: // Constructor
-    
+
         /**
         * Constructor
         * @since Series 60 Series60_2.6
         * @param iBuffer
-        */    
+        */
         TTlv() : TTlvBase( iBuffer ) {}
-        
+
         private:    // Data
-    
+
         // TLV must fit in APDU limits (255 bytes)
         // therefore the maximum possible TLV size is 255
         TBuf8<255>   iBuffer;
@@ -727,7 +728,7 @@
             }
 
     protected: // Data
-        
+
         // Pointer to Tlv data
         TPtrC8 iData;
     };
@@ -753,16 +754,16 @@
 
         /**
         * Find tlv by tag value
-        * @param aTlv 
+        * @param aTlv
         * @param aTlvTagValue TlvTag
         * @param aItemNbr number of requested Tlv, default is 0
         * @return TInt: KErrNone or KErrNotFound
         */
         TInt TlvByTagValue(
             CTlv* aTlv,
-            TUint8 aTlvTagValue, 
+            TUint8 aTlvTagValue,
             TInt aItemNbr = 0 );
-            
+
         /**
         * Find several tlvs by tag value
         * @since Series 60 Series60_2.6
@@ -771,7 +772,7 @@
         * @return TInt: KErrNone or KErrNotFound
         */
         TInt TlvByTagValueMulti( CTlv* aTlv, TUint8 aTlvTag );
-        
+
         /**
         * Set ber-tlv from atk_generic_req isi-message.
         * @since NCP 5.0
@@ -808,7 +809,7 @@
          TUint8 GetShortInfo( TTlvSpesificDataType aType );
 
         /**
-        * Returns the Data defined by aType. Index and length of the 
+        * Returns the Data defined by aType. Index and length of the
         * data depends on data type.
         * @since Series 60 Series60_2.6
         * @param TAtkSpesificDataType aType: data type.
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satcc.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satcc.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -28,11 +28,11 @@
 
 // CONSTANTS
 const TUint8 KBccMaxSize = 0x10; // Maximum length for BCC
-const TUint8 KStringMaxSize = 249; // Maximum length for SS and 
+const TUint8 KStringMaxSize = 249; // Maximum length for SS and
                                    // Call Destination address string
 const TUint8 KUssdStringMaxSize = 160; // Maximum length for USSD string
 const TUint8 KCallModeSize = 2; // Call Mode + Call Mode Info
-
+const TUint8 KSbCheckInfoSize = 4; // Size needed to store check info subblock
 
 // FORWARD DECLARATIONS
 class TTlv;
@@ -140,6 +140,7 @@
 
             TUint8 iAddressType;
 
+            TBuf8<KSbCheckInfoSize> iCheckInfo;
             // SS and Call specific
             TBuf8<KStringMaxSize> iString;
 
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -983,6 +983,13 @@
         inline TBool ImeiAvailable() const;
 
         /**
+        * Method to check if IMEISV is successfully received
+        * @return ETrue if IMEISV is known, otherwise EFalse
+        * @param None
+        */
+        inline TBool ImeiSvAvailable() const;
+
+        /**
         * Method to check Location information status
         * @since NCP 5.0
         * @return ETrue or EFalse
@@ -1187,6 +1194,9 @@
         // For storing IMEI code.
         TBuf8<16>           iIMEI;
 
+        // For storing IMEI-SV BCD string
+        TBuf8<9>           iIMEIsv;
+
         // For storing NMR
         TBuf8<16>           iNMR;
 
@@ -1194,7 +1204,10 @@
         TBuf<32>            iBCCHChannelList;
 
         // For checking if IMEI code has been received
-        TBool               iSerialNumberReadReceived;
+        TBool               iImeiAvailable;
+
+        // For checking if IMEISV code has been received
+        TBool               iImeiSvAvailable;
 
         // Stores the state of SMS CB routing request
         TBool               iSmsCbRoutingComplete;
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.inl	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.inl	Thu Jan 14 10:44:58 2010 +0200
@@ -42,7 +42,17 @@
 //
 inline TBool CSatMessHandler::ImeiAvailable() const
     {
-    return iSerialNumberReadReceived ? ETrue : EFalse;
+    return iImeiAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// CSatMessHandler::ImeiSvAvailable
+// Return ETrue if ImeiSv has been successfullly read, EFalse if not.
+// -----------------------------------------------------------------------------
+//
+inline TBool CSatMessHandler::ImeiSvAvailable() const
+    {
+    return iImeiSvAvailable;
     }
 
 // -----------------------------------------------------------------------------
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -137,8 +137,8 @@
         * @param aAddressData2 TP address
         * @return none
         */
-        void SendMoSmsCtrlEnvelope( TUint8 aTraId, TDes8& aAddressData1,
-            TDes8& aAddressData2 );
+        void SendMoSmsCtrlEnvelope( TUint8 aTraId, const TDesC8& aAddressData1,
+            const TDesC8& aAddressData2 );
 
         /*
         * Handles UICC_CAT_RESP, which comes from SIM as a reply
--- a/adaptationlayer/tsy/simatktsy_dll/src/ber_tlv.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/ber_tlv.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -24,9 +24,9 @@
 #include "tsylogger.h"      // for logging
 #include <tisi.h>           // isi message
 #include <uiccisi.h>        // UICC server
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "ber_tlvtraces.h"
+#include "ber_tlvTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -25,15 +25,16 @@
 #include "ber_tlv.h"            // sat ber-tlv classes
 #include "satutil.h"            // sat utility class
 
+#include <satcs.h>
 #include <pn_const.h>           // server id constants
 #include <tisi.h>               // isi message
 #include <ss_wmisi.h>           // Modem SS server
 #include <call_modemisi.h>      // Modem Call server
 #include <gpdsisi.h>            // GPDS server
 #include <uiccisi.h>            // UICC server
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satcctraces.h"
+#include "satccTraces.h"
 #endif
 
 
@@ -60,6 +61,7 @@
     252 +   //CALL_MODEM_SB_DESTINATION_ADDRESS
     252 +   //CALL_MODEM_SB_DESTINATION_SUBADDRESS
     252 +   //CALL_MODEM_SB_BC
+    4 +     //CALL_MODEM_SB_CAUSE
     4;      //CALL_MODEM_SB_CAUSE
 
 const TUint8 KMSBMask = 0x80;
@@ -136,7 +138,7 @@
     {
     OstTrace0( TRACE_NORMAL, DUP1_CSATCC_CSATCC, "CSatCC::~CSatCC" );
     TFLOGSTRING("TSY: CSatCC::~CSatCC");
-    
+
     if( iCallControlArray )
         {
         iCallControlArray->Close();
@@ -416,7 +418,7 @@
             // send CC event response.
             TPtrC8 atkData;
             SendSsResourceControlReq( aCcstruct, KError, atkData );
-            
+
             TInt index( GetArrayIndexById( aCcstruct.iTransId ) );
             if ( index != KErrNotFound )
                 {
@@ -458,7 +460,7 @@
        CALL_MODEM_SB_DESTINATION_ADDRESS,
        EIsiSubBlockTypeId8Len8,
        sbStartOffset ) );
-    
+
     if ( KErrNone == retValue )
         {
         envelope.AddTag( KTlvAddressTag );
@@ -483,10 +485,10 @@
         {
         envelope.AddTag( KTlvSubaddressTag );
         // Subaddress is given in same form as expected in envelope
-        addressLength = aIsiMessage.Get8bit( sbStartOffset + 
+        addressLength = aIsiMessage.Get8bit( sbStartOffset +
             CALL_MODEM_SB_DESTINATION_SUBADDRESS_OFFSET_ADDRLEN );
-        envelope.AddData( aIsiMessage.GetData( sbStartOffset + 
-            CALL_MODEM_SB_DESTINATION_SUBADDRESS_OFFSET_ADDR, 
+        envelope.AddData( aIsiMessage.GetData( sbStartOffset +
+            CALL_MODEM_SB_DESTINATION_SUBADDRESS_OFFSET_ADDR,
             addressLength ) );
         }
     // Add mandatory location information
@@ -527,7 +529,6 @@
         envelope.End() );
     }
 
-
 // -----------------------------------------------------------------------------
 // CSatCC::UiccCatRespEnvelopeReceived
 // Handler function of incoming call control related data notification messages
@@ -716,9 +717,9 @@
                 {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_IND");
     OstTrace0( TRACE_NORMAL, DUP1_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_IND" );
-                
-                if ( CALL_MODEM_RES_CONF_STARTUP == 
-                    aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+
+                if ( CALL_MODEM_RES_CONF_STARTUP ==
+                    aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                         CALL_MODEM_RESOURCE_CONF_IND_OFFSET_CONFSTATUS ) )
                     {
                     // configure resource control if CC enabled in (U)SIM
@@ -744,14 +745,14 @@
                 {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_RESP");
     OstTrace0( TRACE_NORMAL, DUP2_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_RESP" );
-    
-                if ( CALL_MODEM_RES_CONF_SET == 
-                    aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+
+                if ( CALL_MODEM_RES_CONF_SET ==
+                    aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                         CALL_MODEM_RESOURCE_CONF_RESP_OFFSET_CONFOPERATION ) )
                     {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_RESP Resource configured");
     OstTrace0( TRACE_NORMAL, DUP3_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_CONF_RESP Resource configured" );
-    
+
                     }
                 break;
                 }
@@ -759,7 +760,7 @@
                 {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_RESP Resource control sequence done");
     OstTrace0( TRACE_NORMAL, DUP4_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, CALL_MODEM_RESOURCE_RESP Resource control sequence done" );
-    
+
                 break;
                 }
             default:
@@ -783,9 +784,9 @@
                 {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, SS_RESOURCE_CONF_IND");
     OstTrace0( TRACE_NORMAL, DUP5_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, SS_RESOURCE_CONF_IND" );
-    
-                if ( SS_RESOURCE_CONF_READY  == 
-                    aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+
+                if ( SS_RESOURCE_CONF_READY  ==
+                    aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                         SS_RESOURCE_CONF_IND_OFFSET_CONFSTATUS  ) )
                     {
                     // configure resource control if CC enabled in (U)SIM
@@ -798,19 +799,19 @@
                 }
             case SS_RESOURCE_CONF_RESP:
                 {
-                if ( SS_RESOURCE_CONF_SET == 
-                        aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+                if ( SS_RESOURCE_CONF_SET ==
+                        aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                             SS_RESOURCE_CONF_RESP_OFFSET_CONFOPERATION  ) )
                     {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, SS_RESOURCE_CONF_RESP Resource configured");
     OstTrace0( TRACE_NORMAL, DUP6_CSATCC_MESSAGERECEIVED, "TSY: CSatCC::MessageReceived, SS_RESOURCE_CONF_RESP Resource configured" );
-    
+
                     }
                 break;
                 }
             case SS_STATUS_IND:
                 {
-                TUint8 status( aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+                TUint8 status( aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                     SS_STATUS_IND_OFFSET_SSSTATUSINDICATION  ) );
 
                 if ( SS_STATUS_REQUEST_SERVICE_FAILED == status
@@ -866,8 +867,8 @@
                 }
             case GPDS_RESOURCE_CONF_RESP:
                 {
-                if ( GPDS_RESOURCE_CONF_SET == 
-                        aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+                if ( GPDS_RESOURCE_CONF_SET ==
+                        aIsiMessage.Get8bit( ISI_HEADER_SIZE +
                             GPDS_RESOURCE_CONF_RESP_OFFSET_CONFOPERATION  ) )
                     {
     TFLOGSTRING("TSY: CSatCC::MessageReceived, GPDS_RESOURCE_CONF_RESP Resource configured");
@@ -1028,17 +1029,17 @@
            EIsiSubBlockTypeId8Len8,
            sbStartOffset ) );
 
-    if ( KErrNone == retValue 
+    if ( KErrNone == retValue
         && CALL_MODEM_RES_ID_MO_INIT & aIsiMessage.Get16bit( sbStartOffset +
             CALL_MODEM_SB_RESOURCE_OFFSET_RES  ) )
         {
         TCallControl callcontrol;
         // store traid's
-        callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+        callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
             CALL_MODEM_RESOURCE_IND_OFFSET_TRID );
         callcontrol.iRecourceId = aIsiMessage.Get8bit(
             ISI_HEADER_OFFSET_RESOURCEID);
-        callcontrol.iCallId = aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
+        callcontrol.iCallId = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
             CALL_MODEM_RESOURCE_IND_OFFSET_CALLID );
 
         retValue = aIsiMessage.FindSubBlockOffsetById(
@@ -1048,7 +1049,7 @@
            sbStartOffset );
         if( KErrNone == retValue )
             {
-            callcontrol.iResourceSeqId = aIsiMessage.Get8bit( sbStartOffset + 
+            callcontrol.iResourceSeqId = aIsiMessage.Get8bit( sbStartOffset +
                 CALL_MODEM_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID );
             }
 
@@ -1059,9 +1060,9 @@
             sbStartOffset );
         if( KErrNone == retValue )
             {
-            callcontrol.iCallMode.Append( aIsiMessage.Get8bit( sbStartOffset + 
+            callcontrol.iCallMode.Append( aIsiMessage.Get8bit( sbStartOffset +
                 CALL_MODEM_SB_MODE_OFFSET_MODE ) );
-            callcontrol.iCallMode.Append( aIsiMessage.Get8bit( sbStartOffset + 
+            callcontrol.iCallMode.Append( aIsiMessage.Get8bit( sbStartOffset +
                 CALL_MODEM_SB_MODE_OFFSET_MODEINFO ) );
             }
 
@@ -1074,8 +1075,8 @@
             {
             TInt bearerLength( aIsiMessage.Get8bit( sbStartOffset +
                 CALL_MODEM_SB_BC_OFFSET_BCLENGTH ) );
-            
-            callcontrol.iBearerCapabilities.Copy( aIsiMessage.GetData( 
+
+            callcontrol.iBearerCapabilities.Copy( aIsiMessage.GetData(
                 sbStartOffset + CALL_MODEM_SB_BC_OFFSET_BCDATA,
                 bearerLength ) );
             }
@@ -1092,11 +1093,21 @@
                 CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDRTYPE );
             TUint8 addressLength( aIsiMessage.Get8bit( sbStartOffset +
                 CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDRLEN ) );
-            callcontrol.iString.Copy( aIsiMessage.GetData( sbStartOffset + 
+            callcontrol.iString.Copy( aIsiMessage.GetData( sbStartOffset +
                 CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDR,
                 addressLength * 2 ) );
             }
 
+        retValue = aIsiMessage.FindSubBlockOffsetById(
+           ISI_HEADER_SIZE + SIZE_CALL_MODEM_RESOURCE_IND ,
+           CALL_MODEM_SB_CHECK_INFO,
+           EIsiSubBlockTypeId8Len8,
+           sbStartOffset );
+        if( KErrNone == retValue )
+            {
+            callcontrol.iCheckInfo = aIsiMessage.GetData( sbStartOffset,
+                SIZE_CALL_MODEM_SB_CHECK_INFO );
+            }
         if( CALL_MODEM_MODE_EMERGENCY == callcontrol.iCallMode[0] )
             {
             // Do not make SIM call control, allow emergency calls always
@@ -1151,15 +1162,15 @@
     // Modem Call ID [M]: the unique call ID or CALL_ID_NONE.
     isiMessage.Append( aTcc.iCallId );
     // CALL_MODEM_SB_RESOURCE [M]: resource. Shall be same as in the corresponding indication.
-    TIsiSubBlock resource( 
+    TIsiSubBlock resource(
         isiMessage,
         CALL_MODEM_SB_RESOURCE,
         EIsiSubBlockTypeId8Len8 );
     TSatUtility::AppendWord( CALL_MODEM_RES_ID_MO_INIT, isiMessage );
     resource.CompleteSubBlock();
-    
+
     // CALL_MODEM_SB_RESOURCE_SEQ_ID [M]: Sequence ID. Shall be same as in the corresponding indication.
-    TIsiSubBlock resourceSeqId( 
+    TIsiSubBlock resourceSeqId(
         isiMessage,
         CALL_MODEM_SB_RESOURCE_SEQ_ID,
         EIsiSubBlockTypeId8Len8 );
@@ -1192,8 +1203,8 @@
             {
             // First check if this has been modified to a new SS/USSD action
             CTlv ssServerString;
-            
-            if ( KErrNone == response.TlvByTagValue( &ssServerString, 
+
+            if ( KErrNone == response.TlvByTagValue( &ssServerString,
                 KTlvSsStringTag ) ||
                 KErrNone == response.TlvByTagValue( &ssServerString,
                 KTlvUssdStringTag ) )
@@ -1221,7 +1232,7 @@
     if ( KRejected == internalCcResult || KChanged == internalCcResult )
         {
         // CALL_MODEM_SB_CAUSE sb is needed in rejected cases
-        TIsiSubBlock cause( 
+        TIsiSubBlock cause(
             isiMessage,
             CALL_MODEM_SB_CAUSE,
             EIsiSubBlockTypeId8Len8 );
@@ -1230,18 +1241,18 @@
         cause.CompleteSubBlock();
         sbcount++;
         }
-    
+
     // CALL_MODEM_SB_MODE [M]: call mode.
-    TIsiSubBlock mode( 
+    TIsiSubBlock mode(
         isiMessage,
         CALL_MODEM_SB_MODE,
         EIsiSubBlockTypeId8Len8 );
     // 2 byte buffer
     isiMessage.Append( aTcc.iCallMode );
     mode.CompleteSubBlock();
-    
+
     // CALL_MODEM_SB_BC [M]: Bearer Capabilities for the call.
-    TIsiSubBlock bearer( 
+    TIsiSubBlock bearer(
         isiMessage,
         CALL_MODEM_SB_BC,
         EIsiSubBlockTypeId8Len8 );
@@ -1263,7 +1274,7 @@
         }
     bearer.CompleteSubBlock();
 
-    TIsiSubBlock address( 
+    TIsiSubBlock address(
         isiMessage,
         CALL_MODEM_SB_DESTINATION_ADDRESS ,
         EIsiSubBlockTypeId8Len8 );
@@ -1280,7 +1291,7 @@
             isiMessage.Append( addressTlv.GetValue()[ 0 ] ^KMSBMask );
             isiMessage.Append( KPadding );
             isiMessage.Append( KPadding );
-            
+
             // Temp storage for address
             TBuf8<2 * KCallServerMaxAddressLenght> asciiAddress;
             TSatUtility::BCDToAscii( addressTlv.GetValue().Mid( 1 ),
@@ -1291,20 +1302,20 @@
             TSatUtility::ConvertSms7ToUnicode16( unicodeNumber, asciiAddress );
             TBuf8<2 * KCallServerMaxAddressLenght> temp;
             TIsiUtility::CopyToBigEndian( unicodeNumber, temp );
-            
+
             // Address length = Number of Unicode characters in address
             isiMessage.Append( temp.Length()/2 );
             isiMessage.Append( temp );
-            
+
             address.CompleteSubBlock();
             sbcount++;
             }
-        
+
         CTlv subAddressTlv;
         ret = response.TlvByTagValue( &subAddressTlv, KTlvSubaddressTag );
         if ( KErrNone == ret )
             {
-            TIsiSubBlock subAddress( 
+            TIsiSubBlock subAddress(
                 isiMessage,
                 CALL_MODEM_SB_DESTINATION_SUBADDRESS,
                 EIsiSubBlockTypeId8Len8 );
@@ -1327,9 +1338,24 @@
         sbcount++;
         }
 
+    // CALL_MODEM_SB_CHECK_INFO[O]: bitfield saying if some checks
+    // should be ignored in Call Modem Server
+    if ( aTcc.iCheckInfo.Length() )
+        {
+        isiMessage.Append( aTcc.iCheckInfo );
+        sbcount++;
+        }
     TBuf8<1> numOfSubblocks;
     numOfSubblocks.Append( sbcount);
     isiMessage.Insert( 1, numOfSubblocks );
+
+    // before sending the call control result to call server,
+    // inform NTSY about call control CALL_ID and call control result
+    CMmDataPackage dataPackage;
+    TUint8 callId( aTcc.iCallId );
+    dataPackage.PackData( &callId, &ccresult );
+    iSatMessaging->GetMessageRouter()->ExtFuncL( 
+        ESatNotifyCallControlRequest, &dataPackage );
     // send request
     iSatMessHandler->CallModemResourceReq( aTcc.iTransId, isiMessage );
 
@@ -1356,8 +1382,8 @@
     TCallControl callcontrol;
     TInt stringLength;
     // store traid's
-    callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
-        SS_RESOURCE_CONTROL_IND_OFFSET_TRANSID );    
+    callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
+        SS_RESOURCE_CONTROL_IND_OFFSET_TRANSID );
     callcontrol.iRecourceId = aIsiMessage.Get8bit(
         ISI_HEADER_OFFSET_RESOURCEID);
 
@@ -1367,42 +1393,42 @@
        SS_SB_RESOURCE_SEQ_ID,
        EIsiSubBlockTypeId8Len8,
        sbStartOffset ) );
-    
+
     if( KErrNone == retValue )
         {
-        callcontrol.iResourceSeqId = aIsiMessage.Get8bit( sbStartOffset + 
+        callcontrol.iResourceSeqId = aIsiMessage.Get8bit( sbStartOffset +
             SS_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID );
         }
-    
+
     retValue = aIsiMessage.FindSubBlockOffsetById(
         ISI_HEADER_SIZE + SIZE_SS_RESOURCE_CONTROL_IND,
         SS_SB_SS_CONTROL,
         EIsiSubBlockTypeId8Len8,
         sbStartOffset );
-    
+
     if( KErrNone == retValue )
         {
         stringLength = aIsiMessage.Get8bit( sbStartOffset +
             SS_SB_SS_CONTROL_OFFSET_SSSTRINGLENGTH );
-        callcontrol.iString.Copy( aIsiMessage.GetData( 
+        callcontrol.iString.Copy( aIsiMessage.GetData(
             sbStartOffset + SS_SB_SS_CONTROL_OFFSET_SSSTRING,
             stringLength) );
         }
-    
+
     retValue = aIsiMessage.FindSubBlockOffsetById(
         ISI_HEADER_SIZE + SIZE_SS_RESOURCE_CONTROL_IND,
         SS_SB_USSD_CONTROL,
         EIsiSubBlockTypeId8Len8,
         sbStartOffset );
-    
+
     if( KErrNone == retValue )
         {
         callcontrol.iUssdCodingInfo = aIsiMessage.Get8bit( sbStartOffset +
             SS_SB_USSD_CONTROL_OFFSET_CODINGINFO );
         stringLength = aIsiMessage.Get8bit( sbStartOffset +
             SS_SB_USSD_CONTROL_OFFSET_USSDSTRINGLENGTH  );
-       
-        callcontrol.iUssdString.Copy( aIsiMessage.GetData( 
+
+        callcontrol.iUssdString.Copy( aIsiMessage.GetData(
             sbStartOffset + SS_SB_USSD_CONTROL_OFFSET_USSDSTRING,
             stringLength ) );
         }
@@ -1424,7 +1450,7 @@
 // Creates resource control response for modem SS server
 // -----------------------------------------------------------------------------
 //
-void CSatCC::SendSsResourceControlReq( 
+void CSatCC::SendSsResourceControlReq(
         const TCallControl& aTcc,
         const TUint8 aResult,
         TPtrC8 aApduData )
@@ -1455,15 +1481,15 @@
     // Add mandatory data
     isiMessage.Append( KPadding );
     // SS_SB_RESOURCE [M]: resource. Shall be same as in the corresponding indication.
-    TIsiSubBlock resource( 
+    TIsiSubBlock resource(
         isiMessage,
         SS_SB_RESOURCE ,
         EIsiSubBlockTypeId8Len8 );
     TSatUtility::AppendWord( SS_RES_ID_MO_SS_OPERATION, isiMessage );
     resource.CompleteSubBlock();
-    
+
     // SS_SB_RESOURCE_SEQ_ID [M]: [M]: Sequence ID. Shall be same as in the corresponding indication.
-    TIsiSubBlock resourceSeqId( 
+    TIsiSubBlock resourceSeqId(
         isiMessage,
         SS_SB_RESOURCE_SEQ_ID,
         EIsiSubBlockTypeId8Len8 );
@@ -1497,8 +1523,8 @@
             // First check if this has been modified to a new CALL
             CTlv address;
 
-            if ( KErrNone == response.TlvByTagValue(
-                &address, KTlvAddressTag ) )
+            if ( KErrNone == response.TlvByTagValue( &address,
+                    KTlvAddressTag ) )
                 {
                 // Original action has been modified to call
                 isiMessage.Append( SS_RESOURCE_DENIED );
@@ -1517,7 +1543,8 @@
                     internalCcResult = KChanged;
                     changedSsServerAction = ETrue;
                     }
-                else
+                else if ( KErrNone == response.TlvByTagValue( &ssServerString,
+                    KTlvSsStringTag ) )
                     {
                     // original SS string has been modified to new SS string
                     isiMessage.Append( SS_RESOURCE_ALLOWED );
@@ -1536,7 +1563,8 @@
                     internalCcResult = KChanged;
                     changedSsServerAction = ETrue;
                     }
-                else
+                else if ( KErrNone == response.TlvByTagValue( &ssServerString,
+                    KTlvUssdStringTag ) )
                     {
                     // USSD string has been modified to new USSD string
                     isiMessage.Append( SS_RESOURCE_ALLOWED );
@@ -1567,7 +1595,7 @@
                     isiMessage,
                     SS_SB_SS_CONTROL,
                     EIsiSubBlockTypeId8Len8 );
-                
+
                 TUint8 tonNpi( ssStringTlv.GetValue()[0] );
                 TPtrC8 ssString( ssStringTlv.GetValue().Mid(1) );
 
@@ -1625,7 +1653,7 @@
                 }
             }
         }
-    
+
     TBuf8<1> numOfSubblocks;
     numOfSubblocks.Append( sbcount);
     isiMessage.Insert( 1, numOfSubblocks );
@@ -1664,8 +1692,8 @@
     TInt paramsLength;
     TBuf8<KPdpContextActivationParamsMaxSize> paramsBuffer;
     // store traid's
-    callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE + 
-        GPDS_RESOURCE_CONTROL_REQ_OFFSET_UTID );    
+    callcontrol.iTransId = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
+        GPDS_RESOURCE_CONTROL_REQ_OFFSET_UTID );
     callcontrol.iRecourceId = aIsiMessage.Get8bit(
         ISI_HEADER_OFFSET_RESOURCEID);
     callcontrol.iResourceSeqId = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
@@ -1686,7 +1714,7 @@
         {
         paramsLength = aIsiMessage.Get16bit( sbStartOffset +
             GPDS_ACTIVATE_PDP_CONTEXT_REQUEST_OFFSET_DATALENGTH );
-        paramsBuffer.Copy( aIsiMessage.GetData( 
+        paramsBuffer.Copy( aIsiMessage.GetData(
             sbStartOffset + GPDS_ACTIVATE_PDP_CONTEXT_REQUEST_OFFSET_DATA,
             paramsLength) );
         }
@@ -1702,9 +1730,9 @@
 // Creates resource control response for modem GPDS server
 // -----------------------------------------------------------------------------
 //
-void CSatCC::SendGpdsResourceControlReq( 
+void CSatCC::SendGpdsResourceControlReq(
         const TCallControl& aTcc,
-        const TUint8 aResult, 
+        const TUint8 aResult,
         TPtrC8 aAtkData )
     {
     TFLOGSTRING("TSY: CSatCC::SendGpdsResourceControlReq");
@@ -1750,7 +1778,7 @@
                 {
                 // response is modified in GPDS server terminology only if
                 // new PDP params are provided
-                if ( KCcEmptyResponseLenght < aAtkData.Length() 
+                if ( KCcEmptyResponseLenght < aAtkData.Length()
                     && KErrNone == response.TlvByTagValue( &paramsTlv,
                         KTlvPdpContextActivationParametersTag ) )
                     {
@@ -1785,7 +1813,7 @@
         // Resource is GPDS_CC_FOR_GPRS and Result is GPDS_MODIFIED
         if ( RSat::EAllowedWithModifications == internalCcResult )
             {
-            TIsiSubBlock contextParams( 
+            TIsiSubBlock contextParams(
                 isiMessage,
                 GPDS_ACTIVATE_PDP_CONTEXT_REQUEST,
                 EIsiSubBlockTypeId8Len16 );
--- a/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -29,9 +29,9 @@
 #include <smsisi.h>             // sms server
 #include <etelmm.h>             // etel multimode api
 #include <uiccisi.h>            // UICC server
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satdatadownloadtraces.h"
+#include "satdatadownloadTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/sateventdownload.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/sateventdownload.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,9 +27,9 @@
 #include <tisi.h>               // isi message
 #include <net_modemisi.h>       // net server
 #include <call_modemisi.h>      // Call Modem server
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "sateventdownloadtraces.h"
+#include "sateventdownloadTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satflightmodestatus.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satflightmodestatus.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,9 +25,9 @@
 
 #include <ssm/startupdomainpskeys.h>    // kpsuidstartup & kpsglobalsystemstate
 #include <uiccisi.h>                // UICC server
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satflightmodestatustraces.h"
+#include "satflightmodestatusTraces.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/adaptationlayer/tsy/simatktsy_dll/src/saticon.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/saticon.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -23,9 +23,9 @@
 #include "satmessaging.h"   // sat messaging
 #include "satmesshandler.h" // sat message handler class
 #include "satutil.h"        // sat utility class
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "saticontraces.h"
+#include "saticonTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmessaging.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmessaging.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -40,9 +40,9 @@
 #include <infoisi.h>            // isa cellmo info server
 #include <uiccisi.h>            // UICC server
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satmessagingtraces.h"
+#include "satmessagingTraces.h"
 #endif
 
 #if (NCP_COMMON_S60_VERSION_SUPPORT==S60_VERSION_32)
@@ -233,6 +233,10 @@
     iSatMessHandler->InfoSerialNumberReadReq(
         GetTransactionId(), INFO_SB_SN_IMEI_PLAIN );
 
+    // Request IMEI-SV code. Needed in provide local info proactive command.
+    iSatMessHandler->InfoSerialNumberReadReq(
+        GetTransactionId(), INFO_SN_IMEI_SV_TO_NET );
+
     // Request Network status
     iSatMessHandler->NetCellInfoGetReq(
         GetTransactionId() );
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmesshandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmesshandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -45,9 +45,10 @@
 
 #include <atk_sharedisi.h>
 #include <call_sharedisi.h>
-#include "osttracedefinitions.h"
+#include <info_sharedisi.h>
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satmesshandlertraces.h"
+#include "satmesshandlerTraces.h"
 #endif
 
 
@@ -124,7 +125,8 @@
     iDataDownloadSimReadFieldTraId  = KNoTransactionOngoing;
 
     iCardId                         = KZero;
-    iSerialNumberReadReceived       = EFalse;
+    iImeiAvailable                  = EFalse;
+    iImeiSvAvailable                = EFalse;
     // By default, there's no need to request routing from SMS server
     iSmsCbRoutingComplete           = ETrue;
     iRefreshRequestIsOn             = EFalse;
@@ -1824,6 +1826,12 @@
                 tlvData.AddData( bcdImei );
                 break;
                 }
+            case RSat::KProvideLocalInfoIMEISV:
+                {
+                tlvData.AddTag( KTlvImeisvTag );
+                tlvData.AddData( iIMEIsv );
+                break;
+                }
             case RSat::KProvideLocalInformationNmr:
                 {
                 // Check if NMR's were for UTRAN
@@ -1997,22 +2005,36 @@
 
     TUint sbStartOffset( 0 );
 
-    TInt retValue( aIsiMessage.FindSubBlockOffsetById(
-                    ISI_HEADER_SIZE + SIZE_INFO_SERIAL_NUMBER_READ_RESP,
-                    INFO_SB_SN_IMEI_PLAIN, EIsiSubBlockTypeId8Len8,
-                    sbStartOffset ) );
     //check if INFO_SB_SN_IMEI_PLAIN sub block is present
-    if ( KErrNone == retValue )
+    if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE + SIZE_INFO_SERIAL_NUMBER_READ_RESP,
+        INFO_SB_SN_IMEI_PLAIN, EIsiSubBlockTypeId8Len8,
+        sbStartOffset ) )
         {
         //store imei code
         iIMEI.Copy( aIsiMessage.GetData(
-                    sbStartOffset + INFO_SB_SN_IMEI_PLAIN_OFFSET_IMEIPLAINU8,
-                    aIsiMessage.Get8bit( sbStartOffset +
-                    INFO_SB_SN_IMEI_PLAIN_OFFSET_STRLEN ) - 1 ) );
+            sbStartOffset + INFO_SB_SN_IMEI_PLAIN_OFFSET_IMEIPLAINU8,
+            aIsiMessage.Get8bit( sbStartOffset +
+            INFO_SB_SN_IMEI_PLAIN_OFFSET_STRLEN ) - 1 ) );
         //Set the flag to inform that needed data has been received
-        iSerialNumberReadReceived = ETrue;
-        TFLOGSTRING("TSY: SAT, Imei received.");
-        OstTrace0( TRACE_NORMAL, DUP1_CSATMESSHANDLER_INFOSERIALNUMBERREADRESP, "SAT, Imei received." );
+        iImeiAvailable = ETrue;
+TFLOGSTRING("TSY: SAT, Imei received.");
+OstTrace0( TRACE_NORMAL, DUP1_CSATMESSHANDLER_INFOSERIALNUMBERREADRESP, "SAT, Imei received." );
+        }
+    //check if INFO_SB_SN_IMEI_SV_TO_NET sub block is present
+    else if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE + SIZE_INFO_SERIAL_NUMBER_READ_RESP,
+        INFO_SB_SN_IMEI_SV_TO_NET, EIsiSubBlockTypeId8Len8,
+        sbStartOffset ) )
+        {
+        // store imeisv code
+        iIMEIsv.Copy( aIsiMessage.GetData(
+            sbStartOffset + INFO_SB_SN_IMEI_SV_TO_NET_OFFSET_IMEISVU8,
+            aIsiMessage.Get8bit( sbStartOffset +
+            INFO_SB_SN_IMEI_SV_TO_NET_OFFSET_STRLEN ) ) );
+        iImeiSvAvailable = ETrue;
+TFLOGSTRING("TSY: CSatMessHandler::InfoSerialNumberReadResp IMEISV received");
+OstTrace0( TRACE_NORMAL, DUP2_CSATMESSHANDLER_INFOSERIALNUMBERREADRESP, "CSatMessHandler::InfoSerialNumberReadResp IMEISV received" );
         }
     }
 
@@ -2040,7 +2062,6 @@
         data );
     }
 
-
 // -----------------------------------------------------------------------------
 // CSatMessHandler::NetNeighbourCellResp
 // Parse NET_NEIGHBOUR_CELLS_RESP message and read from it BCCH
@@ -2181,9 +2202,9 @@
 // Sends a CALL_MODEM_RESOURCE_REQ ISI message.
 // -----------------------------------------------------------------------------
 //
-TInt CSatMessHandler::CallModemResourceReq( 
+TInt CSatMessHandler::CallModemResourceReq(
     TUint8 aTransId,
-    const TDesC8& aMsg 
+    const TDesC8& aMsg
     )
     {
     TFLOGSTRING("TSY:CSatMessHandler::CallModemResourceReq");
@@ -2204,26 +2225,26 @@
     TFLOGSTRING("TSY:CSatMessHandler::CallModemResourceConfReq");
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_CALLMODEMRESOURCECONFREQ, "TSY:CSatMessHandler::CallModemResourceConfReq" );
 
-    TBuf8< SIZE_CALL_MODEM_RESOURCE_CONF_REQ + 
+    TBuf8< SIZE_CALL_MODEM_RESOURCE_CONF_REQ +
         SIZE_CALL_MODEM_SB_RESOURCE_CONF> msg;
 
     // CALL_MODEM_RES_CONF_OPERATION
     msg.Append( CALL_MODEM_RES_CONF_SET );
     // Nbr of sb's
     msg.Append( 1 );
-    
+
     TIsiSubBlock sbResourceConf(
         msg,
         CALL_MODEM_SB_RESOURCE_CONF,
         EIsiSubBlockTypeId8Len8 );
-    
+
     TSatUtility::AppendWord( aResourceId, msg );
     TSatUtility::AppendWord( aResourceIdMask, msg);
-    
+
     sbResourceConf.CompleteSubBlock();
-    
-    return iPnSend->Send( 
-        PN_MODEM_CALL, 
+
+    return iPnSend->Send(
+        PN_MODEM_CALL,
         iTsySatMessaging->GetTransactionId(),
         CALL_MODEM_RESOURCE_CONF_REQ,
         msg );
@@ -2238,27 +2259,27 @@
     {
     TFLOGSTRING("TSY:CSatMessHandler::SsResourceConfReq");
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_SSRESOURCECONFREQ, "TSY:CSatMessHandler::SsResourceConfReq" );
-     
-    TBuf8< SIZE_SS_RESOURCE_CONF_REQ  + 
+
+    TBuf8< SIZE_SS_RESOURCE_CONF_REQ  +
         SIZE_SS_SB_RESOURCE_CONF > msg;
 
-    // SS_RESOURCE_CONF_OPERATION 
+    // SS_RESOURCE_CONF_OPERATION
     msg.Append( SS_RESOURCE_CONF_SET );
     // Nbr of sb's
     msg.Append( 1 );
-    
+
     TIsiSubBlock sbResourceConf(
         msg,
         SS_SB_RESOURCE_CONF,
         EIsiSubBlockTypeId8Len8 );
-    
+
     TSatUtility::AppendWord( SS_RES_ID_MO_SS_OPERATION, msg );
     TSatUtility::AppendWord( SS_RES_ID_MO_SS_OPERATION_MASK, msg);
-    
+
     sbResourceConf.CompleteSubBlock();
-    
-    return iPnSend->Send( 
-        PN_SS, 
+
+    return iPnSend->Send(
+        PN_SS,
         iTsySatMessaging->GetTransactionId(),
         SS_RESOURCE_CONF_REQ,
         msg );
@@ -2269,9 +2290,9 @@
 // Sends a SS_RESOURCE_CONNTROL_REQ ISI message.
 // -----------------------------------------------------------------------------
 //
-TInt CSatMessHandler::SsResourceControlReq( 
+TInt CSatMessHandler::SsResourceControlReq(
     TUint8 aTransId,
-    const TDesC8& aMsg 
+    const TDesC8& aMsg
     )
     {
     TFLOGSTRING("TSY:CSatMessHandler::SsResourceControlReq");
@@ -2293,11 +2314,11 @@
     {
     TFLOGSTRING("TSY:CSatMessHandler::GpdsResourceConfReq");
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_GPDSRESOURCECONFREQ, "TSY:CSatMessHandler::GpdsResourceConfReq" );
-    
-    TBuf8< SIZE_GPDS_RESOURCE_CONF_REQ  + 
+
+    TBuf8< SIZE_GPDS_RESOURCE_CONF_REQ  +
         SIZE_GPDS_RESOURCE_CONF > msg;
 
-    // SS_RESOURCE_CONF_OPERATION 
+    // SS_RESOURCE_CONF_OPERATION
     msg.Append( GPDS_RESOURCE_CONF_SET );
     // Nbr of sb's
     msg.Append( 1 );
@@ -2312,8 +2333,8 @@
 
     sbResourceConf.CompleteSubBlock();
 
-    return iPnSend->Send( 
-        PN_GPDS, 
+    return iPnSend->Send(
+        PN_GPDS,
         iTsySatMessaging->GetTransactionId(),
         GPDS_RESOURCE_CONF_REQ,
         msg );
@@ -2324,9 +2345,9 @@
 // Sends a GPDS_RESOURCE_CONNTROL_REQ ISI message.
 // -----------------------------------------------------------------------------
 //
-TInt CSatMessHandler::GpdsResourceControlReq( 
+TInt CSatMessHandler::GpdsResourceControlReq(
     TUint8 aTransId,
-    const TDesC8& aMsg 
+    const TDesC8& aMsg
     )
     {
     TFLOGSTRING("TSY:CSatMessHandler::GpdsResourceControlReq");
@@ -2801,7 +2822,7 @@
         if ( KErrCorrupt == ret )
             {
             if ( !berTlv.TlvByTagValue( &commandDetails,
-                KTlvCommandDetailsTag ) && 
+                KTlvCommandDetailsTag ) &&
                 5 == commandDetails.GetSize()  )
                 {
                 commandDetailsTlv.Copy( commandDetails.Data() );
@@ -2893,7 +2914,7 @@
         // TBuf8<SIZE_SMS_CB_ROUTING_REQ> because we are sending [U]SIM EF CBMID Message
         // Subscription;
         TBuf8<SIZE_SMS_CB_ROUTING_REQ> data;
-        
+
         // Append Routing command
         data.Append( aRoutingCommand );
         // Append Subscription number
@@ -2905,7 +2926,7 @@
         // Append no of Subblocks
         data.Append( 0 );
 
-        // Send Subscription request 
+        // Send Subscription request
         ret = iPnSend->Send( PN_SMS, aTransId, SMS_CB_ROUTING_REQ,
                 data );
 
@@ -2957,7 +2978,7 @@
 
 // -----------------------------------------------------------------------------
 // CSatMessHandler::SmsResourceConfInd
-// Handles Indication from SMS Server for resource configuration Startup 
+// Handles Indication from SMS Server for resource configuration Startup
 // and reconfigure condition .
 // -----------------------------------------------------------------------------
 //
@@ -2975,7 +2996,6 @@
         + SMS_RESOURCE_CONF_IND_OFFSET_CONFSTATUS ) )
         {
         TUint sbStartOffset( 0 );
-        TInt retValue( KErrNotFound );
         // Check if resource control is requested for MO SM.
         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
             ISI_HEADER_SIZE + SIZE_SMS_RESOURCE_CONF_IND,
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -29,9 +29,9 @@
 #include <uiccisi.h>            // UICC server
 #include <smsisi.h>             // sms server
 #include <atk_sharedisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satmosmsctrltraces.h"
+#include "satmosmsctrlTraces.h"
 #endif
 
 
@@ -378,8 +378,7 @@
     OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SMSRESOURCEINDRECEIVED, "CSatMoSmsCtrl::SmsResourceIndReceived" );
     TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceived");
 
-    TBuf8<256> addressData1;
-    TBuf8<256> addressData2;
+    TUint sbOffset;
 
     // Save the transaction id, which is going to
     // be re-used in the resp.
@@ -390,33 +389,64 @@
     iSenderObject = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_SENDEROBJECT );
 
     // Save Sequence id to send it in request message
-    iSequenceId = aIsiMessage.Get8bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+
-            SIZE_SMS_SB_RESOURCE+SMS_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID );
+    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
+        SMS_SB_RESOURCE_SEQ_ID,
+        EIsiSubBlockTypeId16Len16,
+        sbOffset ) )
+        {
+        iSequenceId = aIsiMessage.Get8bit(
+            sbOffset + SMS_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID );
+        }
 
     // save resource id to send it in request mesage
-    iResourceId = aIsiMessage.Get16bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+
-                                         SMS_SB_RESOURCE_OFFSET_RESOURCES );
-
-
-     // Save Service Centre Address Subblock to send it in request message if server has
-     //denied to access
-     iAddressSubblock = aIsiMessage.GetData( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                    SIZE_SMS_SB_RESOURCE_SEQ_ID+SMS_SB_ADDRESS_OFFSET_ADDRESSDATA ,
-                    aIsiMessage.Get8bit(ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+SIZE_SMS_SB_RESOURCE_SEQ_ID+
-                    SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH) );
+    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
+        SMS_SB_RESOURCE,
+        EIsiSubBlockTypeId16Len16,
+        sbOffset ) )
+        {
+        iResourceId = aIsiMessage.Get16bit(
+            sbOffset + SMS_SB_RESOURCE_OFFSET_RESOURCES );
+        }
 
-     // Calculate Address Subblock length
-     TUint8 addrSbLen = aIsiMessage.Get16bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+SIZE_SMS_SB_RESOURCE_SEQ_ID+
-                                             SMS_SB_ADDRESS_OFFSET_SUBBLOCKLENGTH );
+    // Save Service Centre Address Subblock to send it in request message if server has
+    //denied to access
+    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
+        SMS_SB_ADDRESS,
+        EIsiSubBlockTypeId16Len16,
+        sbOffset ) )
+        {
+        TUint8 addressLength = aIsiMessage.Get8bit(
+            sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH );
+        iAddressSubblock = aIsiMessage.GetData(
+            sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATA,
+            addressLength );
+        }
+    else
+        {
+        iAddressSubblock.Zero();
+        }
 
-     // Save Destination address TPDU to send it in request message if server has
-     // Denied the access for that address
-     iUserDataSubblock = ( aIsiMessage.GetData( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                    SIZE_SMS_SB_RESOURCE_SEQ_ID+addrSbLen+
-                    SMS_SB_TPDU_OFFSET_DATABYTES,
-                    aIsiMessage.Get8bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                                 SIZE_SMS_SB_RESOURCE_SEQ_ID+addrSbLen+SMS_SB_TPDU_OFFSET_DATALENGTH )));
-
+    // Save TPDU to send it in request message if server has
+    // Denied the access for that address
+     if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
+         ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
+         SMS_SB_TPDU,
+         EIsiSubBlockTypeId16Len16,
+         sbOffset ) )
+        {
+        TUint8 tpduLength =
+            aIsiMessage.Get8bit( sbOffset + SMS_SB_TPDU_OFFSET_DATALENGTH );
+        iUserDataSubblock = aIsiMessage.GetData(
+            sbOffset + SMS_SB_TPDU_OFFSET_DATABYTES,
+            tpduLength );
+         }
+     else
+         {
+         iUserDataSubblock.Zero();
+         }
 
      //Check if location data is present. Otherwise response to SmsResourceInd
      //is always ALLOWED.
@@ -473,7 +503,7 @@
          dataResp.AppendFill( KPadding,fillbytes );
          addressSb.CompleteSubBlock();
 
-        // Add 5th Subblock SMS_SB_TPDU (Destination address)
+   // Add 5th Subblock SMS_SB_TPDU (Destination address)
 
          TIsiSubBlock userDataSb( dataResp, SMS_SB_TPDU ,
              EIsiSubBlockTypeId16Len16 );
@@ -504,58 +534,43 @@
          {
         if( iIsMoSmsCtrlActivated )    // Check is MO SMS is activated or not
             {
-            TDes8* addressData = NULL;
-            if(SMS_SB_ADDRESS == aIsiMessage.Get16bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                    SIZE_SMS_SB_RESOURCE_SEQ_ID+SMS_SB_ADDRESS_OFFSET_SUBBLOCKID ))
-                {
-                addressData = &addressData1;
+            TPtrC8 addressData2;
 
-                TPtrC8 phoneNumber = aIsiMessage.GetData( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                        SIZE_SMS_SB_RESOURCE_SEQ_ID+SMS_SB_ADDRESS_OFFSET_ADDRESSDATA,
-                        aIsiMessage.Get8bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE+
-                        SIZE_SMS_SB_RESOURCE_SEQ_ID+SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH ) );
-
-                addressData->Append( phoneNumber.Mid( 0, phoneNumber.Length()) );
-
-                }
-            if(SMS_SB_TPDU == aIsiMessage.Get16bit( ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND+SIZE_SMS_SB_RESOURCE
-                    +SIZE_SMS_SB_RESOURCE_SEQ_ID+addrSbLen+SMS_SB_TPDU_OFFSET_SUBBLOCKID ))
+            if ( iUserDataSubblock.Length() )
                 {
-                addressData =&addressData2;
-
                 // check for message type
                 // Whether its a command type message or Submit type
-
                 if(KSmsCommandType == ( iUserDataSubblock[0]& 0x03 ))
                     {
                     iMessageType = KSmsCommandType;
                     TPtrC8 phoneNumber = &iUserDataSubblock[5];
-
                     // Addition of two for Type of number semi octet
-                    addressData->Append( phoneNumber.Mid( 1, (iUserDataSubblock[5]/2)+1 ));
+                    addressData2.Set(
+                        phoneNumber.Mid( 1, (iUserDataSubblock[5]/2)+1 ) );
                     }
-                else if( KSmsSubmitType == ( iUserDataSubblock[0] & 0x03 ))
+                else if( KSmsSubmitType == ( iUserDataSubblock[0] & 0x03 ) )
                     {
                     iMessageType = KSmsSubmitType;
                     TPtrC8 phoneNumber = &iUserDataSubblock[2];
                     // Addition of two for Type of number semi octet
-                    addressData->Append( phoneNumber.Mid( 1, (iUserDataSubblock[2]/2)+1 ));
+                    addressData2.Set(
+                        phoneNumber.Mid( 1, (iUserDataSubblock[2]/2)+1 ) );
                     }
                 }
             // Dialled Number String, the length has to be removed (first byte)
 
-        iMoSmsCtrlEnvelopeTransactionId = iSatMessaging->GetTransactionId();
+            iMoSmsCtrlEnvelopeTransactionId = iSatMessaging->GetTransactionId();
 
-            TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceived, Send envelope");
-            OstTrace0( TRACE_NORMAL, DUP3_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVED, "CSatMoSmsCtrl::SmsResourceIndReceived, Send envelope" );
+TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceived, Send envelope");
+OstTrace0( TRACE_NORMAL, DUP3_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVED, "CSatMoSmsCtrl::SmsResourceIndReceived, Send envelope" );
 
             // The envelope is sent if MO SMS is activated
             SendMoSmsCtrlEnvelope(
                 iMoSmsCtrlEnvelopeTransactionId,
-                addressData1,
+                iAddressSubblock,
                 addressData2
                 );
-       }
+            }
         else        // If MO SMS is not activated
             {
             TBuf8<KMaxLengthOfResourceReq> dataResp;
@@ -623,8 +638,8 @@
 void CSatMoSmsCtrl::SendMoSmsCtrlEnvelope
         (
         TUint8 aTraId,
-        TDes8& aAddressData1,
-        TDes8& aAddressData2
+        const TDesC8& aAddressData1,
+        const TDesC8& aAddressData2
         )
     {
     OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SENDMOSMSCTRLENVELOPE, "CSatMoSmsCtrl::SendMoSmsCtrlEnvelope" );
@@ -897,7 +912,6 @@
 
     if(iIsMoSmsCtrlActivated)
         {
-
             //Resource is disallowed   ||    Resource is allowed without modification
         if((SMS_RESOURCE_ALLOWED != status)||(0 == address1.Length()))
               {
@@ -1129,6 +1143,7 @@
                 break;
                 }
             }
+
         }
     else if ( PN_UICC == resource )
         {
--- a/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -32,9 +32,9 @@
 #include <atkisi.h>             // atk server
 #include <uiccisi.h>            // uicc server
 #include <satcs.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satnotificationstraces.h"
+#include "satnotificationsTraces.h"
 #endif
 
 
@@ -3086,10 +3086,10 @@
     TInt ret( KErrNone );
     TUint8 tpUdlPos( 0 ); // UDL position
     TUint8 tpUdl( 0 ); // User data length
-    TUint8 bufferLength( aTpdu.Length() ); // TPDU buffer length
+    TUint8 lengthOfTPDU( aTpdu.Length() ); // TPDU buffer length
 
     // At first check that TPDU length isn't under minimum
-    if ( KMinSmsTpduLength > bufferLength )
+    if ( KMinSmsTpduLength > lengthOfTPDU )
         {
         TFLOGSTRING("CSatNotifySendSm::CheckTpdu, error: invalid TPDU length");
         OstTrace0( TRACE_NORMAL, DUP1_CSATNOTIFYSENDSM_CHECKTPDU, "CSatNotifySendSm::CheckTpdu, error: invalid TPDU length" );
@@ -3100,7 +3100,7 @@
         // Get index of UDL field
         tpUdlPos = GetTpUdlIndex( aTpdu );
         // Check that UDL index is valid
-        if ( tpUdlPos < bufferLength )
+        if ( tpUdlPos < lengthOfTPDU )
             {
             // Get user data length in 8-bit characters (without packing)
             tpUdl = aTpdu[tpUdlPos];
@@ -3119,7 +3119,7 @@
         if ( KSATSmsMTISubmitOrSubmitReport == ( aTpdu[0] & KMask3 ) )
             {
             // Only user data bytes are remained
-            bufferLength -= ( tpUdlPos + 1 );
+            TUint8 tpUdByteCount( lengthOfTPDU - ( tpUdlPos + 1 ) );
             // Get index of TP-DCS field
             TUint8 tpDcsPos( GetTpDcsIndex( aTpdu ) );
             // Get data coding scheme
@@ -3127,15 +3127,18 @@
 
             // Bits 2 and 3 are for coding scheme ( spec. 3GPP TS23.038 )
             dcs = ( dcs >> 2 ) & 0x03;
+
+            // Check if packing is required
+            TBool isPackingRequired( KSmsPackingRequiredMask &
+                iCommandDetails[KCommandQualifier] );
+            TUint8 maxSmsSize( isPackingRequired ?
+                KSmsMaxSize : KSmsMaxSizeWithoutPacking );
+
             // GSM 7 bit default alphabet
             if ( KSmsDcsDefaultAlphabet == dcs )
                 {
-                // When 7 bit packing is used, number of characters is calculated
-                // as follows (spec. 3GPP TS 23.038 V7.0.0 ):
-                // number of characters = length of user data in bytes * 8 / 7
-                bufferLength = ( bufferLength * 8 ) / 7;
                 // Check the validity of user data length
-                if ( KSmsMaxSize < tpUdl || bufferLength < tpUdl )
+                if ( KSmsMaxSize < tpUdl || maxSmsSize < tpUdByteCount )
                     {
                     // Message is over 160 bytes or invalid user data length
                     TFLOGSTRING("CSatNotifySendSm::CheckTpdu, error: invalid user data length");
@@ -3145,13 +3148,8 @@
                 }
             else // 8-bit or 16-bit data
                 {
-                // Check if packing is required
-                TBool isPackingRequired( KSmsPackingRequiredMask &
-                    iCommandDetails[KCommandQualifier] );
-                TUint8 maxSmsSize( isPackingRequired ?
-                    KSmsMaxSize : KSmsMaxSizeWithoutPacking );
                 // Check the validity of user data length
-                if ( maxSmsSize < tpUdl || bufferLength < tpUdl )
+                if ( maxSmsSize < tpUdl || tpUdByteCount < tpUdl )
                     {
                     // Message size is over the limit or invalid user data length
                     TFLOGSTRING("CSatNotifySendSm::CheckTpdu, error: invalid user data length");
@@ -3783,7 +3781,7 @@
             TFLOGSTRING("TSY: Inform NokiaTSY SS request being SAT originated");
             OstTrace0( TRACE_NORMAL, DUP1_CSATNOTIFYSENDSS_MESSAGERECEIVED, "Inform NokiaTSY SS request being SAT originated" );
             iSatMessaging->GetMessageRouter()->ExtFuncL(
-                ESatNotifyCallControlRequest,
+                ESatNotifySendSsPCmd,
                 NULL );
             }
 #endif
@@ -6934,6 +6932,26 @@
                 }
             break;
             }
+        case RSat::KProvideLocalInfoIMEISV:
+            {
+            TFLOGSTRING("TSY: CSatNotifyLocalInfo::MessageReceived Request: IMEISV");
+            OstTrace0( TRACE_NORMAL, DUP14_CSATNOTIFYLOCALINFO_MESSAGERECEIVED, "CSatNotifyLocalInfo::MessageReceived Request: IMEISV" );
+            // Check if IMEISV is received
+            if ( iSatMessHandler->ImeiSvAvailable() )
+                {
+                // IMEISV is received from info server
+                iLocalInfoRspV3.iGeneralResult = RSat::KSuccess;
+                }
+            else
+                {
+                // No IMEISV available at the moment
+                iLocalInfoRspV3.iGeneralResult =
+                    RSat::KMeUnableToProcessCmd;
+                iLocalInfoRspV3.iAdditionalInfo.Append(
+                    KNoSpecificCauseCanBeGiven );
+                }
+            break;
+            }
         case RSat::KProvideLocalInformationNmr:
             {
             // Check if UTRAN Measurement Qualifier TLV is present
--- a/adaptationlayer/tsy/simatktsy_dll/src/sattimer.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/sattimer.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,9 +21,9 @@
 #include "sattimer.h"           // sat timer class
 #include "satmessaging.h"       // sat messaging class
 #include "satmesshandler.h"     // sat message handler class
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "sattimertraces.h"
+#include "sattimerTraces.h"
 #endif
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satutil.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satutil.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,9 +25,9 @@
 #include <ctsy/serviceapi/cmmsmsutility.h>      // ton/npi constants
 #include "tsylogger.h"          // for logging
 #include <tisi.h>               // isi message
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "satutiltraces.h"
+#include "satutilTraces.h"
 #endif
 
 
--- a/connectivitylayer/group/bld.inf	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/group/bld.inf	Thu Jan 14 10:44:58 2010 +0200
@@ -22,11 +22,8 @@
 DEFAULT
 
 #include "../usbphonetlink/group/bld.inf"
-
-#ifdef NCP_COMMON_BRIDGE_FAMILY
 #include "../isce/group/bld.inf"
 #include "../isimessage/group/bld.inf"
-#endif
 
 PRJ_EXPORTS
 ../rom/connectivitylayer.iby					NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(connectivitylayer.iby)
--- a/connectivitylayer/isce/group/bld.inf	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/group/bld.inf	Thu Jan 14 10:44:58 2010 +0200
@@ -39,6 +39,9 @@
 ../p2prouter_dll/inc/mp2pif.h                   NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(mp2pif.h)
 ../p2prouter_dll/inc/p2pdefs.h                  NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(p2pdefs.h)
 
+// NAMESERVICE
+../isinameservice_dll/inc/nsisi.h                   NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(nsisi.h)
+
 // ISC & ISI
 ../isaaccessextension_dll/inc/isakernelapi.h        NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(isakernelapi.h)
 ../isaaccessextension_dll/inc/iscnokiadefinitions.h NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(iscnokiadefinitions.h)
@@ -57,6 +60,10 @@
 ../isaaccessextension_dll/group/isaaccessextension.mmp
 ../isaaccessldd_ldd/group/isaaccessesldd.mmp
 ../iscapi_dll/group/isauserapi.mmp
+// NameService
+../isinameservice_dll/group/isinameservice.mmp
+// CommunicationManager
+../isicommunicationmanager_dll/group/isicommunicationmanager.mmp
 
 #else
 // No actions
--- a/connectivitylayer/isce/isaaccessextension_dll/eabi/isakernelapiu.def	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/eabi/isakernelapiu.def	Thu Jan 14 10:44:58 2010 +0200
@@ -63,4 +63,5 @@
 	_ZN9DReqQueueD1Ev @ 62 NONAME
 	_ZN9DReqQueueD2Ev @ 63 NONAME
 	_ZNK13DIsaKernelAPI23NotifyStateChangeCancelEv @ 64 NONAME
+	_ZN18MISIObjectRouterIf7ConnectElRhP18MISIRouterObjectIf @ 65 NONAME
 
--- a/connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,12 @@
 *
 */
 
+// NOTE! MISSING SUPPORT >
+//
+// Missing support for NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT, NCP_COMMON_BRIDGE_FAMILY_NAME_SERVICE_SUPPORT
+// Using legacy indicationhandler
+//
+// NOTE! MISSING SUPPORT <
 
 #include <non_foundation_paths.hrh>
 #include <platform_paths.hrh>
@@ -31,6 +37,8 @@
 
 EPOCALLOWDLLDATA
 
+SMPSAFE
+
 SOURCEPATH      ../src
 SOURCE          isakernelapi.cpp
 SOURCE          iadtrace.cpp
@@ -40,7 +48,7 @@
 SOURCE          queue.cpp
 SOURCE          router.cpp
 
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
 SOURCE            pep.cpp
 SOURCE            peptransceiver.cpp
 SOURCE            pipehandler.cpp
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -42,10 +42,12 @@
 
 #include "iadinternaldefinitions.h"    // For TIADConnectionStatus
 //#include "mist2iadapi.h"  // For TIADConnectionStatus // 
+#include "misiobjectrouterif.h"
+#include "misirouterobjectif.h"
 
 // abstract interface for both channels user & kernel 
 // called by extension, provided by extension
-class MIAD2ChannelApi // TODO: MDataRx2ChannelApi?
+class MIAD2ChannelApi : public MISIRouterObjectIf
     {
     
     public:
@@ -110,7 +112,7 @@
 // *called by LDD
 // *provided from extension
 // *must take care of syncronization, LDD and kernel channels using this
-class MChannel2IADApi
+class MChannel2IADApi : public MISIObjectRouterIf
     {
 
     public:
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/isakernelchannel.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/isakernelchannel.h	Thu Jan 14 10:44:58 2010 +0200
@@ -90,6 +90,9 @@
 
         // Checking context.
         void CheckDfc();
+        
+        //From objectapi
+        void Receive( const TDesC8& aMessage );
 
   private:
 
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/iscnokiadefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/iscnokiadefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -139,15 +139,18 @@
     EIscNokiaCancelAsyncEventSubscribe32bit
     };
 
+#ifndef PN_DEV_PC
+#define PN_DEV_PC 0x10 // Not in pn_const.h at the moment TODO: Remove when possible
+#endif
+#ifndef PN_APE_COMMGR
+#define PN_APE_COMMGR 0x11 //TODO remove when defined in pn_const.h
+#endif
 #ifndef THIS_DEVICE
     #if !defined (__WINS__) && !defined(NCP_COMMON_PLATFORM_SIMULATOR)
-        #if !defined (NCP_COMMON_BRIDGE_FAMILY)
-            #define THIS_DEVICE PN_DEV_SOS
-            #define OTHER_DEVICE_1 PN_DEV_HOST
-        #else
             // Device IDs
             #define THIS_DEVICE PN_DEV_HOST
             #define OTHER_DEVICE_1 PN_DEV_MODEM
+            #define PN_DEV_OWN                                                  0x6c
             #define PN_DEV_DONT_CARE OTHER_DEVICE_1
             // Media IDs
             #define PN_MEDIA_SOS                                                PN_MEDIA_MODEM_HOST_IF
@@ -158,7 +161,6 @@
             // To be removed when pipe changes are done.
             #define PNS_PIPE_DATA_OFFSET_DATA                                   3
             // <- Internals CLIENT OF ISC API OR ISA KERNEL API - DO NOT USE!
-        #endif
     #else
         #define THIS_DEVICE PN_DEV_PC
     #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/misiobjectrouterif.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __MISIOBJECTROUTERIF_H__
+#define __MISIOBJECTROUTERIF_H__
+
+class MISIRouterObjectIf;
+
+/*
+* Abstract interface for nameservice and communication manager to use router services.
+*/
+class MISIObjectRouterIf
+    {
+
+    public:
+        
+        /*
+        * Sends a message to router.
+        * Responsibility to deallocate the message is transferred router.
+        * @param aMessage, messages reference
+        * @return, KErrNone if succesfull, KErrNotReady if transceiver is not present.
+        */
+        virtual TInt Send( TDes8& aMessage, const TUint8 aObjId ) = 0;
+
+        /*
+        * Informs router that channel is ready to be open.
+        * If transceiver is not found sets the open pending.
+        * Router shall complete the pending opens when transceiver is ready.
+        * @param aUID, clients UID.
+        * @param aObjId, reference to write clients object id.
+        * @param aCallback, pointer to channel interface.
+        */
+        IMPORT_C static MISIObjectRouterIf* Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterObjectIf* aCallback );        
+
+    };
+
+#endif /* __MISIOBJECTROUTERIF_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/misirouterobjectif.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies 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 __MISIROUTEROBJECTIF_H__
+#define __MISIROUTEROBJECTIF_H__
+
+
+/*
+* Abstract interface for ISI router to use nameservice and communication manager services.
+*/
+class MISIRouterObjectIf
+    {
+
+    public:
+
+        /*
+        * Receive a message from router.
+        * Responsibility to deallocate the message is transferred to channel.
+        * Can be called in 1..N thread contextes.
+        * Cat no be called with FM held.
+        * Same restríctions than in IST API (see from MTrxMuxIf).
+        * @param aMessage, message to receive
+        */
+        virtual void Receive( const TDesC8& aMessage ) = 0;
+
+    };
+
+#endif /* __MISIROUTEROBJECTIF_H__ */
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/router.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/router.h	Thu Jan 14 10:44:58 2010 +0200
@@ -29,7 +29,7 @@
 //ISCE
 #include "isirouterlinkifs.h"       // For MLinkRouterIf
 //ISCE
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT 
 class DPipeHandler;
 #endif
 //ISCE class MIAD2ISTApi;
@@ -137,18 +137,15 @@
             EPipeMsg,
             EMediaMsg,
             EIndicationMsg,
-            EControlMsg,
-            EPnNameAddRespMsg,
             ENotKnownMsg,
+            EUsbPhonetMsg
             };
 
         enum TWaitingType
             {
             ENormalOpen = 1,
-            EDrmOpen,
-            ENameAddOpen
 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
-            ,ELoan
+            ELoan
 #endif
             };
 
@@ -158,9 +155,6 @@
 
         void HandleMediaMessage( TDes8& aMsg );
 
-        void HandleControlMessage( TDes8& aMsg );
-
-        void HandlePnsNameAddResp( TDes8& aMsg );
 
         void SendCommIsaEntityNotReachableResp( const TDesC8& aMsg );
 
@@ -171,18 +165,16 @@
     public:
         static void CheckRouting( DRouter& aTmp, TDes8& aMsg );
 
+        static DRouter* iThisPtr;
+        MISIRouterObjectIf* iNameService;
+        MISIRouterObjectIf* iCommunicationManager;
+
     private:
         static void CommonRxDfc( TAny* aPtr );
 
         static void InitCmtDfc( TAny* aPtr );
-#ifdef NCP_COMMON_BRIDGE_FAMILY
+
         void InitConnectionOk();
-#endif
-        void InitCmtConnection();
-
-        void SendDrmReq( const TUint16 aChannelId );
-
-        void SendPnsNameAddReq( const TUint16 aChannel, const TDesC8& aOpenInfo );
 
         static void NotifyObjLayerConnStatDfc( TAny* aPtr );
 
@@ -190,6 +182,9 @@
 
         void SetSenderInfo( TDes8& aMessage, const TUint16 aCh );
 
+        //From objectapi
+        TInt Send( TDes8& aMessage, const TUint8 aObjId );
+
       // Member data
     private:
         
@@ -214,11 +209,7 @@
 
         enum TISIMedias
             {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-            EISIMediaSOS            = 0x00,
-#else
             EISIMediaHostSSI        = 0x00,
-#endif
             EISIAmountOfMedias
             };
 // ISCE
@@ -226,7 +217,7 @@
         // owned
         // APE <-> CMT connection status ok/nok.
         TIADConnectionStatus                            iConnectionStatus;
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
         DPipeHandler*                                   iPipeHandler;
 #endif
         DIndicationHandler*                             iIndicationHandler;
--- a/connectivitylayer/isce/isaaccessextension_dll/src/indicationhandler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/indicationhandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -17,16 +17,9 @@
 
 
 
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-#include <cmisi.h>                      // PN_COMMMG, PNS_SUBSCRIBED_RESOURCES_...
-#else
 #include <pn_eventmodem_extisi.h>       // PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_...
-#endif
 #include <phonetisi.h>                  // For ISI_HEADER_SIZE
 #include <pn_const.h>                   // For PN_HEADER_SIZE
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-#include <mediaisi.h>                   // For PNS_MEDIA_SOS
-#endif
 #include "indicationhandler.h"
 #include "iadtrace.h"                   // For C_TRACE..
 #include "router.h"                     // For DRouter
@@ -78,9 +71,7 @@
     TUint32 resourceId( 0x00000000 );
     if( ptr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_PREFIX )
         {
-#ifdef NCP_COMMON_BRIDGE_FAMILY
-        TRACE_ASSERT_ALWAYS;// So called "perävalotakuu" for indications PN_PREFIX defined to PN_COMMGR see iscnokiadefinitions.h
-#endif
+        TRACE_ASSERT_ALWAYS;// indications PN_PREFIX defined to PN_COMMGR see iscnokiadefinitions.h
         C_TRACE( ( _T( "DIndicationHandler::Multicast PN_PREFIX 0x%x" ), &aIndication ) );
         OstTrace1( TRACE_NORMAL, DINDICATIONHANDLER_MULTICAST_PN_PREFIX, "DIndicationHandler::Multicast extended resource;aIndication=%x", (TUint)&(aIndication) );
         
@@ -500,11 +491,7 @@
     ASSERT_RESET_ALWAYS( KSubsriptionLength > ( ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCECOUNT ) , EIADOverTheLimits | EIADFaultIdentifier42 << KFaultIdentifierShift );                                                        	
 
     TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-    ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
-#else
     ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_MODEM_HOST_IF;
-#endif
     SET_RECEIVER_DEV( ptr, OTHER_DEVICE_1 );
     SET_SENDER_DEV( ptr, THIS_DEVICE );
     ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_COMMGR;
--- a/connectivitylayer/isce/isaaccessextension_dll/src/isaaccessextension.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/isaaccessextension.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -106,7 +106,7 @@
     C_TRACE( ( _T( "DIsaAccessExtension::GetDFCThread <->" ) ) );
     ASSERT_RESET_ALWAYS( ( EIADLddDfcQueue == aDfcThread || EIADExtensionDfcQueue == aDfcThread ), EIADDFCThreadGetFailed | EIADFaultIdentifier2 << KFaultIdentifierShift );
     // Ownership not given to caller.
-    return iDfcQueueList[ aDfcThread ];
+    return iDfcQueueList[ EIADExtensionDfcQueue ];//SMPSAFE
 
     }
 
--- a/connectivitylayer/isce/isaaccessextension_dll/src/isakernelchannel.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/isakernelchannel.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -879,5 +879,14 @@
     OstTrace0( TRACE_NORMAL, DISAKERNELCHANNEL_CLOSE_EXIT, "<DISAKernelChannel::Close" );
     }
 
+//From objectapi
+void DISAKernelChannel::Receive(
+        const TDesC8& aMessage
+        )
+    {
+    C_TRACE( ( _T( "DISAKernelChannel::Receive 0x%x ->" ), &aMessage ) );
+    ReceiveMsg( aMessage );
+    C_TRACE( ( _T( "DISAKernelChannel::Receive 0x%x <-" ), &aMessage ) );
+    }
 // End of file.
 
--- a/connectivitylayer/isce/isaaccessextension_dll/src/pep.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/pep.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -16,7 +16,7 @@
 */
 
 
-#include <PhonetIsi.h>              // For phonet-header offsets like ISI_HEADER_OFFSET_MESSAGEID
+#include <phonetisi.h>              // For phonet-header offsets like ISI_HEADER_OFFSET_MESSAGEID
 #include <pipeisi.h>                // For PEP_IND_BUSY etc..
 #include <pipe_sharedisi.h>         // For PN_MULTI_CREDIT_FLOW_CONTROL etc..
 #include "pep.h"
--- a/connectivitylayer/isce/isaaccessextension_dll/src/peptransceiver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/peptransceiver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -17,7 +17,7 @@
 
 
 
-#include <PhonetIsi.h>              // For phonet-header offsets like ISI_HEADER_OFFSET_MESSAGEID
+#include <phonetisi.h>              // For phonet-header offsets like ISI_HEADER_OFFSET_MESSAGEID
 #include <pipeisi.h>                // For PEP_IND_BUSY etc..
 #include <pipe_sharedisi.h>         // For PN_MULTI_CREDIT_FLOW_CONTROL etc..
 #include <pn_const.h>
--- a/connectivitylayer/isce/isaaccessextension_dll/src/queue.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/queue.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -279,7 +279,7 @@
     NKern::FMWait( iQueueMutex );
     // If queue get's overfilled throw kernel fault.
     ASSERT_RESET_ALWAYS( ( iCount < iSize ), EIADQueueOutOfSync | EIADFaultIdentifier11 << KFaultIdentifierShift );
-    ASSERT_RESET_ALWAYS( EIADAsyncLast > aReq.iRequest, EIADOverTheLimits | EIADFaultIdentifier11 << KFaultIdentifierShift );
+    ASSERT_RESET_ALWAYS( EIADAsyncLast > aReq.iRequest, EIADOverTheLimits | EIADFaultIdentifier11 << KFaultIdentifierShift | (TUint8)aReq.iRequest << KExtraInfoShift);
     if( iReqList[ aReq.iRequest ] )
         {
         // Place the buffer into the queue.
@@ -351,7 +351,7 @@
     // If setting same request twice.
     C_TRACE( ( _T( "DReqQueue::SetReq 0x%x %d 0x%x 0x%x TBR" ), this, aReqToSet, aStatus, iReqList[ aReqToSet ] ) );
     //jos !NULL ja !NULL fault
-    ASSERT_RESET_ALWAYS( !( !iReqList[ aReqToSet ] && aStatus == NULL ), EIADCommon );
+    ASSERT_RESET_ALWAYS( !( !iReqList[ aReqToSet ] && aStatus == NULL ), EIADCommon | (TUint8)aReqToSet << KExtraInfoShift );
     iReqList[ aReqToSet ] = aStatus;
     C_TRACE( ( _T( "DReqQueue::SetReq 0x%x %d 0x%x <-" ), this, aReqToSet, aStatus ) );
 
@@ -365,7 +365,7 @@
     {
     OstTraceExt2( TRACE_NORMAL, DREQQUEUE_GETREQ_ENTRY, ">DReqQueue::GetReq;aReqToGet=%x;this=%x", (TUint)this, ( TUint )&( aReqToGet ) );
 
-    ASSERT_RESET_ALWAYS( aReqToGet < EIADAsyncLast, EIADWrongRequest | EIADFaultIdentifier14 << KFaultIdentifierShift );
+    ASSERT_RESET_ALWAYS( aReqToGet < EIADAsyncLast, EIADWrongRequest | EIADFaultIdentifier14 << KFaultIdentifierShift | (TUint8)aReqToGet << KExtraInfoShift );
     
     C_TRACE( ( _T( "DReqQueue::GetReq 0x%x 0x%x %d <->" ), this, iReqList[ aReqToGet ], aReqToGet ) );
     
--- a/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -19,10 +19,6 @@
 #include <phonetisi.h>                  // For ISI_HEADER_SIZE
 #include <pn_const.h>                   // For PN_HEADER_SIZE
 #include <pipeisi.h>                    // For PNS_PIPE_DATA_OFFSET_DATA
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-#include <mediaisi.h>                   // For PNS_MEDIA_SPECIFIC_REQ/RESP
-#include <nsisi.h>                      // For PNS_NAME...
-#endif // NCP_COMMON_BRIDGE_FAMILY
 #include <commisi.h>                    // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
 #include "router.h"
 #include "iadtrace.h"                   // For C_TRACE..
@@ -31,6 +27,7 @@
 #include "queue.h"                      // For DQueue
 #include "iadinternaldefinitions.h"     // For EIADAsync...
 #include "iadhelpers.h"                 // For GET_RECEIVER
+#include <nsisi.h>                      // For PN_NAMESERVICE...
 
 #include "pipehandler.h"                // For PipeHandler
 #include "OstTraceDefinitions.h"
@@ -38,97 +35,18 @@
 #include "routerTraces.h"
 #endif
 
+
 //#define MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD // TODO: to be removed when Bridge Modem SW is ok
 
 // ISCE
 #include "memapi.h"                     // For MemApi
 #include "trxdefs.h"                    // For ETrx...
 // ISCE
-// ISCE #include "miad2istapi.h" // For MIAD2ISTApi
-
-
 
 // CONSTS
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-
-// TODO : spec this to some document
-/**** IAD<->SOS_MM ****/
-const TUint8 KIADObjId( 0xfe );
-/* CTRL CONF REQ START *
-[0]     media,          PN_MEDIA_SOS;
-[1]     recdev,         PN_MEDIA_ROUTING_REQ
-[2]     senderdev,      PN_DEV_SOS
-[3]     function,       PN_MEDIA_CONTROL
-[4,5]   length,         8
-[6]     recobj,         PN_OBJ_ROUTER
-[7]     senderobj,      KIADObjId
-[8]     transaction     0x00
-[9]     messageid       PNS_MEDIA_SPECIFIC_REQ
-[10]    media2control   PN_MEDIA_SOS
-[11]    ctrl msg id     KIADCtrlConfReq (0x05)
-[12]    filler          0x00
-[13]    filler          0x00
-*  CTRL CONF REQ END */
-const TUint8 KIADCtrlConfReq( 0x5 );
-/* CTRL CONF RESP START *
-[0]     media,          PN_MEDIA_SOS;
-[1]     recdev,         PN_DEV_SOS
-[2]     senderdev,      PN_MEDIA_ROUTING_REQ
-[3]     function,       PN_MEDIA_CONTROL
-[4,5]   length,         10
-[6]     recobj,         KIADObjId
-[7]     senderobj,      PN_OBJ_ROUTER
-[8]     transaction     0x00
-[9]     messageid       PNS_MEDIA_SPECIFIC_REQ
-[10]    media2control   PN_MEDIA_SOS
-[11]    media error     PN_MCTRL_NO_ERROR
-[12]    ctrl msg id     KIADCtrlConfResp (0x06)
-[13]    conf size       8 bytes
-[14]    conf size       8 bytes
-[15]    filler          0x00
-*  CTRL CONF RESP END */
-const TUint8 KIADCtrlConfResp( 0x6 );
-/* CTRL DRM REQ START *
-[0]     media,          PN_MEDIA_SOS;
-[1]     recdev,         PN_MEDIA_ROUTING_REQ
-[2]     senderdev,      PN_DEV_SOS
-[3]     function,       PN_MEDIA_CONTROL
-[4,5]   length,         8 ( + 6 = KIADCtrlDrmReqLength )
-[6]     recobj,         PN_OBJ_ROUTER
-[7]     senderobj,      KIADObjId
-[8]     channel number  IAD client's channel number
-[9]     messageid       PNS_MEDIA_SPECIFIC_REQ
-[10]    mediatocontrol  PN_MEDIA_SOS
-[11]    ctrl msg id     KIADCtrlDrmReq (0x07)
-[12]    ch is 2 be reg  IAD client's channel number
-[13]    filler          0x00
-*  CTRL DRM REQ END */
-const TUint8 KIADCtrlDrmReq( 0x7 );
-const TInt KIADCtrlDrmReqLength( 14 );
-/* CTRL DRM RESP START *
-[0]     media,          PN_MEDIA_SOS;
-[1]     recdev,         PN_DEV_SOS
-[2]     senderdev,      PN_MEDIA_ROUTING_REQ
-[3]     function,       PN_MEDIA_CONTROL
-[4,5]   length,         8
-[6]     recobj,         KIADObjId
-[7]     senderobj,      PN_OBJ_ROUTER
-[8]     channel number  IAD client's channel number
-[9]     messageid       PNS_MEDIA_SPECIFIC_RESP
-[10]    mediatocontrol  PN_MEDIA_SOS
-[11]    media error     PN_MCTRL_NO_ERROR
-[12]    ctrl msg id     KIADCtrlDrmResp (0x08)
-[13]    filler          0x00
-* CTRL DRM REQ END */
-const TUint8 KIADCtrlDrmResp( 0x8 );
-
-#define CTRL_REQ_OFFSET_MESSAGEID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_DATA )
-#define CTRL_RESP_OFFSET_MESSAGEID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_DATA )
-#define CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 ( CTRL_RESP_OFFSET_MESSAGEID + 1 )
-#define CTRL_CONF_RESP_OFFSET_SIZE_BYTE2 ( CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 + 1 )
-#define CTR_DRM_REQ_RESP_OFFSET_CHANNEL_ID ( ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_UTID )
-#define CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ( CTRL_REQ_OFFSET_MESSAGEID + 1 )
-#endif // NCP_COMMON_BRIDGE_FAMILY
+DRouter* DRouter::iThisPtr = NULL;
+const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
+const TUint32 KNameServiceUID( 0x2002A5A1 );
 
 // TODO: change this to use UnuqueID instead and to extension..
 void DRouter::CheckDfc()
@@ -169,7 +87,7 @@
     
     C_TRACE( ( _T( "DRouter::DRouter ->" ) ) );
     // owned
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     iPipeHandler = new DPipeHandler( *this );
 #endif
     iIndicationHandler = new DIndicationHandler( *this );
@@ -201,21 +119,17 @@
         C_TRACE( ( _T( "DRouter::DRouter %d" ), i ) );
         }
     // Configuration of ISI links. TODO: devices and link configurations for coming platforms are unknown and to be done later.
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-    iLinksArray[ DRouter::EISIMediaSOS ] = MISIRouterLinkIf::CreateLinkF( this, PN_MEDIA_SOS, ETrxPartnerOS );
-#else
-    // Bridge media = PN_MEDIA_MODEM_HOST_IF
     iLinksArray[ DRouter::EISIMediaHostSSI ] = MISIRouterLinkIf::CreateLinkF( this, PN_MEDIA_MODEM_HOST_IF, ETrxSharedMemory );
-#endif // NCP_COMMON_BRIDGE_FAMILY
-    // ISCE
+    DRouter::iThisPtr = this;
     C_TRACE( ( _T( "DRouter::DRouter 0x%x <-" ), this ) );
     OstTrace1( TRACE_NORMAL, DROUTER_DROUTER_EXIT, "<DRouter::DRouter;this=%x", this );
     }
-    
+
 DRouter::~DRouter(
         // None
        )
     {
+
     OstTrace0( TRACE_NORMAL, DUP1_DROUTER_DROUTER_ENTRY, "<DRouter::~DRouter" );
 //ISCE
     // owning so deleting
@@ -235,7 +149,7 @@
         iChannelTable[ i ].iWaitingChannel = NULL;
         iChannelTable[ i ].iType = ENormalOpen;
         }
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     if( iPipeHandler )
         {
         delete iPipeHandler;
@@ -301,7 +215,7 @@
     C_TRACE( ( _T( "DRouter::AllocateDataBlock %d <->" ), aSize ) );
     TUint32 neededLength( aSize + ISI_HEADER_SIZE + PNS_PIPE_DATA_OFFSET_DATA );
     TDes8& tmp = this->AllocateBlock( neededLength );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     tmp.SetLength( neededLength );
     TUint8* msgPtr = const_cast<TUint8*>( tmp.Ptr() );
     SET_RECEIVER_DEV( msgPtr, PN_DEV_DONT_CARE );    
@@ -324,7 +238,7 @@
     OstTraceExt1( TRACE_NORMAL, DROUTER_CLOSE_ENTRY, ">DRouter::Close;aChannelId=%hx", aChannelId );
     C_TRACE( ( _T( "DRouter::Close 0x%x ->" ), aChannelId ) );
     // Channel must be from appropiate length and although it is sixteenbit value it must contain only 8-bit values. If over 8-bit changes needed.
-    ASSERT_RESET_ALWAYS( aChannelId < EIADSizeOfChannels || aChannelId < 0xff, EIADWrongParameter | EIADFaultIdentifier10 << KFaultIdentifierShift );
+    ASSERT_RESET_ALWAYS( aChannelId < EIADSizeOfChannels || aChannelId < 0xff, EIADWrongParameter | EIADFaultIdentifier10 << KFaultIdentifierShift | aChannelId << KChannelNumberShift );
     ASSERT_DFCTHREAD_INEXT();
     // If channel open (!NULL) set as closed (NULL) or if channel open is pending.
     ASSERT_RESET_ALWAYS( aChannelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannelId << KChannelNumberShift | EIADFaultIdentifier21 << KFaultIdentifierShift );
@@ -454,26 +368,10 @@
         // Null so channel is not open, set !null to mark opened channel.
         else
             {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-            const TBool drmChannel( ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ? ETrue : EFalse );
-            if( drmChannel )
-                {
-                C_TRACE( ( _T( "DRouter::Open channel 0x%x drm 0x%x" ), aChannel, aCallback ) );
-                OstTraceExt1( TRACE_NORMAL, DROUTER_OPEN, "DRouter::Open DRM;aChannel=%hx", aChannel );
-                iChannelTable[ aChannel ].iWaitingChannel = aCallback;
-                iChannelTable[ aChannel ].iType = EDrmOpen;
-                SendDrmReq( aChannel );
-                }
-            else
-                {
-#endif // NCP_COMMON_BRIDGE_FAMILY
-                C_TRACE( ( _T( "DRouter::Open channel 0x%x normal 0x%x" ), aChannel, aCallback ) );
-                OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN, "DRouter::Open normal;aChannel=%hx", aChannel );
-                iChannelTable[ aChannel ].iChannel = aCallback;
-                aCallback->CompleteChannelRequest( aRequest, KErrNone );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-                }
-#endif // NCP_COMMON_BRIDGE_FAMILY
+            C_TRACE( ( _T( "DRouter::Open channel 0x%x normal 0x%x" ), aChannel, aCallback ) );
+            OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN, "DRouter::Open normal;aChannel=%hx", aChannel );
+            iChannelTable[ aChannel ].iChannel = aCallback;
+            aCallback->CompleteChannelRequest( aRequest, KErrNone );
             }
         }
     else
@@ -482,17 +380,11 @@
         OstTrace0( TRACE_NORMAL, DUP2_DROUTER_OPEN, "DRouter::Open Not ready" );        
         ASSERT_RESET_ALWAYS( !iChannelTable[ aChannel ].iWaitingChannel, EIADWrongRequest | EIADFaultIdentifier15 << KFaultIdentifierShift  );
         iChannelTable[ aChannel ].iWaitingChannel = aCallback;
-        iChannelTable[ aChannel ].iType = ( ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ?
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-EDrmOpen : ENormalOpen );
-#else
-ENormalOpen : ENormalOpen );
-#endif // NCP_COMMON_BRIDGE_FAMILY
+        iChannelTable[ aChannel ].iType = ( ( aChannel == EIADNokiaDRM || aChannel == EIADNokiaSecurityDriver ) ? ENormalOpen : ENormalOpen );//??? TODO FIX THIS
         }
     C_TRACE( ( _T( "DRouter::Open 0x%x <-" ), aChannel ) );
+    OstTraceExt1( TRACE_NORMAL, DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
 
-    OstTraceExt1( TRACE_NORMAL, DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
-    
     }
 
 // With resource and media
@@ -504,52 +396,15 @@
         )
     {
     OstTraceExt4( TRACE_NORMAL, DUP1_DROUTER_OPEN_ENTRY, ">DRouter::Open;aChannel=%hx;aRequest=%hu;aOpenInfo=%x;aCallback=%x", aChannel, aRequest, ( TUint )&( aOpenInfo ), ( TUint )( aCallback ) );
-//TODO: open with resource: change not to be permit one and in closing pn_name_remove_req.
     C_TRACE( ( _T( "DRouter::Open 0x%x %d 0x%x 0x%x ->" ), aChannel, aRequest, &aOpenInfo, aCallback ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-    ASSERT_RESET_ALWAYS( aCallback, EIADNullParameter | EIADFaultIdentifier20 << KFaultIdentifierShift  );
-    ASSERT_DFCTHREAD_INEXT();
-    ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, EIADWrongParameter | (TUint8)aChannel << KChannelNumberShift | EIADFaultIdentifier27 << KFaultIdentifierShift );
-    if( iConnectionStatus == EIADConnectionOk )
-        {
-        // If not null channel is allready open.
-        if( iChannelTable[ aChannel ].iChannel ||
-            iChannelTable[ aChannel ].iWaitingChannel )
-            {
-            // If another channel tries to open already open channel.
-            OstTrace0( TRACE_NORMAL, DUP4_DROUTER_OPEN, "DRouter::Open already open channel" );            
-            TRACE_WARNING( iChannelTable[ aChannel ].iChannel == aCallback, (TUint8)aChannel << KChannelNumberShift );
-            aCallback->CompleteChannelRequest( aRequest, ( iChannelTable[ aChannel ].iChannel == aCallback ? KErrInUse : KErrAlreadyExists ) );
-            }
-        // Null so channel is not open, set !null to mark opened channel.
-        else
-            {
-            OstTrace0( TRACE_NORMAL, DUP3_DROUTER_OPEN, "DRouter::Open with resource" );            
-            C_TRACE( ( _T( "DRouter::Open channel with resource 0x%x 0x%x" ), aChannel, aCallback ) );
-            iChannelTable[ aChannel ].iWaitingChannel = aCallback;
-            iChannelTable[ aChannel ].iType = ENameAddOpen;
-            SendPnsNameAddReq( aChannel, aOpenInfo );
-            }
-        }
-    else
-        {
-        C_TRACE( ( _T( "DRouter::Open with resource not ready" ) ) );
-        // Opening with resource Id is not supported before IAD is initialized. 
-        // If needed, client can open channel without resource Id and send PNS_NAME_ADD_REQ after 
-        // channel open is actually completed
-        TRACE_ASSERT_INFO( 0, (TUint8)aChannel<<KChannelNumberShift );
-        ASSERT_RESET_ALWAYS( iBootDone, EIADNotSupported | EIADFaultIdentifier5 << KFaultIdentifierShift | (TUint8)aChannel<<KChannelNumberShift );        
-        }
-#else // NCP_COMMON_BRIDGE_FAMILY
     // Some maniac from modem sw decided to remove name service in the last meters, hip-hip hurray inform which clients use resource from open to help debug!
     TRACE_ASSERT_INFO( 0, (TUint8)aChannel<<KChannelNumberShift );
-    // Treat as normal open to enable the sending NOTE! resource is not functioning!!
+    // Treat as normal open to enable the sending.
+    // NOTE! SUPPORT FOR RESOURCE OPEN DOES NOT EXISTS: CLIENT SHOULD NAME SERVICE BY ISI IF. SUPPORT FOR NAME SERVICE DOES NOT EXIST IN APE SW YET: NCP_COMMON_BRIDGE_FAMILY_NAME_SERVICE_SUPPORT
     Open( aChannel, aRequest, aCallback );
-#endif // NCP_COMMON_BRIDGE_FAMILY
+    C_TRACE( ( _T( "DRouter::Open 0x%x <-" ), aChannel ) );
+    OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
 
-    C_TRACE( ( _T( "DRouter::Open 0x%x <-" ), aChannel ) );
-
-    OstTraceExt1( TRACE_NORMAL, DUP1_DROUTER_OPEN_EXIT, "<DRouter::Open;aChannel=%hx", aChannel );
     }
 
 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
@@ -567,7 +422,7 @@
     ASSERT_DFCTHREAD_INEXT();
     ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, aChannel );
     TInt error( KErrNone );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     // Is connection lost.
     error = ( iConnectionStatus == EIADConnectionNotOk ) ? KErrNotSupported : error;
     TRACE_ASSERT_INFO( KErrNone == error, error );
@@ -614,7 +469,7 @@
     ASSERT_DFCTHREAD_INEXT();
     ASSERT_RESET_ALWAYS( aChannel < EIADSizeOfChannels, aChannel );
     TInt error( KErrNone );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     // Is connection lost.
     error = ( iConnectionStatus == EIADConnectionNotOk ) ? KErrNotSupported : error;
     TRACE_ASSERT_INFO( KErrNone == error, error );
@@ -701,9 +556,11 @@
         ASSERT_RESET_ALWAYS( aMessage.Length() > ISI_HEADER_OFFSET_RESOURCEID, EIADOverTheLimits | EIADFaultIdentifier2 << KFaultIdentifierShift  );
         if( msgBlockPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_PIPE && msgBlockPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == THIS_DEVICE )
             {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
             // This shall send the message and deallocate it too.
             error = iPipeHandler->SendPipeMessage( aMessage, aCh );
+#else
+			error = KErrNotSupported;
 #endif
             if( error != KErrNone )
                 {
@@ -729,10 +586,28 @@
                 SET_RECEIVER_OBJ( indicationPtr, KIADEventSubscriptionObjId );
                 this->MessageReceived( tmpIndication );
                 }
-            // The IST shall deallocate the block when it's approriate to do.
-            C_TRACE( ( _T( "DRouter::SendMessage sending 0x%x" ), &aMessage ) );
-            OstTrace1( TRACE_NORMAL, DUP3_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aMessage=%x", (TUint)&(aMessage ));
-            error = SendMsg( aMessage );
+            // To communicationmanager
+            if( ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_EVENT_MULTICAST  )
+               && ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
+                {
+                C_TRACE( ( _T( "DRouter::SendMessage sending to COMMUNICATIONMANAGER>" ) ) );
+                iCommunicationManager->Receive( aMessage );
+                C_TRACE( ( _T( "DRouter::SendMessage sending to COMMUNICATIONMANAGER<" ) ) );
+                }
+            else if( ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_ROUTING_REQ  )
+               && ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
+                {
+                C_TRACE( ( _T( "DRouter::SendMessage sending to NAMESERVICE>" ) ) );
+                iNameService->Receive( aMessage );
+                C_TRACE( ( _T( "DRouter::SendMessage sending to NAMESERVICE<" ) ) );
+                }
+            else // Normal way
+                {
+                // The IST shall deallocate the block when it's approriate to do.
+                C_TRACE( ( _T( "DRouter::SendMessage sending 0x%x" ), &aMessage ) );
+                OstTrace1( TRACE_NORMAL, DUP3_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aMessage=%x", (TUint)&(aMessage ));
+                error = SendMsg( aMessage );
+                }
             }//PIPE
         }
     else
@@ -839,20 +714,48 @@
     OstTrace1( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_ENTRY, ">DRouter::HandleIsiMessage;aMsg=%x", ( TUint )&( aMsg ) );
 
     C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x ->" ), &aMsg ) );
-    const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
-    C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
-    ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier22 << KFaultIdentifierShift );
-    if( iChannelTable[ rcvObjId ].iChannel )
+    TUint8* msg = const_cast<TUint8*>( aMsg.Ptr() );
+    // Message from MODEM to APE, or from APE to APE. If Media SOS -> come through link. If dev OWN -> from APE nameservice
+    if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
         {
-        iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
-        // DeAllocation done by the channel after writing to client's address space.
+        const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
+        C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
+        ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier22 << KFaultIdentifierShift );
+        if( rcvObjId == PN_OBJ_ROUTER ) //TODO to channel table
+            {
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to NAMESERVICE>" ) ) );
+            iNameService->Receive( aMsg );
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to NAMESERVICE<" ) ) );
+            }
+        else if( rcvObjId == PN_OBJ_EVENT_MULTICAST )
+            {
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to COMMUNICATIONMANAGER>" ) ) );
+            iCommunicationManager->Receive( aMsg );
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to COMMUNICATIONMANAGER<" ) ) );
+            }
+        else
+            {
+            if( iChannelTable[ rcvObjId ].iChannel )
+                {
+                iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
+                // DeAllocation done by the channel after writing to client's address space.
+                }
+            else
+                {
+                SendCommIsaEntityNotReachableResp( aMsg );
+                // Not going to anywhere deallocate.
+                DeAllocateBlock( aMsg );
+                }
+            }
         }
-    else
+    else // PN_MEDIA_ROUTING_REQ, receivedevice != own, from nameservice, send to modem
         {
-        SendCommIsaEntityNotReachableResp( aMsg );
-        // Not going to anywhere deallocate.
-        DeAllocateBlock( aMsg );
-        }
+    	  C_TRACE( ( _T( "DRouter::CheckRouting going to MODEM" ) ) );
+    	  msg[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS; // link should set this
+        TInt sendError = SendMsg( aMsg );
+        C_TRACE( ( _T( "DRouter::CheckRouting sendError %d" ), sendError ) );
+    	  }
+    
     C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x <-" ), &aMsg ) );
 
     OstTrace0( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_EXIT, "<DRouter::HandleIsiMessage" );    
@@ -866,7 +769,7 @@
     OstTrace1( TRACE_NORMAL, DROUTER_HANDLEPIPEMESSAGE_ENTRY, ">DRouter::HandlePipeMessage;aMsg=%x", ( TUint )&( aMsg ) );
 
     C_TRACE( ( _T( "DRouter::HandlePipeMessage 0x%x ->" ), &aMsg ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
+#ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
     C_TRACE( ( _T( "DRouter::HandlePipeMessage rcvObjId 0x%x" ), rcvObjId ) );
     ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift| EIADFaultIdentifier25 << KFaultIdentifierShift );    
@@ -898,47 +801,13 @@
         TDes8& aMsg
         )
     {
+
     OstTrace1( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_ENTRY, ">DRouter::HandleMediaMessage;aMsg=%x", ( TUint )&( aMsg ) );
-
     C_TRACE( ( _T( "DRouter::HandleMediaMessage 0x%x ->" ), &aMsg ) );
     TUint8 rcvObjId( 0x00);
     ASSERT_RESET_ALWAYS( aMsg.Length() > ISI_HEADER_OFFSET_MEDIA, EIADOverTheLimits | EIADFaultIdentifier3 << KFaultIdentifierShift  );
-    switch( aMsg[ ISI_HEADER_OFFSET_MEDIA ] )
-        {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-        case PN_MEDIA_USB:
-            {
-            C_TRACE( ( _T( "DRouter::HandleMediaMessage USB" ) ) );
-            OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_USB, "DRouter::HandleMediaMessage USB" );            
-            rcvObjId = EIADNokiaUsbPhonetLink;
-            break;
-            }
-        case PN_MEDIA_BT:
-            {
-            C_TRACE( ( _T( "DRouter::HandleMediaMessage BT" ) ) );
-            OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_BT, "DRouter::HandleMediaMessage BT" );            
-            rcvObjId = EIADNokiaBtPhonetLink;
-            break;
-            }
-        //TBR AFTER CMT ERROR CORRECTION : wk49 cellmo has correction, so remove this later on
-        case PN_MEDIA_ROUTING_REQ:
-            {
-            // TODO: write an error! Someone is sending to APE with wrong media.
-            // USB PDD
-            TRACE_ASSERT_ALWAYS;
-            rcvObjId = GET_RECEIVER_OBJ( aMsg );
-            Kern::Printf("Unknown message 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", aMsg[ 0 ], aMsg[ 1 ], aMsg[ 2 ], aMsg[ 3 ], aMsg[ 4 ], aMsg[ 5 ], aMsg[ 6 ], aMsg[ 7 ], aMsg[ 8 ], aMsg[ 9 ] );
-            break;
-            }
-#endif
-        //TBR AFTER CMT ERROR CORRECTION
-        default:
-            {
-            rcvObjId = GET_RECEIVER_OBJ( aMsg );
-            ASSERT_RESET_ALWAYS( 0, EIADUnkownMedia | ( rcvObjId << KChannelNumberShift ) );
-            break;
-            }
-        }
+    rcvObjId = GET_RECEIVER_OBJ( aMsg );
+    ASSERT_RESET_ALWAYS( 0, EIADUnkownMedia | ( rcvObjId << KChannelNumberShift ) );
     // TODO: UNIQUE
     ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier3 << KFaultIdentifierShift  );
     if( iChannelTable[ rcvObjId ].iChannel )
@@ -953,122 +822,8 @@
         DeAllocateBlock( aMsg );
         }
     C_TRACE( ( _T( "DRouter::HandleMediaMessage 0x%x <-" ), &aMsg ) );
-
     OstTrace0( TRACE_NORMAL, DROUTER_HANDLEMEDIAMESSAGE_EXIT, "<DRouter::HandleMediaMessage" );
-    }
-
-void DRouter::HandleControlMessage(
-        TDes8& aMsg
-        )
-    {
-    OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_ENTRY, ">DRouter::HandleControlMessage;aMsg=%x", ( TUint )&( aMsg ) );
 
-    C_TRACE( ( _T( "DRouter::HandleControlMessage 0x%x ->" ), &aMsg ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-    const TUint8* msgPtr( aMsg.Ptr() );
-    // Check legal msgs
-    ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_SUBFUNCTION ] == PNS_MEDIA_SPECIFIC_RESP, EIADInvalidCtrlMessage | EIADFaultIdentifier1 << KFaultIdentifierShift  );
-    ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_MEDIATOCTRL ] == PN_MEDIA_SOS, EIADInvalidCtrlMessage | EIADFaultIdentifier2 << KFaultIdentifierShift  );
-    ASSERT_RESET_ALWAYS( msgPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_RESP_OFFSET_ERRORCODE ] == PN_MCTRL_NO_ERROR, EIADInvalidCtrlMessage | EIADFaultIdentifier3 << KFaultIdentifierShift  );
-    ASSERT_RESET_ALWAYS( aMsg.Length() > CTRL_RESP_OFFSET_MESSAGEID,  EIADOverTheLimits | EIADFaultIdentifier4 << KFaultIdentifierShift );
-    switch( msgPtr[ CTRL_RESP_OFFSET_MESSAGEID ] )
-        {
-        case KIADCtrlConfResp:
-            {
-            // In MINI_OS case take the maximumdatasize amount from configuration message if bigger than "hat" constant.
-            iMaxFrameSize = KIADMaxIsiMsgSize;
-#ifdef NCP_COMMON_MINIOS
-            TUint16 confMsgSize = ( ( ( ( TUint16 )( msgPtr[ CTRL_CONF_RESP_OFFSET_SIZE_BYTE1 ] ) ) << 8 ) | ( ( TUint16 )( msgPtr[ CTRL_CONF_RESP_OFFSET_SIZE_BYTE2 ] ) ) );
-            // NOTE! This hat constant has relation to cmt side (sos_mm) if the const is changed in either place harmonize!!
-            const TUint16 KSosProxyHatConst( 2140 );
-            iMaxFrameSize = ( confMsgSize > KSosProxyHatConst ? confMsgSize : KIADMaxIsiMsgSize );
-            ASSERT_RESET_ALWAYS( iMaxFrameSize <= confMsgSize, EIADConfigurationInvalid );
-#endif
-            // Datalink layer initialized, router layer is this and knows it, now inform obj layer clients.
-            iConnectionStatus = EIADConnectionOk;
-            iBootDone = ETrue;
-            // Could call straight cause the context is the same thread (extension dfc)
-            NotifyObjLayerConnStat( EIADConnectionOk );
-            // TODO: pns_name_add_req
-            // Initialize channels to NULL when channel is opened !NULL.
-            for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
-                {
-                ASSERT_RESET_ALWAYS( !iChannelTable[ i ].iChannel, EIADChannelOpenedBeforePhysicalLayerInit );
-                C_TRACE( ( _T( "DRouter::HandleControlMessage loop TBR 0x%x" ), i ) );
-                if( iChannelTable[ i ].iWaitingChannel )
-                    {
-                    switch( iChannelTable[ i ].iType )
-                        {
-                        case ENormalOpen:
-                            {
-                            C_TRACE( ( _T( "DRouter::HandleControlMessage booting ENormalOpen 0x%x" ), i ) );
-                            OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_NORMAL_OPEN, "DRouter::HandleControlMessage;i=%x", i );
-                            
-                            MIAD2ChannelApi* tmpChannel = iChannelTable[ i ].iWaitingChannel;
-                            iChannelTable[ i ].iChannel = tmpChannel;
-                            iChannelTable[ i ].iWaitingChannel = NULL;
-                            iChannelTable[ i ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
-                            break;
-                            }
-                        case EDrmOpen:
-                            {
-                            C_TRACE( ( _T( "DRouter::HandleControlMessage booting EDrmOpen 0x%x" ), i ) );
-                            OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_DRM_OPEN, "DRouter::HandleControlMessage EDrmOpen;i=%x", i );
-                            
-                            SendDrmReq( i );
-                            break;
-                            }
-                        case ENameAddOpen:
-                            {
-                            C_TRACE( ( _T( "DRouter::HandleControlMessage booting ENameAddOpen 0x%x" ), i ) );
-                            OstTrace1( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_NAMEADD_OPEN, "DRouter::HandleControlMessage ENameAddOpen;i=%x", i );
-                            
-                            // TODO: Not done yet, problem info get as param, channel to allocate deallocate after open complete?
-                            ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier13 << KFaultIdentifierShift );
-                            break;
-                            }
-                        default:
-                            {
-                            ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier14 << KFaultIdentifierShift  );
-                            break;
-                            }
-                        }
-                    }
-                }
-            C_TRACE( ( _T( "DRouter::HandleControlMessage conf %d" ), iMaxFrameSize ) );
-            break;
-            }
-        case KIADCtrlDrmResp:
-            {
-            const TUint16 channelId( msgPtr[ CTR_DRM_REQ_RESP_OFFSET_CHANNEL_ID ] );
-            C_TRACE( ( _T( "DRouter::HandleControlMessage drm resp 0x%x" ), channelId ) );
-            OstTrace0( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_DRM_RESP, "DRouter::HandleControlMessage drm resp");
-            
-            // Check is this waiting
-            ASSERT_RESET_ALWAYS( channelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)channelId << KChannelNumberShift | EIADFaultIdentifier28 << KFaultIdentifierShift );
-            TRACE_ASSERT_INFO( iChannelTable[ channelId ].iWaitingChannel, (TUint8)channelId<<KChannelNumberShift );
-            TRACE_ASSERT_INFO( !iChannelTable[ channelId ].iChannel, (TUint8)channelId<<KChannelNumberShift );
-            ASSERT_RESET_ALWAYS( iChannelTable[ channelId ].iType == EDrmOpen, EIADWrongTypeOfOpenPending | EIADFaultIdentifier1 << KFaultIdentifierShift );
-            MIAD2ChannelApi* tmpChannel = iChannelTable[ channelId ].iWaitingChannel;
-            iChannelTable[ channelId ].iChannel = tmpChannel;
-            iChannelTable[ channelId ].iWaitingChannel = NULL;
-            C_TRACE( ( _T( "DRouter::HandleControlMessage drm resp 0x%x 0x%x 0x%x 0x%x" ), channelId, tmpChannel, iChannelTable[ channelId ].iChannel, &aMsg ) );
-            iChannelTable[ channelId ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
-            break;
-            }
-        default:
-            {
-            // If wrong message reset! IF changed take care of completion of requests.
-            ASSERT_RESET_ALWAYS( 0, EIADInvalidCtrlMessage | EIADFaultIdentifier5 << KFaultIdentifierShift  );
-            break;
-            }
-        } // switch
-#endif
-    // De-allocate cause not going anywhere else.
-    DeAllocateBlock( aMsg );
-    C_TRACE( ( _T( "DRouter::HandleControlMessage 0x%x <-" ), &aMsg ) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_HANDLECONTROLMESSAGE_EXIT, "<DRouter::HandleControlMessage" );
     }
 
 // KErrBadDescriptor, if message length too small
@@ -1131,17 +886,7 @@
             {
             switch( msg[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] )
                 {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-                // Router <-> SOSMM
-                case KIADObjId:
-                    {
-                    // Name add resp, drm or conf
-                    ASSERT_RESET_ALWAYS( msg[  ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE || msg[  ISI_HEADER_OFFSET_RESOURCEID ] == PN_MEDIA_CONTROL, EIADWrongParameter | msg[  ISI_HEADER_OFFSET_RESOURCEID ] );
-                    route = ( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE ) ? EPnNameAddRespMsg : EControlMsg;
-                    break;
-                    }
-#endif
-                // Indication
+                // Indication NOTE! INDICATION HANDLING IS STILL LEGACY
                 case KIADEventSubscriptionObjId:
                     {
                     ASSERT_RESET_ALWAYS( msg[  ISI_HEADER_OFFSET_RESOURCEID ] != PN_PIPE, EIADWrongParameter | msg[  ISI_HEADER_OFFSET_RESOURCEID ] );
@@ -1169,6 +914,11 @@
             SET_RECEIVER_DEV( ptr, THIS_DEVICE );
             route = EIndicationMsg;
             }
+       else if ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_PC )// TODO: This (PN_DEV_GLOBAL) should be removed from Bridge when modem SW MCE Server is ok
+            {
+            C_TRACE( ( _T( "DRouter::CheckRouting message to PN_DEV_PC ") ) );
+            route=EUsbPhonetMsg;
+            }
 #ifdef MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
 #include <mceisi.h>
             else
@@ -1196,6 +946,12 @@
             Kern::Printf("Unknown message 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", msg[ 0 ], msg[ 1 ], msg[ 2 ], msg[ 3 ], msg[ 4 ], msg[ 5 ], msg[ 6 ], msg[ 7 ], msg[ 8 ], msg[ 9 ] );
             }
         }
+    // APE to APE routing
+    else if( ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) && ( msg[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN ) )
+        {
+        C_TRACE( ( _T( "DRouter::CheckRouting APE to APE routing" ) ) );
+        route = EIsiMsg;
+        }
     // Message to other media than sos in symbian side.
     else
         {
@@ -1228,18 +984,11 @@
             aTmp.DeAllocateBlock( aMsg );
             break;
             }
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-        case EControlMsg:
+        case EUsbPhonetMsg:
             {
-            aTmp.HandleControlMessage( aMsg );
+            aTmp.iChannelTable[ EIscNokiaUsbPhonetLink ].iChannel->ReceiveMsg( aMsg );
             break;
             }
-        case EPnNameAddRespMsg:
-            {
-            aTmp.HandlePnsNameAddResp( aMsg );
-            break;
-            }
-#endif // NCP_COMMON_BRIDGE_FAMILY
         case ENotKnownMsg:
             {
             // Not going to anywhere deallocate.
@@ -1266,6 +1015,7 @@
     C_TRACE( ( _T( "DRouter::CommonRxDfc ->" ) ) );
     DRouter& tmp = *reinterpret_cast<DRouter*>( aPtr );
     ASSERT_DFCTHREAD_INEXT();
+		
     if( tmp.iCommonRxQueue->Count() > KErrNone )
         {
         TDes8& msg( tmp.iCommonRxQueue->Get() );
@@ -1328,9 +1078,15 @@
     tempPtr.Append( 0x00 );
 
 //    ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier2 << KFaultIdentifierShift );
-    SendMsg( tempPtr );
+    if( msgTmpPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN )
+        {
+        MessageReceived( *reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) ) );
+        }
+    else
+        {
+        SendMsg( tempPtr );
+        }
     C_TRACE( ( _T( "DRouter::SendCommIsaEntityNotReachableResp 0x%x <-" ), &aMsg ) );
-
     OstTrace0( TRACE_NORMAL, DROUTER_SENDCOMMISAENTITYNOTREACHABLERESP_EXIT, "<DRouter::SendCommIsaEntityNotReachableResp" );
     }
 
@@ -1344,22 +1100,15 @@
     DRouter& tmp = *reinterpret_cast<DRouter*>( aPtr );
     if( !tmp.iBootDone )
         {
-#ifdef NCP_COMMON_BRIDGE_FAMILY
 #ifndef MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
         tmp.InitConnectionOk();
 #endif // MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD
-#else
-        tmp.InitCmtConnection();
-#endif
         }
+    C_TRACE( ( _T( "DRouter::InitCmtDfc <-" ) ) );
+    OstTrace0( TRACE_NORMAL, DROUTER_INITCMTDFC_EXIT, "<DRouter::InitCmtDfc" );
 
-// ISCE    tmp.InitCmtConnection();
-    C_TRACE( ( _T( "DRouter::InitCmtDfc <-" ) ) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_INITCMTDFC_EXIT, "<DRouter::InitCmtDfc" );
     }
 
-#ifdef NCP_COMMON_BRIDGE_FAMILY
 void DRouter::InitConnectionOk()
     {
 
@@ -1396,216 +1145,6 @@
         }
     C_TRACE( ( _T( "DRouter::InitConnectionOk <-" ) ) );
     }
-#endif // NCP_COMMON_BRIDGE_FAMILY
-
-void DRouter::InitCmtConnection(
-        // None
-        )
-    {
-    OstTrace0( TRACE_NORMAL, DROUTER_INITCMTCONNECTION_ENTRY, ">DRouter::InitCmtConnection" );
-
-    C_TRACE( ( _T( "DRouter::InitCmtConnection ->" ) ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-
-    // send configuration request to proxy
-    const TInt KCtrlConfReqLength( 14 );
-    //ASSERT_RESET_ALWAYS( iIST, EIADNullParameter | EIADFaultIdentifier16 << KFaultIdentifierShift  );
-    TDes8& temp = AllocateBlock( KCtrlConfReqLength );
-    ASSERT_RESET_ALWAYS( ( KCtrlConfReqLength > CTRL_REQ_OFFSET_MESSAGEID + 2 ), EIADOverTheLimits | EIADFaultIdentifier6 << KFaultIdentifierShift  );
-    temp.SetLength( KCtrlConfReqLength );
-    TUint8* tmpPtr( const_cast<TUint8*>( temp.Ptr() ) );
-    tmpPtr[ ISI_HEADER_OFFSET_MEDIA ]                                       = PN_MEDIA_SOS;
-    SET_RECEIVER_DEV( tmpPtr, PN_MEDIA_ROUTING_REQ );
-    SET_SENDER_DEV( tmpPtr, THIS_DEVICE );
-    tmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ]                                  = PN_MEDIA_CONTROL;
-    SET_LENGTH( tmpPtr, ( KCtrlConfReqLength - PN_HEADER_SIZE ) );
-    SET_RECEIVER_OBJ( tmpPtr, PN_OBJ_ROUTER );
-    SET_SENDER_OBJ( tmpPtr, KIADObjId );
-    tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_UTID ]          = 0x00;
-    tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_SUBFUNCTION ]   = PNS_MEDIA_SPECIFIC_REQ;
-    tmpPtr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_MEDIATOCTRL ]   = PN_MEDIA_SOS;
-    tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID ]                                     = KIADCtrlConfReq;
-    tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID + 1 ]                                 = 0x00; // Filler
-    tmpPtr[ CTRL_REQ_OFFSET_MESSAGEID +2 ]                                  = 0x00; // Filler
-    temp.SetLength( KCtrlConfReqLength );
-    SendMsg( temp );
-#endif // NCP_COMMON_BRIDGE_FAMILY
-
-    C_TRACE( ( _T( "DRouter::InitCmtConnection <-" ) ) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_INITCMTCONNECTION_EXIT, "<DRouter::InitCmtConnection" );
-    }
-
-void DRouter::SendDrmReq(
-        const TUint16 aChannelId
-        )
-    {
-    OstTraceExt1( TRACE_NORMAL, DROUTER_SENDDRMREQ_ENTRY, ">DRouter::SendDrmReq;aChannelId=%hx", aChannelId );
-
-    C_TRACE( ( _T( "DRouter::SendDrmReq 0x%x ->" ), aChannelId) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-    // DRM REQ/RESP messages are spec so that only 8-bit values for channelid are possible.
-    ASSERT_RESET_ALWAYS( aChannelId <= 0xff, EIADTooManyBytesToPresent );
-    TDes8& block = AllocateBlock( KIADCtrlDrmReqLength );
-    ASSERT_RESET_ALWAYS( ( KIADCtrlDrmReqLength > CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ), EIADOverTheLimits | EIADFaultIdentifier7 << KFaultIdentifierShift  );;
-    block.SetLength( KIADCtrlDrmReqLength );
-    TUint8* ptr( const_cast<TUint8*>( block.Ptr() ) );
-    ptr[ ISI_HEADER_OFFSET_MEDIA ]                                      = PN_MEDIA_SOS;
-    SET_RECEIVER_DEV( ptr, PN_MEDIA_ROUTING_REQ );
-    SET_SENDER_DEV( ptr, THIS_DEVICE );
-    ptr[ ISI_HEADER_OFFSET_RESOURCEID ]                                 = PN_MEDIA_CONTROL;
-    SET_LENGTH( ptr, ( KIADCtrlDrmReqLength - PN_HEADER_SIZE ) );
-    SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
-    SET_SENDER_OBJ( ptr, KIADObjId );
-    ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_UTID ]         = aChannelId;
-    ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_SUBFUNCTION ]  = PNS_MEDIA_SPECIFIC_REQ;
-    ptr[ ISI_HEADER_SIZE + PNS_MEDIA_SPECIFIC_REQ_OFFSET_MEDIATOCTRL ]  = PN_MEDIA_SOS;
-    ptr[ CTRL_REQ_OFFSET_MESSAGEID ]                                    = KIADCtrlDrmReq;
-    ptr[ CTRL_DRM_REQ_OFFSET_REQUIRED_CHANNEL_ID ]                      = aChannelId;
-    ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier3 << KFaultIdentifierShift );
-    SendMsg( block );
-#endif // NCP_COMMON_BRIDGE_FAMILY
-    C_TRACE( ( _T( "DRouter::SendDrmReq 0x%x <-" ), aChannelId) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_SENDDRMREQ_EXIT, "<DRouter::SendDrmReq" );
-    }
-
-void DRouter::SendPnsNameAddReq( 
-        const TUint16 aChannel, 
-        const TDesC8& aOpenInfo
-        )
-    {
-    OstTraceExt2( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_ENTRY, ">DRouter::SendPnsNameAddReq;aChannel=%hx;aOpenInfo=%x", aChannel, ( TUint )&( aOpenInfo ) );
-
-    C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 0x%x 0x%x ->" ), aChannel, &aOpenInfo ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-
-    TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_REQ );
-    TDes8& block = AllocateBlock( msgLength );
-    ASSERT_RESET_ALWAYS( ( msgLength > ( ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 7 ) ), EIADOverTheLimits | EIADFaultIdentifier8 << KFaultIdentifierShift );
-    block.SetLength( msgLength );
-    TUint8* ptr = const_cast<TUint8*>( block.Ptr() );
-
-    ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
-    SET_RECEIVER_DEV( ptr, OTHER_DEVICE_1 );
-    SET_SENDER_DEV( ptr, THIS_DEVICE );
-    ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
-    SET_LENGTH( ptr, ( msgLength - PN_HEADER_SIZE ) );
-    SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER);
-    SET_SENDER_OBJ( ptr, KIADObjId );
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = aChannel; 
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ;
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = 0x00;
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = 0x00;
-
-    TUint8* resourcePtr = const_cast<TUint8*>( aOpenInfo.Ptr() );
-    /*
-    //TBR
-    for( TInt i( 0 ); i < aOpenInfo.Length(); i++ )
-        {
-        Kern::Printf( "resource[%d]0x%x", i, resourcePtr[i] );
-        }
-    //TBR
-    */
-    switch( aOpenInfo.Length() )
-        {
-        // Resource bigendian 32-bit, TODO : how about winscw?
-        case 4:
-            {
-            C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 32-bit resourceid used 0x%x 0x%x" ), aChannel, &aOpenInfo ) );
-            OstTraceExt5( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_32BIT, "DRouter::SendPnsNameAddReq;aChannel=%hx;resourcePtr[0]=%hhx;resourcePtr[1]=%hhx;resourcePtr[2]=%hhx;resourcePtr[3]=%hhx", aChannel, resourcePtr[0], resourcePtr[1], resourcePtr[2], resourcePtr[3] );
-            
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] = resourcePtr[ 0 ];
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 1 ] = resourcePtr[ 1 ];
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 2 ] = resourcePtr[ 2 ];
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 3 ] = resourcePtr[ 3 ];
-            break;
-            }
-        case 1:
-            {
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] = 0x00;
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 1 ] = 0x00;
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 2 ] = 0x00;
-            ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 3 ] = resourcePtr[ 0 ];
-            OstTraceExt2( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_8BIT, "DRouter::SendPnsNameAddReq;aChannel=%hx;resourcePtr[0]=%hhx", aChannel, resourcePtr[0] );
-            C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 8-bit resourceid used 0x%x 0x%x" ), aChannel, &aOpenInfo ) );
-            break;
-            }
-        default:
-            {
-            ASSERT_RESET_ALWAYS( 0, EIADWrongParameter | EIADFaultIdentifier17 << KFaultIdentifierShift  );
-            break;
-            }
-        }
-    // Phonet device id associated with name.
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 4 ] = THIS_DEVICE;
-    // Phonet object id associated with name.
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 5 ] = aChannel;
-    // Record flags. This entry cannot be changed.
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 6 ] = PN_NAME_NOCHG;
-    ptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + 7 ] = 0x00;
-    ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier4 << KFaultIdentifierShift );
-    SendMsg( block );
-#endif // NCP_COMMON_BRIDGE_FAMILY
-    C_TRACE( ( _T( "DRouter::SendPnsNameAddReq 0x%x 0x%x <-" ), aChannel, &aOpenInfo ) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_SENDPNSNAMEADDREQ_EXIT, "<DRouter::SendPnsNameAddReq" );
-    }
-
-void DRouter::HandlePnsNameAddResp(
-        TDes8& aMsg
-        )
-    {
-    OstTrace1( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_ENTRY, ">DRouter::HandlePnsNameAddResp;aMsg=%x", ( TUint )&( aMsg ) );
-
-    C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp 0x%x ->" ), &aMsg ) );
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-
-    // Channel id from Transaction ID.
-    const TUint8* cptr( aMsg.Ptr() );
-    ASSERT_RESET_ALWAYS( ( ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ) < aMsg.Length(), EIADOverTheLimits | EIADFaultIdentifier9 << KFaultIdentifierShift  );
-    TUint8 channelId( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] );
-    ASSERT_RESET_ALWAYS( channelId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)channelId << KChannelNumberShift | EIADFaultIdentifier23 << KFaultIdentifierShift );
-    if( iChannelTable[ channelId ].iWaitingChannel )
-        {
-        ASSERT_RESET_ALWAYS( iChannelTable[ channelId ].iType == ENameAddOpen, EIADWrongTypeOfOpenPending | EIADFaultIdentifier2 << KFaultIdentifierShift );
-        if( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK )
-            {
-            MIAD2ChannelApi* tmpChannel = iChannelTable[ channelId ].iWaitingChannel;
-            iChannelTable[ channelId ].iChannel = tmpChannel;
-            iChannelTable[ channelId ].iWaitingChannel = NULL;
-            C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp name add resp ok 0x%x 0x%x 0x%x 0x%x" ), channelId, tmpChannel, iChannelTable[ channelId ].iChannel, &aMsg ) );
-
-            OstTraceExt2( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_OK, "DRouter::HandlePnsNameAddResp OK;channelId=%hhx;tmpChannel=%x", channelId, (TUint) ( tmpChannel ) );
-            
-            iChannelTable[ channelId ].iChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNone );
-            }
-        else
-            {
-            C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp name add resp NOK 0x%x 0x%x" ), channelId, &aMsg ) );
-            OstTraceExt1( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_NOK, "DRouter::HandlePnsNameAddResp;channelId=%hhx", channelId );
-            
-            TRACE_ASSERT( cptr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK );
-            iChannelTable[ channelId ].iWaitingChannel->CompleteChannelRequest( EIADAsyncOpen, KErrNotSupported );
-            // Set channel open waiting to null, open was failed.
-            iChannelTable[ channelId ].iWaitingChannel = NULL;
-            }
-        }
-    else
-        {
-        // Check is this waiting
-        // TODO: Does pns_name_add_resp need to be informed with comm_isa_entity_not_reachable_resp if channel is closed?
-        TRACE_ASSERT_INFO( !iChannelTable[ channelId ].iChannel, channelId<<KChannelNumberShift );
-        TRACE_ASSERT_INFO( iChannelTable[ channelId ].iWaitingChannel, channelId<<KChannelNumberShift ); // TODO: This will come when open cancel called with resource.
-        }
-    // De-allocate cause not going anywhere else.
-    DeAllocateBlock( aMsg );
-#endif // NCP_COMMON_BRIDGE_FAMILY
-
-    C_TRACE( ( _T( "DRouter::HandlePnsNameAddResp 0x%x <-" ), &aMsg ) );
-
-    OstTrace0( TRACE_NORMAL, DROUTER_HANDLEPNSNAMEADDRESP_EXIT, "<DRouter::HandlePnsNameAddResp" );
-    }
 
 // router and handler (pipe and indication)
 TInt DRouter::SendMsg(
@@ -1665,40 +1204,34 @@
          )
     {
     OstTraceExt2( TRACE_NORMAL, DROUTER_SETSENDERINFO_ENTRY, ">DRouter::SetSenderInfo;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
-
-    C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x ->" ), &aMessage ) );    
+    C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x ->" ), &aMessage ) );
     TUint8* msgBlockPtr = const_cast<TUint8*>( aMessage.Ptr() );
     ASSERT_RESET_ALWAYS( aMessage.Length() > ISI_HEADER_OFFSET_MEDIA, EIADOverTheLimits | EIADFaultIdentifier10 << KFaultIdentifierShift  );
-    switch( aCh )
-        {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-        case EIADNokiaBtPhonetLink:
-            {
-            OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_BT, "DRouter::SetSenderInfo BT" );            
-            msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_BT;
-            break;
-            }
-        case EIADNokiaUsbPhonetLink:
+    if ( aCh == EIADNokiaUsbPhonetLink )
+ 	      {
+        msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
+        SET_RECEIVER_DEV( msgBlockPtr, OTHER_DEVICE_1 );
+        }
+    else{
+        SET_SENDER_OBJ( msgBlockPtr, aCh );    
+        C_TRACE( ( _T( "DRouter::SetSenderInfo receiver device %d" ), msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] ) );
+        if( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN )
             {
-            OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_USB, "DRouter::SetSenderInfo USB" );            
-            msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_USB;
-            break;
+            C_TRACE( ( _T( "DRouter::SetSenderInfo message to APE from APE" ) ) );
+            SET_SENDER_DEV( msgBlockPtr, PN_DEV_OWN );
             }
-#endif
-        default:
+        else
             {
+            C_TRACE( ( _T( "DRouter::SetSenderInfo message to MODEM from APE" ) ) );
             msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
+            SET_RECEIVER_DEV( msgBlockPtr, OTHER_DEVICE_1 );
             SET_SENDER_DEV( msgBlockPtr, THIS_DEVICE );
-            SET_RECEIVER_DEV( msgBlockPtr, OTHER_DEVICE_1 );
-            SET_SENDER_OBJ( msgBlockPtr, aCh );
-            break;
             }
         }
-    C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x <-" ), &aMessage ) );        
-    
+    C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x <-" ), &aMessage ) );
     OstTrace0( TRACE_NORMAL, DROUTER_SETSENDERINFO_EXIT, "<DRouter::SetSenderInfo" );
     }
-    
+
 void DRouter::CheckSameThreadContext()
     {
     OstTrace0( TRACE_NORMAL, DROUTER_CHECKSAMETHREADCONTEXT_ENTRY, ">DRouter::CheckSameThreadContext" );
@@ -1768,11 +1301,7 @@
         {
         case PN_MEDIA_SOS:
             {
-#ifndef NCP_COMMON_BRIDGE_FAMILY
-            linkdId = EISIMediaSOS;
-#else
             linkdId = EISIMediaHostSSI;
-#endif
             break;
             }
         // Not supported media
@@ -1786,5 +1315,47 @@
 
     }
 
+//From objectapi
+EXPORT_C MISIObjectRouterIf* MISIObjectRouterIf::Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterObjectIf* aCallback )
+    {
+    C_TRACE( ( _T( "MISIObjectRouterIf::Connect %d 0x%x 0x%x>" ), aUID, aObjId, aCallback ) );
+    //Connect( aUID, aObjId, aCallback );
+    if( aUID == KNameServiceUID )
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf was nameservice" ) ) );
+        DRouter::iThisPtr->iNameService = aCallback;
+        aObjId = PN_OBJ_ROUTING_REQ; // 0x00
+        }
+    else if( aUID == KCommunicationManagerUID )
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf was communicationmanager" ) ) );
+        DRouter::iThisPtr->iCommunicationManager = aCallback;
+        aObjId = PN_OBJ_EVENT_MULTICAST; // 0x20
+        }
+    else
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf unknown object api client" ) ) );
+        }
+    MISIObjectRouterIf* tmp = DRouter::iThisPtr;
+    C_TRACE( ( _T( "MISIObjectRouterIf::Connect %d 0x%x 0x%x<" ), aUID, aObjId, aCallback ) );
+    return tmp;
+    }
+
+TInt DRouter::Send( TDes8& aMessage, const TUint8 aObjId )
+    {
+  	C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x>" ), &aMessage, aObjId ) );
+    if( aObjId == PN_OBJ_EVENT_MULTICAST ) //from communicationmanager
+        {
+        // Don't put to mainrxqueue
+        HandleIsiMessage( aMessage );
+        }
+    else
+        {
+        Receive( aMessage );
+        }
+    C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x<" ), &aMessage, aObjId ) );
+  	return KErrNone;
+    }
+
 // End of file.
 
--- a/connectivitylayer/isce/isaaccessldd_ldd/group/isaaccessesldd.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessldd_ldd/group/isaaccessesldd.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -29,6 +29,8 @@
 VENDORID        VID_DEFAULT
 FEATUREVARIANT
 
+SMPSAFE
+
 SOURCEPATH      ../src
 SOURCE          isauserdevice.cpp
 SOURCE          isauserchannel.cpp
--- a/connectivitylayer/isce/isaaccessldd_ldd/inc/isauserchannel.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessldd_ldd/inc/isauserchannel.h	Thu Jan 14 10:44:58 2010 +0200
@@ -137,6 +137,9 @@
         */
         inline TUint16 GetChannelNumber(){ return iChannelNumber; };
 
+        //From objectapi
+        void Receive( const TDesC8& aMessage );
+
         ///// Functions for internal use.
 
     private:
--- a/connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -82,7 +82,7 @@
     }
 
 #ifdef _DEBUG
-#define    ASSERT_DFCTHREAD_INLDD() CheckDfc()
+#define    ASSERT_DFCTHREAD_INLDD()// CheckDfc()
 #else
 #define    ASSERT_DFCTHREAD_INLDD()
 #endif
@@ -1654,5 +1654,15 @@
     OstTrace0( TRACE_NORMAL, DISAUSERCHANNEL_DOCANCEL_EXIT, "<DISAUserChannel::DoCancel" );
     }
 
+//From objectapi
+void DISAUserChannel::Receive(
+        const TDesC8& aMessage
+        )
+    {
+    C_TRACE( ( _T( "DISAUserChannel::Receive 0x%x ->" ), &aMessage ) );
+    ReceiveMsg( aMessage );
+    C_TRACE( ( _T( "DISAUserChannel::Receive 0x%x <-" ), &aMessage ) );
+    } 
+    
 
 
--- a/connectivitylayer/isce/iscapi_dll/group/isauserapi.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/iscapi_dll/group/isauserapi.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,6 +30,8 @@
 CAPABILITY      ALL
 FEATUREVARIANT
 
+SMPSAFE
+
 SOURCEPATH      ../src
 SOURCE          isaapi.cpp
 
--- a/connectivitylayer/isce/iscapi_dll/src/isaapi.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/iscapi_dll/src/isaapi.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -201,20 +201,25 @@
         C_TRACE( ( _T( "RIscApi::Open iChannelNumber %d aChannelNumber %d " ), iChannelNumber, aChannelNumber ) );
         OstTraceExt2( TRACE_NORMAL, DUP1_RISCAPI_OPEN, "RIscApi::Open;iChannelNumber=%hx;aChannelNumber=%hx", iChannelNumber, aChannelNumber );        
         aStatus = KRequestPending;
+        TRequestStatus status = KRequestPending;
         TAny* params[ KThreeParams ];
-        params[ KFirstParam ] = reinterpret_cast< TAny* >( &aStatus );
+        params[ KFirstParam ] = reinterpret_cast< TAny* >( &status );
         params[ KSecondParam ] = reinterpret_cast< TAny* >( &iChannelNumber );
         // If opened with resource (aOpenParams).
         params[ KThirdParam ] = reinterpret_cast< TAny* >( const_cast<TDesC8*>( aOpenParams ) );
         error = DoControl( EIADAsyncOpen, params );
         TRACE_ASSERT_ALWAYS_COND( KErrNone == error );
+        User::WaitForRequest(status);
         // In case of KErrAlreadyExists as a result to open we must close the handle after open.
-        if( KErrAlreadyExists == aStatus.Int() )
+        if( status.Int() == KErrAlreadyExists )
             {
             C_TRACE(  (  _T(  "RIscApi::Open close handle KErrAlreadyExists" ) ) );
             OstTraceExt1( TRACE_NORMAL, RISCAPI_OPEN_ALREADY_EXIST, "RIscApi::Open;aChannelNumber=%hx", aChannelNumber );
             RHandleBase::Close();
             }
+        TRequestStatus* statusPtr=&aStatus;
+
+        User::RequestComplete(statusPtr, status.Int());
         }
     C_TRACE(  (  _T(  "RIscApi::Open <-" ) ) );
 
--- a/connectivitylayer/isce/isiapi_dll/src/isiif.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isiapi_dll/src/isiif.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -26,7 +26,7 @@
 const TInt KReceiveArraySize( 3 );
 const TInt KFirstParam( 0 );
 const TInt KSecondParam( 1 );
-const TInt KThirdParam( 1 );
+const TInt KThirdParam( 2 );
 
 // We need binary type suffix because LDD FW loads .ldd suffix as assumption.
 _LIT( KISIDriverLddBinaryName, "isirouter.dll" );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/group/isicommunicationmanager.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -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 the License "Eclipse Public License v1.0"
+* which accompanies 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        <non_foundation_paths.hrh>
+#include        <platform_paths.hrh>
+#include        "kernel/kern_ext.mmh"
+
+
+TARGET          isicommunicationmanager.dll
+TARGETTYPE      kext
+linkas          isicommunicationmanager.dll
+UID             0x100000AF 0x2002B3D0
+VENDORID        VID_DEFAULT
+CAPABILITY      ALL
+FEATUREVARIANT
+
+SMPSAFE
+
+EPOCALLOWDLLDATA
+
+SOURCEPATH      ../src
+SOURCE          isicommunicationmanager.cpp
+SOURCE          isiindicationhandler.cpp
+
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../isaaccessextension_dll/inc
+USERINCLUDE     ../../memmanager_dll/inc
+USERINCLUDE     ../../isinameservice_dll/inc
+
+
+NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/kernel
+SYSTEMINCLUDE     /epoc32/include/nkern
+
+
+LIBRARY         memmanager.lib
+LIBRARY         isaaccessextension.lib
+LIBRARY         isinameservice.lib
+
+NOEXPORTLIBRARY
+
+START WINS
+win32_library kernel32.lib
+END
+
+
+// flag to enable normal trace inside component
+MACRO   COMPONENT_TRACE_FLAG
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/ape_commgrisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,67 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 _SYMBIAN_ISI_APE_COMMGRISI_H_
+#define _SYMBIAN_ISI_APE_COMMGRISI_H_
+
+#define APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z	 0
+#define APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y	 1
+
+
+//TABLES
+
+//ConstantTable for APE_COMMGR_ERROR_CODES
+#define APE_COMMGR_NOT_ALLOWED                            	0x00                                                 	
+#define APE_COMMGR_OK                                     	0x01                                                 	
+
+
+//SUBBLOCKS
+
+
+//Definition for APE_COMMGR_SUBSCRIBE_SB
+#define APE_COMMGR_SUBSCRIBE_SB                           	0x00                                                 	
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKID         	0 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKLENGTH     	1 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID           	2 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID         	3 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1        	4 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE2        	5 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE3        	6 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_SB_OFFSET_MESSAGEID          	7 //size 1 byte(s)
+#define SIZE_APE_COMMGR_SUBSCRIBE_SB                      	8
+
+
+//MESSAGES
+
+
+//Definition for APE_COMMGR_SUBSCRIBE_REQ
+#define APE_COMMGR_SUBSCRIBE_REQ                          	0x00                                                 	
+#define APE_COMMGR_SUBSCRIBE_REQ_OFFSET_TRANSID           	0 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_REQ_OFFSET_MESSAGEID         	1 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_REQ_OFFSET_FILLERBYTE1       	2 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_REQ_OFFSET_SUBBLOCKCOUNT     	3 //size 1 byte(s)
+#define SIZE_APE_COMMGR_SUBSCRIBE_REQ                     	4
+
+
+//Definition for APE_COMMGR_SUBSCRIBE_RESP
+#define APE_COMMGR_SUBSCRIBE_RESP                         	0x01                                                 	
+#define APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID          	0 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID        	1 //size 1 byte(s)
+#define APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT           	2 //size 1 byte(s)
+#define SIZE_APE_COMMGR_SUBSCRIBE_RESP                    	3
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanager.h	Thu Jan 14 10:44:58 2010 +0200
@@ -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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __ISICOMMUNICATIONMANAGER_H__
+#define __ISICOMMUNICATIONMANAGER_H__
+
+#include "misirouterobjectif.h"
+
+class MISIObjectRouterIf;
+class DISIIndicationHandler;
+
+/*
+* ISI router.
+*/
+NONSHARABLE_CLASS( DISICommunicationManager ) : public DBase, public MISIRouterObjectIf
+    {
+
+    public:
+
+        /*
+        * Default contructor
+        */
+        DISICommunicationManager();
+
+        /*
+        * Destructor
+        */
+        ~DISICommunicationManager();
+
+        /*
+        * See comments from MISIRouterObjectIf
+        */
+        void Receive( const TDesC8& aMessage );
+
+        void SendNameAddReqs();
+        
+        void SendPNSSubscribeResp( const TDesC8& aMessage );
+        
+    private:
+
+        static void InitDfc( TAny* aPtr );
+        
+        // Owned
+        static DMutex*         iCommunicationManagerMutex;
+        TDfc*                  iInitDfc;
+        DISIIndicationHandler* iISIIndicationHandler;
+        TUint8                 iObjId;
+        // Not owned
+        MISIObjectRouterIf*    iRouter;
+        
+    };
+
+#endif /* __ISICOMMUNICATIONMANAGER_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanagertrace.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __ISICOMMUNICATIONMANAGERTRACE_H__
+#define __ISICOMMUNICATIONMANAGERTRACE_H__
+
+// INCLUDES
+#include <kernel.h>
+
+// CONSTANTS
+enum TISIFaultClassCategories
+    {
+    EDISICommunicationManagerTraceId,
+    EDISIIndicationHandlerTraceId,
+    };
+
+const TUint8 KClassIdentifierShift( 8 );
+const TUint8 KObjIdShift( 16 );
+const TUint8 KExtraInfoShift( 24 );
+
+// MACROS
+
+#define _T( a ) a
+#define __TRACE_PRINTF(a) Kern::Printf a
+
+#ifdef _DEBUG
+    #if defined COMPONENT_TRACE_FLAG
+        #define C_TRACE(a) __TRACE_PRINTF(a)
+    #else
+        #define C_TRACE(a) 
+    #endif // COMPONENT_TRACE_FLAG
+#else
+    #define C_TRACE(a)
+#endif // _DEBUG
+
+// Resets are made both in UDEB and UREL (traces only in udeb)
+#define ASSERT_RESET_ALWAYS(a,b) if(!(a)) { __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__)); Kern::Fault( "ISICommunicationManager:", b ); }
+#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled=" __DATE__" "__TIME__, __LINE__ ))
+#define TRACE_ASSERT_INFO(a, b) if (!(a)) __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, extra info 0x%08x, compiled=" __DATE__" "__TIME__, __LINE__, b ));
+
+#endif // __ISICOMMUNICATIONMANAGERTRACE_H__
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/isiindicationhandler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __ISIINDICATIONHANDLER_H__
+#define __ISIINDICATIONHANDLER_H__
+
+#include <klib.h> // For DBase
+
+class SDblQue;
+class MISIObjectRouterIf;
+
+NONSHARABLE_CLASS( DISIIndicationHandler ) : public DBase
+    {
+
+    public:
+
+        class TDeviceIdLink
+            {
+            public:
+                TUint8      iDeviceId;
+                SDblQue     iServerQ;
+                SDblQueLink iDeviceLink;
+            };
+        
+        class TServerIdLink
+            {
+            public:
+                TUint32     iResourceId;
+                SDblQue     iIndicationQ;
+                SDblQueLink iServerLink;
+            };
+
+        class TIndicationLink
+            {
+            public:
+                TUint8      iIndication;
+                SDblQue     iSubscriberQ;
+                SDblQueLink iIndicationLink;
+            };
+
+        class TSubscriberLink
+            {
+            public:
+                TUint8      iObjId;
+                SDblQueLink iSubscriberLink;
+            };
+
+        /*
+        * Constructor
+        */
+        DISIIndicationHandler( MISIObjectRouterIf* aRouter );
+
+        /*
+        * Destructor
+        */
+        ~DISIIndicationHandler();
+
+        /*
+        * Multicast and Subscribe must be called in same DFC thread.
+        * If not then take a deep look at synchronization.
+        */
+        //void Multicast( TDes8& aIndication );
+
+        /*
+        * Multicast and Subscribe must be called in same DFC thread.
+        * If not then take a deep look at synchronization.
+        */
+        TInt Subscribe( TDes8& aSubscriptionReq );
+
+    private:
+
+        void AddIndication( TServerIdLink& aServerLink, const TUint8 aIndication, const TUint16 aObjId );
+
+        void AddSubscriber( TIndicationLink& aIndicationLink, const TUint16 aObjId );
+
+        void AddServer( TDeviceIdLink& aDeviceLink, const TUint32 aResourceId, const TUint8 aIndication, const TUint16 aObjId );
+
+        TDeviceIdLink* GetDeviceLink( const TUint8 aDeviceId );
+
+        TServerIdLink* GetServerLink( TDeviceIdLink& aDeviceLink, const TUint32 aResourceId );
+
+        TIndicationLink* GetIndicationLink( TServerIdLink& aServerLink, const TUint8 aIndication );
+
+        TSubscriberLink* GetSubscriberLink( TIndicationLink& aIndicationLink, const TUint16 aObjId );
+
+        void PrintSubscriptions();
+
+        void RemoveSubscription( const TUint16 aObjId );
+
+        TInt SendSubscription( TDeviceIdLink& aDevice );
+
+    private:
+
+        // Owned
+        SDblQue         iDeviceQ;
+        // Not owned
+        MISIObjectRouterIf* iRouter;
+
+    };
+
+#endif /* __ISIINDICATIONHANDLER_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,287 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <kernel.h>                       // For Kern
+#include "isicommunicationmanager.h"      // For DISINameService
+#include "misiobjectrouterif.h"           // For MISIObjectRouterIf
+#include "isicommunicationmanagertrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes
+#include "memapi.h"                       // For MemApi
+#include <phonetisi.h>                    // For ISI_HEADER_SIZE
+#include <pn_const.h>                     // For PN_OBJ_ROUTING_REQ...
+#include "nsisi.h"                        // For PN_NAMESERVICE
+#include "misiobjectrouterif.h"           // For MISIObjectRouterIf
+#include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
+#include <iscnokiadefinitions.h>          // For THIS_DEVICE
+#include "isaaccessextension.h"           // For DIsaAccessExtension
+#include "isiindicationhandler.h"         // For DISIIndicationHandler
+#include "ape_commgrisi.h"                // For APE_COMMGR..
+
+
+// Faults
+enum TISICommunicationManagerFaults
+    {
+    EISICommunicationManagerMemAllocFailure = 0x01,
+    EISICommunicationManagerMemAllocFailure1,
+    EISICommunicationManagerNullPointer,
+    EISICommunicationManagerUnknownMessage,
+    EISICommunicationManagerMutexCreateFailed,
+    EISICommunicationManagerMutexWaitFailed,
+    };
+
+
+/* PUTB8 macro writes byte value to given address.
+ * This macro is used mainly by other PUTBXX macros.
+ */
+#define PUTB8(p,v) \
+    {(*(TUint8 *)(p)) = ((TUint8)(v));}
+
+
+/* PUTB16 macro writes 16-bit value in Big Endian format
+ * to given address. 16-bit value is written as two separate
+ * bytes, and so this macro can write 16-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB16(p,v) \
+    {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);}
+
+
+/* PUTB32 macro writes 32-bit value in Big Endian format
+ * to given address. 32-bit value is written as four separate
+ * bytes, and so this macro can write 32-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB32(p,v) \
+    {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));}
+
+
+/**
+ *    Big Endian to local endian type
+ */
+ /* GETB8 macro returns byte value from given address.
+ * This macro is used mainly by other GETBXX macros.
+ */
+#define GETB8(p) \
+    (*(TUint8 *)(p))
+
+
+/* GETB16 macro reads 16-bit value in Big Endian format
+ * from given address. 16-bit value is read as two separate
+ * bytes, and so this macro can read 16-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB16(p) \
+    (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
+
+
+/* GETB32 macro reads 32-bit value in Big Endian format
+ * from given address. 32-bit value is read as four separate
+ * bytes, and so this macro can read 32-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB32(p) \
+    (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
+
+
+DMutex* DISICommunicationManager::iCommunicationManagerMutex = NULL;
+_LIT8( KCommunicationManagerMutex, "KCommunicationManagerMutex" );
+
+const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
+const TUint8 KFiller( 0 );
+const TInt KInitDfcPriority( 7 );
+
+
+DISICommunicationManager::DISICommunicationManager(
+        // None
+        )
+    : iObjId( 0x00 )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjId, iRouter ) );
+    iRouter = MISIObjectRouterIf::Connect( KCommunicationManagerUID, iObjId, this );
+    ASSERT_RESET_ALWAYS( iRouter, ( EISICommunicationManagerNullPointer | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+    // Must be > KMutexOrdGeneral1 for nesting purposes because trx shared memory uses KMutexOrdGeneral1
+    TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral2 ) );
+    ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexCreateFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+    iInitDfc = new TDfc( InitDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KInitDfcPriority );
+    ASSERT_RESET_ALWAYS( iInitDfc, ( EISICommunicationManagerMemAllocFailure | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+    iISIIndicationHandler = new DISIIndicationHandler( iRouter );
+    ASSERT_RESET_ALWAYS( iISIIndicationHandler, ( EISICommunicationManagerMemAllocFailure1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+    iInitDfc->Enque();
+    C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x<" ), iObjId, iRouter ) );
+    }
+
+void DISICommunicationManager::InitDfc(
+        TAny* aPtr  // Pointer to this object.
+        )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::InitDfc 0x%x>" ), aPtr ) );
+    DISICommunicationManager* tmp = reinterpret_cast<DISICommunicationManager*>( aPtr );
+    tmp->SendNameAddReqs();
+    C_TRACE( ( _T( "DISICommunicationManager::InitDfc<" ) ) );
+    }
+
+void DISICommunicationManager::SendNameAddReqs()
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs>" ) ) );
+    //PN_COMMGR name
+    TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_REQ );
+    TDes8& addMsg = MemApi::AllocBlock( msgLength );
+    addMsg.SetLength( msgLength );
+    TUint8* addPtr = const_cast<TUint8*>( addMsg.Ptr() );
+    addPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+    SET_RECEIVER_DEV( addPtr, PN_DEV_OWN );
+    SET_SENDER_DEV( addPtr, PN_DEV_OWN );
+    addPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+    SET_LENGTH( addPtr, ( msgLength - PN_HEADER_SIZE ) );
+    SET_RECEIVER_OBJ( addPtr, PN_OBJ_ROUTER );
+    SET_SENDER_OBJ( addPtr, PN_OBJ_EVENT_MULTICAST );
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_UTID ] = 0x00;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_REQ;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED1 ] = KFiller;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_RESERVED2 ] = KFiller;
+    PUTB32( &addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_COMMGR );
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] = PN_DEV_OWN;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_OBJ ] = PN_OBJ_EVENT_MULTICAST;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = PN_NAME_UNDEF;
+    addPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller;
+    //PN_APE_COMMGR name
+    TDes8& addMsg2 = MemApi::AllocBlock( msgLength );
+    addMsg2.SetLength( msgLength );
+    addMsg2.Copy( addMsg );
+    TUint8* addPtr2 = const_cast<TUint8*>( addMsg2.Ptr() );
+    PUTB32( &addPtr2[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_APE_COMMGR );
+    iRouter->Send( addMsg, PN_OBJ_EVENT_MULTICAST );
+    iRouter->Send( addMsg2, PN_OBJ_EVENT_MULTICAST );
+    C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs<" ) ) );    
+    }
+
+
+DISICommunicationManager::~DISICommunicationManager(
+        // None
+        )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager>" ) ) );
+    if( iISIIndicationHandler )
+        {
+        delete iISIIndicationHandler;
+        iISIIndicationHandler = NULL;
+        }
+    iInitDfc->Cancel();
+    delete iInitDfc;
+    iInitDfc = NULL;
+    iCommunicationManagerMutex = NULL;
+    C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager<" ) ) );
+    }
+
+
+void DISICommunicationManager::Receive( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x>" ), &aMessage ) );
+    TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) );
+    ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexWaitFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+    //TODO check nameadd resps for own nameadd success
+    for( TInt i( 0 ); i < aMessage.Length(); i++ )
+        {
+        C_TRACE( ( _T( "index[ %d ] data 0x%x"), i, aMessage.Ptr()[i] ) );
+        }
+    
+    const TUint8* msgPtr( aMessage.Ptr() );
+    TDes8* blockPtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
+    
+    switch( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] )
+        {
+        case PN_COMMGR:
+            {
+            C_TRACE( ( _T( "DISICommunicationManager message to PN_COMMGR" ) ) );
+            break;
+            }
+        case PN_APE_COMMGR: //PN_APE_COMMGR
+            {
+            if( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == APE_COMMGR_SUBSCRIBE_REQ )
+                {
+                SendPNSSubscribeResp( *blockPtr );
+                if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
+                    {
+           	        C_TRACE( ( _T( "DISICommunicationManager PNS_SUBSCRIBE_REQ from APE" ) ) );
+                    iISIIndicationHandler->Subscribe( *blockPtr );
+                    }
+                }
+            else
+                {
+          	    C_TRACE( ( _T( "DISICommunicationManager unknown PN_APE_COMMGR message" ) ) );
+                }
+            break;
+            }
+       default:
+           {
+           C_TRACE( ( _T( "DISICommunicationManager unknown message to communication manager" ) ) );
+           break;	
+           }
+        }
+    MemApi::DeallocBlock( *blockPtr );
+    Kern::MutexSignal( *iCommunicationManagerMutex );
+    C_TRACE( ( _T( "DISICommunicationManager::Receive<" ) ) );
+    }
+
+void DISICommunicationManager::SendPNSSubscribeResp( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::SendPNSSubscribeResp 0x%x>" ), &aMessage ) );
+    TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP );
+    TDes8& respMsg = MemApi::AllocBlock( msgLength );
+    respMsg.SetLength( msgLength );
+    TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
+    TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() );
+    respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ];
+    SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+    SET_SENDER_DEV( respPtr, PN_DEV_OWN );
+    respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
+    SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) );
+    SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+    SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER );
+    respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ];
+    respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP;
+    if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
+        {
+        respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_OK;
+        }
+    else
+        {
+        respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_NOT_ALLOWED;	
+        }
+      
+    
+    for( TInt i( 0 ); i < respMsg.Length(); i++ )
+        {
+        C_TRACE( ( _T( "indeksi[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
+        }
+    
+    iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST );
+	  C_TRACE( ( _T( "DISICommunicationManager::SendPNSSubscribeResp<" ) ) );
+    }
+
+
+DECLARE_STANDARD_EXTENSION()
+    {
+    Kern::Printf( "ISI Communication Manager extension>" );
+    // Create a container extension
+    DISICommunicationManager* extension = new DISICommunicationManager();
+    TRACE_ASSERT( extension );
+    Kern::Printf( "ISI Communication Manager extension<" );
+    return extension ? KErrNone : KErrNoMemory;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,672 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <iscnokiadefinitions.h>
+#include <pn_eventmodem_extisi.h>         // PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_...
+#include <phonetisi.h>                    // For ISI_HEADER_SIZE
+#include <pn_const.h>                     // For PN_HEADER_SIZE
+#include "isiindicationhandler.h"         // For DISIIndicationHandler
+#include "isicommunicationmanagertrace.h" // For C_TRACE..
+#include "misiobjectrouterif.h"           // For DISICommunicationManager
+#include "memapi.h"                       // For MemApi
+#include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
+#include "nsisi.h"                        // For PN_MEDIA_ROUTING_REQ
+#include "ape_commgrisi.h"                // For APE_COMMGR..
+
+
+/* PUTB8 macro writes byte value to given address.
+ * This macro is used mainly by other PUTBXX macros.
+ */
+#define PUTB8(p,v) \
+    {(*(TUint8 *)(p)) = ((TUint8)(v));}
+
+
+/* PUTB16 macro writes 16-bit value in Big Endian format
+ * to given address. 16-bit value is written as two separate
+ * bytes, and so this macro can write 16-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB16(p,v) \
+    {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);}
+
+
+/* PUTB32 macro writes 32-bit value in Big Endian format
+ * to given address. 32-bit value is written as four separate
+ * bytes, and so this macro can write 32-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB32(p,v) \
+    {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));}
+
+/**
+ *    Big Endian to local endian type
+ */
+ /* GETB8 macro returns byte value from given address.
+ * This macro is used mainly by other GETBXX macros.
+ */
+#define GETB8(p) \
+    (*(TUint8 *)(p))
+
+
+/* GETB16 macro reads 16-bit value in Big Endian format
+ * from given address. 16-bit value is read as two separate
+ * bytes, and so this macro can read 16-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB16(p) \
+    (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
+
+#define GETB32(p) \
+    (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
+
+// Faults
+enum TISIIndincationHandlerFaults
+    {
+    EISIIndicationHandlerWrongParameter = 0x01,
+    EISIIndicationHandlerMemAllocFailure,
+    EISIIndicationHandlerMemAllocFailure1,
+    EISIIndicationHandlerMemAllocFailure2,
+    EISIIndicationHandlerMemAllocFailure3,
+    };
+
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::DISIIndicationHandler(
+        MISIObjectRouterIf* aRouter
+        ) : iRouter( aRouter )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::DISIIndicationHandler 0x%x>" ), &iRouter ) );
+    C_TRACE( ( _T( "DISIIndicationHandler::DISIIndicationHandler 0x%x<" ), &iRouter ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::~DISIIndicationHandler
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::~DISIIndicationHandler(
+        // None
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::~DISIIndicationHandler>" ) ) );
+    
+    SDblQueLink*    deviceAnchor = &iDeviceQ.iA;
+    SDblQueLink*    next = deviceAnchor->iNext;
+    TDeviceIdLink*  deviceLink = NULL;
+    
+    SDblQueLink*        serverAnchor = NULL;
+    SDblQueLink*        serverNext = NULL;
+    TServerIdLink*      serverLink = NULL;
+
+    SDblQueLink*        indicationAnchor = NULL;
+    SDblQueLink*        indicationNext = NULL;
+    TIndicationLink*    indicationLink = NULL;
+
+    SDblQueLink*        subscriberAnchor = NULL;
+    SDblQueLink*        subscriberNext = NULL;
+    TSubscriberLink*    subscriberLink = NULL;
+    
+    while( deviceAnchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler device: 0x%x"), deviceLink->iDeviceId ) );
+        serverAnchor = &deviceLink->iServerQ.iA;
+        serverNext = serverAnchor->iNext;
+        while( serverAnchor != serverNext )
+            {
+            serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            indicationAnchor = &serverLink->iIndicationQ.iA;
+            indicationNext = indicationAnchor->iNext;
+            while( indicationAnchor != indicationNext )
+                {
+                indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler indication: 0x%x"), indicationLink->iIndication ));
+                // get next link already in case if particular link is to be deleted
+                indicationNext = indicationNext->iNext;
+                subscriberAnchor = &indicationLink->iSubscriberQ.iA;
+                subscriberNext = subscriberAnchor->iNext;
+                while( subscriberAnchor != subscriberNext )
+                    {
+                    subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                    C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler subscriber: 0x%x"), subscriberLink->iObjId ));
+                    TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
+                    subscriberLink->iSubscriberLink.Deque();
+                    delete subscriberLink;
+                    subscriberLink = NULL;
+                    if( onlySubscriber )
+                        {
+                        C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler remove indication: 0x%x"), indicationLink->iIndication ));
+                        indicationLink->iIndicationLink.Deque();
+                        delete indicationLink;
+                        indicationLink = NULL;
+                        }
+                    // No need to go through rest of subscriberlinks since this one already found and deleted
+                    subscriberNext = subscriberAnchor;      
+                    }
+                }
+            indicationAnchor = &serverLink->iIndicationQ.iA;
+            indicationNext = indicationAnchor->iNext;
+            serverNext = serverNext->iNext;
+            if( indicationAnchor == indicationNext )
+                {
+                // No more indications on the server -> server link can be deleted
+                C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler remove server: 0x%x"), serverLink->iResourceId ));
+                serverLink->iServerLink.Deque();
+                delete serverLink;
+                serverLink = NULL;
+                }
+            }
+        serverAnchor = &deviceLink->iServerQ.iA;
+        serverNext = serverAnchor->iNext;
+        next = next->iNext;
+        if( serverAnchor == serverNext )
+            {
+            // No more servers on the device -> device link can be deleted
+            C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove device: 0x%x"), deviceLink->iDeviceId ));
+            deviceLink->iDeviceLink.Deque();
+            delete deviceLink;
+            deviceLink = NULL;
+            }
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::~DISIIndicationHandler<" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::Subscribe
+//
+// -----------------------------------------------------------------------------
+//
+TInt DISIIndicationHandler::Subscribe(
+        TDes8& aSubscriptionReq
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::Subscribe 0x%x>" ), &aSubscriptionReq ) );
+    
+    TUint8* msgPtr( const_cast<TUint8*>( aSubscriptionReq.Ptr() ) );
+    
+    TInt msgLength( aSubscriptionReq.Length() ); 
+    TUint32 resourceId( 0 );
+    TUint8 deviceId( 0 );
+    TUint8 indication( 0 );
+    TUint16 objId( 0 );
+      
+    objId = msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ];
+    RemoveSubscription( objId );
+    for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ ); subBlockOffset < msgLength; subBlockOffset += ( SIZE_APE_COMMGR_SUBSCRIBE_SB ) )
+        {
+        deviceId = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ];
+        resourceId = GETB32( &msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] ); //resource offset
+        indication = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ];
+        C_TRACE( ( _T("DISIIndicationHandler indication 0x%x objId 0x%x resource 0x%x device 0x%x"), indication, objId, resourceId, deviceId ) );
+        TDeviceIdLink* deviceLink = GetDeviceLink( deviceId );
+        if( !deviceLink )
+            {
+            C_TRACE( ( _T("DISIIndicationHandler::Subscribe device not found yet -> create: 0x%x"), deviceId ) );
+            deviceLink = new TDeviceIdLink();
+            ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+            deviceLink->iDeviceId = deviceId;
+            iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
+            }
+        AddServer( *deviceLink, resourceId, indication, objId );
+        }
+        
+#ifdef _DEBUG
+#ifdef COMPONENT_TRACE_FLAG
+    PrintSubscriptions();
+#endif // COMPONENT_TRACE_FLAG
+#endif // _DEBUG
+    
+    TDeviceIdLink* deviceLink = NULL;
+    SDblQueLink* anchor = &iDeviceQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        C_TRACE( ( _T("DISIIndicationHandler::Subscribe device: 0x%x"), deviceLink->iDeviceId ) );
+        if( deviceLink->iDeviceId != PN_DEV_OWN )
+            {
+            C_TRACE( ( _T("DISIIndicationHandler::Subscribe send subscription to device: 0x%x"), deviceLink->iDeviceId ) );
+            SendSubscription( *deviceLink );
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::Subscribe<" ) ) );
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::AddServer
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::AddServer(
+        TDeviceIdLink& aDeviceLink,
+        const TUint32 aResourceId,
+        const TUint8 aIndication,
+        const TUint16 aObjId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x 0x%x 0x%x>" ), &aDeviceLink, aResourceId, aIndication, aObjId ) );
+    
+    TServerIdLink* serverLink = GetServerLink( aDeviceLink, aResourceId );
+    if( !serverLink )
+        {
+        C_TRACE( ( _T("DISIIndicationHandler::AddServer resource: 0x%x not found, create"), aResourceId ));
+        serverLink = new TServerIdLink();
+        ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerMemAllocFailure1 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        serverLink->iResourceId = aResourceId;
+        aDeviceLink.iServerQ.Add( &( serverLink->iServerLink ) );
+        }
+    AddIndication( *serverLink, aIndication, aObjId );
+    C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x 0x%x 0x%x<" ), &aDeviceLink, aResourceId, aIndication, aObjId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::AddIndication
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::AddIndication(
+        TServerIdLink& aServerLink,
+        const TUint8 aIndication,
+        const TUint16 aObjId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::AddIndication 0x%x 0x%x 0x%x>" ), &aServerLink, aIndication, aObjId ) );
+    TIndicationLink* indicationLink = GetIndicationLink( aServerLink, aIndication );
+    if( !indicationLink )
+        {
+        C_TRACE( ( _T("DISIIndicationHandler::AddIndication Indication: 0x%x not found, create"), aIndication ));
+        indicationLink = new TIndicationLink();
+        ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerMemAllocFailure3 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        indicationLink->iIndication = aIndication;
+        aServerLink.iIndicationQ.Add( &( indicationLink->iIndicationLink ) );
+        }
+    AddSubscriber( *indicationLink, aObjId );
+    C_TRACE( ( _T( "DISIIndicationHandler::AddIndication 0x%x 0x%x 0x%x<" ), &aServerLink, aIndication, aObjId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::AddSubscriber
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::AddSubscriber(
+        TIndicationLink& aIndicationLink,
+        const TUint16 aObjId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::AddSubscriber 0x%x, 0x%x>" ), &aIndicationLink, aObjId ) );
+    TSubscriberLink* subscriberLink = GetSubscriberLink( aIndicationLink, aObjId );
+    if( !subscriberLink )
+        {
+        C_TRACE( ( _T("DISIIndicationHandler::AddSubscriber Subscriber not found: 0x%x 0x%x"), aIndicationLink.iIndication, aObjId ) );
+        subscriberLink = new TSubscriberLink();
+        ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerMemAllocFailure2 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        subscriberLink->iObjId = aObjId;
+        aIndicationLink.iSubscriberQ.Add( &( subscriberLink->iSubscriberLink ) );
+        }
+    else
+        {
+        TRACE_ASSERT_INFO(0, (TUint8)aObjId<<KObjIdShift);
+        C_TRACE( ( _T( "DISIIndicationHandler::AddSubscriber double subscription 0x%x" ), aObjId ) );
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::AddSubscriber 0x%x 0x%x<" ), &aIndicationLink, aObjId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::GetDeviceLink
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::TDeviceIdLink* DISIIndicationHandler::GetDeviceLink(
+        const TUint8 aDeviceId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink 0x%x ->" ), aDeviceId ) );
+    TDeviceIdLink* deviceLink = NULL;
+    TDeviceIdLink* tmpDeviceLink = NULL;
+    SDblQueLink* anchor = &iDeviceQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
+        if( tmpDeviceLink->iDeviceId == aDeviceId )
+            {
+            deviceLink = tmpDeviceLink;
+            break;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink 0x%x <-" ), deviceLink ) );
+    return deviceLink;
+    }
+
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::GetServerLink
+//
+// -----------------------------------------------------------------------------
+//
+
+DISIIndicationHandler::TServerIdLink* DISIIndicationHandler::GetServerLink(
+        TDeviceIdLink& aDeviceLink,
+        const TUint32 aResourceId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink 0x%x 0x%x ->" ), &aDeviceLink, aResourceId ) );
+    TServerIdLink* serverLink = NULL;
+    TServerIdLink* tmpServerLink = NULL;
+    SDblQueLink* anchor = &aDeviceLink.iServerQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next ) // servers
+        {
+        tmpServerLink = _LOFF( next, TServerIdLink, iServerLink );
+        C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink server: 0x%x"), tmpServerLink->iResourceId ) );
+        if( tmpServerLink->iResourceId == aResourceId )
+            {
+            serverLink = tmpServerLink;
+            break;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink 0x%x <-" ), serverLink ) );
+    return serverLink;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::GetIndicationLink
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::TIndicationLink* DISIIndicationHandler::GetIndicationLink(
+        TServerIdLink& aServerLink,
+        const TUint8 aIndication
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::GetIndicationLink 0x%x 0x%x ->" ), &aServerLink, aIndication ) );
+    TIndicationLink* indicationLink = NULL;
+    TIndicationLink* tmpIndicationLink = NULL;
+    SDblQueLink* anchor = &aServerLink.iIndicationQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        tmpIndicationLink = _LOFF( next, TIndicationLink, iIndicationLink );
+        if( tmpIndicationLink->iIndication == aIndication )
+            {
+            indicationLink = tmpIndicationLink;
+            break;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::GetIndicationLink 0x%x <-" ), indicationLink ) );
+    return indicationLink;
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::GetSubscriberLink
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::TSubscriberLink* DISIIndicationHandler::GetSubscriberLink(
+        TIndicationLink& aIndicationLink,
+        const TUint16 aObjId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::GetSubscriberLink 0x%x, 0x%x ->" ), &aIndicationLink, aObjId ) );
+    TSubscriberLink* tmpSubscriberLink = NULL;
+    TSubscriberLink* subscriberLink = NULL;
+    SDblQueLink* anchor = &aIndicationLink.iSubscriberQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        tmpSubscriberLink= _LOFF( next, TSubscriberLink, iSubscriberLink );
+        if ( tmpSubscriberLink->iObjId == aObjId )
+            {
+            subscriberLink = tmpSubscriberLink;
+            break;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::GetSubscriberLink 0x%x <-" ), subscriberLink ) );
+    return subscriberLink;
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::PrintSubscriptions
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::PrintSubscriptions(
+        // None
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::PrintSubscriptions>" ) ) );
+    TDeviceIdLink* deviceLink = NULL;
+    SDblQueLink* anchor = &iDeviceQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    SDblQueLink* serverAnchor = NULL;
+    SDblQueLink* serverNext = NULL;
+    TServerIdLink* serverLink = NULL;
+    SDblQueLink* indicationAnchor = NULL;
+    SDblQueLink* indicationNext = NULL;
+    TIndicationLink* indicationLink = NULL;
+    SDblQueLink* subscriberAnchor = NULL;
+    SDblQueLink* subscriberNext = NULL;
+    TSubscriberLink* subscriberLink = NULL;
+    while( anchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions device: 0x%x"), deviceLink->iDeviceId ) );
+        serverAnchor = &deviceLink->iServerQ.iA;
+        serverNext = serverAnchor->iNext;
+        while( serverAnchor != serverNext )
+            {
+            serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions server: 0x%x"), serverLink->iResourceId ) );
+            indicationAnchor = &serverLink->iIndicationQ.iA;
+            indicationNext = indicationAnchor->iNext;
+            while( indicationAnchor != indicationNext )
+                {
+                indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions indication: 0x%x"), indicationLink->iIndication ) );
+                subscriberAnchor = &indicationLink->iSubscriberQ.iA;
+                subscriberNext = subscriberAnchor->iNext;
+                while( subscriberAnchor != subscriberNext)
+                    {
+                    subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                    subscriberLink = subscriberLink;
+                    C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions objid: 0x%x"), subscriberLink->iObjId ) );
+                    subscriberNext = subscriberNext->iNext;
+                    }
+                indicationNext = indicationNext->iNext;
+                }
+            serverNext = serverNext->iNext;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::PrintSubscriptions<" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::RemoveSubscription
+// Removes all subscriptions from objectid
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::RemoveSubscription(
+        const TUint16 aObjId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::RemoveSubscription 0x%x>" ), aObjId ) );
+
+    SDblQueLink*    deviceAnchor = &iDeviceQ.iA;
+    SDblQueLink*    next = deviceAnchor->iNext;
+    TDeviceIdLink*  deviceLink = NULL;
+
+    SDblQueLink*        serverAnchor = NULL;
+    SDblQueLink*        serverNext = NULL;
+    TServerIdLink*      serverLink = NULL;
+
+    SDblQueLink*        indicationAnchor = NULL;
+    SDblQueLink*        indicationNext = NULL;
+    TIndicationLink*    indicationLink = NULL;
+
+    SDblQueLink*        subscriberAnchor = NULL;
+    SDblQueLink*        subscriberNext = NULL;
+    TSubscriberLink*    subscriberLink = NULL;
+
+    while( deviceAnchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription device: 0x%x"), deviceLink->iDeviceId ) );
+        serverAnchor = &deviceLink->iServerQ.iA;
+        serverNext = serverAnchor->iNext;
+        while( serverAnchor != serverNext )
+            {
+            serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            indicationAnchor = &serverLink->iIndicationQ.iA;
+            indicationNext = indicationAnchor->iNext;
+            while( indicationAnchor != indicationNext )
+                {
+                indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription indication: 0x%x"), indicationLink->iIndication ));
+                // get next link already in case if particular link is to be deleted
+                indicationNext = indicationNext->iNext;
+                subscriberAnchor = &indicationLink->iSubscriberQ.iA;
+                subscriberNext = subscriberAnchor->iNext;
+                while( subscriberAnchor != subscriberNext )
+                    {
+                    subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                    C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription objid: 0x%x"), subscriberLink->iObjId ));
+                    if( subscriberLink->iObjId == aObjId )
+                        {
+                        C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove objid: 0x%x"), subscriberLink->iObjId ));
+                        TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
+                        subscriberLink->iSubscriberLink.Deque();
+                        delete subscriberLink;
+                        subscriberLink = NULL;
+                        if( onlySubscriber )
+                            {
+                            C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove indication: 0x%x"), indicationLink->iIndication ));
+                            indicationLink->iIndicationLink.Deque();
+                            delete indicationLink;
+                            indicationLink = NULL;
+                            }
+                        // No need to go through rest of subscriberlinks since this one already found and deleted
+                        subscriberNext = subscriberAnchor;
+                        }
+                    else
+                        {
+                        subscriberNext = subscriberNext->iNext;
+                        }
+                    }
+                }
+            indicationAnchor = &serverLink->iIndicationQ.iA;
+            indicationNext = indicationAnchor->iNext;
+            serverNext = serverNext->iNext;
+            if( indicationAnchor == indicationNext )
+                {
+                // No more indications for the server -> server link can be deleted
+                C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove server: 0x%x"), serverLink->iResourceId ));
+                serverLink->iServerLink.Deque();
+                delete serverLink;
+                serverLink = NULL;
+                }
+            }
+        serverAnchor = &deviceLink->iServerQ.iA;
+        serverNext = serverAnchor->iNext;
+        next = next->iNext;
+        if( serverAnchor == serverNext )
+            {
+            // No more servers for the device -> device link can be deleted
+            C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove device: 0x%x"), deviceLink->iDeviceId ));
+            deviceLink->iDeviceLink.Deque();
+            delete deviceLink;
+            deviceLink = NULL;
+            }
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::RemoveSubscription 0x%x<" ), aObjId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::SendSubscription
+//
+// -----------------------------------------------------------------------------
+//
+TInt DISIIndicationHandler::SendSubscription( TDeviceIdLink& aDevice )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription>" ) ) );
+    const TUint8 KMaxAmountOfResources( 255 );
+    const TUint8 KPnsSubscribedResourcesExtendLength( 12 );
+    const TUint8 KResourceArraySize( 4 );
+    
+    TDes8& desPtr = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_PNS_SUBSCRIBED_RESOURCES_EXTEND_IND + ( KMaxAmountOfResources * KResourceArraySize ) );
+
+    TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
+    ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+    SET_RECEIVER_DEV( ptr, aDevice.iDeviceId );
+    SET_SENDER_DEV( ptr, PN_DEV_OWN );
+    ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_COMMGR;
+    SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
+    SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
+    ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_TRANSACTIONID ] = 0x00;
+    ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_MESSAGEID ] = PNS_SUBSCRIBED_RESOURCES_EXTEND_IND;
+    ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_FILLER ] = 0x00;
+    
+    TServerIdLink* serverLink = NULL;
+    SDblQueLink* anchor = &(aDevice.iServerQ.iA);
+    SDblQueLink* next = anchor->iNext;
+
+    TUint8 resourceCount( 0x00 );
+    while( anchor != next )
+        {
+        serverLink = _LOFF( next, TServerIdLink, iServerLink );
+        TUint32 resourceId = serverLink->iResourceId;
+        C_TRACE( ( _T("DISIIndicationHandler::SendSubscription Server: 0x%08x"), resourceId ) );
+        PUTB32( &ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST ], resourceId );
+        resourceCount++;
+        next = next->iNext;
+        }
+    ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCECOUNT ] = resourceCount;
+    TInt messageLength( ( resourceCount * KResourceArraySize ) + KPnsSubscribedResourcesExtendLength );
+    while( messageLength % 4 != 0 )
+        {
+        TRACE_ASSERT_INFO(0, messageLength);
+        messageLength++;
+        }
+    desPtr.SetLength( messageLength );
+    SET_LENGTH( ptr, messageLength - PN_HEADER_SIZE );
+      
+    for( TInt i( 0 ); i < desPtr.Length(); i++ )
+        {
+        C_TRACE( ( _T( "index[ %d ] data 0x%x"), i, desPtr.Ptr()[i] ) );
+        }
+    TInt error = iRouter->Send( desPtr, PN_OBJ_EVENT_MULTICAST );
+    C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription<" ) ) );  
+    return error;
+    }
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/eabi/isinameserviceu.def	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN15DISINameService15IsValidResourceERK6TDesC8 @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/group/isinameservice.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies 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        <non_foundation_paths.hrh>
+#include        <platform_paths.hrh>
+#include        "kernel/kern_ext.mmh"
+
+
+TARGET          isinameservice.dll
+TARGETTYPE      kext
+linkas          isinameservice.dll
+UID             0x100000AF 0x2002A5A1
+VENDORID        VID_DEFAULT
+CAPABILITY      ALL
+FEATUREVARIANT
+
+SMPSAFE
+
+EPOCALLOWDLLDATA
+
+SOURCEPATH      ../src
+SOURCE          isinameservice.cpp
+SOURCE          namerecords.cpp
+
+
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../isaaccessextension_dll/inc
+USERINCLUDE     ../../memmanager_dll/inc
+
+
+NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     /epoc32/include/kernel
+SYSTEMINCLUDE     /epoc32/include/nkern
+
+
+DEFFILE         isinameservice.def
+
+LIBRARY         memmanager.lib
+LIBRARY         isaaccessextension.lib
+
+START WINS
+win32_library kernel32.lib
+END
+
+
+// flag to enable normal trace inside component
+MACRO   COMPONENT_TRACE_FLAG
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h	Thu Jan 14 10:44:58 2010 +0200
@@ -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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __ISINAMESERVICE_H__
+#define __ISINAMESERVICE_H__
+
+#include "misirouterobjectif.h"
+#include "misicommunicationmanagerif.h"
+
+class MISIObjectRouterIf;
+class DNameRecords;
+
+/*
+* ISI router.
+*/
+NONSHARABLE_CLASS( DISINameService ) : public DBase, public MISIRouterObjectIf, MISICommunicationManagerIf
+    {
+
+    public:
+
+        /*
+        * Default contructor
+        */
+        DISINameService();
+
+        /*
+        * Destructor
+        */
+        ~DISINameService();
+
+        /*
+        * See comments from MISIRouterObjectIf
+        */
+        void Receive( const TDesC8& aMessage );
+
+        void HandlePNSNameMessage( const TDesC8& aMessage );
+        void HandleNameQueryResp( const TDesC8& aMessage, const TUint8* msgPtr );
+        void HandleNameRemoveResp( const TDesC8& aMessage, const TUint8* msgPtr );
+
+        /*
+        * See comments from MISICommunicationManagerIf
+        */
+        static TBool IsValidResource( const TDesC8& aMessage );
+
+        /*
+        * Construct COMM_ISA_ENTITY_NOT_REACHABLE_RESP message and
+        * send message to router.
+        */
+        void BuildAndSendCommIsaEntityNotReachableResp( const TDesC8& aMsg );
+
+    private:
+
+        MISIObjectRouterIf* iRouter;
+        TUint8              iObjId;
+        DNameRecords*       iNameRecords;
+        static DMutex*      iNameServiceMutex;
+
+    };
+
+#endif /* __ISINAMESERVICE_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/inc/isinameservicetrace.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __ISINAMESERVICETRACE_H__
+#define __ISINAMESERVICETRACE_H__
+
+// INCLUDES
+#include <kernel.h>
+
+// CONSTANTS
+enum TISIFaultClassCategories
+    {
+    EDISINameServiceTraceId=1,
+    EDISINameRecordsTraceId,
+    };
+
+const TUint8 KClassIdentifierShift( 8 );
+const TUint8 KObjIdShift( 16 );
+const TUint8 KMediaIdShift( 16 );
+const TUint8 KExtraInfoShift( 24 );
+
+// MACROS
+
+#define _T( a ) a
+#define __TRACE_PRINTF(a) Kern::Printf a
+
+#ifdef _DEBUG
+    #if defined COMPONENT_TRACE_FLAG
+        #define C_TRACE(a) __TRACE_PRINTF(a)
+    #else
+        #define C_TRACE(a) 
+    #endif // COMPONENT_TRACE_FLAG
+#else
+    #define C_TRACE(a)
+#endif // _DEBUG
+
+// Resets are made both in UDEB and UREL (traces only in udeb)
+#define ASSERT_RESET_ALWAYS(a,b) if(!(a)) { __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__)); Kern::Fault( "ISINameService:", b ); }
+#define TRACE_ASSERT(a) if (!(a)) __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled=" __DATE__" "__TIME__, __LINE__ ))
+
+#endif // __ISINAMESERVICETRACE_H__
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/inc/misicommunicationmanagerif.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies 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 __MISICOMMUNICATIONMANAGERIF_H__
+#define __MISICOMMUNICATIONMANAGERIF_H__
+
+
+/*
+* Abstract interface for communication manager to use nameservice.
+*/
+class MISICommunicationManagerIf
+    {
+
+    public:
+    
+        /*
+        * Checks if client is registered as a resource.
+        * @return name table status
+        */
+        IMPORT_C static TBool IsValidResource( const TDesC8& aMessage );
+
+    };
+
+#endif /* __MISICOMMUNICATIONMANAGERIF_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/inc/namerecords.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 __NAMERECORDS_H__
+#define __NAMERECORDS_H__
+
+#include <e32def.h>                 // For TUint16
+#include <e32cmn.h>                 // For TDesC8
+#include <klib.h>                   // For DBase
+
+NONSHARABLE_CLASS ( TNameTable )
+{
+public:
+	TNameTable( const TUint32 aName, const TUint16 aPhonetAddress, const TUint8 aFlags )
+		:iName(aName),
+		iPhonetAddress(aPhonetAddress),
+		iFlags(aFlags)
+	{}
+
+	TUint32 	iName;
+	TUint16 	iPhonetAddress;
+	TUint8  	iFlags;
+	};
+
+NONSHARABLE_CLASS (DNameRecords) : public DBase
+{
+public:
+	DNameRecords();
+	~DNameRecords();
+
+	RArray<TNameTable*> iNameTableArray;
+
+
+    TUint8 AddName( const TUint32 aName,
+                  	const TUint16 aPhonetAddress,
+                    const TUint8  aFlags );
+
+    TUint8 RemoveName( const TUint32 aName );
+
+    TInt32 LookupPhonetAddress( const TUint32 aName, TUint16* aPhonetAddress );
+
+    RArray <TNameTable*>* GetNameTable();
+
+    TInt32 NameQuery( const TUint32 aName, const TUint32 aMask, RArray <TNameTable*> *aResultsArray );
+};
+
+#endif /* __NAMERECORDS_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/inc/nsisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies 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 _SYMBIAN_ISI_NSISI_H_
+#define _SYMBIAN_ISI_NSISI_H_
+
+#define NAME_SERVICE_ISI_VERSION_Z	 1
+#define NAME_SERVICE_ISI_VERSION_Y	 2
+
+#define PN_NAMESERVICE                                      219 /* 0xDB  [PN] Name Service Messages */
+#define PN_MEDIA_ROUTING_REQ                                0x00
+//TABLES
+
+//BitmaskTables for PN_NAME_RECORD_ATTR
+#define PN_NAME_UNDEF                                     	0x01                                                 	
+#define PN_NAME_NOCHG                                     	0x02                                                 	
+
+//ConstantTable for NAME_SERVICE_CC
+#define PN_NAME_OK                                        	0x00                                                 	
+#define PN_NAME_NOT_ALLOWED                               	0x01                                                 	
+#define PN_NAME_UNKNOWN                                   	0x03                                                 	
+
+
+//STRUCTURES
+
+
+//Definition for PN_NAME_SRV_ITEM_STR
+#define PN_NAME_SRV_ITEM_STR_OFFSET_NAME                  	0 //size 4 byte(s)
+#define PN_NAME_SRV_ITEM_STR_OFFSET_DEV                   	4 //size 1 byte(s)
+#define PN_NAME_SRV_ITEM_STR_OFFSET_OBJ                   	5 //size 1 byte(s)
+#define PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS                 	6 //size 1 byte(s)
+#define PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED              	7 //size 1 byte(s)
+#define SIZE_PN_NAME_SRV_ITEM_STR                         	8
+
+
+//MESSAGES
+
+
+//Definition for PNS_NAME_QUERY_REQ
+#define PNS_NAME_QUERY_REQ                                	0x01                                                 	
+#define PNS_NAME_QUERY_REQ_OFFSET_UTID                    	0 //size 1 byte(s)
+#define PNS_NAME_QUERY_REQ_OFFSET_SUBFUNCTION             	1 //size 1 byte(s)
+#define PNS_NAME_QUERY_REQ_OFFSET_RESERVED1               	2 //size 1 byte(s)
+#define PNS_NAME_QUERY_REQ_OFFSET_RESERVED2               	3 //size 1 byte(s)
+#define PNS_NAME_QUERY_REQ_OFFSET_NAME                    	4 //size 4 byte(s)
+#define PNS_NAME_QUERY_REQ_OFFSET_BITMASK                 	8 //size 4 byte(s)
+#define SIZE_PNS_NAME_QUERY_REQ                           	12
+
+
+//Definition for PNS_NAME_QUERY_RESP
+#define PNS_NAME_QUERY_RESP                               	0x02                                                 	
+#define PNS_NAME_QUERY_RESP_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES           	2 //size 2 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG           	4 //size 2 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_RESERVED1              	6 //size 1 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_RESERVED2              	7 //size 1 byte(s)
+#define PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL           	8 //size 8 byte(s)
+#define SIZE_PNS_NAME_QUERY_RESP                          	16
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_NAME_ADD_IND
+#define PNS_NAME_ADD_IND                                  	0x03                                                 	
+#define PNS_NAME_ADD_IND_OFFSET_UTID                      	0 //size 1 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION               	1 //size 1 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES              	2 //size 2 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG              	4 //size 2 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_RESERVED1                 	6 //size 1 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_RESERVED2                 	7 //size 1 byte(s)
+#define PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL              	8 //size 8 byte(s)
+#define SIZE_PNS_NAME_ADD_IND                             	16
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_NAME_REMOVE_IND
+#define PNS_NAME_REMOVE_IND                               	0x04                                                 	
+#define PNS_NAME_REMOVE_IND_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES           	2 //size 2 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG           	4 //size 2 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_RESERVED1              	6 //size 1 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_RESERVED2              	7 //size 1 byte(s)
+#define PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL           	8 //size 8 byte(s)
+#define SIZE_PNS_NAME_REMOVE_IND                          	16
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_NAME_ADD_REQ
+#define PNS_NAME_ADD_REQ                                  	0x05                                                 	
+#define PNS_NAME_ADD_REQ_OFFSET_UTID                      	0 //size 1 byte(s)
+#define PNS_NAME_ADD_REQ_OFFSET_SUBFUNCTION               	1 //size 1 byte(s)
+#define PNS_NAME_ADD_REQ_OFFSET_RESERVED1                 	2 //size 1 byte(s)
+#define PNS_NAME_ADD_REQ_OFFSET_RESERVED2                 	3 //size 1 byte(s)
+#define PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY                 	4 //size 8 byte(s)
+#define SIZE_PNS_NAME_ADD_REQ                             	12
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+//Definition for PNS_NAME_ADD_RESP
+#define PNS_NAME_ADD_RESP                                 	0x06                                                 	
+#define PNS_NAME_ADD_RESP_OFFSET_UTID                     	0 //size 1 byte(s)
+#define PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION              	1 //size 1 byte(s)
+#define PNS_NAME_ADD_RESP_OFFSET_REASON                   	2 //size 1 byte(s)
+#define PNS_NAME_ADD_RESP_OFFSET_RESERVED                 	3 //size 1 byte(s)
+#define SIZE_PNS_NAME_ADD_RESP                            	4
+
+
+//Definition for PNS_NAME_REMOVE_REQ
+#define PNS_NAME_REMOVE_REQ                               	0x07                                                 	
+#define PNS_NAME_REMOVE_REQ_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_NAME_REMOVE_REQ_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_NAME_REMOVE_REQ_OFFSET_RESERVED1              	2 //size 1 byte(s)
+#define PNS_NAME_REMOVE_REQ_OFFSET_RESERVED2              	3 //size 1 byte(s)
+#define PNS_NAME_REMOVE_REQ_OFFSET_NAME                   	4 //size 4 byte(s)
+#define SIZE_PNS_NAME_REMOVE_REQ                          	8
+
+
+//Definition for PNS_NAME_REMOVE_RESP
+#define PNS_NAME_REMOVE_RESP                              	0x08                                                 	
+#define PNS_NAME_REMOVE_RESP_OFFSET_UTID                  	0 //size 1 byte(s)
+#define PNS_NAME_REMOVE_RESP_OFFSET_SUBFUNCTION           	1 //size 1 byte(s)
+#define PNS_NAME_REMOVE_RESP_OFFSET_REASON                	2 //size 1 byte(s)
+#define PNS_NAME_REMOVE_RESP_OFFSET_RESERVED1             	3 //size 1 byte(s)
+#define SIZE_PNS_NAME_REMOVE_RESP                         	4
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,501 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 <kernel.h>               // For Kern
+#include "isinameservice.h"       // For DISINameService
+#include "misiobjectrouterif.h"   // For MISIObjectRouterIf
+#include "isinameservicetrace.h"  // For C_TRACE, ASSERT_RESET.. and fault codes
+#include "memapi.h"               // For MemApi
+#include <phonetisi.h>            // For ISI_HEADER_SIZE
+#include <pn_const.h>             // For PN_NAMESERVICE
+#include <nsisi.h>                // For PN
+#include "misiobjectrouterif.h"   // For MISIObjectRouterIf
+#include "iadhelpers.h"           // For SET_RECEIVER_OBJ...
+#include "namerecords.h"          // For DNameRecords
+#include <iscnokiadefinitions.h>  // For THIS_DEVICE
+#include <commisi.h>              // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
+// Faults
+enum TISINameServiceFaults
+    {
+    EISINameServiceMemAllocFailure = 0x01,
+    EISINameServiceNullPointer,
+    EISINameServiceUnknownMessage,
+    EISINameServiceMutexCreateFailed,
+    EISINameServiceMutexWaitFailed,
+    };
+
+
+/* PUTB8 macro writes byte value to given address.
+ * This macro is used mainly by other PUTBXX macros.
+ */
+#define PUTB8(p,v) \
+    {(*(TUint8 *)(p)) = ((TUint8)(v));}
+
+
+/* PUTB16 macro writes 16-bit value in Big Endian format
+ * to given address. 16-bit value is written as two separate
+ * bytes, and so this macro can write 16-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB16(p,v) \
+    {PUTB8((p),(TUint16)(v)>>8); PUTB8((TUint8*)(p)+1,v);}
+
+
+/* PUTB32 macro writes 32-bit value in Big Endian format
+ * to given address. 32-bit value is written as four separate
+ * bytes, and so this macro can write 32-bit value to whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define PUTB32(p,v) \
+    {PUTB16((p),(TUint32)(v)>>16); PUTB16((TUint8*)(p)+2,(TUint32)(v));}
+
+
+/**
+ *    Big Endian to local endian type
+ */
+ /* GETB8 macro returns byte value from given address.
+ * This macro is used mainly by other GETBXX macros.
+ */
+#define GETB8(p) \
+    (*(TUint8 *)(p))
+
+
+/* GETB16 macro reads 16-bit value in Big Endian format
+ * from given address. 16-bit value is read as two separate
+ * bytes, and so this macro can read 16-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB16(p) \
+    (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
+
+
+/* GETB32 macro reads 32-bit value in Big Endian format
+ * from given address. 32-bit value is read as four separate
+ * bytes, and so this macro can read 32-bit value from whatever
+ * address, regardless of the processor alignment restrictions
+ */
+#define GETB32(p) \
+    (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
+
+
+const TUint32 KNameServiceUID( 0x2002A5A1 );
+const TUint8 KFiller( 0 );
+
+DMutex* DISINameService::iNameServiceMutex = NULL;
+_LIT8( KNameServiceMutex, "KNameServiceMutex" );
+
+
+DISINameService::DISINameService(
+        // None
+        )
+    : iObjId( 0x00 )
+    {
+    C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x>" ), iObjId, iRouter ) );
+    iRouter = MISIObjectRouterIf::Connect( KNameServiceUID, iObjId, this );
+    ASSERT_RESET_ALWAYS( iRouter, ( EISINameServiceNullPointer | EDISINameServiceTraceId << KClassIdentifierShift ) );
+    iNameRecords = new DNameRecords();
+    ASSERT_RESET_ALWAYS( iNameRecords, ( EISINameServiceMemAllocFailure | EDISINameServiceTraceId << KClassIdentifierShift ) );
+    TInt err( Kern::MutexCreate( iNameServiceMutex, KNameServiceMutex, KMutexOrdGeneral0 ) );
+    ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexCreateFailed | EDISINameServiceTraceId << KClassIdentifierShift ) );
+    C_TRACE( ( _T( "DISINameService::DISINameService 0x%x 0x%x<" ), iObjId, iRouter ) );
+    }
+
+DISINameService::~DISINameService(
+        // None
+        )
+    {
+    C_TRACE( ( _T( "DISINameService::~DISINameService>" ) ) );
+    if( iNameRecords )
+        {
+        delete iNameRecords;
+        iNameRecords = NULL;
+        }
+
+    C_TRACE( ( _T( "DISINameService::~DISINameService<" ) ) );
+    }
+
+
+void DISINameService::Receive( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISINameService::Receive 0x%x>" ), &aMessage ) );
+    TInt err( Kern::MutexWait( *iNameServiceMutex ) );
+    ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) );
+    TUint8* msgPtr( (TUint8*)aMessage.Ptr() );
+
+    TUint8 resource = msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ];
+    if(  resource == PN_NAMESERVICE )
+        {
+        C_TRACE( ( _T( "DISINameService message to PN_NAMESERVICE" ) ) );
+        HandlePNSNameMessage( aMessage );
+        }
+    else
+        {
+        //RouterByResource( aMessage );
+
+        C_TRACE( ( _T( "DISINameService message to RESOURCE : %d" ),resource  ) );
+        //look for nametable by resource in message
+        TUint16 phonetAddress = 0;
+        TInt32 error = iNameRecords->LookupPhonetAddress(resource, &phonetAddress);
+
+        if( KErrNone == error  )
+            {
+            //change phonet addr to current message from table entries
+
+
+            msgPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = (TUint8)( (phonetAddress & 0xFF00) >> 8);
+            msgPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] = (TUint8) (phonetAddress & 0xFF);
+            TDes8* messagePtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
+
+            C_TRACE( ( _T( "<-DISINameService message to recDev: %d" ),msgPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE]  ) );
+            C_TRACE( ( _T( "<-DISINameService message to recObj: %d" ),msgPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT]  ) );
+
+            //send data to router for handling
+            iRouter->Send( *messagePtr, iObjId);
+            }
+        else
+            {
+            //construct not reachable resp message
+            C_TRACE( ( _T( "DISINameService::Receive **ELSE** !!" )  ) );
+            BuildAndSendCommIsaEntityNotReachableResp(aMessage);
+            }
+        }
+    Kern::MutexSignal( *iNameServiceMutex );
+    C_TRACE( ( _T( "DISINameService::DISINameService<" ) ) );
+    }
+
+void DISINameService::HandleNameQueryResp( const TDesC8& aMessage, const TUint8* msgPtr )
+    {
+    C_TRACE( ( _T( "DISINameService::HandleNameQueryResp>" ) ) );
+    TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_NAME ] );
+    TUint32 mask = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_BITMASK ] );
+
+    RArray <TNameTable*> nameTable;
+    TInt32 count = iNameRecords->NameQuery( name, mask, &nameTable );
+
+    TUint16 msgLength = ( SIZE_PNS_NAME_QUERY_RESP + ( count * SIZE_PN_NAME_SRV_ITEM_STR ) );
+    TDes8& respMsg = MemApi::AllocBlock( msgLength );
+    respMsg.SetLength( msgLength );
+    TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() );
+
+    respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ];
+    SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+    SET_SENDER_DEV( respPtr, PN_DEV_OWN );
+    respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+    SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) );
+    SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+    SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER );
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ];
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_SUBFUNCTION ]= PNS_NAME_QUERY_RESP;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES ] = count >> 8;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_TOTALMATCHES + 1 ] = count;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG ] = count >> 8;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_MATCHESINMSG + 1 ] = count;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED1 ] = KFiller;
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_RESERVED2 ] = KFiller;
+
+    TUint16 index = ISI_HEADER_SIZE + PNS_NAME_QUERY_RESP_OFFSET_NAMEENTRYTBL;
+    for( int i = 0; i < count; i++)
+        {
+        //AddNameTable();
+        TNameTable* tmp = (nameTable)[ i ];
+
+        // Name
+        respPtr[ index++ ] = (TUint8)(tmp->iName >> 24);
+        respPtr[ index++ ] = (TUint8)(tmp->iName >> 16);
+        respPtr[ index++ ] = (TUint8)(tmp->iName >> 8);
+        respPtr[ index++ ] = (TUint8)(tmp->iName);
+        // DevId
+        respPtr[ index++ ] = (TUint8)(tmp->iPhonetAddress >> 8);
+        // ObjId
+        respPtr[ index++ ] = (TUint8)(tmp->iPhonetAddress);
+        // Record flags
+        respPtr[ index++ ] = tmp->iFlags;
+        respPtr[ index++ ] = KFiller; // Reserved
+        }
+
+    iRouter->Send( respMsg, iObjId );
+    TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
+    MemApi::DeallocBlock( *block );
+    C_TRACE( ( _T( "DISINameService::HandleNameQueryResp<" ) ) );
+    }
+
+void DISINameService::HandleNameRemoveResp( const TDesC8& aMessage, const TUint8* msgPtr )
+    {
+    C_TRACE( ( _T( "DISINameService::HandleNameRemoveResp>" ) ) );
+    TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_REQ_OFFSET_NAME ] );
+
+    TInt8 err = iNameRecords->RemoveName( name );
+    C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_RESP 0x%x>" ), name ) );
+
+    TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_REMOVE_RESP );
+    TDes8& respMsg = MemApi::AllocBlock( msgLength );
+    respMsg.SetLength( msgLength );
+    TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() );
+
+    respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ];
+    SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+    SET_SENDER_DEV( respPtr, PN_DEV_OWN );
+    respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+    SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) );
+    SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+    SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER );
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ];
+    respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_SUBFUNCTION ] = PNS_NAME_REMOVE_RESP;
+    if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
+        {
+        respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = err;
+        iRouter->Send( respMsg, iObjId );
+
+        if( PN_NAME_OK == err )
+            {
+            C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_IND>" ) ) );
+            msgLength = ( SIZE_PNS_NAME_REMOVE_IND + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL );
+            TDes8& indMsg = MemApi::AllocBlock( msgLength );
+            indMsg.SetLength( msgLength );
+            TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() );
+
+            indPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+            SET_RECEIVER_DEV( indPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+            SET_SENDER_DEV( indPtr, PN_DEV_OWN );
+            indPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+            SET_LENGTH( indPtr, ( msgLength - PN_HEADER_SIZE ) );
+            SET_RECEIVER_OBJ( indPtr, PN_OBJ_EVENT_MULTICAST ); //communicationmanager
+            SET_SENDER_OBJ( indPtr, PN_OBJ_ROUTER );
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_UTID ] = 0x00;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_SUBFUNCTION ]= PNS_NAME_REMOVE_IND;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES ] = 0x00;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_TOTALMATCHES + 1 ] = 0x01;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG ] = 0x00;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_MATCHESINMSG + 1 ] = 0x01;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED1 ] = KFiller;
+            indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_RESERVED2 ] = KFiller;
+            PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], name );
+
+            iRouter->Send( indMsg, iObjId );
+            TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
+            MemApi::DeallocBlock( *block );
+            C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_IND<" ) ) );
+            }
+        C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_RESP<" ) ) );
+        }
+    else
+        {
+        C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage PNS_NAME_REMOVE_REQ from other device, PN_NAME_NOT_ALLOWED" ) ) );
+        respPtr[ ISI_HEADER_SIZE + PNS_NAME_REMOVE_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED;
+        iRouter->Send( respMsg, iObjId );
+        }
+    C_TRACE( ( _T( "DISINameService::HandleNameRemoveResp<" ) ) );
+    }
+
+void DISINameService::HandlePNSNameMessage( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage 0x%x>" ), &aMessage ) );
+    const TUint8* msgPtr( aMessage.Ptr() );
+    TInt8 err( KErrArgument );
+    switch( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] )
+        {
+        case PNS_NAME_QUERY_REQ:
+            {
+            C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ>" ) ) );
+//            if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == THIS_DEVICE )
+//                {
+                C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_RESP>" ) ) );
+                HandleNameQueryResp( aMessage, msgPtr );
+//                }
+//            else
+//                {
+//                C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage PNS_NAME_QUERY_REQ from other device, ignore" ) ) );
+//                }
+            C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ<" ) ) );
+            break;
+            }
+        case PNS_NAME_ADD_REQ:
+            {
+            C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ>" ) ) );
+
+            TUint16 msgLength( ISI_HEADER_SIZE + SIZE_PNS_NAME_ADD_RESP );
+            TDes8& respMsg = MemApi::AllocBlock( msgLength );
+            respMsg.SetLength( msgLength );
+            TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() );
+
+            respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ];
+            SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+            SET_SENDER_DEV( respPtr, PN_DEV_OWN );
+            respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+            SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) );
+            SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+            SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER );
+            respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_UTID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ];
+            respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION ] = PNS_NAME_ADD_RESP;
+
+            if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
+                {
+                C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ from this device" ) ) );
+                TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY ] );
+                TUint16 phonetAddr = GETB16( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ] );
+                TUint8 flags = msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ];
+                err = iNameRecords->AddName( name, phonetAddr, flags );
+                respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = err;
+                for( TInt i( 0 ); i < respMsg.Length(); i++ )
+                    {
+                    C_TRACE( ( _T( "PNS_NAME_ADD_RESP index[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
+                    }
+                iRouter->Send( respMsg, iObjId );
+                C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from this device<" ) ) );
+                if( err == PN_NAME_OK )
+                    {
+                    C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND>" ) ) );
+                    RArray <TNameTable*>* nameTable = NULL;
+                    nameTable = iNameRecords->GetNameTable();
+                    msgLength = ( SIZE_PNS_NAME_ADD_IND + ( SIZE_PN_NAME_SRV_ITEM_STR * nameTable->Count() ) );
+                    TDes8& indMsg = MemApi::AllocBlock( msgLength );
+                    indMsg.SetLength( msgLength );
+                    TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() );
+                    indPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+                    SET_RECEIVER_DEV( indPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+                    SET_SENDER_DEV( indPtr, PN_DEV_OWN );
+                    indPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_NAMESERVICE;
+                    SET_LENGTH( indPtr, ( msgLength - PN_HEADER_SIZE ) );
+                    SET_RECEIVER_OBJ( indPtr, PN_OBJ_EVENT_MULTICAST ); //communicationmanager
+                    SET_SENDER_OBJ( indPtr, PN_OBJ_ROUTER );
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_UTID ] = 0x00;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]= PNS_NAME_ADD_IND;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES ] = 0x00;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_TOTALMATCHES + 1 ] = 0x01;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG ] = 0x00;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_MATCHESINMSG + 1 ] = 0x01;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED1 ] = KFiller;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_RESERVED2 ] = KFiller;
+                    PUTB32( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], name );
+                    PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ], phonetAddr );
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = flags;
+                    indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller;
+                    for( TInt i( 0 ); i < indMsg.Length(); i++ )
+                        {
+                        C_TRACE( ( _T( "PNS_NAME_ADD_IND index[ %d ] data 0x%x"), i, indMsg.Ptr()[i] ) );
+                        }
+                    iRouter->Send( indMsg, iObjId );
+                    C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND<" ) ) );
+                    }
+                }
+            else
+                {
+                C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ from other device>" ) ) );
+                respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED;
+                for( TInt i( 0 ); i < respMsg.Length(); i++ )
+                    {
+                    C_TRACE( ( _T( "PNS_NAME_ADD_RESP index[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
+                    }
+                iRouter->Send( respMsg, iObjId );
+                C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from other device<" ) ) );
+                }
+            TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
+            MemApi::DeallocBlock( *block );
+            C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ<" ) ) );
+            break;
+            }
+        case PNS_NAME_REMOVE_REQ:
+            {
+            C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_REQ>" ) ) );
+            HandleNameRemoveResp( aMessage, msgPtr );
+            C_TRACE( ( _T( "DISINameService PNS_NAME_REMOVE_REQ<" ) ) );
+            break;
+            }
+        default:
+            {
+            ASSERT_RESET_ALWAYS( 0, ( EISINameServiceUnknownMessage | EDISINameServiceTraceId << KClassIdentifierShift ) );
+            C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage unknown NAMESERVICE message" )  ) );
+            }
+        }
+    C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage<" ) ) );
+    }
+
+
+EXPORT_C TBool DISINameService::IsValidResource(
+        const TDesC8& aMessage
+        )
+    {
+    TInt err( Kern::MutexWait( *iNameServiceMutex ) );
+    ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) );
+    C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x>" ), &aMessage ) );
+    C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x<" ), &aMessage ) );
+    Kern::MutexSignal( *iNameServiceMutex );
+    return ETrue;
+    }
+
+
+DECLARE_STANDARD_EXTENSION()
+    {
+    Kern::Printf( "ISI Name Service extension>" );
+    // Create a container extension
+    DISINameService* extension = new DISINameService();
+    TRACE_ASSERT( extension );
+    Kern::Printf( "ISI Name Service extension<" );
+    return extension ? KErrNone : KErrNoMemory;
+    }
+
+void DISINameService::BuildAndSendCommIsaEntityNotReachableResp(
+        const TDesC8& aMsg
+        )
+    {
+    C_TRACE( ( _T( "DISINameService::ConstructCommIsaEntityNotReachableResp 0x%x ->" ), &aMsg ) );
+    // Make channel opening request followinfg COMM specification: 000.026
+    // Length is sixteen bytes.
+    TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
+    TDes8& tempPtr = MemApi::AllocBlock( length );
+    ASSERT_RESET_ALWAYS( &tempPtr, EISINameServiceMemAllocFailure  ); //lisää jotakin infoa jotta löytyy ilman tracea...pelkän luvun perusteella??
+    TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
+    // We start to append from transaction id.
+    tempPtr.SetLength( SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
+    // Get the header until messageid from prev. message.
+    // Just turn receiver and sender device and object vice versa.
+    const TUint8* msgTmpPtr( aMsg.Ptr() );
+    ptr[ ISI_HEADER_OFFSET_MEDIA ] = msgTmpPtr[ ISI_HEADER_OFFSET_MEDIA ];
+    SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMsg ) );
+    SET_SENDER_DEV  ( ptr, GET_RECEIVER_DEV( aMsg ) );
+    ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = msgTmpPtr[ ISI_HEADER_OFFSET_RESOURCEID ];
+    SET_LENGTH( ptr, length - PN_HEADER_SIZE );
+    SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMsg ) );
+    SET_SENDER_OBJ( ptr, GET_RECEIVER_OBJ( aMsg ) );
+    // Transactionid. Set to 0x01 since this is the first.
+    tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_TRANSID ] );
+    // Message ID
+    tempPtr.Append( COMMON_MESSAGE ); // 0xF0
+    // Sub message ID.
+    tempPtr.Append( COMM_ISA_ENTITY_NOT_REACHABLE_RESP ); // 0x14
+    // Not Delivered Message from original req.
+    tempPtr.Append( msgTmpPtr[ ISI_HEADER_OFFSET_MESSAGEID ] );
+    // Status - COMM_ISA_ENTITY_NOT_EXISTING
+    tempPtr.Append( COMM_ISA_ENTITY_NOT_EXISTING); //0x01
+    // Filler
+    tempPtr.Append( 0x00 );
+    // Filler
+    tempPtr.Append( 0x00 );
+    // Filler
+    tempPtr.Append( 0x00 );
+
+    //send data to router for handling
+    iRouter->Send( tempPtr, iObjId);
+
+    TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) );
+    MemApi::DeallocBlock( *block );
+
+    C_TRACE( ( _T( "DISINameService::SendCommIsaEntityNotReachableResp 0x%x <-" ), &aMsg ) );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isce/isinameservice_dll/src/namerecords.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,164 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies 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 "namerecords.h"
+#include <nsisi.h>
+#include "isinameservicetrace.h"  // For C_TRACE, ASSERT_RESET.. and fault codes
+
+enum TISINameRecordsFaults
+    {
+    EISINameRecordsMemAllocFailure = 0x01,
+    };
+
+DNameRecords::DNameRecords()
+	{
+	//nothing
+	C_TRACE( ( _T( "DNameRecords::DNameRecords <->" ) ) );
+	}
+
+DNameRecords::~DNameRecords()
+	{
+	C_TRACE( ( _T( "DNameRecords::~DNameRecords ->" ) ) );
+	TInt i = 0;
+    while( i<iNameTableArray.Count())
+		{
+    	delete iNameTableArray[i];
+    	iNameTableArray.Remove(i);
+		}
+	iNameTableArray.Reset();
+	}
+
+TUint8 DNameRecords::AddName( const TUint32 aName,
+    						  const TUint16 aPhonetAddress,
+    						  const TUint8  aFlags )
+    {
+    C_TRACE( ( _T( "DNameRecords::AddName name:0x%x phonetAdd:%d flags: %d ->" ), aName, aPhonetAddress, aFlags ) );
+
+	TUint8 error = PN_NAME_OK ;
+    TUint i = 0;
+    TBool nameFound = EFalse;
+
+    if( aFlags == PN_NAME_UNDEF ||
+    	aFlags == PN_NAME_NOCHG  )
+        {
+        while( i<iNameTableArray.Count())
+        	{
+            if( iNameTableArray[i]->iName == aName)
+                {
+                nameFound = ETrue;
+                if(  iNameTableArray[i]->iFlags != PN_NAME_UNDEF )
+                    {
+                    error = PN_NAME_NOT_ALLOWED;
+                    }
+                else
+                    {
+                    iNameTableArray[i]->iPhonetAddress = aPhonetAddress;
+                    iNameTableArray[i]->iFlags = aFlags;
+                    }
+                break;
+                }
+            i++;
+            }//while
+        }
+    else
+    	{
+    	error = PN_NAME_UNKNOWN;
+    	}
+    if( !nameFound )
+        {
+    	TNameTable* table = new TNameTable( aName, aPhonetAddress, aFlags );
+
+        ASSERT_RESET_ALWAYS( table, EISINameRecordsMemAllocFailure | EDISINameRecordsTraceId << KClassIdentifierShift );
+    	iNameTableArray.Append( table );
+
+        }
+    return error;
+    }
+
+TUint8 DNameRecords::RemoveName( const TUint32 aName )
+	{
+	C_TRACE( ( _T( "DNameRecords::RemoveName name:0x%x  ->" ), aName ) );
+    TUint8 error = PN_NAME_UNKNOWN;
+    TInt i = 0;
+    while( i<iNameTableArray.Count() )
+        {
+        if( iNameTableArray[i]->iName == aName)
+            {
+            error = PN_NAME_NOT_ALLOWED;
+            if( iNameTableArray[i]->iFlags == PN_NAME_UNDEF )
+                {
+            	delete iNameTableArray[i];;
+            	iNameTableArray.Remove(i);
+            	iNameTableArray.Compress();
+                error = PN_NAME_OK;
+                }
+            break;
+            }
+        i++;
+        } //while
+
+    return error;
+    }
+
+TInt32 DNameRecords::LookupPhonetAddress( const TUint32 aName, TUint16* aPhonetAddress )
+	{
+	C_TRACE( ( _T( "DNameRecords::LookupPhonetAddress name:0x%x  ->" ), aName ) );
+	TInt32 error = KErrNotFound;
+    TInt i = 0;
+
+    while( i<iNameTableArray.Count() )
+        {
+        C_TRACE( ( _T( "DNameRecords::LookupPhonetAddress ind:0x%x " ), i ) );
+        if( iNameTableArray[i]->iName == aName)
+            {
+            C_TRACE( ( _T( "DNameRecords::LookupPhonetAddress found phonet address: 0x%x" ), iNameTableArray[i]->iPhonetAddress ) );
+            *aPhonetAddress = iNameTableArray[i]->iPhonetAddress;
+            error = KErrNone;
+            break;
+            }
+        i++;
+        }//while
+
+    return error;
+    }
+
+RArray <TNameTable*>* DNameRecords::GetNameTable()
+    {
+	C_TRACE( ( _T( "DNameRecords::GetNameTable ->" ) ) );
+	return &iNameTableArray ;
+    }
+
+TInt32 DNameRecords::NameQuery( const TUint32 aName, const TUint32 aMask, RArray <TNameTable*> *aResultsArray )
+	{
+	C_TRACE( ( _T( "DNameRecords::AddName name:0x%x mask:%d &aResultsArray: 0x%x ->" ), aName, aMask, &aResultsArray ) );
+
+    TInt i = 0;
+    TInt32 count = 0;//KErrNotFound
+    while( i<iNameTableArray.Count() )
+        {
+        if( aName == iNameTableArray[i]->iName ||
+        	(aName & aMask ) == ( iNameTableArray[i]->iName & aMask ) )
+            {
+            aResultsArray->Append( iNameTableArray[i] );
+            count++;
+            }
+        i++;
+        }//while
+    return count;
+	}
+
--- a/connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h	Thu Jan 14 10:44:58 2010 +0200
@@ -10,8 +10,8 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
-* 
-* Description: 
+*
+* Description:
 *
 */
 
@@ -26,24 +26,24 @@
 
 NONSHARABLE_CLASS( DISICLTransceiver ) : public DBase, public MISILinkRouterIf
     {
-    
+
     public:
-    
+
         DISICLTransceiver( DISIRouter* aPtr );
-    
+
         ~DISICLTransceiver();
-    
+
         TInt ValidateISIMessage( TDes8& aMessage );
-    
-        void SendCommIsaEntityNotReachableResp( TDes8& aMessage );
-    
+
+        TInt SendCommIsaEntityNotReachableResp( TDes8& aMessage );
+
         TUint8 MapDeviceToMedia( const TUint8 aDevice );
-    
+
         //From MISILinkRouterIf
-        void RouteISIMessage( TDes8& aMessage );
+        TInt RouteISIMessage( TDes8& aMessage );
 
     private:
-    
+
         enum TISIMedias
             {
             EISIMediaSharedMemory = 0x00,
@@ -53,7 +53,7 @@
 
         MISIRouterLinkIf**   iLinksArray;
         DISIRouter*          iRouter;
-        
+
     };
 
 #endif /* __ISICLTRANSCEIVER_H__ */
--- a/connectivitylayer/isce/isirouter_dll/inc/misilinkrouterif.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isirouter_dll/inc/misilinkrouterif.h	Thu Jan 14 10:44:58 2010 +0200
@@ -10,8 +10,8 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
-* 
-* Description: 
+*
+* Description:
 *
 */
 
@@ -34,9 +34,9 @@
         * Receive message from link.
         * Called without FM held.
         * @param aMsg, message to be received
+		* @return Error value
         */
-        virtual void RouteISIMessage( TDes8& aMsg ) = 0;
-
+        virtual TInt RouteISIMessage( TDes8& aMsg ) = 0;
     };
 
 
--- a/connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -10,8 +10,8 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
-* 
-* Description: 
+*
+* Description:
 *
 */
 
@@ -75,11 +75,13 @@
     delete []iLinksArray;
     C_TRACE( ( _T( "DISICLTransceiver::~DISICLTransceiver<" ) ) );
     }
-    
-void DISICLTransceiver::SendCommIsaEntityNotReachableResp( TDes8& aMessage )
+
+TInt DISICLTransceiver::SendCommIsaEntityNotReachableResp( TDes8& aMessage )
     {
     C_TRACE( ( _T( "DISICLTransceiver::SendCommIsaEntityNotReachableResp 0x%x>" ), &aMessage ) );
     const TUint8* msgTmpPtr( aMessage.Ptr() );
+    TInt error = KErrAlreadyExists;
+
     // To avoid COMM_ISA_ENTITY_NOT_REACHABLE_RESP loop
     if( msgTmpPtr[ ISI_HEADER_OFFSET_MESSAGEID ] != COMMON_MESSAGE &&
         msgTmpPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] != COMM_ISA_ENTITY_NOT_REACHABLE_RESP )
@@ -89,7 +91,7 @@
 		    TUint8 length( 16 );
 		    TDes8& tempPtr = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
 		    ASSERT_RESET_ALWAYS( &tempPtr, ( EISICLTransceiverMemAllocFailure1 | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
-  	    ASSERT_RESET_ALWAYS( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP > ISI_HEADER_OFFSET_MESSAGEID, ( EISICLTransceiverOverTheLimits | EDISICLTransceiverTraceId << KClassIdentifierShift ) );    
+  	    ASSERT_RESET_ALWAYS( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP > ISI_HEADER_OFFSET_MESSAGEID, ( EISICLTransceiverOverTheLimits | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
   	    TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
   	    // We start to append from transaction id.
   	    tempPtr.SetLength( ISI_HEADER_OFFSET_TRANSID );
@@ -117,23 +119,25 @@
 		    // Filler
 		    tempPtr.Append( 0x00 );
 		    // Filler
-        tempPtr.Append( 0x00 );
+            tempPtr.Append( 0x00 );
 		    RouteISIMessage( tempPtr );
-		    }
+            error = RouteISIMessage( tempPtr );
+   		    }
 		else
 		    {
 		    C_TRACE( ( _T( "DISICLTransceiver Not sending another CommIsaEntityNotReachableResp" ) ) );
 		    }
     C_TRACE( ( _T( "DISICLTransceiver::SendCommIsaEntityNotReachableResp 0x%x<" ), &aMessage ) );
+    return error;
     }
 
-void DISICLTransceiver::RouteISIMessage( TDes8& aMessage )
+TInt DISICLTransceiver::RouteISIMessage( TDes8& aMessage )
     {
-	  C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x>" ), &aMessage ) );
-	  TInt error( ValidateISIMessage( aMessage ) ); //TODO what to do with error?
-	 	TBool sendOk( EFalse );
-	 	TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
-	  switch( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] )
+	 C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x>" ), &aMessage ) );
+	TInt error( ValidateISIMessage( aMessage ) );
+    TBool sendOk( EFalse );
+	TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
+    switch( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] )
         {
         case PN_DEV_APE:
             {
@@ -154,7 +158,7 @@
             TUint8 linkId = MapDeviceToMedia( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] );
 	          ASSERT_RESET_ALWAYS( linkId < EISIAmountOfMedias, ( EISICLTransceiverNotSupportedMedia | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
             MISIRouterLinkIf* link = iLinksArray[ linkId ];
-            ASSERT_RESET_ALWAYS( link, ( EISICLTransceiverNULLPtr | EDISICLTransceiverTraceId << KClassIdentifierShift ) );  
+            ASSERT_RESET_ALWAYS( link, ( EISICLTransceiverNULLPtr | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
             sendOk = link->Send( aMessage );
             C_TRACE( ( _T( "DISIRouter link sendOk %d" ), sendOk ) );
             break;
@@ -164,8 +168,9 @@
         {
         SendCommIsaEntityNotReachableResp( aMessage );
         MemApi::DeallocBlock( aMessage );
-        }   
+        }
 	  C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x<" ), &aMessage ) );
+    return error;
     }
 
 // KErrBadDescriptor, if message length too small
@@ -189,7 +194,7 @@
     // If the ISI message length is bigger that the largest supported.
     msgOk = ( ( msgOk == KErrNone && isiMsgLength > KMaxISIMsgSize ) ? KErrUnderflow : msgOk );
     TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
-    // If the ISI message length with PN_HEADER_SIZE is less or equal than ISI_HEADER_OFFSET_MESSAGEID. 
+    // If the ISI message length with PN_HEADER_SIZE is less or equal than ISI_HEADER_OFFSET_MESSAGEID.
     msgOk = ( ( msgOk == KErrNone && isiMsgLength <= ISI_HEADER_OFFSET_MESSAGEID ) ? KErrUnderflow : msgOk );
     TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
     TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
--- a/connectivitylayer/isce/isirouter_dll/src/isiif.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/isirouter_dll/src/isiif.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -27,7 +27,7 @@
 const TInt KFirstParam( 0 );
 const TInt KSecondParam( 1 );
 const TInt KThirdParam( 2 );
-const TInt KOneParam( 2 );
+const TInt KOneParam( 1 );
 const TInt KTwoParams( 2 );
 const TInt KThreeParams( 3 );
 
--- a/connectivitylayer/isce/ismpmultiplexer_dll/group/ismpmultiplexer.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/ismpmultiplexer_dll/group/ismpmultiplexer.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,6 +30,8 @@
 CAPABILITY      ALL
 FEATUREVARIANT
 
+SMPSAFE
+
 EPOCALLOWDLLDATA
 
 SOURCEPATH      ../src
--- a/connectivitylayer/isce/ismpmultiplexer_dll/inc/mux.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/ismpmultiplexer_dll/inc/mux.h	Thu Jan 14 10:44:58 2010 +0200
@@ -24,10 +24,10 @@
 class MMuxTrxIf;
 class MMuxLinkIf;
 
-#include <MTrxMuxIf.h>      // For exported MTrxMuxIf
+#include <mtrxmuxif.h>      // For exported MTrxMuxIf
 
 #include "iscedefs.h"       // For EMuxAmountOfProtocols
-#include "MLinkMuxIf.h"     // For internal MLinkMuxIf
+#include "mlinkmuxif.h"     // For internal MLinkMuxIf
 
 /*
 * Class represents a multiplexer.
--- a/connectivitylayer/isce/memmanager_dll/group/memmanager.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/memmanager_dll/group/memmanager.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -29,6 +29,8 @@
 CAPABILITY      ALL
 FEATUREVARIANT
 
+SMPSAFE
+
 DEFFILE         memmanager.def
 
 EPOCALLOWDLLDATA
--- a/connectivitylayer/isce/memmanager_dll/inc/memmanagertrace.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/memmanager_dll/inc/memmanagertrace.h	Thu Jan 14 10:44:58 2010 +0200
@@ -53,6 +53,7 @@
 
 // Resets are made both in UDEB and UREL (traces only in udeb)
 // Internal asserts
+#define TRACE_ASSERT_ALWAYS __TRACE_PRINTF( ("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__) )
 #define ASSERT_RESET_ALWAYS(a,b) if(!(a)) { __TRACE_PRINTF(("Assertion failed: file=" __FILE__ ", line=%d, compiled="__DATE__" "__TIME__, __LINE__)); Kern::Fault( "ISCE MemMgr:", b ); }
 #define ASSERT_THREAD_CONTEXT_ALWAYS( a )ASSERT_RESET_ALWAYS( NKern::CurrentContext() == NKern::EThread, a );
 
--- a/connectivitylayer/isce/memmanager_dll/src/memmanager.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/memmanager_dll/src/memmanager.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -124,6 +124,7 @@
     C_TRACE( ( _T( "DMemManager::PoolAllocateDfc aPtr 0x%x>" ), aPtr ) );
             
     DMemManager& tmp = *reinterpret_cast<DMemManager*>( aPtr );
+    TRACE_ASSERT_ALWAYS;// See below TODO comment, needs a fix
     
     NKern::FMWait( tmp.iFastMutex );
     
@@ -148,7 +149,7 @@
     C_TRACE( ( _T( "DMemManager::PoolDeleteDfc aPtr 0x%x>" ), aPtr ) );
             
     DMemManager& tmp = *reinterpret_cast<DMemManager*>( aPtr );
-    
+    TRACE_ASSERT_ALWAYS; // See below TODO comment, needs a fix
     NKern::FMWait( tmp.iFastMutex );
     
     ASSERT_RESET_ALWAYS( ( tmp.iPoolDeleteQueue.Count() > 0 ), ( EInvalidQueueCount | EDMemmanagerTraceId << KClassIdentifierShift ) );
@@ -257,7 +258,7 @@
 */
 TPtr8* DMemManager::DMemPool::Alloc( const TUint16 aSize )
     {
-	  C_TRACE( ( _T( "DMemManager::DMemPool::Alloc>" ) ) );
+// TODO : not when FM	  C_TRACE( ( _T( "DMemManager::DMemPool::Alloc>" ) ) );
 	  
 	  ASSERT_RESET_ALWAYS( (iMemoryArea || iFreeMemBlock), ( EMemBlockAllocationFailed | EDMemmanagerTraceId << KClassIdentifierShift ) );
     
@@ -281,7 +282,7 @@
     
     iBlockUsage++;
    
-	  C_TRACE( ( _T( "DMemManager::DMemPool::Alloc<" ) ) );
+// TODO : not when FM	  C_TRACE( ( _T( "DMemManager::DMemPool::Alloc<" ) ) );
     return iAllocatedMemBlock->iMemPtr;
     }
 
@@ -291,7 +292,7 @@
 */
 TBool DMemManager::DMemPool::Free( const TUint8* aBlockAddress )
     {
-    C_TRACE( ( _T( "DMemManager::DMemPool::Free>" ) ) );
+// TODO : not when FM    C_TRACE( ( _T( "DMemManager::DMemPool::Free>" ) ) );
 	    
     struct sUnit *pCurUnit = (struct sUnit *)(aBlockAddress - sizeof(struct sUnit) );
 
@@ -313,7 +314,7 @@
     iFreeMemBlock->iMemPtr->Zero();
     iBlockUsage--;
     
-    C_TRACE( ( _T( "DMemManager::DMemPool::Free<" ) ) );
+// TODO : not when FM    C_TRACE( ( _T( "DMemManager::DMemPool::Free<" ) ) );
 
     //If empty & ready to be deleted
     return ( iCopyPoolInUse && iBlockUsage == 0 ) ? ETrue : EFalse; 
--- a/connectivitylayer/isce/p2papi_dll/group/p2papi.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/p2papi_dll/group/p2papi.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -28,6 +28,8 @@
 CAPABILITY      ALL
 FEATUREVARIANT
 
+SMPSAFE
+
 DEFFILE         p2papi.def
 
 SOURCEPATH      ../src
--- a/connectivitylayer/isce/p2prouter_dll/group/p2prouter.mmp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/p2prouter_dll/group/p2prouter.mmp	Thu Jan 14 10:44:58 2010 +0200
@@ -30,6 +30,8 @@
 CAPABILITY      ALL
 FEATUREVARIANT
 
+SMPSAFE
+
 EPOCALLOWDLLDATA
 
 SOURCEPATH      ../src
--- a/connectivitylayer/isce/p2prouter_dll/inc/p2pinternaldefs.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/p2prouter_dll/inc/p2pinternaldefs.h	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 
 enum TP2PSyncRequest
     {
-    EP2PClose = 0,
+    EP2PClose = 1,
     EP2PSend,
     EP2PAllocateBlock,
     EP2PDeallocateBlock,
--- a/connectivitylayer/isce/p2prouter_dll/src/p2puserchannel.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/p2prouter_dll/src/p2puserchannel.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -1,3 +1,4 @@
+
 /*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
@@ -37,6 +38,7 @@
     EP2PUserChannelWrongRequest5,
     EP2PUserChannelWrongRequest6,
     EP2PUserChannelWrongRequest7,
+    EP2PUserChannelWrongRequest8,
     EP2PUserChannelWrongParam,
     EP2PUserChannelWrongParam2,
     EP2PUserChannelProtocolIdNotSpecified,
@@ -308,12 +310,28 @@
         )
     {
 
-    C_TRACE( ( _T( "DP2PUserChannel::Request 0x%x 0x%x %d 0x%x>" ), this, iShP2PProtocolId, aReqNo, a1 ) );
+    C_TRACE( ( _T( "DP2PUserChannel::Request 0x%x 0x%x 0x%x 0x%x>" ), this, iShP2PProtocolId, aReqNo, a1 ) );
     // Programmer errors.
-    ASSERT_RESET_ALWAYS( aReqNo >= ( TInt ) EMinRequestId, ( EP2PUserChannelWrongRequest3 | EDP2PUserChannelTraceId << KClassIdentifierShift ) );
-    ASSERT_RESET_ALWAYS( ( aReqNo <= EP2PLastAsyncRequest || aReqNo == KMaxTInt ), ( EP2PUserChannelWrongRequest4 | EDP2PUserChannelTraceId << KClassIdentifierShift ) );
-    // Wrong API usage e.g. called function when interface is not open so panic the client thread.
-    ASSERT_PANIC_USER_THREAD_ALWAYS( ( iShP2PProtocolId < EP2PAmountOfProtocols || EP2PAsyncOpen == aReqNo ), iThread, ( EP2PUserChannelWrongParam2 | EDP2PUserChannelTraceId << KClassIdentifierShift ) );
+    ASSERT_RESET_ALWAYS( aReqNo >= ( TInt ) EMinRequestId, ( EP2PUserChannelWrongRequest3 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) );
+    ASSERT_RESET_ALWAYS( ( aReqNo <= EP2PLastAsyncRequest || aReqNo == KMaxTInt ), ( EP2PUserChannelWrongRequest4 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) );
+    
+    if ( iShP2PProtocolId < EP2PAmountOfProtocols )
+        {
+        // normal activity
+        }
+    else if ( iShP2PProtocolId > EP2PAmountOfProtocols ) // Open ongoing, not completed 
+        {
+        ASSERT_PANIC_USER_THREAD_ALWAYS( ( aReqNo == EP2PAsyncOpen                              ||
+                                           ( aReqNo == KMaxTInt && (TInt)a1 == EP2PAsyncOpen )   || // cancel open
+                                           aReqNo == EP2PClose ),
+                                         iThread, ( EP2PUserChannelWrongParam2 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) );
+        }
+	else
+        {
+		// Not possible to come here
+        ASSERT_RESET_ALWAYS( 0, ( EP2PUserChannelWrongRequest8 | EDP2PUserChannelTraceId << KClassIdentifierShift | KExtraInfoShift << (TUint8)aReqNo ) );
+        }
+
     TInt result( KErrNotFound );
     // All request go in kernel context and with ::DoControl call.
     TThreadMessage& m=Kern::Message();
@@ -642,7 +660,9 @@
             C_TRACE( ( _T( "DP2PUserChannel::DoCancel 0x%x 0x%x EP2PAsyncOpen" ), this, iShP2PProtocolId ) );
             TInt err( Kern::MutexWait( *iShP2PProtocolIdMutex ) );
             ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EP2PUserChannelMutexWaitFailed4 | EDP2PUserChannelTraceId << KClassIdentifierShift ) );
-            Close( ~iShP2PProtocolId );
+            TUint8 protocolId = ( iShP2PProtocolId > EP2PAmountOfProtocols ) ? ~iShP2PProtocolId : iShP2PProtocolId;
+            Close( protocolId );
+                
             Kern::MutexSignal( *iShP2PProtocolIdMutex );
             break;
             }
--- a/connectivitylayer/isce/rom/isce.iby	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isce/rom/isce.iby	Thu Jan 14 10:44:58 2010 +0200
@@ -29,4 +29,6 @@
 file=ABI_DIR\DEBUG_DIR\iscapi.dll                             SHARED_LIB_DIR\iscapi.dll
 device[VARID]=KERNEL_DIR\DEBUG_DIR\isaaccessldd.ldd           SHARED_LIB_DIR\isaaccessldd.ldd
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\isaaccessextension.dll  \Sys\Bin\isaaccessextension.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isinameservice.dll      \Sys\Bin\isinameservice.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isicommunicationmanager.dll      \Sys\Bin\isicommunicationmanager.dll
 #endif // __ISCE_IBY__
--- a/connectivitylayer/isimessage/group/bld.inf	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/group/bld.inf	Thu Jan 14 10:44:58 2010 +0200
@@ -51,7 +51,9 @@
 ../symbianisamacroif/include/wgmodem25/infoisi.h                                         NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/infoisi.h)
 ../symbianisamacroif/include/wgmodem25/location_wmisi.h                                	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/location_wmisi.h)
 ../symbianisamacroif/include/wgmodem25/mceisi.h                                        	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/mceisi.h)
+../symbianisamacroif/include/wgmodem25/modem_infoisi.h                                   NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/modem_infoisi.h)
 ../symbianisamacroif/include/wgmodem25/net_modemisi.h                                  	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/net_modemisi.h)
+../symbianisamacroif/include/wgmodem25/nvdisi.h                                  	     NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/nvdisi.h)
 ../symbianisamacroif/include/wgmodem25/phonetisi.h                                       NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/phonetisi.h)
 ../symbianisamacroif/include/wgmodem25/pipeisi.h                                         NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/pipeisi.h)
 ../symbianisamacroif/include/wgmodem25/pipe_sharedisi.h                                  NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(wgmodem25/pipe_sharedisi.h)
@@ -75,7 +77,9 @@
 ../symbianisamacroif/include/variation/infoisi.h                                         NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(infoisi.h)
 ../symbianisamacroif/include/variation/location_wmisi.h                                	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(location_wmisi.h)
 ../symbianisamacroif/include/variation/mceisi.h                                        	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(mceisi.h)
+../symbianisamacroif/include/variation/modem_infoisi.h                                   NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(modem_infoisi.h)
 ../symbianisamacroif/include/variation/net_modemisi.h                                  	 NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(net_modemisi.h)
+../symbianisamacroif/include/variation/nvdisi.h                                  	     NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(nvdisi.h)
 ../symbianisamacroif/include/variation/phonetisi.h                                       NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(phonetisi.h)
 ../symbianisamacroif/include/variation/pipeisi.h                                         NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(pipeisi.h)
 ../symbianisamacroif/include/variation/pipe_sharedisi.h                                  NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(pipe_sharedisi.h)
--- a/connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -19,9 +19,9 @@
 #include "tisi.h"
 #include "isimessagetrace.h"
 #include <pn_const.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "tisitraces.h"
+#include "tisiTraces.h"
 #endif
 
 
@@ -554,43 +554,21 @@
     C_TRACE( ( _T ( "TIsiSend::Complete, length: 0x%x, calcfinallength: 0x%x" ), length, calcFinalLength ) );
     OstTraceExt2( TRACE_NORMAL, DUP1_TISISEND_COMPLETE, "TIsiSend::Complete;length=%hu;calcFinalLength=%hu", length, calcFinalLength );
     
-    #if defined( __WINS__ ) || defined( __WINSCW__ )
-        {
-         if( iFinalLength == 0 )    // TIsiSend alternative constructor used
-            {
-                TUint8 byte1 = ( TUint8 )( ( length & 0xff00 ) >> 8 );
-                TUint8 byte2 = ( TUint8 )( length & 0x00ff );        
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte1 );        // BE
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte2 );    // BE
-            }
-         else
-            {
-                TUint8 byte1 = ( TUint8 )( ( calcFinalLength & 0xff00 ) >> 8 );
-                TUint8 byte2 = ( TUint8 )( calcFinalLength & 0x00ff );        
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte1 );        // BE
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte2 );    // BE               
-                iBuffer.SetLength( iFinalLength );
-            }
-        }
-    #else
-        {
-         if( iFinalLength == 0 )    // TIsiSend alternative constructor used
-                {
-                TUint8 byte1 = ( TUint8 )( ( length & 0xff00 ) >> 8 );
-                TUint8 byte2 = ( TUint8 )( length & 0x00ff );        
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte2 );        // LE
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte1 );    // LE
-                }
-            else
-                {
-                TUint8 byte1 = ( TUint8 )( ( calcFinalLength & 0xff00 ) >> 8 );
-                TUint8 byte2 = ( TUint8 )( calcFinalLength & 0x00ff );        
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte2 );        // LE
-                this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte1 );    // LE               
-                iBuffer.SetLength( iFinalLength );
-                }
-        }
-    #endif    
+    if( iFinalLength == 0 )    // TIsiSend alternative constructor used
+       {
+           TUint8 byte1 = ( TUint8 )( ( length & 0xff00 ) >> 8 );
+           TUint8 byte2 = ( TUint8 )( length & 0x00ff );        
+           this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte1 );        // BE
+           this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte2 );    // BE
+       }
+    else
+       {
+           TUint8 byte1 = ( TUint8 )( ( calcFinalLength & 0xff00 ) >> 8 );
+           TUint8 byte2 = ( TUint8 )( calcFinalLength & 0x00ff );        
+           this->Set8bit( ISI_HEADER_OFFSET_LENGTH, byte1 );        // BE
+           this->Set8bit( ISI_HEADER_OFFSET_LENGTH + 1, byte2 );    // BE               
+           iBuffer.SetLength( iFinalLength );
+       }
 
     C_TRACE( ( _T ( "TIsiSend::Complete, byte2: 0x%x, byte1: 0x%x" ), iBuffer[5], iBuffer[4] ) );
     OstTraceExt2( TRACE_NORMAL, DUP2_TISISEND_COMPLETE, "TIsiSend::Complete;byte2=%hhu;byte1=%hhu", iBuffer[5], iBuffer[4] );
--- a/connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,9 +20,9 @@
 #include "isikernel.h"
 #include "kernelisimessage_trace.h"
 #include <phonetisi.h>
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
-#include "isikerneltraces.h"
+#include "isikernelTraces.h"
 #endif
 
 
@@ -561,38 +561,17 @@
     COMPONENT_TRACE( ( _T ( "TIsiKernelSend::Complete, length: 0x%x, calcfinallength: 0x%x" ), length, calcFinalLength ) );
     OstTraceExt2( TRACE_NORMAL, DUP1_TISIKERNELSEND_COMPLETE, "TIsiKernelSend::Complete;length=%hu;calcFinalLength=%hu", length, calcFinalLength );
     
-    #if defined( __WINS__ ) || defined( __WINSCW__ )
+    if( iFinalLength == 0 )    // TIsiKernelSend alternative constructor used
+        {               
+        iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>( (length & 0xff00) >> 8);   //BE             
+        iBuffer[ ISI_HEADER_OFFSET_LENGTH + 1 ] = static_cast<TUint8>(length & 0x00ff);    //BE
+        }
+    else
         {
-        if( iFinalLength == 0 )    // TIsiKernelSend alternative constructor used
-            {               
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>( (length & 0xff00) >> 8);   //BE             
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH + 1 ] = static_cast<TUint8>(length & 0x00ff);    //BE
-            }
-        else
-            {
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>( (calcFinalLength & 0xff00 ) >> 8);   //BE             
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH + 1 ] = static_cast<TUint8>(calcFinalLength & 0x00ff);    //BE
-            iBuffer.SetLength( iFinalLength );                
-            }
-        }        
-        
-    #else
-        {
-        if( iFinalLength == 0 )    // TIsiKernelSend alternative constructor used
-            {
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH +1 ] = static_cast<TUint8>( (length & 0xff00) >> 8);   //LE             
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>(length & 0x00ff);    //LE               
-           }
-        else
-            {              
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH +1 ] = static_cast<TUint8>( (calcFinalLength & 0xff00) >> 8);   //LE             
-            iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>(calcFinalLength & 0x00ff);    //LE
-            iBuffer.SetLength( iFinalLength );                                
-             }
-        OstTraceExt2( TRACE_NORMAL, DUP2_TISIKERNELSEND_COMPLETE, "TIsiKernelSend::Complete;byte2=%hhu;byte1=%hhu", iBuffer[5], iBuffer[4] );
-        COMPONENT_TRACE( ( _T ( "TIsiKernelSend::Complete, byte2: 0x%x, byte1: 0x%x" ), iBuffer[5], iBuffer[4] ) );
+        iBuffer[ ISI_HEADER_OFFSET_LENGTH ] = static_cast<TUint8>( (calcFinalLength & 0xff00 ) >> 8);   //BE             
+        iBuffer[ ISI_HEADER_OFFSET_LENGTH + 1 ] = static_cast<TUint8>(calcFinalLength & 0x00ff);    //BE
+        iBuffer.SetLength( iFinalLength );                
         }
-    #endif    
 
     COMPONENT_TRACE( ( _T ( "TIsiKernelSend::Complete - return, buffer length = 0x%x, iFinalLength = 0x%x" ), length, iFinalLength ) );
     OstTraceExt2( TRACE_NORMAL, DUP3_TISIKERNELSEND_COMPLETE, "TIsiKernelSend::Complete - return;buffer length=%hu;iFinalLength=%u", length, iFinalLength );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/variation/modem_infoisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -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 the License "Eclipse Public License v1.0"
+* which accompanies 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 _VARIATION_ISI_MODEM_INFOISIH_
+#define _VARIATION_ISI_MODEM_INFOISIH_
+
+//CellMO branch support for CellMO wgmodem25 branch
+#if ( NCP_COMMON_CELLMO_BRANCH_SUPPORT == NCP_COMMON_CELLMO_BRANCH_WGMODEM25 )
+#include "wgmodem25/modem_infoisi.h"
+
+#else
+//No headers to include!
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/variation/nvdisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -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 the License "Eclipse Public License v1.0"
+* which accompanies 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 _VARIATION_ISI_NVDISIH_
+#define _VARIATION_ISI_NVDISIH_
+
+//CellMO branch support for CellMO wgmodem25 branch
+#if ( NCP_COMMON_CELLMO_BRANCH_SUPPORT == NCP_COMMON_CELLMO_BRANCH_WGMODEM25 )
+#include "wgmodem25/nvdisi.h"
+
+#else
+//No headers to include!
+#endif
+
+#endif
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/at_modemisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/at_modemisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -5,7 +5,6 @@
 * under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
-
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
@@ -16,6 +15,8 @@
 * Name      : PN_AT_MODEM [ 0x8E ] Resource AT Modem Server
 * Version   : 003.001
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/call_modemisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/call_modemisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -14,7 +14,9 @@
 * 
 * Description:
 * Name      : PN_MODEM_CALL [ 0xC9 ] Resource Modem Call Server
-* Version   : 001.004
+* Version   : 002.002
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -22,8 +24,8 @@
 #ifndef _SYMBIAN_ISI_CALL_MODEMISI_H_
 #define _SYMBIAN_ISI_CALL_MODEMISI_H_
 
-#define MODEM_CALL_SERVER_ISI_VERSION_Z	 1
-#define MODEM_CALL_SERVER_ISI_VERSION_Y	 4
+#define MODEM_CALL_SERVER_ISI_VERSION_Z	 2
+#define MODEM_CALL_SERVER_ISI_VERSION_Y	 2
 
 
 //CONSTANTS
@@ -186,7 +188,6 @@
 #define CALL_MODEM_STATUS_HOLD                            	0x0C                                                 	
 #define CALL_MODEM_STATUS_RETRIEVE_INITIATED              	0x0D                                                 	
 #define CALL_MODEM_STATUS_RECONNECT_PENDING               	0x0E                                                 	
-#define CALL_MODEM_STATUS_TERMINATED                      	0x0F                                                 	
 #define CALL_MODEM_STATUS_SWAP_INITIATED                  	0x10                                              	
 
 //BitmaskTables for CALL_MODEM_PRESENT_INFO
@@ -200,12 +201,12 @@
 #define CALL_MODEM_RI_IN_BAND_INFO                        	0x01                                                 	
 
 //ConstantTable for CALL_MODEM_OPERATION
+#define CALL_MODEM_OP_UNKNOWN                             	0x00                                                 	
 #define CALL_MODEM_OP_HOLD                                	0x01                                                 	
 #define CALL_MODEM_OP_RETRIEVE                            	0x02                                                 	
 #define CALL_MODEM_OP_SWAP                                	0x03                                                 	
 #define CALL_MODEM_OP_CONFERENCE_BUILD                    	0x04                                                 	
 #define CALL_MODEM_OP_CONFERENCE_SPLIT                    	0x05                                                 	
-#define CALL_MODEM_OP_CUG                                 	0xA0                                              	
 #define CALL_MODEM_OP_TRANSFER                            	0xA1                                              	
 
 //ConstantTable for CALL_MODEM_DTMF_STATUS
@@ -217,6 +218,7 @@
 #define CALL_MODEM_RECONNECTED                            	0x02                                                 	
 
 //ConstantTable for CALL_MODEM_PROPERTY
+#define CALL_MODEM_PROP_UNKNOWN                           	0x00                                                 	
 #define CALL_MODEM_PROP_ALL                               	0x01                                                 	
 #define CALL_MODEM_PROP_IMMEDIATE_CONNECT                 	0xA0                                              	
 #define CALL_MODEM_PROP_CUG_INFO                          	0xA1                                              	
@@ -250,6 +252,7 @@
 //ConstantTable for CALL_MODEM_EMERG_NUMBER_OPERATION
 #define CALL_MODEM_EMERG_NUMBER_REMOVE                    	0x00                                                 	
 #define CALL_MODEM_EMERG_NUMBER_ADD                       	0x01                                                 	
+#define CALL_MODEM_EMERG_NUMBER_UNKNOWN                   	0xFF                                              	
 
 //ConstantTable for CALL_MODEM_EMERG_NUMBER_CHECK_STATUS
 #define CALL_MODEM_EMERG_NBR_CHECK_FAIL                   	0x00                                                 	
@@ -478,6 +481,7 @@
 #define CALL_MODEM_RES_CONF_RECONFIGURED                  	0x02                                                 	
 
 //ConstantTable for CALL_MODEM_RES_CONF_OPERATION
+#define CALL_MODEM_RES_CONF_UNKNOWN                       	0x00                                                 	
 #define CALL_MODEM_RES_CONF_GET                           	0x01                                                 	
 #define CALL_MODEM_RES_CONF_SET                           	0x02                                                 	
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/comm_extisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/comm_extisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,8 @@
 * Name      : [ 0x00 ] Resource Common Messages (Extended)
 * Version   : 000.031
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/commisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/commisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,8 @@
 * Name      : [ 0x00 ] Resource Common Messages
 * Version   : 000.031
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/csdisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/csdisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,15 +13,16 @@
 * 
 * Description:
 * Name      : PN_CSD [ 0x16 ] Resource Circuit Switched Data Server
-* Version   : 012.000
+* Version   : 013.000
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
-
 #ifndef _SYMBIAN_ISI_CSDISI_H_
 #define _SYMBIAN_ISI_CSDISI_H_
 
-#define CIRCUIT_SWITCHED_DATA_SERVER_ISI_VERSION_Z	 12
+#define CIRCUIT_SWITCHED_DATA_SERVER_ISI_VERSION_Z	 13
 #define CIRCUIT_SWITCHED_DATA_SERVER_ISI_VERSION_Y	 0
 
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpds_sharedisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpds_sharedisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,7 +13,9 @@
 * 
 * Description:
 * Name      : PN_GPDS [ 0x31 ] Resource GPDS Shared Subblock Descriptions
-* Version   : 018.006
+* Version   : 019.001
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -21,8 +23,8 @@
 #ifndef _SYMBIAN_ISI_GPDS_SHAREDISI_H_
 #define _SYMBIAN_ISI_GPDS_SHAREDISI_H_
 
-#define GPDS_SHARED_SUBBLOCK_DESCRIPTIONS_ISI_VERSION_Z	 18
-#define GPDS_SHARED_SUBBLOCK_DESCRIPTIONS_ISI_VERSION_Y	 6
+#define GPDS_SHARED_SUBBLOCK_DESCRIPTIONS_ISI_VERSION_Z	 19
+#define GPDS_SHARED_SUBBLOCK_DESCRIPTIONS_ISI_VERSION_Y	 1
 
 
 //CONSTANTS
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpdsisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gpdsisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,7 +13,9 @@
 * 
 * Description:
 * Name      : PN_GPDS [ 0x31 ] Resource General Packet Data Server
-* Version   : 019.000
+* Version   : 019.001
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -22,7 +24,7 @@
 #define _SYMBIAN_ISI_GPDSISI_H_
 
 #define GENERAL_PACKET_DATA_SERVER_ISI_VERSION_Z	 19
-#define GENERAL_PACKET_DATA_SERVER_ISI_VERSION_Y	 0
+#define GENERAL_PACKET_DATA_SERVER_ISI_VERSION_Y	 1
 
 
 //CONSTANTS
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gssisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/gssisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,7 +13,9 @@
 * 
 * Description:
 * Name      : PN_GSS [ 0x32 ] Resource GSM Stack Server
-* Version   : 008.001
+* Version   : 008.002
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -22,7 +24,7 @@
 #define _SYMBIAN_ISI_GSSISI_H_
 
 #define GSM_STACK_SERVER_ISI_VERSION_Z	 8
-#define GSM_STACK_SERVER_ISI_VERSION_Y	 1
+#define GSM_STACK_SERVER_ISI_VERSION_Y	 2
 
 
 //CONSTANTS
@@ -384,11 +386,6 @@
 #define GSS_CS_LOCAL_INFO_GET                             	0x03                                                 	
 #define GSS_POWER_CLASS_CHANGE                            	0x04                                                 	
 #define GSS_BAND_INFO_GET                                 	0x05                                                 	
-#define GSS_ADJ_CHA_MEAS_START                            	0x09                                                 	
-#define GSS_ADJ_CHA_MEAS_STOP                             	0x0A                                                 	
-#define GSS_ADJ_CHA_MEAS                                  	0x0B                                                 	
-#define GSS_FORCED_HANDOVER                               	0x0C                                                 	
-#define GSS_CELL_BARRING                                  	0x0D                                                 	
 #define GSS_SELECTED_RAT_WRITE                            	0x0E                                                 	
 #define GSS_ATK_TIMING_ADVANCE_GET                        	0x96                                              	
 #define GSS_UMA_PREF_MODE_READ                            	0x97                                              	
@@ -445,20 +442,11 @@
 #define GSS_CS_STATUS_TCH                                 	0x15                                              	
 #define GSS_CS_STATUS_INIT                                	0x16                                              	
 
-//ConstantTable for GSS_OPERATION_STATUS
-#define GSS_OPERATION_FAILED                              	0x00                                                 	
-#define GSS_OPERATION_OK                                  	0x01                                                 	
-#define GSS_OPERATION_FAILED_CS_INACTIVE                  	0x02                                                 	
-
-//ConstantTable for GSS_CELL_BARRING_FUNCTIONS
-#define CELL_BARRING_NORMAL                               	0x00                                                 	
-#define CELL_BARRING_REVERSE                              	0x01                                                 	
-#define CELL_BARRING_IGNORED                              	0x02                                                 	
-
-//ConstantTable for GSS_RAT_INFO_FUNCTIONS
-#define GSS_DUAL_RAT                                      	0x00                                                 	
+//BitmaskTables for GSS_RAT_INFO_FUNCTIONS
 #define GSS_GSM_RAT                                       	0x01                                                 	
 #define GSS_UMTS_RAT                                      	0x02                                                 	
+#define GSS_EUTRAN_RAT                                    	0x04                                                 	
+#define GSS_DUAL_RAT                                      	0x03                                                 	
 
 //BitmaskTables for GSS_GSM_BAND_VALUES
 #define GSS_GSM_NO_BANDS                                  	0x00                                                 	
@@ -468,6 +456,7 @@
 #define GSS_GSM_850_BAND_MASK                             	0x08                                                 	
 #define GSS_ALL_GSM_BANDS                                 	0xFF                                              	
 
+
 //BitmaskTables for GSS_UMTS_BAND_VALUES
 #define GSS_UMTS_NO_BANDS                                 	0x00                                                 	
 #define GSS_UMTS_BAND_I_MASK                              	0x01                                                 	
@@ -591,35 +580,6 @@
 #define SIZE_GSS_BAND_INFO                                	8
 
 
-//Definition for GSS_ADJ_CHA_MEAS_INFO
-#define GSS_ADJ_CHA_MEAS_INFO                             	0x08                                                 	
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_SUBBLOCKID           	0 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_SUBBLOCKLENGTH       	1 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_RXLEVNFULL           	2 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_RXLEVNSUB            	3 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_RXLEVNUPPER          	4 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_RXLEVNLOWER          	5 //size 1 byte(s)
-#define GSS_ADJ_CHA_MEAS_INFO_OFFSET_FILLERBYTE1          	6 //size 2 byte(s)
-#define SIZE_GSS_ADJ_CHA_MEAS_INFO                        	8
-
-
-//Definition for GSS_HANDOVER_INFO
-#define GSS_HANDOVER_INFO                                 	0x09                                                 	
-#define GSS_HANDOVER_INFO_OFFSET_SUBBLOCKID               	0 //size 1 byte(s)
-#define GSS_HANDOVER_INFO_OFFSET_SUBBLOCKLENGTH           	1 //size 1 byte(s)
-#define GSS_HANDOVER_INFO_OFFSET_CARRIER                  	2 //size 2 byte(s)
-#define SIZE_GSS_HANDOVER_INFO                            	4
-
-
-//Definition for GSS_BARRING_INFO
-#define GSS_BARRING_INFO                                  	0x0A                                                 	
-#define GSS_BARRING_INFO_OFFSET_SUBBLOCKID                	0 //size 1 byte(s)
-#define GSS_BARRING_INFO_OFFSET_SUBBLOCKLENGTH            	1 //size 1 byte(s)
-#define GSS_BARRING_INFO_OFFSET_FUNCTION                  	2 //size 1 byte(s)
-#define GSS_BARRING_INFO_OFFSET_FILLERBYTE1               	3 //size 1 byte(s)
-#define SIZE_GSS_BARRING_INFO                             	4
-
-
 //Definition for GSS_RAT_INFO
 #define GSS_RAT_INFO                                      	0x0B                                                 	
 #define GSS_RAT_INFO_OFFSET_SUBBLOCKID                    	0 //size 1 byte(s)
@@ -757,35 +717,6 @@
 #define SIZE_GSS_CS_SERVICE_FAIL_RESP                     	4
 
 
-//Definition for GSS_NEMO_REQ
-#define GSS_NEMO_REQ                                      	0x07                                                 	
-#define GSS_NEMO_REQ_OFFSET_TRANSID                       	0 //size 1 byte(s)
-#define GSS_NEMO_REQ_OFFSET_MESSAGEID                     	1 //size 1 byte(s)
-#define GSS_NEMO_REQ_OFFSET_OPERATION                     	2 //size 1 byte(s)
-#define GSS_NEMO_REQ_OFFSET_NBROFSUBBLOCKS                	3 //size 1 byte(s)
-#define SIZE_GSS_NEMO_REQ                                 	4
-
-
-//Definition for GSS_NEMO_RESP
-#define GSS_NEMO_RESP                                     	0x08                                                 	
-#define GSS_NEMO_RESP_OFFSET_TRANSID                      	0 //size 1 byte(s)
-#define GSS_NEMO_RESP_OFFSET_MESSAGEID                    	1 //size 1 byte(s)
-#define GSS_NEMO_RESP_OFFSET_OPERATION                    	2 //size 1 byte(s)
-#define GSS_NEMO_RESP_OFFSET_STATUS                       	3 //size 1 byte(s)
-#define GSS_NEMO_RESP_OFFSET_FILLERBYTE1                  	4 //size 3 byte(s)
-#define GSS_NEMO_RESP_OFFSET_NBROFSUBBLOCKS               	7 //size 1 byte(s)
-#define SIZE_GSS_NEMO_RESP                                	8
-
-
-//Definition for GSS_NEMO_NTF
-#define GSS_NEMO_NTF                                      	0x09                                                 	
-#define GSS_NEMO_NTF_OFFSET_TRANSID                       	0 //size 1 byte(s)
-#define GSS_NEMO_NTF_OFFSET_MESSAGEID                     	1 //size 1 byte(s)
-#define GSS_NEMO_NTF_OFFSET_OPERATION                     	2 //size 1 byte(s)
-#define GSS_NEMO_NTF_OFFSET_NBROFSUBBLOCKS                	3 //size 1 byte(s)
-#define SIZE_GSS_NEMO_NTF                                 	4
-
-
 //Definition for GSS_CS_IND
 #define GSS_CS_IND                                        	0x03                                                 	
 #define GSS_CS_IND_OFFSET_TRANSID                         	0 //size 1 byte(s)
@@ -813,15 +744,6 @@
 #define SIZE_GSS_SELECTED_RAT_IND                         	4
 
 
-//Definition for GSS_SELECTED_BANDS_IND
-#define GSS_SELECTED_BANDS_IND                            	0x16                                              	
-#define GSS_SELECTED_BANDS_IND_OFFSET_TRANSID             	0 //size 1 byte(s)
-#define GSS_SELECTED_BANDS_IND_OFFSET_MESSAGEID           	1 //size 1 byte(s)
-#define GSS_SELECTED_BANDS_IND_OFFSET_NBROFSUBBLOCKS      	2 //size 1 byte(s)
-#define GSS_SELECTED_BANDS_IND_OFFSET_FILLERBYTE1         	3 //size 1 byte(s)
-#define SIZE_GSS_SELECTED_BANDS_IND                       	4
-
-
 //Definition for GSS_UMA_PREF_MODE_IND
 #define GSS_UMA_PREF_MODE_IND                             	0x15                                              	
 #define GSS_UMA_PREF_MODE_IND_OFFSET_TRANSID              	0 //size 1 byte(s)
@@ -831,27 +753,6 @@
 #define SIZE_GSS_UMA_PREF_MODE_IND                        	4
 
 
-//Definition for GSS_MS_INTERROGATE_REQ
-#define GSS_MS_INTERROGATE_REQ                            	0x0B                                                 	
-#define GSS_MS_INTERROGATE_REQ_OFFSET_TRANSID             	0 //size 1 byte(s)
-#define GSS_MS_INTERROGATE_REQ_OFFSET_MESSAGEID           	1 //size 1 byte(s)
-#define GSS_MS_INTERROGATE_REQ_OFFSET_FILLERBYTE1         	2 //size 2 byte(s)
-#define SIZE_GSS_MS_INTERROGATE_REQ                       	4
-
-
-//Definition for GSS_MS_INTERROGATE_RESP
-#define GSS_MS_INTERROGATE_RESP                           	0x0C                                                 	
-#define GSS_MS_INTERROGATE_RESP_OFFSET_TRANSID            	0 //size 1 byte(s)
-#define GSS_MS_INTERROGATE_RESP_OFFSET_MESSAGEID          	1 //size 1 byte(s)
-#define GSS_MS_INTERROGATE_RESP_OFFSET_NBROFENTRIES       	2 //size 2 byte(s)
-#define GSS_MS_INTERROGATE_RESP_OFFSET_DATA               	4 //size 2 byte(s)
-#define GSS_MS_INTERROGATE_RESP_OFFSET_FILLERBYTE1        	6 //size 1 byte(s)
-#define GSS_MS_INTERROGATE_RESP_OFFSET_FILLERBYTE2        	7 //size 1 byte(s)
-#define SIZE_GSS_MS_INTERROGATE_RESP                      	8
-//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
-//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
-
-
 //Definition for GSS_HSXPA_USER_SETTING_WRITE_REQ
 #define GSS_HSXPA_USER_SETTING_WRITE_REQ                  	0x0F                                                 	
 #define GSS_HSXPA_USER_SETTING_WRITE_REQ_OFFSET_TRANSID   	0 //size 1 byte(s)
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/location_wmisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/location_wmisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,13 +15,15 @@
 * Name      : PN_MODEM_LCS [ 0x90 ] Resource Modem LCS Server
 * Version   : 006.000
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
 #ifndef _SYMBIAN_ISI_LOCATION_WMISI_H_
 #define _SYMBIAN_ISI_LOCATION_WMISI_H_
 
-#define MODEM_LCS_SERVER_ISI_VERSION_Z	 6
+#define MODEM_LCS_SERVER_ISI_VERSION_Z	 7
 #define MODEM_LCS_SERVER_ISI_VERSION_Y	 0
 
 
@@ -411,9 +413,6 @@
 //ConstantTable for MODEM_LCS_HW_PIN_CTRL_ID
 
 //ConstantTable for MODEM_LCS_HW_PIN_CTRL_STATE
-#define MODEM_LCS_PIN_LOW                                 	0x01                                                 	
-#define MODEM_LCS_PIN_HIGH                                	0x02                                                 	
-#define MODEM_LCS_PIN_RELEASE                             	0x03                                                 	
 
 //ConstantTable for MODEM_LCS_W_OPTIONAL_TAG
 #define MODEM_LCS_W_OPTIONAL_NOT_PRESENT                  	0x00                                                 	
@@ -1501,42 +1500,6 @@
 #define SIZE_MODEM_LCS_SB_SS_PRIVACY_SUPPORT_STATUS       	8
 
 
-//Definition for MODEM_LCS_SB_PROD_TEST_TXP_SET
-#define MODEM_LCS_SB_PROD_TEST_TXP_SET                    	0x700                                             	
-#define MODEM_LCS_SB_PROD_TEST_TXP_SET_OFFSET_SBID        	0 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_SET_OFFSET_SBLEN       	2 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_SET_OFFSET_STATE       	4 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_SET_OFFSET_FILLERBYTE1 	6 //size 2 byte(s)
-#define SIZE_MODEM_LCS_SB_PROD_TEST_TXP_SET               	8
-
-
-//Definition for MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET             	0x701                                             	
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET_OFFSET_SBID 	0 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET_OFFSET_SBLEN	2 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET_OFFSET_STATE	4 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET_OFFSET_FILLERBYTE1	6 //size 2 byte(s)
-#define SIZE_MODEM_LCS_SB_PROD_TEST_TIME_STAMP_SET        	8
-
-
-//Definition for MODEM_LCS_SB_PROD_TEST_TXP_RESULT
-#define MODEM_LCS_SB_PROD_TEST_TXP_RESULT                 	0x702                                             	
-#define MODEM_LCS_SB_PROD_TEST_TXP_RESULT_OFFSET_SBID     	0 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_RESULT_OFFSET_SBLEN    	2 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_RESULT_OFFSET_STATUS   	4 //size 1 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TXP_RESULT_OFFSET_FILLERBYTE1	5 //size 3 byte(s)
-#define SIZE_MODEM_LCS_SB_PROD_TEST_TXP_RESULT            	8
-
-
-//Definition for MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT          	0x703                                             	
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT_OFFSET_SBID	0 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT_OFFSET_SBLEN	2 //size 2 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT_OFFSET_STATUS	4 //size 1 byte(s)
-#define MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT_OFFSET_FILLERBYTE1	5 //size 3 byte(s)
-#define SIZE_MODEM_LCS_SB_PROD_TEST_TIME_STAMP_RESULT     	8
-
-
 //MESSAGES
 
 
@@ -1734,24 +1697,6 @@
 #define SIZE_MODEM_LCS_SS_PRIVACY_TIMEOUT_IND             	4
 
 
-//Definition for MODEM_LCS_TEST_HW_PIN_CTRL_REQ
-#define MODEM_LCS_TEST_HW_PIN_CTRL_REQ                    	0x15                                              	
-#define MODEM_LCS_TEST_HW_PIN_CTRL_REQ_OFFSET_TRANSID     	0 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_REQ_OFFSET_MESSAGEID   	1 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_REQ_OFFSET_FILLERBYTE1 	2 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_REQ_OFFSET_SBCOUNT     	3 //size 1 byte(s)
-#define SIZE_MODEM_LCS_TEST_HW_PIN_CTRL_REQ               	4
-
-
-//Definition for MODEM_LCS_TEST_HW_PIN_CTRL_RESP
-#define MODEM_LCS_TEST_HW_PIN_CTRL_RESP                   	0x16                                              	
-#define MODEM_LCS_TEST_HW_PIN_CTRL_RESP_OFFSET_TRANSID    	0 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_RESP_OFFSET_MESSAGEID  	1 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_RESP_OFFSET_FILLERBYTE1	2 //size 1 byte(s)
-#define MODEM_LCS_TEST_HW_PIN_CTRL_RESP_OFFSET_SBCOUNT    	3 //size 1 byte(s)
-#define SIZE_MODEM_LCS_TEST_HW_PIN_CTRL_RESP              	4
-
-
 //Definition for MODEM_LCS_GSM_TIME_STAMP_REQ
 #define MODEM_LCS_GSM_TIME_STAMP_REQ                      	0x17                                              	
 #define MODEM_LCS_GSM_TIME_STAMP_REQ_OFFSET_TRANSID       	0 //size 1 byte(s)
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/mceisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/mceisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,8 @@
 * Name      : PN_MODEM_MCE [ 0xC2 ] Resource Modem Control Entity
 * Version   : 001.001
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
@@ -22,7 +24,7 @@
 #define _SYMBIAN_ISI_MCEISI_H_
 
 #define MODEM_CONTROL_ENTITY_ISI_VERSION_Z	 1
-#define MODEM_CONTROL_ENTITY_ISI_VERSION_Y	 1
+#define MODEM_CONTROL_ENTITY_ISI_VERSION_Y	 2
 
 
 //TABLES
@@ -196,4 +198,22 @@
 #define MCE_SLEEP_CONTROL_RESP_OFFSET_FILLERBYTE1         	3 //size 1 byte(s)
 #define SIZE_MCE_SLEEP_CONTROL_RESP                       	4
 
+
+//Definition for MCE_DVFS_CONTROL_REQ
+#define MCE_DVFS_CONTROL_REQ                              	0x10                                              	
+#define MCE_DVFS_CONTROL_REQ_OFFSET_TRANSID               	0 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_REQ_OFFSET_MESSAGEID             	1 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_REQ_OFFSET_TYPE                  	2 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_REQ_OFFSET_FILLERBYTE1           	3 //size 1 byte(s)
+#define SIZE_MCE_DVFS_CONTROL_REQ                         	4
+
+
+//Definition for MCE_DVFS_CONTROL_RESP
+#define MCE_DVFS_CONTROL_RESP                             	0x11                                              	
+#define MCE_DVFS_CONTROL_RESP_OFFSET_TRANSID              	0 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_RESP_OFFSET_MESSAGEID            	1 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_RESP_OFFSET_STATUS               	2 //size 1 byte(s)
+#define MCE_DVFS_CONTROL_RESP_OFFSET_FILLERBYTE1          	3 //size 1 byte(s)
+#define SIZE_MCE_DVFS_CONTROL_RESP                        	4
+
 #endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/modem_infoisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+* Name      : PN_MODEM_INFO [ 0xC5 ] Resource Modem Info Server
+* Version   : 001.002
+*
+* Documentation: www.wirelessmodemapi.com
+*
+*/
+
+
+#ifndef _SYMBIAN_ISI_INFOISI_H_
+#define _SYMBIAN_ISI_INFOISI_H_
+
+#define MODEM_INFO_SERVER_ISI_VERSION_Z	 1
+#define MODEM_INFO_SERVER_ISI_VERSION_Y	 2
+
+
+//CONSTANTS
+#define INFO_ANY_SIZE                                     	0x01                                                 	
+
+
+//TABLES
+
+//ConstantTable for M_INFO_GENERAL_SYM
+#define M_INFO_OK                                         	0x00                                                 	
+#define M_INFO_FAIL                                       	0x01                                                 	
+#define M_INFO_NOT_SUPPORTED                              	0x02                                                 	
+
+//ConstantTable for M_INFO_BATCH_TYPE
+#define M_INFO_PP_FEATURE                                 	0x00                                                 	
+#define M_INFO_PP_ALL_FEATURES                            	0x01                                                 	
+
+//BitmaskTables for M_INFO_VERSION_TARGETS
+#define M_INFO_MODEMSW                                    	0x01                                                 	
+
+
+//SUBBLOCKS
+
+
+//Definition for M_INFO_SB_MODEMSW_VERSION
+#define M_INFO_SB_MODEMSW_VERSION                         	0x00                                              	
+#define M_INFO_SB_MODEMSW_VERSION_OFFSET_SUBBLOCKID       	0 //size 1 byte(s)
+#define M_INFO_SB_MODEMSW_VERSION_OFFSET_SUBBLOCKLEN      	1 //size 1 byte(s)
+#define M_INFO_SB_MODEMSW_VERSION_OFFSET_FILLERBYTE1      	2 //size 1 byte(s)
+#define M_INFO_SB_MODEMSW_VERSION_OFFSET_STRLEN           	3 //size 1 byte(s)
+#define M_INFO_SB_MODEMSW_VERSION_OFFSET_MCUSWVERSNC8     	4 //size 1 byte(s)
+#define SIZE_M_INFO_SB_MODEMSW_VERSION                    	5
+//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
+
+
+//Definition for M_INFO_SB_PP_DATA
+#define M_INFO_SB_PP_DATA                                 	0x01                                              	
+#define M_INFO_SB_PP_DATA_OFFSET_SUBBLOCKID               	0 //size 1 byte(s)
+#define M_INFO_SB_PP_DATA_OFFSET_FILLERBYTE1              	1 //size 1 byte(s)
+#define M_INFO_SB_PP_DATA_OFFSET_SUBBLOCKLEN              	2 //size 2 byte(s)
+#define M_INFO_SB_PP_DATA_OFFSET_FILLERBYTE2              	4 //size 2 byte(s)
+#define M_INFO_SB_PP_DATA_OFFSET_PPFEACNT                 	6 //size 2 byte(s)
+#define SIZE_M_INFO_SB_PP_DATA                            	8
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//MESSAGES
+
+
+//Definition for M_INFO_PP_DATA_READ_REQ
+#define M_INFO_PP_DATA_READ_REQ                           	0x02                                              	
+#define M_INFO_PP_DATA_READ_REQ_OFFSET_TRANSID            	0 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_REQ_OFFSET_MESSAGEID          	1 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_REQ_OFFSET_FILLER             	2 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_REQ_OFFSET_SUBBLOCKCOUNT      	3 //size 1 byte(s)
+#define SIZE_M_INFO_PP_DATA_READ_REQ                      	4
+
+
+//Definition for M_INFO_PP_DATA_READ_RESP
+#define M_INFO_PP_DATA_READ_RESP                          	0x03                                              	
+#define M_INFO_PP_DATA_READ_RESP_OFFSET_TRANSID           	0 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_RESP_OFFSET_MESSAGEID         	1 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_RESP_OFFSET_STATUS            	2 //size 1 byte(s)
+#define M_INFO_PP_DATA_READ_RESP_OFFSET_SUBBLOCKCOUNT     	3 //size 1 byte(s)
+#define SIZE_M_INFO_PP_DATA_READ_RESP                     	4
+
+
+//Definition for M_INFO_PP_DATA_WRITE_REQ
+#define M_INFO_PP_DATA_WRITE_REQ                          	0x04                                              	
+#define M_INFO_PP_DATA_WRITE_REQ_OFFSET_TRANSID           	0 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_REQ_OFFSET_MESSAGEID         	1 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_REQ_OFFSET_FILLERBYTE1       	2 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_REQ_OFFSET_SUBBLOCKCOUNT     	3 //size 1 byte(s)
+#define SIZE_M_INFO_PP_DATA_WRITE_REQ                     	4
+
+
+//Definition for M_INFO_PP_DATA_WRITE_RESP
+#define M_INFO_PP_DATA_WRITE_RESP                         	0x05                                              	
+#define M_INFO_PP_DATA_WRITE_RESP_OFFSET_TRANSID          	0 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_RESP_OFFSET_MESSAGEID        	1 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_RESP_OFFSET_FILLERBYTE1      	2 //size 1 byte(s)
+#define M_INFO_PP_DATA_WRITE_RESP_OFFSET_STATUS           	3 //size 1 byte(s)
+#define SIZE_M_INFO_PP_DATA_WRITE_RESP                    	4
+
+
+//Definition for M_INFO_VERSION_READ_REQ
+#define M_INFO_VERSION_READ_REQ                           	0x00                                              	
+#define M_INFO_VERSION_READ_REQ_OFFSET_TRANSID            	0 //size 1 byte(s)
+#define M_INFO_VERSION_READ_REQ_OFFSET_MESSAGEID          	1 //size 1 byte(s)
+#define M_INFO_VERSION_READ_REQ_OFFSET_FILLERBYTE1        	2 //size 2 byte(s)
+#define M_INFO_VERSION_READ_REQ_OFFSET_TARGET             	4 //size 4 byte(s)
+#define SIZE_M_INFO_VERSION_READ_REQ                      	8
+
+
+//Definition for M_INFO_VERSION_READ_RESP
+#define M_INFO_VERSION_READ_RESP                          	0x01                                              	
+#define M_INFO_VERSION_READ_RESP_OFFSET_TRANSID           	0 //size 1 byte(s)
+#define M_INFO_VERSION_READ_RESP_OFFSET_MESSAGEID         	1 //size 1 byte(s)
+#define M_INFO_VERSION_READ_RESP_OFFSET_STATUS            	2 //size 1 byte(s)
+#define M_INFO_VERSION_READ_RESP_OFFSET_SUBBLOCKCOUNT     	3 //size 1 byte(s)
+#define SIZE_M_INFO_VERSION_READ_RESP                     	4
+
+#endif
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/net_modemisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/net_modemisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,7 +13,9 @@
 * 
 * Description:
 * Name      : PN_MODEM_NETWORK [ 0xC8 ] Resource Modem Network Select Server
-* Version   : 016.005
+* Version   : 016.009
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -22,11 +24,10 @@
 #define _SYMBIAN_ISI_NET_MODEMISI_H_
 
 #define MODEM_NETWORK_SELECT_SERVER_ISI_VERSION_Z	 16
-#define MODEM_NETWORK_SELECT_SERVER_ISI_VERSION_Y	 5
+#define MODEM_NETWORK_SELECT_SERVER_ISI_VERSION_Y	 9
 
 
 //CONSTANTS
-#define FTD_CLEAR_BTS_TEST                                	0xD05                                             	
 #define NET_INVALID_TIME                                  	0x64                                              	
 #define NET_FILL                                          	0x00                                                 	
 #define NET_ALPHA_TAG_LEN                                 	0x20                                              	
@@ -43,13 +44,6 @@
 
 //TABLES
 
-//ConstantTable for FtdTable
-#define FTD_SB_BTS_TEST                                   	0x1303                                            	
-#define FTD_SB_BTS_STATUS                                 	0x1304                                            	
-#define FTD_SB_FIRST_PREF                                 	0x1311                                            	
-#define FTD_SB_SECOND_PREF                                	0x1312                                            	
-#define FTD_SB_THIRD_PREF                                 	0x1313                                            	
-
 //ConstantTable for NET_MODEM_SUCCESS_CODES
 #define NET_CAUSE_OK                                      	0x00                                                 	
 #define NET_CAUSE_COMMUNICATION_ERROR                     	0x01                                                 	
@@ -151,15 +145,18 @@
 #define NET_CONTEXT_UNKNOWN                               	0x00                                                 	
 #define NET_CONTEXT_GSM                                   	0x01                                                 	
 #define NET_CONTEXT_UMTS                                  	0x02                                                 	
+#define NET_CONTEXT_EPS                                   	0x04                                                 	
 
 //ConstantTable for NET_ACTIVE_RAT
 #define NET_ACTIVE_RAT_UNKNOWN                            	0x00                                                 	
 #define NET_ACTIVE_RAT_GSM                                	0x01                                                 	
 #define NET_ACTIVE_RAT_UMTS                               	0x02                                                 	
+#define NET_ACTIVE_RAT_EPS                                	0x04                                                 	
 
 //ConstantTable for NET_RAT_NAME
 #define NET_GSM_RAT                                       	0x01                                                 	
 #define NET_UMTS_RAT                                      	0x02                                                 	
+#define NET_EPS_RAT                                       	0x04                                                 	
 
 //ConstantTable for NET_RAT_TYPE
 #define NET_CURRENT_RAT                                   	0x00                                                 	
@@ -267,6 +264,20 @@
 #define NET_WCDMA_FDD_BAND_23_MASK                        	0x400000                                          	
 #define NET_WCDMA_FDD_BAND_24_MASK                        	0x800000                                          	
 
+//BitmaskTables for NET_EUTRAN_BANDS_INFO_TBL
+#define NET_EUTRAN_NO_BANDS                               	0x00                                                 	
+#define NET_EUTRAN_BAND_1_MASK                            	0x01                                                 	
+#define NET_EUTRAN_BAND_2_MASK                            	0x02                                                 	
+#define NET_EUTRAN_BAND_3_MASK                            	0x04                                                 	
+#define NET_EUTRAN_BAND_4_MASK                            	0x08                                                 	
+#define NET_EUTRAN_BAND_5_MASK                            	0x10                                              	
+#define NET_EUTRAN_BAND_6_MASK                            	0x20                                              	
+#define NET_EUTRAN_BAND_7_MASK                            	0x40                                              	
+#define NET_EUTRAN_BAND_8_MASK                            	0x80                                              	
+#define NET_EUTRAN_BAND_9_MASK                            	0x100                                             	
+#define NET_EUTRAN_BAND_10_MASK                           	0x200                                             	
+#define NET_EUTRAN_BAND_11_MASK                           	0x400                                             	
+
 //ConstantTable for NET_MODEM_GPRS_NETWORK_MODE
 #define NET_GPRS_MODE_NONE                                	0x00                                                 	
 #define NET_GPRS_MODE_I                                   	0x01                                                 	
@@ -448,7 +459,7 @@
 #define NET_MODEM_GSM_REG_INFO_OFFSET_HSDPAAVAILABLEINCELL	20 //size 1 byte(s)
 #define NET_MODEM_GSM_REG_INFO_OFFSET_HSUPAAVAILABLEINCELL	21 //size 1 byte(s)
 #define NET_MODEM_GSM_REG_INFO_OFFSET_CAMPEDINHPLMN       	22 //size 1 byte(s)
-#define NET_MODEM_GSM_REG_INFO_OFFSET_FILLERBYTE1         	23 //size 1 byte(s)
+#define NET_MODEM_GSM_REG_INFO_OFFSET_RATNAME             	23 //size 1 byte(s)
 #define SIZE_NET_MODEM_GSM_REG_INFO                       	24
 //NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
 
@@ -715,6 +726,23 @@
 //NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
 
 
+//Definition for NET_EPS_CELL_INFO
+#define NET_EPS_CELL_INFO                                 	0x50                                              	
+#define NET_EPS_CELL_INFO_OFFSET_SUBBLOCKID               	0 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_SUBBLOCKLENGTH           	1 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_CURRENTTAC               	2 //size 2 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_CURRENTCELLID            	4 //size 4 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_NETEPSCELLINFOBAND       	8 //size 4 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_OPERATORCODE             	12 //size 3 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_SERVICESTATUS            	15 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_NETWORKTYPE              	16 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_FILLERBYTE1              	17 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_FILLERBYTE2              	18 //size 1 byte(s)
+#define NET_EPS_CELL_INFO_OFFSET_FILLERBYTE3              	19 //size 1 byte(s)
+#define SIZE_NET_EPS_CELL_INFO                            	20
+//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
+
+
 //Definition for NET_FULL_NITZ_NAME
 #define NET_FULL_NITZ_NAME                                	0x48                                              	
 #define NET_FULL_NITZ_NAME_OFFSET_SUBBLOCKID              	0 //size 1 byte(s)
@@ -1100,4 +1128,28 @@
 #define SIZE_NET_NITZ_NAME_IND                            	8
 //NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
 
+
+//Definition for NET_SOR_REQ
+#define NET_SOR_REQ                                       	0x44                                              	
+#define NET_SOR_REQ_OFFSET_TRANSID                        	0 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_MESSAGEID                      	1 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_LISTTAG                        	2 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_DATALENGTH                     	3 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_DATA                           	4 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_FILLERBYTE1                    	5 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_FILLERBYTE2                    	6 //size 1 byte(s)
+#define NET_SOR_REQ_OFFSET_FILLERBYTE3                    	7 //size 1 byte(s)
+#define SIZE_NET_SOR_REQ                                  	8
+//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for NET_SOR_RESP
+#define NET_SOR_RESP                                      	0x45                                              	
+#define NET_SOR_RESP_OFFSET_TRANSID                       	0 //size 1 byte(s)
+#define NET_SOR_RESP_OFFSET_MESSAGEID                     	1 //size 1 byte(s)
+#define NET_SOR_RESP_OFFSET_SUCCESSCODE                   	2 //size 1 byte(s)
+#define NET_SOR_RESP_OFFSET_FILLERBYTE1                   	3 //size 1 byte(s)
+#define SIZE_NET_SOR_RESP                                 	4
+
 #endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/nvdisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* 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 the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+* Name      : PN_NVD [ 0x43 ] Resource Non-Volatile Data Server
+* Version   : 000.001
+*
+* Documentation: www.wirelessmodemapi.com
+*
+*/
+
+
+#ifndef _SYMBIAN_ISI_NVDISI_H_
+#define _SYMBIAN_ISI_NVDISI_H_
+
+#define NON_VOLATILE_DATA_SERVER_ISI_VERSION_Z	 0
+#define NON_VOLATILE_DATA_SERVER_ISI_VERSION_Y	 1
+
+
+//TABLES
+
+//ConstantTable for NVD_STATUS
+#define NVD_STATUS_OK                                     	0x00                                                 	
+#define NVD_STATUS_FAIL                                   	0x01                                                 	
+#define NVD_STATUS_NONE                                   	0x02                                                 	
+
+
+//MESSAGES
+
+
+//Definition for NVD_SET_DEFAULT_REQ
+#define NVD_SET_DEFAULT_REQ                               	0x01                                                 	
+#define NVD_SET_DEFAULT_REQ_OFFSET_TRANSACTIONID          	0 //size 1 byte(s)
+#define NVD_SET_DEFAULT_REQ_OFFSET_MESSAGEID              	1 //size 1 byte(s)
+#define NVD_SET_DEFAULT_REQ_OFFSET_FILLERBYTE1            	2 //size 2 byte(s)
+#define SIZE_NVD_SET_DEFAULT_REQ                          	4
+
+
+//Definition for NVD_SET_DEFAULT_RESP
+#define NVD_SET_DEFAULT_RESP                              	0x02                                                 	
+#define NVD_SET_DEFAULT_RESP_OFFSET_TRANSACTIONID         	0 //size 1 byte(s)
+#define NVD_SET_DEFAULT_RESP_OFFSET_MESSAGEID             	1 //size 1 byte(s)
+#define NVD_SET_DEFAULT_RESP_OFFSET_STATUS                	2 //size 1 byte(s)
+#define NVD_SET_DEFAULT_RESP_OFFSET_FILLERBYTE1           	3 //size 1 byte(s)
+#define SIZE_NVD_SET_DEFAULT_RESP                         	4
+
+
+#endif
\ No newline at end of file
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/pipeisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/pipeisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,16 +15,350 @@
 * Name      : PN_PIPE [ 0xD9 ] Resource CM Pipe Service
 * Version   : 002.003
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
 #ifndef _SYMBIAN_ISI_PIPEISI_H_
 #define _SYMBIAN_ISI_PIPEISI_H_
 
-#define CM_PIPE_SERVICE_ISI_VERSION_Z	 2
-#define CM_PIPE_SERVICE_ISI_VERSION_Y	 3
+#define PIPE_SERVICE_ISI_VERSION_Z	 2
+#define PIPE_SERVICE_ISI_VERSION_Y	 7
+
+
+//CONSTANTS
+#define PN_MAX_PEP_CTRL_DATA                              	0x0B                                                 	
+#define PN_MAX_PIPE_DATA                                  	0x15                                              	
+#define PN_MAX_PEP_IND_DATA                               	0xC9                                              	
+#define PIPE_ANY_SIZE                                     	0x01                                                 	
+
+
+//TABLES
+
+//ConstantTable for PIPE_FC_TYPES
+#define PN_NO_FLOW_CONTROL                                	0x00                                                 	
+#define PN_LEGACY_FLOW_CONTROL                            	0x01                                                 	
+#define PN_ONE_CREDIT_FLOW_CONTROL                        	0x02                                                 	
+#define PN_MULTI_CREDIT_FLOW_CONTROL                      	0x03                                                 	
+
+//ConstantTable for PIPE_DATA_MSG_TYPES
+#define PN_NORMAL_DATA_MSG                                	0x00                                                 	
+#define PN_ALIGNED_DATA_MSG                               	0x01                                                 	
+
+//ConstantTable for PN_PEP_TYPE
+#define PN_PEP_TYPE_COMMON                                	0x00                                                 	
+
+//ConstantTable for PN_PEP_TYPE_COMMON_SUB
+#define PEP_IND_EMPTY                                     	0x00                                                 	
+#define PEP_IND_BUSY                                      	0x01                                                 	
+#define PEP_IND_READY                                     	0x02                                                 	
+#define PEP_IND_REMOVE                                    	0x03                                                 	
+#define PEP_IND_CREDIT                                    	0x04                                                 	
+
+//ConstantTable for PIPE_SERVICE_CC
+#define PN_PIPE_NO_ERROR                                  	0x00                                                 	
+#define PN_PIPE_ERR_INVALID_PARAM                         	0x01                                                 	
+#define PN_PIPE_ERR_INVALID_HANDLE                        	0x02                                                 	
+#define PN_PIPE_ERR_INVALID_CTRL_ID                       	0x03                                                 	
+#define PN_PIPE_ERR_NOT_ALLOWED                           	0x04                                                 	
+#define PN_PIPE_ERR_PEP_IN_USE                            	0x05                                                 	
+#define PN_PIPE_ERR_OVERLOAD                              	0x06                                                 	
+#define PN_PIPE_ERR_DEV_DISCONNECTED                      	0x07                                                 	
+#define PN_PIPE_ERR_TIMEOUT                               	0x08                                                 	
+#define PN_PIPE_ERR_ALL_PIPES_IN_USE                      	0x09                                                 	
+#define PN_PIPE_ERR_GENERAL                               	0x0A                                                 	
+#define PN_PIPE_ERR_ALIGN_NOT_SUPPORTED                   	0x0B                                                 	
+#define PN_PIPE_ERR_NOT_SUPPORTED                         	0x0C                                                 	
+
+//ConstantTable for PN_PEP_IND_ENUM
+#define PN_PEP_IND_FLOW_CONTROL                           	0x00                                                 	
+#define PN_PEP_IND_MCFC_GRANT_CREDITS                     	0x01                                                 	
+
+//ConstantTable for PIPE_STATE_AFTER
+#define PN_PIPE_DISABLE                                   	0x00                                                 	
+#define PN_PIPE_ENABLE                                    	0x01                                                 	
+
+
+//STRUCTURES
+
+
+//Definition for PIPE_MSG_HDR
+#define PIPE_MSG_HDR_OFFSET_MEDIA                         	0 //size 1 byte(s)
+#define PIPE_MSG_HDR_OFFSET_RECEIVERDEV                   	1 //size 1 byte(s)
+#define PIPE_MSG_HDR_OFFSET_SENDERDEV                     	2 //size 1 byte(s)
+#define PIPE_MSG_HDR_OFFSET_FUNCTION                      	3 //size 1 byte(s)
+#define PIPE_MSG_HDR_OFFSET_LENGTH                        	4 //size 2 byte(s)
+#define PIPE_MSG_HDR_OFFSET_RECEIVEROBJ                   	6 //size 1 byte(s)
+#define PIPE_MSG_HDR_OFFSET_SENDEROBJ                     	7 //size 1 byte(s)
+#define SIZE_PIPE_MSG_HDR                                 	8
+
+
+//Definition for GENERAL_PIPE_MSG
+#define GENERAL_PIPE_MSG_OFFSET_HEADER                    	0 //size 8 byte(s)
+#define GENERAL_PIPE_MSG_OFFSET_UTID                      	8 //size 1 byte(s)
+#define GENERAL_PIPE_MSG_OFFSET_SUBFUNCTION               	9 //size 1 byte(s)
+#define SIZE_GENERAL_PIPE_MSG                             	10
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//SUBBLOCKS
+
+
+//Definition for PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE
+#define PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE               	0x01                                                 	
+#define PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE_OFFSET_SBID   	0 //size 1 byte(s)
+#define PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE_OFFSET_SBLEN  	1 //size 1 byte(s)
+#define PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE_OFFSET_PEPSUBTYPE	2 //size 1 byte(s)
+#define PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE_OFFSET_FILLERBYTE1	3 //size 1 byte(s)
+#define SIZE_PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE          	4
+
+
+//Definition for PN_PIPE_SB_NEGOTIATED_FC
+#define PN_PIPE_SB_NEGOTIATED_FC                          	0x03                                                 	
+#define PN_PIPE_SB_NEGOTIATED_FC_OFFSET_SBID              	0 //size 1 byte(s)
+#define PN_PIPE_SB_NEGOTIATED_FC_OFFSET_SBLEN             	1 //size 1 byte(s)
+#define PN_PIPE_SB_NEGOTIATED_FC_OFFSET_NEGOTIATEDTXFC    	2 //size 1 byte(s)
+#define PN_PIPE_SB_NEGOTIATED_FC_OFFSET_NEGOTIATEDRXFC    	3 //size 1 byte(s)
+#define SIZE_PN_PIPE_SB_NEGOTIATED_FC                     	4
+
+
+//Definition for PN_PIPE_SB_REQUIRED_FC_TX
+#define PN_PIPE_SB_REQUIRED_FC_TX                         	0x04                                                 	
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_SBID             	0 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_SBLEN            	1 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_REQUIREDFCTXLENGTH	2 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_FILLERBYTE1      	3 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_REQUIREDFCTX     	4 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_FILLERBYTE2      	5 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_FILLERBYTE3      	6 //size 1 byte(s)
+#define PN_PIPE_SB_REQUIRED_FC_TX_OFFSET_FILLERBYTE4      	7 //size 1 byte(s)
+#define SIZE_PN_PIPE_SB_REQUIRED_FC_TX                    	8
+//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PN_PIPE_SB_PREFERRED_FC_RX
+#define PN_PIPE_SB_PREFERRED_FC_RX                        	0x05                                                 	
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_SBID            	0 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_SBLEN           	1 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_PREFERREDFCRXLENGTH	2 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_FILLERBYTE1     	3 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_PREFERREDFCRX   	4 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_FILLERBYTE2     	5 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_FILLERBYTE3     	6 //size 1 byte(s)
+#define PN_PIPE_SB_PREFERRED_FC_RX_OFFSET_FILLERBYTE4     	7 //size 1 byte(s)
+#define SIZE_PN_PIPE_SB_PREFERRED_FC_RX                   	8
+//NOTE: Definition contains variable size field(s). SIZE_ and offsets following variable field cannot be defined correctly.
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PN_PIPE_SB_ALIGNED_DATA
+#define PN_PIPE_SB_ALIGNED_DATA                           	0x06                                                 	
+#define PN_PIPE_SB_ALIGNED_DATA_OFFSET_SBID               	0 //size 1 byte(s)
+#define PN_PIPE_SB_ALIGNED_DATA_OFFSET_SBLEN              	1 //size 1 byte(s)
+#define PN_PIPE_SB_ALIGNED_DATA_OFFSET_DATAALIGNMENT      	2 //size 1 byte(s)
+#define PN_PIPE_SB_ALIGNED_DATA_OFFSET_FILLERBYTE1        	3 //size 1 byte(s)
+#define SIZE_PN_PIPE_SB_ALIGNED_DATA                      	4
+
+
+//MESSAGES
+
+
+//Definition for PNS_PIPE_CREATED_IND
+#define PNS_PIPE_CREATED_IND                              	0x61                                              	
+#define PNS_PIPE_CREATED_IND_OFFSET_UTID                  	0 //size 1 byte(s)
+#define PNS_PIPE_CREATED_IND_OFFSET_SUBFUNCTION           	1 //size 1 byte(s)
+#define PNS_PIPE_CREATED_IND_OFFSET_PIPEHANDLE            	2 //size 1 byte(s)
+#define PNS_PIPE_CREATED_IND_OFFSET_NSB                   	3 //size 1 byte(s)
+#define SIZE_PNS_PIPE_CREATED_IND                         	4
+
+
+//Definition for PNS_PEP_CONNECT_REQ
+#define PNS_PEP_CONNECT_REQ                               	0x40                                              	
+#define PNS_PEP_CONNECT_REQ_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_PIPEHANDLE             	2 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_STATEAFTERCONNECT      	3 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_OTHERPEPTYPE           	4 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_FILLERBYTE1            	5 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_FILLERBYTE2            	6 //size 1 byte(s)
+#define PNS_PEP_CONNECT_REQ_OFFSET_NSB                    	7 //size 1 byte(s)
+#define SIZE_PNS_PEP_CONNECT_REQ                          	8
 
 
+//Definition for PNS_PEP_CONNECT_RESP
+#define PNS_PEP_CONNECT_RESP                              	0x41                                              	
+#define PNS_PEP_CONNECT_RESP_OFFSET_UTID                  	0 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_SUBFUNCTION           	1 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_PIPEHANDLE            	2 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_ERRORCODE             	3 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_FILLERBYTE1           	4 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_FILLERBYTE2           	5 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_FILLERBYTE3           	6 //size 1 byte(s)
+#define PNS_PEP_CONNECT_RESP_OFFSET_NSB                   	7 //size 1 byte(s)
+#define SIZE_PNS_PEP_CONNECT_RESP                         	8
+
+
+//Definition for PNS_PEP_CTRL_REQ
+#define PNS_PEP_CTRL_REQ                                  	0x48                                              	
+#define PNS_PEP_CTRL_REQ_OFFSET_UTID                      	0 //size 1 byte(s)
+#define PNS_PEP_CTRL_REQ_OFFSET_SUBFUNCTION               	1 //size 1 byte(s)
+#define PNS_PEP_CTRL_REQ_OFFSET_PIPEHANDLE                	2 //size 1 byte(s)
+#define PNS_PEP_CTRL_REQ_OFFSET_PEPTYPE                   	3 //size 1 byte(s)
+#define PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLID                 	4 //size 1 byte(s)
+#define PNS_PEP_CTRL_REQ_OFFSET_PEPCTRLDATA               	5 //size 1 byte(s)
+#define SIZE_PNS_PEP_CTRL_REQ                             	6
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_PEP_CTRL_RESP
+#define PNS_PEP_CTRL_RESP                                 	0x49                                              	
+#define PNS_PEP_CTRL_RESP_OFFSET_UTID                     	0 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_SUBFUNCTION              	1 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_PIPEHANDLE               	2 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_PEPCTRLID                	3 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_PEPTYPE                  	4 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_ERRORCODE                	5 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_FILLERBYTE1              	6 //size 1 byte(s)
+#define PNS_PEP_CTRL_RESP_OFFSET_FILLERBYTE2              	7 //size 1 byte(s)
+#define SIZE_PNS_PEP_CTRL_RESP                            	8
+
+
+//Definition for PNS_PIPE_ENABLED_IND
+#define PNS_PIPE_ENABLED_IND                              	0x64                                              	
+#define PNS_PIPE_ENABLED_IND_OFFSET_UTID                  	0 //size 1 byte(s)
+#define PNS_PIPE_ENABLED_IND_OFFSET_SUBFUNCTION           	1 //size 1 byte(s)
+#define PNS_PIPE_ENABLED_IND_OFFSET_PIPEHANDLE            	2 //size 1 byte(s)
+#define PNS_PIPE_ENABLED_IND_OFFSET_FILLERBYTE1           	3 //size 1 byte(s)
+#define SIZE_PNS_PIPE_ENABLED_IND                         	4
+
+
+//Definition for PNS_PEP_ENABLE_REQ
+#define PNS_PEP_ENABLE_REQ                                	0x46                                              	
+#define PNS_PEP_ENABLE_REQ_OFFSET_UTID                    	0 //size 1 byte(s)
+#define PNS_PEP_ENABLE_REQ_OFFSET_SUBFUNCTION             	1 //size 1 byte(s)
+#define PNS_PEP_ENABLE_REQ_OFFSET_PIPEHANDLE              	2 //size 1 byte(s)
+#define PNS_PEP_ENABLE_REQ_OFFSET_FILLERBYTE1             	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_ENABLE_REQ                           	4
+
+
+//Definition for PNS_PEP_ENABLE_RESP
+#define PNS_PEP_ENABLE_RESP                               	0x47                                              	
+#define PNS_PEP_ENABLE_RESP_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_PEP_ENABLE_RESP_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_PEP_ENABLE_RESP_OFFSET_PIPEHANDLE             	2 //size 1 byte(s)
+#define PNS_PEP_ENABLE_RESP_OFFSET_ERRORCODE              	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_ENABLE_RESP                          	4
+
+
+//Definition for PNS_PIPE_DATA
+#define PNS_PIPE_DATA                                     	0x20                                              	
+#define PNS_PIPE_DATA_OFFSET_UTID                         	0 //size 1 byte(s)
+#define PNS_PIPE_DATA_OFFSET_SUBFUNCTION                  	1 //size 1 byte(s)
+#define PNS_PIPE_DATA_OFFSET_PIPEHANDLE                   	2 //size 1 byte(s)
+#define PNS_PIPE_DATA_OFFSET_DATA                         	3 //size 1 byte(s)
+#define SIZE_PNS_PIPE_DATA                                	4
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_PIPE_ALIGNED_DATA
+#define PNS_PIPE_ALIGNED_DATA                             	0x21                                              	
+#define PNS_PIPE_ALIGNED_DATA_OFFSET_UTID                 	0 //size 1 byte(s)
+#define PNS_PIPE_ALIGNED_DATA_OFFSET_SUBFUNCTION          	1 //size 1 byte(s)
+#define PNS_PIPE_ALIGNED_DATA_OFFSET_PIPEHANDLE           	2 //size 1 byte(s)
+#define PNS_PIPE_ALIGNED_DATA_OFFSET_FILLERBYTE1          	3 //size 1 byte(s)
+#define PNS_PIPE_ALIGNED_DATA_OFFSET_DATA                 	4 //size 1 byte(s)
+#define SIZE_PNS_PIPE_ALIGNED_DATA                        	5
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_PEP_STATUS_IND
+#define PNS_PEP_STATUS_IND                                	0x60                                              	
+#define PNS_PEP_STATUS_IND_OFFSET_UTID                    	0 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_SUBFUNCTION             	1 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_PIPEHANDLE              	2 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_PEPTYPE                 	3 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_INDICATIONID            	4 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_FILLERBYTE1             	5 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_FILLERBYTE2             	6 //size 1 byte(s)
+#define PNS_PEP_STATUS_IND_OFFSET_INDICATIONDATA          	7 //size 1 byte(s)
+#define SIZE_PNS_PEP_STATUS_IND                           	8
+//NOTE: Definition contains array(s) or sequence(s). SIZE_ and offsets following array or sequence might be defined incorrectly.
+
+
+//Definition for PNS_PIPE_RESET_IND
+#define PNS_PIPE_RESET_IND                                	0x63                                              	
+#define PNS_PIPE_RESET_IND_OFFSET_UTID                    	0 //size 1 byte(s)
+#define PNS_PIPE_RESET_IND_OFFSET_SUBFUNCTION             	1 //size 1 byte(s)
+#define PNS_PIPE_RESET_IND_OFFSET_PIPEHANDLE              	2 //size 1 byte(s)
+#define PNS_PIPE_RESET_IND_OFFSET_FILLERBYTE1             	3 //size 1 byte(s)
+#define SIZE_PNS_PIPE_RESET_IND                           	4
+
+
+//Definition for PNS_PEP_RESET_REQ
+#define PNS_PEP_RESET_REQ                                 	0x44                                              	
+#define PNS_PEP_RESET_REQ_OFFSET_UTID                     	0 //size 1 byte(s)
+#define PNS_PEP_RESET_REQ_OFFSET_SUBFUNCTION              	1 //size 1 byte(s)
+#define PNS_PEP_RESET_REQ_OFFSET_PIPEHANDLE               	2 //size 1 byte(s)
+#define PNS_PEP_RESET_REQ_OFFSET_PIPESTATEAFTERRESET      	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_RESET_REQ                            	4
+
+
+//Definition for PNS_PEP_RESET_RESP
+#define PNS_PEP_RESET_RESP                                	0x45                                              	
+#define PNS_PEP_RESET_RESP_OFFSET_UTID                    	0 //size 1 byte(s)
+#define PNS_PEP_RESET_RESP_OFFSET_SUBFUNCTION             	1 //size 1 byte(s)
+#define PNS_PEP_RESET_RESP_OFFSET_PIPEHANDLE              	2 //size 1 byte(s)
+#define PNS_PEP_RESET_RESP_OFFSET_ERRORCODE               	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_RESET_RESP                           	4
+
+
+//Definition for PNS_PEP_DISCONNECT_REQ
+#define PNS_PEP_DISCONNECT_REQ                            	0x42                                              	
+#define PNS_PEP_DISCONNECT_REQ_OFFSET_UTID                	0 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_REQ_OFFSET_SUBFUNCTION         	1 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_REQ_OFFSET_PIPEHANDLE          	2 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_REQ_OFFSET_FILLERBYTE1         	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_DISCONNECT_REQ                       	4
+
+
+//Definition for PNS_PEP_DISCONNECT_RESP
+#define PNS_PEP_DISCONNECT_RESP                           	0x43                                              	
+#define PNS_PEP_DISCONNECT_RESP_OFFSET_UTID               	0 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_RESP_OFFSET_SUBFUNCTION        	1 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_RESP_OFFSET_PIPEHANDLE         	2 //size 1 byte(s)
+#define PNS_PEP_DISCONNECT_RESP_OFFSET_ERRORCODE          	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_DISCONNECT_RESP                      	4
+
+
+//Definition for PNS_PIPE_REDIRECTED_IND
+#define PNS_PIPE_REDIRECTED_IND                           	0x65                                              	
+#define PNS_PIPE_REDIRECTED_IND_OFFSET_UTID               	0 //size 1 byte(s)
+#define PNS_PIPE_REDIRECTED_IND_OFFSET_SUBFUNCTION        	1 //size 1 byte(s)
+#define PNS_PIPE_REDIRECTED_IND_OFFSET_PIPEHANDLE         	2 //size 1 byte(s)
+#define PNS_PIPE_REDIRECTED_IND_OFFSET_NSB                	3 //size 1 byte(s)
+#define SIZE_PNS_PIPE_REDIRECTED_IND                      	4
+
+
+//Definition for PNS_PEP_DISABLE_REQ
+#define PNS_PEP_DISABLE_REQ                               	0x4C                                              	
+#define PNS_PEP_DISABLE_REQ_OFFSET_UTID                   	0 //size 1 byte(s)
+#define PNS_PEP_DISABLE_REQ_OFFSET_SUBFUNCTION            	1 //size 1 byte(s)
+#define PNS_PEP_DISABLE_REQ_OFFSET_PIPEHANDLE             	2 //size 1 byte(s)
+#define PNS_PEP_DISABLE_REQ_OFFSET_FILLERBYTE1            	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_DISABLE_REQ                          	4
+
+
+//Definition for PNS_PEP_DISABLE_RESP
+#define PNS_PEP_DISABLE_RESP                              	0x4D                                              	
+#define PNS_PEP_DISABLE_RESP_OFFSET_UTID                  	0 //size 1 byte(s)
+#define PNS_PEP_DISABLE_RESP_OFFSET_SUBFUNCTION           	1 //size 1 byte(s)
+#define PNS_PEP_DISABLE_RESP_OFFSET_PIPEHANDLE            	2 //size 1 byte(s)
+#define PNS_PEP_DISABLE_RESP_OFFSET_ERRORCODE             	3 //size 1 byte(s)
+#define SIZE_PNS_PEP_DISABLE_RESP                         	4
+
+/* CL Pipe defines */
 //CONSTANTS
 #define CM_PIPE_ANY_SIZE                                  	0x01                                                 	
 
@@ -338,4 +672,6 @@
 #define CM_PIPE_DISABLED_IND_OFFSET_FILLERBYTE1           	3 //size 1 byte(s)
 #define SIZE_CM_PIPE_DISABLED_IND                         	4
 
+/* end of CL Pipe defines */
+
 #endif
\ No newline at end of file
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/smsisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/smsisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,8 @@
 * Name      : PN_SMS [ 0x02 ] Resource SMS Server
 * Version   : 008.002
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
@@ -22,7 +24,7 @@
 #define _SYMBIAN_ISI_SMSISI_H_
 
 #define SMS_SERVER_ISI_VERSION_Z	 8
-#define SMS_SERVER_ISI_VERSION_Y	 2
+#define SMS_SERVER_ISI_VERSION_Y	 4
 
 
 //CONSTANTS
@@ -43,13 +45,211 @@
 #define SMS_SETTING_REPLY_PATH_MASK                       	0xFE                                              	
 #define SMS_SETTING_CONF_REQUEST                          	0x02                                                 	
 #define SMS_SETTING_CONF_REQUEST_MASK                     	0xFD                                              	
+#define SMS_TP_FCS_TEL_INTERWRK_NOT_SUPPORTED             	0x80                                              	
+#define SMS_TP_FCS_SM_TYPE0_NOT_SUPPORTED                 	0x81                                              	
+#define SMS_TP_FCS_CANNOT_REPLACE_SM                      	0x82                                              	
+#define SMS_TP_FCS_UNSPECIFIED_PID_ERR                    	0x8F                                              	
+#define SMS_TP_FCS_DCS_NOT_SUPPORTED                      	0x90                                              	
+#define SMS_TP_FCS_MESSAGE_CLASS_NOT_SUPPORTED            	0x91                                              	
+#define SMS_TP_FCS_UNSPECIFIED_DCS_ERR                    	0x9F                                              	
+#define SMS_TP_FCS_CMD_CANNOT_BE_ACTIONED                 	0xA0                                              	
+#define SMS_TP_FCS_CMD_UNSUPPORTED                        	0xA1                                              	
+#define SMS_TP_FCS_UNSPECIFIED_CMD_ERR                    	0xAF                                              	
+#define SMS_TP_FCS_TPDU_NOT_SUPPORTED                     	0xB0                                              	
+#define SMS_TP_FCS_SC_BUSY                                	0xC0                                              	
+#define SMS_TP_FCS_NO_SC_SUBSCRIPTION                     	0xC1                                              	
+#define SMS_TP_FCS_SC_SYSTEM_FAILURE                      	0xC2                                              	
+#define SMS_TP_FCS_INVALID_SME_ADDR                       	0xC3                                              	
+#define SMS_TP_FCS_DEST_SME_BARRED                        	0xC4                                              	
+#define SMS_TP_FCS_SM_REJECTED_DUPLICATE_SM               	0xC5                                              	
+#define SMS_TP_FCS_TP_VPF_NOT_SUPPORTED                   	0xC6                                              	
+#define SMS_TP_FCS_TP_VP_NOT_SUPPORTED                    	0xC7                                              	
+#define SMS_TP_FCS_SIM_STORAGE_FULL                       	0xD0                                              	
+#define SMS_TP_FCS_NO_STORAGE_IN_SIM                      	0xD1                                              	
+#define SMS_TP_FCS_ERROR_IN_MS                            	0xD2                                              	
+#define SMS_TP_FCS_MEM_CAP_EXCEEDED                       	0xD3                                              	
+#define SMS_TP_FCS_SIM_ATK_BUSY                           	0xD4                                              	
+#define SMS_TP_FCS_SIM_DATA_DOWNLOAD_ERROR                	0xD5                                              	
+#define SMS_TP_FCS_UNSPECIFIED                            	0xFF                                              	
+#define SMS_TP_MTI_MASK                                   	0x03                                                 	
+#define SMS_TP_MTI_DELIVER                                	0x00                                                 	
+#define SMS_TP_MTI_DELIVER_REPORT                         	0x00                                                 	
+#define SMS_TP_MTI_STATUS_REPORT                          	0x02                                                 	
+#define SMS_TP_MTI_COMMAND                                	0x02                                                 	
+#define SMS_TP_MTI_SUBMIT                                 	0x01                                                 	
+#define SMS_TP_MTI_SUBMIT_REPORT                          	0x01                                                 	
+#define SMS_TP_MTI_UNDEFINED                              	0x03                                                 	
+#define SMS_TP_MMS_MASK                                   	0x04                                                 	
+#define SMS_TP_MMS_MORE_MESSAGES                          	0x00                                                 	
+#define SMS_TP_MMS_NO_MORE_MESSAGES                       	0x04                                                 	
+#define SMS_TP_VPF_MASK                                   	0x18                                              	
+#define SMS_TP_VPF_NOT_PRESENT                            	0x00                                                 	
+#define SMS_TP_VPF_RELATIVE_FORMAT                        	0x10                                              	
+#define SMS_TP_VPF_ENHANCED_FORMAT                        	0x08                                                 	
+#define SMS_TP_VPF_ABSOLUTE_FORMAT                        	0x18                                              	
+#define SMS_TP_VP_RF_WEEK_BASE_VALUE                      	0xC0                                              	
+#define SMS_TP_VP_RF_DAY_BASE_VALUE                       	0xA6                                              	
+#define SMS_TP_VP_RF_HOUR_BASE_VALUE                      	0x8F                                              	
+#define SMS_TP_SRI_MASK                                   	0x20                                              	
+#define SMS_TP_SRI_NOT_RETURNED                           	0x00                                                 	
+#define SMS_TP_SRI_RETURNED                               	0x20                                              	
+#define SMS_TP_SRR_MASK                                   	0x20                                              	
+#define SMS_TP_SRR_NOT_REQUESTED                          	0x00                                                 	
+#define SMS_TP_SRR_REQUESTED                              	0x20                                              	
+#define SMS_TP_RP_MASK                                    	0x80                                              	
+#define SMS_TP_RP_NOT_SET                                 	0x00                                                 	
+#define SMS_TP_RP_SET                                     	0x80                                              	
+#define SMS_TP_RD_MASK                                    	0x04                                                 	
+#define SMS_TP_RD_ACCEPT                                  	0x00                                                 	
+#define SMS_TP_RD_REJECT                                  	0x04                                                 	
+#define SMS_TP_SRQ_MASK                                   	0x20                                              	
+#define SMS_TP_SRQ_SUBMIT                                 	0x00                                                 	
+#define SMS_TP_SRQ_COMMAND                                	0x20                                              	
+#define SMS_TP_UDHI_MASK                                  	0x40                                              	
+#define SMS_TP_UDHI_MESSAGE                               	0x00                                                 	
+#define SMS_TP_UDHI_HEADER_MESSAGE                        	0x40                                              	
+#define SMS_TP_PI_EXTENSION_BIT_MASK                      	0x80                                              	
+#define SMS_TP_PI_EXTENSION_AVAIL                         	0x80                                              	
+#define SMS_TP_PI_EXTENSION_NOT_AVAIL                     	0x00                                                 	
+#define SMS_TP_PI_UDL_AVAIL                               	0x04                                                 	
+#define SMS_TP_PI_UDL_NOT_AVAIL                           	0x00                                                 	
+#define SMS_TP_PI_DCS_AVAIL                               	0x02                                                 	
+#define SMS_TP_PI_DCS_NOT_AVAIL                           	0x00                                                 	
+#define SMS_TP_PI_PID_AVAIL                               	0x01                                                 	
+#define SMS_TP_PI_PID_NOT_AVAIL                           	0x00                                                 	
+#define SMS_TP_DCS_SMS_GDC_UNCOMPRESSED                   	0x00                                                 	
+#define SMS_TP_DCS_SMS_GDC_COMPRESSED                     	0x20                                              	
+#define SMS_TP_DCS_SMS_GDC_NO_CLASS_MEANING               	0x00                                                 	
+#define SMS_TP_DCS_SMS_GDC_CLASS_MEANING                  	0x10                                              	
+#define SMS_TP_DCS_SMS_GDC_CS_GSM_7BIT                    	0x00                                                 	
+#define SMS_TP_DCS_SMS_GDC_CS_8BIT                        	0x04                                                 	
+#define SMS_TP_DCS_SMS_GDC_CS_UCS2                        	0x08                                                 	
+#define SMS_TP_DCS_SMS_GDC_CS_RESERVED                    	0x0C                                                 	
+#define SMS_TP_DCS_SMS_GDC_CLASS0                         	0x00                                                 	
+#define SMS_TP_DCS_SMS_GDC_CLASS1_ME                      	0x01                                                 	
+#define SMS_TP_DCS_SMS_GDC_CLASS2_SIM                     	0x02                                                 	
+#define SMS_TP_DCS_SMS_GDC_CLASS3_TE                      	0x03                                                 	
+#define SMS_TP_DCS_SMS_MWI_IS_INACTIVE                    	0x00                                                 	
+#define SMS_TP_DCS_SMS_MWI_IS_ACTIVE                      	0x08                                                 	
+#define SMS_TP_DCS_SMS_MWI_VOICEMAIL                      	0x00                                                 	
+#define SMS_TP_DCS_SMS_MWI_FAX                            	0x01                                                 	
+#define SMS_TP_DCS_SMS_MWI_EMAIL                          	0x02                                                 	
+#define SMS_TP_DCS_SMS_MWI_OTHER                          	0x03                                                 	
+#define SMS_TP_DCS_SMS_DATA_CODING_MESSAGE_CLASS          	0xF0                                              	
+#define SMS_TP_DCS_SMS_DCMC_MC_GSM_7BIT                   	0x00                                                 	
+#define SMS_TP_DCS_SMS_DCMC_MC_GSM_8BIT                   	0x02                                                 	
+#define SMS_TP_DCS_SMS_DCMC_MC_UCS2                       	0x04                                                 	
+#define SMS_TP_DCS_SMS_DCMC_CLASS0                        	0x00                                                 	
+#define SMS_TP_DCS_SMS_DCMC_CLASS1_ME                     	0x01                                                 	
+#define SMS_TP_DCS_SMS_DCMC_CLASS2_SIM                    	0x02                                                 	
+#define SMS_TP_DCS_SMS_DCMC_CLASS3_TE                     	0x03                                                 	
+#define SMS_TP_DCS_SMS_ADG_MASK_FOR_GDC                   	0x40                                              	
+#define SMS_TP_DCS_MSG_WAITING_MASK                       	0xF0                                              	
+#define SMS_TP_DCS_MSG_WAITING_DISCARD                    	0xC0                                              	
+#define SMS_TP_DCS_MSG_WAITING_STORE                      	0xD0                                              	
+#define SMS_TP_DCS_MSG_WAITING_UCS2                       	0xE0                                              	
+#define SMS_TP_DCS_CBS_LANGUAGE_GSM_7BIT                  	0x00                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_GERMAN                    	0x00                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_ENGLISH                   	0x01                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_ITALIAN                   	0x02                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_FRENCH                    	0x03                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_SPANISH                   	0x04                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_DUTCH                     	0x05                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_SWEDISH                   	0x06                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_DANISH                    	0x07                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_PORTUGESE                 	0x08                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_FINNISH                   	0x09                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_NORWEGIAN                 	0x0A                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_GREEK                     	0x0B                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_TURKISH                   	0x0C                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_HUNGARIAN                 	0x0D                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_POLISH                    	0x0E                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_UNSPECIFIED               	0x0F                                                 	
+#define SMS_TP_DCS_CBS_LANGUAGE_INDICATED_GSM_7BIT        	0x10                                              	
+#define SMS_TP_DCS_CBS_LANGUAGE_INDICATED_UCS2            	0x11                                              	
+#define SMS_TP_DCS_CBS_LANGUAGE_GSM_7BIT_EXTENDED         	0x10                                              	
+#define SMS_TP_DCS_CBS_GSM_7BIT_CZECH                     	0x00                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_HEBREW                    	0x01                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_ARABIC                    	0x02                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_RUSSIAN                   	0x03                                                 	
+#define SMS_TP_DCS_CBS_GSM_7BIT_ICELANDIC                 	0x04                                                 	
+#define SMS_TP_DCS_CBS_GENERAL_DATA_CODING                	0x40                                              	
+#define SMS_TP_DCS_CBS_GDC_UNCOMPRESSED                   	0x00                                                 	
+#define SMS_TP_DCS_CBS_GDC_COMPRESSED                     	0x20                                              	
+#define SMS_TP_DCS_CBS_GDC_NO_CLASS_MEANING               	0x00                                                 	
+#define SMS_TP_DCS_CBS_GDC_CLASS_MEANING                  	0x10                                              	
+#define SMS_TP_DCS_CBS_GDC_CS_GSM_7BIT                    	0x00                                                 	
+#define SMS_TP_DCS_CBS_GDC_CS_8BIT                        	0x04                                                 	
+#define SMS_TP_DCS_CBS_GDC_CS_UCS2                        	0x08                                                 	
+#define SMS_TP_DCS_CBS_GDC_CS_RESERVED                    	0x0C                                                 	
+#define SMS_TP_DCS_CBS_GDC_CLASS0                         	0x00                                                 	
+#define SMS_TP_DCS_CBS_GDC_CLASS1_ME                      	0x01                                                 	
+#define SMS_TP_DCS_CBS_GDC_CLASS2_SIM                     	0x02                                                 	
+#define SMS_TP_DCS_CBS_GDC_CLASS3_TE                      	0x03                                                 	
+#define SMS_TP_DCS_CBS_WAP_MESSAGES                       	0xF0                                              	
+#define SMS_TP_DCS_CBS_DATA_CODING_MSG_HANDLING           	0xF0                                              	
+#define SMS_TP_DCS_CBS_DCMH_MC_GSM_7BIT                   	0x00                                                 	
+#define SMS_TP_DCS_CBS_DCMH_MC_GSM_8BIT                   	0x02                                                 	
+#define SMS_TP_DCS_CBS_DCMH_MC_UCS2                       	0x04                                                 	
+#define SMS_TP_DCS_CBS_DCMH_CLASS0                        	0x00                                                 	
+#define SMS_TP_DCS_CBS_DCMH_CLASS1_ME                     	0x01                                                 	
+#define SMS_TP_DCS_CBS_DCMH_CLASS2_SIM                    	0x02                                                 	
+#define SMS_TP_DCS_CBS_DCMH_CLASS3_TE                     	0x03                                                 	
+#define SMS_TP_ADDR_TON_MASK                              	0x70                                              	
+#define SMS_TP_ADDR_TON_UNKNOWN                           	0x00                                                 	
+#define SMS_TP_ADDR_TON_INTERNATIONAL                     	0x10                                              	
+#define SMS_TP_ADDR_TON_NATIONAL                          	0x20                                              	
+#define SMS_TP_ADDR_TON_NETW_SPECIFIC                     	0x30                                              	
+#define SMS_TP_ADDR_TON_SUBSCRIBER                        	0x40                                              	
+#define SMS_TP_ADDR_TON_ALPHANUMERIC                      	0x50                                              	
+#define SMS_TP_ADDR_TON_ABBREVIATED                       	0x60                                              	
+#define SMS_TP_ADDR_TON_RESERVED                          	0x70                                              	
+#define SMS_RP_ADDR_TON_MASK                              	0x70                                              	
+#define SMS_RP_ADDR_TON_UNKNOWN                           	0x00                                                 	
+#define SMS_RP_ADDR_TON_INTERNATIONAL                     	0x10                                              	
+#define SMS_RP_ADDR_TON_NATIONAL                          	0x20                                              	
+#define SMS_RP_ADDR_TON_NETW_SPECIFIC                     	0x30                                              	
+#define SMS_RP_ADDR_TON_DEDIC_ACCESS                      	0x40                                              	
+#define SMS_RP_ADDR_TON_RESERVED                          	0x70                                              	
+#define SMS_RP_ADDR_NPI_MASK                              	0x0F                                                 	
+#define SMS_RP_ADDR_NPI_UNKNOWN                           	0x00                                                 	
+#define SMS_RP_ADDR_NPI_ISDN                              	0x01                                                 	
+#define SMS_RP_ADDR_NPI_DATA                              	0x03                                                 	
+#define SMS_RP_ADDR_NPI_TELEX                             	0x04                                                 	
+#define SMS_RP_ADDR_NPI_NATIONAL                          	0x08                                                 	
+#define SMS_RP_ADDR_NPI_PRIVATE                           	0x09                                                 	
+#define SMS_RP_ADDR_NPI_RES_CTS                           	0x0B                                                 	
+#define SMS_RP_ADDR_NPI_RESERVED                          	0x0F                                                 	
+#define SMS_TP_ADDR_NPI_MASK                              	0x0F                                                 	
+#define SMS_TP_ADDR_NPI_UNKNOWN                           	0x00                                                 	
+#define SMS_TP_ADDR_NPI_ISDN                              	0x01                                                 	
+#define SMS_TP_ADDR_NPI_DATA                              	0x03                                                 	
+#define SMS_TP_ADDR_NPI_TELEX                             	0x04                                                 	
+#define SMS_TP_ADDR_NPI_SC_SPECIFIC1                      	0x05                                                 	
+#define SMS_TP_ADDR_NPI_SC_SPECIFIC2                      	0x06                                                 	
+#define SMS_TP_ADDR_NPI_NATIONAL                          	0x08                                                 	
+#define SMS_TP_ADDR_NPI_PRIVATE                           	0x09                                                 	
+#define SMS_TP_ADDR_NPI_ERMES                             	0x0A                                                 	
+#define SMS_TP_ADDR_NPI_RESERVED                          	0x0F                                                 	
+#define SMS_SRV_CB_MAX_SUBSCRIPTION_NR                    	0xFF                                              	
+#define SMS_SRV_CB_MAX_CLIENT_AMOUNT                      	0x0B                                                 	
+#define SMS_SRV_CB_MAX_CBMID_COUNT                        	0xC8                                              	
+#define SMS_SRV_CB_MAX_LANGUAGE_COUNT                     	0x11                                              	
+#define SMS_SRV_CB_DCS_ELEMENT_SIZE                       	0x01                                                 	
+#define SMS_SRV_CB_CBMID_ELEMENT_SIZE                     	0x02                                                 	
+#define SMS_CB_SUBSCRIPTION_ID_SIZE                       	0x01                                                 	
 #define SMS_ANY_SIZE                                      	0x01                                                 	
 #define SMS_CONCATENATED_UD_MAX_LEN                       	0x857A                                            	
+//#define SMS_TP_VPF_RELATIVE                               	0x01                                                 	
+//#define SMS_TP_VPF_ABSOLUTE_OR_ENHANCED                   	0x07                                                 	
 #define SMS_PARAM_INDICATOR_MAX_LEN                       	0x0A                                                 	
 #define SMS_SC_TIME_STAMP_SIZE                            	0x07                                                 	
 #define SMS_DEFAULT_PARAMETER_LOCATION                    	0x00                                                 	
 #define SMS_NEW_SUBSCRIPTION                              	0x00                                                 	
 
+#define SMS_VPF_RELATIVE                                  	0x01                                                 	
+#define SMS_VPF_ABSOLUTE_OR_ENHANCED                      	0x07                                                 	
+
 
 //TABLES
 
@@ -246,8 +446,6 @@
 //ConstantTable for SMS_CONTENT_TYPE
 
 //ConstantTable for SMS_VALIDITY_PERIOD_FORMAT
-#define SMS_VPF_RELATIVE                                  	0x01                                                 	
-#define SMS_VPF_ABSOLUTE_OR_ENHANCED                      	0x07                                                 	
 
 //ConstantTable for SMS_SERVER_STATUS
 #define SMS_SERVER_READY                                  	0x00                                                 	
@@ -408,16 +606,6 @@
 #define SIZE_SMS_SB_COMMAND                               	12
 
 
-//Definition for SMS_SB_MO_UNDEFINED
-#define SMS_SB_MO_UNDEFINED                               	0x1F                                              	
-#define SMS_SB_MO_UNDEFINED_OFFSET_SUBBLOCKID             	0 //size 2 byte(s)
-#define SMS_SB_MO_UNDEFINED_OFFSET_SUBBLOCKLENGTH         	2 //size 2 byte(s)
-#define SMS_SB_MO_UNDEFINED_OFFSET_MESSAGEPARAMETERS      	4 //size 1 byte(s)
-#define SMS_SB_MO_UNDEFINED_OFFSET_MESSAGEREFERENCE       	5 //size 1 byte(s)
-#define SMS_SB_MO_UNDEFINED_OFFSET_FILLERBYTE1            	6 //size 2 byte(s)
-#define SIZE_SMS_SB_MO_UNDEFINED                          	8
-
-
 //Definition for SMS_SB_DELIVER_REPORT
 #define SMS_SB_DELIVER_REPORT                             	0x19                                              	
 #define SMS_SB_DELIVER_REPORT_OFFSET_SUBBLOCKID           	0 //size 2 byte(s)
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/ss_wmisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/ss_wmisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -13,7 +13,9 @@
 * 
 * Description:
 * Name      : PN_SS [ 0x06 ] Resource Supplementary Services Server
-* Version   : 013.000
+* Version   : 014.000
+*
+* Documentation: www.wirelessmodemapi.com
 *
 */
 
@@ -21,7 +23,7 @@
 #ifndef _SYMBIAN_ISI_SS_WMISI_H_
 #define _SYMBIAN_ISI_SS_WMISI_H_
 
-#define SUPPLEMENTARY_SERVICES_SERVER_ISI_VERSION_Z	 13
+#define SUPPLEMENTARY_SERVICES_SERVER_ISI_VERSION_Z	 14
 #define SUPPLEMENTARY_SERVICES_SERVER_ISI_VERSION_Y	 0
 
 
--- a/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/uiccisi.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/isimessage/symbianisamacroif/include/wgmodem25/uiccisi.h	Thu Jan 14 10:44:58 2010 +0200
@@ -15,6 +15,8 @@
 * Name      : PN_UICC [ 0x8C ] Resource UICC Server
 * Version   : 003.000
 *
+* Documentation: www.wirelessmodemapi.com
+*
 */
 
 
--- a/connectivitylayer/rom/connectivitylayer.iby	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/rom/connectivitylayer.iby	Thu Jan 14 10:44:58 2010 +0200
@@ -20,12 +20,9 @@
 #define CONNECTIVITYLAYER_IBY
 
 #include <usbphonetlink.iby>
-
-#ifdef NCP_COMMON_BRIDGE_FAMILY
 #include <isce.iby>
 #include <isimessage.iby>
 #include <isimessagekernel.iby>
-#endif
 
 #endif // CONNECTIVITYLAYER_IBY
 
--- a/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/inc/usbpnclasscontroller.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/inc/usbpnclasscontroller.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -34,18 +34,15 @@
 
 /**
 *  CUsbPNClassController
-*  This class implements the Usb Isa class controller used to control the usb media.
-*  See Lotus Notes:
-*  TSW Docman / Core Components Factory / USB PhoNet Link / Design
-*  ID:
+*  This class implementation needed for USB Manager to start and stop the service.
 */
 class CUsbPNClassController : public CUsbClassControllerPlugIn
     {
-    public: // New functions.
+    public:
         /**
-        * Constructs a CUsbIsaClassController object.
+        * Constructs a CUsbPNClassController object.
         * @param MUsbClassControllerNotify& aOwner  USB Device that owns and manages the class
-        * @return static CUsbIsaClassController*    A new CUsbIsaClassController object
+        * @return static CUsbPNClassController*     A new CUsbPNClassController object
         */
         static CUsbPNClassController* NewL(MUsbClassControllerNotify& aOwner);
 
@@ -106,5 +103,6 @@
 
     };
 
+#endif // USBPNCLASSCONTROLLER_H
 
-#endif // #ifndef USBPNCLASSCONTROLLER_H
+// End of File
--- a/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/src/usbpnclasscontroller.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/src/usbpnclasscontroller.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,7 +20,7 @@
 #include "usbpndefinitions.h"
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"    // For tracing
+#include "OstTraceDefinitions.h"    // For tracing
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "usbpnclasscontrollerTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnclasscontroller_dll/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -18,5 +18,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,7 +21,7 @@
 #include "usbpndefinitions.h"
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "rusbpnclientTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnclient_dll/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnclient_dll/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -18,5 +18,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpninterface.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpninterface.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -86,7 +86,6 @@
 
         /**
         * Activates data transfer mode when USB host selects alternate setting.
-        * @since Series ?XX ?SeriesXX_version
         * @param TUint aAltSetNumber. 0 for altset zero. 1 for data transfer mode.
         */
         void SetAltSetting( TUint aAltSetNumber );
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -63,9 +63,7 @@
 
         /**
         * From MUsbPnControlObserver. Adds packet to send queue.
-        * @since Series ?XX ?SeriesXX_version
-        * @param ?arg1 ?description
-        * @return ?description
+        * @param aPacket
         */
         void Send( CUsbPnPacket& aPacket );
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnscheduler.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnscheduler.h	Thu Jan 14 10:44:58 2010 +0200
@@ -47,8 +47,6 @@
 
         /**
         * Starts USB Phonet Link server thread and the server itself.
-        * @since Series ?XX ?SeriesXX_version
-        * @param
         * @return Starting status
         */
         IMPORT_C static TInt ThreadStart();
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnbufferlistener.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnbufferlistener.h	Thu Jan 14 10:44:58 2010 +0200
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -34,9 +34,7 @@
 
         /**
         * Continue receive if buffer queue has room again.
-        * @since Series ?XX ?SeriesXX_version
         * @param TBool aDiscard
-        * @return ?description
         */
         virtual void Receive( TBool aDiscard ) = 0;
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h	Thu Jan 14 10:44:58 2010 +0200
@@ -34,17 +34,11 @@
 
         /**
         * Get packet for sending.
-        * @since Series ?XX ?SeriesXX_version
-        * @param ?arg1 ?description
-        * @return ?description
         */
         virtual CUsbPnPacket& PacketL() = 0;
 
         /**
         * Send packet.
-        * @since Series ?XX ?SeriesXX_version
-        * @param ?arg1 ?description
-        * @return ?description
         */
         virtual void Send( CUsbPnPacket& aPacket ) = 0;
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnalt.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnalt.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,7 +21,7 @@
 #include "usbpntrace.h"
 #include "musbpnaltobserver.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnaltTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpninterface.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpninterface.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -25,7 +25,7 @@
 #include "usbpndefinitions.h"       // For constants
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpninterfaceTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 #include "usbpndefinitions.h"   // For constants
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnisareceiverTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 #include "usbpndefinitions.h"
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnisasenderTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnpacket.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnpacket.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,7 +20,7 @@
 #include "usbpndefinitions.h"
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnpacketTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnscheduler.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnscheduler.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -20,7 +20,7 @@
 #include    "cusbpnserver.h"
 #include    "usbpntrace.h"
 
-#include    "osttracedefinitions.h"
+#include    "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include    "cusbpnschedulerTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,7 +21,7 @@
 #include    "cusbpninterface.h"
 #include    "usbpntrace.h"
 
-#include    "osttracedefinitions.h"
+#include    "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include    "cusbpnserverTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserversession.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnserversession.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -21,7 +21,7 @@
 #include "usbpndefinitions.h"
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnserversessionTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 #include "usbpndefinitions.h"       // For constants
 #include "usbpntrace.h"             // For tracing
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnusbreceiverTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -22,7 +22,7 @@
 #include "usbpndefinitions.h"       // For constants
 #include "usbpntrace.h"
 
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cusbpnusbsenderTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/usbpnexe.cpp	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/usbpnexe.cpp	Thu Jan 14 10:44:58 2010 +0200
@@ -19,7 +19,7 @@
 #include    "cusbpnscheduler.h"
 #include    "usbpntrace.h"
 
-#include    "osttracedefinitions.h"
+#include    "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include    "usbpnexeTraces.h"
 #endif
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/traces/osttracedefinitions.h	Mon Nov 09 10:36:19 2009 +0000
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/traces/osttracedefinitions.h	Thu Jan 14 10:44:58 2010 +0200
@@ -18,5 +18,5 @@
 
 #ifndef __OSTTRACEDEFINITIONS_H__
 #define __OSTTRACEDEFINITIONS_H__
-#include <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif