New release based on our 2010wk15 release
authormikaruus <mika.a.ruuskanen@nokia.com>
Wed, 21 Apr 2010 14:29:55 +0300
changeset 8 6295dc2169f3
parent 7 fa67e03b87df
child 9 8486d82aef45
New release based on our 2010wk15 release
adaptationlayer/bcaiscadapter/group/bld.inf
adaptationlayer/dataport/group/bld.inf
adaptationlayer/devicemodecontroller/boot_reason_plat/group/bld.inf
adaptationlayer/devicemodecontroller/config/dmc.cfg
adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp
adaptationlayer/devicemodecontroller/group/bld.inf
adaptationlayer/group/bld.inf
adaptationlayer/modematadaptation/group/bld.inf
adaptationlayer/modematadaptation/modematcommon_dll/group/bld.inf
adaptationlayer/modematadaptation/modematcontroller_dll/group/bld.inf
adaptationlayer/modematadaptation/modematcontroller_exe/group/bld.inf
adaptationlayer/modematadaptation/modematcontroller_exe/inc/catmessage.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsession.h
adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h
adaptationlayer/modematadaptation/modematcontroller_exe/src/catmessage.cpp
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/bld.inf
adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp
adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss
adaptationlayer/systemstatemanageradaptation/group/bld.inf
adaptationlayer/tsy/group/bld.inf
adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp
adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketcontextmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketmesshandlercontextlist.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/cmmphonemesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmussdmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h
adaptationlayer/tsy/nokiatsy_dll/inc/operators.h
adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.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/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/cmmphonemesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp
adaptationlayer/tsy/simatktsy_dll/inc/satmessaging.h
adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h
adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h
adaptationlayer/tsy/simatktsy_dll/inc/satnotifications.h
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/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/satutil.cpp
connectivitylayer/group/bld.inf
connectivitylayer/isce/group/bld.inf
connectivitylayer/isce/isaaccessextension_dll/inc/iadhelpers.h
connectivitylayer/isce/isaaccessextension_dll/inc/iadtrace.h
connectivitylayer/isce/isaaccessextension_dll/src/router.cpp
connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp
connectivitylayer/isce/iscapi_dll/src/isaapi.cpp
connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp
connectivitylayer/isce/p2prouter_dll/src/p2prouter.cpp
connectivitylayer/isimessage/group/bld.inf
connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp
connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp
connectivitylayer/usbphonetlink/group/bld.inf
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/cusbpnusbreceiver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp
group/bld.inf
rom/bld.inf
--- a/adaptationlayer/bcaiscadapter/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/bcaiscadapter/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -21,7 +21,7 @@
 
 PRJ_PLATFORMS
 
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 ../rom/bcaiscadapter.iby                          NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(bcaiscadapter.iby)
--- a/adaptationlayer/dataport/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/dataport/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 ../rom/dataport.iby				NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(dataport.iby)
--- a/adaptationlayer/devicemodecontroller/boot_reason_plat/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/devicemodecontroller/boot_reason_plat/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -21,7 +21,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 
--- a/adaptationlayer/devicemodecontroller/config/dmc.cfg	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/devicemodecontroller/config/dmc.cfg	Wed Apr 21 14:29:55 2010 +0300
@@ -26,6 +26,6 @@
 // Used temporary as long as wee need MTC-server for testing
 //MACRO USE_MTC_SERVER
 
-#endif DMC_CFG
+#endif
 
 // End of File
--- a/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/devicemodecontroller/dmc_ext/src/dmc_mce_isi.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -159,23 +159,24 @@
     TInt retVal(KErrNone);
 
 #ifdef USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MTC_STATE_QUERY_RESP_OFFSET_TRANSID)]);
     TUint8 modemCurrentState(aMsgPtr[ISI_MSG(MTC_STATE_QUERY_RESP_OFFSET_CURRENT)]);
     TUint8 modemTargetState(aMsgPtr[ISI_MSG(MTC_STATE_QUERY_RESP_OFFSET_TARGET)]);
 
     DMC_TRACE((("DMC:MCE_ISIMSG: MceModemStateQueryResp() - trId: %d, modemCurrentState: 0x%x, modemTargetState: 0x%x:"),
-                 trId, modemCurrentState, modemTargetState));
+                 TUint8(aMsgPtr[ISI_MSG(MTC_STATE_QUERY_RESP_OFFSET_TRANSID)]), 
+				 modemCurrentState, modemTargetState));
 
 #else // USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_QUERY_RESP_OFFSET_TRANSID)]);
     TUint8 modemCurrentState(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_QUERY_RESP_OFFSET_CURRENT)]);
     TUint8 modemTargetState(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_QUERY_RESP_OFFSET_TARGET)]);
 
     OstTraceExt3(TRACE_FLOW, DMC_MCE_ISI_MCE_STATE_QUERY_RESP_1,
                  "DMC:MCE_ISIMSG: MceModemStateQueryResp() - trId: %d, modemCurrentState: 0x%x, modemTargetState: 0x%x:",
-                 trId, modemCurrentState, modemTargetState);
+                 TUint8(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_QUERY_RESP_OFFSET_TRANSID)]), 
+				 modemCurrentState, modemTargetState);
     DMC_TRACE((("DMC:MCE_ISIMSG: MceModemStateQueryResp() - trId: %d, modemCurrentState: 0x%x, modemTargetState: 0x%x:"),
-                 trId, modemCurrentState, modemTargetState));
+                 TUint8(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_QUERY_RESP_OFFSET_TRANSID)]), 
+				 modemCurrentState, modemTargetState));
 #endif // USE_MTC_SERVER
 
     // Check if Modem has already powered up. 
@@ -251,21 +252,26 @@
               "DMC:MCE_ISIMSG: MceResetResp() # IN");
     DMC_TRACE(("DMC:MCE_ISIMSG: MceResetResp() # IN"));
 
-#if USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_TRANSID)]);
-    TUint8 status(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_STATUS)]);
-#else // USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)]);
-    TUint8 status(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)]);
-#endif // USE_MTC_SERVER
     /* Modem reset cannot fail, thus just print out 
        received information. */
+#if USE_MTC_SERVER
     OstTraceExt2(TRACE_FLOW, DMC_MCE_ISI_MCE_POWER_OFF_RESP_1,
                  "DMC:MCE_ISIMSG: McePowerOff() - trId: %d, status: 0x%x",
-                 trId, status);
+                 TUint8(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_STATUS)]));
+    DMC_TRACE(("DMC:MCE_ISIMSG: McePowerOff() - trId: %d, status: 0x%x"),
+                 TUint8(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MTC_POWER_OFF_RESP_OFFSET_STATUS)]));
+#else // USE_MTC_SERVER
+   OstTraceExt2(TRACE_FLOW, DMC_MCE_ISI_MCE_POWER_OFF_RESP_1,
+                 "DMC:MCE_ISIMSG: McePowerOff() - trId: %d, status: 0x%x",
+                 TUint8((aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)])), 
+				 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)]));
     DMC_TRACE((("DMC:MCE_ISIMSG: McePowerOff() - trId: %d, status: 0x%x"),
-                 trId, status));
-
+                 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)])));
+#endif // USE_MTC_SERVER
+ 
     OstTrace0(TRACE_ENTRY_EXIT, DMC_MCE_ISI_MCE_POWER_OFF_RETURN,
               "DMC:MCE_ISIMSG: McePowerOff() # OUT");
     DMC_TRACE(("DMC:MCE_ISIMSG: MceResetResp() # OUT"));
@@ -320,24 +326,26 @@
               "DMC:MCE_ISIMSG: MceResetResp() # IN");
     DMC_TRACE(("DMC:MCE_ISIMSG: MceResetResp() # IN"));
 
-#if USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_TRANSID)]);
-    TUint8 status(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_STATUS)]);
-
-#else // USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)]);
-    TUint8 status(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)]);
-
-
-#endif // USE_MTC_SERVER
-
     /* Modem reset cannot fail, thus just print out 
        received information. */
-    OstTraceExt2(TRACE_FLOW, DMC_MCE_ISI_MCE_RESET_RESP_1,
+
+#if USE_MTC_SERVER
+    OstTraceExt2(TRACE_FLOW, DMC_MCE_ISI_MCE_POWER_OFF_RESP_1,
                  "DMC:MCE_ISIMSG: MceResetResp() - trId: %d, status: 0x%x",
-                 trId, status);
+                 TUint8(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_STATUS)]));
+    DMC_TRACE(("DMC:MCE_ISIMSG: MceResetResp() - trId: %d, status: 0x%x"),
+                 TUint8(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MTC_RESET_GENERATE_RESP_OFFSET_STATUS)]));
+#else // USE_MTC_SERVER
+   OstTraceExt2(TRACE_FLOW, DMC_MCE_ISI_MCE_POWER_OFF_RESP_1,
+                 "DMC:MCE_ISIMSG: MceResetResp() - trId: %d, status: 0x%x",
+                 TUint8((aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)])), 
+				 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)]));
     DMC_TRACE((("DMC:MCE_ISIMSG: MceResetResp() - trId: %d, status: 0x%x"),
-                 trId, status));
+                 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_TRANSID)]), 
+				 TUint8(aMsgPtr[ISI_MSG(MCE_RESET_RESP_OFFSET_STATUS)])));
+#endif // USE_MTC_SERVER
 
     OstTrace0(TRACE_ENTRY_EXIT, DMC_MCE_ISI_MCE_RESET_RESP_RETURN,
               "DMC:MCE_ISIMSG: MceResetResp() # OUT");
@@ -355,23 +363,29 @@
     DMC_TRACE(("DMC:MCE_ISIMSG: MceModemStateInd() # IN"));
 
 #if USE_MTC_SERVER
-    TUint8 trId(aMsgPtr[ISI_MSG(MTC_STATE_INFO_IND_OFFSET_TRANSID)]);
     aModemState  = aMsgPtr[ISI_MSG(MTC_STATE_INFO_IND_OFFSET_STATE)];
     aModemAction = aMsgPtr[ISI_MSG(MTC_STATE_INFO_IND_OFFSET_ACTION)];
+	OstTraceExt3(TRACE_FLOW, DMC_MCE_ISI_MCE_STATE_IND_1,
+                "DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x",
+                TUint8(aMsgPtr[ISI_MSG(MTC_STATE_INFO_IND_OFFSET_TRANSID)]), 
+				aModemState, aModemAction);
+    DMC_TRACE((("DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x"),
+                TUint8(aMsgPtr[ISI_MSG(MTC_STATE_INFO_IND_OFFSET_TRANSID)]), 
+				aModemState, aModemAction));
 
 #else // USE_MTC_SERVER
-        TUint8 trId(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_IND_OFFSET_TRANSID)]);
     aModemState  = aMsgPtr[ISI_MSG(MCE_MODEM_STATE_IND_OFFSET_STATE)];
     aModemAction = aMsgPtr[ISI_MSG(MCE_MODEM_STATE_IND_OFFSET_ACTION)];
+    OstTraceExt3(TRACE_FLOW, DMC_MCE_ISI_MCE_STATE_IND_1,
+                "DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x",
+                TUint8(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_IND_OFFSET_TRANSID)]), 
+				aModemState, aModemAction);
+    DMC_TRACE((("DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x"),
+                TUint8(aMsgPtr[ISI_MSG(MCE_MODEM_STATE_IND_OFFSET_TRANSID)]), 
+				aModemState, aModemAction));
 
 #endif // USE_MTC_SERVER
 
-    OstTraceExt3(TRACE_FLOW, DMC_MCE_ISI_MCE_STATE_IND_1,
-                 "DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x",
-                 trId, aModemState, aModemAction);
-    DMC_TRACE((("DMC:MCE_ISIMSG: MceModemStateInd() - trId: %d, aModemState: 0x%x, aModemAction: 0x%x"),
-                 trId, aModemState, aModemAction));
-
     OstTrace0(TRACE_ENTRY_EXIT, DMC_MCE_ISI_MCE_STATE_IND_RETURN,
               "DMC:MCE_ISIMSG: MceModemStateInd() # OUT");
     DMC_TRACE(("DMC:MCE_ISIMSG: MceModemStateInd() # OUT"));
--- a/adaptationlayer/devicemodecontroller/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/devicemodecontroller/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -21,7 +21,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 // Remove comments if the default "boot reason API" is needed.
 //#include "../internal/boot_reason_api_dummy/group/bld.inf"
--- a/adaptationlayer/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -19,7 +19,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 #include "../bcaiscadapter/group/bld.inf"
 #include "../devicemodecontroller/group/bld.inf"
--- a/adaptationlayer/modematadaptation/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 ../rom/modematadaptation.iby    NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(modematadaptation.iby)
--- a/adaptationlayer/modematadaptation/modematcommon_dll/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcommon_dll/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_MMPFILES
 modematcommon_dll.mmp
--- a/adaptationlayer/modematadaptation/modematcontroller_dll/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_dll/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_MMPFILES
 modematcontroller_dll.mmp
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_MMPFILES
 modematcontroller_exe.mmp
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/catmessage.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/catmessage.h	Wed Apr 21 14:29:55 2010 +0300
@@ -68,11 +68,6 @@
      */
     CModemAtSession* GetSession();
 
-    /** IsRequestActive
-     * @return ETrue if request is not NULL, EFalse otherwise
-     */
-    TBool IsRequestActive();
-
 private:    
     HBufC8* iMessage;
     TUint8 iMessageType;
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodemathandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -23,15 +23,11 @@
 #include <e32base.h>
 #include "mmodematobserver.h"
 
-const TInt KMaxDteIdCount(10);
-const TInt KPluginCount(2); //atext & common plugin
-const TInt KMaxNumOfTransactionIds(256);
 
 // FORWARD DECLARATIONS
 class CModemAtSrv;
 class RIscApi;
 class TIsiReceiveC;
-class MMtiWrapperService;
 class CModemAtPipeController;
 
 
@@ -73,10 +69,10 @@
         const TDesC8& aCmd );
 
     /**
-      *  Connects Handler to modem with specific dteid.
-      *  @param TUint8 aDteId
+      *  Connects handler to modem
+      *  @param aDteId DteId. Default is zero. If pipe is created, pipehandle will be used.
       *  @return KErrNone or
-	  *  @return KErrNoMemory
+      *  @return KErrNoMemory
       */
 
     TInt Connect( const TUint8 aDteId );
@@ -86,7 +82,7 @@
      *  @param TUint8 aDteId
      *  @return Disconnect status
      */
-    TInt Disconnect( const  TUint8 aDteId );
+    TInt Disconnect( const TUint8 aDteId );
     
     /**
      *  Check if disconnect is called directly
@@ -96,10 +92,9 @@
     
     /**
      *  HandleCommandModeChange
-     *  @param TUint8 aDteId
      *  @param TCommandMode aMode
      */
-    void HandleCommandModeChange( TInt aDteid, TCommandMode aMode );
+    void HandleCommandModeChange( TCommandMode aMode );
     
     /**
      *  SendAtModemDataRedirectResultReq
@@ -138,6 +133,12 @@
      *  @param TBool aModemAtExistsInCmt
      */
     void SetModemAtExistsInCmt( TBool aModemAtExistsInCmt );
+    
+    /**
+     *  SendAtModemConnectReq
+     *  @param TUint8 aDteId
+     */
+    TInt SendAtModemConnectReq( const TUint8 aDteId );
 
 protected:
     // from CActive
@@ -195,7 +196,7 @@
     TUint8 iChannel;
     TATPluginInterface iPluginType;
 #endif
-    TUint8 iLastTransactionId[KMaxNumOfTransactionIds];
+    TUint8 iLastTransactionId;
     TBool iDisconnected;
     TBool iModemAtExistInCmt;
     };
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematpipecontroller.h	Wed Apr 21 14:29:55 2010 +0300
@@ -20,8 +20,8 @@
 #define CMODEMATPIPECONTROLLER_H
 
 #include <e32base.h>
-#include "cmodemathandler.h" //KMaxDteIdCount
-
+#include "cmodemathandler.h"
+const TUint8 KInvalidPipeHandle = 0xff;
 
 class TPipeInfo
 {
@@ -36,13 +36,13 @@
         EPipeRemoving,
         EPipeNoPipe
         };
-        
-    TInt iHandle;
-    TUint8 iFirstObjId;
-    TUint8 iFirstDevId;
-    TUint8 iSecondObjId;
-    TUint8 iSecondDevId;
-    EPipeState iPipeState;
+
+    TUint8 pipeHandle;
+    TUint8 firstObjId;
+    TUint8 firstDevId;
+    TUint8 secondObjId;
+    TUint8 secondDevId;
+    EPipeState pipeState;
 };
 
 /**
@@ -78,37 +78,36 @@
     void RemovePipe( const TUint8 aDteId);
     
     /**
-      * Redirects pipe
-      * @param TUint8 aDteId Connection DteId   
-      * @param TUint8 aNewDevId New PEP
-      * @param TUint8 aNewObjId New PEP
-      */
-    
+     * Redirects pipe
+     * @param TUint8 aDteId Connection DteId   
+     * @param TUint8 aNewDevId New PEP
+     * @param TUint8 aNewObjId New PEP
+     */
     void RedirectPipe( const TUint8 aDteId, const TUint8 aNewDevId, const TUint8 aNewObjId );
 
     /**
-      * Links dteId to created Pipe
-      * @param TUint8 aDteId Connection DteId   
-      */
-    void LinkDteIdToPipe( const TUint8 aDteId );
-    
-    /**
      * Queries AT MODEM object id. 
      */
     void QueryModemAtFromNameService();
+
+    /**
+     * GetPipeHandle
+     * @return pipehandle
+     */
+    TUint8 GetPipeHandle();
+
 #endif
 private:
     /**
      * Default C++ constructor.
-     * @param None
-     * @return
+     * @param RIscApi& aIscApi
+     * @param TUint& aObjId
+     * @param CModemAtHandler& aHandler
      */
     CModemAtPipeController( RIscApi& aIscApi, TUint& aObjId, CModemAtHandler& aHandler );
 
     /**
-     *  Used to send At command to modem
-     *  @param
-     *  @return Send status
+     *  ConstructL
      */
 
     void ConstructL();
@@ -187,31 +186,24 @@
      * @param TUint8 aPipeHandle Pipehandle
      */
     void SendEnablePipeReq( const TUint8 aPipeHandle);
-    /**
-     * Finds dteid of pipe
-     * @param const TInt aHandle pipe handle
-     */
-    TInt FindDteId( const TInt aHandle );
 
     /**
      * ChangePipeState
-     * @param const TInt aDteId
      * @param TPipeInfo::EPipeState aState
      */
-    void ChangePipeState( const TInt aDteId, TPipeInfo::EPipeState aState );
+    void ChangePipeState( TPipeInfo::EPipeState aState );
+    
 #endif
 private:
     
     RIscApi& iIscApi;
     TUint iModemAtObjId;            //Modem AT Controller Obj-id
     TUint iModemAtDevId;            //Modem AT Controller device-id
-    TInt  iPipeHandle;              //handle of created pipe 
     TUint iDataportDevId;           //Dataport device-id
     TUint iDataportObjId;           //Dataport obj-id
-    TPipeInfo iPipeTable[KMaxDteIdCount];   //created pipes
+    TPipeInfo iPipe;                //Pipehandle, pipe status and pipe id's
     CModemAtHandler& iAtHandler;    //forwards AT-commands to the AT MODEM
     CActiveSchedulerWait* iSchedulerWait;
-    TUint8 iDteId;                  // temporary dte id for creating the connection
     };
 
 #endif  // CMODEMATPIPECONTROLLER_H
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsession.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsession.h	Wed Apr 21 14:29:55 2010 +0300
@@ -60,18 +60,6 @@
     void SignalIndReceived( );
 
     /**
-     * Returns DteId of current session
-     *  @return DteID 
-     */    
-    TUint8 GetDteId();
-
-    /**
-      *  Sets DteID for this session
-      *  @param aDteId DteId
-      */    
-    void SetDteId( const TUint8 aDteId );
-
-    /**
       * Returns name of current session  
       * @return Session name 
       */    
@@ -154,10 +142,11 @@
     RMessage2 iCommandModeReq;
 
     TVersion iVersion;
-    TUint8 iDteId;
     HBufC8* iClientName;
     TATPluginInterface iPluginType;
     TPtr8 iClientNamePtr;
     };
 
 #endif  // CMODEMATSESSION_H
+
+
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/inc/cmodematsrv.h	Wed Apr 21 14:29:55 2010 +0300
@@ -24,7 +24,6 @@
 #include "cmodemathandler.h"  //KMaxDteIdCount
 #include "modemattrace.h"
 
-const TUint8 KInitialDteId = 999;
 const TUint8 EAtCmd = 0;
 const TUint8 EGetNvramStatus = 1;
 
@@ -80,21 +79,22 @@
     /**
      * Connect session to the modem  
      * @param CModemAtSession* aSession Pointer to the session
+     * @param TATPluginInterface aPluginType Atext or common plugin
      * @return Connection status: KErrNone, KErrAlreadyExists
      */    
-    TInt ConnectToModem( CModemAtSession* aSession);
+    TInt ConnectToModem( CModemAtSession* aSession, TATPluginInterface aPluginType);
 
     /**
      * HandleSignalInd  
      * @param aDteId Device Terminal ID
      */ 
-    void HandleSignalInd( const TInt aDteId );
+    void HandleSignalInd( const TUint8 aDteId );
     /**
      * HandleUnsolicitedData 
      * @param aDteId Device Terminal ID
      * @param aData Descriptor data
      */ 
-    void HandleUnsolicitedData( const TInt aDteId, const TDesC8& aData );
+    void HandleUnsolicitedData( const TUint8 aDteId, const TDesC8& aData );
     /**
      * HandleIntermediateDataInd
      * @param aDteId Device Terminal ID
@@ -102,36 +102,27 @@
      * @param aResponse Response buffer
      * @param aCommand Command buffer
      */ 
-    void HandleIntermediateDataInd( const TInt aDteId, const TATPluginInterface aPluginType, const TDesC8& aResponse, const TUint8 aCommand );
+    void HandleIntermediateDataInd( const TUint8 aDteId, const TATPluginInterface aPluginType, const TDesC8& aResponse, const TUint8 aCommand );
 
     /**
      * HandleATResponse
      * @param aDteId Device Terminal ID
      * @param aResponse Response buffer
      */ 
-    void HandleATResponse( const TInt aDteId, const TDesC8& aResponse, const TUint8 aCommand );
-    
-    /**
-     * BroadcastModemConnected
-     * @param aDteId Device Terminal ID
-     * @param aErr KErrNone if connected, otherwise KErrGeneral
-     */ 
-    void BroadcastModemConnected(const TUint aDteId, TInt aErr );
+    void HandleATResponse( const TUint8 aDteId, const TDesC8& aResponse, const TUint8 aCommand );
     
     /**
      * HandleCommandModeChange
-     * @param aDteId Device Terminal ID
      * @param aMode Command mode 0 or data mode 1
      */ 
-    void HandleCommandModeChange( TInt aDteId, TCommandMode aMode );
+    void HandleCommandModeChange( TCommandMode aMode );
     
     /**
      * AddToSendFifo
-     * @param aDteId Device Terminal ID
      * @param aPluginType Plugin type
      * @param aMessage RMessage2 container class
      */ 
-    void AddToSendFifo( const TUint8 aDteId, const TATPluginInterface aPluginType, CAtMessage* aMessage );
+    void AddToSendFifo( const TATPluginInterface aPluginType, CAtMessage* aMessage );
 
     /**
      * RemoveFirstFromSendFifo 
@@ -151,9 +142,15 @@
     
     /**
      * RemovePipe
-     * @param aDteId Device Terminal ID
      */ 
-    void RemovePipe( const TUint8 aDteId );
+    void RemovePipe();
+
+    /**
+      *  Sets DteID for this session
+      *  @param aDteId DteId
+      * @param aConnectionError error
+      */    
+    void SetDteIdAndConnect( const TUint8 aDteId, const TInt aConnectionError );
 
 private:
 
@@ -183,9 +180,9 @@
 private:  // data
 
     RPointerArray<CModemAtSession> iSessions;       //Sessions from R-interface
-    CModemAtSession* iRouteTable[KPluginCount][KMaxDteIdCount]; //Messages are routed to session by this table
     RPointerArray<CAtMessage> iAtMessageArray;
     CModemAtHandler* iHandler;
+    TUint8 iDteId;
     };
 
 #endif  // CMODEMATSRV_H
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/catmessage.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/catmessage.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -111,8 +111,3 @@
         }
     }
 
-TBool CAtMessage::IsRequestActive()
-    {
-    C_TRACE(( _T("CAtMessage::IsRequestActive ret: %d"), (TInt) !iRequest.IsNull() ));
-    return !iRequest.IsNull();
-    }
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodemathandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodemathandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -23,9 +23,9 @@
 #include <pn_const.h>
 #ifndef NCP_COMMON_BRIDGE_FAMILY       
 #include <nsisi.h>
-#endif
 #include <pipeisi.h>
 #include <pipe_sharedisi.h>
+#endif
 #include <tisi.h>
 #include <at_modemisi.h>
 #include "cmodemathandler.h"
@@ -97,6 +97,7 @@
     iReceivedMessage( NULL ),
     iPepObjId(0),
     iPipeController(NULL),
+    iLastTransactionId( 0 ),
     iDisconnected( EFalse ),
     iModemAtExistInCmt( EFalse )
     {
@@ -193,7 +194,7 @@
             } //if( receiveMessageBuffer->Length() > ISI_HEADER_OFFSET_MESSAGEID )
         else 
             {
-            C_TRACE(_L("ISI essage is too short"));
+            C_TRACE(_L("ISI message is too short"));
             TRACE_ASSERT_ALWAYS;
             }
         
@@ -217,14 +218,7 @@
     
     iIscApi = new ( ELeave ) RIscApi;
     C_TRACE(_L("RIscApi created"));
-
-    //used with intermediate data ind
-    //can be removed, when AT_MODEM_INTERMEDIATE_DATA_IND supports transactionid 
-    for( TInt i = 0 ; i < KMaxDteIdCount ; i++) 
-        {
-        iLastTransactionId[i]=0;
-        }
-    
+   
 #ifndef __WINSCW__
       OpenChannelL();
 #ifndef NCP_COMMON_BRIDGE_FAMILY
@@ -245,12 +239,12 @@
 
     TInt err = KErrNone;
     // aMessageType contains normal AT-cmd (0) or Nvram-query (1)
-    TUint transactionId= (aPluginType << KTransactionIdBitsShift) | aMessageType;
-    //used with intermediate data ind
-    //can be removed, when AT_MODEM_INTERMEDIATE_DATA_IND supports transactionid        
-    iLastTransactionId[aDteId] = transactionId;  //messages are routed to correct plugin by transaction id
+    TUint transactionId = ( aPluginType << KTransactionIdBitsShift ) | aMessageType;
+    // used with intermediate data ind
+    // can be removed, when AT_MODEM_INTERMEDIATE_DATA_IND supports transactionid        
+    iLastTransactionId = transactionId;  //messages are routed to correct plugin by transaction id
     C_TRACE((_L("transaction id %d, plugintype %d, aMessageType %d"), transactionId, aPluginType, aMessageType));
-    C_TRACE((_L("iLastTransctionId[%d] = %d "),aDteId,iLastTransactionId[aDteId]));
+    C_TRACE((_L("iLastTransctionId = %d "), iLastTransactionId ));
 
     #ifdef __WINSCW__
     iDteId = aDteId;
@@ -348,8 +342,6 @@
     events.Append( AT_MODEM_UNSOLICITED_DATA_IND );  
     events.Append( PN_AT_MODEM );
     events.Append( AT_MODEM_DATA_REDIRECT_IND );  
-    events.Append( PN_PIPE );
-    events.Append( PNS_PEP_STATUS_IND );
 
 #ifndef NCP_COMMON_BRIDGE_FAMILY       
     //name add ind
@@ -357,11 +349,15 @@
     events.Append( PNS_NAME_ADD_IND );  
     events.Append( PN_NAMESERVICE );
     events.Append( PNS_NAME_REMOVE_IND );
+    events.Append( PN_PIPE );
+    events.Append( PNS_PEP_STATUS_IND );
 #else
     events.Append( 0 );
     events.Append( 0 );  
     events.Append( 0 );
     events.Append( 0 );
+    events.Append( 0 );
+    events.Append( 0 );
 #endif
     
     iIscApi->CustomFunction(EIscNokiaEventSubscribe,&events);
@@ -380,7 +376,7 @@
     {
     C_TRACE (( _T("CModemAtHandler::HandleATResponse()") ));
     
-    TInt dteId = aMessage.Get8bit( ISI_HEADER_SIZE+ AT_MODEM_CMD_RESP_OFFSET_DTEID ) ;
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_CMD_RESP_OFFSET_DTEID ) ;
     TUint transactionId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_CMD_RESP_OFFSET_TID );
     TUint8 command = transactionId & KCommandBits; //normal AT-cmd or Nvram-query
     TInt length = aMessage.Get16bit( ISI_HEADER_SIZE+AT_MODEM_CMD_RESP_OFFSET_LENGTH );
@@ -415,7 +411,7 @@
 #endif
 
     
-TInt CModemAtHandler::Connect(const TUint8 aDteId)
+TInt CModemAtHandler::Connect( const TUint8 aDteId )
     {
     C_TRACE (( _T("CModemAtHandler::Connect()") ));
 
@@ -425,37 +421,37 @@
         TRACE_ASSERT_ALWAYS;
         return KErrNotFound;
         }
+    SetDisconnected( EFalse );
 
-    C_TRACE((_L("Connecting with dteid:%d "), aDteId));
-    SetDisconnected( EFalse );
-    
-    #ifdef __WINSCW__ //emulate, modem is connected
-    iServer.BroadcastModemConnected( aDteId, KErrNone );
-    iDteId = aDteId;
+#ifdef __WINSCW__
     return KErrNone;
-    #endif
+#endif
+
+    TInt err( KErrNone );
+	TUint8 pipeHandle( KInvalidPipeHandle );
+
 #ifndef NCP_COMMON_BRIDGE_FAMILY
-    iPipeController->LinkDteIdToPipe( aDteId );
+    pipeHandle = iPipeController->GetPipeHandle();
 #endif
-    TInt size = ISI_HEADER_SIZE + SIZE_AT_MODEM_CONNECT_REQ;
-    
-    HBufC8* message = HBufC8::New( size );
-    TRACE_ASSERT( message );
-    TPtr8 messageptr = message->Des();
-    TIsiSend isimessage( messageptr, size );
-    isimessage.Set8bit(ISI_HEADER_OFFSET_RESOURCEID, PN_AT_MODEM); 
-    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_TID, KDefaultTId);
-    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_MESSAGEID, AT_MODEM_CONNECT_REQ);
-    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_DTEID, aDteId);
-    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_FILLERBYTE1, KFiller);
-    isimessage.Complete();
 
-    DUMP_MESSAGE( messageptr );
-    TInt err = iIscApi->Send( messageptr );
-    TRACE_ASSERT( err == KErrNone );
-    delete message;
-    message = NULL;
-    return err;
+    if( pipeHandle == KInvalidPipeHandle )
+        {
+        C_TRACE(( _L("Connecting with dteId %d. (RComm was not used before connecting the plug-ins)."), aDteId ));
+        err = SendAtModemConnectReq( aDteId );
+        }
+    else
+        {
+        C_TRACE(( _L("Connecting with pipehandle %d."), pipeHandle ));
+        err = SendAtModemConnectReq( pipeHandle );
+        }
+   
+   if( err != KErrNone )
+       {
+       TRACE_ASSERT_ALWAYS;
+       return KErrNotFound;
+       }
+
+    return KErrNone;
     }
 
 void CModemAtHandler::SetDisconnected( TBool aIsDisconnected )
@@ -518,35 +514,35 @@
 void CModemAtHandler::HandleModemConnectResp( const TIsiReceiveC& aMessage )
     {
     C_TRACE (( _T("CModemAtHandler::HandleModemConnectResp()") ));
-    TInt dteId= aMessage.Get8bit(ISI_HEADER_SIZE+ AT_MODEM_CONNECT_RESP_OFFSET_DTEID);
-    TInt status = aMessage.Get8bit(ISI_HEADER_SIZE+ AT_MODEM_CONNECT_RESP_OFFSET_RESULT);
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_CONNECT_RESP_OFFSET_DTEID );
+    TInt status = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_CONNECT_RESP_OFFSET_RESULT );
     TInt err = KErrGeneral;
     if( status == AT_MODEM_RESULT_OK )
         {
         C_TRACE(_L("Connected ok, AT_MODEM_RESULT_OK received"));
         err = KErrNone;
-        }   
-    else 
+        }
+    else
         {
-        C_TRACE((_L("Connection failed, AT_MODEM_RESULT_ERROR received (%d)"),status));
+        C_TRACE((_L("Connection failed, AT_MODEM_RESULT_ERROR received (%d)"), status));
         TRACE_ASSERT_ALWAYS;
         }
 
-    iServer.BroadcastModemConnected( dteId, err );
+    iServer.SetDteIdAndConnect( dteId, err );
     }
 
 
 void CModemAtHandler::HandleSignalInd( const TIsiReceiveC& aMessage )
     {
     C_TRACE (( _T("CModemAtHandler::HandleSignalInd()") ));
-    TInt dteId = aMessage.Get8bit(ISI_HEADER_SIZE+ AT_MODEM_SIGNAL_IND_OFFSET_DTEID);
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_SIGNAL_IND_OFFSET_DTEID );
     iServer.HandleSignalInd( dteId );
     }
 
 void CModemAtHandler::HandleUnsolicitedData( const TIsiReceiveC& aMessage )
     {
     C_TRACE (( _T("CModemAtHandler::HandleUnsolicitedData()") ));
-    TInt dteId = aMessage.Get8bit( ISI_HEADER_SIZE+ AT_MODEM_UNSOLICITED_DATA_IND_OFFSET_LENGTH );
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE+ AT_MODEM_UNSOLICITED_DATA_IND_OFFSET_LENGTH );
     TInt length = aMessage.Get16bit( ISI_HEADER_SIZE+AT_MODEM_UNSOLICITED_DATA_IND_OFFSET_LENGTH );
     
     iServer.HandleUnsolicitedData( dteId,
@@ -558,14 +554,18 @@
 void CModemAtHandler::HandleIntermediateDataInd( const TIsiReceiveC& aMessage )
     {
     C_TRACE (( _T("CModemAtHandler::HandleIntermediateDataInd()") ));
-    TInt dteId = aMessage.Get8bit( ISI_HEADER_SIZE+ AT_MODEM_INTERMEDIATE_DATA_IND_OFFSET_DTEID );
-    TInt length= aMessage.Get16bit( ISI_HEADER_SIZE+AT_MODEM_INTERMEDIATE_DATA_IND_OFFSET_LENGTH );
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_INTERMEDIATE_DATA_IND_OFFSET_DTEID );
+    TInt length = aMessage.Get16bit( ISI_HEADER_SIZE + AT_MODEM_INTERMEDIATE_DATA_IND_OFFSET_LENGTH );
      
-    TUint transactionId = aMessage.Get8bit( ISI_HEADER_SIZE+ AT_MODEM_CMD_RESP_OFFSET_TID );
-    transactionId = iLastTransactionId[ dteId ];
-    TUint8 command = transactionId & KCommandBits;
+    TUint transactionId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_CMD_RESP_OFFSET_TID );
+    
+    C_TRACE((_L("transactionId from %d"), transactionId));
+    transactionId = iLastTransactionId;
+    C_TRACE((_L("transactionId after setting it to iLastTransactionId: %d"), transactionId));
+    
+    TUint8 command = transactionId & KCommandBits; //normal AT-cmd or Nvram-query
     TUint8 pluginType = transactionId >> KTransactionIdBitsShift;
-    C_TRACE((_L("dteid %d iLastrid[dteid] = %d trid %d"), dteId, iLastTransactionId[dteId], transactionId));
+    C_TRACE((_L("dteId %d, command %d (AT=0,NVRAM=1), pluginType = %d (atext=0,common=1)"), dteId, command, pluginType));
     
     iServer.HandleIntermediateDataInd( dteId,
       (TATPluginInterface) pluginType,
@@ -579,8 +579,8 @@
     {
     C_TRACE (( _T("CModemAtHandler::HandleRedirectInd()") ));
   
-    TInt dteId = aMessage.Get8bit( ISI_HEADER_SIZE+  AT_MODEM_DATA_REDIRECT_IND_OFFSET_DTEID );
-    TInt newSecondDevId = aMessage.Get8bit( ISI_HEADER_SIZE +  AT_MODEM_DATA_REDIRECT_IND_OFFSET_DEVICEID );
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_IND_OFFSET_DTEID );
+    TInt newSecondDevId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_IND_OFFSET_DEVICEID );
     TInt newSecondObjId = aMessage.Get16bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_IND_OFFSET_SERVERID );
 #ifndef NCP_COMMON_BRIDGE_FAMILY
     iPipeController->RedirectPipe( dteId, newSecondDevId, newSecondObjId ); 
@@ -619,7 +619,7 @@
 void CModemAtHandler::HandleRedirectResultResp(const TIsiReceiveC& aMessage)
     {
     C_TRACE (( _T("CModemAtHandler::HandleRedirectResultResp()") ));
-    TInt dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_RESULT_RESP_OFFSET_DTEID );
+    TUint8 dteId = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_RESULT_RESP_OFFSET_DTEID );
     TInt error = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_DATA_REDIRECT_RESULT_RESP_OFFSET_RESULT );
     C_TRACE((_L("CModemAtHandler::HandleRedirectResultResp() dte %d"), dteId));
     
@@ -634,19 +634,19 @@
         }
     
     }
-void CModemAtHandler::HandleCommandModeChange( TInt aDteId, TCommandMode aMode )
+void CModemAtHandler::HandleCommandModeChange( TCommandMode aMode )
     {
-    C_TRACE(( _T("CModemAtHandler::HandleCommandModeChange() aDteId: %d aMode: %d"),aDteId, (TInt) aMode ));
-    iServer.HandleCommandModeChange( aDteId, aMode );
+    C_TRACE(( _T("CModemAtHandler::HandleCommandModeChange() aMode: %d"), (TInt) aMode ));
+    iServer.HandleCommandModeChange( aMode );
     }
 
 TInt CModemAtHandler::SendEscapeSignalDetection( const TUint8 aDteId )
     {
     C_TRACE((_T("CModemAtHandler::SendEscapeSignalDetection(%d)"), aDteId));
-    #ifdef __WINSCW__
+#ifdef __WINSCW__
     iDteId = aDteId;
     return KErrNone;
-    #endif
+#endif
   
     TInt error( KErrGeneral );  
     TUint msgSize( ISI_HEADER_SIZE + SIZE_AT_MODEM_SIGNAL_DETECTED_REQ );
@@ -671,7 +671,7 @@
       isimessage.Set8bit( msgSize + AT_MODEM_SB_SIGNAL_DETECTED_OFFSET_FILLERBYTE1, 0x00 );
       isimessage.Complete();
       error = iIscApi->Send(messageptr);
-        C_TRACE((_L("escape send result %d"), error ));
+      C_TRACE((_L("escape send result %d"), error ));
       delete message;
       message = NULL;
       }
@@ -687,8 +687,7 @@
 void CModemAtHandler::HandleSignalDetectedResp( const TIsiReceiveC& aMessage )
     {
     C_TRACE (( _T("CModemAtHandler::HandleSignalDetectedResp() escape sequence detect response received from cellmo") ));
-    TInt dteId( aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_SIGNAL_DETECTED_RESP_OFFSET_DTEID ) );
-    TRACE_ASSERT( dteId < KMaxDteIdCount );
+    TUint8 dteId( aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_SIGNAL_DETECTED_RESP_OFFSET_DTEID ) );
     TInt result = aMessage.Get8bit( ISI_HEADER_SIZE + AT_MODEM_SIGNAL_DETECTED_RESP_OFFSET_RESULT );
     C_TRACE((_L("CModemAtHandler::HandleSignalDetectedResp() dteId %d"), dteId));
     TRACE_ASSERT( result == AT_MODEM_RESULT_OK );
@@ -700,3 +699,26 @@
     iModemAtExistInCmt = aModemAtExistsInCmt;
     }
 
+TInt CModemAtHandler::SendAtModemConnectReq( const TUint8 aDteId )
+    {
+    C_TRACE (( _T("CModemAtHandler::SendAtModemConnectReq()") ));
+    TInt size = ISI_HEADER_SIZE + SIZE_AT_MODEM_CONNECT_REQ;
+    HBufC8* message = HBufC8::New( size );
+    TRACE_ASSERT( message );
+    TPtr8 messageptr = message->Des();
+    TIsiSend isimessage( messageptr, size );
+    isimessage.Set8bit(ISI_HEADER_OFFSET_RESOURCEID, PN_AT_MODEM); 
+    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_TID, KDefaultTId);
+    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_MESSAGEID, AT_MODEM_CONNECT_REQ);
+    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_DTEID, aDteId);
+    isimessage.Set8bit(ISI_HEADER_SIZE + AT_MODEM_CONNECT_REQ_OFFSET_FILLERBYTE1, KFiller);
+    isimessage.Complete();
+    DUMP_MESSAGE( messageptr );
+    TInt err = iIscApi->Send( messageptr );
+    TRACE_ASSERT( err == KErrNone );
+    delete message;
+    message = NULL;
+    C_TRACE (( _T("CModemAtHandler::SendAtModemConnectReq()<< returned: %d"), err ));
+    return err;
+    }
+
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematpipecontroller.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematpipecontroller.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -22,24 +22,23 @@
 #include <pn_const.h>
 #ifndef NCP_COMMON_BRIDGE_FAMILY       
 #include <nsisi.h>
+#include <pipeisi.h>                //pipe
+#include <pipe_sharedisi.h>         //pipe
 #endif
 #include <tisi.h>                   //for isimessage
-#include <pipeisi.h>                //pipe
-#include <pipe_sharedisi.h>         //pipe
 #include "cmodematpipecontroller.h"    
 #include "cmodemathandler.h"
 #include <at_modemisi.h>            //redirectreq error codes
 #include "modemattrace.h"
 #include "cmodematsrv.h"
 
-const TInt KInvalidPipeHandle = -1;
+
 #ifndef NCP_COMMON_BRIDGE_FAMILY
-const TUint8 PEP_COMM_IND_ID_ESCAPE(0x07);
-const TInt KInvalidDteId = -1;
+const TUint8 PEP_COMM_IND_ID_ESCAPE = 0x07;
 const TUint8 KFiller = 0;
-const TUint8 KDefaultTrId(0);
+const TUint8 KDefaultTrId = 0;
+const TInt KLastByteIndex = 3;
 #endif
-const TInt KLastByteIndex = 3;
 
 CModemAtPipeController* CModemAtPipeController::NewL( RIscApi& aIscApi,
     TUint& aObjId,
@@ -76,14 +75,20 @@
     iIscApi( aIscApi ),
     iModemAtObjId( aObjId ),
     iModemAtDevId( THIS_DEVICE ),
-    iPipeHandle( KInvalidPipeHandle ),
     iDataportDevId( 0 ),
     iDataportObjId( 0 ),
     iAtHandler( aHandler ),
-    iSchedulerWait( NULL ),
-    iDteId( KInitialDteId )
+    iSchedulerWait( NULL )
     {
-    C_TRACE (( _T("CModemAtPipeController::CModemAtPipeController()") ));
+    C_TRACE (( _T("CModemAtPipeController::CModemAtPipeController()>") ));
+    iPipe.pipeHandle = KInvalidPipeHandle;
+    iPipe.firstDevId = 0;
+    iPipe.firstObjId = 0;
+    iPipe.secondDevId = 0;
+    iPipe.secondDevId = 0;
+    iPipe.pipeState = TPipeInfo::EPipeNoPipe;
+
+    C_TRACE (( _T("CModemAtPipeController::CModemAtPipeController()<") ));
     }
 
  
@@ -121,7 +126,7 @@
      switch( aReceivedMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) )
         {
         case PNS_PIPE_CREATE_RESP:
-            C_TRACE(_L("PIPE CREATE RESP"));
+            C_TRACE(_L("PNS_PIPE_CREATE_RESP"));
             HandlePipeCreateResp( aReceivedMessage );
             break;
 
@@ -141,7 +146,7 @@
             break;
 
         case PNS_PEP_STATUS_IND :
-            C_TRACE(_L("PNS_PEP_STATUS_IND "));
+            C_TRACE(_L("PNS_PEP_STATUS_IND"));
             HandlePepStatusInd( aReceivedMessage );
             break;
 
@@ -212,13 +217,15 @@
                PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL * i +
                PN_NAME_SRV_ITEM_STR_OFFSET_OBJ);
 
-             if( iDataportDevId == THIS_DEVICE )
+             if( ( iDataportDevId == THIS_DEVICE ) &&
+                 ( iPipe.pipeState == TPipeInfo::EPipeNoPipe ) )
                 {
-                C_TRACE((_L("CREATE PIPE FROM DATAPORT when ATEXT plugins connect (devid %x  o-bjid %x) "),iDataportDevId,iDataportObjId));
+                C_TRACE((_L("Creating pipe. (Dataport device id 0x%x,  object id: 0x%x)"),iDataportDevId,iDataportObjId));
+                SendCreatePipeMessage( iDataportDevId, iDataportObjId );
                 }
              else
                 {
-                C_TRACE((_L("ERROR: PIPE not Created due to unmatching DevId: 0x%x or ObjId 0x%x"),iDataportDevId, iDataportObjId ));
+                C_TRACE((_L("ERROR: Pipe is not created. (Dataport device id 0x%x,  object id: 0x%x)"),iDataportDevId, iDataportObjId ));
                 TRACE_ASSERT_ALWAYS;
                 }
              }
@@ -330,65 +337,38 @@
  void CModemAtPipeController::HandlePipeCreateResp( const TIsiReceiveC& aReceivedMessage )
     {
     C_TRACE (( _T("CModemAtPipeController::HandlePipeCreateResp()") ));
-    TInt error = aReceivedMessage.Get8bit(ISI_HEADER_SIZE +  PNS_PIPE_CREATE_RESP_OFFSET_ERRORCODE );
+    TInt error = aReceivedMessage.Get8bit(ISI_HEADER_SIZE +
+      PNS_PIPE_CREATE_RESP_OFFSET_ERRORCODE );
     C_TRACE((_L("Pipe create resp: %d"), error ));
-    TRACE_ASSERT( iDteId != KInitialDteId );
-
+    
     if( error == PN_PIPE_NO_ERROR)
         {
-        iPipeHandle = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
+        iPipe.pipeHandle = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
           PNS_PIPE_CREATE_RESP_OFFSET_PIPEHANDLE );
-        C_TRACE( (_L("handle %d"), iPipeHandle ));
-        iPipeTable[iDteId].iHandle = iPipeHandle;
-        iPipeTable[iDteId].iFirstDevId = iDataportDevId;
-        iPipeTable[iDteId].iFirstObjId =  iDataportObjId; 
-        iPipeTable[iDteId].iSecondDevId = THIS_DEVICE;
-        iPipeTable[iDteId].iSecondObjId =  iModemAtObjId;
-        ChangePipeState( iDteId, TPipeInfo::EPipeCreated );
-        iPipeHandle = KInvalidPipeHandle;
-        iDteId = KInitialDteId;
+        C_TRACE( (_L("Pipe created successfully. Pipehandle: %d"), iPipe.pipeHandle ));
+        
+        // Now that pipehandle is received, it will also be used as dteId when connecting to AT Modem.
+        
+        iPipe.firstDevId = iDataportDevId;
+        iPipe.firstObjId =  iDataportObjId; 
+        iPipe.secondDevId = THIS_DEVICE;
+        iPipe.secondObjId =  iModemAtObjId;
+        ChangePipeState( TPipeInfo::EPipeCreated );
+
         }
     else
         {
-        C_TRACE (( _T("iPipeHandle == KInvalidPipeHandle ")));
-        iPipeTable[iDteId].iHandle = KInvalidPipeHandle;
-        iPipeTable[iDteId].iFirstDevId = 0;
-        iPipeTable[iDteId].iFirstObjId = 0;
-        iPipeTable[iDteId].iSecondDevId = 0;
-        iPipeTable[iDteId].iSecondObjId = 0;
-        ChangePipeState( iDteId, TPipeInfo::EPipeNoPipe );
+        C_TRACE((_L("Pipe creation failed: %d"), error ));
+        iPipe.pipeHandle = KInvalidPipeHandle;
+        iPipe.firstDevId = 0;
+        iPipe.firstObjId = 0;
+        iPipe.secondDevId = 0;
+        iPipe.secondObjId = 0;
+        ChangePipeState( TPipeInfo::EPipeNoPipe );
         ASSERT_ALWAYS;
         }
     }
 
- void CModemAtPipeController::LinkDteIdToPipe( const TUint8 aDteId )
-    {
-    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 )
-        {
-        C_TRACE((_L("CREATE PIPE FROM DATAPORT (plugins are connecting) (devid %x  o-bjid %x) "),iDataportDevId,iDataportObjId));
-        SendCreatePipeMessage( iDataportDevId, iDataportObjId );
-        }
-    else
-        {
-        C_TRACE((_L("Dataport has not been created (devid %x  o-bjid %x) "), iDataportDevId, iDataportObjId ));
-        C_TRACE (( _T("iPipeHandle == KInvalidPipeHandle ")));
-        iPipeTable[aDteId].iHandle = KInvalidPipeHandle;
-        iPipeTable[aDteId].iFirstDevId = 0;
-        iPipeTable[aDteId].iFirstObjId = 0;
-        iPipeTable[aDteId].iSecondDevId = 0;
-        iPipeTable[aDteId].iSecondObjId = 0;
-        ChangePipeState( aDteId, TPipeInfo::EPipeNoPipe );
-        }
-    }
 
 
 void CModemAtPipeController::HandlePipeRemoveResp( const TIsiReceiveC& aReceivedMessage )
@@ -399,12 +379,10 @@
     TInt pipehandle = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
       PNS_PIPE_REMOVE_RESP_OFFSET_PIPEHANDLE );
 
-    TInt dteId = FindDteId( pipehandle );
-    
-    TRACE_ASSERT( dteId < KMaxDteIdCount )
-    if( !(dteId < KMaxDteIdCount) )
+    TRACE_ASSERT( pipehandle == iPipe.pipeHandle );
+    if( pipehandle != iPipe.pipeHandle )
         {
-        C_TRACE(( _T("CModemAtPipeController::HandlePipeRemoveResp() illegal dteid %d"), dteId ));
+        C_TRACE(( _T("CModemAtPipeController::HandlePipeRemoveResp() illegal pipehandle %d"), pipehandle ));
         return;
         }
     
@@ -415,9 +393,9 @@
         return;
         }
 
-    ChangePipeState( dteId, TPipeInfo::EPipeNoPipe );
+    ChangePipeState( TPipeInfo::EPipeNoPipe );
 
-    iPipeTable[ dteId ].iHandle = KInvalidPipeHandle; 
+    iPipe.pipeHandle = KInvalidPipeHandle; 
 
     if( iSchedulerWait )
         {
@@ -434,31 +412,31 @@
     {
     C_TRACE (( _T("CModemAtPipeController::RemovePipe(%d, 0x%x)"), aDteId, this ));
 
-    TRACE_ASSERT( aDteId < KMaxDteIdCount );
-    if( !(aDteId < KMaxDteIdCount) )
+    C_TRACE (( _T("iPipe:0x%x"), &iPipe ));
+    C_TRACE (( _T("iHandle: %d"), iPipe.pipeHandle ));
+    C_TRACE (( _T("i1stDevId: %d"), iPipe.firstDevId ));
+    C_TRACE (( _T("i1stObjId: %d"), iPipe.firstObjId )); 
+    C_TRACE (( _T("i2ndDevId: %d"), iPipe.secondDevId ));
+    C_TRACE (( _T("i2ndObjId: %d"), iPipe.secondObjId ));
+    
+    if( iPipe.pipeHandle != KInvalidPipeHandle )   
         {
-        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 ));
-    C_TRACE (( _T("i1stObjId: %d"), iPipeTable[aDteId].iFirstObjId )); 
-    C_TRACE (( _T("i2ndDevId: %d"), iPipeTable[aDteId].iSecondDevId ));
-    C_TRACE (( _T("i2ndObjId: %d"), iPipeTable[aDteId].iSecondObjId ));
-    
-    if( iPipeTable[aDteId].iHandle != KInvalidPipeHandle )   
-        {
-        if( ( iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeRemoving ) || 
-            ( iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeNoPipe ) )
+        if( ( iPipe.pipeState == TPipeInfo::EPipeRemoving ) || 
+            ( iPipe.pipeState == TPipeInfo::EPipeNoPipe ) )
             {
-            C_TRACE((_L("Already removing pipe or pipe is removed. Handle %d"), iPipeTable[aDteId].iHandle));
+            C_TRACE((_L("Already removing pipe or pipe is removed. Handle %d"), iPipe.pipeHandle));
             return;
             }
-        C_TRACE((_L("Remove pipe. Handle %d"), iPipeTable[aDteId].iHandle));
-        ChangePipeState( aDteId, TPipeInfo::EPipeRemoving );
-        SendRemovePipeReq( iPipeTable[aDteId].iHandle );
+        
+        if( aDteId != iPipe.pipeHandle )
+            {
+            C_TRACE(( _T("Dteid %d is not same as pipehandle %d, so there is no pipe to remove."), aDteId, iPipe.pipeHandle ));
+            return;
+            }
+        
+        C_TRACE((_L("Remove pipe. Handle %d"), iPipe.pipeHandle));
+        ChangePipeState( TPipeInfo::EPipeRemoving );
+        SendRemovePipeReq( iPipe.pipeHandle );
         }
     else
         {
@@ -504,23 +482,23 @@
     const TUint8 aNewDevId,
     const TUint8 aNewObjId ) 
     {
-    C_TRACE (( _T("CModemAtPipeController::RedirectPipe() dteid %d"), aDteId ));
+    C_TRACE (( _T("CModemAtPipeController::RedirectPipe() dteid %d, iPipe.pipeHandle: %d"), aDteId, iPipe.pipeHandle ));
     C_TRACE((_L("CModemAtPipeController::RedirectPipe() New pep, deviceId: 0x%x objId: 0x%x "), aNewDevId, aNewObjId));
-    TRACE_ASSERT( aDteId < KMaxDteIdCount );
-    if( !(aDteId < KMaxDteIdCount) )
+    TRACE_ASSERT( aDteId == iPipe.pipeHandle );
+    if( aDteId != iPipe.pipeHandle )
         {
         C_TRACE(( _T("CModemAtPipeController::RedirectPipe() illegal dteid %d"), aDteId ));
         return;
         }
-    TRACE_ASSERT( iPipeTable[aDteId].iHandle != KInvalidPipeHandle );
-    if( iPipeTable[aDteId].iHandle == KInvalidPipeHandle )
+    TRACE_ASSERT( iPipe.pipeHandle != KInvalidPipeHandle );
+    if( iPipe.pipeHandle == KInvalidPipeHandle )
         {
-        C_TRACE(( _T("CModemAtPipeController::RedirectPipe() invalid pipe handle %d"), iPipeTable[aDteId].iHandle ));
+        C_TRACE(( _T("CModemAtPipeController::RedirectPipe() invalid pipe handle %d"), iPipe.pipeHandle ));
         return;
         }
 
-    if( iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeRemoving || 
-        iPipeTable[aDteId].iPipeState == TPipeInfo::EPipeNoPipe ) 
+    if( iPipe.pipeState == TPipeInfo::EPipeRemoving || 
+        iPipe.pipeState == TPipeInfo::EPipeNoPipe ) 
         {
         C_TRACE(_L("CModemAtPipeController::RedirectPipe() Pipe is already removed -> cant redirect"));
         return;
@@ -529,12 +507,12 @@
     if( aNewDevId == THIS_DEVICE && aNewObjId == iModemAtObjId )
         {
         C_TRACE((_L("CModemAtPipeController::RedirectPipe() EPipeDisabled. iModemAtObjId: 0x%x"), iModemAtObjId));
-        ChangePipeState( aDteId, TPipeInfo::EPipeDisabled );
+        ChangePipeState( TPipeInfo::EPipeDisabled );
         }
     else
         {
         C_TRACE(_L("CModemAtPipeController::RedirectPipe() EPipeRedirected"));
-        ChangePipeState( aDteId, TPipeInfo::EPipeRedirected );
+        ChangePipeState( TPipeInfo::EPipeRedirected );
         }
 
     C_TRACE(_L("CModemAtPipeController::RedirectPipe() Redirecting pipe"));
@@ -549,14 +527,14 @@
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_SUBFUNCTION,
       PNS_PIPE_REDIRECT_REQ );
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_PIPEHANDLE,
-      iPipeTable[aDteId].iHandle ); 
+      iPipe.pipeHandle );
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_STATEAFTERCREATION,
       PN_PIPE_DISABLE );
     //old pep 
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_OLDPEPDEV,
-      iPipeTable[aDteId].iSecondDevId );
+      iPipe.secondDevId );
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_OLDPEPOBJ, 
-      iPipeTable[aDteId].iSecondObjId );
+      iPipe.secondObjId );
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_OLDPEPTYPE, PN_PEP_TYPE_COMMON); 
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_FILLERBYTE1, KFiller );
 
@@ -565,8 +543,8 @@
     isimessage.Set8bit( ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_REPLACEMENTPEPTYPE, 
       PN_PEP_TYPE_COMMON ); 
 
-    iPipeTable[aDteId].iSecondDevId = aNewDevId;
-    iPipeTable[aDteId].iSecondObjId = aNewObjId;
+    iPipe.secondDevId = aNewDevId;
+    iPipe.secondObjId = aNewObjId;
 
     isimessage.Set8bit(ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_REQ_OFFSET_NSB, KFiller );
     isimessage.Complete();
@@ -585,32 +563,37 @@
     TInt pipeHandle = aReceivedMessage.Get8bit( ISI_HEADER_SIZE + 
       PNS_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE );
     C_TRACE((_L("CModemAtPipeController::HandlePipeRedirectResp() pipehandle: %d"), pipeHandle ));
-    TInt dteId = FindDteId( pipeHandle );
     
     if( error != PN_PIPE_NO_ERROR )
         {
-        if( dteId != KInvalidDteId )
+        if( pipeHandle == iPipe.pipeHandle )
             {
             C_TRACE(( _L("CModemAtPipeController::HandlePipeRedirectResp() pipe error: %d"), error ));
-            iAtHandler.SendAtModemDataRedirectResultReq( dteId, AT_MODEM_REDIRECT_RESULT_ERROR);
-            RemovePipe( dteId );
+            iAtHandler.SendAtModemDataRedirectResultReq( pipeHandle, AT_MODEM_REDIRECT_RESULT_ERROR);
+            RemovePipe( pipeHandle );
             return;
             }
         else
             {
-            C_TRACE(( _L("CModemAtPipeController::HandlePipeRedirectResp() dteId not found, pipe error: %d"), error ));
+            C_TRACE(( _L("CModemAtPipeController::HandlePipeRedirectResp() pipeHandle not found, pipe error: %d"), error ));
             TRACE_ASSERT_ALWAYS;
             return;
             }
         }
 
-    iAtHandler.SendAtModemDataRedirectResultReq( dteId, AT_MODEM_REDIRECT_RESULT_OK );
+    if( pipeHandle != iPipe.pipeHandle )
+        {
+        C_TRACE(( _L("CModemAtPipeController::HandlePipeRedirectResp() unknown pipehandle %d"), pipeHandle ));
+        TRACE_ASSERT_ALWAYS;
+        return;
+        }
 
-    if( iPipeTable[ dteId ].iPipeState != TPipeInfo::EPipeDisabled )
+    iAtHandler.SendAtModemDataRedirectResultReq( pipeHandle, AT_MODEM_REDIRECT_RESULT_OK );
+
+    if( iPipe.pipeState != TPipeInfo::EPipeDisabled )
         {
         SendEnablePipeReq( pipeHandle );
         }
-
     }
 
 void CModemAtPipeController::QueryModemAtFromNameService() 
@@ -658,25 +641,6 @@
     delete message;
     }
 
- TInt CModemAtPipeController::FindDteId( const TInt aHandle )
-    {
-    C_TRACE (( _T("CModemAtPipeController::FindDteId()") ));
-    TInt dteId = KInvalidDteId;
-    for( TInt i = 0 ; i < KMaxDteIdCount ; i++ ) 
-        {
-        if( iPipeTable[i].iHandle == aHandle ) 
-            {
-            dteId = i;
-            break;
-            }
-        }
-
-    TRACE_ASSERT( dteId != KInvalidDteId );
-    C_TRACE((_L("CModemAtPipeController::FindDteId() returns dteid: %d"),dteId));
-    return dteId;
-    } 
-
- 
 void CModemAtPipeController::HandlePipeEnabledResp( const TIsiReceiveC& aReceivedMessage )
     {
     C_TRACE (( _T("CModemAtPipeController::HandlePipeEnabledResp()") ));
@@ -684,12 +648,18 @@
       PNS_PIPE_ENABLE_RESP_OFFSET_ERRORCODE);
     TInt pipeHandle = aReceivedMessage.Get8bit(ISI_HEADER_SIZE + 
       PNS_PIPE_ENABLE_RESP_OFFSET_PIPEHANDLE);
-    TInt dteId = FindDteId(pipeHandle);           
+    if( pipeHandle != iPipe.pipeHandle )
+        {
+        C_TRACE((_L("CModemAtPipeController::HandlePipeEnabledResp() unknown pipeHandle received")));
+        TRACE_ASSERT_ALWAYS;
+        return;
+        }
+
     C_TRACE((_L("CModemAtPipeController::HandlePipeEnabledResp() pipehandle %d"), pipeHandle));
        
     if( error == PN_PIPE_NO_ERROR )
         {
-        ChangePipeState( dteId, TPipeInfo::EPipeEnabled );
+        ChangePipeState( TPipeInfo::EPipeEnabled );
         }
     else
         {
@@ -699,22 +669,20 @@
     }
 
 
-void CModemAtPipeController::ChangePipeState(
-    const TInt aDteId,
-    TPipeInfo::EPipeState aState )
+void CModemAtPipeController::ChangePipeState( TPipeInfo::EPipeState aState )
     {
-    C_TRACE((_L("CModemAtPipeController::ChangePipeState(%d, %d)"), aDteId, aState));
-    C_TRACE(( _L("Was: iPipeTable[ %d ].iPipeState = %d"), aDteId, (TInt)iPipeTable[ aDteId ].iPipeState ));
-    iPipeTable[ aDteId ].iPipeState = aState;
+    C_TRACE((_L("CModemAtPipeController::ChangePipeState( New state: %d )"), (TInt)aState));
+    C_TRACE(( _L("Old iPipe.pipeState = %d"), (TInt)iPipe.pipeState ));
+    iPipe.pipeState = aState;
     if( aState == TPipeInfo::EPipeEnabled )
         {
         C_TRACE(( _T("DATA MODE") ));
-        iAtHandler.HandleCommandModeChange( aDteId, EDataMode );
+        iAtHandler.HandleCommandModeChange( EDataMode );
         }
     else if( aState == TPipeInfo::EPipeDisabled )
         {
         C_TRACE(( _T("COMMAND MODE") ));
-        iAtHandler.HandleCommandModeChange( aDteId, ECommandMode );
+        iAtHandler.HandleCommandModeChange( ECommandMode );
         }
     }
 
@@ -731,13 +699,13 @@
             {
             TUint8 pipeHandle( aReceivedMessage.Get8bit( ISI_HEADER_SIZE +
               PNS_PEP_STATUS_IND_OFFSET_PIPEHANDLE ) );
-            TInt dteId( FindDteId( pipeHandle ) );           
-            C_TRACE( (_L("CModemAtPipeController PEP_COMM_IND_ID_ESCAPE received, pipehandle %d dteid %d"), pipeHandle, dteId ));
+          
+            C_TRACE( (_L("CModemAtPipeController PEP_COMM_IND_ID_ESCAPE received, pipehandle: %d iPipe.pipeHandle: %d"), pipeHandle, iPipe.pipeHandle ));
 
-            if( dteId != KInvalidDteId )
+            if( pipeHandle == iPipe.pipeHandle )
                 {
-                C_TRACE( (_L("SendEscapeSignalDetection dteid %d"), dteId ));
-                iAtHandler.SendEscapeSignalDetection( dteId );
+                C_TRACE( (_L("SendEscapeSignalDetection dteid %d"), pipeHandle ));
+                iAtHandler.SendEscapeSignalDetection( pipeHandle );
                 }
             }
         // Not know should any other indicationid from comm pep type to be handled
@@ -753,5 +721,11 @@
         }
     }
 
+TUint8 CModemAtPipeController::GetPipeHandle()
+    {
+    C_TRACE((_L("CModemAtPipeController::GetPipeHandle %d"), iPipe.pipeHandle));
+    return iPipe.pipeHandle;
+    }
+
  #endif // NCP_COMMON_BRIDGE_FAMILY
 
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsession.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsession.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -145,9 +145,9 @@
             break;
 
         default:
-            C_TRACE(_L("default"));
-            _LIT( KPanicString, "AtServer");
-            aMessage.Panic( KPanicString, KErrNotSupported );
+            C_TRACE(_L("CModemAtSession::CheckAndCompleteExistingRequest Message not supported"));
+            _LIT( KApplicationName, "Modematconroller.exe");
+            aMessage.Panic( KApplicationName, KErrNotSupported );
             break;
         }
    
@@ -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") ));
@@ -185,8 +185,7 @@
             iClientNamePtr.Set( iClientName->Des() );
             aMessage.Read( KATModemResponseArgumentIndex, iClientNamePtr );
             iConnectReq = aMessage;
-            err = iServer.ConnectToModem( this );
-            ModemConnected( err );
+            iServer.ConnectToModem( this, iPluginType );
             break;
 
         case  EReceiveUnsolicitedResult:
@@ -216,7 +215,7 @@
 
         case EModemAtRemovePipe:
             C_TRACE (( _T("EModemAtRemovePipe") ));
-            iServer.RemovePipe( iDteId );
+            iServer.RemovePipe();
             aMessage.Complete(KErrNone);
             break;
 
@@ -238,7 +237,7 @@
             CAtMessage* message = new CAtMessage( EAtCmd, this, aMessage );
             TRACE_ASSERT( message );
             C_TRACE(_L("iServer.AddToSendFifo EAtCmd"));
-            iServer.AddToSendFifo( iDteId, iPluginType, message  );
+            iServer.AddToSendFifo( iPluginType, message  );
             }
             break;
         
@@ -255,14 +254,15 @@
             CAtMessage* message = new CAtMessage( EGetNvramStatus, this, aMessage );
             TRACE_ASSERT( message );
             C_TRACE(_L("iServer.AddToSendFifo EGetNvramStatus"));
-            iServer.AddToSendFifo( iDteId, iPluginType, message  );
+            iServer.AddToSendFifo( iPluginType, message  );
             break;
             }
         default:
             {
             C_TRACE(_L("CModemAtSession::DoServiceL message not supported"));
             aMessage.Complete( KErrNotSupported );
-            User::Panic(_L("ATServer"),KErrNotSupported);
+            _LIT( KApplicationName, "Modematconroller.exe");
+            aMessage.Panic( KApplicationName, KErrNotSupported );
             break;
             }
         }  
@@ -272,7 +272,6 @@
     const TVersion& aVersion ) :
     iServer( aServer ),
     iVersion( aVersion ),
-    iDteId( KInitialDteId ),
     iClientName( NULL ),
     iClientNamePtr( NULL, 0 )
     {
@@ -294,32 +293,18 @@
         }
     }
 
-TUint8 CModemAtSession::GetDteId() 
-    {
-    C_TRACE (( _T("CModemAtSession::GetDteId()") ));
-    return iDteId;    
-    }
-
-
 TATPluginInterface CModemAtSession::GetPluginType()
     {
     C_TRACE (( _T("CCModemAtSession::GetPluginType(%d)"),iPluginType ));
     return iPluginType;
     }
 
-
 TDesC8& CModemAtSession::GetName() 
     {
     C_TRACE( _T("CModemAtSession::GetName()") ); 
     return *iClientName;
     }
 
-void CModemAtSession::SetDteId( const TUint8 aDteId ) 
-    {
-    C_TRACE(( _T("CModemAtSession::SetDteId( %d )"), aDteId ));
-    iDteId = aDteId;   
-    }
-
 void CModemAtSession::ModemConnected( const TInt aErr ) 
     {
     C_TRACE(( _T("CModemAtSession::ModemConnected( %d )"), aErr ));
--- a/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -27,7 +27,9 @@
 
 
 CModemAtSrv::CModemAtSrv( TInt aPriority ) :
-    CPolicyServer( aPriority, KSrvPolicy ), iHandler(NULL)
+    CPolicyServer( aPriority, KSrvPolicy ),
+    iHandler(NULL),
+    iDteId( 0 )  // iDteId defaults to 0 and it is updated by PNS_PIPE_CREATE_RESP
     {
     }
 
@@ -49,10 +51,10 @@
     return self;
     }
 
-void CModemAtSrv::RemovePipe( const TUint8 aDteId )
+void CModemAtSrv::RemovePipe()
     {
     C_TRACE((_L("CModemAtSrv::RemovePipe()") ));
-    iHandler->RemovePipe( aDteId );
+    iHandler->RemovePipe( iDteId );
     }
 
 void CModemAtSrv::ClientClosed( CModemAtSession* aSession )
@@ -61,21 +63,16 @@
     TInt index = iSessions.Find( aSession );
     if( index >= 0 )
         {
-        //remove session from routing table, if dteId exists
-        if(iSessions[index]->GetDteId() != KInitialDteId )
-            {
-            iRouteTable[ iSessions[index]->GetPluginType() ][ iSessions[index]->GetDteId() ] = NULL;
-            }
         
         if( iSessions.Count() == 1 )
             {
             C_TRACE((_L("Disconnecting ISI message handler ") ));
-            iHandler->Disconnect( iSessions[ index ]->GetDteId() );
+            iHandler->Disconnect( iDteId );
             }
-    
-        C_TRACE((_L("Removing session (plugin type %d dteid: %d)"), iSessions[index]->GetPluginType(), iSessions[index]->GetDteId() ));
+
+        C_TRACE((_L("Removing session (plugin type %d)"), iSessions[index]->GetPluginType() ));
         iSessions.Remove( index );
-        
+
         C_TRACE((_T("<<CModemAtSrv::ClientClosed()") ));
         }
     }
@@ -96,23 +93,14 @@
     {
     C_TRACE (( _T("CModemAtSrv::ConstructL()") ));
     iHandler = CModemAtHandler::NewL( *this );
-    
-     //setup routing table
-    for( TInt i = 0 ; i < KPluginCount ; i++)
-        {
-        for(TInt o = 0; o < KMaxDteIdCount; o++)
-            {
-            iRouteTable[ i ][ o ] = NULL;
-            }
-        }
     } 
 
-void CModemAtSrv::HandleSignalInd( const TInt aDteId )
+void CModemAtSrv::HandleSignalInd( const TUint8 aDteId )
     {
     C_TRACE ((_T("CModemAtSrv::HandleSignalInd aDteId = %d sessions = %d"), aDteId, iSessions.Count() ));
     for( TInt i = 0; i < iSessions.Count(); i++ )
         {
-        if( iSessions[i]->GetDteId() == aDteId  && iSessions[i]->IsSignalIndReqActive() )
+        if( iDteId == aDteId  && iSessions[i]->IsSignalIndReqActive() )
             {
             C_TRACE (( _T("CModemAtSrv::HandleSignalInd() session found") ));
             iSessions[i]->SignalIndReceived();
@@ -120,12 +108,12 @@
         }
     }
 
-void CModemAtSrv::HandleUnsolicitedData( const TInt aDteId, const TDesC8& aData )
+void CModemAtSrv::HandleUnsolicitedData( const TUint8 aDteId, const TDesC8& aData )
     {
     C_TRACE ((_T("CModemAtSrv::HandleUnsolicitedData aDteId = %d sessions = %d"), aDteId, iSessions.Count() ));
     for( TInt i = 0; i < iSessions.Count(); i++ )
         {
-        if( (iSessions[i]->GetDteId() == aDteId || aDteId == KUnsolicitedDataDteId )&&
+        if( ( iDteId == aDteId || aDteId == KUnsolicitedDataDteId )&&
             iSessions[i]->IsUnsolicitedDataReqActive() &&
             iSessions[i]->GetPluginType() == EATExtPlugin )
             {
@@ -135,13 +123,12 @@
         }
     }
 
-void CModemAtSrv::HandleCommandModeChange( TInt aDteId, TCommandMode aMode )
+void CModemAtSrv::HandleCommandModeChange( TCommandMode aMode )
     {
-    C_TRACE ((_T("CModemAtSrv::HandleCommandModeChange aDteId = %d sessions = %d mode = %d"), aDteId, iSessions.Count(), (TInt) aMode ));
+    C_TRACE ((_T("CModemAtSrv::HandleCommandModeChange sessions = %d mode = %d"), iSessions.Count(), (TInt) aMode ));
     for( TInt i = 0; i < iSessions.Count(); i++ )
         {
-        if( iSessions[i]->GetDteId() == aDteId &&
-            iSessions[i]->IsCommandModeReqActive() &&
+        if( iSessions[i]->IsCommandModeReqActive() &&
             iSessions[i]->GetPluginType() == ECommonPlugin )
             {
             C_TRACE (( _T("CModemAtSrv::HandleCommandModeChange() session found") ));
@@ -150,20 +137,7 @@
         }
     }
 
-void CModemAtSrv::BroadcastModemConnected(const TUint aDteId, TInt aErr )
-    {
-    C_TRACE ((_T("CModemAtSrv::BroadcastModemConnected aDteId = %d err = %d sessions = %d"), aDteId, aErr, iSessions.Count() ));
-    for( TInt i = 0; i < iSessions.Count(); i++ )
-        {
-        if( iSessions[i]->GetDteId() == aDteId  && iSessions[i]->IsConnectReqActive() )
-            {
-            C_TRACE (( _T("CModemAtSrv::BroadcastModemConnected() session found") ));
-            iSessions[i]->ModemConnected( aErr );
-            }
-        }
-    }
-
-void CModemAtSrv::HandleIntermediateDataInd( const TInt aDteId,
+void CModemAtSrv::HandleIntermediateDataInd( const TUint8 aDteId,
     const TATPluginInterface aPluginType,
     const TDesC8& aResponse,
     const TUint8 aCommand )
@@ -182,7 +156,7 @@
         }
     }
 
-void CModemAtSrv::HandleATResponse( const TInt aDteId, const TDesC8& aResponse, const TUint8 aCommand )
+void CModemAtSrv::HandleATResponse( const TUint8 aDteId, const TDesC8& aResponse, const TUint8 aCommand )
     {
     C_TRACE ((_T(">>CModemAtSrv::HandleATResponse aDteId = %d sessions = %d "), aDteId, iSessions.Count() ));
     C_TRACE ((_T("CModemAtSrv::HandleATResponse command = %d"), aCommand ));
@@ -204,67 +178,39 @@
     C_TRACE ((_T("<<CModemAtSrv::HandleATResponse()") ));
     }
 
-TInt CModemAtSrv::ConnectToModem(CModemAtSession* aSession) 
+TInt CModemAtSrv::ConnectToModem( CModemAtSession* aSession, TATPluginInterface aPluginType ) 
     {
     C_TRACE ((_T(">>CModemAtSrv::ConnectToModem 0x%x"), aSession));
-    TInt type = aSession->GetPluginType();
-   
-    C_TRACE(( _L("session count: %d, type: %d"), iSessions.Count(), type ));
-    //find already defined dteid
-    for(TInt i = 0; i < iSessions.Count(); i++) 
+
+    C_TRACE(( _L("session count: %d, type: %d"), iSessions.Count(), (TInt) aPluginType ));
+
+    if( aPluginType == ECommonPlugin )
         {
-        TInt dteid = iSessions[i]->GetDteId();
-        TDesC8& name = iSessions[i]->GetName();
-        C_TRACE((_L("i: %d, dteid: %d"), i, dteid));
-        
-        //Is there plugin with samename
-        if( name.Compare(aSession->GetName())== 0 && dteid != KInitialDteId )
-            {
-            if( type == iSessions[i]->GetPluginType())
-                {
-                TRACE_ASSERT_ALWAYS;
-                aSession->SetDteId( dteid );
-                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));
+        C_TRACE ((_T("Common plug-in connecting")));
+        C_TRACE ((_T("<<CModemAtSrv::ConnectToModem iDteId: %d, session: 0x%x"), iDteId, aSession));
+        return iHandler->Connect( iDteId );
+        }
+    else
+        {
+        C_TRACE ((_T("Atext plug-in connecting")));
 
-            aSession->SetDteId( dteid );
-            C_TRACE ((_T("<<CModemAtSrv::ConnectToModem KErrNone 0x%x"), aSession));
-            return KErrNone;
-            }
+        aSession->ModemConnected( KErrNone );
+        C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
+        return KErrNone;
         }
 
-    //no AT-plugin& Common plugin, find first free dteid
-    TInt dteId = 0;
-    while(iRouteTable[0][dteId] || iRouteTable[1][dteId])
-        {
-        dteId++;
-      }     
-    ASSERT_PANIC_ALWAYS( dteId < KMaxDteIdCount );
-    iRouteTable[type][dteId] = aSession;
-    C_TRACE((_L("Added new dteid: %d"),dteId));
-
-    aSession->SetDteId(dteId);
-    C_TRACE ((_T("<<CModemAtSrv::ConnectToModem session: 0x%x"), aSession));
-    return iHandler->Connect( dteId );
     }
 
-void CModemAtSrv::AddToSendFifo( const TUint8 aDteId,
-    const TATPluginInterface aPluginType,
-    CAtMessage* aMessage )
+void CModemAtSrv::AddToSendFifo( const TATPluginInterface aPluginType, CAtMessage* aMessage )
     {
-    C_TRACE (( _T("CModemAtSrv::AddToSendFifo( dteId = %d,0x%x)"), aDteId, aMessage  ));
+    C_TRACE (( _T("CModemAtSrv::AddToSendFifo( aPluginType: %d, aMessage: 0x%x)"), (TInt)aPluginType, aMessage));
 
     iAtMessageArray.Append( aMessage ); // only one AT command at the time in modem
 
     if( iAtMessageArray.Count() == 1 ) //if empty Fifo send immediately
         {
         C_TRACE((_L("Sending message immediately")));
-        iHandler->SendATCommand( aDteId, 
+        iHandler->SendATCommand( iDteId, 
            aPluginType,
            aMessage->GetMessageType(),
            aMessage->GetBuffer() );
@@ -305,7 +251,7 @@
         ptr.Set( iAtMessageArray[0]->GetBuffer() );
         
         C_TRACE (( _T("iHandler->SendATCommand()") ));
-        iHandler->SendATCommand( iAtMessageArray[0]->GetSession()->GetDteId(), 
+        iHandler->SendATCommand( iDteId, 
            iAtMessageArray[0]->GetSession()->GetPluginType(),
            iAtMessageArray[0]->GetMessageType(),
            ptr );
@@ -346,3 +292,19 @@
     return iSessions.Count();
     }
 
+void CModemAtSrv::SetDteIdAndConnect( const TUint8 aDteId, const TInt aConnectionError ) 
+    {
+    C_TRACE(( _T("CModemAtSrv::SetDteIdAndConnect( %d )"), aDteId ));
+    iDteId = aDteId;
+
+    C_TRACE ((_T("sessions = %d"), iSessions.Count() ));
+    for( TInt i = 0; i < iSessions.Count(); i++ )
+        {
+        if( iSessions[i]->IsConnectReqActive() )
+            {
+            C_TRACE (( _T("set sessions to connected") ));
+            iSessions[i]->ModemConnected( aConnectionError );
+            }
+        }
+    }
+
--- a/adaptationlayer/modematadaptation/modematext_dll/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematext_dll/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_MMPFILES
 modematext_dll.mmp
--- a/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -60,7 +60,6 @@
     ("AT&D3"),
     ("AT+IFC"),
     ("AT+ILRR"),
-    ("ATS25"),
     ("AT&S"),
     ("AT&S0"),
     ("AT&S1"),
@@ -102,8 +101,6 @@
     ("ATH0"),
     ("ATO"),
     ("ATO0"),
-    ("ATT"),
-    ("ATP"),
     ("AT+DS"),
     ("AT+DR"),
     ("ATB"),
@@ -118,7 +115,6 @@
     ("AT+CSNS"),
     ("AT+CVHU"),
     ("AT+CREG"),
-    ("AT+COPS"),
     ("AT+CLIP"),
     ("AT+CLIR"),
     ("AT+COLP"),
@@ -155,7 +151,14 @@
     ("AT+CGDSCONT"),
     ("AT+CGTFT"),
     ("AT+CGCMOD"),
-    ("AT+CBCIE"),
+    ("AT+CRSM"),
+    ("AT+CSIM"),
+    ("AT+CPNET"),
+    ("AT+CPNSTAT"),
+    ("AT+CGPADDR"),
+    ("AT+CPLS"),
+    ("AT+ES"),
+    ("AT+ESA"),
     ("AT"),
     ("LAST")
     };
--- a/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.rss	Wed Apr 21 14:29:55 2010 +0300
@@ -40,7 +40,7 @@
           implementation_uid = 0x2001FCB3;
           version_no = 1;
           display_name = "Modem AT EXT";
-          default_data = "PATS0|PATS1|PATS2|PATS3|PATS4|PATS5|PATS6|PATS7|PATS8|PATS10|PATS12|PATS25|PATE|PATE0|PATE1|PATQ|PATQ0|PATQ1|PATV|PATV0|PATV1|PATX|PATX0|PATX1|PATX2|PATX3|PATX4|PATX5|PAT&C|PAT&C0|PAT&C1|PAT&D|PAT&D0|PAT&D1|PAT&D2|PAT&D3|PAT+IFC|PAT+ILRR|PATS25";
+          default_data = "PATS0|PATS1|PATS2|PATS3|PATS4|PATS5|PATS6|PATS7|PATS8|PATS10|PATS12|PATS25|PATE|PATE0|PATE1|PATQ|PATQ0|PATQ1|PATV|PATV0|PATV1|PATX|PATX0|PATX1|PATX2|PATX3|PATX4|PATX5|PAT&C|PAT&C0|PAT&C1|PAT&D|PAT&D0|PAT&D1|PAT&D2|PAT&D3|PAT+IFC|PAT+ILRR";
           opaque_data = "";
           rom_only = 0;
           },
@@ -58,7 +58,7 @@
           implementation_uid = 0x20022E87;
           version_no = 1;
           display_name = "Modem AT EXT";
-          default_data = "PAT+WS46|PATA|PATH|PATH0|PATO|PATO0|PATT|PATP|PAT+DS|PAT+DR|PATB|PATB0|PATB1|PATB2|PAT+CSTA|PAT+CHUP|PAT+CR|PAT+CEER|PAT+CRC|PAT+CSNS|PAT+CVHU|PAT+CREG|PAT+COPS|PAT+CLIP|PAT+CLIR|PAT+COLP|PAT+CCFC|PAT+CCWA|PAT+CHLD|PAT+CLCC|PAT+CSSN|PAT+CPAS";
+          default_data = "PAT+WS46|PATA|PATH|PATH0|PATO|PATO0|PAT+DS|PAT+DR|PATB|PATB0|PATB1|PATB2|PAT+CSTA|PAT+CHUP|PAT+CR|PAT+CEER|PAT+CRC|PAT+CSNS|PAT+CVHU|PAT+CREG|PAT+CLIP|PAT+CLIR|PAT+COLP|PAT+CCFC|PAT+CCWA|PAT+CHLD|PAT+CLCC|PAT+CSSN|PAT+CPAS";
           opaque_data = "";
           rom_only = 0;
           },
@@ -76,7 +76,7 @@
           implementation_uid = 0x20022E89;
           version_no = 1;
           display_name = "Modem AT EXT";
-          default_data = "PAT+CGTFT|PAT+CGCMOD|PAT|PATD*|PATI|PATI0|PATI1|PATI2|PATI3|PATI4|PATI9|PATI10|PATI11";
+          default_data = "PAT+CGTFT|PAT+CGCMOD|PAT|PATD*|PATI|PATI0|PATI1|PATI2|PATI3|PATI4|PATI9|PATI10|PATI11|PAT+CPNET|PAT+CPNSTAT|PAT+CGPADDR|PAT+ES|PAT+ESA|PAT+CRSM|PAT+CSIM|PAT+CPLS";
           opaque_data = "";
           rom_only = 0;
           }
--- a/adaptationlayer/systemstatemanageradaptation/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 ../rom/sspluginsadaptation.iby    NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(sspluginsadaptation.iby)
--- a/adaptationlayer/tsy/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 
 PRJ_EXPORTS
--- a/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -70,6 +70,7 @@
 SOURCE        cmmenstoremesshandler.cpp
 SOURCE        cmmphonebookoperationdelete.cpp
 SOURCE        cmmphonebookoperationwrite3g_adn.cpp
+SOURCE        cmmphonebookoperationdelete3g_adn.cpp
 
 // SMS & other messaging
 SOURCE        cmmsmsmesshandler.cpp
@@ -115,6 +116,7 @@
 LIBRARY       flogger.lib  // Logging
 LIBRARY       c32.lib      // Comms server
 LIBRARY       commdb.lib   // For data call
+LIBRARY       esock.lib    // For TSockAddr
 
 // ETel
 LIBRARY       etel.lib     // ETel Server
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -661,13 +661,6 @@
         */
         void PnsPipeCreateResp( const TIsiReceiveC &aIsiMessage );
 
-        /**
-        * PnsPipeRemove response.
-        * @param aIsiMessage, reference to the received message.
-        * @return void
-        */
-        void PnsPipeRemoveResp( const TIsiReceiveC& aIsiMessage );
-
     public:     // Data
         // None
 
@@ -795,12 +788,6 @@
         // Pipe handle for video/multimediacall
         TUint8 iPipeHandle;
 
-        // Call Operation ID
-        TUint8 iCallOperationID;
-
-        // Video call mo/mt released
-        TBool iVideoCallReleased;
-
         // CALL_ID of the call controlled request
         TUint8 iCallControlCallId;
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -211,6 +211,14 @@
             TUint8& aRegistrationStatus
             ) const;
 
+        /**
+        * Handles last received NET_MODEM_REG_STATUS_IND again
+        * so that network information is completed to the upper 
+        * layers
+        * @return void
+        */
+        void HandleLastNetModemRegStatusInd();
+
     private: // Constructors and destructor
 
         /**
@@ -582,6 +590,9 @@
         // NET_MODEM_REG_STATUS_GET_RESP and NET_SET_RESP messages.
         RPointerArray<HBufC8> iNetMessageQueue;
 
+        // For storing latest received NET_MODEM_REG_STATUS_IND
+        HBufC8* iLastNetModemRegStatusInd;
+
     protected: // Data
 
         // Pointer to the PhonetSender
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -36,6 +36,8 @@
 const TUint8 KDisplayTagLength = 30;
 // Operator code BCD string length.
 const TUint8 KBCDLength = 3;
+// Max buffer length for Operator name.
+const TInt KMaxLengthOfOperatorName = 124;
 
 // MACROS
     //None
@@ -270,7 +272,7 @@
 
         /**
         * Checks one OPL rule record against received Operator Code
-        * in BCD format and LAC value.
+        * and LAC value.
         * @param aIndex is OPL record index.
         * @param aOperCode is Operator Code in BCD format.
         * @param aLAC is Location Area Code.
@@ -282,17 +284,6 @@
             TUint aLac );
 
         /**
-        * Check BCD char against rule to find out is that matching
-        * with OPL list.
-        * @param aOperCodeChar is character from one BCD byte.
-        * @param aPlmnListChar is character from OPL list BCD byte.
-        * @return success/failure value.
-        */
-        TInt BCDCharChecker(
-             TUint8 aOperCodeChar,
-             TUint8 aPlmnListChar );
-
-        /**
         * Copy EONS Long and Short names if exist.
         * @param aNetworkData is Network data.
         * @return None.
@@ -490,6 +481,11 @@
         // Buffer for Operator Name String (ONS name).
         TBuf<KOnsNameMaxLength> iOperatorNameString;
 
+        // Buffers for custom EONS and NITZ names.
+        TBuf<KMaxLengthOfOperatorName> iCustomNitzLongNameString;
+        TBuf<KMaxLengthOfOperatorName> iCustomNitzShortNameString;
+        TBuf<KMaxLengthOfOperatorName> iCustomEonsNameString;
+
         // Operator PLMN list available.
         TBool iOplListAvailable;
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketcontextmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketcontextmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -11,12 +11,10 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
-
-
 #ifndef CMMPACKETCONTEXTMESSHANDLER_H
 #define CMMPACKETCONTEXTMESSHANDLER_H
 
@@ -114,14 +112,6 @@
 // Subbclock length
 const TInt KSubBlockLengthOffset1 = 1;
 
-// masks for detailed cause values.
-// see 3GPP TS 24.008 V5.16.0 spec
-const TUint8 KDiagnosticsOctet2( 0x02 ); // B0000_0100
-const TUint8 KDiagnosticsOctet3( 0xC0 ); // B1100_0000
-const TUint8 KDiagnosticsOctet4( 0x95 ); // B1001_0101
-const TUint8 KDiagnosticsOctet5( 0x82 ); // B1000_0010
-const TUint8 KDiagnosticsOctet6( 0x02 ); // B0000_0010
-
 // MACROS
     // None
 
@@ -230,7 +220,7 @@
         * By default Symbian 2nd phase constructor is private.
         */
         void ConstructL();
-        
+
     private: // New functions
 
         /**
@@ -825,22 +815,32 @@
         * @param aIsiMessage: received Isi message.
         */
         void CallModemResourceResp( const TIsiReceiveC &aIsiMessage );
-        
+
         /**
         * Creates SendCallmodemResourceDenied ISI message to modem call server.
         * @param aDatapackage
         * @return None
         */
-        void CallModemResourceReqDenied();
-        
+        void CallModemResourceReqDenied(
+            const TUint8 aCauseType,
+            const TUint8 aCause,
+            const TDesC8& aDetailedCause );
+
         /*
-        * This method completes drive mode functions, if drive mode flag 
+        * This method completes drive mode functions, if drive mode flag
         * is enabled
         * @param aDataPackage: data package
-        * @return TInt: KErrNone 
+        * @return TInt: KErrNone
         */
         void CompleteDCMdrivemodeFunctionalityL();
 
+        /*
+        * This method interpretes channel ID from context name.
+        * @param TInfoName: Context name
+        * @return TInt: Channel ID
+        */
+        TInt getProxyId(const TInfoName& contextName);
+
     public: // Data
         // None
 
@@ -893,8 +893,8 @@
 
         // Buffer for isimessage. Used in resource control
         HBufC8* iResourceControlMsg;
-        
-        //drive mode flag 
+
+        // drive mode flag
         TBool iDriveModeFlag;
 
     };
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketmesshandlercontextlist.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmpacketmesshandlercontextlist.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -75,15 +75,6 @@
             TBool iChannelOpened;
         };
 
-    // Proxy Id List contains TMmProxyIdList elements.
-    class TMmProxyIdList
-        {
-        public:
-            TUint8 iObjectId;
-            TUint8 iChannelId;
-            TBool iIsFree;
-        };
-
 // FUNCTION PROTOTYPES
     // None
 
@@ -149,15 +140,6 @@
         TInt NumberOfContexts() const;
 
         /**
-        * Generates new proxy id.
-        * @param aProxyId: proxy id (channel id) of the context
-        * @return TInt: KErrNone or error code
-        *     (KErrOverflow: maximum number of context already created)
-        */
-        TInt GenerateProxyId(
-            TUint8& aProxyId );
-
-        /**
         * Sets context id to the context info list.
         * @param aContextId: context id
         * @param aTransactionId: transaction id
@@ -634,6 +616,13 @@
         */
         TUint8 GetContextTypeById( const TUint8 aContextId );
 
+        /**
+        * Initialize context info list
+        * @param aContextId: id of the context
+        * @return none
+        */
+        void InitializeContextInfoList( const TUint8 aContextId );
+
     public: // Functions from base classes
         // None
 
@@ -671,9 +660,6 @@
         // A context info list.
         TMmContextInfo iContextInfoArray[KMmMaxNumberOfContexts];
 
-        // A proxy id list.
-        TMmProxyIdList iProxyIdList[KMmMaxNumberOfContexts];
-
         // Number of created contexts in context info list.
         TInt iNumberOfCreatedContexts;
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -113,6 +113,59 @@
         */
         void CancelReq( TName& aPhoneBook );
 
+        /**
+        * Read application file info from SIM/USIM
+        * @param aFileId
+        * @param aRecordId
+        * @param aTrId Transaction ID:
+        * @return Error code
+        */
+        TInt UiccReadApplFileInfo( const TInt aFileId,
+                                   const TInt aRecordId,
+                                   const TUint8 aTrId );
+
+        /**
+        * Handles Recieved data
+        * @param aTransId Transaction ID:
+        * @param TInt aStatus : To get the UICC Server response status
+        * @param const TDesC8 &aFileData : Data received in ISI Message
+        * @retun EFalse/ETrue to notify is operation completed or not
+        */
+        TBool HandleUiccReadApplFileInfoResp(
+            TInt aTransId,
+            TInt aStatus,
+            const TDesC8 &aFileData );
+
+        /**
+        * Checks is MSISDN service available.
+        * @return value KErrNone or KErrNotSupported
+        */
+        TInt CheckMSISDNSupport();
+
+        /**
+        * Completes given IPC with data package
+        */
+        void CompleteThisIPC
+            (
+            TInt aIPCToBeCompleted,
+            CMmDataPackage* aDataPackage,
+            TInt ret
+            );
+
+        /**
+        * Read application file data from SIM/USIM
+        * @param aFileId
+        * @param aRecordId
+        * @param aTrId Transaction ID:
+        * @return Error code
+        */
+        TInt UiccReadApplFileData
+        	   (
+	           const TInt aFileId,
+             const TInt aRecordId,
+             const TUint8 aTrId
+             );
+
     public: // Data
         // None
 
@@ -120,6 +173,38 @@
         // Store information about operation has been canceled or not
         TBool iCancelOperation;
 
+        // Record ID
+        TInt iRecordId;
+
+        // Saved IPC
+        TInt iSavedIPC;
+
+        // Attribute to check what kind of read is ongoing
+        TTypeOfFileToBeRead iTypeOfReading;
+       
+        // Attribute to store file id
+        TUint16 iFileId;
+        
+        // Attribute to store Ext FileID
+        TUint16 iExtFileId;
+        
+        // Attribute to store ArrayIndex
+        TUint8 iArrayIndex;
+
+        // Service type for EMmTsyONStoreGetInfoIPC
+        TServiceType iServiceType;
+
+        // Attribute to Store Entry
+        TPBEntry* iStoreEntry;
+
+        // To Store the information about no of entries filled in commontsy araay
+        TInt iNumOfEntriesFilled;
+
+        // Length of the EXT file
+        TInt iEXTNumberLen;
+
+        // Flag to store EXT needs to be read or not
+        TBool iExtensionToRead;
     private: // Data
 
         // Number of used SDN entries
@@ -128,25 +213,7 @@
         // 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;
-
-        // Attribute to Store Entry
-        TPBEntry* iStoreEntry;
-
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
-        // Flag keeps track if GAS is cashed or not
-        TBool iGASCacheIsReady;
-
-        // Flag keeps track if AAS is cashed or not
-        TBool iAASCacheIsReady;
-
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 
     };
 #endif // _CMMPHONEBOOK_OPERATION_CACHE_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationdelete.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationdelete.h	Wed Apr 21 14:29:55 2010 +0300
@@ -72,6 +72,11 @@
         ~CMmPhoneBookOperationDelete();
 
         /**
+        * By default Symbian OS constructor is private.
+        */
+        CMmPhoneBookOperationDelete();
+
+        /**
         * This method creates entry point to correct operation
         * @param aPhonebookType PhoneBook type
         * @param aIpc IPC
@@ -81,18 +86,7 @@
             TName aPhonebookType,
             TInt aIpc );
 
-  private:
-
-        /**
-        * By default Symbian OS constructor is private.
-        */
-        CMmPhoneBookOperationDelete();
-
-        /**
-        * Class attributes are created in ConstructL.
-        */
-        //void ConstructL();
-
+    protected:
         /**
         * Separates different IPC requests for each other.
         *
@@ -118,6 +112,8 @@
             const TDesC8& aFileData,
             TInt aTransId );
 
+    private:
+
         /**
         * Handles request to delete a phonebook entry
         * @return KErrNone or error value
@@ -151,6 +147,22 @@
         TInt HandleReadEntryResp( const TDesC8& aFileData );
 
         /**
+        * Handles Delete for phoenBook Entry
+        * @param aFileData File data
+        * @return KErrNone or error value
+        */
+        TInt HandleDeleteEntryResp(
+            TBool &aComplete,
+            TInt &aLocation );
+
+        /**
+        * Handles Deelte for phoenBook Entry Ext Data
+        * @param aFileData File data
+        * @return KErrNone or error value
+        */
+        TInt HandleDeleteExtResp();
+
+        /**
         * Creates and sends ISI message in order to read an extension
         * @return KErrNone or error value
         */
@@ -176,7 +188,7 @@
         * @param aFileData File data
         * @return KErrNone or error value
         */
-        TInt HandleWriteMBIReadResp(TInt aStatus, TUint8 aDetails, TBool &aComplete, const TDesC8& aFileData );
+        TInt HandleMBIReadResp(TInt aStatus, TUint8 aDetails, TBool &aComplete, const TDesC8& aFileData );
         
         /**
         * Creates request to Delete MBI profile
@@ -189,18 +201,17 @@
         // None
 
     protected:  // Data
-        // none
+        // Phone book entry to be deleted
+        CPhoneBookStoreEntry* iPhoneBookEntry;
+
+        // IPC number of operation
+        TInt iIpc;
 
     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;
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit.h	Wed Apr 21 14:29:55 2010 +0300
@@ -61,9 +61,6 @@
     // None
 
 // FORWARD DECLARATION
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-class CAlphaString;
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 class CMmPhoneBookOperationInit3G_adn;
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Wed Apr 21 14:29:55 2010 +0300
@@ -42,10 +42,6 @@
     // None
 
 // FORWARD DECLARATION
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-class CAlphaString;
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 
 // CLASS DECLARATION
 /**
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -60,7 +60,8 @@
         static CMmPhoneBookOperationRead* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
             CMmUiccMessHandler* aUiccMessHandler,
-            const CMmDataPackage* aDataPackage );
+            const CMmDataPackage* aDataPackage,
+            TInt aIpc );
 
         /**
         * Destructor.
@@ -68,30 +69,109 @@
         ~CMmPhoneBookOperationRead();
 
         /**
-        * This method created entry point to correct operation
-        * @param TName aPhonebookType:
-        * @param TInt aIpc: Identify number of request.
-        * @return CMmPhoneBookStoreOperation*: pointer to operation.
+        * Sends Request To Get Read and Write Size
+        * for Msisdn PB
+        * @param TUint8 aTransId : TransactionId
+        * @return TInt: KErrNone or error value.
+        */
+        TInt USimReadWriteSizeReq( TUint8 aTransId );
+
+        /**
+        * Construct UICC Req to read Entry
+        * @param
+        * @return TInt: KErrNone or error value.
+        */
+        TInt USimPbReqRead( TInt aRecordNo, TUint8 aTransId );
+
+        /**
+        * Appends Correct record numner to request
+        * @param aParams
+        * @return TInt: KErrNone or error value.
         */
-        static CMmPhoneBookOperationRead* Build(
-            TName aPhonebookType,
-            TInt aIpc );
+        TInt AddParamToReadReq( TUiccReadLinearFixed& aParams );
+
+        /**
+        * Handles SimPbResp ISI -message
+        * @param  aStatus
+        * @param aTransId
+        * @param aFileData
+        * @param pbFileId
+        * @param fileIdExt
+        * @parma arrayIndex
+        * @return TInt: KErrNone or error value.
+        */
+        TBool  USimPbReadRespL( TInt aStatus, 
+                TUint8 aTransId,
+                const TDesC8 &aFileData );
 
+        /**
+        * Handles response for Msisdn read Write size request
+        * @param  TDesC8 &aFileData :  Response Data
+        * @return TInt: KErrNone or error value.
+        */
+        TBool USimReadWriteSizeResp( const TDesC8 &aFileData, 
+                                    TInt aStatus );
+
+  private:
+
+      /**
+      * 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.
+      */
+      TInt UICCCreateReq( TInt aIpc, const CMmDataPackage* aDataPackage, TUint8 aTransId );
 
 
-virtual TInt UICCHandleData3gADNReadReq( TInt /*aFileID*/, TInt /*aFileSFI*/)
-{
-        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
-        return KErrNotSupported;
-}
+      /**
+      * Handles read resp for main Entry
+      * @param  aFileData
+      * @param aTransId
+      * @param aEmptyEntry  : Entry is EMpty or not
+      * @param aEntryStore : ENtry is store in internal list or not
+      * @return TInt: KErrNone or error value.
+      */
+      void HandleReadResp( 
+              const TDesC8 &aFileData, 
+              TUint8 aTransId, 
+              TInt &aEmptyEntry, 
+              TBool &aEntryStore );
+
+      /**
+      * Handles read resp for main Entry when Entry is present
+      * @param  aFileData
+      * @param aTransId
+      * @param aEntryStore : ENtry is store in internal list or not
+      * @return TInt: KErrNone or error value.
+      */
+      void HandleEntryPresentResp( 
+              const TDesC8 &aFileData, 
+              TUint8 aTransId, 
+              TBool &aEntryStore );
+
+      /**
+      * 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.
+      */
+      TBool HandleUICCPbRespL(
+              TInt aStatus,
+              TUint8 aDetails,
+              const TDesC8 &aFileData,
+              TInt aTransId);
 
 
-virtual TInt HandleUICC3gADNRespL(const TInt /*aStatus*/, const TDes8& /*aFileData*/, const TInt /*aTransId*/)
-{
-        TFLOGSTRING("TSY: CMmPhoneBookOperationInit::CreateReq - Return KErrNotSupported");
-        return KErrNotSupported;
-}
-  private:
+      /**
+      * Handles EXT file read resp
+      * @param aFIleData 
+      * @param aTransId
+      * @return TInt: KErrNone or error value.
+      */
+      void HandleExtReadResp( const TDesC8 &aFileData, 
+                              TUint8 aTransId,
+                              TBool &aEntryStored );
 
 
         /**
@@ -102,21 +182,6 @@
         // Transmit
 
         /**
-        * 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.
-        */
-        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, TUint8 aTransId );
-
-        /**
         * Constructs Data to read entry from USIM ADN Phonebook
         * @param
         * @return TInt: KErrNone or error value.
@@ -126,20 +191,6 @@
 
         // Receive
 
-        /**
-        * 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.
-        */
-        TBool HandleUICCPbRespL(
-                TInt aStatus,
-                TUint8 aDetails,
-                const TDesC8 &aFileData,
-                TInt aTransId);
-
-
 
         /**
         * Handles SimPbResp ISI -message
@@ -149,6 +200,17 @@
         */
         TInt UICCHandleDataADNReadResp( const TDesC8& aFileData);
 
+        /**
+        * Store Entry to internal List and CacheArray
+        * @param  TBool &aEntryStored
+        */
+        void StoreEntryToListL( TBool &aEntryStored );
+
+        /**
+        * Store Own Number Entry to internal and compelte
+        * @param  TInt aRet
+        */
+        void StoreAndCompleteOwnNumber( TInt aRet, TInt aEmptyEntry );
 
     public: // Data
         // None
@@ -164,6 +226,21 @@
         // To Store the information about first valid Entry Search
         TBool iLocationSearch;
 
+        // Attribute to Store Entry
+        TPBEntry* iStoreEntry;
+
+        // Saved IPC for complete
+        TInt iSavedIPCForComplete;
+        
+        // Attribute store fileid
+        TUint16 iFileId;
+        
+        // Attribute to store Ext File 
+        TUint16 iExtFileId;
+        
+        // Attribute to store Phonebook conf array index
+        TUint8 iArrayIndex;
+
     private: // Data
 
         // Attribute to check what kind of read is ongoing
@@ -171,11 +248,7 @@
 
         TBool iExtensionRead ;
         
-        // Attribute to Store Entry
-        TPBEntry* iStoreEntry;
         
-        // Saved IPC for complete
-        TInt iSavedIPCForComplete;
 
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread3g_adn.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationread3g_adn.h	Wed Apr 21 14:29:55 2010 +0300
@@ -22,6 +22,7 @@
 #include <ctsy/pluginapi/cmmdatapackage.h>
 #include <e32base.h>
 #include "cmmphonebookoperationread.h"
+#include "muiccoperationbase.h"
 
 // CONSTANTS
     // None
@@ -33,7 +34,15 @@
     // None
 
 // EXTERNAL DATA STRUCTURES
-    // None
+
+enum TPBAdn3GReadPhases
+    {
+    EPBReadPhase_PBR_Read_Entry = 0,
+    EPBReadPhase_Read_Type1_Entry,
+    EPBReadPhase_Read_Type2_Entry,
+    EPBReadPhase_Read_type3_Entry,
+    EPB_3G_ADN_Read_Phase_complete
+    };
 
 // FUNCTION PROTOTYPES
     // None
@@ -55,7 +64,8 @@
                (
                 CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
                 CMmUiccMessHandler* aUiccMessHandler,
-                const CMmDataPackage* aDataPackage // Data
+                const CMmDataPackage* aDataPackage, // Data
+                TInt aIpc
                );
 
         /**
@@ -80,24 +90,215 @@
         // Transmit 
 
         /**
+        * Check for valid ipc and PhoneBook
+        * @param aIpc : Ipc
+        * @param aDataPackage: Data received from Commontsy
+        * @param aTransId : Transaction id
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UICCCreateReq
+            (
+            TInt aIpc,
+            const CMmDataPackage* aDataPackage,
+            TUint8 aTransId
+            );
+
+        /**
         * Constructs Data to read entry from USIM ADN Phonebook
         * @param
         * @return TInt: KErrNone or error value.
         */
-        TInt UICCHandleData3gADNReadReq(TInt aFileId, TInt aFileSFI);
+        TInt UICCHandleData3gADNReadReq
+             (            
+             const CMmDataPackage* aDataPackage,
+             TUint8 aTransId
+             );
+        
         
+        /**
+        * Creates request to read record
+        * @param aTraId : Transaction Id
+        * @param aFileId : FielId
+        * @param aFileidSfi : aFileIdSfi
+        * @param aRecordNo : record number to be read
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UiccReadEfRecordReq( 
+            const TInt aTraId, 
+            const TUint16 aFileId, 
+            const TUint8 aFileIdSfi,
+            const TUint8 aRecordNo );
+
         
         // Receive
 
         
+        TBool HandleUICCPbRespL
+            (
+            TInt aStatus,
+            TUint8 aDetails,
+            const TDesC8 &aFileData,
+            TInt aTransId
+            );
+
         /**
         * Handles SimPbResp ISI -message
         * @param  TInt aTagValue
         * @param  TDes8& aFileData
         * @return TInt: KErrNone or error value.
         */
-        TInt HandleUICC3gADNRespL(const TInt aStatus, const TDes8& aFileData, const TInt aTransId);
+        TBool HandleUICC3gADNRespL(const TInt aStatus, 
+                                  const TDesC8& aFileData,
+                                  const TInt aTransId);
         
+        /**
+        * Handles response for PBR record read
+        * @param  TInt aStatus : UICC Server status
+        * @param  TDesC8& aFileData : Response Data
+        * @param TInt aTraId : transaction id
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UiccReadEfPbrRecordResp( 
+            TInt aStatus, 
+            const TDesC8 &aFileData, 
+            TInt aTraId );
+
+        /**
+        * Handles response for Type1 files record read response
+        * @param  TInt aStatus : UICC Server status
+        * @param TInt aTraId : transaction id
+        * @param  TDesC8& aFileData : Response Data
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UiccReadEfType1RespL(
+                TInt aStatus, 
+                TInt aTraId,
+                const TDesC8 &aFileData );
+
+        /**
+        * Handles response for Type2 files record read response
+        * @param  TInt aStatus : UICC Server status
+        * @param TInt aTraId : transaction id
+        * @param  TDesC8& aFileData : Response Data
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UiccReadEfType2RespL(
+                TInt aStatus, 
+                TInt aTraId,
+                const TDesC8 &aFileData );
+
+        /**
+        * Handles response for Type3 files record read response
+        * @param  TInt aStatus : UICC Server status
+        * @param TInt aTraId : transaction id
+        * @param  TDesC8& aFileData : Response Data
+        * @return TInt: KErrNone or error value.
+        */
+        TInt UiccReadEfType3RespL(
+                TInt aStatus, 
+                TInt aTraId,
+                TUint8 aFileTag,
+                const TDesC8 &aFileData );
+
+        /**
+        * Send request to continue reading Entry after reading Ext record
+        * @param TUint8 aIndex : record index to be read
+        * @const TDesC8 &aFileData : response data for Ext record read
+        * @param TInt aTraId : Transaction id
+        * @TInt &aExtFileTagIndex : Index offset for Ext record identifier 
+        * in filedata
+        * @return TInt : KErrNone or Error value
+        */
+        TInt CheckForExtToContinueNextRead( 
+                TUint8 aIndex, 
+                const TDesC8 &aFileData, 
+                TInt aTraId,
+                TInt &aExtFileTagIndex );
+
+        /**
+        * Send request to continue reading Entry
+        * @param TUint8 aTraId : transaction id
+        * @return TInt : error value
+        */
+        TInt ContinueWithNextReading( TUint8 aTraId );
+
+        /**
+        * Send Request to start reading Entry
+        * @param TUitn8 aTransId : TransactionId
+        * @return TInt : errorValue
+        */
+        TInt StartReadingEntry( TUint8 aTransId );
+
+        /**
+        * Creates Entry to append in the internal List
+        * @param TInt aLocation : Entry Index
+        */
+        void CreateInternalPbEntryL(
+            const TInt aLocation );
+
+        /**
+        * Creates Entry to append in the Sharing Buffer
+        * @param TInt aLocation : Entry Index
+        * @TBool &aAllocatedNow . If the Entry is Allocated now 
+        * or returned earlier allocated entry
+        * @return CPhoneBookStoreEntry* : Entry pointer
+        */
+        CPhoneBookStoreEntry* CreateReadPbEntryL(
+            const TInt aLocation, TBool& aAllocatedNow );
+
+        /**
+        * Search for Index for respective FileId in respective FileList
+        * @param TUint8 aFileTag : FileTag needs to be searched
+        * @param RArray <TPrimitiveTag>& aFileList : FileList in 
+        * which search needs to be done
+        * @param TUinr8 aOffset : offset for start index
+        * @return TInt : KErrNone or KErrNotFound
+        */
+        TInt SearchForFileTagIndex(
+                    TUint8 aFileTag,
+                    RArray <TPrimitiveTag>& aFileList,
+                    TUint8 aOffset );
+
+        /**
+        * Send request to read next Type 2 file
+        * @param TInt aTraId : Transaction id
+        * @return TInt : KErrNone or KErrNotFound
+        */
+        TInt CheckForNextType2Read( TInt aTraId );
+        
+        /**
+        * Get next used Type 2 File index
+        * @param TInt aOffset : offset to start location
+        * @return TInt : KErrNone or KErrNotFound
+        */
+        TInt GetNextUsedType2FileRecord( TInt &aOffset );
+
+        /**
+        * GetNext valid Type1 FileId 
+        * @return TInt : KErrNotFound ot KErrNone
+        */
+        TInt GetNextType1File();
+
+        /**
+        * Check Entry is Empty or not
+        * @param TUint8 aFileType : Type1 Type1 or Type3
+        * @param TDesC8 &aFileData 
+        * @return TBool : ETrue or EFalse
+        */
+        TBool CheckForEmptyEntry(
+            const TUint8 aFileType,
+            const TDesC8 &aFileData );
+
+        /**
+        * Get the empty record pattern for 
+        * all ADN 3G Files
+        * @param  TUint8 aFileType : Type1 Type2 or Type3
+        * @param  TDes8& aEmptyPattern : Empty pattern for file
+        */
+        void GetEmptyRecordPattern(
+            const TUint8 aFileType,
+            TDes8& aEmptyPattern );
+
     public: // Data
         // None
 
@@ -107,9 +308,32 @@
     private: // Data
         // None
 
+        // Attribute to store the Current PBR rrecord number
+        TUint8 iCurrentPBRRecordNo;
+        
+        // Attribute to store the current EF record number
+        TUint8 iCurrentEfEntryIndex;
+        
+        // Attribute to store the Current Phase ongoing
+        TPBAdn3GReadPhases iCurrentReadPhase;
 
-        // List of Pbr Files records
-        RArray <TPrimitiveTag> iPBRFileRecordArray;
+        // stores type 1 file list from EFpbr
+        RArray <TPrimitiveTag> iType1FileArray;
+        
+        // stores type 2 file list from EFpbr
+        RArray <TPrimitiveTag> iType2FileArray;
+        
+        // stores type 3 file list from EFpbr
+        RArray <TPrimitiveTag> iType3FileArray;
+        
+        // Attribute Store the current type 1 file reading
+        TInt iCurrentType1Ef;
+        
+        // Attribute to Current Type2 File
+        TInt iCurrentType2Ef;
+        
+        // Attribute to store information about typeFileoperation ongoing
+        TBool iType2OperationOngoing;
 
 
 };
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -36,7 +36,7 @@
 //  EXTERNAL DATA STRUCTURES
 enum TPBWritePhases
     {
-    EPBWritePhase_Read_Entry = 0,
+    EPBWritePhase_Read_Entry = 1,
     EPBWritePhase_Read_Ext_Entry,
     EPBWritePhase_Search_Ext_Entry,
     EPBWritePhase_Write_Entry,
@@ -66,7 +66,8 @@
         static CMmPhoneBookOperationWrite* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
             CMmUiccMessHandler* aUiccMessHandler,
-            const CMmDataPackage* aDataPackage );
+            const CMmDataPackage* aDataPackage,
+            TInt aIpc);
 
         /**
         * Destructor.
@@ -92,13 +93,14 @@
     protected:
         
         /**
-        * Creates and sends ISI message in order to read MBI Profile form first record
+        * 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 UiccPbReqReadMBI( TUint8 aIndex, TUint8 aTransId );
+        TInt UiccPbReqReadMBI( TUint8 aOffset, TUint8 aTransId );
 
         /**
         * Creates and sends ISI message in order to wite an entry to SIM
@@ -127,6 +129,13 @@
                 const TDesC8& aFileData,
                 TInt aTransId );
 
+        /**
+        * Copy data from one buffer to othe
+        * @param &aSource : source buffer
+        * @param &aTraget : target buffer
+        */
+        static void CopyData( const TDesC16& aSource, TDes16& aTarget );
+
 
 
   private:
@@ -156,17 +165,15 @@
         * @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 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 );
+            TUint8 aTransId );
 
         /**
         * Handles HandleWriteReadExtEntryResp aFileData
@@ -175,17 +182,16 @@
         * @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 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);
-
+            TUint8 aTransId );
+        
         /**
         * Handles HandleWriteSearchExtEntryResp aFileData
         *
@@ -193,16 +199,15 @@
         * @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 aArrayIndex - Array index for the Array in which configuration
+        *  data Stored
         * @param aStatus - Response message status
         * @return complete 
         */
         TInt HandleWriteSearchExtEntryResp(
             TInt aStatus,
             const TDesC8& aFileData,
-            TUint8 aTransId,
-            TUint16 aFileId,
-            TUint16 aFileIdExt );
+            TUint8 aTransId );
         
         /**
         * Handles HandleWriteEntryResp aFileData
@@ -211,15 +216,14 @@
         * @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 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 );
+            TUint8 aTransId );
 
         /**
         * Handles HandleWriteExtEntryResp aFileData
@@ -228,15 +232,14 @@
         * @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 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);
+            TUint8 aTransId );
         
         /**
         * Handles HandleWriteMBIReadResp aFileData
@@ -245,7 +248,8 @@
         * @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 aArrayIndex - Array index for the Array in which configuration
+        *  data Stored
         * @param aStatus - Response message status
         * @return complete 
         */
@@ -269,6 +273,17 @@
                 TUint8 aDetails );
 
         /**
+        * Creates request to Writy Msisdn Main Entry
+        *
+        * @param aTransId - Transaction id received
+        * @param RMobileONStore::TMobileONEntryV1 aEntry - Entry to be written
+        * @return complete 
+        */
+        TInt UiccPbReqWriteMsisdn( 
+                     TUint8 aTransId, 
+                     RMobileONStore::TMobileONEntryV1 aEntry );
+
+        /**
         * Creates and sends ISI message in order to wite an entry to SIM
         *
         * @param aTraId Transaction id
@@ -277,7 +292,6 @@
         * @return KErrNone or error value
         */
         TInt UiccPBReqWriteEntry(
-                TUint16 aFileId,
                 TUint8 aIndex,
                 TUint8 aTraId,
                 CPhoneBookStoreEntry& aDataToWrite );
@@ -294,12 +308,11 @@
         TInt UiccPbReqWriteExt(
                 TUint8 aTraId,
                 TUint8 aIndex,
-                TUint16 aFileId,
-                TUint16 aFileIdExt,
                 CPhoneBookStoreEntry& aDataToWrite );
 
         /**
-        * Creates and sends ISI message in order to read an existing entry Ext record from SIM
+        * Creates and sends ISI message in order to read an existing entry Ext 
+        * record from SIM
         *
         * @param aTraId Transaction id
         * @param aIndex Location index
@@ -307,13 +320,12 @@
         * @return KErrNone or error value
         */
         TInt UiccPbReqWriteReadExt(
-                TUint16 aFileId,
-                TUint16 aFileIdExt,
                 TUint8 aIndex,
                 TUint8 aTraId );
 
         /**
-        * Creates and sends ISI message in order to read an existing entry from SIM
+        * Creates and sends ISI message in order to read an existing entry from
+        * SIM
         *
         * @param aTraId Transaction id
         * @param aIndex Location index
@@ -321,32 +333,82 @@
         * @return KErrNone or error value
         */
         TInt UiccPbReqWriteRead(
-                TUint16 aFileId,
                 TUint8 aIndex,
                 TUint8 aTraId );
 
         /**
-        * Creates and sends ISI message in order to delete EXT file record releted to PB entry
+        * Starts Write Entry When Entry is present in internal List
+        * SIM
+        *
+        * @param TPBEntry &aEntry : Internal List Entry
+        * @param TUint8 aExtRecNo : Total number of Ext records 
+        * for new Entry to write
+        * @param TUint8 aTransId : Transaction id
+        * @param CPhoneBookStoreEntry& aDataToWrite : New Entry data
+        * @param TUint16 aPbFileId : PhoneBook FileId
+        * @param TUint16 aPbExtFileId : Phonebook Ext File id
+        * @return KErrNone or error value
+        */
+        TInt StartWriteEntryIndex( 
+                TUint16 aIndex,
+                TUint8 aExtRecNo, 
+                TUint8 aTransId, 
+                CPhoneBookStoreEntry& aDataToWrite );
+        
+        /**
+        * 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 UiccPbReqWriteExtDelete(
-                TUint16 aFileId,
-                TUint16 aFileIdExt,
                 TUint8 aIndex,
                 TUint8 aTransId );
         
         
         /**
-        * Creates and sends ISI message in order to write MBI Profile form first record
+        * 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 );
+        TInt UiccPBReqWriteMBIProfile( 
+                        TUint8 aTransId,
+                        TUint8 aIndex,
+                        TUint8 aOperationType );
+        
+        /**
+        * Get the Ext record number to write the new Entry
+        * first record
+        * @param &aExtRecordNo : Number of EXT records
+        */
+        void GetExtRecNum( TUint8 &aExtRecordNo );
+
+        /**
+        * Check for Ext record numbers for new Entry are sufficient or not
+        * @param &aExtRecordNo : Number of EXT records
+        * @param entry : Entry present in internal list
+        * @param aTransId : transaction id
+        */
+        TInt CheckForExtRecordNum( TPBEntry entry, 
+                                   TUint8 aTransId );
+
+        /**
+        * Continue with writing new Entry
+        * @param &aExtRecordNo : Number of EXT records
+        * @param entry : Entry present in internal list
+        * @param aTransId : transaction id
+        */
+        TInt ContinueWriteEntry( 
+                TUint8 aExtRecNo, 
+                TPBEntry entry, 
+                TUint8 aTransId,
+                CPhoneBookStoreEntry& aDataToWrite );
+
     public:     // Data
         // None
 
@@ -359,20 +421,31 @@
 
         // Attribute Store the information if it is location search
         TBool iLocationSearch;
-        
-        // Array to Store new EXT records
-        RArray<TInt> iExtRecordArrayToBeWrite;
-        
-        // Array to store EXT record nos to be delete
-       RArray<TInt> iExtRecordArrayToBeDelete; 
        
        // Store the no of ext records already written
        TUint8 iExtRecordWritten;
        
+       // attribute to store the recieved ipc
+       TInt iSavedIpc;
         
+       // attribute to store file id
+       TUint16 iFileId;
+       
+       // Attribute to store Ext File id
+       TUint16 iExtFileId;
+       
+       // attribute to store arry index
+       TUint8 iArrayIndex;
+       
     private:    // Data
 
 
+        // 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;
        
@@ -387,6 +460,7 @@
        
        // to store the MBI operation
        TUint8 iMBIOperation;
+       
 };
 
 #endif // CMMPHONEBOOKOPERATIONWRITE_H
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -22,10 +22,6 @@
 #include <ctsy/serviceapi/cmmgsmphonestorageutility.h>
 #include "mmmmesshandlerbase.h"
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-#include <ctsy/rmmcustomapi.h>
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 #include "cmmphonetsender.h"
 #include "cmmphonetreceiver.h"
 #include "nokiatsy_internal_variation.h"
@@ -160,11 +156,6 @@
 class CMmPhoneBookStoreOperationBase;
 class CMmPhoneBookStoreOperationList;
 class CMmMessageRouter;
-//class CMmUiccMessHandler;
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-class CMmPhonebookAlphaString;
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
 
 // CLASS DECLARATION
 /**
@@ -246,8 +237,7 @@
                                           TDes8& aNumber,
                                           CPhoneBookStoreEntry& aEntry,
                                           const TUint16 aFileId,
-                                          const TInt aIndexToRead,
-                                          const TBool aMailboxIdExist );
+                                          const TInt aIndexToRead );
 
         /**
         * Store ANR to phonebook entry
@@ -336,6 +326,29 @@
             TPBEntry& aEntry );
 
         /**
+        * Get the PBR Record number
+        *
+        * @param aIndexToRead : actual index to be read or write
+        * @param aPBRRecNum : PBR record num calculated
+        * @return None
+        */
+        TInt GetPBRRecordNum(
+            TInt aIndexToRead,
+            TUint8 &aPBRRecNum );
+
+        /**
+        * Get currentElementary File record num
+        *
+        * @param aIndexToRead : actual index to be read or write
+        * @param aCurrentRecNum : Current Ef record num calculated
+        * @return None
+        */
+        TInt GetCurrentEfRecNum(
+            TUint8 aPBRRecNum,
+            TUint8 &aCurrentRecNum,
+            TInt aIndexToRead);
+
+        /**
         * Find Index for Present Entry
         *
         * @param aIndex
@@ -469,6 +482,27 @@
         */
         void SimInd( const TIsiReceiveC& aIsiMessage );
 
+        /**
+        * Get mailbox identifiers
+        *
+        * @return Error code
+        */
+        TInt GetMailboxIdentifiers();
+
+
+        /**
+        * Handle mailbox identifiers
+        *
+        * @param aStatus Status
+        * @param aFileData File data
+        * @return None
+        */
+        void HandleGetMailboxIdentifiers(
+            TInt aStatus,
+            const TDesC8 &aFileData );
+
+
+
     public:     // Data
         // table for All phone books Configuration Data
        TPrimitiveInitInfo  iPBStoreConf[UICC_MAX_PB_NUM];
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -25,10 +25,6 @@
 #include <badesca.h>    //for arrays
 #include <e32base.h>
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-#include <ctsy/rmmcustomapi.h>
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 #include "cmmphonetsender.h"
 #include "cmmphonetreceiver.h"
 #include "cmmphonebookstoremesshandler.h"
@@ -51,11 +47,6 @@
 
 const TUint8 KPadding = 0;
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-const TUint8 SIM_AAS  = 0x10;
-const TUint8 SIM_GAS  = 0x11;
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 // Mask that is used to separate phonebooktype from transaction Id
 const TUint8 KMaskPhonebookType = 0xF0;
 
@@ -70,11 +61,6 @@
 const TUint8 KMaskMbdnType = 0x50;      //0101 0000 = MBDN
 const TUint8 KMaskVoiceMailBox = 0x60;  //0110 0000 = VMBX
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-const TUint8 KMaskAasType = 0x70; //0111 0000 = Additional Alpha String
-const TUint8 KMaskGasType = 0x80;     //1000 0000 = Group Alpha String
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 //const TUint8 KMaskFreeType = 0x09;  //1001 0000 = Free
 //const TUint8 KMaskFreeType = 0xA0;  //1010 0000 = Free
 //const TUint8 KMaskFreeType = 0xB0;  //1011 0000 = Free
@@ -121,6 +107,7 @@
 const TUint8 KFileSize1       = 2;
 const TUint8 KFileIdentifier1 = 3;
 const TUint8 KFileStatus1     = 4;
+const TUint8 KStartRecord = 1; // Record numbering starts from 1
 
 const TUint8 KAdditionalData  = 0x02;
 const TUint8 KExtRecordSize  = 13;
@@ -130,7 +117,7 @@
 const TUint8 KIapRecordsToBeSearched        = 0 ;     // constant to find unused bytes
 const TUint8 KMaxNoOfRecInOneEf = 254;
 
-
+const TUint8 KAdditionalNoType = 0x02;
 // UICC constants
 #define MF_FILE                             0x3F00 //Master file
 #define DF_CURRENT_APP                      0x7FFF //
@@ -150,8 +137,8 @@
 #define PB_EXT1_FID                         0x6F4A
 #define PB_EXT2_FID                         0x6F4B
 #define PB_EXT3_FID                         0x6F4C
-#define PB_EXT4_FID                         0x6F4E
-#define PB_EXT5_FID                         0x6F55
+#define PB_EXT4_FID                         0x6F55
+#define PB_EXT5_FID                         0x6F4E
 #define PB_EXT6_FID                         0x6FC8
 #define PB_EXT7_FID                         0x6FCC
 #define PB_PBR_FID                          0x4F30
@@ -278,6 +265,8 @@
 #define UICC_TYPE3_FILE                     3
 
 
+const TIapInfo iapinfo = { UICC_ILLEGAL_FILE_ID, 0x00, 0x00, 0x00};
+
 // end UICC constants
 
 
@@ -304,9 +293,12 @@
 
 enum TTypeOfFileToBeRead
     {
+    EStartRead,
     EBasicEfRead,
     EExtensionRead,
-    EMailboxIdRead
+    EMailboxIdRead,
+    EFileInfoRead,
+    EBasicEfReadToGetUsedFileCount
     };
 
 // Struct data
@@ -327,10 +319,6 @@
 class CStorageInfoData;
 class CMmUiccMessHandler;
 
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-    class CAlphaString;
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
 // CLASS DECLARATION
 /**
 * CMmPhoneBookStoreOperationBase is base class for all operations
@@ -351,7 +339,8 @@
         ~CMmPhoneBookStoreOperationBase();
 
         // Second phase constructor
-        static CMmPhoneBookStoreOperationBase* NewL(CMmUiccMessHandler* aUiccMessHandler);
+        static CMmPhoneBookStoreOperationBase* NewL(
+                           CMmUiccMessHandler* aUiccMessHandler);
         /**
         * Basic implementation to handling request if operation not found.
         *
@@ -371,31 +360,6 @@
         virtual void CancelReq( TName& aPhoneBook );
 
         /**
-        * 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
-        */
-        virtual TInt PrepareReq( TInt aIpc, const CMmDataPackage* aDataPackage );
-
-        /**
-        * Checks if operation is ready to be launched.
-        * Base implementation returns EFalse
-        *
-        * @return TBool ETrue - operation is ready to be launched
-        */
-        virtual TBool IsPrepared() const;
-
-        /**
-        * Launches activated operation.
-        *
-        * @return TInt KErrNotReady on attempt to launch not prepared operation;
-        * or system-wide error code
-        */
-        virtual TInt LaunchReq();
-
-        /**
         * Completes the request.
         *
         * @param aErrorCode error code to be completed with
@@ -404,19 +368,6 @@
         virtual TInt CompleteReq( TInt aErrorCode );
 
         /**
-        * Basic implementation to handling response if operation not found.
-        *
-        * @param aIsiMessage not used
-        * @param aComplete not used
-        * @return KErrNotSupported.
-        */
-        virtual TInt HandleSimPbRespL(
-        const TIsiReceiveC& /*aIsiMessage*/, TBool& /*aComplete*/ )
-            {TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleSimPbResp - Return KErrNotSupported");
-            return KErrNotSupported; };
-
-
-        /**
         * Basic implementation to handling request if operation not found in UICC.
         *
         * @param aComplete not used
@@ -425,8 +376,13 @@
         * @return KErrNotSupported.
         */
 
-        virtual TBool HandleUICCPbRespL( TInt /*aStatus*/, TUint8 /*aDetails*/, const TDesC8& /*aFileData*/, TInt /*aTransId*/)
-            {TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleUICCPbRespL - Return KErrNotSupported");
+        virtual TBool HandleUICCPbRespL(
+                        TInt /*aStatus*/,
+                        TUint8 /*aDetails*/,
+                        const TDesC8& /*aFileData*/,
+                        TInt /*aTransId*/)
+            {
+            TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::HandleUICCPbRespL - Return KErrNotSupported");
             return ETrue;
             };
 
@@ -462,7 +418,10 @@
         * @param aPBType
         * @return TUint8
         */
-        static TUint16 ConvertToPBfileId( const TName& aPBType, TUint16& aFileIdExt,TUint8 aCardType );
+        static TUint16 ConvertToPBfileId(
+                       const TName& aPBType,
+                       TUint16& aFileIdExt,
+                       TUint8 aCardType );
 
 
         /**
@@ -472,16 +431,7 @@
         * @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.
         *
@@ -497,7 +447,9 @@
         * @param aPBType
         * @return TUint8
         */
-        void ConvertPBTypeToPbName(const TUint aPhonebookType, TName& aName );
+        void ConvertPBTypeToPbName(
+                      const TUint aPhonebookType,
+                      TName& aName );
 
         /**
         * Converts client phonebook to phonebook mask.
@@ -505,7 +457,9 @@
         * @param aPBType
         * @return TUint8
         */
-        void ConvertToPBname( const TUint8 aTrans, TName& aName );
+        void ConvertToPBname(
+                     const TUint8 aTrans,
+                     TName& aName );
 
         /**
         * Gets PhoneBookName.
@@ -525,13 +479,6 @@
             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 );
-
-        /**
         * Handle to Find the Empty Entry
         * @param const TDesC8& aFileData: Entry data to checked entry is empty or not
         * @return TInt: KErrNone or KErrNotFound
@@ -539,15 +486,15 @@
         TInt EmptyEntryCheck( const TDesC8 &aFileData );
 
         /**
-        * Searches wanted file list from EFpbr  
+        * Searches wanted file list from EFpbr
         * @param aFileData: data of EFpbr record
         * @param aTag: Tag for file list to be search
         * @param aFileList: parameter where file list is inserted
         * @return TInt: KErrNone or KErrNotFound
         */
-        TInt FetchFileListFromPBR( 
-            const TDesC8 &aFileData, 
-            const TUint8 aTag, 
+        TInt FetchFileListFromPBR(
+            const TDesC8 &aFileData,
+            const TUint8 aTag,
             RArray <TPrimitiveTag>& aFileList );
 
     protected:
@@ -556,68 +503,9 @@
 
     private:
 
-        /**
-        * Converts operation mask to IPC
-        *
-        * @param aDestination Operation mask
-        * @param aSource Client IPC
-        * @return None
-        */
-        void ConvertOperationToClientIPCType(
-            TInt& aDestination,
-            const TUint8 aSource );
-
-
         // ConstructL
 
         void ConstructL();
-        /**
-        * Collects all needed data together.
-        *
-        * @param aSbStartOffSet Offset
-        * @param aNumOfSubBlocks Number of subblocks
-        * @param aIsiMessage ISI message
-        * @param aEntry Phonebook entry
-        * @param aEmailFound Flag indicate if email found or not
-        * @param aAnrFound Flag indicate if anr found or not
-        * @param aSneFound Flag indicate if sne found or not
-        * @param aGrpFound Flag indicate if grp found or not
-        * @return None
-        */
-        void CollectAvailableDataL(
-            TUint& aSbStartOffSet,
-            TInt& aNumOfSubBlocks,
-            const TIsiReceiveC& aIsiMessage,
-            CPhoneBookStoreEntry& aEntry,
-            TBool& aEmailFound,
-            TBool& aAnrFound,
-            TBool& aSneFound
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            ,TBool& aGrpFound
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-            );
-
-        /**
-        * Construct a SIM_READ_FIELD_REQ message and send it through phonet.
-        *
-        * @param aTransId Transaction Id
-        * @return KErrNone / Error value from phonet
-        */
-        TInt SimReadFieldReq( TUint8 aTransId );
-
-        /**
-        * Breaks received SIM_READ_FIELD_RESP ISI message
-        *
-        * @param aIsiMessage Received ISI message
-        * @param aComplete Indicates if request can remove from
-        *        operationlist or not.
-        * @return None
-        */
-        void SimReadFieldRespL(
-            const TIsiReceiveC& aIsiMessage,
-            TBool& aComplete );
-
-
 
     public:     // Data
         // None
@@ -649,9 +537,6 @@
         // 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;
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonemesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonemesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -227,11 +227,18 @@
 
         /**
         * Class attributes are created in ConstructL
-        * @param CMmMessageRouter* aMessageRouter: pointer to message
-        *  router object
-        * @return void : None
+        * @param aMessageRouter Pointer to message router object
+        * @param aPhoNetSender Pointer to phonet sender object
+        * @param aSupplServMessHandler Pointer to supplementaty services
+        * message handler object
+        * @param aUiccMessHandler Pointer to uicc message handler object
+        * @return void None
         */
-        void ConstructL( CMmMessageRouter* aMessageRouter );
+        void ConstructL(
+            CMmMessageRouter* aMessageRouter,
+            CMmPhoNetSender* aPhoNetSender,
+            CMmSupplServMessHandler* aSupplServMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler );
 
         /**
         * Read request for EFest
@@ -241,24 +248,24 @@
 
         /**
         * Handles response for EFest reading in case of getting
-        * ACL status       
+        * ACL status
         * @param aStatus status of the operation
         * @param aFileData content of the EFest
         * @return none
         */
-        void UiccGetAclStatusReadEfEstResp( 
-            TInt aStatus, 
+        void UiccGetAclStatusReadEfEstResp(
+            TInt aStatus,
             const TDesC8& aFileData );
 
         /**
         * Handles response for EFest reading in case of setting
-        * ACL status       
+        * ACL status
         * @param aStatus status of the operation
         * @param aFileData content of the EFest
         * @return none
         */
-        void UiccSetAclStatusReadEfEstResp( 
-            TInt aStatus, 
+        void UiccSetAclStatusReadEfEstResp(
+            TInt aStatus,
             const TDesC8& aFileData );
 
         /**
@@ -270,7 +277,7 @@
 
         /**
         * Handles response for EFest writing in case of setting
-        * ACL status       
+        * ACL status
         * @param aStatus status of the operation
         * @return none
         */
@@ -284,13 +291,13 @@
         TInt UiccReadAclReq();
 
         /**
-        * Handles response for EFacl reading 
+        * Handles response for EFacl reading
         * @param aStatus status of the operation
         * @param aFileData content of the EFacl
         * @return none
         */
         void UiccReadAclResp(
-            TInt aStatus, 
+            TInt aStatus,
             const TDesC8& aFileData );
 
         /**
@@ -345,6 +352,27 @@
         */
         TUint16 ACLLength( CDesC8ArrayFlat* aApnList ) const;
 
+        /**
+        * Set parameters for UICC_APPL_CMD_REQ message and call UICC message
+        * handler's function to create and send the message
+        * @param aTrId Transaction ID
+        * @param aServiceType Service type
+        * @param aDataAmount Amount of data to be read/write
+        * @param aDataOffset Offset where data reading/writing starts
+        * @param aFileId Elemantary file ID
+        * @param aFileIdSfi Elemantary file SFI
+        * @param aFileData File data in case of writing
+        * @return Error code
+        */
+        TInt UiccApplCmdReq(
+            const TUiccTrId aTrId,
+            const TUint8 aServiceType,
+            const TUint16 aDataAmount,
+            const TUint16 aDataOffset,
+            const TUint16 aFileId,
+            const TUint8 aFileIdSfi,
+            const TDesC8& aFileData = KNullDesC8 );
+
     private:
 
         /**
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -147,6 +147,16 @@
         static void ConvertIPAddressToClient(
             const TDesC8& aGPDSAddres,
             TDes8& aInetAddr );
+
+        /**
+        * Converts IP address string from client into GPDS suitable format
+        * @param TDes8& aClientAddr: Clients IP address
+        * @param TDesC8& aGpdsAddres: GPDS IP address
+        */
+        static TInt ConvertIPAddressFromClient(
+            const TDesC8& aClientAddr,
+            TDes8& aGpdsAddr );
+
         /**
         * Converts number string to integer
         * @param TUint& integer: integer value
@@ -241,6 +251,16 @@
         * @param aGsmDataString Output string
         * @return None
         */
+        static void ConvertUcs2To7BitCodedData(
+            TDesC16& aInputString,
+            TDes8& aGsmDataString );
+
+        /**
+        * Converts data to GSM format
+        * @param aInputString Input string
+        * @param aGsmDataString Output string
+        * @return None
+        */
         static void ConvertUcs2ToGsmUcs2Data(
                 TDesC16& aInputString,
                 TDes8& aGsmDataString );
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmuiccmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -93,6 +93,7 @@
 const TUint16 KElemFilePlmnNetworkName            ( 0x6FC5 );
 const TUint16 KElemFileFixedDiallingNumbers       ( 0x6F3B );
 const TUint16 KElemEmergencyCallCodes             ( 0x6FB7 );
+const TUint16 KElemFileMailboxIdentifier          ( 0x6FC9 );
 
 const TUint8 KEfSstSize (0xFF);
 const TUint8 KEfUstSize (0xFF);
@@ -203,6 +204,7 @@
     ETrIdReadPnn,
     ETrIdEnStoreRead,
     ETrIdEnStoreGetInfo,
+    ETrIdEMmTsyONStoreGetInfo,
     ENumOfUiccTrIds
     };
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmussdmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmussdmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -42,7 +42,6 @@
 
     //none
 
-
 //  EXTERNAL DATA STRUCTURES
 
     //none
@@ -192,6 +191,8 @@
         // Etrue if NoFdn request is in active
         TBool iNoFdnUSSDReq;
 
+        // Used to distinguish between command and request MT USSD's
+        TBool iLastMtUssdIsRequest;
 };
 
 #endif // CMMUSSDMESSHANDLER
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Wed Apr 21 14:29:55 2010 +0300
@@ -22,7 +22,7 @@
 #define NOKIATSY_RELEASE_H
 
 // UPDATE THIS STRING FOR EVERY RELEASE!!!
-#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> modemadaptation-MCL_201006"
+#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> modemadaptation-MCL_201015"
 #endif // NOKIATSY_RELEASE_H
            
 // End of File
\ No newline at end of file
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/operators.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/operators.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -18,7 +18,7 @@
 
 
 // This file is autogenerated from operators.txt
-// Generation date: 11-Dec-2009 09:21:25
+// Generation date: 09-Apr-2010 08:13:42
 
 
 struct TOperator
@@ -122,7 +122,7 @@
 
 const TOperator operators_219[3] = { // HRV
   { 1, "T-Mobile HR", NULL },
-  { 2, "HR TELE2", NULL },
+  { 2, "Tele2 HR", NULL },
   { 10, "HR VIP", NULL },
 };
 
@@ -210,7 +210,7 @@
   { 3, "Orange", NULL },
   { 4, "SWEDEN", NULL },
   { 5, "SWEDEN 3G", NULL },
-  { 7, "S COMVIQ", NULL },
+  { 7, "Tele2 SE", NULL },
   { 8, "Telenor SE", NULL },
   { 10, "Spring", NULL },
 };
@@ -219,7 +219,7 @@
   { 1, "TELENOR", NULL },
   { 2, "N NetCom", NULL },
   { 3, "MTU", NULL },
-  { 5, "NetworkN", NULL },
+  { 5, "Mobile N", NULL },
 };
 
 const TOperator operators_244[7] = { // FIN
@@ -235,19 +235,19 @@
 const TOperator operators_246[3] = { // LTU
   { 1, "OMNITEL LT", NULL },
   { 2, "BITE GSM", NULL },
-  { 3, "TELE2", NULL },
+  { 3, "Tele2 LT", NULL },
 };
 
 const TOperator operators_247[3] = { // LVA
   { 1, "LV LMT", NULL },
-  { 2, "LV TELE2", NULL },
+  { 2, "Tele2 LV", NULL },
   { 5, "BITE LV", NULL },
 };
 
 const TOperator operators_248[3] = { // EST
   { 1, "EE EMT", NULL },
   { 2, "EE elisa", NULL },
-  { 3, "EE TELE2", NULL },
+  { 3, "Tele2 EE", NULL },
 };
 
 const TOperator operators_250[24] = { // RUS
@@ -266,7 +266,7 @@
   { 16, "NTC", NULL },
   { 17, "Ermak RMS", NULL },
   { 19, "RUS: INDIGO", NULL },
-  { 20, "TELE2", NULL },
+  { 20, "TELE2 RU", NULL },
   { 28, "Beeline", NULL },
   { 35, "MOTIV", NULL },
   { 37, "KODOTEL", NULL },
@@ -306,7 +306,7 @@
 };
 
 const TOperator operators_262[7] = { // DEU
-  { 1, "T-Mobile D", NULL },
+  { 1, "Telekom.de", NULL },
   { 2, "Vodafone.de", NULL },
   { 3, "E-Plus", NULL },
   { 7, "o2 - de", NULL },
@@ -348,10 +348,11 @@
   { 11, "NOVA IS", NULL },
 };
 
-const TOperator operators_276[3] = { // ALB
+const TOperator operators_276[4] = { // ALB
   { 1, "AMC - AL", NULL },
   { 2, "vodafone AL", NULL },
   { 3, "EAGLE AL", NULL },
+  { 4, "PLUS AL", NULL },
 };
 
 const TOperator operators_278[3] = { // MLT
@@ -424,7 +425,7 @@
   { 77, "LI TANGO", NULL },
 };
 
-const TOperator operators_302[8] = { // CAN
+const TOperator operators_302[9] = { // CAN
   { 220, "TELUS", NULL },
   { 350, "FIRST", NULL },
   { 370, "Fido", NULL },
@@ -432,6 +433,7 @@
   { 490, "WIND", NULL },
   { 610, "Bell", NULL },
   { 720, "ROGERS", NULL },
+  { 730, "TStarSol", NULL },
   { 880, "3G Plus", NULL },
 };
 
@@ -522,7 +524,7 @@
   { 990, "Cingular", NULL },
 };
 
-const TOperator operators_311[23] = { // USA
+const TOperator operators_311[25] = { // USA
   { 0, "Mid-Tex", NULL },
   { 30, "Indigo", NULL },
   { 40, "Commnet", NULL },
@@ -546,6 +548,8 @@
   { 370, "GCI", NULL },
   { 500, "MOSAIC", NULL },
   { 530, "USANCW", NULL },
+  { 540, "US Proximiti", NULL },
+  { 720, "MainePCS", NULL },
 };
 
 const TOperator operators_330[1] = { // PRI
@@ -568,9 +572,10 @@
   { 180, "C&W", NULL },
 };
 
-const TOperator operators_340[4] = { // FRA
+const TOperator operators_340[5] = { // FRA
   { 1, "F-Orange", NULL },
   { 2, "ONLY", NULL },
+  { 3, "CHIPPIE", NULL },
   { 8, "DAUPHIN", NULL },
   { 20, "DIGICEL", NULL },
 };
@@ -790,7 +795,7 @@
   { 98, "AirTel", NULL },
 };
 
-const TOperator operators_405[127] = { // IND
+const TOperator operators_405[147] = { // IND
   { 1, "Reliance", NULL },
   { 5, "Reliance", NULL },
   { 6, "Reliance", NULL },
@@ -865,6 +870,26 @@
   { 820, "IN UNITECH", NULL },
   { 821, "IN UNITECH", NULL },
   { 822, "IN UNITECH", NULL },
+  { 823, "VIDEOCON", NULL },
+  { 824, "VIDEOCON", NULL },
+  { 825, "VIDEOCON", NULL },
+  { 827, "VIDEOCON", NULL },
+  { 828, "VIDEOCON", NULL },
+  { 829, "VIDEOCON", NULL },
+  { 830, "VIDEOCON", NULL },
+  { 831, "VIDEOCON", NULL },
+  { 832, "VIDEOCON", NULL },
+  { 833, "VIDEOCON", NULL },
+  { 834, "VIDEOCON", NULL },
+  { 835, "VIDEOCON", NULL },
+  { 836, "VIDEOCON", NULL },
+  { 837, "VIDEOCON", NULL },
+  { 838, "VIDEOCON", NULL },
+  { 839, "VIDEOCON", NULL },
+  { 840, "VIDEOCON", NULL },
+  { 841, "VIDEOCON", NULL },
+  { 842, "VIDEOCON", NULL },
+  { 843, "VIDEOCON", NULL },
   { 844, "Unitech", NULL },
   { 845, "IDEA", NULL },
   { 846, "IDEA", NULL },
@@ -938,7 +963,7 @@
 const TOperator operators_413[6] = { // SRI
   { 1, "Mobitel", NULL },
   { 2, "DIALOG", NULL },
-  { 3, "SRI-Tigo", NULL },
+  { 3, "SRI Etisalat", NULL },
   { 5, "SRI AIRTEL", NULL },
   { 8, "Hutch", NULL },
   { 71, "LK Mobitel", NULL },
@@ -1012,9 +1037,10 @@
   { 6, "WM", NULL },
 };
 
-const TOperator operators_426[2] = { // BHR
+const TOperator operators_426[3] = { // BHR
   { 1, "BATELCO", NULL },
   { 2, "zain BH", NULL },
+  { 4, "VIVA BH", NULL },
 };
 
 const TOperator operators_427[2] = { // QAT
@@ -1027,6 +1053,10 @@
   { 99, "MN MobiCom", NULL },
 };
 
+const TOperator operators_429[1] = { // NPL
+  { 2, "Ncell", NULL },
+};
+
 const TOperator operators_432[5] = { // IRN
   { 11, "IR-TCI", NULL },
   { 14, "IR KISH", NULL },
@@ -1045,8 +1075,8 @@
 };
 
 const TOperator operators_436[7] = { // TJK
-  { 1, "Somoncom", NULL },
-  { 2, "INDIGO-T", NULL },
+  { 1, "TCELL", NULL },
+  { 2, "TCELL", NULL },
   { 3, "TJK MLT", NULL },
   { 4, "Babilon-M", NULL },
   { 5, "BEELINE TJ", NULL },
@@ -1107,13 +1137,14 @@
   { 5, "3 Macau", NULL },
 };
 
-const TOperator operators_456[7] = { // KHM
+const TOperator operators_456[8] = { // KHM
   { 1, "MOBITEL", NULL },
   { 2, "hello", NULL },
   { 4, "CADCOMMS", NULL },
   { 5, "STAR CELL", NULL },
   { 6, "SMART", NULL },
   { 8, "Metfone", NULL },
+  { 9, "Beeline KH", NULL },
   { 18, "Mfone", NULL },
 };
 
@@ -1179,7 +1210,7 @@
 
 const TOperator operators_510[6] = { // IDN
   { 1, "INDOSAT", NULL },
-  { 8, "axis", NULL },
+  { 8, "AXIS", NULL },
   { 10, "TELKOMSEL", NULL },
   { 11, "IND XL", NULL },
   { 21, "INDOSAT", NULL },
@@ -1308,7 +1339,7 @@
 
 const TOperator operators_606[2] = { // LBY
   { 0, "Libyana", NULL },
-  { 1, "606 01", NULL },
+  { 1, "Al Madar", NULL },
 };
 
 const TOperator operators_607[4] = { // GMB
@@ -1744,7 +1775,7 @@
 
 
 // Country data
-const TCountry countrylist[221] = {
+const TCountry countrylist[222] = {
   { 1, "001", 1, operators_1 },
   { 2, "002", 1, operators_2 },
   { 202, "GRC", 4, operators_202 },
@@ -1783,7 +1814,7 @@
   { 270, "LUX", 3, operators_270 },
   { 272, "IRL", 4, operators_272 },
   { 274, "ISL", 6, operators_274 },
-  { 276, "ALB", 3, operators_276 },
+  { 276, "ALB", 4, operators_276 },
   { 278, "MLT", 3, operators_278 },
   { 280, "CYP", 2, operators_280 },
   { 282, "GEO", 4, operators_282 },
@@ -1796,10 +1827,10 @@
   { 293, "SVN", 4, operators_293 },
   { 294, "MKD", 3, operators_294 },
   { 295, "LIE", 4, operators_295 },
-  { 302, "CAN", 8, operators_302 },
+  { 302, "CAN", 9, operators_302 },
   { 308, "SPM", 2, operators_308 },
   { 310, "USA", 79, operators_310 },
-  { 311, "USA", 23, operators_311 },
+  { 311, "USA", 25, operators_311 },
   { 312, "USA", 0, NULL },
   { 313, "USA", 0, NULL },
   { 314, "USA", 0, NULL },
@@ -1809,7 +1840,7 @@
   { 332, "USA", 1, operators_332 },
   { 334, "MEX", 2, operators_334 },
   { 338, "JAM", 4, operators_338 },
-  { 340, "FRA", 4, operators_340 },
+  { 340, "FRA", 5, operators_340 },
   { 342, "BRB", 4, operators_342 },
   { 344, "ATG", 3, operators_344 },
   { 346, "CYM", 1, operators_346 },
@@ -1834,7 +1865,7 @@
   { 401, "KAZ", 3, operators_401 },
   { 402, "BTN", 2, operators_402 },
   { 404, "IND", 91, operators_404 },
-  { 405, "IND", 127, operators_405 },
+  { 405, "IND", 147, operators_405 },
   { 410, "PAK", 5, operators_410 },
   { 412, "AFG", 4, operators_412 },
   { 413, "SRI", 6, operators_413 },
@@ -1849,9 +1880,10 @@
   { 422, "OMN", 2, operators_422 },
   { 424, "UAE", 3, operators_424 },
   { 425, "ISR", 5, operators_425 },
-  { 426, "BHR", 2, operators_426 },
+  { 426, "BHR", 3, operators_426 },
   { 427, "QAT", 2, operators_427 },
   { 428, "MNG", 2, operators_428 },
+  { 429, "NPL", 1, operators_429 },
   { 432, "IRN", 5, operators_432 },
   { 434, "UZB", 6, operators_434 },
   { 436, "TJK", 7, operators_436 },
@@ -1862,7 +1894,7 @@
   { 452, "VMN", 4, operators_452 },
   { 454, "HKG", 13, operators_454 },
   { 455, "MAC", 5, operators_455 },
-  { 456, "KHM", 7, operators_456 },
+  { 456, "KHM", 8, operators_456 },
   { 457, "LAO", 4, operators_457 },
   { 460, "CHN", 2, operators_460 },
   { 466, "TWN", 8, operators_466 },
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -245,8 +245,6 @@
     // Read "HSDPA Disabled" status from product profile
     InfoPpDataReadReq();
 
-    iCallOperationID = CSD_CALL_CREATE;
-    iVideoCallReleased = EFalse;
     iCallControlCallId = CALL_MODEM_ID_NONE;
     iCcResult = KCcResultAllowedNoModification;
     iResourceControlSuppress = EFalse;
@@ -289,7 +287,6 @@
     aPhoNetReceiver->RegisterL( callMessHandler, PN_CSD );
 
     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_CREATE_RESP );
-    aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_REMOVE_RESP );
 
     callMessHandler->iDtmfMessHandler = aDtmfMessHandler;
     CleanupStack::Pop( callMessHandler );
@@ -307,6 +304,12 @@
 TFLOGSTRING("TSY: CMmCallMessHandler::~CMmCallMessHandler");
 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CMMCALLMESSHANDLER, "CMmCallMessHandler::~CMmCallMessHandler" );
 
+    if ( KInvalidPipeHandle != iPipeHandle )
+        {
+        // error ignored
+        PnsPipeRemoveReq();
+        }
+
     if ( iDataPortHandler )
         {
         delete iDataPortHandler;
@@ -490,11 +493,6 @@
                     PnsPipeCreateResp( aIsiMessage );
                     break;
                     }
-                case PNS_PIPE_REMOVE_RESP:
-                    {
-                    PnsPipeRemoveResp( aIsiMessage );
-                    break;
-                    }
                 default:
                     {
 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_PIPE, switch messageId - default.\n" );
@@ -3316,15 +3314,6 @@
         iCallDirection = RMobileCall::EMobileTerminated;
         }
 
-    // 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 ||
-         CALL_MODEM_STATUS_MO_RELEASE == callStatusISA )
-        {
-        iVideoCallReleased = ETrue;
-        }
-
     // Read call mode
     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
         ISI_HEADER_SIZE + CALL_MODEM_STATUS_IND_OFFSET_MODE,
@@ -4585,10 +4574,10 @@
     // SIM is ready, start dataport handling
     if ( !iDataPortHandler )
         {
-TFLOGSTRING("NTSY: CMmCallMessHandler::InitializeDataportL - Start dataport handling");
-OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_INITIALIZEDATAPORTL, "CMmCallMessHandler::InitializeDataportL - Start dataport handling" );
-        // Deleted in CMmCallMessHandler::~CMmCallMessHandler()
+TFLOGSTRING("NTSY: CMmCallMessHandler::InitializeDataportL - Create pipe for videotelephony");
+OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_INITIALIZEDATAPORTL, "CMmCallMessHandler::InitializeDataportL - Create pipe for videotelephony" );
         iDataPortHandler = CMmDataPortHandler::NewL( iMessageRouter );
+        User::LeaveIfError( PnsPipeCreateReq( PN_PIPE_ENABLE ) );
         }
     }
 
@@ -5264,18 +5253,8 @@
                 EEtelCallAnswer, &callData, KErrNone );
             }
         }
-    else
-        {
-        // MO/MT video call released. we have to remove pipe.
-        if ( iVideoCallReleased )
-            {
-TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: call MO/MT released");
-OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: call MO/MT released" );
-            //Remove Pipe for wideo telephony
-            PnsPipeRemoveReq();
-            iVideoCallReleased = EFalse;
-            }
-        }
+    // no else
+
     // CSD_VIDEO_CALL_STATUS_DISCONNECT arrives also when call establishment
     // fails
     // reset call direction to avoid further unnecessary IPC completions
@@ -5512,13 +5491,8 @@
         iTelNumber = callInfo->iDialledParty.iTelNumber;
 
         // Dial the call
-        iCallOperationID = CSD_CALL_CREATE;
         iCallDirection = RMobileCall::EMobileOriginated;
-
-        // Create Pipe for wideo telephony
-        // If creation succeed, then CsdCallControlReq( CSD_CALL_CREATE )
-        // is called on PnsPipeCreateResp()
-        PnsPipeCreateReq( PN_PIPE_ENABLE );
+        CsdCallControlReq( CSD_CALL_CREATE );
         }
     else
         {
@@ -5559,12 +5533,7 @@
 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_ANSWERINCOMINGDATACALL, "CMmCallMessHandler::AnswerIncomingDataCall, Send ATA" );
 
         // Answer the call
-        iCallOperationID = CSD_CALL_ANSWER;
-
-        //Create Pipe for wideo telephony
-        // If creation succeed, then CsdCallControlReq( CSD_CALL_ANSWER )
-        // is called on PnsPipeCreateResp()
-        PnsPipeCreateReq( PN_PIPE_ENABLE );
+        CsdCallControlReq( CSD_CALL_ANSWER );
         }
         // If we are setting auto answer, the status is unknown
     else if ( RMobileCall::EStatusIdle >= iMobileCallInfo.iStatus )
@@ -5680,39 +5649,14 @@
 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeCreateResp. TransactionId: %d, PipeHandle: %d, error code: %d", transId, iPipeHandle, errorCode );
 OstTraceExt3( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPECREATERESP, "CMmCallMessHandler::PnsPipeCreateResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
 
-        if ( PN_PIPE_NO_ERROR == errorCode )
-            {
-            // Dial or Answer the call
-            CsdCallControlReq( iCallOperationID );
-            }
-        else
+        if ( PN_PIPE_NO_ERROR != errorCode )
             {
-            CCallDataPackage callData;
-            // set call id and mode
-            callData.SetCallIdAndMode(
-                iMobileCallInfo.iCallId, iMobileCallInfo.iService );
-            TInt err = CMmStaticUtility::PacketDataCSCauseToEpocError(
-                 errorCode, PN_PIPE );
-            if ( RMobileCall::EMobileTerminated == iCallDirection )
-                {
-                // 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;
+            delete iDataPortHandler;
+            iDataPortHandler = NULL;
             }
+        // no else
         }
+    // no else
     }
 
 // ----------------------------------------------------------------------------
@@ -5725,6 +5669,8 @@
     TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeRemoveReq. PipeHandle: %d", iPipeHandle );
 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREMOVEREQ, "CMmCallMessHandler::PnsPipeRemoveReq;aPipeHandle=%hhu", iPipeHandle );
 
+    iPipeHandle = KInvalidPipeHandle;
+
     // Create buffer for isi msg data
 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
     TBuf8<SIZE_PNS_PIPE_REMOVE_REQ> data;
@@ -5743,37 +5689,6 @@
         data );
     }
 
-// ----------------------------------------------------------------------------
-// CMmCallMessHandler::PnsPipeRemoveResp
-// Breaks a PNS_PIPE_REMOVE_RESP ISI-message.
-// ----------------------------------------------------------------------------
-//
-void CMmCallMessHandler::PnsPipeRemoveResp(
-    const TIsiReceiveC& aIsiMessage )
-    {
-TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeRemoveResp");
-OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEREMOVERESP, "CMmCallMessHandler::PnsPipeRemoveResp" );
-    // Get Transaction Id from the ISI message
-    TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
-
-    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_REMOVE_RESP_OFFSET_ERRORCODE ) );
-#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-            ISI_HEADER_SIZE + CM_PIPE_REMOVE_RESP_OFFSET_ERRORCODE ) );
-#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
-
-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 );
-
-        iPipeHandle = KInvalidPipeHandle;
-        }
-    // no else
-    }
-
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
     // None
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmdataporthandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -532,8 +532,7 @@
 TInt CMmDataPortHandler::RecoverDataPort(
     const CCallDataPackage* aCallDataPackage )
     {
-
-    TFLOGSTRING("TSY: CMmDataPortHandler::RecoverDataPort");
+TFLOGSTRING("TSY: CMmDataPortHandler::RecoverDataPort");
 OstTrace0( TRACE_NORMAL, CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort" );
 
     TInt ret( KErrNone );
@@ -544,39 +543,33 @@
     if ( commPort && ECommsDataportOpened <= iCommsStatus )
         {
 
-        TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - Client returning control: %S", &commPort->iPort );
+TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - Client returning control: %S", &commPort->iPort );
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort;Client returning control=%S", commPort->iPort );
         // Check if port 0 has been loaned
         if ( iDP0LoanedToClient && commPort->iPort == KDataPortPort0 )
             {
             iDP0LoanedToClient = EFalse;
-
-            TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
-
+            // noone needs remaining data in buffers
+            ret = iDataPort.ResetBuffers();
+TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
 OstTraceExt1( TRACE_NORMAL, DUP3_CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort;commPort->iPort=%S Recovered", commPort->iPort );
             }
         else if ( iDP1LoanedToClient && commPort->iPort == KDataPortPort1 )
             {
             iDP1LoanedToClient = EFalse;
-
-            TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
-
+TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
 OstTraceExt1( TRACE_NORMAL, DUP4_CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort;commPort->iPort=%S Recovered", commPort->iPort );
             }
         else if ( iDP4LoanedToClient && commPort->iPort == KDataPortPort4 )
             {
             iDP4LoanedToClient = EFalse;
-
-            TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
-
+TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
 OstTraceExt1( TRACE_NORMAL, DUP5_CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort;commPort->iPort=%S Recovered", commPort->iPort );
             }
         else if ( iDP5LoanedToClient && commPort->iPort == KDataPortPort5 )
             {
             iDP5LoanedToClient = EFalse;
-
-            TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
-
+TFLOGSTRING2("TSY: CMmDataPortHandler::RecoverDataPort - %S Recovered", &commPort->iPort );
 OstTraceExt1( TRACE_NORMAL, DUP6_CMMDATAPORTHANDLER_RECOVERDATAPORT, "CMmDataPortHandler::RecoverDataPort;commPort->iPort=%S Recovered", commPort->iPort );
             }
         else
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmenstoremesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmenstoremesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -27,7 +27,7 @@
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "cmmstaticutility.h"
 #include "tsylogger.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmenstoremesshandlertraces.h"
 #endif
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -446,7 +446,14 @@
             case EMobilePhoneGetMailboxNumbers:
             case EMmTsyONStoreReadIPC:
             case EMmTsyONStoreReadEntryIPC:
-                {
+            case EMmTsyONStoreGetInfoIPC:
+            case EMmTsyONStoreDeleteIPC:
+            case EMmTsyONStoreDeleteAllIPC:
+            case EMmTsyONStoreReadSizeIPC:
+            case EMmTsyONStoreWriteSizeIPC:
+            case EMmTsyONStoreWriteEntryIPC:
+            case EMmTsyONStoreWriteIPC:
+                 {
                 messHandler = iMmPhoneBookStoreMessHandler;
                 break;
                 }
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -360,6 +360,8 @@
 
     iNetMessageHandlingOngoing = EFalse;
 
+    iLastNetModemRegStatusInd = NULL;
+
     // Request network signal strength (RSSI)
     NetRssiGetReq();
     }
@@ -2913,6 +2915,11 @@
 TFLOGSTRING("TSY: CMmNetMessHandler::StartHandlingNetModemRegStatusMessages - NET_MODEM_REG_STATUS_IND");
 OstTrace0( TRACE_NORMAL, DUP2_CMMNETMESSHANDLER_STARTHANDLINGNETMODEMREGSTATUSMESSAGES, "CMmNetMessHandler::StartHandlingNetModemRegStatusMessages - NET_MODEM_REG_STATUS_IND" );
 
+            // destroy previous ind and store current NET_MODEM_REG_STATUS_IND 
+            // for later use
+            delete iLastNetModemRegStatusInd;
+            iLastNetModemRegStatusInd = tempHBuf;
+
             // Start handling NET_MODEM_REG_STATUS_IND message.
             NetModemRegStatusInd( isimessage );
             }
@@ -3060,8 +3067,13 @@
                 }
             }
 
-        // Delete used message.
-        delete tempHBuf;
+        // if message is NET_MODEM_REG_STATUS_IND it's not destroyed
+        // because of it can be needed later on.
+        if ( NET_MODEM_REG_STATUS_IND != messageId )
+            {
+            // Delete used message.
+            delete tempHBuf;
+            }
         }
     }
 
@@ -3182,6 +3194,52 @@
     return iNetOperatorNameHandler;
     }
 
+// ---------------------------------------------------------------------------
+// CMmNetMessHandler::HandleLastNetModemRegStatusInd
+// Handles last received NET_MODEM_REG_STATUS_IND so that network info
+// is completed to upper layers
+// ---------------------------------------------------------------------------
+//
+void CMmNetMessHandler::HandleLastNetModemRegStatusInd()
+    {
+TFLOGSTRING("TSY: CMmNetMessHandler::HandleLastNetModemRegStatusInd");
+OstTrace0( TRACE_NORMAL, CMMNETMESSHANDLER_HANDLELASTNETMODEMREGSTATUSIND, "CMmNetMessHandler::HandleLastNetModemRegStatusInd" );
+
+    TBool handlingNeeded( ETrue );
+    if( iNetMessageQueue.Count() )
+        {
+        // we need to check is there any NET_MODEM_REG_STATUS_IND or
+        // NET_MODEM_REG_STATUS_GET_RESP in queue. If there is one
+        // of these two messages, we don't need to handle last received
+        // NET_MODEM_REG_STATUS_IND
+        for( int i = 0; i < iNetMessageQueue.Count(); i++ )
+            {
+            const TDesC8& message( *iNetMessageQueue[i] );
+            TIsiReceiveC isimessage( ( TIsiReceiveC ) message );
+            TInt messageId( isimessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
+
+            if( NET_MODEM_REG_STATUS_IND == messageId ||
+                NET_MODEM_REG_STATUS_GET_RESP == messageId )
+                {
+TFLOGSTRING("TSY: CMmNetMessHandler::HandleLastNetModemRegStatusInd: Similar messages already in queue, no need to handle last received ind");
+OstTrace0( TRACE_NORMAL, DUP1_CMMNETMESSHANDLER_HANDLELASTNETMODEMREGSTATUSIND, "CMmNetMessHandler::HandleLastNetModemRegStatusInd:: Similar messages already in queue, no need to handle last received ind" );
+                handlingNeeded = EFalse;
+                break;
+                }
+            }
+        }
+
+    if( iLastNetModemRegStatusInd && handlingNeeded )
+        {
+        // We need to handle last received NET_MODEM_REG_STATUS_IND
+        // so that we complete network info to upper layers (for example
+        // NITZ name)
+        const TDesC8& message( *iLastNetModemRegStatusInd );
+        TIsiReceiveC isimessage( ( TIsiReceiveC ) message );
+        QueueNetModemRegStatusMessagesL( message );
+        }
+    }
+
 // =============================================================================
 // CDelayTimer: Used for delaying for completion of Packet transfer state
 // from GPDS_RADIO_AVTIVITY_IND.
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetoperatornamehandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetoperatornamehandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -55,9 +55,6 @@
 const TUint8 KNetNoHplmnPnnRecordNumber = 0x00;
 const TUint8 KNetHplmnPnnRecordNumber = 0x01;
 
-// Max buffer length for Operator name.
-const TInt KMaxLengthOfOperatorName = 124;
-
 // Max data string length in FULL_NAME or SHORT_NAME.
 // Length is enough big to hold max data length converted
 // to 7-bit characters.
@@ -69,10 +66,10 @@
 const TUint8 KCountryInitialsMask = 0x08; // Mask bit 4.
 const TUint8 KCodingSchemeMask = 0x70; // Mask bits 5-7.
 
-// Wild char mask for BCD code checking.
-const TUint8 KBCDWildChar = 0x0D;
-// Character mask.
-const TUint8 KBCDOneCharMask = 0x0F;
+// Wild char 'D' for OPL rule checking.
+const TUint16 KWildCharD = 0x000D;
+// Wild char 'F' for OPL rule checking.
+const TUint16 KWildCharF = 0x000F;
 
 // Extended table.
 const TUint8 KExtendedTable = 0x1B;
@@ -207,6 +204,11 @@
     // Initialization of Operator Name String (ONS).
     iOperatorNameString.Zero();
 
+    // Initialize custom EONS and NITZ name buffers.
+    iCustomNitzLongNameString.Zero();
+    iCustomNitzShortNameString.Zero();
+    iCustomEonsNameString.Zero();
+
     // Operator PLMN list available flag initialization.
     iOplListAvailable = EFalse;
 
@@ -272,6 +274,8 @@
     iNitzName.iMNC = 0;
     iNitzName.iLongName.Zero();
     iNitzName.iShortName.Zero();
+    iCustomNitzLongNameString.Zero();
+    iCustomNitzShortNameString.Zero();
 
     // Initialize.
     TUint tempMCC( 0 ); // Mobile Country Code
@@ -330,6 +334,9 @@
             nitzFullNameData,
             longNitzName );
 
+        // Store NITZ Long name for custom request use.
+        iCustomNitzLongNameString.Copy( longNitzName );
+
         // Store NITZ Long name.
         iNitzName.iLongName.Copy( longNitzName.Left(
             iNitzName.iLongName.MaxLength() ) );
@@ -365,6 +372,9 @@
             nitzShortNameData,
             shortNitzName );
 
+        // Store NITZ Short name for custom request use.
+        iCustomNitzShortNameString.Copy( shortNitzName );
+
         // Store NITZ Short name.
         iNitzName.iShortName.Copy( shortNitzName.Left(
             iNitzName.iShortName.MaxLength() ) );
@@ -374,13 +384,21 @@
 TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iMNC: %d", iNitzName.iMNC);
 TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iLongName: %S", &iNitzName.iLongName);
 TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iShortName: %S", &iNitzName.iShortName);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::NetNitzNameInd - iCustomNitzLongNameString: %S", &iCustomNitzLongNameString);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::NetNitzNameInd - iCustomNitzShortNameString: %S", &iCustomNitzShortNameString);
 OstTrace1( TRACE_NORMAL, DUP3_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iMCC=%u", iNitzName.iMCC );
 OstTrace1( TRACE_NORMAL, DUP4_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iMNC=%u", iNitzName.iMNC );
 OstTraceExt1( TRACE_NORMAL, DUP5_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iLongName=%S", iNitzName.iLongName );
 OstTraceExt1( TRACE_NORMAL, DUP6_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iNitzName.iShortName=%S", iNitzName.iShortName );
+OstTraceExt1( TRACE_NORMAL, DUP7_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iCustomNitzLongNameString=%S", iCustomNitzLongNameString );
+OstTraceExt1( TRACE_NORMAL, DUP8_CMMNETOPERATORNAMEHANDLER_NETNITZNAMEIND, "CMmNetOperatorNameHandler::NetNitzNameInd - iCustomNitzShortNameString=%S", iCustomNitzShortNameString );
 
     // Compare NITZ name got in NET_NITZ_NAME_IND to stored values in PMM.
     CompareNitzNameToPmmValues();
+
+    // last received NET_MODEM_REG_STATUS_IND is needed to handle again
+    // so that NITZ information is updated to upper layers
+    iNetMessHandler->HandleLastNetModemRegStatusInd();
     }
 
 // -----------------------------------------------------------------------------
@@ -1797,7 +1815,8 @@
             iNitzNamePmm.iMNC = tempMNC;
             iNitzNamePmm.iLongName.Copy( tempLongName );
             iNitzNamePmm.iShortName.Copy( tempShortName );
-
+            iCustomNitzLongNameString.Copy( tempLongName );
+            iCustomNitzShortNameString.Copy( tempShortName );
             // Copy name data to iNitzName struct to keep PMM data in handle.
             iNitzName = iNitzNamePmm;
             }
@@ -2085,8 +2104,7 @@
 
 // -----------------------------------------------------------------------------
 // CMmNetOperatorNameHandler::OplRuleRecordChecker
-// Checks one OPL rule record against received Operator Code in BCD format
-// and LAC value.
+// Checks one OPL rule record against received Operator Code and LAC value.
 // -----------------------------------------------------------------------------
 //
 void CMmNetOperatorNameHandler::OplRuleRecordChecker
@@ -2099,54 +2117,140 @@
 TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker");
 OstTrace0( TRACE_NORMAL, CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker" );
 
-    // Temp data.
-    TUint8 operCodeChar( 0 );
-    TUint8 plmnListChar( 0 );
-
-    // Setting ret value to KErrNone first to get compare working.
-    TInt ret( KErrNone );
-
-    // Compare one BCD code byte at time.
-    for ( TUint8 i = 0; i < KBCDLength; i++ )
+    // Buffer for SIM Operator code, length is 3.
+    TBuf8<KBCDLength> simOperatorCode;
+
+    TUint16 bcchMcc1( 0 );
+    TUint16 bcchMcc2( 0 );
+    TUint16 bcchMcc3( 0 );
+
+    TUint16 bcchMnc1( 0 );
+    TUint16 bcchMnc2( 0 );
+    TUint16 bcchMnc3( 0 );
+
+    TUint16 simMcc1( 0 );
+    TUint16 simMcc2( 0 );
+    TUint16 simMcc3( 0 );
+
+    TUint16 simMnc1( 0 );
+    TUint16 simMnc2( 0 );
+    TUint16 simMnc3( 0 );
+
+    TUint bcchMccNumber( 0 );
+
+    // BCCH MCC/MNC mapping.
+    CMmStaticUtility::GetMccCodes( aOperCode, &bcchMcc1, &bcchMcc2, &bcchMcc3 );
+    CMmStaticUtility::GetMncCodes( aOperCode, &bcchMnc1, &bcchMnc2, &bcchMnc3 );
+
+TFLOGSTRING4("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH MCC1 MCC2 MCC3 : %X %X %X", bcchMcc1, bcchMcc2, bcchMcc3);
+TFLOGSTRING4("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH MNC1 MNC2 MNC3 : %X %X %X", bcchMnc1, bcchMnc2, bcchMnc3);
+OstTraceExt3( TRACE_NORMAL, DUP6_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH MCC1 MCC2 MCC3 : %hx %hx %hx", bcchMcc1, bcchMcc2, bcchMcc3 );
+OstTraceExt3( TRACE_NORMAL, DUP7_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH MNC1 MNC2 MNC3 : %hx %hx %hx", bcchMnc1, bcchMnc2, bcchMnc3 );
+
+    // BCCH MCC.
+    bcchMccNumber = 100 * bcchMcc1 + 10 * bcchMcc2 + bcchMcc3;
+
+    // SIM operator code in BCD string format.
+    simOperatorCode.Copy( iOperatorPlmnListTable[aIndex].iOperCodeBCD );
+
+    // SIM MCC/MNC mapping.
+    CMmStaticUtility::GetMccCodes( simOperatorCode, &simMcc1, &simMcc2, &simMcc3 );
+    CMmStaticUtility::GetMncCodes( simOperatorCode, &simMnc1, &simMnc2, &simMnc3 );
+
+TFLOGSTRING4("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM MCC1 MCC2 MCC3 : %X %X %X", simMcc1, simMcc2, simMcc3);
+TFLOGSTRING4("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM MNC1 MNC2 MNC3 : %X %X %X", simMnc1, simMnc2, simMnc3);
+OstTraceExt3( TRACE_NORMAL, DUP8_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM MCC1 MCC2 MCC3 : %hx %hx %hx", simMcc1, simMcc2, simMcc3 );
+OstTraceExt3( TRACE_NORMAL, DUP9_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM MNC1 MNC2 MNC3 : %hx %hx %hx", simMnc1, simMnc2, simMnc3 );
+
+    // Flag for OPL rule checking.
+    TBool digitMatch( EFalse );
+
+    // - BCD value of 'D' in any of the MCC and/or MNC digits shall be used
+    //   to indicate a "wild" value for that corresponding MCC/MNC digit.
+    //   3GPP spec 31.102/4.2.59.
+    // - Other special cases for handling of OPL rules.
+    //   3GPP 23.122 Annex A.
+
+    // SIM MCC = BCCH MCC.
+    if ( ( bcchMcc1 == simMcc1 || KWildCharD == simMcc1 )
+        && ( bcchMcc2 == simMcc2 || KWildCharD == simMcc2 )
+        && ( bcchMcc3 == simMcc3 || KWildCharD == simMcc3 ) )
         {
-        if ( KErrNone == ret )
+        // 1st and 2nd digit SIM MNC and BCCH MNC match.
+        if ( ( bcchMnc1 == simMnc1 || KWildCharD == simMnc1 )
+            && ( bcchMnc2 == simMnc2 || KWildCharD == simMnc2 ) )
             {
-            // Check upper part of byte.
-            operCodeChar = ( aOperCode[i] >> 4 ) & KBCDOneCharMask;
-            plmnListChar =
-                ( iOperatorPlmnListTable[aIndex].iOperCodeBCD[i] >> 4 ) &
-                KBCDOneCharMask;
-
-            ret = BCDCharChecker( operCodeChar, plmnListChar );
-
-            // Continue checking lower part if previous matches.
-            if ( KErrNone == ret )
+            // 3rd digit SIM MNC and BCCH MNC match.
+            if ( bcchMnc3 == simMnc3 || KWildCharD == simMnc3 )
+                {
+                // Match.
+                digitMatch = ETrue;
+                }
+            else
                 {
-                // Check lower part of byte.
-                operCodeChar = aOperCode[i] & KBCDOneCharMask;
-                plmnListChar =
-                    iOperatorPlmnListTable[aIndex].iOperCodeBCD[i] &
-                    KBCDOneCharMask;
-
-                ret = BCDCharChecker( operCodeChar, plmnListChar );
+                // Check whether the PLMN is from country where '0'
+                // and 'F' are treated equally in MNC digit 3.
+                // BCCH MCC in the range 302, 310-316.
+                if ( 302 == bcchMccNumber
+                    || 310 == bcchMccNumber
+                    || 311 == bcchMccNumber
+                    || 312 == bcchMccNumber
+                    || 313 == bcchMccNumber
+                    || 314 == bcchMccNumber
+                    || 315 == bcchMccNumber
+                    || 316 == bcchMccNumber )
+                    {
+                    if ( ( 0 == bcchMnc3 && KWildCharF == simMnc3 )
+                        || ( KWildCharF == bcchMnc3 && 0 == simMnc3 ) )
+                        {
+                        // Match.
+                        digitMatch = ETrue;
+                        }
+                    else
+                        {
+                        // No match.
+                        digitMatch = EFalse;
+                        }
+                    }
+                else
+                    {
+                    // No match.
+                    digitMatch = EFalse;
+                    }
                 }
             }
+        else
+            {
+            // No match.
+            digitMatch = EFalse;
+            }
+        }
+    else
+        {
+        // No match.
+        digitMatch = EFalse;
         }
 
     // Compare Location Area Value information.
     // LAC should be in between upper and lower limit.
     //
-    // If BCD code match then continue to check LAC values.
-    if ( KErrNone == ret )
+    // If MCC and MNC code match then continue to check LAC values.
+    if ( digitMatch )
         {
-TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - BCD code match");
-OstTrace0( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - BCD code match" );
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - MCC and MNC match");
+OstTrace0( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - MCC and MNC match" );
+
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH LAC: %d", aLac);
+TFLOGSTRING3("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM LAC between: %d - %d", iOperatorPlmnListTable[aIndex].iLACUpperLimit, iOperatorPlmnListTable[aIndex].iLACLowerLimit);
+OstTrace1( TRACE_NORMAL, DUP10_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - BCCH LAC: %u", aLac );
+OstTraceExt2( TRACE_NORMAL, DUP11_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - SIM LAC between: %u - %u", iOperatorPlmnListTable[aIndex].iLACUpperLimit, iOperatorPlmnListTable[aIndex].iLACLowerLimit );
+
         if ( ( aLac <= iOperatorPlmnListTable[aIndex].iLACUpperLimit )
             && ( aLac >= iOperatorPlmnListTable[aIndex].iLACLowerLimit ) )
             {
 TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - LAC match => OPL Rule match");
 OstTrace0( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - LAC match => OPL Rule match" );
-            // Both BCD code and LAC value match.
+            // MCC, MNC and LAC value match.
             // Set iOplRuleMatch value to ETrue.
             // This informs that OPL record match.
             iOplRuleMatch = ETrue;
@@ -2163,46 +2267,13 @@
         }
     else
         {
-TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - BCD code didn't match => OPL Rule doesn't match");
-OstTrace0( TRACE_NORMAL, DUP4_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - BCD code didn't match => OPL Rule doesn't match" );
+TFLOGSTRING("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - MCC or MNC didn't match => OPL Rule doesn't match");
+OstTrace0( TRACE_NORMAL, DUP4_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker - MCC or MNC didn't match => OPL Rule doesn't match" );
         // Set iOplRuleMatch value to EFalse.
         // This informs that OPL record didn't match.
         iOplRuleMatch = EFalse;
         }
 TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::OplRuleRecordChecker - OPL Rule Match value T/F: %d", iOplRuleMatch);
-OstTrace1( TRACE_NORMAL, DUP6_CMMNETOPERATORNAMEHANDLER_OPLRULERECORDCHECKER, "CMmNetOperatorNameHandler::OplRuleRecordChecker;iOplRuleMatch=%d", iOplRuleMatch );
-    }
-
-// -----------------------------------------------------------------------------
-// CMmNetOperatorNameHandler::BCDCharChecker
-// Check BCD char against rule to find out is that matching with OPL list.
-// -----------------------------------------------------------------------------
-//
-TInt CMmNetOperatorNameHandler::BCDCharChecker
-        (
-        TUint8 aOperCodeChar,
-        TUint8 aPlmnListChar
-        )
-    {
-TFLOGSTRING3("TSY: CMmNetOperatorNameHandler::BCDCharChecker - Operator code char : Plmn list char = %X : %X", aOperCodeChar, aPlmnListChar);
-OstTraceExt2( TRACE_NORMAL, DUP2_CMMNETOPERATORNAMEHANDLER_BCDCHARCHECKER, "CMmNetOperatorNameHandler::BCDCharChecker - Operator code char : Plmn list char = %hhx : %hhx", aOperCodeChar, aPlmnListChar );
-
-    TInt ret( KErrGeneral );
-
-    // Check character.
-    // Operator code character needs to match OPL list Operator character
-    // or if OPL list character value is 'D' it indicates "wild" value what
-    // corresponding to all values.
-    if ( aOperCodeChar == aPlmnListChar || KBCDWildChar == aPlmnListChar )
-        {
-TFLOGSTRING("TSY: CMmNetOperatorNameHandler::BCDCharChecker - Character match");
-OstTrace0( TRACE_NORMAL, DUP1_CMMNETOPERATORNAMEHANDLER_BCDCHARCHECKER, "CMmNetOperatorNameHandler::BCDCharChecker - Character match" );
-        // Character match.
-        ret = KErrNone;
-        }
-    // No else, ret is already set to KErrGeneral.
-
-    return ret;
     }
 
 // -----------------------------------------------------------------------------
@@ -2230,7 +2301,7 @@
 
         // Add Operator name info data.
         iOperNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
-        iOperNameInfo.iName.Copy( iEonsName.iLongName );
+        iOperNameInfo.iName.Copy( iCustomEonsNameString );
 
         // Copy Short EONS name if exist.
         if ( 0 < iEonsName.iShortName.Length() )
@@ -2275,7 +2346,7 @@
 
             // Add Operator name info data.
             iOperNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
-            iOperNameInfo.iName.Copy( iNitzName.iLongName );
+            iOperNameInfo.iName.Copy( iCustomNitzLongNameString );
             }
 
         // Copy Short NITZ name if exist.
@@ -2289,7 +2360,7 @@
                 {
                 // Add Operator name info data.
                 iOperNameInfo.iType = RMmCustomAPI::EOperatorNameNitzShort;
-                iOperNameInfo.iName.Copy( iNitzName.iShortName );
+                iOperNameInfo.iName.Copy( iCustomNitzShortNameString );
                 }
             }
         }
@@ -3074,6 +3145,7 @@
         // Reset EONS names.
         iEonsName.iLongName.Zero();
         iEonsName.iShortName.Zero();
+        iCustomEonsNameString.Zero();
 
         // Temporary buffer for full EONS name. Full name is mandatory.
         TBuf<KMaxLengthOfOperatorName> longEonsName;
@@ -3087,9 +3159,14 @@
             iEonsName.iMCC,
             eonsFullNameData,
             longEonsName );
+
+        // Store EONS Long name for custom request use.
+        iCustomEonsNameString.Copy( 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() )
             {
@@ -3125,11 +3202,14 @@
 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);
+TFLOGSTRING2("TSY: CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL - iCustomEonsNameString: %S", &iCustomEonsNameString);
+
 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 );
+OstTraceExt1( TRACE_NORMAL, DUP23_CMMNETOPERATORNAMEHANDLER_UICCOPERATORRESPREADPNNL, "CMmNetOperatorNameHandler::UiccOperatorRespReadPnnL;iCustomEonsNameString=%S", iCustomEonsNameString );
         }
     else
         {
@@ -3141,6 +3221,7 @@
         // Reset EONS names.
         iEonsName.iLongName.Zero();
         iEonsName.iShortName.Zero();
+        iCustomEonsNameString.Zero();
         }
 
     // This completes NetModemRegStatusInd method IPC
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketcontextmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketcontextmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -15,8 +15,6 @@
 *
 */
 
-
-
 // INCLUDES
 #include <in_sock.h>
 #include <etelutils.h>
@@ -55,6 +53,8 @@
     //None
 
 // CONSTANTS
+// Offset to subblock length in EIsiSubBlockTypeId8Len8 subblock
+const TUint KSubblockTypeId8Len8LengthOffset = 1;
 
 // MACROS
     //None
@@ -1078,31 +1078,39 @@
             ( GPDS_PDP_TYPE_IPV4 == aPdpType ||
                 GPDS_PDP_TYPE_IPV6 == aPdpType ) )
             {
-            // Set the pdp address info
-            TBuf8<KMaxLengthOfGdpsActivateReqSB> pdpAddressInfo;
-            pdpAddressInfo.Zero();
-            TIsiSubBlock gpdsPdpAddressInfoSb (
-                pdpAddressInfo,
-                GPDS_PDP_ADDRESS_INFO,
-                EIsiSubBlockTypeId8Len8 );
-
-            pdpAddressInfo.Append( KGpdsPadding );
-            pdpAddressInfo.Append( aPdpAddress.Length() ); //lenght should always
-                                                           //be 4 or 16
-            pdpAddressInfo.Append( aPdpAddress );
-
-            TUint8 subBlockCount( 1 );
-            gpdsActivateReq.Append( subBlockCount );
-            gpdsActivateReq.Append( gpdsPdpAddressInfoSb.CompleteSubBlock() );
+            TBuf8<KIpv6AddressLen> gpdsAddress;
+            ret = CMmStaticUtility::ConvertIPAddressFromClient(
+                aPdpAddress, gpdsAddress );
+            if ( KErrNone == ret )
+                {
+                TBuf8<KMaxLengthOfGdpsActivateReqSB> pdpAddressInfo;
+                pdpAddressInfo.Zero();
+                TIsiSubBlock gpdsPdpAddressInfoSb (
+                    pdpAddressInfo,
+                    GPDS_PDP_ADDRESS_INFO,
+                    EIsiSubBlockTypeId8Len8 );
+                pdpAddressInfo.Append( KGpdsPadding );
+                pdpAddressInfo.Append( gpdsAddress.Length() );
+                pdpAddressInfo.Append( gpdsAddress );
+
+                TUint8 subBlockCount( 1 );
+                gpdsActivateReq.Append( subBlockCount );
+                gpdsActivateReq.Append( gpdsPdpAddressInfoSb.CompleteSubBlock() );
+                }
             }
         else
             {
             gpdsActivateReq.Append( 0 ); //sub block count
             }
 
-        // Send Isi message via Phonet
-        ret = iPhoNetSender->Send( PN_GPDS,
-            aTransactionId, GPDS_CONTEXT_ACTIVATE_REQ, gpdsActivateReq );
+        if ( KErrNone == ret )
+            {
+            // Send Isi message via Phonet
+            ret = iPhoNetSender->Send( PN_GPDS,
+                aTransactionId, GPDS_CONTEXT_ACTIVATE_REQ, gpdsActivateReq );
+            }
+        // no else
+
         }
     // no else
 
@@ -1991,6 +1999,7 @@
 TInt CMmPacketContextMessHandler::GpdsContextDeactivateReq(
     const CMmDataPackage& aDataPackage )
     {
+    TInt ret( KErrNone );
     TInfoName* contextName = NULL;
     aDataPackage.UnPackData( &contextName );
     TUint8 contextId( iContextList->GetContextIdByContextName( contextName ) );
@@ -2001,18 +2010,26 @@
         }
     // no else
 
-    TUint8 transactionId( GenerateTraId( contextId ) );
-
-    TFLOGSTRING3("TSY: CMmPacketContextMessHandler::GpdsContextDeactivateReq. TransId: %d ContextId: %d", transactionId, contextId );
+    if ( GPDS_CID_VOID != contextId )
+        {
+        TUint8 transactionId( GenerateTraId( contextId ) );
+TFLOGSTRING3("TSY: CMmPacketContextMessHandler::GpdsContextDeactivateReq. TransId: %d ContextId: %d", transactionId, contextId );
 OstTraceExt2( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLER_GPDSCONTEXTDEACTIVATEREQ, "CMmPacketContextMessHandler::GpdsContextDeactivateReq;transactionId=%hhu;contextId=%hhu", transactionId, contextId );
-
-    // Set the message data that consists of one parameter
-    TBuf8<KMessageDataBufSize1> messageData;
-    messageData.Append( contextId );
-
-    // Send Isi message via Phonet
-    return iPhoNetSender->Send( PN_GPDS,
-        transactionId, GPDS_CONTEXT_DEACTIVATE_REQ, messageData );
+        // Set the message data that consists of one parameter
+        TBuf8<KMessageDataBufSize1> messageData;
+        messageData.Append( contextId );
+
+        // Send Isi message via Phonet
+        ret = iPhoNetSender->Send( PN_GPDS,
+            transactionId, GPDS_CONTEXT_DEACTIVATE_REQ, messageData );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPacketContextMessHandler::GpdsContextDeactivateReq. Context ID not found, return KErrNotFound" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLER_GPDSCONTEXTDEACTIVATEREQ, "CMmPacketContextMessHandler::GpdsContextDeactivateReq. Context ID not found, return KErrNotFound" );
+        ret = KErrNotFound;
+        }
+    return ret;
     }
 
 // -----------------------------------------------------------------------------
@@ -3285,7 +3302,7 @@
     TFLOGSTRING( "TSY: CMmPacketContextMessHandler::InitialiseContext");
 OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLER_INITIALISECONTEXT, "CMmPacketContextMessHandler::InitialiseContext" );
 
-    TUint8 channelId( KTUint8NotDefined );
+    TInt channelId( KTUint8NotDefined );
     TInfoName* contextName = NULL;
     TInfoName* hostCidName = NULL;
     TInt ret( KErrNone );
@@ -3304,7 +3321,14 @@
 
     if( KErrNone == ret )
         {
-        ret = iContextList->GenerateProxyId( channelId );
+        if ( contextName )
+            {
+            channelId = getProxyId( *contextName );
+            }
+        else
+            {
+            ret = KErrNotFound;
+            }
 
         if( KErrNone == ret )
             {
@@ -3951,30 +3975,29 @@
     TUint8 contextId( iContextList->
         GetContextIdByContextName( contextName ) );
 
-    iContextList->SetInitialiseMember( contextId, ETrue );
-
     // Check that the mode given in aConfig is GPRS
     if ( TPacketDataConfigBase::KConfigGPRS == config->ExtensionId() )
         {
         if ( GPDS_CID_VOID != contextId )
             {
-
-            TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> Rel97");
+TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> Rel97");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL -> Rel97" );
 
-            iContextList->SetContextConfigurationType(
-                contextId, TPacketDataConfigBase::KConfigGPRS );
+            iContextList->SetInitialiseMember( contextId, ETrue );
 
             RPacketContext::TContextConfigGPRS& configGPRS =
                 *reinterpret_cast<RPacketContext::TContextConfigGPRS*>(
                     config );
 
-            TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iPrimaryDns:%S", &configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
-
-OstTraceExt1( TRACE_NORMAL, DUP2_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;iPrimaryDns=%s", configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
-            TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iSecondaryDns:%S", &configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
-OstTraceExt1( TRACE_NORMAL, DUP3_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;iSecondaryDns=%s", configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns );
-
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig IP.Length() = %d", configGPRS.iPdpAddress.Length());
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iPrimaryDns.Length() = %d", configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length() );
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iSecondaryDns.Length() = %d", configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length());
+OstTrace1( TRACE_NORMAL, DUP10_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iPdpAddress.Length()=%d", configGPRS.iPdpAddress.Length() );
+OstTrace1( TRACE_NORMAL, DUP11_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length()=%d", configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length() );
+OstTrace1( TRACE_NORMAL, DUP12_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length()=%d", configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length() );
+
+            iContextList->SetContextConfigurationType(
+                contextId, TPacketDataConfigBase::KConfigGPRS );
             // save authentication data
             ret = iContextList->SaveConfig(
                 contextId,
@@ -4103,7 +4126,6 @@
             ret = KErrNotReady;
             }
         }
-
     else if ( TPacketDataConfigBase::KConfigRel99Rel4 == config->ExtensionId()
         || TPacketDataConfigBase::KConfigRel5 == config->ExtensionId() )
         {
@@ -4111,24 +4133,29 @@
             {
             if ( TPacketDataConfigBase::KConfigRel5 == config->ExtensionId() )
                 {
-
-                TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> R5");
+TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> R5");
 OstTrace0( TRACE_NORMAL, DUP4_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL -> R5" );
                 }
             else
                 {
-
-                TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> R99");
+TFLOGSTRING("TSY: CMmPacketContextMessHandler::SetConfig -> R99");
 OstTrace0( TRACE_NORMAL, DUP5_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL -> R99" );
                 }
 
-            iContextList->SetContextConfigurationType(
-                contextId, TPacketDataConfigBase::KConfigRel99Rel4 );
-
             RPacketContext::TContextConfigR99_R4& configR99_R4 =
                 *reinterpret_cast<RPacketContext::TContextConfigR99_R4*>(
                     config );
 
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iMiscBuffer:%S", &configR99_R4.iProtocolConfigOption.iMiscBuffer );
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig IP.Length() = %d", configR99_R4.iPdpAddress.Length());
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iPrimaryDns.Length() = %d", configR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length() );
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iSecondaryDns.Length() = %d", configR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length());
+OstTrace1( TRACE_NORMAL, DUP6_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iPdpAddress.Length()=%d", configR99_R4.iPdpAddress.Length() );
+OstTrace1( TRACE_NORMAL, DUP7_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length()=%d", configR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Length() );
+OstTrace1( TRACE_NORMAL, DUP8_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;configGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length()=%d", configR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Length() );
+
+            iContextList->SetContextConfigurationType(
+                contextId, TPacketDataConfigBase::KConfigRel99Rel4 );
             // save authentication data
             // No need to save REL5 type-> more complexity later as there is no
             // own class for Rel5 Config.
@@ -4137,13 +4164,6 @@
                 NULL,
                 &configR99_R4 );
 
-            TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iMiscBuffer:%S", &configR99_R4.iProtocolConfigOption.iMiscBuffer );
-OstTraceExt1( TRACE_NORMAL, DUP6_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;iMiscBuffer=%s", configR99_R4.iProtocolConfigOption.iMiscBuffer );
-            TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iPrimaryDns:%S", &configR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
-OstTraceExt1( TRACE_NORMAL, DUP7_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;iPrimaryDns=%s", configR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
-            TFLOGSTRING2("TSY: CMmPacketContextMessHandler::SetConfig iSecondaryDns:%S",&configR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns );
-OstTraceExt1( TRACE_NORMAL, DUP8_CMMPACKETCONTEXTMESSHANDLER_SETCONFIGL, "CMmPacketContextMessHandler::SetConfigL;iSecondaryDns=%s", configR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns );
-
             // Config saved succesfully
             if ( KErrNone == ret )
                 {
@@ -4915,7 +4935,14 @@
                 iDeactivateContextList->Reset();
                 delete iDeactivateContextList;
                 iDeactivateContextList = NULL;
-                CallModemResourceReqDenied();
+
+                // detailed cause values.
+                // see 3GPP TS 24.008 V5.16.0 spec
+                _LIT8(KDetailedCause, "\xc0\x95\x82\x02");
+                CallModemResourceReqDenied(
+                    CALL_MODEM_CAUSE_TYPE_CLIENT,
+                    CALL_MODEM_CAUSE_RELEASE_BY_USER, 
+                    KDetailedCause );
                 }
             //no else
             }
@@ -5644,8 +5671,7 @@
     TUint sbStartOffset( 0 );
     //Default, 0 is unused value
     TUint resourceId( 0 );
-    // Default, emergency call mode not possible in MT call
-    TUint8 callMode( CALL_MODEM_MODE_EMERGENCY );
+    TBool callModeFound( EFalse );
     // Make a copy of received message. Allocate heap memory.
     // Can leave if out of mem.
     iResourceControlMsg = HBufC8::NewL( aIsiMessage.GetBuffer().Length() );
@@ -5674,35 +5700,56 @@
         EIsiSubBlockTypeId8Len8,
         sbStartOffset ) )
         {
-        callMode = aIsiMessage.Get8bit(
-            sbStartOffset + CALL_MODEM_SB_MODE_OFFSET_MODE );
+        callModeFound = ETrue;
         }
     // check request
-    if ( ( CALL_MODEM_RES_ID_MT_INIT == resourceId ) &&
-         ( CALL_MODEM_ID_NONE != callId ) &&
-         ( CALL_MODEM_MODE_SPEECH == callMode ||
-           CALL_MODEM_MODE_ALS_LINE_2 == callMode ||
-           CALL_MODEM_MODE_MULTIMEDIA == callMode ) )
+    if( CALL_MODEM_RES_ID_MT_INIT == resourceId )
         {
-        // if DCM drive mode flag is enabled
-        if ( iDriveModeFlag )
+        if( CALL_MODEM_ID_NONE != callId && callModeFound )
             {
+            // if DCM drive mode flag is enabled
+            if ( iDriveModeFlag )
+                {
 TFLOGSTRING( "TSY: CMmPacketContextMessHandler::CallModemResourceIndL - DCM Drive Mode enabled" );
 OstTrace0( TRACE_NORMAL, DUP8_CMMPACKETCONTEXTMESSHANDLER_CALLMODEMRESOURCEINDL, "CMmPacketContextMessHandler::CallModemResourceIndL - DCM Drive Mode enabled" );
 
-            // Complete DCM specific functionality
-            // Drive mode rejects automatically incoming calls
-            CompleteDCMdrivemodeFunctionalityL();
-            CallModemResourceReqDenied();
+                // Complete DCM specific functionality
+                // Drive mode rejects automatically incoming calls
+                CompleteDCMdrivemodeFunctionalityL();
+
+                // detailed cause values.
+                // see 3GPP TS 24.008 V5.16.0 spec
+                _LIT8(KDetailedCause, "\xc0\x95\x82\x02");
+                CallModemResourceReqDenied(
+                    CALL_MODEM_CAUSE_TYPE_CLIENT,
+                    CALL_MODEM_CAUSE_RELEASE_BY_USER, 
+                    KDetailedCause );
+                }
+            else
+                {
+TFLOGSTRING( "TSY: CMmPacketContextMessHandler::CallModemResourceIndL - Allow incoming call activation" );
+OstTrace0( TRACE_NORMAL, DUP6_CMMPACKETCONTEXTMESSHANDLER_CALLMODEMRESOURCEINDL, "CMmPacketContextMessHandler::CallModemResourceIndL - Allow incoming call activation" );
+
+                // allow incoming call activation
+                iCallModemResourceCallId = callId;
+                AllowIncomingCallActivationL();
+                }
             }
         else
             {
-TFLOGSTRING( "TSY: CMmPacketContextMessHandler::CallModemResourceIndL - Allow incoming call activation" );
-OstTrace0( TRACE_NORMAL, DUP6_CMMPACKETCONTEXTMESSHANDLER_CALLMODEMRESOURCEINDL, "CMmPacketContextMessHandler::CallModemResourceIndL - Allow incoming call activation" );
-
-            // allow incoming call activation
-            iCallModemResourceCallId = callId;
-            AllowIncomingCallActivationL();
+TFLOGSTRING( "TSY: CMmPacketContextMessHandler::CallModemResourceIndL - Call mode missing, resource is denied" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLER_CALLMODEMRESOURCEINDL, "CMmPacketContextMessHandler::CallModemResourceIndL - Call mode missing, resource is denied" );
+
+            // detailed cause values.
+            // see 3GPP TS 24.008 V5.16.0 spec
+            // in this case we need to return detailed cause as
+            // 0xE0 (coding standard GSM PLMN, location user)
+            // 0xD8 (cause 88)
+            _LIT8(KDetailedCause, "\xe0\xd8");
+            CallModemResourceReqDenied(
+                CALL_MODEM_CAUSE_TYPE_NETWORK, 
+                CALL_MODEM_NW_CAUSE_INCOMPATIBLE_DEST,
+                KDetailedCause );
             }
         }
     else
@@ -5841,8 +5888,11 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CMmPacketContextMessHandler::CallModemResourceReqDenied()
-   {
+void CMmPacketContextMessHandler::CallModemResourceReqDenied(
+    const TUint8 aCauseType,
+    const TUint8 aCause,
+    const TDesC8& aDetailedCause )
+    {
 TFLOGSTRING("TSY: CMmPacketContextMessHandler::CallModemResourceReqDenied");
 OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLER_CALLMODEMRESOURCEREQDENIED, "CMmPacketContextMessHandler::CallModemResourceReqDenied" );
 
@@ -5866,10 +5916,49 @@
     callModemResourceDenied.Set8bit(
         ISI_HEADER_SIZE + CALL_MODEM_RESOURCE_REQ_OFFSET_CALLID, callId );
 
-    TInt aCurrentMsgOffset(
+    TInt currentMsgOffset(
         ISI_HEADER_SIZE + SIZE_CALL_MODEM_RESOURCE_REQ );
 
     TUint8 numOfSbInMessage( 0 );
+    TUint subblockOffset( 0 );
+
+    // CALL_MODEM_SB_RESOURCE (same as in indication)
+    if ( KErrNone == isimessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE + SIZE_CALL_MODEM_RESOURCE_IND,
+        CALL_MODEM_SB_RESOURCE,
+        EIsiSubBlockTypeId8Len8,
+        subblockOffset ) )
+        {
+        TUint subblockLength( isimessage.Get8bit(
+            subblockOffset + KSubblockTypeId8Len8LengthOffset ) );
+
+        callModemResourceDenied.CopyData(
+            currentMsgOffset, 
+            isimessage.GetData(
+                subblockOffset, 
+                subblockLength ) );
+        numOfSbInMessage++;
+        currentMsgOffset += subblockLength;
+        }
+
+    // CALL_MODEM_SB_RESOURCE_SEQ_ID  (same as in indication)
+    if ( KErrNone == isimessage.FindSubBlockOffsetById(
+        ISI_HEADER_SIZE + SIZE_CALL_MODEM_RESOURCE_IND,
+        CALL_MODEM_SB_RESOURCE_SEQ_ID,
+        EIsiSubBlockTypeId8Len8,
+        subblockOffset ) )
+        {
+        TUint subblockLength( isimessage.Get8bit(
+            subblockOffset + KSubblockTypeId8Len8LengthOffset ) );
+
+        callModemResourceDenied.CopyData(
+            currentMsgOffset, 
+            isimessage.GetData(
+                subblockOffset, 
+                subblockLength ) );
+        numOfSbInMessage++;
+        currentMsgOffset += subblockLength;
+        }
 
     // buffer for CALL_MODEM_SB_RESOURCE_STATUS subblock
     TBuf8<CALL_MODEM_SB_RESOURCE_STATUS> resourceStatus;
@@ -5884,10 +5973,10 @@
     resourceStatus.Append( KCallPadding );
 
     callModemResourceDenied.CopyData(
-        aCurrentMsgOffset, resourceStatusSb.CompleteSubBlock() );
+        currentMsgOffset, resourceStatusSb.CompleteSubBlock() );
     // Set new offset and increase subblock count
-    aCurrentMsgOffset =
-        aCurrentMsgOffset + resourceStatus.Length();
+    currentMsgOffset =
+        currentMsgOffset + resourceStatus.Length();
     // increase subblock count
     numOfSbInMessage++;
 
@@ -5903,14 +5992,14 @@
         CALL_MODEM_SB_CAUSE,
         EIsiSubBlockTypeId8Len8 );
     // cause type + cause
-    modemSbCause.Append( CALL_MODEM_CAUSE_TYPE_CLIENT );
-    modemSbCause.Append( CALL_MODEM_CAUSE_RELEASE_BY_USER );
+    modemSbCause.Append( aCauseType );
+    modemSbCause.Append( aCause );
 
     callModemResourceDenied.CopyData(
-        aCurrentMsgOffset, modemSbCauseSb.CompleteSubBlock() );
+        currentMsgOffset, modemSbCauseSb.CompleteSubBlock() );
     // Set new offset and increase subblock count
-    aCurrentMsgOffset =
-        aCurrentMsgOffset + modemSbCause.Length();
+    currentMsgOffset =
+        currentMsgOffset + modemSbCause.Length();
     // increase subblock count
     numOfSbInMessage++;
 
@@ -5925,19 +6014,15 @@
         detailedCause,
         CALL_MODEM_SB_DETAILED_CAUSE,
         EIsiSubBlockTypeId8Len8 );
-    // cause length + cause values ( 4 ) + filler
-    detailedCause.Append( KDiagnosticsOctet2 );
-    detailedCause.Append( KDiagnosticsOctet3 );
-    detailedCause.Append( KDiagnosticsOctet4 );
-    detailedCause.Append( KDiagnosticsOctet5 );
-    detailedCause.Append( KDiagnosticsOctet6 );
-    detailedCause.Append( KCallPadding );
+    // cause length + cause values
+    detailedCause.Append( aDetailedCause.Length() );
+    detailedCause.Append( aDetailedCause );
 
     callModemResourceDenied.CopyData(
-        aCurrentMsgOffset, detailedCauseSb.CompleteSubBlock() );
+        currentMsgOffset, detailedCauseSb.CompleteSubBlock() );
     // Set new offset and increase subblock count
-    aCurrentMsgOffset =
-        aCurrentMsgOffset + detailedCause.Length();
+    currentMsgOffset =
+        currentMsgOffset + detailedCause.Length();
     // increase subblock count
     numOfSbInMessage++;
 
@@ -5955,7 +6040,6 @@
     // Delete iResourceControlMsg
     delete iResourceControlMsg;
     iResourceControlMsg = NULL;
-
     }
 
 // -----------------------------------------------------------------------------
@@ -6059,6 +6143,32 @@
 
     }
 
+// -----------------------------------------------------------------------------
+// CMmPacketContextMessHandler::getProxyId
+// This method interpretes channel ID from context name.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMmPacketContextMessHandler::getProxyId(const TInfoName& contextName)
+    {
+    _LIT(KUnderscore, "_");
+    TInt channelId ;
+    TInt pos = contextName.Find( KUnderscore );
+    if ( pos != KErrNotFound )
+        {
+        TLex(contextName.Mid(pos+1)).Val(channelId);
+TFLOGSTRING2("TSY: CMmPacketContextMessHandler::getProxyId channelId = %d", channelId );
+OstTrace1( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLER_GETPROXYID, "CMmPacketContextMessHandler::getProxyId;channelId=%d", channelId );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPacketContextMessHandler::getProxyId channelId NOT FOUND !!!" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLER_GETPROXYID, "CMmPacketContextMessHandler::getProxyId: channelId NOT FOUND !!!" );
+        // FAIL, this should never happen..
+        }
+    return channelId;
+    }
+
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
     // None
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketmesshandlercontextlist.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmpacketmesshandlercontextlist.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -35,7 +35,17 @@
     //None
 
 // CONSTANTS
-    //None
+
+// A list for defined proxy ids ( see IscNokiaDefinitions.h )
+// Max number of supported contexts is limited to be 11
+// Get defined proxy ids
+const TUint8 KDefinedProxyIds[KMmMaxNumberOfContexts] = {
+    KMmPacketContextProxy1_DOS, KMmPacketContextProxy2_DOS,
+    KMmPacketContextProxy3_DOS, KMmPacketContextProxy4_DOS,
+    KMmPacketContextProxy5_DOS, KMmPacketContextProxy6_DOS,
+    KMmPacketContextProxy7_DOS, KMmPacketContextProxy8_DOS,
+    KMmPacketContextProxy9_DOS, KMmPacketContextProxy10_DOS,
+    KMmPacketContextProxy11_DOS };
 
 // MACROS
     //None
@@ -118,42 +128,9 @@
     TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::InitAttributesAndLists");
 OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_INITATTRIBUTESANDLISTS, "CMmPacketContextMesshandlerList::InitAttributesAndLists" );
 
-    // A list for defined proxy ids ( see IscNokiaDefinitions.h )
-    // Max number of supported contexts is limited to be 11
-    // Get defined proxy ids
-    const TUint8 definedProxyIds[KMmMaxNumberOfContexts] = {
-        KMmPacketContextProxy1_DOS, KMmPacketContextProxy2_DOS,
-        KMmPacketContextProxy3_DOS, KMmPacketContextProxy4_DOS,
-        KMmPacketContextProxy5_DOS, KMmPacketContextProxy6_DOS,
-        KMmPacketContextProxy7_DOS, KMmPacketContextProxy8_DOS,
-        KMmPacketContextProxy9_DOS, KMmPacketContextProxy10_DOS,
-        KMmPacketContextProxy11_DOS };
-
     for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
-        iProxyIdList[i].iChannelId = definedProxyIds[i];
-
-        // Mark proxy id free
-        iProxyIdList[i].iIsFree = ETrue;
-
-        // Initialize context info list
-        iContextInfoArray[i].iContextId = GPDS_CID_VOID;
-
-        iContextInfoArray[i].iChannelId = KTUint8NotDefined;
-
-        iContextInfoArray[i].iContextName.Zero();
-        iContextInfoArray[i].iHostContextName.Zero();
-        iContextInfoArray[i].iPipeStatus = PN_PIPE_DISABLE;
-        iContextInfoArray[i].iPipeHandle = KInvalidPipeHandle;
-        iContextInfoArray[i].iCreateContextIdTransId = KTUint8NotDefined;
-        iContextInfoArray[i].iPipeCreateTransId = KTUint8NotDefined;
-        iContextInfoArray[i].iContextType = GPDS_CONT_TYPE_NORMAL ;
-        iContextInfoArray[i].iInitialiseStarted = EFalse;
-        iContextInfoArray[i].iContextConfigurationType = KTIntNotDefined;
-        iContextInfoArray[i].iActivationTraId = KTUint8NotDefined;
-        iContextInfoArray[i].iPipeResetTraId = KTUint8NotDefined;
-        iContextInfoArray[i].iDeleteTraId = KTUint8NotDefined;
-        iContextInfoArray[i].iChannelOpened = EFalse;
+        InitializeContextInfoList( i );
         }
 
     iNumberOfCreatedContexts = 0;
@@ -175,9 +152,12 @@
 
     TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::~CMmPacketContextMesshandlerList" );
 OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CMMPACKETCONTEXTMESSHANDLERLIST, "CMmPacketContextMesshandlerList::~CMmPacketContextMesshandlerList" );
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
-        iContextInfoArray[i].iIscApi.Close();
+        if ( iContextInfoArray[i].iChannelOpened )
+            {
+            iContextInfoArray[i].iIscApi.Close();
+            }
         }
     }
 
@@ -207,30 +187,24 @@
             // Find given proxy id from proxy id list
             for (  TInt i = 0; i < KMmMaxNumberOfContexts; i++  )
                 {
-                if ( ( aChannelId == iProxyIdList[i].iChannelId ) &&
-                     iProxyIdList[i].iIsFree )
+                if ( aChannelId == iContextInfoArray[i].iChannelId )
                     {
-                    iContextInfoArray[iNumberOfCreatedContexts].iChannelId =
+                    iContextInfoArray[i].iChannelId =
                         aChannelId;
-                    iContextInfoArray[iNumberOfCreatedContexts].iContextName =
+                    iContextInfoArray[i].iContextName =
                         aContextName;
-                    iContextInfoArray[iNumberOfCreatedContexts].iHostContextName =
+                    iContextInfoArray[i].iHostContextName =
                         aHostContextName;
-                    iContextInfoArray[iNumberOfCreatedContexts].iObjectId =
+                    iContextInfoArray[i].iObjectId =
                         aObjectId;
-                    // Set proxy id reserved
-                    iProxyIdList[i].iIsFree = EFalse;
                     // Increase number of created contexts
                     iNumberOfCreatedContexts++;
                     // proxy id found, break
                     i = KMmMaxNumberOfContexts;
-
                     ret = KErrNone;
                     }
-                // no else
                 }
             }
-        // no else
         }
     // no else
 
@@ -253,95 +227,18 @@
     // Set ret to KErrArgument to check that context is in list
     TInt ret( KErrArgument );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-            for ( TInt j = 0; j < KMmMaxNumberOfContexts; j++ )
-                {
-                if ( ( iContextInfoArray[i].iChannelId ==
-                        iProxyIdList[j].iChannelId ) &&
-                    ( EFalse == iProxyIdList[j].iIsFree ) )
-                    {
-
-                    TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveObject. Context Name: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveObject. Context Name: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_REMOVEOBJECT, "CMmPacketContextMesshandlerList::RemoveObject;Context Name=%S", iContextInfoArray[i].iContextName );
-                    // Release Proxy id
-                    iProxyIdList[j].iIsFree = ETrue;
-                    // Get index to last reserved cell in the list
-                    const TInt lastContext( iNumberOfCreatedContexts - 1 );
-                    // If not already last object
-                    if ( i < lastContext )
-                        {
-                        // Replace object to be remove by last object
-                        iContextInfoArray[i].iContextId =
-                            iContextInfoArray[lastContext].iContextId;
-                        iContextInfoArray[i].iChannelId =
-                            iContextInfoArray[lastContext].iChannelId;
-                        iContextInfoArray[i].iContextName =
-                            iContextInfoArray[lastContext].iContextName;
-                        iContextInfoArray[i].iHostContextName =
-                           iContextInfoArray[lastContext].iHostContextName;
-                        iContextInfoArray[i].iPipeStatus =
-                           iContextInfoArray[lastContext].iPipeStatus;
-                        iContextInfoArray[i].iPipeHandle =
-                           iContextInfoArray[lastContext].iPipeHandle;
-                        iContextInfoArray[i].iCreateContextIdTransId =
-                           iContextInfoArray[lastContext].iCreateContextIdTransId;
-                        iContextInfoArray[i].iPipeCreateTransId =
-                           iContextInfoArray[lastContext].iPipeCreateTransId;
-                        iContextInfoArray[i].iContextType =
-                           iContextInfoArray[lastContext].iContextType;
-                        iContextInfoArray[i].iInitialiseStarted =
-                           iContextInfoArray[lastContext].iInitialiseStarted;
-                        iContextInfoArray[i].iContextConfigurationType =
-                            iContextInfoArray[lastContext].iContextConfigurationType;
-                        iContextInfoArray[i].iActivationTraId =
-                            iContextInfoArray[lastContext].iActivationTraId;
-                        iContextInfoArray[i].iPipeResetTraId =
-                            iContextInfoArray[lastContext].iPipeResetTraId;
-                        iContextInfoArray[i].iDeleteTraId =
-                            iContextInfoArray[lastContext].iDeleteTraId;
-                        }
-                    // no else
 
-                    // Reset object information of the last object
-                    iContextInfoArray[lastContext].iChannelId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iContextName.Zero();
-                    iContextInfoArray[lastContext].iContextId = GPDS_CID_VOID;
-                    iContextInfoArray[lastContext].iHostContextName.Zero();
-                    iContextInfoArray[lastContext].iPipeStatus =
-                       PN_PIPE_DISABLE;
-                    iContextInfoArray[lastContext].iPipeHandle =
-                       KInvalidPipeHandle;
-                    iContextInfoArray[lastContext].iCreateContextIdTransId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iPipeCreateTransId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iContextType =
-                        GPDS_CONT_TYPE_NORMAL;
-                    iContextInfoArray[lastContext].iInitialiseStarted = EFalse;
-                    iContextInfoArray[lastContext].iContextConfigurationType =
-                        KTIntNotDefined;
-                    iContextInfoArray[lastContext].iActivationTraId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iPipeResetTraId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iDeleteTraId =
-                        KTUint8NotDefined;
-
-                    // Decrease number of created contexts
-                    iNumberOfCreatedContexts--;
-
-                    // Proxy id found, break
-                    j = KMmMaxNumberOfContexts;
-                    }
-                // no else
-                }
-            // aContext found, break
-            i = iNumberOfCreatedContexts;
+            // Reset object information
+            InitializeContextInfoList( i );
+            i = KMmMaxNumberOfContexts;
+            iNumberOfCreatedContexts--;
             }
         // no else
         }
@@ -364,38 +261,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMmPacketContextMesshandlerList::GenerateNewContextNameAndProxyId
-// Generates new proxy id.
-// -----------------------------------------------------------------------------
-//
-TInt CMmPacketContextMesshandlerList::GenerateProxyId(
-    TUint8& aProxyId )
-    {
-
-    TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::GenerateProxyId");
-OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_GENERATEPROXYID, "CMmPacketContextMesshandlerList::GenerateProxyId" );
-
-    TInt ret( KErrOverflow );
-
-    // Find first free proxy id from the list
-    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
-        {
-        if ( iProxyIdList[i].iIsFree )
-            {
-            aProxyId = iProxyIdList[i].iChannelId;
-
-            // Proxy id selected, set ret to KErrNone
-            ret = KErrNone;
-            // Free proxy id found, break
-            i = KMmMaxNumberOfContexts;
-            }
-        // no else
-        }
-
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
 // CMmPacketContextMesshandlerList::SetContextId
 // Sets context id to the context info list.
 // -----------------------------------------------------------------------------
@@ -410,13 +275,12 @@
 
     TInt ret( KErrNotFound );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find object from the list
         if ( aTransactionId == iContextInfoArray[i].iCreateContextIdTransId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetContextId. ContextName: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetContextId. ContextName: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETCONTEXTID, "CMmPacketContextMesshandlerList::SetContextId;ContextName=%S", iContextInfoArray[i].iContextName );
             // Set context id to the context info list
             iContextInfoArray[i].iContextId = aContextId;
@@ -444,18 +308,18 @@
 
     TInt ret( KErrArgument );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find object from the list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetContextNameByContextId. ContextName: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetContextNameByContextId. ContextName: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTNAMEBYCONTEXTID, "CMmPacketContextMesshandlerList::GetContextNameByContextId;ContextName=%S", iContextInfoArray[i].iContextName );
             // Set context name to aName
             aContextName = iContextInfoArray[i].iContextName;
             // Context id found, return KErrNone
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -478,12 +342,11 @@
     TUint8 pipeHandle( KInvalidPipeHandle );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::PipeHandleByContextName, PipeHandle: %d", iContextInfoArray[i].iPipeHandle );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::PipeHandleByContextName, PipeHandle: %d", iContextInfoArray[i].iPipeHandle );
 OstTrace1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PIPEHANDLEBYCONTEXTNAME, "CMmPacketContextMesshandlerList::PipeHandleByContextName;PipeHandle=%d", iContextInfoArray[i].iPipeHandle );
             // Return object from the context info list
             pipeHandle = iContextInfoArray[i].iPipeHandle;
@@ -509,12 +372,11 @@
     TUint8 proxyId( KTUint8NotDefined );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ProxyIdByContextName, ProxyId: %d", iContextInfoArray[i].iChannelId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ProxyIdByContextName, ProxyId: %d", iContextInfoArray[i].iChannelId );
 OstTrace1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PROXYIDBYCONTEXTNAME, "CMmPacketContextMesshandlerList::ProxyIdByContextName;ProxyId=%d", iContextInfoArray[i].iChannelId );
 
             proxyId = iContextInfoArray[i].iChannelId;
@@ -534,14 +396,14 @@
 
     TUint8 proxyId( KTUint8NotDefined );
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-            TFLOGSTRING3("TSY CMmPacketContextMesshandlerList::ProxyIdByPipeHandle found 0x%x for pipehandle 0x%x", proxyId, aPipeHandle );
-            OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PROXYIDBYPIPEHANDLE, "CMmPacketContextMesshandlerList::ProxyIdByPipeHandle;proxyId=%hhx;aPipeHandle=%hhx", proxyId, aPipeHandle );
+TFLOGSTRING3("TSY CMmPacketContextMesshandlerList::ProxyIdByPipeHandle found 0x%x for pipehandle 0x%x", proxyId, aPipeHandle );
+OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PROXYIDBYPIPEHANDLE, "CMmPacketContextMesshandlerList::ProxyIdByPipeHandle;proxyId=%hhx;aPipeHandle=%hhx", proxyId, aPipeHandle );
             proxyId = iContextInfoArray[i].iChannelId;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -561,7 +423,7 @@
     OstTraceExt1( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_OPENCHANNEL, "CMmPacketContextMesshandlerList::OpenChannel;aChannelId=%hhu", aChannelId );
     TInt ret( KErrNotReady );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++)
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++)
         {
         if ( aChannelId == iContextInfoArray[i].iChannelId )
             {
@@ -580,7 +442,7 @@
                 {
                 ret = KErrAlreadyExists;
                 }
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         }
 
@@ -598,7 +460,7 @@
     OstTraceExt1( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_CLOSECHANNEL, "CMmPacketContextMesshandlerList::CloseChannel;aChannelId=%hhu", aChannelId );
     TInt ret( KErrNotFound );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aChannelId == iContextInfoArray[i].iChannelId )
             {
@@ -606,7 +468,7 @@
             iContextInfoArray[i].iIscApi.Close();
             ret = KErrNone;
             iContextInfoArray[i].iChannelOpened = EFalse;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         }
 
@@ -628,18 +490,17 @@
 
     TInt ret( KErrArgument );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aProxyId == iContextInfoArray[i].iChannelId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextNameByProxyId. ContextName: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextNameByProxyId. ContextName: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CONTEXTNAMEBYPROXYID, "CMmPacketContextMesshandlerList::ContextNameByProxyId;ContextName=%S", iContextInfoArray[i].iContextName );
             // Set context name to aName
             aContextName = iContextInfoArray[i].iContextName;
             // Context id found, return KErrNone
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -661,7 +522,7 @@
     TUint8 ret( GPDS_CONT_TYPE_NORMAL );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
@@ -672,9 +533,7 @@
                  ret = GPDS_CONT_TYPE_SEC;
                 }
             // no else
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextTypeByName. ContextName: %S, ContextType: %d", &iContextInfoArray[i].iContextName, ret );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextTypeByName. ContextName: %S, ContextType: %d", &iContextInfoArray[i].iContextName, ret );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTTYPEBYNAME, "CMmPacketContextMesshandlerList::GetContextTypeByName;ContextName=%S;ContextType=%hhu", iContextInfoArray[i].iContextName, ret );
             }
         // no else
@@ -699,18 +558,16 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetCreateContextIdTransId. ContextName: %S, IdTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetCreateContextIdTransId. ContextName: %S, IdTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETCREATECONTEXTIDTRANSID, "CMmPacketContextMesshandlerList::SetCreateContextIdTransId;ContextName=%S;aTransactionId=%d", iContextInfoArray[i].iContextName, aTransactionId );
             // Return object from the context info list
             iContextInfoArray[i].iCreateContextIdTransId = aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -734,18 +591,16 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeCreateTransId. ContextName: %S, CreateTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeCreateTransId. ContextName: %S, CreateTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETPIPECREATETRANSID, "CMmPacketContextMesshandlerList::SetPipeCreateTransId;ContextName=%S;aTransactionId=%hhu", iContextInfoArray[i].iContextName, aTransactionId );
             // Return object from the context info list
             iContextInfoArray[i].iPipeCreateTransId = aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -769,18 +624,17 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetGpdsLlConfigureTraId. ContextName: %S, L1ConfigureTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetGpdsLlConfigureTraId. ContextName: %S, L1ConfigureTransId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETGPDSLLCONFIGURETRAID, "CMmPacketContextMesshandlerList::SetGpdsLlConfigureTraId;ContextName=%S;aTransactionId=%hhu", iContextInfoArray[i].iContextName, aTransactionId );
 
             // Return object from the context info list
             iContextInfoArray[i].iGpdsLlConfigureTraId = aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -804,18 +658,17 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetRemovePipeTraId. ContextName: %S, RemovePipeTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetRemovePipeTraId. ContextName: %S, RemovePipeTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP2_CMMPACKETCONTEXTMESSHANDLERLIST_SETREMOVEPIPETRAID, "CMmPacketContextMesshandlerList::SetRemovePipeTraId;ContextName=%S;aTransactionId=%hhu", iContextInfoArray[i].iContextName, aTransactionId );
 
             // Return object from the context info list
             iContextInfoArray[i].iRemovePipeTraId = aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -839,18 +692,17 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetActivationTraId. ContextName: %S, ActivationTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetActivationTraId. ContextName: %S, ActivationTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETACTIVATIONTRAID, "CMmPacketContextMesshandlerList::SetActivationTraId;ContextName=%S;aTransactionId=%hhu", iContextInfoArray[i].iContextName, aTransactionId );
 
             // Return object from the context info list
             iContextInfoArray[i].iActivationTraId = aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -873,7 +725,7 @@
 
     TUint8 transId( KTUint8NotDefined );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
@@ -881,8 +733,7 @@
             transId = iContextInfoArray[i].iActivationTraId;
             iContextInfoArray[i].iActivationTraId = KTUint8NotDefined;
 
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetAndResetActivationTraId. ContextName: %S, ActivationTraId: %d", &iContextInfoArray[i].iContextName, transId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetAndResetActivationTraId. ContextName: %S, ActivationTraId: %d", &iContextInfoArray[i].iContextName, transId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETANDRESETACTIVATIONTRAID, "CMmPacketContextMesshandlerList::GetAndResetActivationTraId;ContextName=%S;transId=%hhu", iContextInfoArray[i].iContextName, transId );
             }
         // no else
@@ -907,18 +758,16 @@
     TInt ret( KErrNotFound );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetDeletionTraId. ContextName: %S, DeleteTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetDeletionTraId. ContextName: %S, DeleteTraId: %d", &iContextInfoArray[i].iContextName, aTransactionId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETDELETIONTRAID, "CMmPacketContextMesshandlerList::SetDeletionTraId;ContextName=%S;aTransactionId=%hhu", iContextInfoArray[i].iContextName, aTransactionId );
             // Return object from the context info list
             iContextInfoArray[i].iDeleteTraId= aTransactionId;
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -941,7 +790,7 @@
 
     TUint8 transId( KTUint8NotDefined );
 
-     for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+     for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
@@ -949,8 +798,7 @@
             transId = iContextInfoArray[i].iDeleteTraId;
             iContextInfoArray[i].iDeleteTraId = KTUint8NotDefined;
 
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetAndResetActivationTraId. ContextName: %S, DeleteTraId: %d", &iContextInfoArray[i].iContextName, transId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetAndResetActivationTraId. ContextName: %S, DeleteTraId: %d", &iContextInfoArray[i].iContextName, transId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETANDRESETDELETIONTRAID, "CMmPacketContextMesshandlerList::GetAndResetDeletionTraId;ContextName=%s;transId=%hhu", iContextInfoArray[i].iContextName, transId );
             }
         // no else
@@ -974,15 +822,13 @@
     TUint8 transId( KTUint8NotDefined );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
             // Return object from the context info list
             transId = iContextInfoArray[i].iCreateContextIdTransId;
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::CreateContextIdTransIdByPipeHandle. ContextName: %S, CreateContextIdTransId: %d", &iContextInfoArray[i].iContextName, transId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::CreateContextIdTransIdByPipeHandle. ContextName: %S, CreateContextIdTransId: %d", &iContextInfoArray[i].iContextName, transId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CREATECONTEXTIDTRANSIDBYPIPEHANDLE, "CMmPacketContextMesshandlerList::CreateContextIdTransIdByPipeHandle;ContextName=%S;transId=%hhu", iContextInfoArray[i].iContextName, transId );
             }
         // no else
@@ -1007,15 +853,14 @@
     TUint8 transId( KTUint8NotDefined );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
             // Return object from the context info list
             transId = iContextInfoArray[i].iCreateContextIdTransId;
 
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::CreateContextIdTraIdByContextId. ContextName: %S, CreateContextIdTransId: %d", &iContextInfoArray[i].iContextName, transId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::CreateContextIdTraIdByContextId. ContextName: %S, CreateContextIdTransId: %d", &iContextInfoArray[i].iContextName, transId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CREATECONTEXTIDTRAIDBYCONTEXTID, "CMmPacketContextMesshandlerList::CreateContextIdTraIdByContextId;ContextName=%S;transId=%hhu", iContextInfoArray[i].iContextName, transId );
             }
         // no else
@@ -1040,15 +885,13 @@
     TUint8 pipeHandle( KInvalidPipeHandle );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
             // Return object from the context info list
             pipeHandle = iContextInfoArray[i].iPipeHandle;
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::PipeHandleByContextId. ContextName: %S, PipeHandle: %d", &iContextInfoArray[i].iContextName, pipeHandle );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::PipeHandleByContextId. ContextName: %S, PipeHandle: %d", &iContextInfoArray[i].iContextName, pipeHandle );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PIPEHANDLEBYCONTEXTID, "CMmPacketContextMesshandlerList::PipeHandleByContextId;ContextName=%S;pipeHandle=%hhu", iContextInfoArray[i].iContextName, pipeHandle );
             }
         // no else
@@ -1073,14 +916,12 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aTransId == iContextInfoArray[i].iPipeCreateTransId )
             {
-
-            TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::PipeCreateTransIdOkByTransId. TransId Matched");
+TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::PipeCreateTransIdOkByTransId. TransId Matched");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PIPECREATETRANSIDOKBYTRANSID, "CMmPacketContextMesshandlerList::PipeCreateTransIdOkByTransId, TransId Matched" );
-
             ret = KErrNone;
             }
         // no else
@@ -1104,14 +945,12 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aTransId == iContextInfoArray[i].iCreateContextIdTransId )
             {
-
-            TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::CreateContextIdTraIdOK. TransId Matched");
+TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::CreateContextIdTraIdOK. TransId Matched");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CREATECONTEXTIDTRAIDOK, "CMmPacketContextMesshandlerList::CreateContextIdTraIdOK, TransId Matched" );
-
             ret = KErrNone;
             }
         // no else
@@ -1135,16 +974,14 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aTransId == iContextInfoArray[i].iGpdsLlConfigureTraId )
             {
-
-            TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::GpdsLlConfigureTraIdOK. TransId Matched");
+TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::GpdsLlConfigureTraIdOK. TransId Matched");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GPDSLLCONFIGURETRAIDOK, "CMmPacketContextMesshandlerList::GpdsLlConfigureTraIdOK, TransId Matched" );
-
             ret = KErrNone;
-            i= iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -1168,14 +1005,12 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aTransactionId == iContextInfoArray[i].iPipeCreateTransId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeHandle. ContextName: %S, PipeHandle: %d", &iContextInfoArray[i].iContextName, aPipeHandle );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeHandle. ContextName: %S, PipeHandle: %d", &iContextInfoArray[i].iContextName, aPipeHandle );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETPIPEHANDLE, "CMmPacketContextMesshandlerList::SetPipeHandle;ContextName=%S;aPipeHandle=%hhu", iContextInfoArray[i].iContextName, aPipeHandle );
-
             iContextInfoArray[i].iPipeHandle = aPipeHandle;
             ret = KErrNone;
             }
@@ -1201,14 +1036,12 @@
     TBool ret( EFalse );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeStatus. ContextName: %S, PipeStatus: %d", &iContextInfoArray[i].iContextName, aPipeStatus );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeStatus. ContextName: %S, PipeStatus: %d", &iContextInfoArray[i].iContextName, aPipeStatus );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETPIPESTATUS, "CMmPacketContextMesshandlerList::SetPipeStatus;ContextName=%S;aPipeStatus=%d", iContextInfoArray[i].iContextName, aPipeStatus );
-
             iContextInfoArray[i].iPipeStatus = aPipeStatus ;
             ret = ETrue;
             }
@@ -1233,14 +1066,12 @@
     TInt pipeStatus( PN_PIPE_DISABLE );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
             pipeStatus = iContextInfoArray[i].iPipeStatus;
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetPipeStatus. ContextName: %S, PipeStatus: %d", &iContextInfoArray[i].iContextName, pipeStatus );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetPipeStatus. ContextName: %S, PipeStatus: %d", &iContextInfoArray[i].iContextName, pipeStatus );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETPIPESTATUS, "CMmPacketContextMesshandlerList::GetPipeStatus;ContextName=%S;pipeStatus=%d", iContextInfoArray[i].iContextName, pipeStatus );
             }
         // no else
@@ -1264,12 +1095,11 @@
     TUint contextId( GPDS_CID_VOID );
 
     // Find name from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextIdByContextName. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iContextId );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextIdByContextName. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iContextId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTIDBYCONTEXTNAME, "CMmPacketContextMesshandlerList::GetContextIdByContextName;ContextName=%S;contextId=%d", iContextInfoArray[i].iContextName, iContextInfoArray[i].iContextId );
 
             // Name found, return object
@@ -1297,13 +1127,11 @@
     hostName.Zero();
 
     // Find name from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetHostCidName. ContextName: %S, HostContextName: %S", &iContextInfoArray[i].iContextName, &iContextInfoArray[i].iHostContextName );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetHostCidName. ContextName: %S, HostContextName: %S", &iContextInfoArray[i].iContextName, &iContextInfoArray[i].iHostContextName );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETHOSTCIDNAME, "CMmPacketContextMesshandlerList::GetHostCidName;ContextName=%S;HostContextName=%S", iContextInfoArray[i].iContextName, iContextInfoArray[i].iHostContextName );
             // Name found
             hostName.Copy( iContextInfoArray[i].iHostContextName );
@@ -1329,17 +1157,15 @@
     TInt ret( KErrNotFound );
 
     // Find name from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::RemoveContextId. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::RemoveContextId. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_REMOVECONTEXTID, "CMmPacketContextMesshandlerList::RemoveContextId;ContextName=%S;aContextId=%hhu", iContextInfoArray[i].iContextName, aContextId );
             // Name found
             iContextInfoArray[i].iContextId = GPDS_CID_VOID;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             ret = KErrNone;
             }
         // no else
@@ -1350,8 +1176,7 @@
         {
         if( aContextId == iDialUpContextId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveContextId. Dial-Up Context, ContextId: %d", aContextId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveContextId. Dial-Up Context, ContextId: %d", aContextId );
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPACKETCONTEXTMESSHANDLERLIST_REMOVECONTEXTID, "CMmPacketContextMesshandlerList::RemoveContextId;Dial-Up Context, ContextId=%hhu", aContextId );
             iDialUpContextId = GPDS_CID_VOID;
             iDialUpContextName.Zero();
@@ -1361,8 +1186,7 @@
 
         if( aContextId == iSecondaryDialUpContextId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveContextId. Secondary Dial-Up Context, ContextId: %d", aContextId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveContextId. Secondary Dial-Up Context, ContextId: %d", aContextId );
 OstTraceExt1( TRACE_NORMAL, DUP3_CMMPACKETCONTEXTMESSHANDLERLIST_REMOVECONTEXTID, "CMmPacketContextMesshandlerList::RemoveContextId;Secondary Dial-Up Context, ContextId=%hhu", aContextId );
             iSecondaryDialUpContextId = GPDS_CID_VOID;
             iSecondaryDialUpContextName.Zero();
@@ -1390,18 +1214,17 @@
     TInt ret( KErrNotFound );
 
     // Find name from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ResetPipeHandleAndStatus. ContextName: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ResetPipeHandleAndStatus. ContextName: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_RESETPIPEHANDLEANDSTATUS, "CMmPacketContextMesshandlerList::ResetPipeHandleAndStatus;ContextName=%S", iContextInfoArray[i].iContextName );
 
             // Pipe found
             iContextInfoArray[i].iPipeHandle = KInvalidPipeHandle;
             iContextInfoArray[i].iPipeStatus = PN_PIPE_DISABLE;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             ret = KErrNone;
             }
         // no else
@@ -1426,13 +1249,11 @@
     TBool ret( EFalse );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetInitialiseMember. ContextName: %S, InitialiseStarted: %d", &iContextInfoArray[i].iContextName, aFlag );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetInitialiseMember. ContextName: %S, InitialiseStarted: %d", &iContextInfoArray[i].iContextName, aFlag );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETINITIALISEMEMBER, "CMmPacketContextMesshandlerList::SetInitialiseMember;ContextName=%S;aFlag=%hhu", iContextInfoArray[i].iContextName, aFlag );
             // Return object from the context info list
             iContextInfoArray[i].iInitialiseStarted = aFlag;
@@ -1459,14 +1280,12 @@
     TBool ret( EFalse );
 
     // Find name from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetInitialiseMember. ContextName: %S, InitialiseStarted: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iInitialiseStarted );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetInitialiseMember. ContextName: %S, InitialiseStarted: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iInitialiseStarted );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETINITIALISEMEMBER, "CMmPacketContextMesshandlerList::GetInitialiseMember;ContextName=%S;InitialiseStarted=%hhu", iContextInfoArray[i].iContextName, iContextInfoArray[i].iInitialiseStarted );
-
             ret = iContextInfoArray[i].iInitialiseStarted;
             }
         // no else
@@ -1490,12 +1309,11 @@
     TUint8 contextId( GPDS_CID_VOID );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aPipeHandle == iContextInfoArray[i].iPipeHandle )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextIdByPipeHandle. ContextId: %d", iContextInfoArray[i].iContextId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextIdByPipeHandle. ContextId: %d", iContextInfoArray[i].iContextId );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CONTEXTIDBYPIPEHANDLE, "CMmPacketContextMesshandlerList::ContextIdByPipeHandle;ContextId=%hhu", iContextInfoArray[i].iContextId );
 
             // Return object from the context info list
@@ -1524,12 +1342,11 @@
     TBool ret( EFalse );
 
      // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetContextConfigurationType. ContextName: %S, ConfigType: %d", &iContextInfoArray[i].iContextName, aConfigType );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetContextConfigurationType. ContextName: %S, ConfigType: %d", &iContextInfoArray[i].iContextName, aConfigType );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETCONTEXTCONFIGURATIONTYPE, "CMmPacketContextMesshandlerList::SetContextConfigurationType;ContextName=%S;aConfigType=%d", iContextInfoArray[i].iContextName, aConfigType );
 
             // Return object from the context info list
@@ -1557,15 +1374,13 @@
     TInt ret( KTIntNotDefined );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
             // Return object from the context info list
             ret = iContextInfoArray[i].iContextConfigurationType;
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextConfigurationType. ContextName: %S, ConfigType: %d", &iContextInfoArray[i].iContextName, ret );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetContextConfigurationType. ContextName: %S, ConfigType: %d", &iContextInfoArray[i].iContextName, ret );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTCONFIGURATIONTYPE, "CMmPacketContextMesshandlerList::GetContextConfigurationType;ContextName=%S;ret=%d", iContextInfoArray[i].iContextName, ret );
             }
         // no else
@@ -1592,20 +1407,16 @@
     TInt ret( KErrArgument );
 
      // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SaveConfig. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SaveConfig. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
 OstTraceExt2( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_SAVECONFIG, "CMmPacketContextMesshandlerList::SaveConfig;ContextName=%S;aContextId=%hhu", iContextInfoArray[i].iContextName, aContextId );
             // Return object from the context info list
             if( TPacketDataConfigBase::KConfigGPRS == aConfigurationType )
                 {
-
-                TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SaveConfig. ConfigType: %d", aConfigurationType );
-
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SaveConfig. ConfigType: %d", aConfigurationType );
 OstTrace1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SAVECONFIG, "CMmPacketContextMesshandlerList::SaveConfig;aConfigurationType=%d", aConfigurationType );
                 iContextInfoArray[i].iConfig = *aConfig;
                 iContextInfoArray[i].iContextConfigurationType =
@@ -1616,9 +1427,7 @@
             else if( TPacketDataConfigBase::KConfigRel99Rel4 ==
                 aConfigurationType )
                 {
-
-                TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SaveConfig. ConfigType: %d", aConfigurationType );
-
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SaveConfig. ConfigType: %d", aConfigurationType );
 OstTrace1( TRACE_NORMAL, DUP2_CMMPACKETCONTEXTMESSHANDLERLIST_SAVECONFIG, "CMmPacketContextMesshandlerList::SaveConfig;aConfigurationType=%d", aConfigurationType );
                 iContextInfoArray[i].iConfig99 =
                     *aConfig99;
@@ -1628,7 +1437,7 @@
                 }
             // no else
 
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -1653,30 +1462,24 @@
     config = NULL;
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetConfig. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetConfig. ContextName: %S, ContextId: %d", &iContextInfoArray[i].iContextName, aContextId );
 OstTraceExt2( TRACE_NORMAL, DUP3_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONFIG, "CMmPacketContextMesshandlerList::GetConfig;ContextName=%S;aContextId=%hhu", iContextInfoArray[i].iContextName, aContextId );
             // Return object from the context info list
             if( TPacketDataConfigBase::KConfigGPRS == aConfigurationType )
                 {
-
-                TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetConfig. ConfigType: %d", aConfigurationType );
-
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetConfig. ConfigType: %d", aConfigurationType );
 OstTrace1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONFIG, "CMmPacketContextMesshandlerList::GetConfig;aConfigurationType=%d", aConfigurationType );
                 // Return object from the context info list
                 config = &( iContextInfoArray[i].iConfig );
                 }
-
             else if( TPacketDataConfigBase::KConfigRel99Rel4 ==
                 aConfigurationType )
                 {
-
-                TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetConfig. ConfigType: %d", aConfigurationType );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetConfig. ConfigType: %d", aConfigurationType );
 OstTrace1( TRACE_NORMAL, DUP2_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONFIG, "CMmPacketContextMesshandlerList::GetConfig;aConfigurationType=%d", aConfigurationType );
                 // Return object from the context info list
                 config = &( iContextInfoArray[i].iConfig99 );
@@ -1705,17 +1508,15 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeResetTraId. ContextName: %S, PipeResetTraId: %d", &iContextInfoArray[i].iContextName, aTransId );
-
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::SetPipeResetTraId. ContextName: %S, PipeResetTraId: %d", &iContextInfoArray[i].iContextName, aTransId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETPIPERESETTRAID, "CMmPacketContextMesshandlerList::SetPipeResetTraId;ContextName=%S;aTransId=%hhu", iContextInfoArray[i].iContextName, aTransId );
             // Return object from the context info list
             iContextInfoArray[i].iPipeResetTraId = aTransId;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             ret = KErrNone;
             }
         // no else
@@ -1739,16 +1540,14 @@
     TInt ret( KErrNotFound );
 
     // Find context pipehandle from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aTransId == iContextInfoArray[i].iPipeResetTraId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::CheckAndResetPipeResetTraId. ContextName: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::CheckAndResetPipeResetTraId. ContextName: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CHECKANDRESETPIPERESETTRAID, "CMmPacketContextMesshandlerList::CheckAndResetPipeResetTraId;ContextName=%S", iContextInfoArray[i].iContextName );
-
             ret = KErrNone;
-            i = iNumberOfCreatedContexts;
+            i = KMmMaxNumberOfContexts;
             iContextInfoArray[i].iPipeResetTraId = KTUint8NotDefined;
             }
         // no else
@@ -1772,14 +1571,12 @@
     TUint channelId( KTUint8NotDefined );
 
     // Find context proxyId from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::ProxyIdByContextId. ContextName: %S, ChannelId: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iChannelId );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::ProxyIdByContextId. ContextName: %S, ChannelId: %d", &iContextInfoArray[i].iContextName, iContextInfoArray[i].iChannelId );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_PROXYIDBYCONTEXTID, "CMmPacketContextMesshandlerList::ProxyIdByContextId;ContextName=%S;ChannelId=%hhu", iContextInfoArray[i].iContextName, iContextInfoArray[i].iChannelId );
-
             channelId = iContextInfoArray[i].iChannelId;
             }
         // no else
@@ -1827,7 +1624,7 @@
 TUint8 CMmPacketContextMesshandlerList::GetDialUpContextId()
     {
 
-    TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::GetDialUpContextId");
+TFLOGSTRING("TSY: CMmPacketContextMesshandlerList::GetDialUpContextId");
 OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_GETDIALUPCONTEXTID, "CMmPacketContextMesshandlerList::GetDialUpContextId" );
 
     return iDialUpContextId;
@@ -1923,101 +1720,19 @@
 OstTrace0( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_REMOVEOBJECTBYNAME, "CMmPacketContextMesshandlerList::RemoveObjectByName" );
 
     // Set ret to KErrArgument to check that context is in list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( *aContextName == iContextInfoArray[i].iContextName )
             {
-
-            for ( TInt j = 0; j < KMmMaxNumberOfContexts; j++ )
-                {
-
-                if ( ( iContextInfoArray[i].iChannelId ==
-                     iProxyIdList[j].iChannelId ) && ( EFalse ==
-                     iProxyIdList[j].iIsFree ) )
-                    {
-
-                    TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveObjectByName. Context Name: %S", &iContextInfoArray[i].iContextName );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::RemoveObjectByName. Context Name: %S", &iContextInfoArray[i].iContextName );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_REMOVEOBJECTBYNAME, "CMmPacketContextMesshandlerList::RemoveObjectByName;ContextName=%S", iContextInfoArray[i].iContextName );
-                    // Release Proxy id
-                    iProxyIdList[j].iIsFree = ETrue;
-
-                    // Get index to last reserved cell in the list
-                    const TInt lastContext( iNumberOfCreatedContexts - 1 );
-
-                    // If not already last object
-                    if ( i < lastContext )
-                        {
-                        // Replace object to be remove by last object
-                        iContextInfoArray[i].iContextId =
-                            iContextInfoArray[lastContext].iContextId;
-
-                        iContextInfoArray[i].iChannelId =
-                            iContextInfoArray[lastContext].iChannelId;
-
-                        iContextInfoArray[i].iContextName =
-                            iContextInfoArray[lastContext].iContextName;
 
-                        iContextInfoArray[i].iHostContextName =
-                           iContextInfoArray[lastContext].iHostContextName;
-                        iContextInfoArray[i].iPipeStatus =
-                           iContextInfoArray[lastContext].iPipeStatus;
-                        iContextInfoArray[i].iPipeHandle =
-                           iContextInfoArray[lastContext].iPipeHandle;
-                        iContextInfoArray[i].iCreateContextIdTransId =
-                           iContextInfoArray[lastContext].iCreateContextIdTransId;
-                        iContextInfoArray[i].iPipeCreateTransId =
-                           iContextInfoArray[lastContext].iPipeCreateTransId;
-                        iContextInfoArray[i].iContextType =
-                           iContextInfoArray[lastContext].iContextType;
-                        iContextInfoArray[i].iInitialiseStarted =
-                           iContextInfoArray[lastContext].iInitialiseStarted;
-                        iContextInfoArray[i].iContextConfigurationType =
-                            iContextInfoArray[lastContext].iContextConfigurationType;
-                        iContextInfoArray[i].iActivationTraId =
-                            iContextInfoArray[lastContext].iActivationTraId;
-                        iContextInfoArray[i].iPipeResetTraId =
-                            iContextInfoArray[lastContext].iPipeResetTraId;
-                        iContextInfoArray[i].iDeleteTraId =
-                            iContextInfoArray[lastContext].iDeleteTraId;
-                        }
-                    // no else
-
-                    // Reset object information of the last object
-                    iContextInfoArray[lastContext].iChannelId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iContextName.Zero();
-                    iContextInfoArray[lastContext].iContextId = GPDS_CID_VOID;
-                    iContextInfoArray[lastContext].iHostContextName.Zero();
-                    iContextInfoArray[lastContext].iPipeStatus =
-                       PN_PIPE_DISABLE;
-                    iContextInfoArray[lastContext].iPipeHandle =
-                       KInvalidPipeHandle;
-                    iContextInfoArray[lastContext].iCreateContextIdTransId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iPipeCreateTransId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iContextType =
-                        GPDS_CONT_TYPE_NORMAL;
-                    iContextInfoArray[lastContext].iInitialiseStarted = EFalse;
-                    iContextInfoArray[lastContext].iContextConfigurationType =
-                        KTIntNotDefined;
-                    iContextInfoArray[lastContext].iActivationTraId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iPipeResetTraId =
-                        KTUint8NotDefined;
-                    iContextInfoArray[lastContext].iDeleteTraId =
-                        KTUint8NotDefined;
-                    // Decrease number of created contexts
-                    iNumberOfCreatedContexts--;
-                    // Proxy id found, break
-                    j = KMmMaxNumberOfContexts;
-                    }
-                // no else
-                }
-
-            // aContext found, break
-            i = iNumberOfCreatedContexts;
+            // Reset object information
+            InitializeContextInfoList( i );
+            // Decrease number of created contexts
+            iNumberOfCreatedContexts--;
+            i = KMmMaxNumberOfContexts;
             }
         // no else
         }
@@ -2037,15 +1752,13 @@
 
     TInt ret( KErrNotFound );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetDNSAddressInfoToContextInfo. ContextId: %d", aContextId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetDNSAddressInfoToContextInfo. ContextId: %d", aContextId );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETDNSADDRESSINFOTOCONTEXTINFO, "CMmPacketContextMesshandlerList::SetDNSAddressInfoToContextInfo;aContextId=%hhu", aContextId );
-
             iContextInfoArray[i].iAddDNSAddress = ETrue;
             ret = KErrNone;
             }
@@ -2069,15 +1782,13 @@
 
     TBool addDNSAddress( EFalse );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetDNSAddressInfoToContextInfo. ContextId: %d, AddDNSAddress: %d", aContextId, iContextInfoArray[i].iAddDNSAddress );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetDNSAddressInfoToContextInfo. ContextId: %d, AddDNSAddress: %d", aContextId, iContextInfoArray[i].iAddDNSAddress );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETDNSADDRESSINFOTOCONTEXTINFO, "CMmPacketContextMesshandlerList::GetDNSAddressInfoToContextInfo;aContextId=%hhu;AddDNSAddress=%hhu", aContextId, iContextInfoArray[i].iAddDNSAddress );
-
             addDNSAddress = iContextInfoArray[i].iAddDNSAddress;
             }
         // no else
@@ -2100,15 +1811,13 @@
 
     TInt ret( KErrNotFound );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetPCSCFAddressInfoToContextInfo. ContextId: %d", aContextId );
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::SetPCSCFAddressInfoToContextInfo. ContextId: %d", aContextId );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_SETPCSCFADDRESSINFOTOCONTEXTINFO, "CMmPacketContextMesshandlerList::SetPCSCFAddressInfoToContextInfo;aContextId=%hhu", aContextId );
-
             iContextInfoArray[i].iAddPCSCFAddress = ETrue;
             ret = KErrNone;
             }
@@ -2132,15 +1841,13 @@
 
     TBool addPCSCFAddress( EFalse );
 
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         // Find aContext from context info list
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
-
-            TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetPCSCFAddressInfoToContextInfo. ContextId: %d, AddPCSCFAddress: %d", aContextId, iContextInfoArray[i].iAddPCSCFAddress );
+TFLOGSTRING3("TSY: CMmPacketContextMesshandlerList::GetPCSCFAddressInfoToContextInfo. ContextId: %d, AddPCSCFAddress: %d", aContextId, iContextInfoArray[i].iAddPCSCFAddress );
 OstTraceExt2( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETPCSCFADDRESSINFOTOCONTEXTINFO, "CMmPacketContextMesshandlerList::GetPCSCFAddressInfoToContextInfo;aContextId=%hhu;AddPCSCFAddress=%hhu", aContextId, iContextInfoArray[i].iAddPCSCFAddress );
-
             addPCSCFAddress = iContextInfoArray[i].iAddPCSCFAddress;
             }
         // no else
@@ -2163,18 +1870,15 @@
 
     TUint8 contextId( GPDS_CID_VOID );
 
-    if ( aListIndex < iNumberOfCreatedContexts )
+    if ( aListIndex < KMmMaxNumberOfContexts )
         {
         // Return context id from the context info list
         contextId = iContextInfoArray[aListIndex].iContextId;
-
-        TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextIdByListIndex. ContextId: %d", contextId );
-
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::ContextIdByListIndex. ContextId: %d", contextId );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_CONTEXTIDBYLISTINDEX, "CMmPacketContextMesshandlerList::ContextIdByListIndex;contextId=%hhu", contextId );
         }
     // no else
 
-    // Valid values to return are, 0x00, 0x01, 0xFF = GPDS_CID_VOID
     return contextId;
     }
 
@@ -2193,7 +1897,7 @@
     TUint8 ret( GPDS_CONT_TYPE_NORMAL );
 
     // Find context id from context info list
-    for ( TInt i = 0; i < iNumberOfCreatedContexts; i++ )
+    for ( TInt i = 0; i < KMmMaxNumberOfContexts; i++ )
         {
         if ( aContextId == iContextInfoArray[i].iContextId )
             {
@@ -2203,9 +1907,7 @@
                  ret = GPDS_CONT_TYPE_SEC;
                 }
             // no else
-
-            TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetContextTypeById, ContextType: %d", ret );
-
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::GetContextTypeById, ContextType: %d", ret );
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTTYPEBYID, "CMmPacketContextMesshandlerList::GetContextTypeById;ContextType=%hhu", ret );
             }
         // no else
@@ -2214,6 +1916,39 @@
     return ret;
     }
 
+// -----------------------------------------------------------------------------
+// CMmPacketContextMesshandlerList::InitializeContextInfoList
+// This function initializes context info
+// -----------------------------------------------------------------------------
+//
+void CMmPacketContextMesshandlerList::InitializeContextInfoList(
+    const TUint8 aContextId )
+    {
+
+TFLOGSTRING2("TSY: CMmPacketContextMesshandlerList::InitializeContextInfoList, ContextId: %d", aContextId );
+//OstTraceExt1( TRACE_NORMAL, CMMPACKETCONTEXTMESSHANDLERLIST_GETCONTEXTTYPEBYID, "CMmPacketContextMesshandlerList::GetContextTypeById;aContextId=%hhu", aContextId );
+
+
+    iContextInfoArray[aContextId].iContextId = GPDS_CID_VOID;
+
+    iContextInfoArray[aContextId].iChannelId = KDefinedProxyIds[aContextId];
+
+    iContextInfoArray[aContextId].iContextName.Zero();
+    iContextInfoArray[aContextId].iHostContextName.Zero();
+    iContextInfoArray[aContextId].iPipeStatus = PN_PIPE_DISABLE;
+    iContextInfoArray[aContextId].iPipeHandle = KInvalidPipeHandle;
+    iContextInfoArray[aContextId].iCreateContextIdTransId = KTUint8NotDefined;
+    iContextInfoArray[aContextId].iPipeCreateTransId = KTUint8NotDefined;
+    iContextInfoArray[aContextId].iContextType = GPDS_CONT_TYPE_NORMAL ;
+    iContextInfoArray[aContextId].iInitialiseStarted = EFalse;
+    iContextInfoArray[aContextId].iContextConfigurationType = KTIntNotDefined;
+    iContextInfoArray[aContextId].iActivationTraId = KTUint8NotDefined;
+    iContextInfoArray[aContextId].iPipeResetTraId = KTUint8NotDefined;
+    iContextInfoArray[aContextId].iDeleteTraId = KTUint8NotDefined;
+    iContextInfoArray[aContextId].iChannelOpened = EFalse;
+
+    }
+
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
     //None
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -8,9 +8,9 @@
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-* 
+*
 * Contributors:
-* 
+*
 * Description:
 *
 */
@@ -22,8 +22,9 @@
 #include <pn_const.h>
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "cmmmessagerouter.h"
+#include "cmmphonebookstoreoperationbase.h"
 #include "cmmphonebookoperationcache.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookoperationcachetraces.h"
 #endif
@@ -35,6 +36,10 @@
     // None
 
 // CONSTANTS
+const TUint8 KEFBasicLength   = 14;
+
+// Extension length is 22 (11 bytes having 2 digits/byte)
+const TUint8 KEFExtensionLength   = 22;
 
 // MACROS
     // None
@@ -116,7 +121,7 @@
         aMmPhoneBookStoreMessHandler;
 
     mmPhoneBookOperationCache->iMmUiccMessHandler = aUiccMessHandler;
-    
+
     return mmPhoneBookOperationCache;
     }
 
@@ -137,6 +142,10 @@
 
     TInt ret( KErrNotSupported );
 
+    // Transaction ID is saved to separate EMmTsyONStoreGetInfoIPC handling
+    // from other PB handling. Also it can be used for any separation purpose.
+    iSavedIPC = aIpc;
+
     switch( aIpc )
         {
         case EMmTsyPhoneBookStoreGetInfoIPC:
@@ -145,8 +154,30 @@
             iNumOfUsedVMBXEntries = 0;
             break;
             }
+        case EMmTsyONStoreGetInfoIPC:
+            {
+            iFileId = PB_MSISDN_FID;
+            iExtFileId = PB_EXT1_FID;
+            iArrayIndex = EPhonebookTypeMSISDN;
+
+            TInt recordId( 0 );
+            iEXTNumberLen = 0;
+            iTypeOfReading = EFileInfoRead;
+            aDataPackage->UnPackData( recordId );
+            ret = UiccReadApplFileInfo( PB_MSISDN_FID,
+                                        recordId,
+                                        aTransId );
+            break;
+            }
         case EMmTsyPhoneBookStoreCacheIPC:
             {
+            // Convert Phone Book name to file id
+            iExtFileId = UICC_ILLEGAL_FILE_ID;
+            iFileId = ConvertToPBfileId( iPhoneBookTypeName, 
+                                         iExtFileId,  
+                                         iMmUiccMessHandler->GetCardType());
+            iArrayIndex = ConvertToConfArrayIndex( iFileId );
+
             const CPhoneBookDataPackage* phoneBookData(
                 static_cast<const CPhoneBookDataPackage*>( aDataPackage ) );
 
@@ -172,7 +203,7 @@
             {
             // Nothing to do here
 TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::CreateReq - Unknown IPC: %d", aIpc);
-OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_UICCCREATEREQ, "CMmPhoneBookOperationCache::UiccCreateReq; Unknown IPC =%hd", aIpc );
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_UICCCREATEREQ, "CMmPhoneBookOperationCache::UICCCreateReq;Unknown aIpc=%d", aIpc );
             break;
             }
         }//switch-case
@@ -209,14 +240,10 @@
         }
 
 
-    if( !iCancelOperation )
+    if ( ( !iCancelOperation ) &&
+         ( EMmTsyONStoreGetInfoIPC != iSavedIPC ) )
         {
-        // Convert Phone Book name to file id
-        TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-        TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt,  iMmUiccMessHandler->GetCardType());
-        TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
-        
-        switch(pbFileId)
+        switch(iFileId)
             {
             case PB_ADN_FID:
             case PB_FDN_FID:
@@ -225,7 +252,7 @@
                 // Start Caching for ADN Phone Book
                 if(!iExtensionToRead)
                     {
-                    // Check for UICC_SERVER_OK 
+                    // Check for UICC_SERVER_OK
                     if( UICC_STATUS_OK == aStatus)
                         {
                         iStoreEntry = new ( ELeave ) TPBEntry();
@@ -234,69 +261,68 @@
 
                         // check if Entry is valid Entry or Empty Entry
                         TInt retval = EmptyEntryCheck(aFileData);
-                        
+
                         // if Entry is not empty
                         if( KErrNone == retval)
                             {
-                            // Update Entry Status 
+                            // Update Entry Status
                             iStoreEntry->iEntryPresent = ETrue;
                             // Seperate Entry data form UICC Server response message
                             // Case: <Data available to be filled into array>
                             iMmPhoneBookStoreMessHandler->
-                            iPBStoreConf[pbArrayIndex].
-                            GetPBEntryFromUICCData( 
+                            iPBStoreConf[iArrayIndex].
+                            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 
+                            // Length + 14 , minus 1 is for Array index Calculation
                             //(it starts from 0)
                             if ( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
-                                         iPBStoreConf[pbArrayIndex].
+                                         iPBStoreConf[iArrayIndex].
                                          iAlphaStringlength + 13]  )
                                 {
                                 // Append Entry to list
                                 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
                                               iStoreEntry,
-                                              pbArrayIndex );
+                                              iArrayIndex );
 
                                 // the there is no extension data
                                 CPhoneBookStoreEntry* phoneBookStoreMsg =
                                 new( ELeave ) CPhoneBookStoreEntry;
                                 CleanupStack::PushL( phoneBookStoreMsg );
                                 phoneBookStoreMsg->ConstructL();
-                                
+
                                 iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
                                     iNameBuf,
                                     iNumberBuf,
                                     *phoneBookStoreMsg,
-                                    pbFileId,
-                                    iIndexToRead,
-                                    EFalse );
+                                    iFileId,
+                                    iIndexToRead );
                                 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 );
-                                
+OstTraceExt1( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL; - Append entries into array iNumOfEntriesFilled=%hhu", 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[pbArrayIndex].
+                                               iPBStoreConf[iArrayIndex].
                                                iAlphaStringlength + 13];
-                                
+
                                 // Append EXT record no.
                                 iStoreEntry->PBEntryExtRecord.Append( recordNo );
 
                                 retExt = USimPbReqRead( recordNo, aTransId );
-                                // if while reading EXT error comes 
+                                // if while reading EXT error comes
                                 //(for invalid Entry)than read next entry
                                 if(( KErrNone != retExt ))
                                     {
@@ -308,10 +334,10 @@
                             {
                             //Update Entry Status
                             iStoreEntry->iEntryPresent = EFalse;
-                            // Reset Entry andd Append to the List 
+                            // Reset Entry andd Append to the List
                             iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
                                  iStoreEntry,
-                                 pbArrayIndex );
+                                 iArrayIndex );
                             }
 
                         // to read next record
@@ -324,7 +350,7 @@
                     if( UICC_STATUS_OK == aStatus )
                         {
                         // Check for next extension data record
-                        if(0xFF != aFileData[UICC_EXT_REC_NO_OFFSET])    
+                        if(0xFF != aFileData[UICC_EXT_REC_NO_OFFSET])
                             {
                             // Again Append the EXT no to Array
                             iStoreEntry->PBEntryExtRecord.Append(
@@ -332,9 +358,9 @@
 
                             // 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( 
+                            // 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)
                                 {
@@ -346,38 +372,37 @@
                             // Append Entry to list and reset all the EXT data
                             iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
                                                           iStoreEntry,
-                                                          pbArrayIndex );
+                                                          iArrayIndex );
                             // Reset Extension File record
                             iExtensionToRead = EFalse;
-                            
-                            // Check for Extended Data is Addition number 
+
+                            // 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 );
+                                                              iFileId,
+                                                              iIndexToRead );
                                 TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
-                                iPhoneBookStoreCacheArray->AppendL( 
+                                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 );
+OstTraceExt1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL; - Append entries into array iNumOfEntriesFilled=%hhu", iNumOfEntriesFilled );
                                 } // end for checking Data type in EXT
                             } // end for Entry store
                         }
@@ -396,20 +421,20 @@
                 break;
                 }
             } // End of switch case
-        
+
         // Check for next location be read when its not for EXT Data
-        
-        if( ( !iExtensionToRead ) &&( iIndexToRead <= 
-              iMmPhoneBookStoreMessHandler->iPBStoreConf[pbArrayIndex].iNoOfRecords ) )
+
+        if( ( !iExtensionToRead ) &&( iIndexToRead <=
+              iMmPhoneBookStoreMessHandler->iPBStoreConf[iArrayIndex].iNoOfRecords ) )
             {
             // Send request to read next Entry
             USimPbReqRead( iIndexToRead, aTransId );
             }
 
         // Complete IPC if error is there OR all Entries are read
-        if( ((KErrNone != ret) || 
+        if( ((KErrNone != ret) ||
              ( iIndexToRead > iMmPhoneBookStoreMessHandler->
-                              iPBStoreConf[pbArrayIndex].iNoOfRecords )) 
+                              iPBStoreConf[iArrayIndex].iNoOfRecords ))
              && ( !iExtensionToRead ))
             {
             // Check if any entries are filled in commonTSY Array
@@ -431,6 +456,14 @@
             complete = ETrue;
             }
         }
+    else if ( EMmTsyONStoreGetInfoIPC == iSavedIPC )
+        {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::HandleUICCPbRespL: Handle EMmTsyONStoreGetInfoIPC");
+OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationCache::HandleUICCPbRespL: Handle EMmTsyONStoreGetInfoIPC" );
+        complete = HandleUiccReadApplFileInfoResp( aTransId,
+                                                   aStatus,
+                                                   aFileData );
+        }
     else
         { // Operation has been canceled
         complete = ETrue;
@@ -461,26 +494,21 @@
     TInt appFileID ( APPL_FILE_ID );   // Application File id for DFphonebook
 
     TUiccReadLinearFixed cmdParams;
-    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+    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);
-    
+
     if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
         {
         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, iMmUiccMessHandler->GetCardType() );
-    TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
 
-    switch( pbFileId )
+    switch( iFileId )
         {
         case PB_ADN_FID:
         case PB_FDN_FID:
@@ -490,21 +518,21 @@
             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 
+                // Check for the record Number to be
                 //read is valid record number
                 if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
-                        iPBStoreConf[pbArrayIndex].iNoOfRecords)
+                        iPBStoreConf[iArrayIndex].iNoOfRecords)
                     {
-                    // Start from first location and Search for First Valid 
+                    // 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 
+                    // then Read From Sim and Check the Staus its Free
                     // or not till end of the records
-                    
-                    cmdParams.fileId = pbFileId;
+
+                    cmdParams.fileId = iFileId;
                     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
                     cmdParams.record = aRecordNo;
                     // till End of Record
@@ -522,14 +550,14 @@
                 // Send Request to Read Extension Data
                 // Check for UST Table supports for EXT File
                 if( iMmPhoneBookStoreMessHandler->
-                        iPBStoreConf[pbArrayIndex].iExtension )
+                        iPBStoreConf[iArrayIndex].iExtension )
                     {
                     // Check for Extension data record in valid
                     if(iMmPhoneBookStoreMessHandler->
-                            iPBStoreConf[pbArrayIndex].iExtNoOfRec >= aRecordNo)
+                            iPBStoreConf[iArrayIndex].iExtNoOfRec >= aRecordNo)
                         {
                         // Read Request to read that index
-                        cmdParams.fileId = fileIdExt;
+                        cmdParams.fileId = iExtFileId;
                         cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
                         cmdParams.record = aRecordNo;
                         // till End of Record
@@ -551,19 +579,19 @@
             }
         default:
             {
-TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead - PhoenBook Not supported");
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead - PhoneBook 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 );
+OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead;returns ret=%d", ret );
         }
     return ret;
     }
@@ -586,4 +614,318 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::UiccReadApplFileInfo
+// Read application file info
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationCache::UiccReadApplFileInfo(
+    const TInt aFileId,
+    const TInt aRecordId,
+    const TUint8 aTrId )
+    {
+TFLOGSTRING3("TSY: CMmPhoneBookOperationCache::UiccReadApplFileInfo, aTraId: %d, aRecordId: %d", aTrId, aRecordId );
+OstTraceExt2( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_UICCREADAPPLFILEINFO, "CMmPhoneBookOperationCache::UiccReadApplFileInfo;aFileId=%d;aRecordId=%d", aFileId, aRecordId );
+
+    TInt ret( KErrNone );
+
+    iRecordId = aRecordId;
+
+    // Check wheter MSIDN is supported at all
+    ret = CheckMSISDNSupport();
+
+    if ( KErrNone == ret )
+        {
+        // Set parameters for UICC_APPL_CMD_REQ message
+        TUiccReadLinearFixed params;
+        params.messHandlerPtr  = static_cast<MUiccOperationBase*>
+                                   ( iMmPhoneBookStoreMessHandler );
+        params.trId = static_cast<TUiccTrId> ( aTrId );
+        params.dataOffset = 0;
+        params.dataAmount = 0;
+        params.record = iRecordId;
+
+        params.fileId = aFileId;
+        params.fileIdSfi = UICC_SFI_NOT_PRESENT;
+        params.serviceType = UICC_APPL_FILE_INFO;
+
+        // File id path
+        params.filePath.Append( KMasterFileId >> 8 );
+        params.filePath.Append( KMasterFileId );
+        params.filePath.Append( APPL_FILE_ID>>8);
+        params.filePath.Append( APPL_FILE_ID);
+
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+            CreateUiccApplCmdReq( params );
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::UiccReadApplFileInfo MSISDN is not activated on SIM" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_UICCREADAPPLFILEINFO, "CMmPhoneBookOperationCache::UiccReadApplFileInfo MSISDN is not activated on SIM" );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp
+// Read application file info
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp(
+      TInt aTransId,
+      TInt aStatus,
+      const TDesC8 &aFileData )
+    {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp, aStatus: %d", aStatus );
+OstTrace1( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCREADAPPLFILEINFORESP, "CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp;aStatus=%d", aStatus );
+
+    TInt ret( KErrNone );
+    TBool completed( EFalse );
+
+    CMmDataPackage numberData;
+
+    if ( ( UICC_STATUS_OK != aStatus ) || ( 0 == aFileData.Length() ) )
+        {
+        // Complete response with the array of ON entries with ret
+        // Pack the data for sending to the manager
+        ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
+        TInt numofEntry( -1 );
+        numberData.PackData( &numofEntry );
+        CompleteThisIPC( EMmTsyONStoreGetInfoIPC, &numberData, ret );
+        completed = ETrue;
+        }
+    else
+        {
+        switch ( iTypeOfReading )
+            {
+            case EFileInfoRead:
+                {
+                TFci fci( aFileData );
+                // Number of entries and name length can be fetched here.
+                // Number length and number of used entries will be updated
+                // during next sequences.
+                iServiceType.iNumOfEntries = fci.GetNumberOfRecords();
+                iServiceType.iNameLen = fci.GetRecordLength() - KEFBasicLength;
+
+                iTypeOfReading = EBasicEfRead;
+
+                // Start from the 1st record
+                iRecordId = KStartRecord;
+
+                UiccReadApplFileData(
+                    PB_MSISDN_FID,
+                    iRecordId,
+                    aTransId );
+                break;
+                }
+
+            case EBasicEfRead:
+                {
+                // 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 +
+                // basic EF length minus 1 is for Array index Calculation
+                // (it starts from 0)
+
+                iServiceType.iNumLen = UICC_NO_EXT_MAX_NUM_LEN;
+                TInt fileId( iExtFileId );
+                iRecordId = 
+                    aFileData[iServiceType.iNameLen + KEFBasicLength - 1];
+                if ( 0xFF == iRecordId )
+                    {
+                    iServiceType.iNumLen =
+                        UICC_NO_EXT_MAX_NUM_LEN;
+
+                    // No extension. Continue with file count reading.
+                    iTypeOfReading = EBasicEfReadToGetUsedFileCount;
+
+                    // EFSMS file id is used for file count reading.
+                    fileId = iFileId;
+
+                    // Start from the 1st record
+                    iRecordId = KStartRecord;
+                    }
+                else
+                    {
+                    iTypeOfReading = EExtensionRead;
+                    }
+
+                UiccReadApplFileData(
+                    fileId,
+                    iRecordId,
+                    aTransId );
+                break;
+                }
+
+            case EExtensionRead:
+                {
+                // If current record number is the same as the next record
+                // number in the extension file complete the whole session
+                // with cause KErrArgument.
+                if ( iRecordId ==
+                         aFileData[UICC_EXT_REC_NO_OFFSET] )
+                    {
+                    TInt numofEntry( -1 );
+                    numberData.PackData( &numofEntry );
+                    CompleteThisIPC( EMmTsyONStoreGetInfoIPC,
+                                     &numberData,
+                                     KErrCorrupt );
+                    completed = ETrue;
+                    }
+                else
+                    {
+                    iServiceType.iNumLen += KEFExtensionLength;
+                    iRecordId = aFileData[UICC_EXT_REC_NO_OFFSET];
+
+                    // In case of ICC EXT1 is used, but in UICC case it is EXT5
+                    TInt fileId( iExtFileId );
+                    if ( 0xFF == iRecordId )
+                        {
+                        // The last record found. Check count of used entires
+                        iTypeOfReading = EBasicEfReadToGetUsedFileCount;
+                        // EFMSISDN file id is used for file count reading.
+                        fileId = PB_MSISDN_FID;
+                        // Start from the 1st record
+                        iRecordId = 1;
+                        }
+                    else
+                        {
+                        iTypeOfReading = EExtensionRead;
+                        }
+
+                    UiccReadApplFileData(
+                        fileId,
+                        iRecordId,
+                        aTransId );
+                    }
+                break;
+                }
+
+            case EBasicEfReadToGetUsedFileCount:
+                {
+                TInt retval( EmptyEntryCheck( aFileData ) );
+                if ( KErrNone == retval )
+                    {
+                    iServiceType.iUsedEntries++;
+                    }
+                // No else, because used entries counter is increased only when
+                // there is data in the record.
+                iRecordId++;
+                if ( iRecordId > iServiceType.iNumOfEntries )
+                    {
+                    numberData.PackData( &iServiceType );
+                    CompleteThisIPC( EMmTsyONStoreGetInfoIPC,
+                                     &numberData,
+                                     ret );
+                    completed = ETrue;
+                    }
+                else
+                    {
+                    UiccReadApplFileData(
+                        PB_MSISDN_FID,
+                        iRecordId,
+                        aTransId );
+                    }
+                break;
+                }
+
+            default:
+                {
+TFLOGSTRING2("TSY: CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp - Unknown iTypeOfReading: %d", iTypeOfReading);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_HANDLEUICCREADAPPLFILEINFORESP, "CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp;Unknown iTypeOfReading=%hhu", iTypeOfReading );
+                completed = ETrue;
+                break;
+                }
+            }
+        }
+    return completed;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::HandleUiccReadApplFileInfoResp
+// Read application file info
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationCache::CheckMSISDNSupport
+    (
+    // None
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CheckMSISDNSupport" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_CHECKMSISDNSUPPORT, "CMmPhoneBookOperationCache::CheckMSISDNSupport" );
+
+    TInt ret( KErrNotSupported );
+
+    if ( iMmUiccMessHandler->GetServiceStatus( UICC_MSISDN_SERVICE_NUM ) )
+       {
+       ret = KErrNone;
+       }
+    // No else
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::CompleteThisIPC
+// Read application file info
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationCache::CompleteThisIPC
+    (
+    TInt aIPCToBeCompleted,
+    CMmDataPackage* aDataPackage,
+    TInt ret
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationCache::CompleteThisIPC" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_CHECKMSISDNSUPPORT, "CMmPhoneBookOperationCache::CheckMSISDNSupport" );
+
+    iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+        aIPCToBeCompleted,
+        aDataPackage,
+        ret );
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache::UiccReadApplFileData
+// Read application file info
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationCache::UiccReadApplFileData(
+    const TInt aFileId,
+    const TInt aRecordId,
+    const TUint8 aTrId )
+    {
+TFLOGSTRING3("TSY: CMmPhoneBookOperationCache::UiccReadApplFileData, aTraId: %d, aRecordId: %d", aTrId, aRecordId );
+OstTraceExt2( TRACE_NORMAL, CMMPHONEBOOKOPERATIONCACHE_UICCREADAPPLFILEDATA, "CMmPhoneBookOperationCache::UiccReadApplFileData;aTrId=%d;aRecordId=%d", aTrId, aRecordId );
+
+    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>( aTrId );
+    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    cmdParams.record = aRecordId;
+    cmdParams.fileId = aFileId;
+    cmdParams.dataAmount = 0;
+    cmdParams.dataOffset = 0;
+
+    ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
+
+    return ret;
+    }
+
 // End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -23,7 +23,7 @@
 #include "tsylogger.h"
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationdelete.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookoperationdeletetraces.h"
 #endif
@@ -141,7 +141,10 @@
     iIpc = aIpc;
     iTransId = aTransId;
     // Convert phone book name to file id
-    iFileId = ConvertToPBfileId( iPhoneBookTypeName, iFileIdExt, iMmUiccMessHandler->GetCardType() );
+    iFileId = ConvertToPBfileId(
+        iPhoneBookTypeName,
+        iFileIdExt,
+        iMmUiccMessHandler->GetCardType() );
     // Find location from internal array
     iArrayIndex = ConvertToConfArrayIndex( iFileId );
 
@@ -151,6 +154,7 @@
     switch( aIpc )
         {
         case EMmTsyPhoneBookStoreDeleteIPC:
+        case EMmTsyONStoreDeleteIPC:
             {
             phoneBookData->UnPackData( iIndex );
 
@@ -158,7 +162,7 @@
                 {
                 // Store MBI Profile
                 iMBIProfileType = iIndex;
-                // For MBDN PhoneBook first read MBI file 
+                // For MBDN PhoneBook first read MBI file
                 // Check if the mailbox inidcation type is correct
                 if( iIndex < iMmPhoneBookStoreMessHandler->
                         iPBStoreConf[iArrayIndex].iMbiRecLen )
@@ -179,6 +183,7 @@
             break;
             }
         case EMmTsyPhoneBookStoreDeleteAllIPC:
+        case EMmTsyONStoreDeleteAllIPC:
             {
             if( PB_MBDN_FID != iFileId)
                 {
@@ -197,7 +202,7 @@
                 // For first Profile Type Read
                 iMBIProfileType = 0;
                 iIndex = iMBIProfileType;
-                // For MBDN PhoneBook first read MBI file 
+                // For MBDN PhoneBook first read MBI file
                 // Check if the mailbox inidcation type is correct
                 if( iMBIProfileType < iMmPhoneBookStoreMessHandler->
                         iPBStoreConf[iArrayIndex].iMbiRecLen )
@@ -211,15 +216,8 @@
                     ret = KErrArgument;
                     }
                 }
-                
             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);
@@ -249,10 +247,12 @@
         case PB_FDN_FID:
         case PB_MBDN_FID:
         case PB_VMBX_FID:
+        case PB_MSISDN_FID:
             {
             // Check if the location to be deleted is valid
-            if( iIndex <= iMmPhoneBookStoreMessHandler->
-                iPBStoreConf[iArrayIndex].iNoOfRecords )
+            if( ( iIndex <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].iNoOfRecords ) &&
+                ( 0 < iIndex ) )
                 {
                 // Check if entry can be found in list
                 if( iMmPhoneBookStoreMessHandler->IndexCheckInPBList(
@@ -316,7 +316,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() )
+    if( ( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() ) &&
+        ( PB_MSISDN_FID != iFileId ) )
         {
         cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
         cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
@@ -375,7 +376,7 @@
     TBuf8<KExtensionDataBytes>extFileData;
     extFileData.Append( 0x00 ); // Type of record ( 0x00 == unknown )
     // Rest of data is set by 'FF'
-    extFileData.AppendFill( 0xFF, ( KExtensionDataBytes - 1 ) ); 
+    extFileData.AppendFill( 0xFF, ( KExtensionDataBytes - 1 ) );
     cmdParams.fileData.Append( extFileData );
 
     return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
@@ -405,12 +406,12 @@
         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 );
     }
@@ -418,23 +419,23 @@
 
 // ---------------------------------------------------------------------------
 // CMmPhoneBookOperationDelete::UiccPbReqReadMBI
-// Constructs an ISI-message to Read MBI profile from first record 
+// 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*> 
+        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 ));
@@ -447,8 +448,8 @@
         cmdParams.dataAmount = 1;
         cmdParams.dataOffset = iMBIProfileType;
         cmdParams.record = 1;   // only first profile number is supported
-        
-        
+
+
         if( KErrNone == ret )
             {
             ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
@@ -469,9 +470,9 @@
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_UICCPBREQDELETEMBIPROFILE, "CMmPhoneBookOperationDelete::UiccPBReqDeleteMBIProfile" );
 
     TInt ret ( KErrNone );
-    
+
     TUiccWriteLinearFixed cmdParams;
-    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
+    cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*>
                                ( iMmPhoneBookStoreMessHandler );
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
@@ -491,8 +492,8 @@
 
     // Append FileData needs to be write
     cmdParams.fileData.Append( 0 );
-    
-    
+
+
     if( KErrNone == ret )
         {
         ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
@@ -500,7 +501,7 @@
         }
 
     return ret;
-    
+
     }
 
 // ---------------------------------------------------------------------------
@@ -543,6 +544,128 @@
     }
 
 
+
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::HandleDeleteEntryResp
+// Handles phonebook Entry Delete
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::HandleDeleteEntryResp(
+    TBool &aComplete,
+    TInt &aLocation )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleDeleteEntryResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEDELETEENTRYRESP, "CMmPhoneBookOperationDelete::HandleDeleteEntryResp" );
+
+    TInt ret ( KErrNone );
+
+    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
+            aComplete = ETrue;
+        if ( EMmTsyPhoneBookStoreDeleteAllIPC == iIpc &&
+            iNumOfEntries )
+            {
+            // Continue deleting entries
+            iIndex = iNumOfEntries;
+            ret = UiccPbReqDelete();
+            iNumOfEntries--;
+            }
+        else
+            {
+            // Ready for complete
+            aComplete = ETrue;
+            // In case of delete all location is 0
+            if ( EMmTsyPhoneBookStoreDeleteIPC == iIpc )
+                {
+                aLocation = iIndex;
+                }
+            }
+        }
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationDelete::HandleReadExtResp
+// Handles phonebook Ext data Read
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationDelete::HandleDeleteExtResp()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleDeleteExtResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEDELETEEXTRESP, "CMmPhoneBookOperationDelete::HandleDeleteExtResp" );
+
+    TInt ret ( KErrNone );
+
+    // 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();
+            }
+        }
+
+    return ret;
+    }
+
 // ---------------------------------------------------------------------------
 // CMmPhoneBookOperationDelete::UiccPbReqDeleteExt
 // Constructs an ISI-message to delete extension record
@@ -620,18 +743,18 @@
 
 // ---------------------------------------------------------------------------
 // TBool CMmPhoneBookOperationDelete::HandleWriteMBIReadResp
-// Handle write response for MBI profile read
+// Handle response for MBI profile read
 // ---------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationDelete::HandleWriteMBIReadResp(
+TInt CMmPhoneBookOperationDelete::HandleMBIReadResp(
         TInt aStatus,
         TUint8 aDetails,
         TBool &aComplete,
-        const TDesC8 &aFileData ) 
+        const TDesC8 &aFileData )
     {
     TInt ret ( KErrNone );
-TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleWriteMBIReadResp");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEWRITEMBIREADRESP, "CMmPhoneBookOperationDelete::HandleWriteMBIReadResp" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationDelete::HandleMBIReadResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONDELETE_HANDLEMBIREADRESP, "CMmPhoneBookOperationDelete::HandleMBIReadResp" );
 
     if( UICC_STATUS_OK  == aStatus )
         {
@@ -714,99 +837,17 @@
                 }
             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();
-                        }
-                    }
+                ret = HandleDeleteExtResp();
                 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;
-                    if ( EMmTsyPhoneBookStoreDeleteAllIPC == iIpc &&
-                        iNumOfEntries )
-                        {
-                        // Continue deleting entries
-                        iIndex = iNumOfEntries;
-                        ret = UiccPbReqDelete();
-                        iNumOfEntries--;
-                        }
-                    else
-                        {
-                        // Ready for complete
-                        complete = ETrue;
-                        // In case of delete all location is 0
-                        if ( EMmTsyPhoneBookStoreDeleteIPC == iIpc )
-                            {
-                            location = iIndex;
-                            }
-                        }
-                    }
+                ret = HandleDeleteEntryResp( complete, location );
                 break;
                 }
             case EPBDeletePhase_Read_MBI_profile:
                 {
-                ret = HandleWriteMBIReadResp( aStatus, aDetails, complete, aFileData );
+                ret = HandleMBIReadResp( aStatus, aDetails, complete, aFileData );
                 break;
                 }
             case EPBDeletePhase_delete_MBI_profile:
@@ -827,7 +868,7 @@
                     // Continue deleting entries
                     // increment iMBIProfileType to read next profile
                     iMBIProfileType++;
-                    
+
                     if ( EMmTsyPhoneBookStoreDeleteAllIPC == iIpc &&
                         ( iMBIProfileType < iMmPhoneBookStoreMessHandler->
                                 iPBStoreConf[iArrayIndex].iMbiRecLen ) )
@@ -874,9 +915,18 @@
     if ( complete )
         {
         TPBEntryInfo pbEntryInfo;
-        pbEntryInfo.iMaxNumLength = iMmPhoneBookStoreMessHandler->
-        iPBStoreConf[iArrayIndex].iNumlength;
-        pbEntryInfo.iLocation = location;
+        pbEntryInfo.iLocation = 0;
+        pbEntryInfo.iMaxNumLength = 0;
+
+        if( KErrNone == ret )
+            {
+            pbEntryInfo.iMaxNumLength = iMmPhoneBookStoreMessHandler->
+            iPBStoreConf[iArrayIndex].iNumlength;
+            if( iIpc == EMmTsyPhoneBookStoreDeleteIPC )
+                {
+                pbEntryInfo.iLocation = location;
+                }
+            }
 
         CPhoneBookDataPackage phoneBookData;
         phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -156,18 +156,6 @@
     iServiceType = 0;
     iNumOfPBRRecords = 0;
     iADNPbInitilized = EFalse;
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
-        INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is ON.");
-
-    iMmPhoneBookStoreMessHandler->SetMaxNumOfAasEntries( 0 );
-    iMmPhoneBookStoreMessHandler->SetMaxNumberOfGAS( 0 );
-#else
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
-        INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is OFF.");
-OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONINIT_CONSTRUCTL, "CMmPhoneBookOperationInit::ConstructL, CASW_RD_USIM_PHONEBOOK_GAS_AND_AAS is OFF" );
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
     }
 
 
@@ -862,7 +850,7 @@
                             {
                             // Chekc for Extension
                             // Check for EXT1 Service is present or not
-                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT5_SERVICE_NUM ) || ( iTypeOfReading  == EBasicEfRead ))
+                            if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT5_SERVICE_NUM ) )
                                 {
                                 // Store MSISDN Phone book configuration in local array if EXT is not present in UICC Card
                                 TPrimitiveInitInfo primConfMsisdn;
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -85,7 +85,6 @@
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit3G_adn" );
-
     }
 
 // -----------------------------------------------------------------------------
@@ -162,17 +161,6 @@
     iIniPhase = 0;
     iServiceType = 0;
     iNumOfPBRRecords = 0;
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
-        INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is ON.");
-
-    iMmPhoneBookStoreMessHandler->SetMaxNumOfAasEntries( 0 );
-    iMmPhoneBookStoreMessHandler->SetMaxNumberOfGAS( 0 );
-#else
-    TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
-        INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is OFF.");
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
     }
 
 
@@ -266,7 +254,7 @@
 
             cmdParams.fileId = PB_PBR_FID;
             cmdParams.serviceType = iServiceType;
-            cmdParams.record = 0;
+            cmdParams.record = KStartRecord;
             break;
             }
         case EPBInitPhase_3GADN_Type1:
@@ -317,7 +305,7 @@
 //
 TInt CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile(
     TUiccReadLinearFixed & aparams,
-    const TUint8 aFileType)
+    const TUint8 aFileType )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile" );
@@ -398,7 +386,7 @@
         iInternalInit = EFalse;
         complete = ETrue;
         return KErrNone;
-        }
+        }  // no else
 
     switch(iIniPhase)
         {
@@ -441,7 +429,7 @@
          if ( UICC_STATUS_OK != aStatus )
              {
              ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
-             }
+             }  // no else
 
          iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
                  EMmTsyPhoneBookStoreInitIPC,
@@ -449,7 +437,7 @@
                  ret );
 
          complete = ETrue;
-         }
+         }  // no else
     return complete;
     }
 
@@ -482,6 +470,10 @@
                     {
                     TFci fci( aFileData );
                     iNumOfPBRRecords = fci.GetNumberOfRecords();
+                    // Store PBR record no in internal conf list
+                    iMmPhoneBookStoreMessHandler->
+                              iPBStoreConf[EPhonebookTypeAdn].
+                                    iPBRNoOfRecords = iNumOfPBRRecords;
 
                     ret = KErrNone;
                     iServiceType = UICC_APPL_READ_LINEAR_FIXED;
@@ -517,12 +509,12 @@
 
                     iServiceType = UICC_APPL_FILE_INFO;
                     iIniPhase = EPBInitPhase_3GADN_Type1;
-                    }
+                    }  // no else ...
                 }
             else
                 {
                 iADNPbInitilized = EFalse;
-                GetNextPhoneBookInitPhase(iIniPhase);
+                GetNextPhoneBookInitPhase( iIniPhase );
                 }
             break;
             }
@@ -571,7 +563,7 @@
             // Call Create request for next phase
             ret = UICCInitializeReq3GADN( aTransId );
             }
-        }
+        }  // no else
 
     return ret;
     }
@@ -606,8 +598,8 @@
         if( UICC_EF_ADN_TAG != tagValue )
             {
             ret = CheckForNoOfRecords( noOfRecords );
-            }
-        }
+            }  // no else
+        }  // no else
 
     if( iCurrentArrayCounter < iType1FileArray.Count() )
         {
@@ -646,7 +638,7 @@
                     {
                     // Check for if No of records for this File is same as ADN
                     // phonebook no of records
-                    if(KErrNone == ret)
+                    if( KErrNone == ret )
                         {
                         // Check for fixed size record length
                         ret = CheckRecordSizeForFixedLength(
@@ -670,8 +662,8 @@
                             iMmPhoneBookStoreMessHandler->
                                 iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords
                                 = iPBStoreInfoData->iANRNumOfEntries;
-                            }
-                        }
+                            } // no else
+                        }  // no else
                     break;
                     }
                 case UICC_EF_EMAIL_TAG:
@@ -698,7 +690,7 @@
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength =
                                 iPBStoreInfoData->iEmailTextLengthMax;
-                        }
+                        }  // no else
                     break;
                     }
 
@@ -709,7 +701,7 @@
                         // get the record record no from file info data
                         iPBStoreInfoData->iGRPNumOfEntriesPerEntry =
                             noOfRecords;
-                        }
+                        }  // no else
                     break;
                     }
                 case UICC_EF_IAP_TAG:
@@ -718,14 +710,14 @@
                     if( iType2FileArray.Count()== 0 )
                         {
                         ret = KErrGeneral;
-                        }
+                        }  // no else
                     if( KErrNone == ret )
                         {
                         // Store IAP record record length in internal buffer
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iIAPRecordLength =
                                 recordLength;
-                        }
+                        } // no else
                     break;
                     }
                 case UICC_EF_PBC_TAG:
@@ -740,10 +732,9 @@
                             // remove this entry from Array
                             iType1FileArray[iCurrentArrayCounter].tagFID = 0x00;
                             iType1FileArray[iCurrentArrayCounter].tagSFI = 0x00;
-                            iType1FileArray[iCurrentArrayCounter].tagValue =
-                                0x00;
-                            }
-                        }
+                            iType1FileArray[iCurrentArrayCounter].tagValue = 0x00;
+                            }  // no else
+                        }  // no else
                     break;
                     }
                 case UICC_EF_SNE_TAG:
@@ -764,7 +755,7 @@
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
                                 iPBStoreInfoData->iSNETextLengthMax;
-                        }
+                        }  // no else
                     break;
                     }
                 case UICC_EF_UID_TAG:
@@ -781,7 +772,7 @@
             // iType1FileArray
             if( KErrNone != ret )
                 {
-                iType1FileArray.Remove(iCurrentArrayCounter);
+                iType1FileArray.Remove( iCurrentArrayCounter );
                 }
             else
                 {
@@ -798,7 +789,7 @@
                 // parameters
                 iIniPhase = EPBIniPhase_3GADNDone;
                 return;
-                }
+                }  // no else
             iCurrentArrayCounter++;
             }
 
@@ -809,7 +800,9 @@
 
             // Change Phase to read other Files
             if( 0 != iType2FileArray.Count() )
+                {
                 iIniPhase = EPBInitPhase_3GADN_Type2;
+                }
 
             else if( 0 != iType3FileArray.Count() )
                 {
@@ -819,7 +812,7 @@
                 {
                 iIniPhase = EPBIniPhase_3GADNDone;
                 }
-            }
+            }  // no else
         } // End of Type 1 file array handling
     }
 
@@ -831,14 +824,14 @@
 //
 void CMmPhoneBookOperationInit3G_adn::HandleType2FileResp(
     const TDesC8 &aFileData,
-    TInt aStatus)
+    TInt aStatus )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType2FileResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE2FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType2FileResp" );
 
     TInt ret(KErrNone);
     TInt recordLength( 0 );
-    TInt noOfRecords(0);
+    TInt noOfRecords( 0 );
 
     if( UICC_STATUS_OK  == aStatus )
         {
@@ -846,7 +839,7 @@
         TFci fci( aFileData );
         recordLength = fci.GetRecordLength();
         noOfRecords = fci.GetNumberOfRecords();
-        }
+        }  // no else
 
     // Get the tag value for current File
     TUint tagValue = iType2FileArray[iCurrentArrayCounter].tagValue;
@@ -855,7 +848,7 @@
         {
         if( UICC_STATUS_OK  == aStatus )
             {
-            switch(tagValue)
+            switch( tagValue )
                 {
                 case UICC_EF_ANR_TAG:
                     {
@@ -863,7 +856,7 @@
                         UICC_TYPE2_FILE,
                         UICC_EF_ANR_TAG,recordLength );
 
-                    if(KErrNone == ret)
+                    if( KErrNone == ret )
                         {
                         // total no of entries in all ANR files
                         iPBStoreInfoData->iANRNumOfEntries =
@@ -880,7 +873,7 @@
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords =
                                 iPBStoreInfoData->iANRNumOfEntries;
-                        }
+                        }  // KErrNone
                     break;
                     }
                 case UICC_EF_EMAIL_TAG:
@@ -901,6 +894,10 @@
                     iMmPhoneBookStoreMessHandler->
                         iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
                             iPBStoreInfoData->iEmailNumOfEntries;
+                    
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength = 
+                            recordLength - 2;
                     break;
                     }
                 case UICC_EF_SNE_TAG:
@@ -919,6 +916,11 @@
                     iMmPhoneBookStoreMessHandler->
                         iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
                             iPBStoreInfoData->iSNENumOfEntries;
+                    
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
+                            iPBStoreInfoData->iSNETextLengthMax;
+                                        
                     break;
                     }
                 default:
@@ -945,11 +947,15 @@
             {
             iCurrentArrayCounter = 0;
             if( 0 != iType3FileArray.Count() )
+                {
                 iIniPhase = EPBInitPhase_3GADN_Type3;
+                }
             else
+                {
                 iIniPhase = EPBIniPhase_3GADNDone;
-            }
-        }
+                }
+            }  // no else
+        }  // no else
     }
 
 
@@ -974,7 +980,7 @@
         TFci fci( aFileData );
         recordLength = fci.GetRecordLength();
         noOfRecords = fci.GetNumberOfRecords();
-        }
+        }  // no else
 
     // Get the tag value for current File
     TUint tagValue ( iType3FileArray[iCurrentArrayCounter].tagValue );
@@ -993,8 +999,8 @@
                     {
                     // Check for Fixed record length
                     ret = CheckRecordSizeForFixedLength(
-                        3,
-                        UICC_EF_EXT1_TAG,recordLength );
+                            UICC_TYPE3_FILE,
+                            UICC_EF_EXT1_TAG,recordLength );
 
                     // check for Error if Length doesn'nt match
                     if( KErrNone == ret )
@@ -1003,15 +1009,15 @@
                         // (remove record type and Identifier 2 bytes)
                         TInt fileLength ( ( recordLength - 2 ) * noOfRecords );
                             iPBStoreInfoData->iADNNumberLengthMax =
-                                UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
+                                UICC_NO_EXT_MAX_NUM_LEN+( 2*fileLength );
 
                         // Check file is not invalid
                         if( UICC_NO_EXT_MAX_NUM_LEN ==
                             iPBStoreInfoData->iANRNumLengthMax )
                             {
                             iPBStoreInfoData->iANRNumLengthMax =
-                                UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
-                            }
+                                UICC_NO_EXT_MAX_NUM_LEN+( 2*fileLength );
+                            }  // no else
 
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iNumlength =
@@ -1019,7 +1025,7 @@
                         iMmPhoneBookStoreMessHandler->
                             iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec =
                                 ( noOfRecords * iNumOfPBRRecords );
-                        }
+                        }  // no else
                     break;
                     }
                 case UICC_EF_GAS_TAG:
@@ -1035,12 +1041,12 @@
                     break;
                     }
                 }
-            }
+            }  // no else
 
         if( KErrNone != ret )
             {
             // remove from teh Array
-            iType3FileArray.Remove(iCurrentArrayCounter);
+            iType3FileArray.Remove( iCurrentArrayCounter );
             }
         else
             {
@@ -1052,8 +1058,8 @@
             {
             iCurrentArrayCounter = 0;
             iIniPhase = EPBIniPhase_3GADNDone;
-            }
-        }
+            }  // no else
+        }  // no else
     }
 
 
@@ -1076,20 +1082,22 @@
     for( TInt j=0; j < iType1FileArray.Count(); j++ )
         {
         // Check for Type 1 files
-        for( TInt i = (j+1); i< (iType1FileArray.Count()-j); i++ )
+        for( TInt i = ( j+1 ); i< ( iType1FileArray.Count()-j ); i++ )
             {
             if( iType1FileArray[i].tagFID == iType1FileArray[j].tagFID )
                 {
                 // Check if it is a ADN EF then it will be a failure case
                 if( iType1FileArray[i].tagValue == UICC_ADN_PRIM_TAG )
-                ret = KErrGeneral;
+                    {
+                    ret = KErrGeneral;
+                    }
                 else
                     {
                     // remove Entry
                     iType1FileArray.Remove(i);
                     iType1FileArray.Remove(j);
                     }
-                }
+                }  // no else
             }
         // Check for Type2 file id's
         for(TInt i=0; i<iType2FileArray.Count(); i++)
@@ -1107,60 +1115,64 @@
                     iType1FileArray.Remove(j);
                     iType2FileArray.Remove(i);
                     }
-                }
+                }  // no else
             }
         // Check for Type 3 File Id's
         for( TInt i=0; i<iType3FileArray.Count(); i++ )
             {
             if( iType3FileArray[i].tagFID == iType1FileArray[j].tagFID )
+                {
                 // Check for ADN file
                 if( iType1FileArray[j].tagValue == UICC_ADN_PRIM_TAG )
+                    {
                     ret = KErrGeneral;
+                    }
                 else
                     {
                     // remove those entries
-                    iType1FileArray.Remove(j);
-                    iType3FileArray.Remove(i);
+                    iType1FileArray.Remove( j );
+                    iType3FileArray.Remove( i );
                     }
-                }
+                }  // no else
             }
+        }
 
-        // Check for Type2 File Id's with all Type2 and Type3 file Id's
-        for( TInt j=0; j< iType2FileArray.Count(); j++ )
+    // Check for Type2 File Id's with all Type2 and Type3 file Id's
+    for( TInt j=0; j< iType2FileArray.Count(); j++ )
+        {
+        // Check for Type 2 files
+        for( TInt i = (j+1); i< ( iType2FileArray.Count()-j ); i++ )
             {
-            // Check for Type 2 files
-            for( TInt i = (j+1); i< ( iType2FileArray.Count()-j ); i++ )
-                {
-                if( iType2FileArray[i].tagFID == iType2FileArray[j].tagFID)
-                    {
-                    iType2FileArray.Remove(j);
-                    iType2FileArray.Remove(i);
-                    }
-                }
-            // Check for Type 3 File Id's
-            for( TInt i=0; i<iType3FileArray.Count(); i++ )
+            if( iType2FileArray[i].tagFID == iType2FileArray[j].tagFID )
                 {
-                if( iType3FileArray[i].tagFID == iType2FileArray[j].tagFID )
-                    {
-                    iType2FileArray.Remove(j);
-                    iType3FileArray.Remove(i);
-                    }
-                }
+                iType2FileArray.Remove( j );
+                iType2FileArray.Remove( i );
+                }  // no else
             }
-
-        //Check for Type3 File Id's with all other Type3 file Id's
-        for( TInt j=0; j< iType3FileArray.Count(); j++ )
+        // Check for Type 3 File Id's
+        for( TInt i=0; i<iType3FileArray.Count(); i++ )
             {
-            // Check for Type 2 files
-            for( TInt i = (j+1); i< (iType3FileArray.Count()-j); i++ )
+            if( iType3FileArray[i].tagFID == iType2FileArray[j].tagFID )
                 {
-                if( iType3FileArray[i].tagFID == iType3FileArray[j].tagFID )
-                    {
-                    iType3FileArray.Remove(j);
-                    iType3FileArray.Remove(i);
-                    }
-                }
+                iType2FileArray.Remove( j  );
+                iType3FileArray.Remove( i );
+                }  // no else
             }
+        }
+
+    //Check for Type3 File Id's with all other Type3 file Id's
+    for( TInt j=0; j< iType3FileArray.Count(); j++ )
+        {
+        // Check for Type 2 files
+        for( TInt i = ( j+1 ); i< ( iType3FileArray.Count()-j ); i++ )
+            {
+            if( iType3FileArray[i].tagFID == iType3FileArray[j].tagFID )
+                {
+                iType3FileArray.Remove( j );
+                iType3FileArray.Remove( i );
+                }  // no else
+            }
+        }
 
     return ret;
     }
@@ -1178,10 +1190,15 @@
 
     TInt ret( KErrNone );
 
-    if( iPBStoreInfoData->iADNNumOfEntries != aNoOfRecord )
+    // get the no of records in one ADN Ef
+    TInt maxNoOfRecInOneAdnEf =  ( ( iMmPhoneBookStoreMessHandler->
+                                      iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords ) /  
+                                 ( iMmPhoneBookStoreMessHandler->
+                                      iPBStoreConf[EPhonebookTypeAdn].iPBRNoOfRecords ) ); 
+    if( maxNoOfRecInOneAdnEf != aNoOfRecord )
         {
         ret = KErrGeneral;
-        }
+        }  // no else
     return ret;
     }
 
@@ -1213,10 +1230,10 @@
                     }
                 else
                     {
-                    iType1FileArray.Remove(i);
-                    iType2FileArray.Remove(j);
+                    iType1FileArray.Remove( i );
+                    iType2FileArray.Remove( j );
                     }
-                }
+                }  // no else
             }
         }
     return ret;
@@ -1253,7 +1270,7 @@
                     if( ( 2== aFileType )&& ( 17!=aRecordLength ) )
                         {
                         ret =KErrNone;
-                        }
+                        }  // no else
                     }
             break;
             }
@@ -1262,7 +1279,7 @@
             if( 2!=aRecordLength )
                 {
                 ret = KErrGeneral;
-                }
+                }  // no else
             break;
             }
         case UICC_EF_UID_TAG:
@@ -1270,7 +1287,7 @@
             if( 2!= aRecordLength )
                 {
                 ret = KErrGeneral;
-                }
+                }  // no else
             break;
             }
         case UICC_EF_EXT1_TAG:
@@ -1278,7 +1295,7 @@
             if( 13 != aRecordLength )
                 {
                 ret = KErrGeneral;
-                }
+                }  // no else
             break;
             }
         }
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -23,7 +23,6 @@
 #include "tsylogger.h"
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationread.h"
-#include "cmmphonebookoperationread3g_adn.h"
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookoperationreadTraces.h"
@@ -70,7 +69,7 @@
     iNumOfEntriesToRead = 0;
     iNumOfEntriesFilled = 0;
     iIndexToRead = 0;
-    iTypeOfReading = EBasicEfRead;
+    iTypeOfReading = EStartRead;
     }
 
 // -----------------------------------------------------------------------------
@@ -97,24 +96,29 @@
     (
     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
     CMmUiccMessHandler* aUiccMessHandler,
-    const CMmDataPackage* aDataPackage // Data
+    const CMmDataPackage* aDataPackage, // Data
+    TInt aIpc
     )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::NewL");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_NEWL, "CMmPhoneBookOperationRead::NewL" );
 
-    TName phonebookTypeName;
-
     CMmPhoneBookOperationRead* mmPhoneBookOperationRead =
         new( ELeave ) CMmPhoneBookOperationRead();
 
-    const CPhoneBookDataPackage* phoneBookData =
-        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+    if( ( EMmTsyONStoreReadSizeIPC != aIpc )&&
+        ( EMmTsyONStoreWriteSizeIPC != aIpc ) )
+        {
+        TName phonebookTypeName;
 
-    phoneBookData->GetPhoneBookName( phonebookTypeName );
-    
-    // Store phoen Book name 
-    mmPhoneBookOperationRead->iPhoneBookTypeName = phonebookTypeName;
+        const CPhoneBookDataPackage* phoneBookData =
+            static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+        phoneBookData->GetPhoneBookName( phonebookTypeName );
+        // Store phoen Book name 
+        mmPhoneBookOperationRead->iPhoneBookTypeName = phonebookTypeName;
+
+        }
     // get the Transaction id for Phone book and operation combination
     mmPhoneBookOperationRead->iLocationSearch = EFalse;
     mmPhoneBookOperationRead->iMmPhoneBookStoreMessHandler =
@@ -164,12 +168,27 @@
 
     iSavedIPCForComplete = aIpc;
     
+    iFileId = ConvertToPBfileId( iPhoneBookTypeName, iExtFileId, iMmUiccMessHandler->GetCardType() );
+    iArrayIndex = ConvertToConfArrayIndex( iFileId );
+    
     switch( aIpc )
         {
-        case EMmTsyPhoneBookStoreReadIPC:
         case EMmTsyONStoreReadIPC:
         case EMmTsyONStoreReadEntryIPC:
             {
+            // For MSISDN PhoneBook
+            iFileId = PB_MSISDN_FID;
+            iExtFileId = PB_EXT1_FID;
+            iArrayIndex = EPhonebookTypeMSISDN;
+            // Unpack index to be read
+            aDataPackage->UnPackData( iIndexToRead );
+            // number of entries to be read for MBDN PhoneBook will always be 1
+            iNumOfEntriesToRead = 1;
+            ret = USimPbReqRead( iIndexToRead, aTransId );
+            break;
+            }
+        case EMmTsyPhoneBookStoreReadIPC:
+            {
             CArrayPtrSeg<CPhoneBookStoreEntry>* prtToReadEntriesArray;
             RMobilePhoneBookStore::TPBIndexAndNumEntries* ptrToIndexAndEntries;
             phoneBookData->UnPackData(
@@ -187,6 +206,12 @@
                 }
             break;
             }
+        case EMmTsyONStoreReadSizeIPC:
+        case EMmTsyONStoreWriteSizeIPC:
+            {
+            ret = USimReadWriteSizeReq( aTransId );
+            break;
+            }
         default:
             {
             // Nothing to do here
@@ -215,10 +240,8 @@
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREQREAD, "CMmPhoneBookOperationRead::USimPbReqRead" );
 
     TInt ret( KErrNone );
-    // get the index to be read from phonebook
-    TInt index( iIndexToRead );
-
     TUiccReadLinearFixed cmdParams;
+    
     cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
                                ( iMmPhoneBookStoreMessHandler );
 
@@ -234,139 +257,75 @@
         }
     
     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, iMmUiccMessHandler->GetCardType() );
-    TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
-    
+
     // get the corect Location to be read from phone book
-    if( PB_MBDN_FID == pbFileId)
+    if( ( PB_MBDN_FID == iFileId ) &&
+        ( EStartRead == iTypeOfReading ) )
         {
-        // 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
-
-        if ( EMailboxIdRead == iTypeOfReading )
+        // Check id MBI file index is valid
+        if( ( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].iMbiRecLen ) &&
+            ( iIndexToRead >= 0 ) )
             {
-            iTypeOfReading = EBasicEfRead;
+            // Send request to read MBI File
+            cmdParams.fileId = PB_MBI_FID;
+            cmdParams.dataAmount = 1;
+            
+            cmdParams.dataOffset = iIndexToRead;
+            cmdParams.record = 1;   // only first profile number is supported
+            
+            // Set TYpe od reading
+            iTypeOfReading = EMailboxIdRead;
             }
         else
             {
-            iTypeOfReading = EMailboxIdRead;
+            ret = KErrArgument;
             }
         }
-
-    // Check for Extension Data is Present or not
-    if ( EBasicEfRead == iTypeOfReading )
+    else
         {
-        cmdParams.fileId = pbFileId;
-        // Check for the record Number to be read is valid record number
-        if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
-                iPBStoreConf[arrayIndex].iNoOfRecords)
+        if( EStartRead == iTypeOfReading )
+            {
+            iTypeOfReading = EBasicEfRead;
+            } // no else
+        // till End of Record
+        cmdParams.dataAmount = 0;
+        // Start from begining of record
+        cmdParams.dataOffset = 0;
+        // Check for Extension Data is Present or not
+        if ( EBasicEfRead == iTypeOfReading )
             {
-            // 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
+            cmdParams.fileId = iFileId;
+            ret = AddParamToReadReq( cmdParams );
+            }// end of if case for checking extension data
+        else if  ( EExtensionRead == iTypeOfReading )
             {
-            // 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 )
+            // Send Request to Read Extension Data
+            // Check for UST Table supports for EXT File
+            if ( ( iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[iArrayIndex].iExtension )&&
+                 ( iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[iArrayIndex].iExtNoOfRec >= aRecordNo ) &&
+                 ( aRecordNo > 0 ) )
                 {
                 // Read Request to read that index
-                cmdParams.fileId = fileIdExt;
-                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                cmdParams.fileId = iExtFileId;
                 cmdParams.record = aRecordNo;
-                // till End of Record
-                cmdParams.dataAmount = 0;
-                // Start from begining of record
-                cmdParams.dataOffset = 0;
                 }
             else
                 {
                 ret = KErrGeneral;
                 }
-            }
-        else
-            {
-            ret = KErrGeneral;
-            }
+            } // no else
         }
-
-    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 );
-        }
+        }  // no else
     
     return ret;
     }
@@ -374,6 +333,86 @@
 
 
 
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::USimReadWriteSizeReq
+// Send Request to Get Read and Write size
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead::USimReadWriteSizeReq( TUint8 aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZEREQ, "CMmPhoneBookOperationRead::USimReadWriteSizeReq" );
+
+    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.fileId = PB_MSISDN_FID;
+    cmdParams.serviceType = UICC_APPL_FILE_INFO;
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    
+    ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->CreateUiccApplCmdReq( cmdParams );
+
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::CreateReqToReadEntry
+// Append parametes to request
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead::AddParamToReadReq( TUiccReadLinearFixed& aParams )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::AddParamToReadReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_ADDPARAMTOREADREQ, "CMmPhoneBookOperationRead::AddParamToReadReq" );
+
+    TInt ret( KErrNone );
+    // Check for the record Number to be read is valid record number
+    if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+            iPBStoreConf[iArrayIndex].iNoOfRecords )
+        {
+        // Check for Valid PhoneBook Entry no.
+        if( iIndexToRead > 0)
+            {
+            aParams.record = iIndexToRead;
+            }
+        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 First record
+            iIndexToRead = 1;
+            aParams.record = iIndexToRead;
+            
+            // Set Flag for first valid Entry location Search
+            iLocationSearch = ETrue;
+            }
+        }
+    else
+        {
+        // return error for invalid Entry (Out of max range idf entries)
+        ret = KErrArgument;
+        }
+    return ret;
+    }
 
 
 // -----------------------------------------------------------------------------
@@ -394,7 +433,6 @@
 
     TBool complete( EFalse );
     TInt ret(KErrNone);
-    TInt retExt(KErrNone);
     // Initialize Application file ID to send in next request
     TBuf8<2> applFieldId;
     
@@ -408,218 +446,84 @@
         ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus );
         }
 
-    // Convert Phone Book name to file id
-    TUint16 fileIdExt( 0x0000 );
-    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
-    TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
+    switch( iSavedIPCForComplete )
+        {
+        case EMmTsyPhoneBookStoreReadIPC:
+        case EMmTsyONStoreReadIPC:
+        case EMmTsyONStoreReadEntryIPC:
+            {
+            complete = USimPbReadRespL( ret, 
+                                aTransId,
+                                aFileData );
+            break;
+            }
+        case EMmTsyONStoreReadSizeIPC:
+        case EMmTsyONStoreWriteSizeIPC:
+            {
+            complete = USimReadWriteSizeResp( aFileData, ret );
+            break;
+            }
+        default:
+            {
+            // Nothing to do here
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUICCPbRespL - Unknown IPC: %d", iSavedIPCForComplete);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL - Unknown Ipc : %d", iSavedIPCForComplete );
+            break;
+            }
+        }
 
+
+    return complete;
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::USimPbReadRespL
+// Handles Response for all phone book read 
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationRead:: USimPbReadRespL( TInt aStatus,
+        TUint8 aTransId,
+        const TDesC8 &aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReadRespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMPBREADRESPL, "CMmPhoneBookOperationRead::USimPbReadRespL" );
+
+    TInt ret ( aStatus );
+    TBool complete( EFalse );
+    TBool entryStored( EFalse );
+    TInt emptyEntry( KErrNone );
+    
     if ( UICC_STATUS_OK == aStatus )
         {
         if ( EBasicEfRead == iTypeOfReading )
             {
-            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;
-
-                // 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--;
-
-                    // 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 );
-
-                    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 );
-
-                    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--;
-                    }
-                }
-
-            // to read next record
-            iIndexToRead++;
-
+            HandleReadResp( aFileData, aTransId, emptyEntry, entryStored );
             }// End of without EXT File Data Case
 
          // 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;
-                    }
-                }
-            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 );
-
-                    }
-                }
+            HandleExtReadResp( aFileData, aTransId, entryStored );
             }
         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 );
+            TInt mbdnRecNo( aFileData[0] );
+            
+            iTypeOfReading = EBasicEfRead;
+            ret = USimPbReqRead( mbdnRecNo, aTransId );
             }
         }
 
+    if( ( entryStored ) && 
+        ( 0 != iNumOfEntriesToRead) )
+        {
+        iTypeOfReading = EStartRead;
+        ret = USimPbReqRead( iIndexToRead, aTransId );
+        } // no else
+    
     // Complete request
     if( ( KErrNone != ret )|| ( 0 == iNumOfEntriesToRead ))
         {
@@ -629,15 +533,25 @@
             ret = KErrNotFound;
             }
         
-        CPhoneBookDataPackage phoneBookData;
-        phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
-        iNumOfEntriesFilled = 0;
-        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
-            iSavedIPCForComplete,
-            &phoneBookData,
-            ret );
+        if( ( EMmTsyONStoreReadEntryIPC != iSavedIPCForComplete ) &&
+                ( EMmTsyONStoreReadIPC != iSavedIPCForComplete ) )
+            {
+            CPhoneBookDataPackage phoneBookData;
+            phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+            iNumOfEntriesFilled = 0;
+            iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                iSavedIPCForComplete,
+                &phoneBookData,
+                ret );
 
-        iPhoneBookStoreCacheArray = NULL;
+            iPhoneBookStoreCacheArray = NULL;
+            }
+        else
+            {
+            // Store own number Entry and complete the ipc
+            StoreAndCompleteOwnNumber( ret, emptyEntry );
+            }
+
         // Set flag to indicate that we can remove this operation from array
         complete = ETrue;
         }
@@ -646,4 +560,359 @@
     }
 
 
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::HandleReadResp
+// Handles Main Entry file read resp
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead::HandleReadResp( 
+        const TDesC8 &aFileData, 
+        TUint8 aTransId, 
+        TInt &aEmptyEntry, 
+        TBool &aEntryStore )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleReadResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEREADRESP, "CMmPhoneBookOperationRead::HandleReadResp" );
+    
+    iStoreEntry = new ( ELeave ) TPBEntry();
+    // update Entry Data
+    iStoreEntry->iEntryIndex = iIndexToRead;
+
+    // check if Entry is valid Entry or Empty Entry
+    aEmptyEntry = EmptyEntryCheck(aFileData);
+    
+    // if Entry is not empty
+    if( KErrNone == aEmptyEntry )
+        {
+        // Update Entry Status 
+        iStoreEntry->iEntryPresent = ETrue;
+
+        // 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>
+        if( iArrayIndex < EPhonebookTypeUnknown )
+            {
+            iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].GetPBEntryFromUICCData( aFileData,
+                                                             iNumberBuf,
+                                                             iNameBuf);
+            }
+        
+        HandleEntryPresentResp( aFileData, aTransId, aEntryStore );
+        }
+    else
+        {
+        //Update Entry Status
+        iStoreEntry->iEntryPresent = EFalse;
+        // Reset Entry andd Append to the List 
+        iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+             iStoreEntry,
+             iArrayIndex );
+
+        aEntryStore = ETrue;
+        // Entry is Empty read next Entry
+        if(!iLocationSearch)
+            {
+            // Decrement the no of Entries to be read
+            iNumOfEntriesToRead--;
+            }
+        }
+
+    // to read next record
+    iIndexToRead++;
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::HandleEntryPresentResp
+// Handles main Entry read resp When Entry is Present
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead::HandleEntryPresentResp( 
+        const TDesC8 &aFileData, 
+        TUint8 aTransId, 
+        TBool &aEntryStore )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleEntryPresentResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEENTRYPRESENTRESP, "CMmPhoneBookOperationRead::HandleEntryPresentResp" );
+
+    // 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[iArrayIndex].iAlphaStringlength+ 13]  )
+        {
+        if( ( EMmTsyONStoreReadEntryIPC != iSavedIPCForComplete ) &&
+                ( EMmTsyONStoreReadIPC != iSavedIPCForComplete ) )
+            {
+            StoreEntryToListL( aEntryStore );
+            }
+        else
+            {
+            // decment for own number read entry
+            iNumOfEntriesToRead--;
+            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[iArrayIndex].iAlphaStringlength + 13];
+        
+        // Append EXT record no.
+        iStoreEntry->PBEntryExtRecord.Append( recordNo );
+
+        // if while reading EXT error comes (for invalid Entry)than
+        // read next entry
+        if( ( KErrNone != USimPbReqRead( recordNo, aTransId ) ) )
+            {
+            iNumOfEntriesToRead--;
+            iTypeOfReading = EStartRead;
+            }  // no else
+        }                        
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::HandleExtReadResp
+// Handles Ext file read resp
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead::HandleExtReadResp( 
+        const TDesC8 &aFileData, 
+        TUint8 aTransId,
+        TBool &aEntryStored )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::HandleExtReadResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_HANDLEEXTREADRESP, "CMmPhoneBookOperationRead::HandleExtReadResp" );
+
+    // 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
+        if( KErrNone != USimPbReqRead( 
+                aFileData[UICC_EXT_REC_NO_OFFSET], aTransId ) )
+            {
+            iNumOfEntriesToRead--;
+            iTypeOfReading = EStartRead;
+            } // no else
+        }
+    else
+        {
+        // 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 )));
+            
+            if( ( EMmTsyONStoreReadEntryIPC == iSavedIPCForComplete ) &&
+                    ( EMmTsyONStoreReadIPC == iSavedIPCForComplete ) )
+                {
+                StoreEntryToListL( aEntryStored );
+                }
+            else
+                {
+                // decment for own number read entry
+                iNumOfEntriesToRead--;
+                iNumOfEntriesFilled++;
+                }
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead::HandleUSimPbRespL - Append entries into array %i",iNumOfEntriesFilled);
+OstTrace1( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONREAD_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead::HandleUICCPbRespL;iNumOfEntriesFilled=%d", iNumOfEntriesFilled );
+            }
+        }
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::USimReadWriteSizeResp
+// Send Request to Get Read and Write size
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationRead::USimReadWriteSizeResp( const TDesC8 &aFileData, 
+        TInt aStatus )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZERESP, "CMmPhoneBookOperationRead::USimReadWriteSizeResp" );
+
+    TInt ret( aStatus );
+    TInt numOfEntries(0);
+
+    if(UICC_STATUS_OK == aStatus)
+        {
+        // get the record length and number of entries
+        TFci fci( aFileData );
+        numOfEntries = fci.GetNumberOfRecords();
+        
+        // Update it in Internal Buffer
+        iMmPhoneBookStoreMessHandler->
+              iPBStoreConf[EPhonebookTypeMSISDN].iNoOfRecords = numOfEntries;
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimReadWriteSizeResp - FileInfo read Fail");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD_USIMREADWRITESIZERESP, "CMmPhoneBookOperationRead::USimReadWriteSizeResp - FileInfo Read Fail" );
+        
+        ret = KErrArgument;
+        }
+    
+    
+    // Create data package
+    CMmDataPackage numberData;
+    // complete request
+    numberData.PackData( &numOfEntries );
+    iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( 
+            iSavedIPCForComplete, 
+            &numberData, 
+            ret );
+
+    return ETrue;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::StoreEntryToListL
+// StoreEntry to internal list and Cache Array
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead::StoreEntryToListL( TBool &aEntryStored )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::StoreEntryToList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_STOREENTRYTOLIST, "CMmPhoneBookOperationRead::StoreEntryToList" );
+ 
+    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                  iStoreEntry,
+                  iArrayIndex );
+
+    // Decrement the number of entries to be read when it is
+    // stored in commonTSY Array
+    iNumOfEntriesToRead--;
+
+    // the there is no extension data
+    CPhoneBookStoreEntry* phoneBookStoreEntry =
+    new( ELeave ) CPhoneBookStoreEntry;
+    CleanupStack::PushL( phoneBookStoreEntry );
+    phoneBookStoreEntry->ConstructL();
+    iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+        iNameBuf,
+        iNumberBuf,
+        *phoneBookStoreEntry,
+        iFileId,
+        iIndexToRead );
+    TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+
+    iPhoneBookStoreCacheArray->AppendL( phoneBookStoreEntry );
+    CleanupStack::Pop( phoneBookStoreEntry );
+    iNumOfEntriesFilled++;
+    aEntryStored = ETrue;
+    }
+
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::StoreOwnNumber
+// StoreEntry to internal list and shared buffer for own number
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber( TInt aRet , TInt aEmptyEntry)
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_STOREANDCOMPLETEOWNNUMBER, "CMmPhoneBookOperationRead::StoreAndCompleteOwnNumber" );
+ 
+    if( ( EMmTsyONStoreReadEntryIPC == iSavedIPCForComplete ) &&
+            ( ( KErrNone != aEmptyEntry ) || ( KErrNone != aRet ) ) )
+        {
+        // complete ipc with null
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( 
+                iSavedIPCForComplete, 
+                NULL, 
+                aRet );
+        }
+    else
+        {
+        // Append Entry to list
+        iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                      iStoreEntry,
+                      iArrayIndex );
+
+        // Decrement the number of entries to be read when it is
+        // stored in commonTSY Array
+        iNumOfEntriesToRead--;
+
+        // Create ON store structure
+        TONStoreMsg* oNStoreMsg = new ( ELeave ) TONStoreMsg();
+
+        // Push oNStoreMsg into CleanupStack
+        CleanupStack::PushL( oNStoreMsg );
+
+        // Save Name
+
+        TBuf8<UICC_EF_MAX_NAME_LEN> aNameString;
+        // Convert String to 8 bit format
+        CMmStaticUtility::ConvertGsmDataToUcs2(iNameBuf, iNameBuf.Length() , aNameString );
+        TIsiUtility::CopyFromBigEndian(
+                aNameString,
+                oNStoreMsg->iName );
+
+        // Convert Number to Ascii Code
+        // Save Number
+        iMmPhoneBookStoreMessHandler->ConvertToUcs2FromBCD(iNumberBuf, oNStoreMsg->iTelNumber,PB_MBDN_FID );
+
+        // Set location index
+        // Map location to client world (increase value by one)
+        oNStoreMsg->iLocation = iStoreEntry->iEntryIndex ;
+
+        // Create data package
+        CMmDataPackage numberData;
+        if( EMmTsyONStoreReadIPC == iSavedIPCForComplete )
+            {
+            // Complete response with ret
+            // Pack the data for sending to the manager
+            numberData.PackData( &oNStoreMsg );
+            }
+        else
+            {
+            numberData.PackData( oNStoreMsg );
+            }
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete( 
+                iSavedIPCForComplete, 
+                &numberData, 
+                aRet );
+        // Delete oNStoreMsg structure
+        CleanupStack::PopAndDestroy( oNStoreMsg );
+
+        // Reset current IPC.
+        iSavedIPCForComplete = 0;
+        iNumOfEntriesFilled++;
+        }
+    }
+
+
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread3g_adn.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread3g_adn.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -21,6 +21,7 @@
 #include <pn_const.h>
 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
 #include "tsylogger.h"
+#include "cmmmessagerouter.h"
 #include "cmmphonebookoperationread3g_adn.h"
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
@@ -37,7 +38,10 @@
     // None
 
 // CONSTANTS
-//const TUint16 KSimPbLocationMBDN = 0x0100;
+const TUint8 KAnrOffsetNumLength = 1;  // refer from 3GPP TS 31.102 document
+const TUint8 KAnrOffsetNumber = 2;
+const TUint8 KMinLengthEfAnr = 15;
+const TUint8 KMaxEmptyPatternBuf = 243;
 
 // MACROS
     // None
@@ -67,8 +71,6 @@
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::CMmPhoneBookOperationRead3g_adn");
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CMMPHONEBOOKOPERATIONREAD3G_ADN, "CMmPhoneBookOperationRead3g_adn::CMmPhoneBookOperationRead3g_adn" );
-
-
     }
 
 // -----------------------------------------------------------------------------
@@ -82,7 +84,6 @@
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::~CMmPhoneBookOperationRead3g_adn");
     OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_CMMPHONEBOOKOPERATIONREAD3G_ADN, "CMmPhoneBookOperationRead3g_adn::~CMmPhoneBookOperationRead3g_adn" );
-
     }
 
 // -----------------------------------------------------------------------------
@@ -93,20 +94,39 @@
 //
 CMmPhoneBookOperationRead3g_adn* CMmPhoneBookOperationRead3g_adn::NewL
     (
-            CMmPhoneBookStoreMessHandler* /*aMmPhoneBookStoreMessHandler*/,
-            CMmUiccMessHandler* /*aUiccMessHandler*/,
-            const CMmDataPackage* /*aDataPackage*/ // Data
+            CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler,
+            const CMmDataPackage* aDataPackage,
+            TInt aIpc
     )
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::NewL");
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_NEWL, "CMmPhoneBookOperationRead3g_adn::NewL" );
 
 
-    TName phonebookTypeName;
-
     CMmPhoneBookOperationRead3g_adn* mmPhoneBookOperationRead3g_adn =
         new( ELeave ) CMmPhoneBookOperationRead3g_adn();
 
+    if( ( EMmTsyONStoreReadSizeIPC != aIpc )&&
+        ( EMmTsyONStoreWriteSizeIPC != aIpc ) )
+        {
+        TName phonebookTypeName;
+
+        const CPhoneBookDataPackage* phoneBookData =
+            static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+        phoneBookData->GetPhoneBookName( phonebookTypeName );
+        
+        // Store phoneBook name 
+        mmPhoneBookOperationRead3g_adn->iPhoneBookTypeName = phonebookTypeName;
+        }
+
+    mmPhoneBookOperationRead3g_adn->iMmPhoneBookStoreMessHandler =
+        aMmPhoneBookStoreMessHandler;
+    mmPhoneBookOperationRead3g_adn->iMmUiccMessHandler = aUiccMessHandler;
+    
+    mmPhoneBookOperationRead3g_adn->ConstructL();
+    
     return mmPhoneBookOperationRead3g_adn;
     }
 
@@ -122,10 +142,109 @@
     {
     TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::ConstructL");
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CONSTRUCTL, "CMmPhoneBookOperationRead3g_adn::ConstructL" );
+    
+    iLocationSearch = EFalse;
+    iCurrentType1Ef = 0;
+    iCurrentType2Ef = 0;
+    iLocationSearch = EFalse;
+    iNumOfEntriesFilled = 0;
+    iNumOfEntriesToRead = 0;
+    iIndexToRead = 0;
 
     }
 
 
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::UICCCreateReq
+// Create request to read Entry
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::UICCCreateReq
+    (
+    TInt aIpc,
+    const CMmDataPackage* aDataPackage,
+    TUint8 aTransId
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UICCCreateReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationRead3g_adn::UICCCreateReq" );
+
+    TInt ret( KErrNotSupported );
+    
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+    iSavedIPCForComplete = aIpc;
+
+    // Convert Phone Book name to file id
+    iExtFileId = UICC_ILLEGAL_FILE_ID;
+    iFileId = ConvertToPBfileId(
+                            iPhoneBookTypeName,
+                            iExtFileId,
+                            iMmUiccMessHandler->GetCardType() );
+    iArrayIndex = ConvertToConfArrayIndex( iFileId );
+
+    
+    switch( aIpc )
+        {
+        case EMmTsyONStoreReadIPC:
+        case EMmTsyONStoreReadEntryIPC:
+            {
+            iFileId = PB_MSISDN_FID;
+            iExtFileId = PB_EXT5_FID;
+            iArrayIndex = EPhonebookTypeMSISDN;
+            // Unpack index to be read
+            aDataPackage->UnPackData( iIndexToRead );
+            ret = USimPbReqRead( iIndexToRead, aTransId );
+            break;
+            }
+        case EMmTsyPhoneBookStoreReadIPC:
+            {
+            CArrayPtrSeg<CPhoneBookStoreEntry>* prtToReadEntriesArray;
+            RMobilePhoneBookStore::TPBIndexAndNumEntries* ptrToIndexAndEntries;
+            phoneBookData->UnPackData(
+                ptrToIndexAndEntries,
+                prtToReadEntriesArray );
+
+            if ( prtToReadEntriesArray && ptrToIndexAndEntries )
+                {
+                iPhoneBookStoreCacheArray = prtToReadEntriesArray;
+                iNumOfEntriesToRead = ptrToIndexAndEntries->iNumSlots;
+                iNumOfEntriesFilled = 0;
+                iIndexToRead = ptrToIndexAndEntries->iIndex;
+
+                if( PB_ADN_FID == iFileId )
+                    {
+                    // handle for ADN 3g phoneBook
+                    ret = UICCHandleData3gADNReadReq( aDataPackage,
+                                                      aTransId );
+                    }
+                else
+                    {
+                    ret = USimPbReqRead( iIndexToRead, aTransId );
+                    }
+                }
+            break;
+            }
+        case EMmTsyONStoreReadSizeIPC:
+        case EMmTsyONStoreWriteSizeIPC:
+            {
+            ret = USimReadWriteSizeReq( aTransId );
+            break;
+            }
+        default:
+            {
+            // Nothing to do here
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead3g_adn::UICCCreateReq - Unknown IPC: %d", aIpc);
+OstTrace1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationRead3g_adn::UICCCreateReq - UnKnown Ipc : %d", aIpc );
+            break;
+            }
+        } // switch-case
+
+    return ret;
+    }
+
 // -----------------------------------------------------------------------------
 // CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq
 // Handles Read Resp
@@ -133,52 +252,340 @@
 //
 TInt CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq
         (
-        TInt aFileId,
-        TInt aFileSFI
+         const CMmDataPackage* aDataPackage,
+         TUint8 aTransId         
         )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCHANDLEDATA3GADNREADREQ, "CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCHANDLEDATA3GADNREADREQ, "CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq" );
 
     TInt ret(KErrNone);
 
-    // get the index to be read from phonebook
-    TInt index( iIndexToRead );
-    TInt appFileId(APPL_FILE_ID);
+    const CPhoneBookDataPackage* phoneBookData =
+        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+    CArrayPtrSeg<CPhoneBookStoreEntry>* prtToReadEntriesArray;
+    RMobilePhoneBookStore::TPBIndexAndNumEntries* ptrToIndexAndEntries;
+    phoneBookData->UnPackData(
+        ptrToIndexAndEntries,
+        prtToReadEntriesArray );
+
+    if ( prtToReadEntriesArray && ptrToIndexAndEntries )
+        {
+        iPhoneBookStoreCacheArray = prtToReadEntriesArray;
+        iNumOfEntriesToRead = ptrToIndexAndEntries->iNumSlots;
+        iNumOfEntriesFilled = 0;
+        iIndexToRead = ptrToIndexAndEntries->iIndex;
+        
+        if( ( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                         iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords ) &&
+            ( 0 < iIndexToRead ) )
+            {
+            ret = iMmPhoneBookStoreMessHandler->GetPBRRecordNum( iIndexToRead, 
+                                                                 iCurrentPBRRecordNo);
+            }
+        else
+            {
+            // Start Reading from first location , 1st PBR Record
+            iCurrentPBRRecordNo = 1;
+            }
 
-    TUiccReadLinearFixed cmdParams;
-    //cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> iMmPhoneBookStoreMessHandler;
+        if( KErrNone == ret )
+            {
+            ret = UiccReadEfRecordReq(
+                         aTransId,
+                         PB_PBR_FID,
+                         UICC_SFI_NOT_PRESENT,
+                         iCurrentPBRRecordNo );
+            }
+        }
+    return ret;
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::UiccReadEfRecordReq
+// Reads record from EFpbr
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::UiccReadEfRecordReq( 
+    const TInt aTraId, 
+    const TUint16 aFileId, 
+    const TUint8 aFileIdSfi,
+    const TUint8 aRecordNo )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfRecordReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFRECORDREQ, "CMmPhoneBookOperationRead3g_adn::UiccReadEfRecordReq" );
+
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr =
+             static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    params.fileId = aFileId;
+    params.fileIdSfi = aFileIdSfi;
+    params.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+    params.record = aRecordNo;
+    params.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
+    params.filePath.Append( static_cast<TUint8>( MF_FILE ));
+    params.filePath.Append( static_cast<TUint8>( APPL_FILE_ID >> 8 ));
+    params.filePath.Append( static_cast<TUint8>( APPL_FILE_ID ));
+    params.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+    params.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    params.trId = static_cast<TUiccTrId>( aTraId );
+
+    return iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+                                          CreateUiccApplCmdReq( params );
+    }
+
+
 
-    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 ));
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead::HandleUICCPbRespL
+// Separate request
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL
+    (
+    TInt aStatus,
+    TUint8 /*aDetails*/,
+    const TDesC8 &aFileData,
+    TInt aTransId
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL" );
+    
+    TBool completed( EFalse );
+    TInt ret( KErrNone );
+    // Handle possible error case all PhoneBooks extcept Adn
+    if ( UICC_STATUS_OK != aStatus )
+        {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL-Unsuccessfully completed by UICC");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL - Unsuccessfully completed by UICC" );
+        
+        ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus );
+        }
+    switch( iSavedIPCForComplete )
+        {
+        case EMmTsyPhoneBookStoreReadIPC:
+        case EMmTsyONStoreReadIPC:
+        case EMmTsyONStoreReadEntryIPC:
+            {
+            if( PB_ADN_FID == iFileId )
+                {
+                completed = HandleUICC3gADNRespL( aStatus,
+                                                  aFileData,
+                                                  aTransId );
+                }
+            else
+                {
+                completed = USimPbReadRespL( ret, 
+                                    aTransId,
+                                    aFileData );
+                }
+            break;
+            }
+        case EMmTsyONStoreReadSizeIPC:
+        case EMmTsyONStoreWriteSizeIPC:
+            {
+            completed = USimReadWriteSizeResp( aFileData, ret );
+            break;
+            }
+        default:
+            {
+            // Nothing to do here
+TFLOGSTRING2("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL - Unknown IPC: %d", iSavedIPCForComplete);
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationRead3g_adn::HandleUICCPbRespL - UnKnown Ipc : =%d", iSavedIPCForComplete );
+            break;
+            }
+        }
+    return completed;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL
+// HAndles Response for ADN phoneBook
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL
+    (
+    const TInt aStatus,
+    const TDesC8 &aFileData,
+    const TInt aTransId
+    )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCHANDLEDATA3GADNREADREQ, "CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq" );
 
-    index = iIndexToRead && 0x00FF;
+    TBool completed ( EFalse );
+    TInt ret(KErrNone);
+    
+    switch( iCurrentReadPhase )
+        {
+        case EPBReadPhase_PBR_Read_Entry:
+            {
+            ret = UiccReadEfPbrRecordResp( aStatus, 
+                                           aFileData, 
+                                           aTransId );
+
+            break;
+            }
+        case EPBReadPhase_Read_Type1_Entry:
+            {
+            ret = UiccReadEfType1RespL( aStatus, 
+                                       aTransId,
+                                       aFileData );
+
+            break;
+            }
+        case EPBReadPhase_Read_Type2_Entry:
+            {
+            ret = UiccReadEfType2RespL( aStatus, 
+                                       aTransId,
+                                       aFileData );
 
-    if( PB_PBR_FID == aFileId )
+            break;
+            }
+        case EPBReadPhase_Read_type3_Entry:
+            {
+            TUint8 fileTag;
+            if( iType2OperationOngoing )
+                {
+                fileTag = iType2FileArray[iCurrentType2Ef].tagValue;
+                }
+            else
+                {
+                fileTag = iType1FileArray[iCurrentType1Ef].tagValue;
+                }
+            ret = UiccReadEfType3RespL( aStatus, 
+                                       aTransId,
+                                       fileTag,
+                                       aFileData );
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL - default branch ");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_HANDLEUICC3GADNRESPL, "CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL - default branch " );
+            break;
+            }
+        }
+
+    if( ( EPB_3G_ADN_Read_Phase_complete == iCurrentReadPhase ) &&
+        ( 0 != iNumOfEntriesToRead ) &&
+        ( KErrNone == ret ) )
         {
-        // Find which record no should be read
-        // get ADN file ID from PBR EF data according to which entry needs to be read
-        TUint8 pbrRecordNo(0);
-        do
+        iIndexToRead++;
+        iCurrentEfEntryIndex++;
+        
+        // Calculate The PBR Record Number needs to be read
+        // get the Max no of Entries in one PBR record
+        TInt maxNoOfEntry( iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords  );
+
+        TInt maxNoOfPbrRec( iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[EPhonebookTypeAdn].iPBRNoOfRecords );
+
+        if( iIndexToRead > ( iCurrentPBRRecordNo * ( maxNoOfEntry/maxNoOfPbrRec ) ) )
+            {
+            // Read Next PBR Record 
+            iCurrentPBRRecordNo++;
+            if( iCurrentPBRRecordNo <= maxNoOfPbrRec )
+                {
+                // Reset all Buffers
+                iType1FileArray.Reset();
+                iType2FileArray.Reset();
+                iType3FileArray.Reset();
+                
+                iCurrentReadPhase = EPBReadPhase_PBR_Read_Entry;
+                ret = UiccReadEfRecordReq(
+                             aTransId,
+                             PB_PBR_FID,
+                             UICC_SFI_NOT_PRESENT,
+                             iCurrentPBRRecordNo );
+                }
+            else
+                {
+                // complete with Error
+                ret = KErrArgument;
+                iNumOfEntriesToRead = 0;
+                }
+            }
+        else
+            {
+            // Start Reading next Entry
+            ret = StartReadingEntry( aTransId );
+            }
+        }
+    
+    if( ( KErrNone != ret ) ||
+        ( EPB_3G_ADN_Read_Phase_complete == iCurrentReadPhase ) )
+        {
+        // Check fo Any Entries Found
+        if( ( UICC_STATUS_OK == aStatus )&& ( 0 == iNumOfEntriesFilled ) )
             {
-            pbrRecordNo++;
-            index = index-255;
-            }while(index > 255);
+            ret = KErrNotFound;
+            }
+        
+        CPhoneBookDataPackage phoneBookData;
+        phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+        iNumOfEntriesFilled = 0;
+        iPhoneBookStoreCacheArray = NULL;
+        iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                EMmTsyPhoneBookStoreReadIPC,
+                &phoneBookData,
+                ret );
+
+        // Set flag to indicate that we can remove this operation from array
+        completed = ETrue;
+        }
+
+    return completed;
+    }
+
+
+
 
-        cmdParams.fileId = PB_PBR_FID;
-        cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-        cmdParams.record = pbrRecordNo;
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::UiccReadEfPbrRecordResp
+// Handles response for EFpbr record reading
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::UiccReadEfPbrRecordResp( 
+    TInt aStatus, 
+    const TDesC8 &aFileData, 
+    TInt aTraId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfPbrRecordResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFPBRRECORDRESP, "CMmPhoneBookOperationRead3g_adn::UiccReadEfPbrRecordResp" );
+
+    TInt ret( KErrArgument );
+    if( UICC_STATUS_OK == aStatus )
+        {
+        ret = FetchFileListFromPBR(
+                           aFileData,
+                           KTagConstructedTagA8,
+                           iType1FileArray );
+        ret = FetchFileListFromPBR(
+                           aFileData,
+                           KTagConstructedTagA9,
+                           iType2FileArray );
+        ret = FetchFileListFromPBR(
+                           aFileData,
+                           KTagConstructedTagAA,
+                           iType3FileArray );
+        
+        ret = StartReadingEntry( aTraId );
         }
     else
         {
-        cmdParams.fileId = aFileId;
-        cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-        cmdParams.record = index;
-        cmdParams.fileIdSfi = aFileSFI;
+TFLOGSTRING2("TSY: CMmPhoneBookOperationWrite3g_adn::UiccReadEfPbrRecordResp: file reading fails: 0x%x", aStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFPBRRECORDRESP, "CMmPhoneBookOperationRead3g_adn::UiccReadEfPbrRecordResp;file reading fails: =%d", aStatus );
+        
+        iNumOfEntriesToRead = 0;
         }
     return ret;
     }
@@ -187,51 +594,901 @@
 
 
 // -----------------------------------------------------------------------------
-// CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL
-// HAndles Response for ADN phoneBook
+// CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL
+// Handles response for Type1 File Array record reading
 // -----------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL
-    (
-    const TInt aStatus,
-    const TDes8 &/*aFileData*/,
-    const TInt /*aTransId*/
-    )
+TInt CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL(
+        TInt aStatus, 
+        TInt aTraId,
+        const TDesC8 &aFileData )
     {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE1RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL" );
 
-    TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::HandleUICC3gADNRespL");
-    OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCHANDLEDATA3GADNREADREQ, "CMmPhoneBookOperationRead3g_adn::UICCHandleData3gADNReadReq" );
+     TInt ret ( KErrNone );
+     
+     CPhoneBookStoreEntry* phoneBookStoreEntry( NULL );
+     TBool entryAllocatedNow( EFalse ); // Cache entry allocated now or earlier
+     TBool entryStored( EFalse ); // Is entry data stored in cache
+     TBool notEmptyEntry( ETrue ); // If Entryis Empty
+
+     if( UICC_STATUS_OK == aStatus )
+         {
+         CreateInternalPbEntryL( iIndexToRead );
+         }
+     
+     notEmptyEntry = CheckForEmptyEntry( iType1FileArray[iCurrentType1Ef].tagValue,
+             aFileData );
+     if( notEmptyEntry )
+         {
+         phoneBookStoreEntry = CreateReadPbEntryL(
+             iIndexToRead,
+             entryAllocatedNow );
+         }
+     
+     if( UICC_STATUS_OK == aStatus )
+         {
+         switch( iType1FileArray[iCurrentType1Ef].tagValue )
+             {
+             case UICC_EF_ADN_TAG: 
+                 {
+                 // Get name and number
+                 iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeAdn].
+                 GetPBEntryFromUICCData( aFileData, iNumberBuf, iNameBuf );
+
+                 // Check if there is Any Ext records
+                 TInt index( iMmPhoneBookStoreMessHandler->
+                         iPBStoreConf[EPhonebookTypeAdn].iAlphaStringlength
+                         + KAdnMandatoryBytes );
+
+                 TInt extFileTagIndex( KErrNotFound );
+                 iType2OperationOngoing = EFalse;
+                 ret = CheckForExtToContinueNextRead(
+                         index,
+                         aFileData,
+                         aTraId,
+                         extFileTagIndex );
+
+                 if( KErrNotFound == extFileTagIndex )
+                     {
+                     entryStored = ETrue;
+                     iCurrentType1Ef++;
+
+                     ret = ContinueWithNextReading( aTraId );
+                     } // no else
+                     
+                 if ( entryStored && notEmptyEntry ) // No extension record, store entry
+                     {
+                     iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                             iNameBuf,
+                             iNumberBuf,
+                             *phoneBookStoreEntry,
+                             PB_ADN_FID,
+                             iIndexToRead );
+
+                     // Set status in internal list
+                     iStoreEntry->iEntryPresent = ETrue;
+                     iNumberBuf.Zero(); // Reset buffers for next time
+                     iNameBuf.Zero();
+                     }
+                 break;
+                 }
+             case UICC_EF_ANR_TAG:
+                 {
+                 if ( aFileData.Length() && KMinLengthEfAnr <= aFileData.Length() )
+                     {
+                     // Get and save ANR
+                     TInt numLength( aFileData[KAnrOffsetNumLength] );
+                     iNumberBuf.Copy( aFileData.Mid( KAnrOffsetNumber, numLength ) );
+                     }
+                 
+                 TInt extFileTagIndex( KErrNotFound );
+                 iType2OperationOngoing = EFalse;
+                 ret = CheckForExtToContinueNextRead(
+                         KAnrExtRecIdOffset,
+                         aFileData,
+                         aTraId,
+                         extFileTagIndex );
+                 
+                 if( KErrNotFound == extFileTagIndex )
+                     {
+                     entryStored = ETrue;
+                     iCurrentType1Ef++;
+                     ret = ContinueWithNextReading( aTraId );
+                     }  // no else
+                 
+                 
+                 if( entryStored && notEmptyEntry )
+                     {
+                     iMmPhoneBookStoreMessHandler->StoreAnrToPhonebookEntryL(
+                             iNumberBuf,
+                             *phoneBookStoreEntry,
+                             PB_ADN_FID ); // Coding is same as in ADN
+
+                     // Set status in internal list
+                     iStoreEntry->iEntryPresent = ETrue;
+                     
+                     // Reset buffer for next time
+                     iNumberBuf.Zero();
+                     }  // NO ELSE
+                 break;
+                 }
+             case UICC_EF_EMAIL_TAG:
+             case UICC_EF_SNE_TAG:
+                 {
+                 // In type 1 file, EF SNE contains only alpha string
+                 iNameBuf.Copy( aFileData );
+                 if( notEmptyEntry )
+                     {
+                     iMmPhoneBookStoreMessHandler->StoreSneEmailToPbEntryL(
+                         iNameBuf,
+                         *phoneBookStoreEntry,
+                         iType1FileArray[iCurrentType1Ef].tagValue );
+                     // Set status in internal list
+                     iStoreEntry->iEntryPresent = ETrue;
+                     }
+
+                 // reset name buffer to reuse next time
+                 iNameBuf.Zero();
+
+                 iCurrentType1Ef++;
+                 ret = ContinueWithNextReading( aTraId );
+                 break;
+                 }
+             case UICC_EF_IAP_TAG:
+                 {
+                 if( ( aFileData.Length() == iType2FileArray.Count() ) &&
+                     ( notEmptyEntry ) )
+                     {
+                     for ( TInt i( 0 ); i < aFileData.Length() ; i++ )
+                         {
+                         TIapInfo iapinfo;
+                         iapinfo.recordNo = aFileData[i];
+                         iapinfo.fileTag = iType2FileArray[i].tagValue;
+                         iapinfo.fileSfi = iType2FileArray[i].tagSFI;
+                         iapinfo.fileId = iType2FileArray[i].tagFID;
+                         
+                         iStoreEntry->iapInfo.Append( iapinfo );
+                         }
+                     } // no else
+                 
+                 iCurrentType1Ef++;
+                 ret = ContinueWithNextReading( aTraId );
+                 break;
+                 }
+             default:
+                 {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL - default branch ");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE1RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL - default branch" );
+
+                 break;
+                 }
+             }
+         }
+     else
+         {
+         // ADN Read failed for some reason so complete the
+         // operation with error value
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite3g_adn::UiccReadEfType1RespL - Type1 File Read failed ");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE1RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType1RespL - Type1 file read failed" );
+
+         iCurrentReadPhase = EPB_3G_ADN_Read_Phase_complete;
+         ret = KErrArgument;
+         }
+
+
+         if ( entryAllocatedNow )
+             {
+             TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+             iPhoneBookStoreCacheArray->AppendL( phoneBookStoreEntry );
+             CleanupStack::Pop( phoneBookStoreEntry );
+             iNumOfEntriesFilled++;
+             } // No else
+
+         return ret;
+    }
+
 
 
-    TInt ret(KErrNone);
-    // Initialize Application file ID to send in next request
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL
+// Handles response for Type2 File Array record reading
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL(
+        TInt aStatus, 
+        TInt aTraId,
+        const TDesC8 &aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE2RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL" );
+
+     TInt ret ( KErrNone );
+     
+     CPhoneBookStoreEntry* phoneBookStoreEntry( NULL );
+     TBool entryAllocatedNow( EFalse ); // Cache entry allocated now or earlier
+     TBool entryStored( EFalse ); // Is entry data stored in cache
+     TBool notEmptyEntry( ETrue ); // Entry is Empty
+
+     if( UICC_STATUS_OK == aStatus )
+         {
+         CreateInternalPbEntryL( iIndexToRead );
+         }
+
+     notEmptyEntry = CheckForEmptyEntry( iType2FileArray[iCurrentType2Ef].tagValue,
+             aFileData );
+     if( notEmptyEntry )
+         {
+         phoneBookStoreEntry = CreateReadPbEntryL(
+             iIndexToRead,
+             entryAllocatedNow );
+         }
+
+     if( UICC_STATUS_OK == aStatus )
+         {
+         // Check for Filetag 
+         switch( iType2FileArray[iCurrentType2Ef].tagValue )
+             {
+             case UICC_EF_ANR_TAG:
+                 {
+                 if ( aFileData.Length() && KMinLengthEfAnr <= aFileData.Length() )
+                     {
+                     // Get and save ANR
+                     TInt numLength( aFileData[KAnrOffsetNumLength] );
+                     iNumberBuf.Copy( aFileData.Mid( KAnrOffsetNumber, numLength ) );
+                     }
 
-    // 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" );
-        ret = CMmStaticUtility::UICCCSCauseToEpocError(aStatus );
-        }
+                 TInt extFileTagIndex( KErrNotFound );
+                 // Check if there is Any Ext records
+                 iType2OperationOngoing = ETrue;
+                 ret = CheckForExtToContinueNextRead(
+                           KAnrExtRecIdOffset,
+                           aFileData,
+                           aTraId,
+                           extFileTagIndex );
+                 
+                 if( KErrNotFound == extFileTagIndex )
+                     {
+                     entryStored = ETrue;
+                     iCurrentType2Ef++;
+                     ret = CheckForNextType2Read( aTraId );
+                     } // no else
+                 
+                 if( entryStored && notEmptyEntry )
+                     {
+                     iMmPhoneBookStoreMessHandler->StoreAnrToPhonebookEntryL(
+                         iNumberBuf,
+                         *phoneBookStoreEntry,
+                         PB_ADN_FID ); // Coding is same as in ADN
+
+                     // Set status in internal list
+                     iStoreEntry->iEntryPresent = ETrue;
+                     // Reset buffer for next time
+                     iNumberBuf.Zero();
+                     }
+                 break;
+                 }
+             case UICC_EF_EMAIL_TAG:
+             case UICC_EF_SNE_TAG:
+                 {
+                 // In type 1 file, EF SNE contains only alpha string
+                 iNameBuf.Copy( aFileData );
+                 if( notEmptyEntry )
+                     {
+                     iMmPhoneBookStoreMessHandler->StoreSneEmailToPbEntryL(
+                         iNameBuf,
+                         *phoneBookStoreEntry,
+                         iType2FileArray[iCurrentType2Ef].tagValue );
+                     // Set status in internal list
+                     iStoreEntry->iEntryPresent = ETrue;
+                     }
+
+                 // Reset name buffe rto recuse next time
+                 iNameBuf.Zero();
+
+                 iCurrentType2Ef++;
+                 ret = CheckForNextType2Read( aTraId );
+                 break;
+                 }
+             default:
+                 {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL - default branch");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE2RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL - default branch" );
+                 break;
+                 }
+             }
+         }
+     else
+         {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL - Type2 File Read Failed");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE2RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL - Type2 file read failed" );
+
+         iCurrentReadPhase = EPB_3G_ADN_Read_Phase_complete;
+         ret = KErrArgument;
+         }
+     
+     if ( entryAllocatedNow )
+         {
+         TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+         iPhoneBookStoreCacheArray->AppendL( phoneBookStoreEntry );
+         CleanupStack::Pop( phoneBookStoreEntry );
+         iNumOfEntriesFilled++;
+         } // No else
+
+     return ret;
+    }
 
 
-    if(UICC_STATUS_OK == aStatus)
-        {
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::UiccReadEfType3RespL
+// Handles response for Type3 File Array record reading
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::UiccReadEfType3RespL(
+        TInt aStatus, 
+        TInt aTraId,
+        TUint8 aFileTag,
+        const TDesC8 &aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType2RespL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE3RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType3RespL" );
+    
+     TInt ret ( KErrNone );
+     
+     CPhoneBookStoreEntry* phoneBookStoreEntry( NULL );
+     TBool entryAllocatedNow( EFalse ); // Cache entry allocated now or earlier
+
+     if( UICC_STATUS_OK == aStatus )
+         {
+         CreateInternalPbEntryL( iIndexToRead );
+         phoneBookStoreEntry = CreateReadPbEntryL(
+             iIndexToRead,
+             entryAllocatedNow );
+         }
+
+     
+     if( UICC_STATUS_OK == aStatus )
+         {
+         // Store number , if Data length valid and Data type is Additional Data Type
+         if( ( KExtRecordSize == aFileData.Length() ) &&
+             ( KAdditionalNoType == aFileData[0] ) )
+             {
+             // Check if EXT Data Furthe has any ext records
+             if( KTagUnusedbyte != aFileData[UICC_EXT_REC_NO_OFFSET] )
+                 {
+                 // Store Number upto last byte
+                 iNumberBuf.Append(aFileData.Mid(1,UICC_EF_EXT_REC_NUM_LEN));
+
+                 // read that Entry
+                 TInt index (SearchForFileTagIndex(
+                               UICC_EF_EXT1_TAG,
+                               iType3FileArray,
+                               0 ) );
+                               
+                 ret = UiccReadEfRecordReq(
+                         aTraId,
+                         iType3FileArray[index].tagFID,
+                         iType3FileArray[index].tagSFI,
+                         aFileData[UICC_EXT_REC_NO_OFFSET] );
+                 }
+             else
+                 {
+                 // Check for length upto which no is stored
+                 TInt offset = aFileData.Find( &KTagUnusedbyte,1 );
+                 // store Data
+                 iNumberBuf.Append(aFileData.Mid(1,( offset - 1 )));
 
-        // Case: <complete request>
-        if ( KErrNone != ret || 0 == iNumOfEntriesToRead )
+                 // Save to cache
+                 if ( UICC_ADN_PRIM_TAG == aFileTag )
+                     {
+                     iMmPhoneBookStoreMessHandler->StorePhonebookEntryL(
+                         iNameBuf,
+                         iNumberBuf,
+                         *phoneBookStoreEntry,
+                         PB_ADN_FID,
+                         iIndexToRead );
+                     
+                     // Reset Number and name buffer to reuse next time
+                     iNumberBuf.Zero(); // Reset buffers for next time
+                     iNameBuf.Zero();
+                     }
+                 else if ( UICC_ANR_PRIM_TAG == aFileTag )
+                     {
+                     iMmPhoneBookStoreMessHandler->StoreAnrToPhonebookEntryL(
+                         iNumberBuf,
+                         *phoneBookStoreEntry,
+                         PB_ADN_FID ); // Same coding as in ADN
+                     
+                     // Reset number buffer to reuse next time
+                     iNumberBuf.Zero();
+                     }
+
+                 if( iType2OperationOngoing )
+                     {
+                     iCurrentType2Ef++;
+                     // Continue with Type2 File operations
+                     ret = CheckForNextType2Read( aTraId );
+                     }
+                 else
+                     {
+                     iCurrentType1Ef++;
+                     // Continue with next read phase
+                     ret = ContinueWithNextReading( aTraId );
+                     }
+                 }
+             } // no else
+         }
+     else
+         {
+         // EXT Reading fails for some reason complete the operation with
+         // error value
+TFLOGSTRING("TSY: CMmPhoneBookOperationRead3g_adn::UiccReadEfType3RespL - EXT Read fail");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_UICCREADEFTYPE3RESPL, "CMmPhoneBookOperationRead3g_adn::UiccReadEfType3RespL - EXT Read fail" );
+         
+         iCurrentReadPhase = EPB_3G_ADN_Read_Phase_complete;
+         ret = KErrArgument;
+         }
+     
+     if ( entryAllocatedNow )
+         {
+         TF_ASSERT( NULL != iPhoneBookStoreCacheArray );
+         iPhoneBookStoreCacheArray->AppendL( phoneBookStoreEntry );
+         CleanupStack::Pop( phoneBookStoreEntry );
+         iNumOfEntriesFilled++;
+         } // No else
+
+
+     return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationReadg_adn::GetNextType1File
+// Get next Type1 valid FileId to be read
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::GetNextType1File()
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::GetNextType1File" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_GETNEXTTYPE1FILE, "CMmPhoneBookOperationRead3g_adn::GetNextType1File" );
+    
+    TInt ret ( KErrNotFound );
+
+    for(; iCurrentType1Ef < iType1FileArray.Count(); )
+        {
+        if( ( iType1FileArray[iCurrentType1Ef].tagValue == UICC_EF_PBC_TAG ) ||
+                ( iType1FileArray[iCurrentType1Ef].tagValue == UICC_EF_UID_TAG )||
+                ( iType1FileArray[iCurrentType1Ef].tagValue == UICC_EF_GRP_TAG ) )
             {
-            // If no entries found
-            if ( 0 == iNumOfEntriesFilled )
-                {
-                ret = KErrNotFound;
-                }
+            iCurrentType1Ef++;
+            }
+        else
+            {
+            ret = KErrNone;
+            break;
+            }
+        }
+    return ret ;
+    }
+
 
-            }
-          }
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::CheckForExtToContinueNextRead(
+// Start Delete Operation for present Entry
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::CheckForExtToContinueNextRead( 
+        TUint8 aIndex, 
+        const TDesC8 &aFileData, 
+        TInt aTraId,
+        TInt &aExtFileTagIndex )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::CheckForExtToContinueNextRead" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CHECKFOREXTTOCONTINUENEXTREAD, "CMmPhoneBookOperationRead3g_adn::CheckForExtToContinueNextRead" );
+    
+    TInt ret ( KErrNone );
+
+    if( KTagUnusedbyte != aFileData[aIndex] )
+        {
+        // Start reading Ext1 FileData
+        iStoreEntry->PBEntryExtRecord.Append( aFileData[aIndex] );
+        
+        // Search For Ext1 File tag in iType3FileArray
+        aExtFileTagIndex = SearchForFileTagIndex(
+                               UICC_EF_EXT1_TAG,
+                               iType3FileArray,
+                               0 ) ;
+                               
+        if( KErrNotFound != aExtFileTagIndex )
+            {
+            iCurrentReadPhase = EPBReadPhase_Read_type3_Entry;
+            // Send request to read Ext
+            ret = UiccReadEfRecordReq(
+                    aTraId,
+                    iType3FileArray[aExtFileTagIndex].tagFID,
+                    iType3FileArray[aExtFileTagIndex].tagSFI,
+                    aFileData[aIndex] );
+            } // no else
+        } // no else
     return ret;
     }
 
 
 
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::ContinueWithNextReading(
+// Start Delete Operation for present Entry
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::ContinueWithNextReading( TUint8 aTraId )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::ContinueWithNextReading" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CONTINUEWITHNEXTREADING, "CMmPhoneBookOperationRead3g_adn::ContinueWithNextReading" );
+    
+    TInt ret( KErrNone );
+    if( KErrNone == GetNextType1File() )
+        {
+        iType2OperationOngoing = EFalse;
+        iCurrentReadPhase = EPBReadPhase_Read_Type1_Entry;
+        ret =  UiccReadEfRecordReq( 
+                  aTraId, 
+                  iType1FileArray[iCurrentType1Ef].tagFID, 
+                  iType1FileArray[iCurrentType1Ef].tagSFI,
+                  iCurrentEfEntryIndex );
+        }
+    else
+        {
+        iCurrentType2Ef  = 0;
+        // Check if there is any type 2 File Data present
+        if( ( iCurrentType2Ef < iType2FileArray.Count() ) &&
+                (  KErrNotFound != GetNextUsedType2FileRecord( iCurrentType2Ef ) ) )
+            {
+            iType2OperationOngoing = ETrue;
+            // Start reading Type2Files
+            // Continue with next Type 2 File reading
+            iCurrentReadPhase = EPBReadPhase_Read_Type2_Entry;
+            ret =  UiccReadEfRecordReq( 
+                    aTraId, 
+                    iType2FileArray[iCurrentType2Ef].tagFID, 
+                    iType2FileArray[iCurrentType2Ef].tagSFI,
+                    iStoreEntry->iapInfo[iCurrentType2Ef].recordNo );
+            }
+        else
+            {
+            if( !iLocationSearch )
+                {
+                iNumOfEntriesToRead--;
+                }
+
+            iCurrentReadPhase = EPB_3G_ADN_Read_Phase_complete;
+            }
+        }
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::StartReadingEntry
+// STart reading Entry
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::StartReadingEntry( TUint8 aTransId )
+    {
+    TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::StartReadingEntry" );
+    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_STARTREADINGENTRY, "CMmPhoneBookOperationRead3g_adn::StartReadingEntry" );
+
+    TInt ret( KErrNone );
+    
+    // Check if index is valid index or Entry to Written on first free entry
+    if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                              iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords )
+        {
+        iType2OperationOngoing = EFalse;
+        // Start reading The present Entry
+        iCurrentReadPhase = EPBReadPhase_Read_Type1_Entry;
+        iCurrentType1Ef = 0;
+
+        if( 0 < iIndexToRead )
+            {
+            ret = iMmPhoneBookStoreMessHandler->GetCurrentEfRecNum( 
+                                                     iCurrentPBRRecordNo, 
+                                                     iCurrentEfEntryIndex, 
+                                                     iIndexToRead );
+            
+            if( ( KErrNone == GetNextType1File() ) &&
+                ( KErrNone == ret ) )
+                {
+                ret =  UiccReadEfRecordReq( 
+                        aTransId, 
+                        iType1FileArray[iCurrentType1Ef].tagFID, 
+                        iType1FileArray[iCurrentType1Ef].tagSFI,
+                        iCurrentEfEntryIndex );
+                }  // no else
+            }
+        else
+            {
+            iLocationSearch = ETrue;
+            // Read First Entry
+            iIndexToRead  = 1;
+            iCurrentEfEntryIndex = 1;
+            
+            if( KErrNone == GetNextType1File() )
+                {
+                ret =  UiccReadEfRecordReq( 
+                          aTransId, 
+                          iType1FileArray[iCurrentType1Ef].tagFID, 
+                          iType1FileArray[iCurrentType1Ef].tagSFI,
+                          iCurrentEfEntryIndex );
+                }  // no else
+            }
+        }
+
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache3G_adn::CreateInternalPbEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead3g_adn::CreateInternalPbEntryL(
+    const TInt aLocation )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3G_adn::CreateInternalPbEntryL" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CREATEINTERNALPBENTRYL, "CMmPhoneBookOperationRead3g_adn::CreateInternalPbEntryL" );
+
+    // Check if this entry was already stored in internal list
+    iStoreEntry = iMmPhoneBookStoreMessHandler->FindEntryFromPbList(
+        EPhonebookTypeAdn,
+        aLocation );
+    if( ! iStoreEntry )
+        {
+        // Add new entry to internal list
+        iStoreEntry = new ( ELeave ) TPBEntry();
+        iStoreEntry->iEntryIndex = iIndexToRead;
+        // Not present by default. if some data for this record is found,
+        // it is set as present
+        iStoreEntry->iEntryPresent = EFalse;
+        iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+            iStoreEntry,
+            EPhonebookTypeAdn );
+        } // No else
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationCache3G_adn::CreateReadPbEntryL
+//
+// -----------------------------------------------------------------------------
+//
+CPhoneBookStoreEntry* CMmPhoneBookOperationRead3g_adn::CreateReadPbEntryL(
+    const TInt aLocation, TBool& aAllocatedNow )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::CreateReadPbEntryL" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CREATEREADPBENTRYL, "CMmPhoneBookOperationRead3g_adn::CreateReadPbEntryL" );
+
+    aAllocatedNow = ETrue;
+    CPhoneBookStoreEntry* phoneBookStoreEntry( NULL );
+    // Check is there already created CPhoneBookStoreEntry in
+    // iPhoneBookStoreCacheArray.
+    for ( TInt i ( 0 ); i < iPhoneBookStoreCacheArray->Count(); i++ )
+        {
+        phoneBookStoreEntry = iPhoneBookStoreCacheArray->At( i );
+        if ( phoneBookStoreEntry &&
+            ( phoneBookStoreEntry->iLocation == aLocation ) )
+            {
+            aAllocatedNow = EFalse;
+            break;
+            }
+        // No else
+        }
+
+    if ( aAllocatedNow ) // Need to create a new entry
+        {
+        phoneBookStoreEntry = new( ELeave ) CPhoneBookStoreEntry;
+        CleanupStack::PushL( phoneBookStoreEntry );
+        phoneBookStoreEntry->ConstructL();
+        phoneBookStoreEntry->iLocation = aLocation;
+        }
+    // No else
+
+    return phoneBookStoreEntry;
+    }
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::SearchForFileTagIndex
+// Get the index for ADN file Tag
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::SearchForFileTagIndex(
+            TUint8 aFileTag,
+            RArray <TPrimitiveTag>& aFileList,
+            TUint8 aOffset )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::SearchForFileTagIndex" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_SEARCHFORFILETAGINDEX, "CMmPhoneBookOperationRead3g_adn::SearchForFileTagIndex" );
+    
+    TInt index( KErrNotFound );
+    for( TInt count(0); count<aFileList.Count(); count++ )
+        {
+        if( ( aFileTag == aFileList[count].tagValue ) &&
+            ( aOffset <= count ) )
+            {
+            index = count;
+            break;
+            }  // no else
+        }
+    return( index );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::CheckForNextType2Read(
+// Check for next Type 1 Read
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::CheckForNextType2Read( TInt aTraId )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::CheckForNextType2Read" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CHECKFORNEXTTYPE2READ, "CMmPhoneBookOperationRead3g_adn::CheckForNextType2Read" );
+    
+    TInt ret ( KErrNone );
+    // Check if there is any type 2 File Data present
+    if( ( iCurrentType2Ef < iType2FileArray.Count() ) &&
+        ( KErrNotFound != GetNextUsedType2FileRecord( iCurrentType2Ef ) ) )
+        {
+        iType2OperationOngoing = ETrue;
+        // Start reading Type2Files
+        // Continue with next Type 2 File reading
+        iCurrentReadPhase = EPBReadPhase_Read_Type2_Entry;
+        ret =  UiccReadEfRecordReq( 
+                aTraId, 
+                iType2FileArray[iCurrentType2Ef].tagFID, 
+                iType2FileArray[iCurrentType2Ef].tagSFI,
+                iStoreEntry->iapInfo[iCurrentType2Ef].recordNo );
+        }
+    else
+        {
+        if( !iLocationSearch )
+            {
+            iNumOfEntriesToRead--;
+            }
+
+        iCurrentReadPhase = EPB_3G_ADN_Read_Phase_complete;
+        }
+    return ret;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3g_adn::GetNextUsedType2FileRecord
+// Start Delete Operation for present Entry
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationRead3g_adn::GetNextUsedType2FileRecord( TInt &aOffset )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::GetNextUsedType2FileRecord" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_GETNEXTUSEDTYPE2FILERECORD, "CMmPhoneBookOperationRead3g_adn::GetNextUsedType2FileRecord" );
+    
+    TInt index( KErrNotFound );
+    if( iStoreEntry->iapInfo.Count() == iType2FileArray.Count() )
+        {
+        for( TInt count( aOffset ); count < iType2FileArray.Count(); count++ )
+            {
+            if( KTagUnusedbyte != iStoreEntry->iapInfo[count].recordNo )
+                {
+                aOffset = count;
+                index = KErrNone;
+                break;
+                }  // no else
+            }
+        }
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3G_adn::UiccGetSearchPattern
+// resolves P2 and search data for command SEARCH RECORD depending on file type
+// -----------------------------------------------------------------------------
+//
+TBool CMmPhoneBookOperationRead3g_adn::CheckForEmptyEntry(
+    const TUint8 aFileType,
+    const TDesC8 &aFileData )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::CheckForEmptyEntry" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_CHECKFOREMPTYENTRY, "CMmPhoneBookOperationRead3g_adn::CheckForEmptyEntry" );
+
+    TBool notEmpty( ETrue );
+    TBuf8<KMaxEmptyPatternBuf> emptyData;
+    GetEmptyRecordPattern( aFileType,
+                           emptyData );
+    for( TInt count(0); count < emptyData.Length(); count++ )
+        {
+        if( aFileData[count] == emptyData[count] )
+            {
+            notEmpty = EFalse;
+            break;
+            }
+        }
+    return notEmpty;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookOperationRead3G_adn::UiccGetSearchPattern
+// resolves P2 and search data for command SEARCH RECORD depending on file type
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationRead3g_adn::GetEmptyRecordPattern(
+    const TUint8 aFileType,
+    TDes8& aEmptyPattern )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::GetEmptyRecordPattern" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD3G_ADN_GETEMPTYRECORDPATTERN, "CMmPhoneBookOperationRead3G_adn::GetEmptyRecordPattern" );
+
+    switch( aFileType )
+        {
+        case UICC_ADN_PRIM_TAG:
+            {
+            TInt alphaStringLength( iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[EPhonebookTypeAdn].iAlphaStringlength );
+            // If aplha string field is included in entry, search pattern is
+            // all alpa bytes 'FF' and number length 0 and TON&NPI 'FF'
+            if ( alphaStringLength )
+                {
+                aEmptyPattern.AppendFill( KTagUnusedbyte, alphaStringLength );
+                aEmptyPattern.Append( 0x00 ); // Search for number length zero
+                aEmptyPattern.Append( KTagUnusedbyte ); // and TON&NPI 'FF'
+                }
+            // Alpha string does not exists, search pattern is for empty number
+            else
+                {
+                aEmptyPattern.Append( 0x00 ); // Search for number length zero
+                aEmptyPattern.Append( KTagUnusedbyte ); // and TON&NPI FF
+                }
+            break;
+            }
+        case UICC_IAP_PRIM_TAG:
+            {
+            // Number of bytes in EFiap is same as file amount
+            // in EFpbr list with tag "A9". In other words, count
+            // of type 2 files
+            for( TInt i( 0 ); i < iType2FileArray.Count(); i++ )
+                {
+                aEmptyPattern.Append( 0x00 );
+                }
+            break;
+            }
+        case UICC_ANR_PRIM_TAG:
+            {
+            aEmptyPattern.Append( KTagUnusedbyte ); // Check for AAS record there is none
+            aEmptyPattern.Append( 0x00 ); // For SSC/ BCD Number Length 0
+            aEmptyPattern.Append( KTagUnusedbyte ); //TON&NPI FF
+            aEmptyPattern.Append( KTagUnusedbyte ); // SSC/BCD forst Byte is FF
+            break;
+            }
+        case UICC_SNE_PRIM_TAG:
+        case UICC_EMAIL_PRIM_TAG:
+            {
+            // If first byte of the EF record is 0xFF, the record
+            // is empty
+            aEmptyPattern.Append( KTagUnusedbyte );
+            break;
+            }
+        default:
+            {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationRead3g_adn::GetEmptyRecordPattern: default" );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONREAD3G_ADN_GETEMPTYRECORDPATTERN, "CMmPhoneBookOperationRead3g_adn::GetEmptyRecordPattern : default" );
+            break;
+            }
+        }
+    }
+
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -27,7 +27,7 @@
 #include "cmmmessagerouter.h"
 #include "cmmphonebookoperationwrite.h"
 #include "cmmphonebookalphastring.h"
-#include "osttracedefinitions.h"
+#include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookoperationwritetraces.h"
 #endif
@@ -40,6 +40,8 @@
 
 // CONSTANTS
 
+const TUint8 KOwnNumberTextSize = 20;
+const TUint8 KMaxMobileTelNumberSize = 100;
 // MACROS
     // None
 
@@ -91,7 +93,8 @@
 CMmPhoneBookOperationWrite* CMmPhoneBookOperationWrite::NewL(
     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
     CMmUiccMessHandler* aUiccMessHandler,
-    const CMmDataPackage* aDataPackage ) // Data
+    const CMmDataPackage* aDataPackage,
+    TInt aIpc ) // Data
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::NewL");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_NEWL, "CMmPhoneBookOperationWrite::NewL" );
@@ -101,12 +104,19 @@
     CMmPhoneBookOperationWrite* mmPhoneBookOperationWrite =
         new( ELeave ) CMmPhoneBookOperationWrite();
 
-    const CPhoneBookDataPackage* phoneBookData =
-        static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+    if( ( EMmTsyONStoreWriteIPC != aIpc )&&
+        ( EMmTsyONStoreWriteEntryIPC != aIpc ) )
+        {
+        TName phonebookTypeName;
 
-    phoneBookData->GetPhoneBookName( phonebookTypeName );
-    // Store phonebook name 
-    mmPhoneBookOperationWrite->iPhoneBookTypeName = phonebookTypeName;
+        const CPhoneBookDataPackage* phoneBookData =
+            static_cast<const CPhoneBookDataPackage*>( aDataPackage );
+
+        phoneBookData->GetPhoneBookName( phonebookTypeName );
+        // Store phonebook name 
+        mmPhoneBookOperationWrite->iPhoneBookTypeName = phonebookTypeName;
+        }
+
 
     mmPhoneBookOperationWrite->iMmPhoneBookStoreMessHandler =
         aMmPhoneBookStoreMessHandler;
@@ -143,11 +153,15 @@
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCCREATEREQ, "CMmPhoneBookOperationWrite::UICCCreateReq;aIpc=%hd", aIpc );
     
     TInt ret (KErrNotSupported);
+    iSavedIpc = aIpc;
+    
     const CPhoneBookDataPackage* phoneBookData =
         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
 
-        if( aIpc == EMmTsyPhoneBookStoreWriteIPC )
+        switch( aIpc )
             {
+            case EMmTsyPhoneBookStoreWriteIPC:
+                {
                 TInt16 index( 0 );
                 // Store Entry to the operation which needs to be write in SIM
                 phoneBookData->UnPackData( index, iPhoneBookEntry );
@@ -158,41 +172,95 @@
                     iPhoneBookEntry->iLocation = static_cast<TUint16>( index );
                     
                     // Convert Phone Book name to file id
-                    TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-                    TUint16 pbFileId = ConvertToPBfileId( 
+                    iFileId = ConvertToPBfileId( 
                                          iPhoneBookTypeName,
-                                         fileIdExt,
+                                         iExtFileId,
                                          iMmUiccMessHandler->GetCardType() );
                                          
-                    TUint8 pbArrayIndex ( ConvertToConfArrayIndex( pbFileId ) );
+                    iArrayIndex = ConvertToConfArrayIndex( iFileId );
+                    ret = UiccPbReqWriteL( aTransId, index, *iPhoneBookEntry );
+                    }
+                break;
+                }
+            case EMmTsyONStoreWriteEntryIPC:
+                {
+                iFileId = PB_MSISDN_FID;
+                iExtFileId = PB_EXT1_FID;
+                iArrayIndex = EPhonebookTypeMSISDN;
+                
+                RMobileONStore::TMobileONEntryV1 entry;
+                aDataPackage->UnPackData( entry );
+
+                iPhoneBookEntry = new( ELeave ) CPhoneBookStoreEntry;
+                CleanupStack::PushL( iPhoneBookEntry );
+                iPhoneBookEntry->ConstructL();
+                
+                // Copy index number
+                iPhoneBookEntry->iLocation = entry.iIndex;
+
+                iPhoneBookEntry->iText = HBufC::NewL( KOwnNumberTextSize );
+                // Copy name
+                TPtr ptrToName ( iPhoneBookEntry->iText->Des() );
+                CopyData( entry.iText,  ptrToName );
+
+                iPhoneBookEntry->iNumber = HBufC::NewL( KMaxMobileTelNumberSize );
+                // Copy Number
+                TPtr ptrToNumber( iPhoneBookEntry->iNumber->Des() );
+                CopyData( entry.iNumber.iTelNumber, ptrToNumber );
+                
+                CleanupStack::Pop( iPhoneBookEntry );
+
+                // Send Request 
+                ret = UiccPbReqWriteL( aTransId, entry.iIndex, *iPhoneBookEntry );
 
-                    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
-            {
+                break;
+                }
+            case EMmTsyONStoreWriteIPC:
+                {
+                iFileId = PB_MSISDN_FID;
+                iExtFileId = PB_EXT1_FID;
+                
+                iArrayIndex = EPhonebookTypeMSISDN;
+
+                TDesC8* entry = NULL;
+                aDataPackage->UnPackData( entry );
+
+                // Unpack entry param to get the location
+                RMobileONStore::TMobileONEntryV1Pckg* entryPckg =
+                    reinterpret_cast<RMobileONStore::TMobileONEntryV1Pckg*>( entry );
+                RMobileONStore::TMobileONEntryV1& onEntry = ( *entryPckg )();
+
+                iPhoneBookEntry = new( ELeave ) CPhoneBookStoreEntry;
+                CleanupStack::PushL( iPhoneBookEntry );
+                iPhoneBookEntry->ConstructL();
+                
+                // Copy index number
+                iPhoneBookEntry->iLocation = onEntry.iIndex;
+
+                iPhoneBookEntry->iText = HBufC::NewL( KOwnNumberTextSize );
+                // Copy name
+                TPtr ptrToName ( iPhoneBookEntry->iText->Des() );
+                CopyData( onEntry.iText,  ptrToName );
+
+                iPhoneBookEntry->iNumber = HBufC::NewL( KMaxMobileTelNumberSize );
+                // Copy Number
+                TPtr ptrToNumber( iPhoneBookEntry->iNumber->Des() );
+                CopyData( onEntry.iNumber.iTelNumber, ptrToNumber );
+                
+                CleanupStack::Pop( iPhoneBookEntry );
+
+                // Send Request 
+                ret = UiccPbReqWriteL( aTransId, onEntry.iIndex, *iPhoneBookEntry );
+
+                break;
+                }
+            default:
+                {
 TFLOGSTRING2("TSY: CMmPhoneBookOperationWrite::UICCCreateReq Unknown Ipc: %d", aIpc);
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONWRITE_UICCCREATEREQ, "CMmPhoneBookOperationWrite::UICCCreateReq;Unknown aIpc =%hd", aIpc );
+                 
+                break;
+                }
             }
     return ret;
     }
@@ -212,185 +280,40 @@
 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() )
+    
+    if( ( PB_MBDN_FID == iFileId )&&
+        ( 0 == iCurrentWritePhase ) )
         {
-        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;
-            }
+        iCurrentWritePhase = EPBWritePhase_Read_MBI_profile;
+        // read MBDN record number from MBI first record 
+        //Profile number
+        ret = UiccPbReqReadMBI( aIndex, aTransId );
         }
-        
-    // reserve Space for ext record no
-    iExtRecordArrayToBeWrite.ReserveL( extRecordNo );
-    // File reserved memory with 0
-    for( TInt count = 0; count < extRecordNo; count++ )
+    else
         {
-        iExtRecordArrayToBeWrite.Insert( 0 , count );
-        }
-
-    // Convert Phone Book name to file id
-    TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-    TUint16 pbFileId = ConvertToPBfileId( 
-                          iPhoneBookTypeName,
-                          fileIdExt,
-                          iMmUiccMessHandler->GetCardType() );
-
-    if( UICC_ILLEGAL_FILE_ID != pbFileId )
-        {
-        TUint8 pbArrayIndex ( ConvertToConfArrayIndex( pbFileId ) );
+        // Check for no of EXT records required for Writing this Entry
+        TUint8 extRecordNo ( 0 ); 
+        GetExtRecNum( extRecordNo );
 
         // Check if the index To read is valid
-        if(  aIndex <= iMmPhoneBookStoreMessHandler->
-                iPBStoreConf[pbArrayIndex].iNoOfRecords )
+        if( ( UICC_ILLEGAL_FILE_ID != iFileId ) &&
+            ( aIndex <= iMmPhoneBookStoreMessHandler->
+                 iPBStoreConf[iArrayIndex].iNoOfRecords ) )
             {
-            // if Entry present in list Store it locally
-            TPBEntry entry;
             if( 0 < aIndex )
                 {
-                // Check for index present the store list
-                if( iMmPhoneBookStoreMessHandler->IndexCheckInPBList(
+                ret =  StartWriteEntryIndex( 
                         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
-                    }
+                        extRecordNo, 
+                        aTransId, 
+                        aDataToWrite );                
                 }
             else
                 {
                 // Start Serching For first free Entry in the Stored list
-                TInt index = iMmPhoneBookStoreMessHandler->
-                EmptyEntryCheckInPBList( pbArrayIndex );
-                if( 0 < index )
+                iEntryToWrite = iMmPhoneBookStoreMessHandler->
+                EmptyEntryCheckInPBList( iArrayIndex );
+                if( 0 < iEntryToWrite )
                     {
                     //Check if EXT records Are needed or not
                     if( 0 < extRecordNo )
@@ -398,12 +321,10 @@
                         // 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 );
                         }
@@ -413,8 +334,7 @@
                         // Start Writting Entry
                         iCurrentWritePhase = EPBWritePhase_Write_Entry;
                         ret = UiccPBReqWriteEntry(
-                                pbFileId,
-                                index,
+                                iEntryToWrite,
                                 aTransId,
                                 aDataToWrite );
                         }
@@ -426,7 +346,6 @@
                     iLocationSearch = ETrue;
                     iEntryToWrite = 1;
                     ret = UiccPbReqWriteRead(
-                            pbFileId,
                             iEntryToWrite,
                             aTransId );
                     }
@@ -435,24 +354,19 @@
         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 )
@@ -477,12 +391,11 @@
         }
     
     cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
-    cmdParams.fileId = aFileId;
+    cmdParams.fileId = iFileId;
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
     // Check for valid record number
-    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
     if( aIndex <= iMmPhoneBookStoreMessHandler->
-                     iPBStoreConf[arrayIndex].iNoOfRecords )
+                     iPBStoreConf[iArrayIndex].iNoOfRecords )
         {
         cmdParams.record = aIndex;
         }
@@ -498,21 +411,24 @@
     // Convert the Entry Name from ASCII format to UCS2
     CMmStaticUtility::ConvertUcs2ToGsmUcs2Data( ptrToName, nameBuf );
     if( nameBuf.Length() < iMmPhoneBookStoreMessHandler->
-                           iPBStoreConf[ arrayIndex ].iAlphaStringlength )
+                           iPBStoreConf[iArrayIndex].iAlphaStringlength )
         {
         // Fill rest of the Bytes 
         for( TInt count = nameBuf.Length(); count < ( iMmPhoneBookStoreMessHandler->
-                      iPBStoreConf[ arrayIndex ].iAlphaStringlength ); count++ )
+                      iPBStoreConf[ iArrayIndex ].iAlphaStringlength ); count++ )
             {
             nameBuf.Append( KTagUnusedbyte );
             }
         }
     TBuf8<300>numberBuf;
     TPtr16 ptrToNumber = aDataToWrite.iNumber->Des();
-    iMmPhoneBookStoreMessHandler->ConvertToBCDFromUCS2(
-                                  ptrToNumber,
-                                  numberBuf,
-                                  aFileId );
+    if( ptrToNumber.Length() > 0 )
+        {
+        iMmPhoneBookStoreMessHandler->ConvertToBCDFromUCS2(
+                                      ptrToNumber,
+                                      numberBuf,
+                                      iFileId );
+        }
     
     // Store number length
     TUint8 numLength ( numberBuf.Length() );
@@ -530,7 +446,7 @@
     
     TBuf8<200>fileDataWrite;
     fileDataWrite.Append( nameBuf.Mid( 0, iMmPhoneBookStoreMessHandler->
-                          iPBStoreConf[ arrayIndex ].iAlphaStringlength ) );
+                          iPBStoreConf[ iArrayIndex ].iAlphaStringlength ) );
     fileDataWrite.Append( numLength );
     fileDataWrite.Append( numberBuf.Mid( 0, UICC_EF_EXT_REC_NUM_LEN ) );
     // Append Capability configuration byte as not used
@@ -573,8 +489,6 @@
 TInt CMmPhoneBookOperationWrite::UiccPbReqWriteExt(
         TUint8 aTransId,
         TUint8 aIndex,
-        TUint16 aFileId,
-        TUint16 aFileIdExt,
         CPhoneBookStoreEntry& aDataToWrite )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqWriteExt");
@@ -596,7 +510,7 @@
         cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
         }
     
-    cmdParams.fileId = aFileIdExt;
+    cmdParams.fileId = iExtFileId;
     cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
     
@@ -608,7 +522,7 @@
     iMmPhoneBookStoreMessHandler->ConvertToBCDFromUCS2(
                                   ptrToNumber,
                                   numBuf,
-                                  aFileId );
+                                  iFileId );
     
         if( numBuf.Length() > ( 10 + ( iExtRecordWritten* 11 ) ))
             {
@@ -655,8 +569,7 @@
         
         cmdParams.fileData.Append( extFileData );
 
-    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ));
-    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec )
+    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[iArrayIndex].iExtNoOfRec )
         {
         cmdParams.record = aIndex;
         }
@@ -686,8 +599,6 @@
 // ---------------------------------------------------------------------------
 //
 TInt CMmPhoneBookOperationWrite::UiccPbReqWriteReadExt(
-             TUint16 aFileId,
-             TUint16 aFileIdExt,
              TUint8 aIndex,
              TUint8 aTransId)
     {
@@ -714,16 +625,15 @@
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
     
     // Append File id
-    cmdParams.fileId = aFileIdExt;
+    cmdParams.fileId = iExtFileId;
     
     // 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 )
+                   iPBStoreConf[iArrayIndex].iExtNoOfRec )
         {
         // Append recor number
         cmdParams.record = aIndex;
@@ -751,7 +661,6 @@
 // ---------------------------------------------------------------------------
 //
 TInt CMmPhoneBookOperationWrite::UiccPbReqWriteRead(
-                     TUint16 aFileId,
                      TUint8 aIndex,
                      TUint8 aTransId )
     {
@@ -775,11 +684,10 @@
         }
     
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
-    cmdParams.fileId = aFileId;
+    cmdParams.fileId = iFileId;
     cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
-    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
     if( aIndex <= iMmPhoneBookStoreMessHandler->
-                    iPBStoreConf[arrayIndex].iNoOfRecords )
+                    iPBStoreConf[iArrayIndex].iNoOfRecords )
         {
         cmdParams.record = aIndex;
         }
@@ -805,8 +713,6 @@
 // ---------------------------------------------------------------------------
 //
 TInt CMmPhoneBookOperationWrite::UiccPbReqWriteExtDelete(
-                  TUint16 aFileId,
-                  TUint16 aFileIdExt,
                   TUint8 aIndex,
                   TUint8 aTransId )
     {
@@ -831,14 +737,11 @@
         }
     
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
-    cmdParams.fileId = aFileIdExt;
+    cmdParams.fileId = iExtFileId;
     cmdParams.serviceType =  UICC_APPL_UPDATE_LINEAR_FIXED ;
-    
-    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
-
-    
+   
     if( aIndex <= iMmPhoneBookStoreMessHandler->
-                   iPBStoreConf[arrayIndex].iExtNoOfRec)
+                   iPBStoreConf[iArrayIndex].iExtNoOfRec)
         {
         cmdParams.record = aIndex;
         }
@@ -869,12 +772,92 @@
     }
 
 
+
 // ---------------------------------------------------------------------------
 // CMmPhoneBookOperationWrite::UiccPbReqReadMBI
 // Constructs an ISI-message to Read MBI profile from first record 
 // ---------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationWrite::UiccPbReqReadMBI( TUint8 aIndex, TUint8 aTransId )
+TInt CMmPhoneBookOperationWrite::StartWriteEntryIndex( 
+        TUint16 aIndex,
+        TUint8 aExtRecNo, 
+        TUint8 aTransId, 
+        CPhoneBookStoreEntry& aDataToWrite )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::StartWriteForEntryPresentInList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_STARTWRITEFORENTRYPRESENTINLIST, "CMmPhoneBookOperationWrite::StartWriteForEntryPresentInList" );
+
+    TInt ret( KErrNone );
+    // if Entry present in list Store it locally
+    TPBEntry entry;
+        // Check for index present the store list
+        if( iMmPhoneBookStoreMessHandler->IndexCheckInPBList(
+                aIndex,
+                iArrayIndex,
+                entry ) )
+            {
+            // Check if Entry is present or not 
+            if( entry.iEntryPresent )
+                {
+                // Check if no if ext records are sufficient from 
+                //previous Entry
+                if( aExtRecNo  > entry.PBEntryExtRecord.Count() )
+                    {
+                    ret = CheckForExtRecordNum( entry, aTransId );
+                    }
+                else  
+                    {
+                    // check for reocrds to be delete
+                    ret = ContinueWriteEntry( aExtRecNo, 
+                                              entry, 
+                                              aTransId, 
+                                              aDataToWrite );
+                    }
+                }
+            else
+                {
+                // If entry not present
+                // Check if EXT Records are needed for Entry to be written
+                if( 0 < aExtRecNo )
+                    {
+                    // Search for free ext records 
+                    iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
+                    // Send request To read First EXT record
+                    iExtRecordNo = 1;
+                    ret = UiccPbReqWriteReadExt(
+                            iExtRecordNo,
+                            aTransId );
+                    }
+                else
+                    {
+                    // Start Writting Entry
+                    iCurrentWritePhase = EPBWritePhase_Write_Entry;
+                    TUint8 indexToWrite = iPhoneBookEntry->iLocation;
+                    ret = UiccPBReqWriteEntry(
+                            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( aIndex, aTransId );
+            }
+
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookOperationWrite::UiccPbReqReadMBI
+// Constructs an ISI-message to Read MBI profile from first record 
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::UiccPbReqReadMBI( TUint8 aOffset, TUint8 aTransId )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPbReqReadMBI");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQREADMBI, "CMmPhoneBookOperationWrite::UiccPbReqReadMBI" );
@@ -898,7 +881,17 @@
         cmdParams.fileId = PB_MBI_FID;
         cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
         cmdParams.dataAmount = 1;
-        cmdParams.dataOffset = aIndex;
+        
+        if( aOffset <= iMmPhoneBookStoreMessHandler->
+                iPBStoreConf[iArrayIndex].iMbiRecLen )
+            {
+            cmdParams.dataOffset = aOffset;
+            }
+        else
+            {
+            ret = KErrArgument;
+            }
+        
         cmdParams.record = 1;   // only first profile number is supported
         
         
@@ -920,7 +913,7 @@
 TInt CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile( 
         TUint8 aTransId,
         TUint8 aIndex,
-        TUint8 aOperationType)
+        TUint8 aOperationType )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile");
 OstTrace0( TRACE_FATAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEMBIPROFILE, "CMmPhoneBookOperationWrite::UiccPBReqWriteMBIProfile" );
@@ -984,11 +977,6 @@
     TBool complete ( EFalse );
     TInt ret ( KErrNone );
     
-    TUint16 fileIdExt ( 0x0000 );
-    TUint16 fileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
-    //// Check for PhoenBook Index for which needs to checked
-    TUint8 pbArrayIndex = ConvertToConfArrayIndex( fileId );
-
     switch( iCurrentWritePhase )
         {
         case EPBWritePhase_Read_Entry:
@@ -996,10 +984,7 @@
             ret = HandleWriteReadEntryResp(
                   aStatus,
                   aFileData,
-                  aTransId,
-                  fileId,
-                  fileIdExt,
-                  pbArrayIndex );
+                  aTransId );
             break;
             }
         case EPBWritePhase_Read_Ext_Entry:
@@ -1007,9 +992,7 @@
             ret = HandleWriteReadExtEntryResp(
                   aStatus,
                   aFileData,
-                  aTransId,
-                  fileId,
-                  fileIdExt );
+                  aTransId );
             break;
             }
         case EPBWritePhase_Search_Ext_Entry:
@@ -1017,27 +1000,21 @@
             ret = HandleWriteSearchExtEntryResp(
                   aStatus,
                   aFileData,
-                  aTransId,
-                  fileId,
-                  fileIdExt );
+                  aTransId );
             break;
             }
         case EPBWritePhase_Write_Entry:
             {
             ret = HandleWriteEntryResp(
                   aStatus,
-                  aTransId,
-                  fileId,
-                  fileIdExt );
+                  aTransId );
             break;
             }
         case EPBWritePhase_Write_Ext_Entry:
             {
             ret = HandleWriteExtEntryResp(
                   aStatus,
-                  aTransId,
-                  fileId,
-                  fileIdExt );
+                  aTransId );
             break;
             }
         case EPBWritePhase_Read_MBI_profile:
@@ -1066,33 +1043,97 @@
     
     if( ( KErrNone != ret ) || ( iCurrentWritePhase == EPBWritePhase_complete ))
         {
-        // Complete the to common TSY
-        CPhoneBookDataPackage phoneBookData;
+        switch( iSavedIpc )
+            {
+            case EMmTsyONStoreWriteIPC:
+                {
+                // Reset SavedIpc IPC.
+                iSavedIpc = 0;
+                if( KErrNone != ret )
+                    {
+                    // Complete failed request
+                    iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                            EMmTsyONStoreWriteIPC,
+                            NULL,
+                            ret );
+                    }
+                else
+                    {
+                    // Create data package
+                    CMmDataPackage numberData;
+                    numberData.PackData( &iPhoneBookEntry->iLocation );
 
-        //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;
+                    // Complete request
+                    iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                            EMmTsyONStoreWriteIPC,
+                            &numberData,
+                            ret );
+                    }
+                
+                // delete PhoneBook Entry
+                delete iPhoneBookEntry;
+                break;
+                }
+            case EMmTsyONStoreWriteEntryIPC:
+                {
+                // Reset saved IPC.
+                iSavedIpc = 0;
+                // Complete request
+                iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                        EMmTsyONStoreWriteEntryIPC,
+                        ret );
+                
+                // Delete Phone Book Entry
+                delete iPhoneBookEntry;
+                break;
+                }
+            case EMmTsyPhoneBookStoreWriteIPC:
+                {
+                // 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 )
+                    {
+                    // Convert Phone Book name to file id
+                    pbEntryInfo.iMaxNumLength = iMmPhoneBookStoreMessHandler->
+                                     iPBStoreConf[iArrayIndex].iNumlength;
+                    if( 0 != iPhoneBookEntry->iLocation )
+                        {
+                        pbEntryInfo.iLocation = iPhoneBookEntry->iLocation;
+                        }
+                    else
+                        {
+                        pbEntryInfo.iLocation = iEntryToWrite;
+                        }
+                    }
+                // 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 );
+                break;
+                }
+            default:
+                {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleSimPbRespL - unknown Ipc ");
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONWRITE_HANDLEUICCPBRESPL, "CMmPhoneBookOperationWrite::HandleUICCPbRespL - unknown Ipc" );
+                break;
+                }
             }
-        // 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;
         }
@@ -1108,10 +1149,7 @@
 TInt CMmPhoneBookOperationWrite::HandleWriteReadEntryResp(
     TInt aStatus,
     const TDesC8& aFileData,
-    TUint8 aTransId,
-    TUint16 aFileId,
-    TUint16 aFileIdExt,
-    TUint8 aArrayIndex )
+    TUint8 aTransId )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteReadEntryResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEREADENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteReadEntryResp" );
@@ -1129,7 +1167,7 @@
                 
                 // Check for Ext data present or not
                 if( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
-                            iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13] )
+                            iPBStoreConf[iArrayIndex].iAlphaStringlength+ 13] )
                     {
                     // No EXT Records 
                     // Check if EXT reords needed for Entry to be write
@@ -1142,8 +1180,6 @@
                         // Send request to read first entry in Ext
                         iExtRecordNo = 1;
                         ret = UiccPbReqWriteReadExt(
-                              aFileId,
-                              aFileIdExt,
                               iExtRecordNo,
                               aTransId );
                         }
@@ -1152,7 +1188,7 @@
                         // Start Write main Entry
                         iCurrentWritePhase = EPBWritePhase_Write_Entry;
                         TUint8 indexToWrite ( 0 );
-                        if( PB_MBDN_FID == aFileId )
+                        if( PB_MBDN_FID == iFileId )
                             {
                             indexToWrite = iEntryToWrite;
                             }
@@ -1161,7 +1197,6 @@
                             indexToWrite = iPhoneBookEntry->iLocation;
                             }
                         ret = UiccPBReqWriteEntry(
-                              aFileId,
                               indexToWrite,
                               aTransId,
                               *iPhoneBookEntry );
@@ -1172,15 +1207,13 @@
                     // Append this Record number to be Delete record Array
                     iExtRecordArrayToBeDelete.Append(
                                     iMmPhoneBookStoreMessHandler->
-                                    iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13 );
+                                    iPBStoreConf[iArrayIndex].iAlphaStringlength+ 13 );
                     
                     // Start Reading EXT Record
                     iCurrentWritePhase = EPBWritePhase_Read_Ext_Entry;
                     TUint8 indexToRead = iMmPhoneBookStoreMessHandler->
-                               iPBStoreConf[aArrayIndex].iAlphaStringlength+ 13;
+                               iPBStoreConf[iArrayIndex].iAlphaStringlength+ 13;
                     ret = UiccPbReqWriteReadExt(
-                          aFileId,
-                          aFileIdExt,
                           indexToRead,
                           aTransId );
                     }
@@ -1192,7 +1225,6 @@
                 iCurrentWritePhase = EPBWritePhase_Read_Entry;
                 iEntryToWrite++;
                 ret = UiccPbReqWriteRead(
-                      aFileId,
                       iEntryToWrite,
                       aTransId );
                 }
@@ -1211,8 +1243,6 @@
                 // Send request to read first entry in Ext
                 iExtRecordNo = 1;
                 ret = UiccPbReqWriteReadExt(
-                      aFileId,
-                      aFileIdExt,
                       iExtRecordNo,
                       aTransId);
                 }
@@ -1223,7 +1253,7 @@
                 // Start Write Entry
                 iCurrentWritePhase = EPBWritePhase_Write_Entry;
                 TUint8 index ( 0 ); 
-                if( ( PB_MBDN_FID == aFileId )|| ( 0 == iPhoneBookEntry->iLocation ))
+                if( ( PB_MBDN_FID == iFileId )|| ( 0 == iPhoneBookEntry->iLocation ))
                     {
                     index = iEntryToWrite; 
                     }
@@ -1232,7 +1262,6 @@
                     index = iPhoneBookEntry->iLocation;
                     }
                 ret = UiccPBReqWriteEntry(
-                        aFileId,
                         index,
                         aTransId,
                         *iPhoneBookEntry );
@@ -1259,9 +1288,7 @@
 TInt CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp(
     TInt aStatus,
     const TDesC8& aFileData,
-    TUint8 aTransId,
-    TUint16 aFileId,
-    TUint16 aFileIdExt)
+    TUint8 aTransId )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEREADEXTENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteReadExtEntryResp" );
@@ -1292,8 +1319,6 @@
                     TUint8 index = iExtRecordArrayToBeDelete[
                                         iExtRecordArrayToBeDelete.Count() -1 ];
                     ret = UiccPbReqWriteExtDelete(
-                          aFileId,
-                          aFileIdExt,
                           index,
                           aTransId );
                     }
@@ -1309,8 +1334,6 @@
                     // Start Searching for first location
                     iExtRecordNo = 1;
                     ret = UiccPbReqWriteReadExt(
-                          aFileId,
-                          aFileIdExt,
                           iExtRecordNo,
                           aTransId );
                     }
@@ -1327,8 +1350,6 @@
                     TUint8 index = 
                       iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
                     ret = UiccPbReqWriteExtDelete(
-                          aFileId,
-                          aFileIdExt,
                           index,
                           aTransId );
                     }
@@ -1338,7 +1359,7 @@
                     iCurrentWritePhase = EPBWritePhase_Write_Entry;
                     //last index
                     TUint8 index (0 );
-                    if( PB_MBDN_FID == aFileId )
+                    if( PB_MBDN_FID == iFileId )
                         {
                         index = iEntryToWrite;
                         }
@@ -1347,7 +1368,6 @@
                         index = iPhoneBookEntry->iLocation;
                         }
                     ret = UiccPBReqWriteEntry(
-                          aFileId,
                           index,
                           aTransId,
                           *iPhoneBookEntry );
@@ -1361,8 +1381,6 @@
             // Raed Next 
             iCurrentWritePhase = EPBWritePhase_Read_Ext_Entry;
             ret = UiccPbReqWriteReadExt(
-                  aFileId,
-                  aFileIdExt,
                   aFileData[UICC_EXT_REC_NO_OFFSET],
                   aTransId );
             }
@@ -1383,15 +1401,12 @@
 TInt CMmPhoneBookOperationWrite::HandleWriteSearchExtEntryResp(
     TInt aStatus,
     const TDesC8& aFileData,
-    TUint8 aTransId,
-    TUint16 aFileId,
-    TUint16 aFileIdExt)
+    TUint8 aTransId )
     {
 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
@@ -1413,8 +1428,6 @@
                     TUint8 index = 
                     iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
                     ret = UiccPbReqWriteExtDelete( 
-                            aFileId,
-                            aFileIdExt,
                             index,
                             aTransId );
                     iExtRecordArrayToBeDelete.Remove( 
@@ -1428,7 +1441,7 @@
                     TUint8 index ( 0 );
                         // Start writing main Entry
                     if( ( iPhoneBookEntry->iLocation == 0 )||
-                        ( PB_MBDN_FID == aFileId ) )
+                        ( PB_MBDN_FID == iFileId ) )
                         {
                         index = iEntryToWrite;
                         }
@@ -1439,7 +1452,6 @@
                     if( 0 < index )
                         {
                         ret = UiccPBReqWriteEntry(
-                                aFileId,
                                 index,
                                 aTransId,
                                 *iPhoneBookEntry );
@@ -1456,11 +1468,9 @@
                 iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
                 TUint8 index = iExtRecordNo++;
                 if( index < iMmPhoneBookStoreMessHandler->
-                            iPBStoreConf[ arrayIndex ].iExtNoOfRec )
+                            iPBStoreConf[ iArrayIndex ].iExtNoOfRec )
                     {
                     ret = UiccPbReqWriteReadExt(
-                          aFileId,
-                          aFileIdExt,
                           index,
                           aTransId );
                     }
@@ -1476,11 +1486,9 @@
             iCurrentWritePhase = EPBWritePhase_Search_Ext_Entry;
             TUint8 index = iExtRecordNo++;
             if( index < iMmPhoneBookStoreMessHandler->
-                        iPBStoreConf[ arrayIndex ].iExtNoOfRec )
+                        iPBStoreConf[ iArrayIndex ].iExtNoOfRec )
                 {
                 ret = UiccPbReqWriteReadExt(
-                      aFileId,
-                      aFileIdExt,
                       index,
                       aTransId );
                 }
@@ -1507,21 +1515,18 @@
 //
 TInt CMmPhoneBookOperationWrite::HandleWriteEntryResp(
     TInt aStatus,
-    TUint8 aTransId,
-    TUint16 aFileId,
-    TUint16 aFileIdExt) 
+    TUint8 aTransId )
     {
 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 ) )
+        if( ( 0 == iPhoneBookEntry->iLocation )|| ( PB_MBDN_FID == iFileId ) )
             {
             iEntryToUpdateInList->iEntryIndex = iEntryToWrite;
             iEntryToUpdateInList->iEntryPresent = ETrue;
@@ -1543,31 +1548,29 @@
             ret = UiccPbReqWriteExt(
                     aTransId,
                     index,
-                    aFileId,
-                    aFileIdExt,
                     *iPhoneBookEntry );
             }
         else
             {
             // Remove old Entry from the list 
             TInt index = iMmPhoneBookStoreMessHandler->
-                         GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+                         GetIndexForPresentEntry( iPhoneBookEntry->iLocation, iArrayIndex );
             if( 0 <= index )
                 {
                 iMmPhoneBookStoreMessHandler->UpdateEntryFromList( 
                                                 iEntryToUpdateInList,
                                                 index,
-                                                arrayIndex );
+                                                iArrayIndex );
                 }
             else
                 {
                 // Append the Entry to the List
                 iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
                                                 iEntryToUpdateInList,
-                                                arrayIndex );
+                                                iArrayIndex );
                 }
             // If it is MBDN Phone Book then update MBI File also
-            if( PB_MBDN_FID == aFileId)
+            if( PB_MBDN_FID == iFileId)
                 {
                 // Start Writing MBI file
                 iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
@@ -1586,7 +1589,7 @@
     else
         {
         // If it is a MBDN PhoneBook Then delete MBI profile by writin 0
-        if( PB_MBDN_FID == aFileId)
+        if( PB_MBDN_FID == iFileId)
             {
             // Start Writing MBI file
             iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
@@ -1614,14 +1617,11 @@
 //
 TInt CMmPhoneBookOperationWrite::HandleWriteExtEntryResp(
     TInt aStatus,
-    TUint8 aTransId,
-    TUint16 aFileId,
-    TUint16 aFileIdExt) 
+    TUint8 aTransId )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::HandleWriteExtEntryResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_HANDLEWRITEEXTENTRYRESP, "CMmPhoneBookOperationWrite::HandleWriteExtEntryResp" );
     TInt ret ( KErrNone );
-    TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ));
     
     if( UICC_STATUS_OK  == aStatus )
         {
@@ -1637,12 +1637,12 @@
             // Remove old Entry from the list 
             TInt index = iMmPhoneBookStoreMessHandler->GetIndexForPresentEntry(
                                                         iPhoneBookEntry->iLocation,
-                                                        arrayIndex );
+                                                        iArrayIndex );
             if( 0 <= index )
                 {
                 iMmPhoneBookStoreMessHandler->RemoveExtEntryFromList(
                                                 index,
-                                                arrayIndex);
+                                                iArrayIndex);
                 }
             
             if( iExtRecordArrayToBeDelete.Count() > 0 )
@@ -1652,8 +1652,6 @@
                 TUint8 index = iExtRecordArrayToBeDelete[
                                iExtRecordArrayToBeDelete.Count() -1 ];
                 ret = UiccPbReqWriteExtDelete(
-                              aFileId,
-                              aFileIdExt,
                               index,
                               aTransId );
                 }
@@ -1664,7 +1662,7 @@
                 TUint8 index ( 0 );
                 // Start writing main Entry
                 if( ( iPhoneBookEntry->iLocation == 0 )||
-                      ( PB_MBDN_FID == aFileId ) )
+                      ( PB_MBDN_FID == iFileId ) )
                     {
                     index = iEntryToWrite;
                     }
@@ -1675,7 +1673,6 @@
                 if( 0 < index )
                     {
                     ret = UiccPBReqWriteEntry(
-                          aFileId,
                           index,
                           aTransId,
                           *iPhoneBookEntry );
@@ -1705,8 +1702,6 @@
                 ret = UiccPbReqWriteExt(
                       aTransId,
                       index,
-                      aFileId,
-                      aFileIdExt,
                       *iPhoneBookEntry );
                 }
             else
@@ -1715,23 +1710,23 @@
                 TInt index = iMmPhoneBookStoreMessHandler->
                                 GetIndexForPresentEntry( 
                                   iPhoneBookEntry->iLocation,
-                                  arrayIndex );
+                                  iArrayIndex );
                 if( 0 <= index )
                     {
                     iMmPhoneBookStoreMessHandler->UpdateEntryFromList(
                                                    iEntryToUpdateInList,
                                                    index,
-                                                   arrayIndex );
+                                                   iArrayIndex );
                     }
                 else
                     {
                     // Append the Entry to the List
                     iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
                                                     iEntryToUpdateInList,
-                                                    arrayIndex );
+                                                    iArrayIndex );
                     }
                 // If it is MBDN PhoenBook then update MBI Profile also
-                if( PB_MBDN_FID == aFileId)
+                if( PB_MBDN_FID == iFileId)
                     {
                     // Start Writing MBI file
                     iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
@@ -1751,7 +1746,7 @@
         }
     else
         {
-        if( PB_MBDN_FID == aFileId )
+        if( PB_MBDN_FID == iFileId )
             {
             // Start Writing MBI File
             iCurrentWritePhase = EPBWritePhase_Write_MBI_profile;
@@ -1842,9 +1837,173 @@
             ret = KErrArgument;
             }
         }
+    return ret;
+    }
 
 
+
+
+// ---------------------------------------------------------------------------
+// void CMmPhoneBookOperationWrite::GetExtRecNum
+// Get the total number of Ext records needed for new entry
+// ---------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationWrite::GetExtRecNum( TUint8 &aExtRecordNo )
+{
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::GetExtRecNum");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEMSISDN, "CMmPhoneBookOperationWrite::UiccPbReqWriteMsisdn" );
+
+
+    if( UICC_EF_FDN_NO_EXT_NUM_LEN < iPhoneBookEntry->iNumber->Length() )
+        {
+        aExtRecordNo++;
+        TInt extDataLength = iPhoneBookEntry->iNumber->Length() - 
+                              UICC_EF_FDN_NO_EXT_NUM_LEN;
+        while ( extDataLength > UICC_EF_EXT_REC_NUM_LEN)
+            {
+            aExtRecordNo++;
+            extDataLength = extDataLength - UICC_EF_EXT_REC_NUM_LEN;
+            }
+        }
+    
+    // reserve Space for ext record no
+    iExtRecordArrayToBeWrite.ReserveL( aExtRecordNo );
+    // File reserved memory with 0
+    for( TInt count = 0; count < aExtRecordNo; count++ )
+        {
+        iExtRecordArrayToBeWrite.Insert( 0, count );
+        }
+}
+
+
+
+// ---------------------------------------------------------------------------
+// void CMmPhoneBookOperationWrite::CheckForExtRecordNum
+// Check for EXT number of records for new Entry is sufficiet or not
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::CheckForExtRecordNum( 
+        TPBEntry entry, 
+        TUint8 aTransId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::CheckForExtRecordNum");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_CHECKFOREXTRECORDNUM, "CMmPhoneBookOperationWrite::CheckForExtRecordNum" );
+
+    TInt ret( KErrNone );
+    
+    // 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(
+            iExtRecordNo,
+            aTransId);
+
     return ret;
     }
 
+
+
+// ---------------------------------------------------------------------------
+// void CMmPhoneBookOperationWrite::ContinueWriteEntry
+// Check for records to deleted else start writing new entry
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookOperationWrite::ContinueWriteEntry( 
+        TUint8 aExtRecNo, 
+        TPBEntry entry, 
+        TUint8 aTransId,
+        CPhoneBookStoreEntry& aDataToWrite )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::ContinueWriteEntry");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_CONTINUEWRITEENTRY, "CMmPhoneBookOperationWrite::ContinueWriteEntry" );
+
+    TInt ret( KErrNone );
+    
+    // Check of both records are 0
+    if( ( aExtRecNo == 0 ) && 
+        ( entry.PBEntryExtRecord.Count() == 0 ))
+        {
+        // Start Writing Entry
+        iCurrentWritePhase = EPBWritePhase_Write_Entry;
+        ret = UiccPBReqWriteEntry( 
+                iPhoneBookEntry->iLocation,
+                aTransId,
+                aDataToWrite );
+        }
+    else
+        {
+        // Start copy Ext record number to be write array
+        for( TInt i=0; i <  aExtRecNo; 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=aExtRecNo;
+             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(
+                index,
+                aTransId );
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// void CMmPhoneBookOperationWrite::GetExtRecNum
+// Get the total number of Ext records needed for new entry
+// ---------------------------------------------------------------------------
+//
+void CMmPhoneBookOperationWrite::CopyData( const TDesC16& aSource, TDes16& aTarget )
+{
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::CopyData");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_COPYDATA, "CMmPhoneBookOperationWrite::CopyData" );
+
+TInt temp ( aSource.Length() );
+TInt temp1( aTarget.MaxLength() );
+    if( aSource.Length() <= aTarget.MaxLength() )
+        {
+        // Start Copy Data
+        for( TInt count(0); count < aSource.Length(); count++ )
+            {
+            aTarget.Append( aSource[count] );
+            }
+        }
+}
+
 // End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -37,6 +37,7 @@
 #include "cmmphonebookoperationwrite.h"
 #include "cmmphonebookoperationwrite3g_adn.h"
 #include "cmmphonebookoperationdelete.h"
+#include "cmmphonebookoperationdelete3g_adn.h"
 #include "cmmphonebookstoreoperationlist.h"
 #include "cmmphonebookstoreoperationbase.h"
 #include "cmmmessagerouter.h"
@@ -55,6 +56,10 @@
 // CONSTANTS
 const TUint8 KMaxAnrLength( 100 );
 const TUint8 KMaxSneLength( 241 );
+const TUint8 KOffsetVoicemail( 0 );
+const TUint8 KOffsetFax( 1 );
+const TUint8 KOffsetData( 2 );
+const TUint8 KOffsetOther( 3 );
 
 // MACROS
     // None
@@ -178,19 +183,6 @@
         }
 
     delete iOperationlist;
-
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-    if ( iAas )
-      {
-      iAas->Reset();
-      delete iAas;
-      }
-    if ( iGas )
-      {
-      iGas->Reset();
-      delete iGas;
-      }
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
     }
 
 // ---------------------------------------------------------------------------
@@ -268,6 +260,10 @@
         // processing cache cancel IPC
         iOperationlist->CancelOperation( phonebookTypeName ); // seek from the beginning
         }  // end of EMmTsyPhoneBookStoreCacheCancelIPC
+    else if ( EMobilePhoneGetMailboxNumbers == aIpc )
+        {
+        GetMailboxIdentifiers();
+        }
     else
         { // all other IPC's
         // Check for Empty Index
@@ -315,33 +311,38 @@
     TInt aTraId,
     TInt aStatus,
     TUint8 aDetails,
-    const TDesC8 &aFileData  ) // received data in UICC Server Message
+    const TDesC8 &aFileData ) // received data in UICC Server Message
     {
     TInt ret(KErrNone);
 
-
 TFLOGSTRING2("TSY: CMmPhoneBookStoreMessHandler::ProcessUiccMsg. transactId:%d", aTraId);
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_PROCESSUICCMSG, "CMmPhoneBookStoreMessHandler::ProcessUiccMsg" );
 
-
-    // Check for operation with transaction id
-    CMmPhoneBookStoreOperationBase* operation;
-    operation = iOperationlist->Find( aTraId );
-    if( operation )
+    if ( ETrIdReadMailboxIdentifier != aTraId )
         {
-        if( operation->HandleUICCPbRespL( aStatus, aDetails, aFileData, aTraId ))
+        // Check for operation with transaction id
+        CMmPhoneBookStoreOperationBase* operation;
+        operation = iOperationlist->Find( aTraId );
+        if( operation )
             {
+            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 " );
 
-            // remove operation From the list
-            iOperationlist->RemoveOperationFromList( aTraId );
-            } // End of operation remove from thelist
-        }
-    else
-        {
+                // 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 " );
+            }
+        }
+    else // Mailbox identifiers is special case
+        {
+        HandleGetMailboxIdentifiers( aStatus, aFileData );
         }
 
     return(ret);
@@ -401,11 +402,12 @@
 
         case EMmTsyPhoneBookStoreGetInfoIPC:
         case EMmTsyPhoneBookStoreCacheIPC:
+        case EMmTsyONStoreGetInfoIPC:
             {
 
             if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
                 {
-                //call CmmPhonebookOperationCache Phonebook
+                //call CmmPhonebookOperationCache3G_adn Phonebook
                 pointer = CMmPhoneBookOperationCache3G_adn::NewL(
                         this,
                         iMmUiccMessHandler,
@@ -426,9 +428,8 @@
         case EMmTsyPhoneBookStoreReadIPC:
         case EMmTsyONStoreReadIPC:
         case EMmTsyONStoreReadEntryIPC:
-#ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-        case ECustomReadAlphaStringIPC:
-#endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
+        case EMmTsyONStoreReadSizeIPC:
+        case EMmTsyONStoreWriteSizeIPC:
             {
             //call CmmPhonebookOperatorRead
             if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
@@ -436,18 +437,22 @@
                 pointer = CMmPhoneBookOperationRead::NewL(
                     this,
                     iMmUiccMessHandler,
-                    aDataPackage );
+                    aDataPackage,
+                    aIpc );
                 }
             else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
                 {
-                pointer = CMmPhoneBookOperationRead::NewL(
+                pointer = CMmPhoneBookOperationRead3g_adn::NewL(
                         this,
                         iMmUiccMessHandler,
-                        aDataPackage );
+                        aDataPackage,
+                        aIpc );
                 }
             break;
             }
         case EMmTsyPhoneBookStoreWriteIPC:
+        case EMmTsyONStoreWriteEntryIPC:
+        case EMmTsyONStoreWriteIPC:
             {
             if( UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
                 {
@@ -455,7 +460,8 @@
                 pointer = CMmPhoneBookOperationWrite::NewL(
                     this,
                     iMmUiccMessHandler,
-                    aDataPackage );
+                    aDataPackage,
+                    aIpc);
                 }
             else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
                 {
@@ -464,15 +470,13 @@
                 pointer = CMmPhoneBookOperationWrite3g_adn::NewL(
                     this,
                     iMmUiccMessHandler,
-                    aDataPackage );
+                    aDataPackage,
+                    aIpc );
                 }
             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() )
                 {
@@ -486,25 +490,26 @@
                 {
                 // To be implemented for 3G
                 // needs to be changed after 3G ADN implementation
-                pointer = CMmPhoneBookOperationDelete::NewL(
+                pointer = CMmPhoneBookOperationDelete3g_adn::NewL(
                     this,
                     iMmUiccMessHandler,
                     aDataPackage );
                 }
             break;
             }
-        /*
-        case EMobilePhoneGetMailboxNumbers:
+        case EMmTsyONStoreDeleteIPC:
+        case EMmTsyONStoreDeleteAllIPC:
             {
-            pointer =  new ( ELeave )CMmPhonebookOperationCustom(
-                iMmPhoneBookStoreMessHandler );
-            CleanupStack::PushL( pointer );
-            // Add pointer to array
-            iPtrOperationArray.AppendL( pointer );
-            CleanupStack::Pop( pointer );
+            TName phonebookName;
+            phonebookName.Copy( KETelIccMsisdnPhoneBook );
+            CPhoneBookDataPackage package;
+            package.SetPhoneBookName( phonebookName );
+            pointer = CMmPhoneBookOperationDelete::NewL(
+                this,
+                iMmUiccMessHandler,
+                &package );
             break;
             }
-            */
         default:
             {
             // Nothing to do here
@@ -532,8 +537,7 @@
         TDes8& aNumber,
         CPhoneBookStoreEntry& aEntry,
         const TUint16 aFileId,
-        const TInt aIndexToRead,
-        const TBool aMailboxIdExist )
+        const TInt aIndexToRead )
     {
     // Save Name
 
@@ -581,15 +585,8 @@
 
         }
 
-
-    // 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;
+    aEntry.iLocation = aIndexToRead;
 
     // reset both buffers after storing data to commonTSY buffer
     aName.Zero();
@@ -1190,4 +1187,157 @@
     }
 
 
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetMailboxIdentifiers
+//
+// ---------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreMessHandler::GetMailboxIdentifiers()
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetMailboxIdentifiers");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETMAILBOXNUMBERS, "CMmPhoneBookStoreMessHandler::GetMailboxIdentifiers" );
+    // Set parameters for UICC_APPL_CMD_REQ message
+    TUiccReadLinearFixed params;
+    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+    params.trId = ETrIdReadMailboxIdentifier;
+    params.dataOffset = 0;
+    params.dataAmount = 0;
+    params.record = 1; // Profile 1 is supported only
+
+    params.fileId = KElemFileMailboxIdentifier;
+    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 );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::HandleGetMailboxIdentifiers
+//
+// -----------------------------------------------------------------------------
+//
+void CMmPhoneBookStoreMessHandler::HandleGetMailboxIdentifiers(
+    TInt aStatus,
+    const TDesC8 &aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::HandleGetMailboxIdentifiers");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_HANDLEGETMAILBOXIDENTIFIERS, "CMmPhoneBookStoreMessHandler::HandleGetMailboxIdentifiers" );
+
+    RMobilePhone::TMobilePhoneVoicemailIdsV3* voicemailIds(
+        new ( ELeave ) RMobilePhone::TMobilePhoneVoicemailIdsV3() );
+
+    TPtrC8 data;
+    TInt error( KErrNone );
+
+    if ( ( UICC_STATUS_OK == aStatus ) &&
+        ( KOffsetOther < aFileData.Length() ) )
+        {
+        voicemailIds->iVoice = aFileData[KOffsetVoicemail];
+        voicemailIds->iFax = aFileData[KOffsetFax];
+        voicemailIds->iData = aFileData[KOffsetData];
+        voicemailIds->iOther = aFileData[KOffsetOther];
+        }
+    else
+        {
+        error = KErrGeneral;
+        }
+
+    CMmDataPackage dataPackage;
+    dataPackage.PackData( &voicemailIds );
+    iMessageRouter->Complete(
+        EMobilePhoneGetMailboxNumbers,
+        &dataPackage,
+        error );
+
+    delete voicemailIds;
+    voicemailIds = NULL;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetPBRRecordNum
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreMessHandler::GetPBRRecordNum(
+    TInt aIndexToRead,
+    TUint8 &aPBRRecNum )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetPBRRecordNum");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETPBRRECORDNUM, "CMmPhoneBookStoreMessHandler::GetPBRRecordNum" );
+
+    TInt ret( KErrNone );
+
+    // Calculate The PBR Record Number needs to be read
+    // get the Max no of Entries in one PBR record
+    TInt maxNoOfEntry( iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords  );
+
+    TInt maxNoOfPbrRec( iPBStoreConf[EPhonebookTypeAdn].iPBRNoOfRecords );
+
+    if( maxNoOfPbrRec > 0 )
+        {
+        if( 0 != ( aIndexToRead%( maxNoOfEntry/maxNoOfPbrRec ) ) )
+            {
+            aPBRRecNum = 
+            ( aIndexToRead / ( maxNoOfEntry/maxNoOfPbrRec ) ) + 1;
+            }
+        else
+            {
+            aPBRRecNum = 
+            ( aIndexToRead / ( maxNoOfEntry/maxNoOfPbrRec ) );
+            }
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+    return ret;
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetCurrentEfRecNum
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreMessHandler::GetCurrentEfRecNum(
+    TUint8 aPBRRecNum,
+    TUint8 &aCurrentRecNum, 
+    TInt aIndexToRead )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetCurrentEfRecNum");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETCURRENTEFRECNUM, "CMmPhoneBookStoreMessHandler::GetCurrentEfRecNum" );
+
+    TInt ret( KErrNone );
+    // get ADN anf PBR Max no of records
+    TInt maxNoOfEntry( iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords );
+
+    TInt maxPbrNoOfRec(  iPBStoreConf[EPhonebookTypeAdn].iPBRNoOfRecords );
+
+
+    if( maxPbrNoOfRec > 0 )
+        {
+        // Get the Entry index in Elementary File
+        aCurrentRecNum = aIndexToRead - 
+        ( ( maxNoOfEntry/maxPbrNoOfRec )*
+                ( aPBRRecNum - 1 ) );
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+    return ret;
+    }
+
+
+
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -26,10 +26,6 @@
 #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"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cmmphonebookstoreoperationbaseTraces.h"
@@ -101,45 +97,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::PrepareReq
-// Prepares the operation (makes it ready to be launched).
-// ---------------------------------------------------------------------------
-//
-TInt CMmPhoneBookStoreOperationBase::PrepareReq(
-        TInt /*aIpc*/,
-        const CMmDataPackage* /*aDataPackage*/
-        )
-    {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::PrepareReq - not supported");
-OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_PREPAREREQ, "CMmPhoneBookStoreOperationBase::PrepareReq - not supported" );
-    return KErrNotSupported;
-    }
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::IsPrepared
-// Checks if operation is ready to be launched.
-// ---------------------------------------------------------------------------
-//
-TBool CMmPhoneBookStoreOperationBase::IsPrepared() const
-    {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::IsPrepared");
-OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_ISPREPARED, "CMmPhoneBookStoreOperationBase::IsPrepared" );
-    return EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::LaunchReq
-// Launches activated operation.
-// ---------------------------------------------------------------------------
-//
-TInt CMmPhoneBookStoreOperationBase::LaunchReq()
-    {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::LaunchReq - not supported");
-OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKSTOREOPERATIONBASE_LAUNCHREQ, "CMmPhoneBookStoreOperationBase::LaunchReq - not supported" );
-    return KErrNotSupported;
-    }
-
-// ---------------------------------------------------------------------------
 // CMmPhoneBookStoreOperationBase::CompleteReq
 // Completes the request.
 // ---------------------------------------------------------------------------
@@ -408,221 +365,6 @@
     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
@@ -683,71 +425,6 @@
     }
 
 
-
-
-// ---------------------------------------------------------------------------
-// CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType
-// Converts internal request mask to client ipc request.
-// ---------------------------------------------------------------------------
-//
-void CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType(
-    TInt& aDestination,
-    const TUint8 aSource )
-    {
-TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType - source: %d", aSource );
-OstTraceExt1( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTOPERATIONTOCLIENTIPCTYPE, "CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType;aSource=%hhu", aSource );
-
-    switch( aSource )
-        {
-        case KOperationInit:
-            {
-            aDestination = EMmTsyPhoneBookStoreInitIPC;
-            break;
-            }
-        case KOperationCache:
-            {
-            aDestination = EMmTsyPhoneBookStoreCacheIPC;
-            break;
-            }
-        case KOperationRead:
-            {
-            aDestination = EMmTsyPhoneBookStoreReadIPC;
-            break;
-            }
-        case KOperationWrite:
-        case KOperationReWrite:
-            {
-            aDestination = EMmTsyPhoneBookStoreWriteIPC;
-            break;
-            }
-        case KOperationDelete:
-        case KOperationDeleteWrite:
-            {
-            aDestination = EMmTsyPhoneBookStoreDeleteIPC;
-            break;
-            }
-        case KOperationDeleteAll:
-            {
-            aDestination = EMmTsyPhoneBookStoreDeleteAllIPC;
-            break;
-            }
-        case KOperationGetMailBoxNumber:
-            {
-            aDestination = EMobilePhoneGetMailboxNumbers;
-            break;
-            }
-        default: //KOperationUnknown
-            {
-TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType - Default case" );
-OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTOPERATIONTOCLIENTIPCTYPE, "CMmPhoneBookStoreOperationBase::ConvertOperationToClientIPCType, Default case" );
-            aDestination = KErrNotFound;
-            break;
-            }
-        }
-    }
-
-
-
 // -----------------------------------------------------------------------------
 // CMmPhoneBookOperationRead::EmptyEntryCheck
 // Check for Entry is Empty or not
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonemesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonemesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -65,8 +65,7 @@
 
 // LOCAL CONSTANTS AND MACROS
 
-const TUint8 KPhoneTransId = 6; //hard coded transaction ID
-const TUint8 KImsiSize = 8;
+const TUint8 KPhoneTransId = 6;
 const TUint8 KServiceProviderSize = 36;
 const TUint8 KSpnFileSize = 16;
 
@@ -74,14 +73,26 @@
 const TUint8 KAclStateMask( 4 );
 const TUint8 KNumOfApnsIndex( 0 );
 const TUint8 KApnDataIndex( 1 );
+const TUint8 KCpsLength( 18 );
+const TUint8 KSpnLength( 17 );
+const TUint8 KLineInfoLength( 1 );
+const TUint8 KAclStatusLength( 1 );
+
+const TUint8 KImsiSize = 9;
+const TUint8 KUnusedNibble = 0x0F;
+const TUint8 KImsiStringByteCount = 0;
+const TUint8 KFirstImsiDigit = 1;
+const TUint8 KSecondImsiDigit = 2;
+const TUint8 KNibbleMask = 0x0f;
+const TUint8 KNibbleShift = 4;
 
 // ------------------------------------------------------
 // --- Alternate Line Service (ALS)-related constants ---
 // ------------------------------------------------------
 // Consts for mapping the Als Line values, as used in SIMSON's
 // SIM_SERV_DYNAMIC_FLAGS_STR structure.
-const TUint8 KAlsAuxiliaryLine = 0x00; // ALS alternate line
-const TUint8 KAlsPrimaryLine = 0x01;   // ALS primary line
+const TUint8 KAlsAuxiliaryLine = 0x00;
+const TUint8 KAlsPrimaryLine = 0x01;
 
 // ----------------------------------------------
 // --- (U)ICC Service Table-related constants ---
@@ -130,9 +141,9 @@
 //
 CMmPhoneMessHandler* CMmPhoneMessHandler::NewL
         (
-        CMmPhoNetSender* aPhoNetSender,  //a ptr to the phonet sender
-        CMmPhoNetReceiver* aPhoNetReceiver,  //a ptr to the phonet receiver
-        CMmMessageRouter* aMessageRouter, // pointer to the msg router
+        CMmPhoNetSender* aPhoNetSender,
+        CMmPhoNetReceiver* aPhoNetReceiver,
+        CMmMessageRouter* aMessageRouter,
         CMmSupplServMessHandler* aSupplServMessHandler,
         CMmUiccMessHandler* aUiccMessHandler
         )
@@ -145,9 +156,11 @@
 
     CleanupStack::PushL( phoneMessHandler );
     phoneMessHandler->iPhoNetSender = aPhoNetSender;
-    phoneMessHandler->ConstructL( aMessageRouter );
-    phoneMessHandler->iSupplServMessHandler = aSupplServMessHandler;
-    phoneMessHandler->iMmUiccMessHandler = aUiccMessHandler;
+    phoneMessHandler->ConstructL(
+        aMessageRouter,
+        aPhoNetSender,
+        aSupplServMessHandler,
+        aUiccMessHandler );
 
     aPhoNetReceiver->RegisterL(
         phoneMessHandler,
@@ -180,19 +193,24 @@
 //
 void CMmPhoneMessHandler::ConstructL
         (
-        CMmMessageRouter* aMessageRouter
+        CMmMessageRouter* aMessageRouter,
+        CMmPhoNetSender* aPhoNetSender,
+        CMmSupplServMessHandler* aSupplServMessHandler,
+        CMmUiccMessHandler* aUiccMessHandler
         )
     {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::ConstructL");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_CONSTRUCTL, "CMmPhoneMessHandler::ConstructL" );
 
-    // Internal pointers, must be nulled before used.
+    iPhoNetSender = aPhoNetSender;
+    iSupplServMessHandler = aSupplServMessHandler;
+    iMmUiccMessHandler = aUiccMessHandler;
+    iMessageRouter = aMessageRouter;
+
     iSSTFileData = NULL;
     iStoreInfo = NULL;
     iLocIndex = 0;
 
-    iMessageRouter = aMessageRouter;
-
     iCommonTSYRefreshPending = EFalse;
     iRefreshError = EFalse;
     iCompleteRefresfDone = EFalse;
@@ -212,16 +230,13 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler destructed.");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEMESSHANDLER_CMMPHONEMESSHANDLER, "CMmPhoneMessHandler::~CMmPhoneMessHandler" );
 
-    // Delete iStoreInfo and set it to NULL, if it exist.
     if( iStoreInfo )
         {
         delete iStoreInfo;
         }
 
-    // Delete iSSTFileData and set it to NULL, if it exist.
     if( iSSTFileData )
         {
-        // Delete object
         delete iSSTFileData;
         }
 
@@ -352,19 +367,12 @@
 TInt CMmPhoneMessHandler::ExtFuncL
         (
         TInt aIpc,
-        const CMmDataPackage* aDataPackage // Data package
+        const CMmDataPackage* aDataPackage
         )
     {
 TFLOGSTRING2("TSY: CMmPhoneMessHandler::ExtFuncL. Licensee specific implemtantion. IPC: %d", aIpc);
 OstTrace1( TRACE_NORMAL, CMMPHONEMESSHANDLER_EXTFUNCL, "CMmPhoneMessHandler::ExtFuncL;Licensee specific implemtantion aIpc=%d", aIpc );
 
-    //*************************************************************//
-    // NOTE.
-    //
-    // LICENSEE SPECIFIC MESSAGE HANDLER IMPLEMENTATION STARTS HERE
-    //
-    //*************************************************************//
-
     TInt ret( KErrNone );
     TUint8 transId( KPhoneTransId );
 
@@ -378,8 +386,15 @@
         case EMobilePhoneSetALSLine:
             {
             TUint8 alsLine;
-            aDataPackage->UnPackData( alsLine );
-            ret = UiccWriteDynamicFlagsReq( alsLine );
+            if ( aDataPackage )
+                {
+                aDataPackage->UnPackData( alsLine );
+                ret = UiccWriteDynamicFlagsReq( alsLine );
+                }
+            else
+                {
+                ret = KErrArgument;
+                }
             break;
             }
         case EMobilePhoneGetCustomerServiceProfile:
@@ -567,7 +582,7 @@
 //
 void CMmPhoneMessHandler::ReceiveMessageL
         (
-        const TIsiReceiveC &aIsiMessage  // ISI message received
+        const TIsiReceiveC &aIsiMessage
         )
     {
     TInt resource( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_RESOURCEID ) );
@@ -584,44 +599,31 @@
         case PN_MODEM_INFO:
 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
             {
-            switch( messageId )
+            if ( INFO_SERIAL_NUMBER_READ_RESP == messageId )
                 {
-                case INFO_SERIAL_NUMBER_READ_RESP:
-                    {
-                    InfoSerialNumberReadResp( aIsiMessage );
-                    break;
-                    }
-                default:
-                    {
+                InfoSerialNumberReadResp( aIsiMessage );
+                }
+            else
+                {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::ReceiveMessageL, switch resource - case PN_MODEM_INFO, switch messageId - default.\n" );
 OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEMESSHANDLER_RECEIVEMESSAGEL, "CMmPhoneMessHandler::ReceiveMessageL, switch resource - case PN_MODEM_INFO, switch messageId - default" );
-                    break;
-                    }
                 }
             break; // end case PN_MODEM_INFO
             }
         case PN_UICC:
             {
-            switch( messageId )
+            if ( UICC_REFRESH_IND == messageId )
                 {
-                case UICC_REFRESH_IND:
-                    {
-                    UiccRefreshInd( aIsiMessage );
-                    break;
-                    }
-                case UICC_REFRESH_RESP:
-                    {
-                    UiccRefreshResp( aIsiMessage );
-                    break;
-                    }
-                default:
-                    {
-                    break;
-                    }
+                UiccRefreshInd( aIsiMessage );
                 }
+            else if ( UICC_REFRESH_RESP == messageId )
+                {
+                UiccRefreshResp( aIsiMessage );
+                }
+            // No else
             break;
             }
-        default:
+       default:
             {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::ReceiveMessageL, switch resource - default.\n" );
 OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEMESSHANDLER_RECEIVEMESSAGEL, "CMmPhoneMessHandler::ReceiveMessageL, switch resource - default" );
@@ -632,13 +634,13 @@
 
 // --------------------------------------------------------------------------
 // CMmPhoneMessHandler::InfoSerialNumberReadReq
-// Constructs INFO_SERIAL_NUMBER_READ_REQ ISI message..
+// Constructs INFO_SERIAL_NUMBER_READ_REQ ISI message.
 // Returns KErrNone on success, other error value on failure.
 // --------------------------------------------------------------------------
 //
 TInt CMmPhoneMessHandler::InfoSerialNumberReadReq
         (
-        TUint8 aTransactionId, // transaction id
+        TUint8 aTransactionId,
         TUint8 aTarget // type of requested serial number
         )
     {
@@ -673,54 +675,49 @@
 
     TBuf8<KSerialNumberLength> serialData;
 
-    // Get status
     TUint8 status( aIsiMessage.Get8bit(
         ISI_HEADER_SIZE + INFO_SERIAL_NUMBER_READ_RESP_OFFSET_STATUS ) );
 
 TFLOGSTRING2("TSY: CMmPhoneMessHandler::InfoSerialNumberReadResp, status=0x%02x",status);
 OstTraceExt1( TRACE_NORMAL, CMMPHONEMESSHANDLER_INFOSERIALNUMBERREADRESP, "CMmPhoneMessHandler::InfoSerialNumberReadResp;status=%hhx", status );
 
-    // If status is Ok get information from possible sub block(s).
+    // Get information from possible sub block(s).
     if ( INFO_OK == status )
         {
+        TBool subblockFound( EFalse );
+        TUint sbSerialNumberStartOffset( 0 );
+
         // If sub blocks
         if ( 0 != aIsiMessage.Get8bit(
             ISI_HEADER_SIZE +
             INFO_SERIAL_NUMBER_READ_RESP_OFFSET_SUBBLOCKCOUNT ) )
             {
-            TUint sbSerialNumberStartOffset( 0 );
+            subblockFound = ETrue;
+            }
 
-            if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
-                ISI_HEADER_SIZE + SIZE_INFO_SERIAL_NUMBER_READ_RESP,
-                INFO_SB_SN_IMEI_PLAIN,
-                EIsiSubBlockTypeId8Len8,
-                sbSerialNumberStartOffset ) )
-                {
-                // Read the string length - the zero terminator...
-                TUint8 strLength( aIsiMessage.Get8bit(
-                    sbSerialNumberStartOffset +
-                    INFO_SB_SN_IMEI_PLAIN_OFFSET_STRLEN ) - 1 );
-                // ...and compare it to the available buffer size
-                // (50 bytes in etel),
-                // and choose the shorter one strLength =
-                // ( RMobilePhone::KPhoneSerialNumberSize > strLength )?
-                // strLength : RMobilePhone::KPhoneSerialNumberSize;
+        if ( subblockFound && ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+            ISI_HEADER_SIZE + SIZE_INFO_SERIAL_NUMBER_READ_RESP,
+            INFO_SB_SN_IMEI_PLAIN,
+            EIsiSubBlockTypeId8Len8,
+            sbSerialNumberStartOffset ) ) )
+            {
+            // Read the string length - the zero terminator
+            TUint8 strLength( aIsiMessage.Get8bit(
+                sbSerialNumberStartOffset +
+                INFO_SB_SN_IMEI_PLAIN_OFFSET_STRLEN ) - 1 );
 
-                TUint8 dataOffset(
-                    sbSerialNumberStartOffset +
-                    INFO_SB_SN_IMEI_PLAIN_OFFSET_IMEIPLAINU8 );
+            TUint8 dataOffset(
+                sbSerialNumberStartOffset +
+                INFO_SB_SN_IMEI_PLAIN_OFFSET_IMEIPLAINU8 );
 
-                serialData.Append( aIsiMessage.GetData(
-                    dataOffset,
-                    strLength ).Left( KSerialNumberLength ) );
+            serialData.Append( aIsiMessage.GetData(
+                dataOffset,
+                strLength ).Left( KSerialNumberLength ) );
 
-                err = KErrNone;
-                }
+            err = KErrNone;
             }
         }
 
-    // Complete to CommonTSY, ONLY if all data has already been received
-    // packed parameter: TBuf8<KSerialNumberLength> serialData
     CMmDataPackage dataPackage;
     dataPackage.PackData( &serialData );
     iMessageRouter->Complete( EMobilePhoneGetPhoneId, &dataPackage, err );
@@ -736,22 +733,13 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadDynamicFlagsReq");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADDYNAMICFLAGSREQ, "CMmPhoneMessHandler::UiccReadDynamicFlagsReq" );
 
-    // Set parameters for UICC_APPL_CMD_REQ message
-    TUiccWriteTransparent params;
-    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-    params.trId = ETrIdReadDynamicFlags;
-    params.dataOffset = 0;
-    params.dataAmount = 0;
-    params.fileId = KElemFileDynFlagsOrange;
-    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( KOrangeDedicatedFile >> 8 );
-    params.filePath.Append( KOrangeDedicatedFile );
-
-    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    return UiccApplCmdReq(
+        ETrIdReadDynamicFlags,
+        UICC_APPL_READ_TRANSPARENT,
+        0,
+        0,
+        KElemFileDynFlagsOrange,
+        UICC_SFI_NOT_PRESENT );
     }
 
 // --------------------------------------------------------------------------
@@ -785,24 +773,19 @@
 
     if ( KErrNone == ret )
         {
-        // Set parameters for UICC_APPL_CMD_REQ message
-        TUiccWriteTransparent params;
-        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-        params.trId = ETrIdWriteDynamicFlags;
-        params.dataOffset = 0;
-        params.fileId = KElemFileDynFlagsOrange;
-        params.fileIdSfi = UICC_SFI_NOT_PRESENT;
-        params.serviceType = UICC_APPL_UPDATE_TRANSPARENT;
+        TBuf8<KLineInfoLength> fileData;
+        fileData.Append( line );
+        ret = UiccApplCmdReq(
+            ETrIdWriteDynamicFlags,
+            UICC_APPL_UPDATE_TRANSPARENT,
+            0,
+            0,
+            KElemFileDynFlagsOrange,
+            UICC_SFI_NOT_PRESENT,
+            fileData);
+        }
+    // No else
 
-        // File id path
-        params.filePath.Append( KMasterFileId >> 8 );
-        params.filePath.Append( KMasterFileId );
-        params.filePath.Append( KOrangeDedicatedFile >> 8 );
-        params.filePath.Append( KOrangeDedicatedFile );
-
-        params.fileData.Append( line );
-        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
-        }
     return ret;
     }
 
@@ -822,9 +805,9 @@
         ( RMobilePhone::EAlternateLineUnknown );
 
     TInt ret( KErrNone );
-    if ( UICC_STATUS_OK == aStatus )
+    if ( UICC_STATUS_OK == aStatus && ( 0 < aFileData.Length() ) )
         {
-        // Dynamic flags byte: if bit 0 is 1, it is line 1, else line 2
+        // Dynamic flags byte
         if ( aFileData[0] & 0x1 )
             {
             alsLine = RMobilePhone::EAlternateLinePrimary;
@@ -875,21 +858,13 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccCspFileReq");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCCSPFILEREQ, "CMmPhoneMessHandler::UiccCspFileReq" );
 
-    // Set parameters for UICC_APPL_CMD_REQ message
-    TUiccReadTransparent params;
-    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-    params.trId = ETrIdReadCsp;
-    params.dataAmount = 18;
-    params.dataOffset = 0; // Read from first byte
-    params.fileId = KElemFileCustomerServiceProfile;
-    params.serviceType = UICC_APPL_READ_TRANSPARENT;
-
-    // File id path
-    params.filePath.Append( KMasterFileId >> 8 );
-    params.filePath.Append( KMasterFileId );
-    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
-
-    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    return UiccApplCmdReq(
+        ETrIdReadCsp,
+        UICC_APPL_READ_TRANSPARENT,
+        18,
+        0,
+        KElemFileCustomerServiceProfile,
+        UICC_SFI_NOT_PRESENT );
     }
 
 // --------------------------------------------------------------------------
@@ -905,7 +880,7 @@
 
     RMobilePhone::TMobilePhoneCspFileV1 cspFileEtel;
 
-    if ( aStatus == KErrNone )
+    if ( aStatus == KErrNone && ( KCpsLength <= aFileData.Length() ) )
         {
         TUint8 i( 0 );
         // Call offering capabilities
@@ -961,13 +936,12 @@
             {
             cspFileEtel.iValueAddedServices = aFileData[i++];
             }
-        } // End of if ( aStatus == KErrNone )
+        } // End of if
     else
         {
         aStatus = KErrNotFound;
         }
 
-    // Complete with CSP data and error code
     CMmDataPackage dataPackage;
     dataPackage.PackData( &cspFileEtel );
 
@@ -987,22 +961,13 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccImsiReq");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCIMSIREQ, "CMmPhoneMessHandler::UiccImsiReq" );
 
-    // Set parameters for UICC_APPL_CMD_REQ message
-    TUiccReadTransparent params;
-    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-    params.trId = ETrIdReadImsi;
-    params.dataAmount = 9; // Length + IMSI = 9 bytes
-    params.dataOffset = 0; // Read from first byte
-    params.fileId = KElemFileImsi;
-    params.fileIdSfi = 7;
-    params.serviceType = UICC_APPL_READ_TRANSPARENT;
-
-    // File id path
-    params.filePath.Append( KMasterFileId >> 8 );
-    params.filePath.Append( KMasterFileId );
-    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
-
-    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    return UiccApplCmdReq(
+        ETrIdReadImsi,
+        UICC_APPL_READ_TRANSPARENT,
+        9,
+        0,
+        KElemFileImsi,
+        7 );
     }
 
 // --------------------------------------------------------------------------
@@ -1017,60 +982,50 @@
 
     TInt err( KErrNone );
     TBuf8<RMobilePhone::KIMSISize> imsiData;
-    if ( UICC_STATUS_OK == aStatus )
+
+    if ( ( UICC_STATUS_OK == aStatus ) &&
+         ( KImsiSize == aFileData.Length() ) )
         {
-        TUint8 i( 0 );
-        TUint8 valueMSB( 0 );
-        TUint8 valueLSB( 0 );
-        // Get length of IMSI (the first byte)
-        TUint8 lengthOfImsi( aFileData[0] );
-        // Get the first IMSI number: MSB semioctet of byte 2
-        valueMSB = static_cast<TUint8>( aFileData[1] >> 4 );
-        // Check the validity
-        if ( KImsiSize >= lengthOfImsi && 10 > valueMSB  )
-            {
-            imsiData.AppendNum( valueMSB, EDecimal);
-            }
-        else
-            {
-            err = KErrCorrupt;
-            }
+        // 1st digit of the buffer is byte count (see 3GPP TS 51.011
+        // 10.3.2 EFIMSI (IMSI)). Get first IMSI number from second byte higher
+        // nibbles. Lower part has parity information and it is ignored.
+        imsiData.AppendNum( 
+            ( ( aFileData[KFirstImsiDigit]>> KNibbleShift )&KNibbleMask ),
+            EDecimal );
 
-        if ( KErrNone == err )
+        for( TUint8 i = KSecondImsiDigit;
+             i <= aFileData[KImsiStringByteCount];
+             i++ )
             {
-            // Check and append the rest of IMSI numbers
-            for ( i = 2; i <= lengthOfImsi; i++ )
+            // Unused nibbles are set to 'F' so pack only valid digits.
+            if ( KUnusedNibble != aFileData[i]&KNibbleMask )
+                {
+                imsiData.AppendNum( ( ( aFileData[i]&KNibbleMask ) ), EDecimal );
+                }
+            else
                 {
-                valueLSB = static_cast<TUint8>( aFileData[i] & 0x0F );
-                valueMSB = static_cast<TUint8>( aFileData[i] >> 4 );
-
-                // If both values are valid
-                if ( 10 > valueLSB && 10 > valueMSB )
-                    {
-                    imsiData.AppendNum( valueLSB, EDecimal);
-                    imsiData.AppendNum( valueMSB, EDecimal);
-                    }
-                // Last nibble is unused
-                else if( 10 > valueLSB && 0xF == valueMSB )
-                    {
-                    imsiData.AppendNum( valueLSB, EDecimal);
-                    break;
-                    }
-                // Either is invalid
-                else
-                    {
-                    err = KErrCorrupt;
-                    break;
-                    }
+                // Last digit found.
+                break;
+                }
+            if ( KUnusedNibble != ( ( aFileData[i]>>KNibbleShift )&KNibbleMask ) )
+                {
+                imsiData.AppendNum( 
+                    ( ( aFileData[i]>>KNibbleShift )&KNibbleMask ),
+                    EDecimal );
+                }
+            else
+                {
+                // Last digit found.
+                break;
                 }
             }
+        err = KErrNone;
         }
     else
         {
         err = KErrNotFound;
         }
 
-    // Complete with packed parameter
     CMmDataPackage dataPackage;
     dataPackage.PackData( &imsiData );
 
@@ -1090,23 +1045,13 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadServiceProviderName");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADSERVICEPROVIDERNAME, "CMmPhoneMessHandler::UiccReadServiceProviderName" );
 
-    // Read SIM file '6F46', Service Provider Name
-    // Set parameters for UICC_APPL_CMD_REQ message
-    TUiccReadTransparent params;
-    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-    params.trId = ETrIdReadServiceProviderName;
-    // Read all 17 bytes
-    params.dataAmount = 17;
-    params.dataOffset = 0;
-    params.fileId = KElemFileServiceProviderName;
-    params.serviceType = UICC_APPL_READ_TRANSPARENT;
-
-    // File id path
-    params.filePath.Append( KMasterFileId >> 8 );
-    params.filePath.Append( KMasterFileId );
-    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
-
-    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    return UiccApplCmdReq(
+        ETrIdReadServiceProviderName,
+        UICC_APPL_READ_TRANSPARENT,
+        17,
+        0,
+        KElemFileServiceProviderName,
+        UICC_SFI_NOT_PRESENT );
     }
 
 // --------------------------------------------------------------------------
@@ -1121,8 +1066,8 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadServiceProviderNameResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADSERVICEPROVIDERNAMERESP, "CMmPhoneMessHandler::UiccReadServiceProviderNameResp" );
 
-    TInt ret( KErrNone );
-    if ( KErrNone == aStatus )
+    TInt ret( KErrNotFound );
+    if ( KErrNone == aStatus && ( KSpnLength == aFileData.Length() ) )
         {
         // Store data and read SPN display info
         ret = UiccProcessServiceTypeCheck( aFileData );
@@ -1230,7 +1175,6 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccProcessServiceTypeCheck");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCPROCESSSERVICETYPECHECK, "CMmPhoneMessHandler::UiccProcessServiceTypeCheck" );
 
-    // Copy service provider name, starting from byte 2
     TBuf8<KSpnFileSize> spnBuffer( aFileData.Mid( 1 ) );
     TBuf8<KServiceProviderSize> spnOutputBuffer;
     CMmStaticUtility::ConvertGsmDataToUcs2(
@@ -1266,12 +1210,10 @@
         iSecondDisplayCondition = RMobilePhone::KDisplaySPNRequired;
         }
 
-    // PLMN and SPN control information summed up to iDisplayReq field
     iServiceProviderName.iDisplayReq =
         iServiceProviderName.iDisplayReq + iSecondDisplayCondition;
 TFLOGSTRING2("TSY: CMmPhoneMessHandler::UiccProcessServiceTypeCheck - display condition: %d", (TUint8)iServiceProviderName.iDisplayReq);
 
-    // Buffer for service provider name
     TBuf16<KSpnFileSize> tempBuf;
     TIsiUtility::CopyFromBigEndian( spnOutputBuffer, tempBuf );
     // Copy service provider name
@@ -1281,23 +1223,13 @@
 
     // We still need to get the PLMN list to complete the information.
     // Read the SIM file EF SPDI ('6FCD')
-    // Set parameters for UICC_APPL_CMD_REQ message
-    TUiccReadTransparent params;
-    params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
-    params.trId = ETrIdReadServiceProviderDisplayInfo;
-    // Read all the data
-    params.dataAmount = 0;
-    params.dataOffset = 0;
-    params.fileId = KElemFileServiceProviderDisplayInfo;
-    params.fileIdSfi = 0x1B;
-    params.serviceType = UICC_APPL_READ_TRANSPARENT;
-
-    // File id path
-    params.filePath.Append( KMasterFileId >> 8 );
-    params.filePath.Append( KMasterFileId );
-    params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
-
-    return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+    return UiccApplCmdReq(
+        ETrIdReadServiceProviderDisplayInfo,
+        UICC_APPL_READ_TRANSPARENT,
+        0,
+        0,
+        KElemFileServiceProviderDisplayInfo,
+        0x1B );
     }
 
 // --------------------------------------------------------------------------
@@ -1320,7 +1252,6 @@
         TInt lengthOfLengthInBytes( 0 );
 
         // Display info is coded in TLV format in USIM.
-        // Check the tag
         if ( 0xA3 == aFileData[i] )
             {
             i++;
@@ -1333,7 +1264,6 @@
                 }
             i++;
 
-            // Check the tag
             if ( 0x80 == aFileData[i] )
                 {
                 // Check how many bytes are used for length field
@@ -1377,18 +1307,15 @@
     // Copy PLMNs and complete
     if ( KErrNone == aStatus )
         {
-        // Number of PLMNs cannot exceed 170
         if ( 170 < numOfPlmns )
             {
             numOfPlmns = 170;
             }
 
-        // At first append number of PLMNs and second display condition
         TUint16 word( static_cast<TUint16>(
                 numOfPlmns << 8 | iSecondDisplayCondition ) );
         iServiceProviderName.iPLMNField.Append( word );
 
-        // Copy PLMNs to 16 bit buffer
         for ( TUint8 j( 0 ); j < lengthOfDataInBytes / 2; j++, i += 2 )
             {
             // PLMN entries are copied to 16-bit buffer as follows:
@@ -1398,10 +1325,9 @@
                 ( aFileData[i+1] << 8 ) | aFileData[i] );
             iServiceProviderName.iPLMNField.Append( word );
             }
-        // Last word is added
+
         iServiceProviderName.iPLMNField.Append( ( 0xFF << 8 ) | aFileData[i] );
 
-        // Complete SPN info
         CMmDataPackage dataPackage;
         dataPackage.PackData( &iServiceProviderName );
         iMessageRouter->Complete(
@@ -1409,14 +1335,13 @@
             &dataPackage,
             KErrNone );
         }
-    else // Complete error without data
+    else
         {
         iMessageRouter->Complete(
              EMobilePhoneGetServiceProviderName,
              KErrNotFound );
         }
 
-    // Reset iServiceProviderName for next time.
     iServiceProviderName.iSPName.Zero();
     iServiceProviderName.iPLMNField.Zero();
     }
@@ -1485,7 +1410,7 @@
     // If NTSY or CTSY cacheing is ongoing, message is not sent
     if ( ! iCommonTSYRefreshPending && ! iInternalRefreshFiles )
         {
-        if ( iRefreshError ) // Some cacheing was failed, set error status
+        if ( iRefreshError ) // Some cacheing was failed
             {
             aStatus = UICC_REFRESH_NOT_OK;
             }
@@ -1508,8 +1433,8 @@
         ret = iPhoNetSender->Send( isiMsg.Complete() );
         iRefreshError = EFalse;
 
-        // When NTSY/CTSY refresh was performed, set iCompleteRefresfDone flag
-        // that IPC EMmTsySimRefreshDoneIPC will be completed to CTSY
+        // When NTSY/CTSY refresh was performed
+        // IPC EMmTsySimRefreshDoneIPC will be completed to CTSY
         if ( UICC_REFRESH_DONE == aStatus || UICC_REFRESH_NOT_OK == aStatus )
             {
             iCompleteRefresfDone = ETrue;
@@ -1597,7 +1522,6 @@
                     EMobilePhoneNotifyAPNListChanged,
                     KErrNone );
 
-                // Clear and delete cache
                 if ( iAPNList )
                     {
                     iAPNList->Reset();
@@ -1703,7 +1627,6 @@
         if ( !( refreshFiles & KCacheAdn )
             && !( refreshFiles & KCacheFdn ) )
             {
-            // Creating buffer for phonebook's name
             TName phonebookName;
             phonebookName.Copy( KInternalPhoneBookType );
 
@@ -1726,7 +1649,6 @@
 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 );
 
@@ -1737,8 +1659,6 @@
             KErrNone );
         }
 
-    // Send refresh done to UICC only if there's no CTSY/NTSY
-    // caching ongoing.
     if ( ! iCommonTSYRefreshPending && ! iInternalRefreshFiles )
         {
         UiccRefreshReq( UICC_REFRESH_DONE );
@@ -1921,22 +1841,13 @@
     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 );
+        ret = UiccApplCmdReq(
+            ETrIdAclStatusReadEfEst,
+            UICC_APPL_READ_TRANSPARENT,
+            0,
+            0,
+            KElemEst,
+            5 );
         }
     else
         {
@@ -1963,7 +1874,7 @@
     TInt ret( KErrNone );
     RMobilePhone::TAPNControlListServiceStatus aclStatus;
 
-    if( UICC_STATUS_OK == aStatus )
+    if( ( UICC_STATUS_OK == aStatus ) && ( 0 < aFileData.Length() ) )
         {
         TUint8 aclState( aFileData[0] & KAclStateMask );
         if( aclState )
@@ -1982,7 +1893,6 @@
         ret = KErrAccessDenied;
         }
 
-    // complete with packed parameter
     CMmDataPackage dataPackage;
 
     if( KErrNone == ret )
@@ -1990,7 +1900,7 @@
         dataPackage.PackData( &aclStatus );
         }
 
-    iACLIsProgress = EFalse; //set ACL flag
+    iACLIsProgress = EFalse;
     iMessageRouter->Complete(
         EMobilePhoneGetAPNControlListServiceStatus,
         &dataPackage,
@@ -2011,40 +1921,42 @@
 
     TInt ret( KErrNone );
     TBool completeNeeded( ETrue );
+    TUint8 aclState( 0 );
 
-    if( UICC_STATUS_OK == aStatus )
+    if ( 0 < aFileData.Length() )
         {
-        TUint8 aclState( aFileData[0] );
-        if( aclState & KAclStateMask )
+        aclState = aFileData[0];
+        }
+
+    if ( ( UICC_STATUS_OK == aStatus ) && ( aclState & KAclStateMask ) )
+        {
+        if ( RMobilePhone::EAPNControlListServiceDisabled == iAclStatus )
             {
-            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" );
-                }
+            // ACL state is enabled and we need to set it to disabled.
+            // So EFest needs to be updated
+            completeNeeded = EFalse;
+            UiccSetAclStatusWriteEfEstReq( aclState );
             }
         else
             {
-            if( RMobilePhone::EAPNControlListServiceEnabled == iAclStatus )
-                {
-                // EFest needs to be updated
-                completeNeeded = EFalse;
-                UiccSetAclStatusWriteEfEstReq( aclState );
-                }
-            else
-                {
-                // ACL status already correct, let's complete
+            // 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 ( ( UICC_STATUS_OK == aStatus ) && ( ! aclState & KAclStateMask ) )
+        {
+        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
@@ -2057,8 +1969,7 @@
 
     if( completeNeeded )
         {
-        // set flag and complete
-        iACLIsProgress = EFalse; //set ACL flag
+        iACLIsProgress = EFalse;
         iMessageRouter->Complete(
             EMobilePhoneSetAPNControlListServiceStatus,
             ret );
@@ -2070,7 +1981,7 @@
 // Writes ACL status to EFest
 // ----------------------------------------------------------------------------
 //
-TInt CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq(  TUint8 aOldAclState )
+TInt CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq( TUint8 aOldAclState )
     {
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCSETACLSTATUSWRITEEFESTREQ, "CMmPhoneMessHandler::UiccSetAclStatusWriteEfEstReq" );
@@ -2093,21 +2004,16 @@
     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 );
+        TBuf8<KAclStatusLength> fileData;
+        fileData.Append( newState );
+        ret = UiccApplCmdReq(
+            ETrIdAclStatusWriteEfEst,
+            UICC_APPL_UPDATE_TRANSPARENT,
+            0,
+            0,
+            KElemEst,
+            5,
+            fileData );
         }
     else
         {
@@ -2169,22 +2075,13 @@
     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 );
+        ret = UiccApplCmdReq(
+            ETrIdAclReadEfAcl,
+            UICC_APPL_READ_TRANSPARENT,
+            0,
+            0,
+            KElemFileAcl,
+            UICC_SFI_NOT_PRESENT );
         }
     else
         {
@@ -2209,7 +2106,8 @@
 TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccReadAclResp");
 OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCREADACLRESP, "CMmPhoneMessHandler::UiccReadAclResp" );
     TInt ret( KErrNone );
-    if( UICC_STATUS_OK == aStatus )
+    if ( ( UICC_STATUS_OK == aStatus ) &&
+        ( KApnDataIndex < aFileData.Length() ) )
         {
         if( iAPNList )
             {
@@ -2281,13 +2179,11 @@
 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
@@ -2323,12 +2219,10 @@
 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
+    iACLIsProgress = EFalse;
     iMessageRouter->Complete(
         EMobilePhoneEnumerateAPNEntries,
         &dataPackage,
@@ -2349,7 +2243,6 @@
     RMobilePhone::TAPNEntryV3 aclEntry;
     TInt err( KErrNone );
 
-    //check if index is valid or not.
     if ( iAPNList->MdcaCount() <= aIndex )
         {
         err = KErrOverflow;
@@ -2363,8 +2256,7 @@
 
     dataPackage.PackData( &aclEntry );
 
-    // set flag and complete
-    iACLIsProgress = EFalse; //set ACL flag
+    iACLIsProgress = EFalse;
     iMessageRouter->Complete( EMobilePhoneGetAPNname, &dataPackage, err );
     }
 
@@ -2379,16 +2271,12 @@
 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();
 
@@ -2416,30 +2304,25 @@
         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 );
+        TBuf8<KFileDataLength> fileData;
+        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 );
+            fileData.Append( 0xdd );
+            fileData.Append( apn.Length() );
+            fileData.Append( apn );
             }
 
-        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        ret = UiccApplCmdReq(
+            ETrIdAclWriteEfAcl,
+            UICC_APPL_UPDATE_TRANSPARENT,
+            0,
+            0,
+            KElemFileAcl,
+            UICC_SFI_NOT_PRESENT,
+            fileData );
         }
     else
         {
@@ -2470,7 +2353,7 @@
         ret = KErrAccessDenied;
         }
 
-    iACLIsProgress = EFalse; //set ACL flag
+    iACLIsProgress = EFalse;
     iMessageRouter->Complete(
         iOngoingAclIpc,
         ret );
@@ -2488,10 +2371,13 @@
 
     TUint16 length( 0 );
 
-    for ( TInt i = 0; i < aApnList->MdcaCount(); i++ )
+    if ( aApnList )
         {
-        TPtrC8 apn = aApnList->MdcaPoint( i );
-        length += apn.Length() + 2;
+        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
@@ -2504,4 +2390,67 @@
     return length;
     }
 
+
+// --------------------------------------------------------------------------
+// CMmPhoneMessHandler::UiccApplCmdReq
+//
+// --------------------------------------------------------------------------
+//
+TInt CMmPhoneMessHandler::UiccApplCmdReq(
+    const TUiccTrId aTrId,
+    const TUint8 aServiceType,
+    const TUint16 aDataAmount,
+    const TUint16 aDataOffset,
+    const TUint16 aFileId,
+    const TUint8 aFileIdSfi,
+    const TDesC8& aFileData )
+    {
+TFLOGSTRING("TSY: CMmPhoneMessHandler::UiccApplCmdReq");
+OstTrace0( TRACE_NORMAL, CMMPHONEMESSHANDLER_UICCAPPLCMDREQ, "CMmPhoneMessHandler::UiccApplCmdReq" );
+
+    TInt ret( KErrNone );
+    TBuf8<KFilePathLength> filePath;
+    filePath.Append( KMasterFileId >> 8 );
+    filePath.Append( KMasterFileId );
+    if ( KElemFileDynFlagsOrange == aFileId )
+        {
+        filePath.Append( KOrangeDedicatedFile >> 8 );
+        filePath.Append( KOrangeDedicatedFile );
+        }
+    else
+        {
+        filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
+        }
+
+    if ( UICC_APPL_READ_TRANSPARENT == aServiceType )
+        {
+        TUiccReadTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = aTrId;
+        params.dataAmount = aDataAmount;
+        params.dataOffset = aDataOffset;
+        params.fileId = aFileId;
+        params.fileIdSfi = aFileIdSfi;
+        params.serviceType = aServiceType;
+        params.filePath.Append( filePath );
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    else if ( UICC_APPL_UPDATE_TRANSPARENT == aServiceType )
+        {
+        TUiccWriteTransparent params;
+        params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
+        params.trId = aTrId;
+        params.dataAmount = aDataAmount;
+        params.dataOffset = aDataOffset;
+        params.fileId = aFileId;
+        params.fileIdSfi = aFileIdSfi;
+        params.serviceType = aServiceType;
+        params.fileData.Append( aFileData );
+        params.filePath.Append( filePath );
+        ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
+        }
+    // No else
+    return ret;
+    }
+
 // End of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsmsmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1540,26 +1540,8 @@
         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 )
             {
@@ -1978,7 +1960,7 @@
     // of the number of useful semi-octets of address field
     // Add two mandatory bytes of TP-OA, too.
 
-    messageReference = ( ( messageReference + 1 ) / 2) + 2;
+    messageReference = ( ( messageReference + 1 ) / 2 ) + 2;
     offset += messageReference;
 
     TUint8 protocolId( aSMSOnSIM->iMsgData[offset] );
@@ -3398,7 +3380,9 @@
 
             position++;
             TUint8 addressDataLength( aFileData[position] );
-            position++;
+            // Also length byte should be included to addressDataLength so it
+            // is added by one
+            addressDataLength++;
             TPtrC8 scA( aFileData.Mid( position, addressDataLength ) );
             CMmSmsGsmAddress::GsmConv0411AddrToUnicode(
                 receivedMsgServiceCentre,
@@ -3413,8 +3397,11 @@
             position += addressDataLength; // Start of the TPDU
             TUint8 totalLength( aFileData.Length() ); // Total aFileData length
             TUint8 tpduLength( totalLength - position );
+            if ( RMobileSmsMessaging::KGsmTpduSize < tpduLength )
+                {
+                tpduLength = RMobileSmsMessaging::KGsmTpduSize;
+                }
             smsData.iMsgData = aFileData.Mid( position, tpduLength  );
-
             iSmsCache.AddEntryL( &smsData, iRecordId );
             }
 
@@ -3527,7 +3514,10 @@
 
             position++;
             TUint8 addressDataLength( aFileData[position] );
-            position++;
+            // Also length byte should be included to addressDataLength so it
+            // is added by one
+            addressDataLength++;
+
             TPtrC8 scA( aFileData.Mid( position, addressDataLength ) );
             CMmSmsGsmAddress::GsmConv0411AddrToUnicode(
                 receivedMsgServiceCentre,
@@ -3691,10 +3681,6 @@
         scAddress,
         telNumber );
 
-    // addressDataLength
-    fileDataBuf.Append( scAddress.Length() );
-    totalDataLength++;
-
     fileDataBuf.Append( scAddress );
 
     // It is possible for a TS Service Centre Address of maximum permitted
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -1739,6 +1739,7 @@
 
     return epocError;
     }
+
 // -----------------------------------------------------------------------------
 // CMmStaticUtility::PacketDataCSCauseToEpocError
 // Converts Packet Data CS cause to EPOC error value
@@ -2171,6 +2172,62 @@
     // no else
     }
 
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::ConvertIPAddressFromClient
+// Converts IP address string from client into GPDS suitable format
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMmStaticUtility::ConvertIPAddressFromClient
+        (
+        const TDesC8& aClientAddr,
+        TDes8& aGpdsAddr
+        )
+    {
+TFLOGSTRING("TSY: CMmStaticUtility::ConvertIPAddressFromClient");
+OstTrace0( TRACE_NORMAL, CMMSTATICUTILITY_CONVERTIPADDRESSFROMCLIENT, "CMmStaticUtility::ConvertIPAddressFromClient" );
+    TInt ret(KErrNone);
+
+    TBuf<RPacketContext::KMaxPDPAddressLength> tmpClientAddress;
+    tmpClientAddress.Copy(aClientAddr);
+    TInetAddr inetAddr;
+    ret = inetAddr.Input(tmpClientAddress);
+
+    if ( KErrNone == ret )
+        {
+        if ( KAfInet == inetAddr.Family() )
+            {
+            TUint32 ipV4Address = inetAddr.Address();
+            TPtrC8 ptrIpV4Address( (TUint8*)&ipV4Address, KIpv4AddressLen );
+            aGpdsAddr.SetLength( KIpv4AddressLen );
+            // reverse copy IP address bytes to get correct endianness
+            for ( TInt i=0; i<KIpv4AddressLen; i++)
+                {
+                aGpdsAddr[i] = ptrIpV4Address[KIpv4AddressLen - i - 1];
+                }
+            }
+        else if ( KAfInet6 == inetAddr.Family() )
+            {
+            TPtrC8 ptrIpV6Address(
+                inetAddr.Ip6Address().u.iAddr8,
+                KIpv6AddressLen );
+            aGpdsAddr.Copy( ptrIpV6Address );
+            }
+        else
+            {
+TFLOGSTRING2("TSY: CMmStaticUtility::ConvertIPAddressFromClient; not supported family(%d)", inetAddr.Family());
+OstTrace1( TRACE_NORMAL, DUP2_CMMSTATICUTILITY_CONVERTIPADDRESSFROMCLIENT, "CMmStaticUtility::ConvertIPAddressFromClient; not supported family(%d)", inetAddr.Family() );
+            ret = KErrNotSupported;
+            }
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmStaticUtility::ConvertIPAddressFromClient; TInetAddr::Input failed");
+OstTrace0( TRACE_NORMAL, DUP1_CMMSTATICUTILITY_CONVERTIPADDRESSFROMCLIENT, "CMmStaticUtility::ConvertIPAddressFromClient; TInetAddr::Input failed" );
+        }
+
+    return ret;
+    }
 
 // -----------------------------------------------------------------------------
 // CMmStaticUtility::GetIntFromDescriptor
@@ -3447,6 +3504,37 @@
     }
 
 
+// -----------------------------------------------------------------------------
+// CMmStaticUtility::ConvertUcs2To7BitCodedData
+// Convert data to 7 bit GSM format.
+// -----------------------------------------------------------------------------
+//
+void CMmStaticUtility::ConvertUcs2To7BitCodedData(
+    TDesC16& aInputString,
+    TDes8& aGsmDataString )
+    {
+TFLOGSTRING("TSY: CMmStaticUtility::ConvertUcs2To7BitCodedData");
+OstTrace0( TRACE_NORMAL, CMMSTATICUTILITY_CONVERTUCS2TO7BITCODEDDATA, "CMmStaticUtility::ConvertUcs2To7BitCodedData" );
+
+    if ( 0 < aInputString.Length() )
+        {
+        // 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::ConvertUcs2ToGsmUcs2Data
@@ -4247,6 +4335,8 @@
  return target;
  }
 
+
+
 // ==================== OTHER EXPORTED FUNCTIONS ===============================
     //None
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -11,12 +11,10 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
-
-
 //  Include Files
 
 #include <ctsy/pluginapi/cmmdatapackage.h>
@@ -113,6 +111,8 @@
     iIsSendReleaseReqPending = EFalse;
 
     iNoFdnUSSDReq = EFalse;
+
+    iLastMtUssdIsRequest = EFalse;
     }
 
 // -----------------------------------------------------------------------------
@@ -221,7 +221,7 @@
     TInt ret ( KErrNone );
     TBuf8<RMobileUssdMessaging::KGsmUssdDataSize> data( 0 );
     TDes8* attributes( 0 );
-    TUint8 numOfSubblocks( 2 );
+    TUint8 numOfSubblocks( 0 );
 
     aDataPackage->UnPackData( data, attributes );
 
@@ -241,9 +241,24 @@
             {
             // User has requested to send MO USSD
             case RMobileUssdMessaging::EUssdMORequest:
+                {
+                ussdType = SS_GSM_USSD_COMMAND;
+                break;
+                }
             case RMobileUssdMessaging::EUssdMOReply:
                 {
-                ussdType = SS_GSM_USSD_COMMAND;
+TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdSendReq; iLastMtUssdIsRequest = %d", iLastMtUssdIsRequest);
+OstTrace1( TRACE_NORMAL, DUP5_CMMUSSDMESSHANDLER_SSGSMUSSDSENDREQ, "CMmUssdMessHandler::SsGsmUssdSendReq;iLastMtUssdIsRequest=%d", iLastMtUssdIsRequest );
+                if ( iLastMtUssdIsRequest )
+                    {
+                    ussdType = SS_GSM_USSD_MT_REPLY;
+                    }
+                else
+                    {
+                    ussdType = SS_GSM_USSD_COMMAND;
+                    }
+                // no need to reset the field, because MT USSD indication
+                // will always precede this kind of response
                 break;
                 }
             // User is signing for the MT request
@@ -303,50 +318,55 @@
             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
                 SS_GSM_USSD_SEND_REQ_OFFSET_USSDTYPE, ussdType );
 
-            // Create SsGsmUssdString subblock.
-            // subblock header + ussd string length subblock max length = 164
-
-            TBuf8<KMaxLengthOfUssdMessage + 3> ssGsmUssdStringSb( 0 );
-
-            TIsiSubBlock subblockSSGsmUssdString(
-                ssGsmUssdStringSb, SS_GSM_USSD_STRING, EIsiSubBlockTypeId8Len8 );
+            if ( SS_GSM_USSD_NOTIFY != ussdType )
+                {
+                // Create SsGsmUssdString subblock.
+                // subblock header + ussd string length subblock max length = 164
+                TBuf8<KMaxLengthOfUssdMessage + 3> ssGsmUssdStringSb( 0 );
+                TIsiSubBlock subblockSSGsmUssdString(
+                    ssGsmUssdStringSb, SS_GSM_USSD_STRING, EIsiSubBlockTypeId8Len8 );
 
-            ssGsmUssdStringSb.Append( codingInfo );
-            ssGsmUssdStringSb.Append( data.Length() );
-            ssGsmUssdStringSb.Append( data );
+                ssGsmUssdStringSb.Append( codingInfo );
+                ssGsmUssdStringSb.Append( data.Length() );
+                ssGsmUssdStringSb.Append( data );
 
-            ssGsmUssdSendReq.CopyData( ISI_HEADER_SIZE +
-                SIZE_SS_GSM_USSD_SEND_REQ,
-                subblockSSGsmUssdString.CompleteSubBlock() );
+                ssGsmUssdSendReq.CopyData( ISI_HEADER_SIZE +
+                    SIZE_SS_GSM_USSD_SEND_REQ,
+                    subblockSSGsmUssdString.CompleteSubBlock() );
+                numOfSubblocks++;
 
-            // create subblock SS_SB_CHECK_INFO
-            TBuf8<SIZE_SS_SB_CHECK_INFO>sbData( 0 );
-            TIsiSubBlock ssCheckInfoSb(
-                sbData,
-                SS_SB_CHECK_INFO,
-                EIsiSubBlockTypeId8Len8 );
+                if ( SS_GSM_USSD_COMMAND == ussdType )
+                    {
+                    // create subblock SS_SB_CHECK_INFO
+                    TBuf8<SIZE_SS_SB_CHECK_INFO>sbData( 0 );
+                    TIsiSubBlock ssCheckInfoSb(
+                        sbData,
+                        SS_SB_CHECK_INFO,
+                        EIsiSubBlockTypeId8Len8 );
 
-            if( iNoFdnUSSDReq )
-                {
-                sbData.Append( SS_FDN_CHECK_SUPPRESS );
+                    if( iNoFdnUSSDReq )
+                        {
+                        sbData.Append( SS_FDN_CHECK_SUPPRESS );
+                        }
+                    else
+                        {
+                        sbData.Append( SS_NO_FDN_CHECK_SUPPRESS );
+                        }
+
+                    sbData.Append( SS_NO_RESOURCE_CONTROL_SUPPRESS );
+
+                    // add the SIZE_SS_SB_CHECK_INFO subblock to service req
+                    ssGsmUssdSendReq.CopyData(
+                        ISI_HEADER_SIZE + SIZE_SS_GSM_USSD_SEND_REQ +
+                        ssGsmUssdStringSb.Length(),
+                        ssCheckInfoSb.CompleteSubBlock( ) );
+                    numOfSubblocks++;
+                    }
                 }
-            else
-                {
-                sbData.Append( SS_NO_FDN_CHECK_SUPPRESS );
-                }
-
-            sbData.Append( SS_NO_RESOURCE_CONTROL_SUPPRESS );
-
-            // add the SIZE_SS_SB_CHECK_INFO subblock to service req
-            ssGsmUssdSendReq.CopyData(
-                ISI_HEADER_SIZE + SIZE_SS_GSM_USSD_SEND_REQ +
-                ssGsmUssdStringSb.Length(),
-                ssCheckInfoSb.CompleteSubBlock( ) );
 
             ssGsmUssdSendReq.Set8bit( ISI_HEADER_SIZE +
                 SS_GSM_USSD_SEND_REQ_OFFSET_SUBBLOCKCOUNT, numOfSubblocks );
 
-
             //send message via phonet
             ret = iPhoNetSender->Send( ssGsmUssdSendReq.Complete() );
             }
@@ -575,9 +595,9 @@
                 TUint8 sw1 = data[KSw1Index];
                 TUint8 sw2 = data[KSw2Index];
                 TUint8 result = data[KResultIndex];
-                epocError = CMmStaticUtility::MapSw1Sw2ToEpocError( 
-                    sw1, 
-                    sw2, 
+                epocError = CMmStaticUtility::MapSw1Sw2ToEpocError(
+                    sw1,
+                    sw2,
                     result );
                 errorMappingNeeded = EFalse;
                 }
@@ -739,6 +759,9 @@
         case SS_GSM_USSD_REQUEST:
         case SS_GSM_USSD_COMMAND:
             {
+            iLastMtUssdIsRequest = SS_GSM_USSD_REQUEST == ussdType;
+TFLOGSTRING2("TSY: CMmUssdMessHandler::SsGsmUssdSendReq; iLastMtUssdIsRequest = %d", iLastMtUssdIsRequest);
+OstTrace1( TRACE_NORMAL, DUP3_CMMUSSDMESSHANDLER_SSGSMUSSDRECEIVEIND, "CMmUssdMessHandler::SsGsmUssdReceiveInd;iLastMtUssdIsRequest=%d", iLastMtUssdIsRequest );
             receiveUssdMessageAttributes.iType =
                 RMobileUssdMessaging::EUssdMTRequest;
             break;
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmessaging.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmessaging.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -357,7 +357,7 @@
         * @param aIsiMessage received ISI message
         * @return none
         */
-        void MoSmsControlReceived( const TIsiReceiveC& aIsiMessage );
+        void MoSmsControlReceivedL( const TIsiReceiveC& aIsiMessage );
 
         /**
         * This methods returns ETrue if MoSmControl
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmesshandler.h	Wed Apr 21 14:29:55 2010 +0300
@@ -752,22 +752,6 @@
 
 
         /**
-        * Sends a NET_RAT_REQ isi-message to phonet
-        * @since Series60_ver 2.6
-        * @param aTransId Transaction ID
-        * @retrun TInt: Phonet sender status
-        */
-        TInt NetRatReq( TUint8 aTransId );
-
-        /*
-        * Breaks a NET_RAT_RESP ISI-message
-        * @since Series60_ver 3.0
-        * @param aIsiMessage Net rat resp ISI message
-        * Return value: none
-        */
-        void NetRatResp( const TIsiReceiveC& aIsiMessage );
-
-        /**
         * Send a response to SMS server after a SMS resource Indication received from
         * SMS sever.
         * This response tells whether the SMS can be sent or not.
@@ -806,9 +790,9 @@
         /**
         * Stores Network service status to an internal structure
         * @param aIsiMessage NetCellInfoInd or NetCellInfoGetResp
-        * @return none
+        * @return TInt: Success value
         */
-        void StoreNetServiceStatus( const TIsiReceiveC& aIsiMessage );
+        TInt StoreNetServiceStatus( const TIsiReceiveC& aIsiMessage );
 
         /**
         * Getter for location information
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satmosmsctrl.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -90,7 +90,7 @@
         * @param aIsiMessage proactive command from phonet
         * @return TInt
         */
-        TInt MessageReceived( const TIsiReceiveC& aIsiMessage );
+        TInt MessageReceivedL( const TIsiReceiveC& aIsiMessage );
 
         /*
         * Returns iIsMoSmsCtrlActivated
@@ -125,7 +125,7 @@
         * @param aIsiMessage coming from ISA SMS Server
         * @return none
         */
-        void SmsResourceIndReceived( const TIsiReceiveC& aIsiMessage );
+        void SmsResourceIndReceivedL( const TIsiReceiveC& aIsiMessage );
 
         /*
         * Send an envelope to SIM server in order to check wheter the SMS
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satnotifications.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satnotifications.h	Wed Apr 21 14:29:55 2010 +0300
@@ -1781,8 +1781,14 @@
         * @param aClearSatus If true clear status
         * @return TBool iLocalInfoIsOngoing
         */
-        TBool Status( TBool aClearStatus = EFalse );
-
+        TBool LocalInfoStatus( TBool aClearStatus = EFalse );
+
+        /**
+        * From CSatNotificationsBase Handles the LocalInfo terminal response
+        * @param aClearSatus If true clear status
+        * @return TBool iLocalInfoAccTechOngoing
+        */
+        TBool LocalInfoAccTechStatus( TBool aClearStatus = EFalse );
 
     private: // Data
 
@@ -1791,10 +1797,11 @@
 
         // Response package allocated by SimAtkTsy. In use when terminal
         // response result and parameters are determined in SimAtkTsy.
-        RSat::TLocalInfoRspV3   iLocalInfoRspV3;
-
-        // Flag
-        TBool                   iLocalInfoIsOngoing;
+        RSat::TLocalInfoRspV3 iLocalInfoRspV3;
+
+        // Flags
+        TBool iLocalInfoIsOngoing;
+        TBool iLocalInfoAccTechOngoing;
     };
 
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -66,6 +66,7 @@
 
 const TUint8 KMSBMask = 0x80;
 const TUint8 KSw1Sw2Unknown = 0;
+const TUint8 KValidTonNpi   = 0x3F;
 
 
 // ==================== MEMBER FUNCTIONS ====================================
@@ -1150,6 +1151,8 @@
 
     TBuf8<KMaximumCcBufferSize> isiMessage;
     TInt ret( KErrNotFound );
+    TBool checkInfoNeeded( EFalse );
+    TUint8 checkInfoParams( 0 );
     CBerTlv response;
     response.SetData( aApduData );
     // Set initial cc result, e.g. the SIM has responded with sw1/sw2 90 00
@@ -1227,6 +1230,8 @@
                 isiMessage.Append( CALL_MODEM_RESOURCE_ALLOWED );
                 isiMessage.Append( KPadding );
                 internalCcResult = KModified;
+                checkInfoNeeded = ETrue;
+                checkInfoParams += CALL_MODEM_CHK_DISABLE_FDN;
                 }
             break;
             }
@@ -1296,7 +1301,21 @@
         if ( KErrNone == ret  )
             {
             // CALL_MODEM_ADDRESS_TYPE, mask MSB off
-            isiMessage.Append( addressTlv.GetValue()[ 0 ] ^KMSBMask );
+            TUint8 tonNpi( addressTlv.GetValue()[ 0 ] ^ KMSBMask );
+
+            // check if valid TON/NPI
+            if( KValidTonNpi >= tonNpi )
+                {
+                isiMessage.Append( tonNpi );
+                }
+            else
+                {
+                // use default TON/NPI in reserved cases
+                isiMessage.Append( 
+                    CALL_MODEM_NBR_TYPE_UNKNOWN | 
+                    CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY );
+                }
+
             isiMessage.Append( KPadding );
             isiMessage.Append( KPadding );
 
@@ -1305,6 +1324,18 @@
             TSatUtility::BCDToAscii( addressTlv.GetValue().Mid( 1 ),
                 asciiAddress );
 
+            // let's check is new number "112". This because of if number 
+            // is "112" emergency call is needed to establish. otherwise 
+            // normal call needs to be established, even new number is found 
+            // from EFecc. So if number is not "112" we need to add subblock 
+            // CALL_MODEM_CHECK_INFO with CALL_MODEM_CHK_DISABLE_EMERG
+            _LIT8(KEccNbr, "112");
+            if( 0 != asciiAddress.Compare( KEccNbr ) )
+                {
+                checkInfoNeeded = ETrue;
+                checkInfoParams += CALL_MODEM_CHK_DISABLE_EMERG;
+                }
+
             //add the number string as unicode.
             TBuf16<KCallServerMaxAddressLenght> unicodeNumber;
             TSatUtility::ConvertSms7ToUnicode16( unicodeNumber, asciiAddress );
@@ -1350,9 +1381,35 @@
     // should be ignored in Call Modem Server
     if ( aTcc.iCheckInfo.Length() )
         {
-        isiMessage.Append( aTcc.iCheckInfo );
         sbcount++;
+        if( checkInfoNeeded )
+            {
+            TUint8 oldInfo( aTcc.iCheckInfo[CALL_MODEM_SB_CHECK_INFO_OFFSET_CHECKINFO] );
+            TUint8 newInfo( checkInfoParams | oldInfo );
+            TIsiSubBlock checkInfo(
+                isiMessage,
+                CALL_MODEM_SB_CHECK_INFO,
+                EIsiSubBlockTypeId8Len8 );
+            isiMessage.Append( newInfo );
+            checkInfo.CompleteSubBlock();
+            }
+        else
+            {
+            isiMessage.Append( aTcc.iCheckInfo );
+            }
         }
+    else if( checkInfoNeeded )
+        {
+        sbcount++;
+        TIsiSubBlock checkInfo(
+            isiMessage,
+            CALL_MODEM_SB_CHECK_INFO,
+            EIsiSubBlockTypeId8Len8 );
+        isiMessage.Append( checkInfoParams );
+        checkInfo.CompleteSubBlock();
+        }
+    // no else
+
     TBuf8<1> numOfSubblocks;
     numOfSubblocks.Append( sbcount);
     isiMessage.Insert( 1, numOfSubblocks );
--- a/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -287,6 +287,13 @@
         TIsiSubBlock userData( msgBuffer, SMS_SB_USER_DATA,
                 EIsiSubBlockTypeId16Len16 );
 
+        TUint16 maxDataLen( SMS_DELIVER_ACK_UD_MAX_LEN );
+        if( ENone != aTpFailure )
+            {
+            maxDataLen = SMS_DELIVER_ERR_UD_MAX_LEN;
+            }
+        dataLen = Min( dataLen, maxDataLen );
+
         // data length
         // to append MSB byte
         msgBuffer.Append( dataLen >> 8 );
@@ -307,9 +314,8 @@
         msgBuffer.Append( dataLengthInOctets >> 8 );
         msgBuffer.Append( dataLengthInOctets );
 
-        // Append whole msg or SMS_GSM_DELIVER_ACK_UD_MAX_LEN bytes
-        msgBuffer.Append( aUserData.Left(Min( dataLen,
-                SMS_COMMAND_DATA_MAX_LEN ) ) );
+        // Append whole msg or max data len bytes
+        msgBuffer.Append( aUserData.Left( dataLen ) );
         // Increment number of subblock
         msgBuffer[5]++;
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/sateventdownload.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/sateventdownload.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -758,12 +758,11 @@
                                 sbStartOffset +
                                 CALL_MODEM_SB_ORIGIN_CS_ADDRESS_OFFSET_ADDR )
                                 | KMSBMask );
-                            // Append BCD address. Skip call type and mode
-                            // ( 2 first bytes, not required in envelope )
+                            // Append BCD address. Skip TON/NPI
                             BCDAddress.Append( aIsiMessage.GetData(
                                 sbStartOffset +
-                                CALL_MODEM_SB_ORIGIN_CS_ADDRESS_OFFSET_ADDR + 2,
-                                addressLength - 2 ) );
+                                CALL_MODEM_SB_ORIGIN_CS_ADDRESS_OFFSET_ADDR + 1,
+                                addressLength - 1 ) );
                             }
                         // Extract subaddress
                         retValue = aIsiMessage.FindSubBlockOffsetById(
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmessaging.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmessaging.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -244,8 +244,7 @@
     //Initalize flag, this is used to check if proactiveCommand is ongoing
     iSatTimer->SetProactiveCommandOnGoingStatus( EFalse );
 
-    // Request access technology type
-    iSatMessHandler->NetRatReq( GetTransactionId() );
+
 
 #ifdef INFO_PP_SIM_OLD_POLL_INTERVAL
     // Check old poll interval is supported by ME's Product Profile
@@ -2063,20 +2062,21 @@
     }
 
 // -----------------------------------------------------------------------------
-// CTsySatMessaging::MoSmsControlReceived
+// CTsySatMessaging::MoSmsControlReceivedL
 // Processes ISI messages that are relevant for MoSm control
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CTsySatMessaging::MoSmsControlReceived
+void CTsySatMessaging::MoSmsControlReceivedL
         (
         const TIsiReceiveC& aIsiMessage
         )
     {
-    OstTrace0( TRACE_NORMAL, CTSYSATMESSAGING_MOSMSCONTROLRECEIVED, "CTsySatMessaging::MoSmsControlReceived" );
+    TFLOGSTRING("TSY: CTsySatMessaging::MoSmsControlReceivedL");
+    OstTrace0( TRACE_NORMAL, CTSYSATMESSAGING_MOSMSCONTROLRECEIVEDL, "CTsySatMessaging::MoSmsControlReceivedL" );
     if ( iSatMoSmsCtrl->IsActivated() )
         {
-        iSatMoSmsCtrl->MessageReceived( aIsiMessage );
+        iSatMoSmsCtrl->MessageReceivedL( aIsiMessage );
         }
     }
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmesshandler.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -268,7 +268,7 @@
     iTsySatMessaging->DataDownloadReceivedL( aIsiMessage );
 
     // handle MO-SMS Control related messages
-    iTsySatMessaging->MoSmsControlReceived( aIsiMessage );
+    iTsySatMessaging->MoSmsControlReceivedL( aIsiMessage );
     }
 
 // -----------------------------------------------------------------------------
@@ -319,11 +319,6 @@
             NetTimeInd( aIsiMessage );
             break;
             }
-        case NET_RAT_RESP:
-            {
-            NetRatResp( aIsiMessage );
-            break;
-            }
         case NET_RAT_IND:
             {
             NetRatInd( aIsiMessage );
@@ -1541,13 +1536,13 @@
 // Stores location information and network service status
 // -----------------------------------------------------------------------------
 //
-void CSatMessHandler::StoreNetServiceStatus
+TInt CSatMessHandler::StoreNetServiceStatus
         (
         const TIsiReceiveC& aIsiMessage
         )
     {
-    OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus" );
-    TFLOGSTRING("TSY: CSatMessHandler::StoreNetServiceStatus");
+OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus" );
+TFLOGSTRING("TSY: CSatMessHandler::StoreNetServiceStatus");
 
     // SubBlock offset
     TUint sbOffset( 0 );
@@ -1556,6 +1551,8 @@
 
     TInt headerSize( KErrNotFound );
 
+    TInt retValue( KErrNone );
+
     if ( NET_CELL_INFO_IND == messageId )
         {
         headerSize = SIZE_NET_CELL_INFO_IND;
@@ -1595,9 +1592,8 @@
             iLocInfo.iRegStatus = aIsiMessage.Get8bit(
                 sbOffset + NET_GSM_CELL_INFO_OFFSET_SERVICESTATUS );
 
-            TFLOGSTRING2("TSY: CSatMessHandler::StoreNetServiceStatus: \
-                NET_REGISTRATION_STATUS = %d", iLocInfo.iRegStatus );
-            OstTrace1( TRACE_NORMAL, DUP1_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus NET_REGISTRATION_STATUS = %d", iLocInfo.iRegStatus );
+TFLOGSTRING2("TSY: CSatMessHandler::StoreNetServiceStatus: NET_REGISTRATION_STATUS = %d", iLocInfo.iRegStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus NET_REGISTRATION_STATUS = %d", iLocInfo.iRegStatus );
 
             if ( NET_SERVICE == iLocInfo.iRegStatus ||
                 NET_LIMITED_SERVICE == iLocInfo.iRegStatus )
@@ -1639,17 +1635,21 @@
             }
         else
             {
-            TFLOGSTRING("TSY: CSatMessHandler::StoreNetServiceStatus \
-                NET_GSM_CELL_INFO or NET_WCDMA_CELL_INFO not found!");
-            OstTrace0( TRACE_NORMAL, DUP2_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus NET_GSM_CELL_INFO or NET_WCDMA_CELL_INFO not found!" );
+TFLOGSTRING("TSY: CSatMessHandler::StoreNetServiceStatus - NET_GSM_CELL_INFO or NET_WCDMA_CELL_INFO not found!");
+OstTrace0( TRACE_NORMAL, DUP2_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus NET_GSM_CELL_INFO or NET_WCDMA_CELL_INFO not found!" );
+
+            retValue = KErrNotFound;
             }
         }
     else
         {
-        TFLOGSTRING2("TSY: CSatMessHandler::StoreNetServiceStatus \
-            Unexpected message id: %d", messageId );
-        OstTrace1( TRACE_NORMAL, DUP3_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus Unexpected message id: %d", messageId );
+TFLOGSTRING2("TSY: CSatMessHandler::StoreNetServiceStatus - Unexpected message id: %d", messageId );
+OstTrace1( TRACE_NORMAL, DUP3_CSATMESSHANDLER_STORENETSERVICESTATUS, "CSatMessHandler::StoreNetServiceStatus Unexpected message id: %d", messageId );
+
+        retValue = KErrNotFound;
         }
+
+    return retValue;
     }
 
 // -----------------------------------------------------------------------------
@@ -2078,7 +2078,7 @@
 
     TUint8 result( RSat::KSuccess );
 
-    if ( iTsySatMessaging->GetNotifyLocalInfo()->Status() )
+    if ( iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus() )
         {
         // Provide local info proactive command is ongoing
 
@@ -2192,7 +2192,7 @@
                 additionalInfo );
             }
         // Clear local info flag
-        iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
+        iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus( ETrue );
         }
     }
 
@@ -3055,61 +3055,93 @@
         const TIsiReceiveC& aIsiMessage
         )
     {
-    OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_NETCELLINFOGETRESP, "CSatMessHandler::NetCellInfoGetResp" );
-    TFLOGSTRING("TSY: CSatMessHandler::NetCellInfoGetResp");
+OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_NETCELLINFOGETRESP, "CSatMessHandler::NetCellInfoGetResp" );
+TFLOGSTRING("TSY: CSatMessHandler::NetCellInfoGetResp");
+
+    TUint8 successCode( aIsiMessage.Get8bit(
+        ISI_HEADER_SIZE + NET_CELL_INFO_GET_RESP_OFFSET_SUCCESSCODE ) );
 
     TBuf<1> additionalInfo;
+    additionalInfo.Zero();
 
     // Default result
     TUint8 result( RSat::KMeUnableToProcessCmd );
 
     // Store recieved network parameters
-    StoreNetServiceStatus( aIsiMessage );
-
-    switch ( iLocInfo.iRegStatus )
+    TInt retValue( StoreNetServiceStatus( aIsiMessage ) );
+
+    if ( iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoAccTechStatus() )
         {
-        case NET_SERVICE:
+        if ( NET_CAUSE_OK == successCode )
             {
-            result = RSat::KSuccess;
-            break;
-            }
-        case NET_LIMITED_SERVICE:
-            {
-            result = RSat::KSuccessLimitedService;
-            break;
+            if ( KErrNone == retValue )
+                {
+                if ( NET_SERVICE == iLocInfo.iRegStatus
+                    || NET_LIMITED_SERVICE == iLocInfo.iRegStatus )
+                    {
+                    result = RSat::KSuccess;
+                    }
+                else
+                    {
+                    // No service.
+                    additionalInfo.Append( RSat::KNoService );
+                    }
+                }
+                // No else, result already set.
             }
-        case NET_NO_COVERAGE:
+            // No else, result already set.
+
+        // Clear local info access technology flag
+        iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoAccTechStatus( ETrue );
+        }
+    else
+        {
+        switch ( iLocInfo.iRegStatus )
             {
-            // Default result value already set
-            additionalInfo.Append( RSat::KNoService );
-            break;
-            }
-        default:
-            {
-            // Default result value already set
-            TFLOGSTRING2("TSY: CSatMessHandler::NetCellInfoGetResp, Unexpected iRegStatus: %d", iLocInfo.iRegStatus );
-            OstTrace1( TRACE_NORMAL, DUP1_CSATMESSHANDLER_NETCELLINFOGETRESP, "CSatMessHandler::NetCellInfoGetResp Unexpected iRegStatus: %d", iLocInfo.iRegStatus );
-            additionalInfo.Append( RSat::KNoSpecificMeProblem );
-            break;
+            case NET_SERVICE:
+                {
+                result = RSat::KSuccess;
+                break;
+                }
+            case NET_LIMITED_SERVICE:
+                {
+                result = RSat::KSuccessLimitedService;
+                break;
+                }
+            case NET_NO_COVERAGE:
+                {
+                // Default result value already set
+                additionalInfo.Append( RSat::KNoService );
+                break;
+                }
+            default:
+                {
+                // Default result value already set
+TFLOGSTRING2("TSY: CSatMessHandler::NetCellInfoGetResp - Unexpected iRegStatus: %d", iLocInfo.iRegStatus );
+OstTrace1( TRACE_NORMAL, DUP1_CSATMESSHANDLER_NETCELLINFOGETRESP, "CSatMessHandler::NetCellInfoGetResp Unexpected iRegStatus: %d", iLocInfo.iRegStatus );
+
+                additionalInfo.Append( RSat::KNoSpecificMeProblem );
+                break;
+                }
             }
         }
 
     TInt trId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
 
     // Check if this response is for provide local info proactive command.
-    if ( iTsySatMessaging->GetNotifyLocalInfo()->Status()
+    if ( iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus()
         && iTsySatMessaging->GetNotifyLocalInfo()->GetTransactionId()
             == trId )
         {
         // Send terminal response
-        LocalInfoTerminalResp( iTsySatMessaging->GetNotifyLocalInfo()
-                                    ->GetTransactionId(),
-                                iTsySatMessaging->GetNotifyLocalInfo()
-                                    ->GetCmdDetails(),
-                                result,
-                                additionalInfo );
+        LocalInfoTerminalResp(
+            iTsySatMessaging->GetNotifyLocalInfo()->GetTransactionId(),
+            iTsySatMessaging->GetNotifyLocalInfo()->GetCmdDetails(),
+            result,
+            additionalInfo );
+
         // Clear local info flag
-        iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
+        iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus( ETrue );
         }
     }
 
@@ -3147,7 +3179,7 @@
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_GSSCSSERVICERESP, "CSatMessHandler::GssCsServiceResp" );
     TFLOGSTRING("CSatMessHandler::GssCsServiceResp ");
 
-    if ( iTsySatMessaging->GetNotifyLocalInfo()->Status() )
+    if ( iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus() )
         {
         TUint8 generalResult ( RSat::KSuccess );
 
@@ -3215,7 +3247,7 @@
                                     additionalInfo );
 
             // Clear local info flag
-            iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
+            iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus( ETrue );
             }
         else
             {
@@ -3223,7 +3255,7 @@
             additionalInfo.Append( RSat::KNoService );
 
             // Clear local info flag
-            iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
+            iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus( ETrue );
 
             // Call local info terminal response method to send
             // terminal response to the sim card.
@@ -3248,7 +3280,7 @@
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_GSSCSSERVICEFAILRESP, "CSatMessHandler::GssCsServiceFailResp" );
     TFLOGSTRING("CSatMessHandler::GssCsServiceFailResp ");
 
-    if ( iTsySatMessaging->GetNotifyLocalInfo()->Status() )
+    if ( iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus() )
         {
         if ( GSS_ATK_TIMING_ADVANCE_GET == aIsiMessage.Get8bit(
              ISI_HEADER_SIZE + GSS_CS_SERVICE_RESP_OFFSET_OPERATION ) )
@@ -3272,7 +3304,7 @@
                                     additionalInfo );
 
             // Clear local info flag
-            iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
+            iTsySatMessaging->GetNotifyLocalInfo()->LocalInfoStatus( ETrue );
             }
         }
     }
@@ -3350,127 +3382,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CSatMessHandler::NetRatReq
-// Constructs NET_RAT_REQ ISI message.
-// -----------------------------------------------------------------------------
-//
-TInt CSatMessHandler::NetRatReq
-        (
-        TUint8 aTransId         // Transaction Id
-        )
-    {
-    OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_NETRATREQ, "CSatMessHandler::NetRatReq" );
-    TFLOGSTRING("TSY: CSatMessHandler::NetRatReq ");
-
-    TBuf8<1> data;
-    //we need to know the current RAT
-    data.Append( NET_CURRENT_RAT );
-
-    return iPnSend->Send( PN_MODEM_NETWORK, aTransId, NET_RAT_REQ, data );
-    }
-
-// -----------------------------------------------------------------------------
-// CSatMessHandler::NetRatResp
-// Constructs NET_RAT_RESP ISI message.
-// -----------------------------------------------------------------------------
-//
-void CSatMessHandler::NetRatResp
-        (
-        const TIsiReceiveC& aIsiMessage //received ISI message
-        )
-    {
-    OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_NETRATRESP, "CSatMessHandler::NetRatResp" );
-    TFLOGSTRING("TSY:CSatMessHandler::NetRatResp");
-
-    if ( iTsySatMessaging->GetNotifyLocalInfo()->Status() )
-        {
-        TBuf<1> additionalInfo;
-        additionalInfo.Zero();
-
-        // Get transaction id
-        TUint8 transId(
-            iTsySatMessaging->GetNotifyLocalInfo()->GetTransactionId() );
-
-        // Get command details tlv
-        TBuf8<5> commandDetails;
-        commandDetails =
-            iTsySatMessaging->GetNotifyLocalInfo()->GetCmdDetails();
-
-        if ( NET_CAUSE_OK == aIsiMessage.Get8bit(
-            ISI_HEADER_SIZE + NET_RAT_RESP_OFFSET_SUCCESSCODE ) )
-            {
-            TUint8 generalResult ( RSat::KSuccess );
-
-            // Subblock offset
-            TUint sbOffset( 0 );
-
-            // Check if NET_RAT_INFO sub block is present
-            TInt ret( aIsiMessage.FindSubBlockOffsetById(
-                ISI_HEADER_SIZE + SIZE_NET_RAT_RESP,
-                NET_RAT_INFO,
-                EIsiSubBlockTypeId8Len8,
-                sbOffset ) );
-
-            if ( KErrNone == ret )
-                {
-                // Get ratName
-                TUint8 ratName( aIsiMessage.Get8bit(
-                    sbOffset + NET_RAT_INFO_OFFSET_RATNAME ) );
-
-                switch ( ratName )
-                    {
-                    case NET_GSM_RAT:
-                        {
-                        iCurrentAccTech = KNetworkModeGsm;
-                        break;
-                        }
-                    case NET_UMTS_RAT:
-                        {
-                        iCurrentAccTech = KNetworkModeUtran;
-                        break;
-                        }
-                    default:
-                        {
-                        generalResult= RSat::KMeUnableToProcessCmd;
-                        break;
-                        }
-                    }
-                }
-            else
-                {
-                generalResult = RSat::KMeUnableToProcessCmd;
-                }
-
-            // Call local info terminal response method to send
-            // terminal response to the sim card.
-            LocalInfoTerminalResp( transId,
-                                commandDetails,
-                                generalResult,
-                                additionalInfo );
-
-            // Clear local info flag
-            iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
-
-            }
-         else
-            {
-            // No service
-            additionalInfo.Append( RSat::KNoService );
-
-            // Clear local info flag
-            iTsySatMessaging->GetNotifyLocalInfo()->Status( ETrue );
-
-            // Call local info terminal response method to send
-            // terminal response to the sim card.
-            LocalInfoTerminalResp( transId,
-                                    commandDetails,
-                                    RSat::KMeUnableToProcessCmd,
-                                    additionalInfo );
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
 // CSatMessHandler::OpenChannelTerminalResp
 // Constructs Open Channel specific part of terminal
 // response and calls SendTerminalResponse to send the terminal response.
@@ -4662,41 +4573,41 @@
     TFLOGSTRING("TSY: CSatMessHandler::SimMoSmsControlAvail" );
     OstTrace0( TRACE_NORMAL, CSATMESSHANDLER_SIMMOSMSCONTROLAVAIL, "CSatMessHandler::SimMoSmsControlAvail" );
 
-    // Activate the MO-SMS Control in SMS server. This is done by
-    // sending a request SMS_RESOURCE_CONF_REQ to SMS server
-    TBuf8<SIZE_SMS_RESOURCE_CONF_REQ + SIZE_SMS_SB_RESOURCE_CONF> data;
-    // Append Confoguration operation
-    data.Append( SMS_RES_CONF_SET );
-    // Number of Subblocks
-    data.Append( 1 );
-    // Add Subblock
-    TIsiSubBlock ResourceConfReqSb(
-        data,
-        SMS_SB_RESOURCE_CONF,
-        EIsiSubBlockTypeId16Len16 );
-
-    TSatUtility::AppendWord( SMS_RES_ID_MO_SM_INIT, data );
-
-    if( aStatus )
+    if( SIM_SERV_OK == aStatus )
         {
         // Set MoSmsCtrl object´s member iIsMoSmsCtrlActivated to ETrue
         iTsySatMessaging->GetMoSmsCtrl()->Activate();
+        // Activate the MO-SMS Control in SMS server. This is done by
+        // sending a request SMS_RESOURCE_CONF_REQ to SMS server
+        TBuf8<SIZE_SMS_RESOURCE_CONF_REQ + SIZE_SMS_SB_RESOURCE_CONF> data;
+        // Append Configuration operation
+        data.Append( SMS_RES_CONF_SET );
+        // Number of Subblocks
+        data.Append( 1 );
+        // Add Subblock
+        //SMS_RESOURCE_IDS to zero SMS_RES_ID_MASK_MO_SM_INIT 
+        TIsiSubBlock ResourceConfReqSb(
+            data,
+            SMS_SB_RESOURCE_CONF,
+            EIsiSubBlockTypeId16Len16 );
+    
+        TSatUtility::AppendWord( SMS_RES_ID_MO_SM_INIT, data );
         TSatUtility::AppendWord( SMS_RES_ID_MASK_MO_SM_INIT, data);
-        }
+
+        ResourceConfReqSb.CompleteSubBlock();
+        SmsResoureConfReq(
+            iTsySatMessaging->GetTransactionId(),
+            SMS_RESOURCE_CONF_REQ,
+            data );
+      }
+    // should not send SMS_RESOURCE_CONF_REQ if there is no MO SMS control enabled in SIM card
     else
-        {
-        // Set MoSmsCtrl object´s member IsMoSmsCtrlDeActivated to EFalse
-        iTsySatMessaging->GetMoSmsCtrl()->Deactivate();
-        TSatUtility::AppendWord( 0x0000, data);
-        }
-    ResourceConfReqSb.CompleteSubBlock();
-    SmsResoureConfReq(
-        iTsySatMessaging->GetTransactionId(),
-        SMS_RESOURCE_CONF_REQ,
-        data );
+      {
+      // Set MoSmsCtrl object´s member IsMoSmsCtrlDeActivated to EFalse
+      iTsySatMessaging->GetMoSmsCtrl()->Deactivate();
+      }
     }
 
-
 // -----------------------------------------------------------------------------
 // CSatMessHandler::UiccTerminalProfileReq
 // Send terminal profile
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -364,20 +364,20 @@
 
 
 // -----------------------------------------------------------------------------
-// CSatMoSmsCtrl::SmsResourceIndReceived
+// CSatMoSmsCtrl::SmsResourceIndReceivedL
 // Request received from SMS server with the SMS parameters
 // of the SMS to be sent by the Mobile Equipment.
 // The response will tell whether the SMS can be sent
 // to network or not.
 // -----------------------------------------------------------------------------
 //
-void CSatMoSmsCtrl::SmsResourceIndReceived
+void CSatMoSmsCtrl::SmsResourceIndReceivedL
         (
         const TIsiReceiveC& aIsiMessage //Received data notification
         )
     {
-    OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SMSRESOURCEINDRECEIVED, "CSatMoSmsCtrl::SmsResourceIndReceived" );
-    TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceived");
+    TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL");
+    OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL, "CSatMoSmsCtrl::SmsResourceIndReceivedL" );
 
     TUint sbOffset;
 
@@ -421,6 +421,10 @@
         {
         TUint8 addressLength = aIsiMessage.Get8bit(
             sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH );
+        // According to sms_isi specification
+        __ASSERT_ALWAYS(
+            2 <= addressLength && SMS_ADDRESS_MAX_LEN >= addressLength,
+            User::Leave( KErrCorrupt ) );
         iAddressSubblock = aIsiMessage.GetData(
             sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATA,
             addressLength );
@@ -1033,8 +1037,8 @@
                                  )
                                   {
                                   // Only Ton&Npi is present
-                                  // or TON6NPI has a reserved value
-                                  iUserDataSubblock[3] = 0x00;
+                                  // or TON&NPI has a reserved value
+                                  iUserDataSubblock[2] = 0x00;
                                   }
                               else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) )
                                   {
@@ -1084,11 +1088,11 @@
         }
     }
 // -----------------------------------------------------------------------------
-// CSatMoSmsCtrl::MessageReceived
+// CSatMoSmsCtrl::MessageReceivedL
 // Handle received messages related to MO-SMS Control
 // -----------------------------------------------------------------------------
 //
-TInt CSatMoSmsCtrl::MessageReceived
+TInt CSatMoSmsCtrl::MessageReceivedL
         (
         const TIsiReceiveC& aIsiMessage
         )
@@ -1115,7 +1119,7 @@
             {
             case SMS_RESOURCE_IND:
                 {
-                SmsResourceIndReceived( aIsiMessage );
+                SmsResourceIndReceivedL( aIsiMessage );
                 break;
                 }
             case SMS_RESOURCE_RESP:
--- a/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -6171,44 +6171,52 @@
                 KTlvBrowserIdentityTag );
             if ( KErrNotFound != returnValue )
                 {
-                // Browser id 0x00-0x04 allowed, other values are RFU
-                switch ( browserId.GetShortInfo( ETLV_BrowserIdentity ) )
+                // Check if real data present in TLV
+                if ( browserId.GetLength() )
                     {
-                    case KDefaultBrowser:
+                    // Browser id 0x00-0x04 allowed, other values are RFU
+                    switch ( browserId.GetShortInfo( ETLV_BrowserIdentity ) )
                         {
-                        launchBrowserV2.iBrowserId = RSat::EDefaultBrowser;
-                        break;
-                        }
-#if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
-                    case KWMLBrowser:
-                        {
-                        launchBrowserV2.iBrowserId = RSat::EWMLBrowser;
-                        break;
-                        }
-                    case KHTMLBrowser:
-                        {
-                        launchBrowserV2.iBrowserId = RSat::EHTMLBrowser;
-                        break;
+                        case KDefaultBrowser:
+                            {
+                            launchBrowserV2.iBrowserId = RSat::EDefaultBrowser;
+                            break;
+                            }
+                        case KWMLBrowser:
+                            {
+                            launchBrowserV2.iBrowserId = RSat::EWMLBrowser;
+                            break;
+                            }
+                        case KHTMLBrowser:
+                            {
+                            launchBrowserV2.iBrowserId = RSat::EHTMLBrowser;
+                            break;
+                            }
+                        case KXHTMLBrowser:
+                            {
+                            launchBrowserV2.iBrowserId = RSat::EXHTMLBrowser;
+                            break;
+                            }
+                        case KCHTMLBrowser:
+                            {
+                            launchBrowserV2.iBrowserId = RSat::ECHTMLBrowser;
+                            break;
+                            }
+                        default:
+                            {
+                            // Object present but does not identify a known
+                            // browser ID
+                            launchBrowserV2.iBrowserId =
+                                RSat::EBrowserIdNotSpecified;
+                            break;
+                            }
                         }
-                    case KXHTMLBrowser:
-                        {
-                        launchBrowserV2.iBrowserId = RSat::EXHTMLBrowser;
-                        break;
-                        }
-                    case KCHTMLBrowser:
-                        {
-                        launchBrowserV2.iBrowserId = RSat::ECHTMLBrowser;
-                        break;
-                        }
-#endif
-                    default:
-                        {
-                        // Object present but does not identify a known
-                        // browser ID
-                        launchBrowserV2.iBrowserId =
-                            RSat::EBrowserIdNotSpecified;
-                        break;
-                        }
+                    }
+                else
+                    {
+                    // TLV present without real browser ID
+                    launchBrowserV2.iBrowserId =
+                        RSat::EBrowserIdNotSpecified;
                     }
                 }
             else
@@ -6231,7 +6239,12 @@
                     }
                 else
                     {
-                    launchBrowserV2.iUrl.Copy( url.GetData( ETLV_Url ) );
+                    // Check if URL is really given
+                    // If not, SAT server will use default URL address
+                    if ( url.GetLength() )
+                        {
+                        launchBrowserV2.iUrl.Copy( url.GetData( ETLV_Url ) );
+                        }
                     }
                 }
             else
@@ -6873,7 +6886,8 @@
         :
         CSatNotificationsBase( aSatMessHandler, aSatMessaging ),
         iLocalInfoV3Pckg( NULL ),
-        iLocalInfoIsOngoing( EFalse )
+        iLocalInfoIsOngoing( EFalse ),
+        iLocalInfoAccTechOngoing( EFalse )
     {
     OstTrace0( TRACE_NORMAL, CSATNOTIFYLOCALINFO_CSATNOTIFYLOCALINFO, "CSatNotifyLocalInfo::CSatNotifyLocalInfo" );
     TFLOGSTRING("CSatNotifyLocalInfo::CSatNotifyLocalInfo");
@@ -7163,8 +7177,12 @@
             TFLOGSTRING("CSatNotifyLocalInfo:: request: Access Technology");
             OstTrace0( TRACE_NORMAL, DUP13_CSATNOTIFYLOCALINFO_MESSAGERECEIVED, "CSatNotifyLocalInfo::MessageReceived Request: Access Technology" );
             iLocalInfoIsOngoing = ETrue;
-            //request NET_RAT_REQ
-            iSatMessHandler->NetRatReq( iSatMessaging->GetTransactionId() );
+            iLocalInfoAccTechOngoing = ETrue;
+
+            // Use same transaction id what comes with proactive
+            // command and compare that when response is received
+            iSatMessHandler->NetCellInfoGetReq( iTransId );
+
             break;
             }
         // Currently not supported:
@@ -7257,26 +7275,50 @@
     }
 
 // -----------------------------------------------------------------------------
-// CSatNotifyLocalInfo::Status
+// CSatNotifyLocalInfo::LocalInfoStatus
 // Method to check and set local info status. This is used when
 // SIM request NMR or Local Info.
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TBool CSatNotifyLocalInfo::Status
+TBool CSatNotifyLocalInfo::LocalInfoStatus
         (
         TBool aClearStatus
         )
     {
-    OstTrace0( TRACE_NORMAL, CSATNOTIFYLOCALINFO_STATUS, "CSatNotifyLocalInfo::Status" );
-    TFLOGSTRING("CSatNotifyLocalInfo::Status");
+    OstTrace0( TRACE_NORMAL, CSATNOTIFYLOCALINFO_LOCALINFOSTATUS, "CSatNotifyLocalInfo::LocalInfoStatus" );
+    TFLOGSTRING("CSatNotifyLocalInfo::LocalInfoStatus");
+
     if ( aClearStatus )
         {
         iLocalInfoIsOngoing = EFalse;
         }
+
     return iLocalInfoIsOngoing;
     }
 
+// -----------------------------------------------------------------------------
+// CSatNotifyLocalInfo::LocalInfoAccTechStatus
+// Method to check and set local info access technology status.
+// This is used when SIM request Local Info access technology.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CSatNotifyLocalInfo::LocalInfoAccTechStatus
+        (
+        TBool aClearStatus
+        )
+    {
+OstTrace0( TRACE_NORMAL, CSATNOTIFYLOCALINFO_LOCALINFOACCTECHSTATUS, "CSatNotifyLocalInfo::LocalInfoAccTechStatus" );
+TFLOGSTRING("CSatNotifyLocalInfo::LocalInfoAccTechStatus");
+
+    if ( aClearStatus )
+        {
+        iLocalInfoAccTechOngoing = EFalse;
+        }
+
+    return iLocalInfoAccTechOngoing;
+    }
 
 // -----------------------------------------------------------------------------
 // CSatNotifyTimerMgmt::CSatNotifyTimerMgmt
--- a/adaptationlayer/tsy/simatktsy_dll/src/satutil.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satutil.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1045,34 +1045,40 @@
         aBerTlv.TlvByTagValue( &duration, KTlvDurationTag ) );
     if ( KErrNotFound != returnValue )
         {
-        TUint8 durationTimeUnit = duration.GetShortInfo( ETLV_TimeUnit );
-        switch ( durationTimeUnit )
+        // Check if Duration TLV has real data
+        if ( duration.GetLength() )
             {
-            case KMinutes:
-                {
-                // Minutes
-                aTDuration.iTimeUnit = RSat::EMinutes;
-                break;
-                }
-            case KSeconds:
+            TUint8 durationTimeUnit( duration.GetShortInfo( ETLV_TimeUnit ) );
+            switch ( durationTimeUnit )
                 {
-                // Seconds
-                aTDuration.iTimeUnit = RSat::ESeconds;
-                break;
+                case KMinutes:
+                    {
+                    // Minutes
+                    aTDuration.iTimeUnit = RSat::EMinutes;
+                    break;
+                    }
+                case KSeconds:
+                    {
+                    // Seconds
+                    aTDuration.iTimeUnit = RSat::ESeconds;
+                    break;
+                    }
+                case KTenthsOfSeconds:
+                    {
+                    // Tenths of seconds
+                    aTDuration.iTimeUnit = RSat::ETenthsOfSeconds;
+                    break;
+                    }
+                default:
+                    {
+                    aTDuration.iTimeUnit = RSat::ETimeUnitNotSet;
+                    break;
+                    }
                 }
-            case KTenthsOfSeconds:
-                {
-                // Tenths of seconds
-                aTDuration.iTimeUnit = RSat::ETenthsOfSeconds;
-                break;
-                }
-            default:
-                {
-                aTDuration.iTimeUnit = RSat::ETimeUnitNotSet;
-                }
+                // Time interval
+                aTDuration.iNumOfUnits =
+                    duration.GetShortInfo( ETLV_TimeInteval );
             }
-            // Time interval
-            aTDuration.iNumOfUnits = duration.GetShortInfo( ETLV_TimeInteval );
         }
     }
 
--- a/connectivitylayer/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -19,7 +19,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 #include "../usbphonetlink/group/bld.inf"
 #include "../isce/group/bld.inf"
--- a/connectivitylayer/isce/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -22,7 +22,7 @@
 #define NCP_COMMON_RD_ISCE_IN_USE
 #ifdef NCP_COMMON_RD_ISCE_IN_USE // Internal R&D flag
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 // IBY FILES
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/iadhelpers.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/iadhelpers.h	Wed Apr 21 14:29:55 2010 +0300
@@ -23,7 +23,7 @@
 
 // MACROS
 
-#if defined ( __WINS__ )
+#if defined ( __WINS__ ) || defined(ISI_LENGTH_BIG_ENDIAN)
 #define MESSAGELENGTH_LSB 5
 #define MESSAGELENGTH_MSB 4
 #else
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/iadtrace.h	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/iadtrace.h	Wed Apr 21 14:29:55 2010 +0300
@@ -42,24 +42,24 @@
     EIADDoNotCallInISRContext,                  // 0x09  ident 0
     EIADDFCAlreadyQueued,                       // 0x0a  ident 2
     EIADWrongKernelResponse,                    // 0x0b  ident 0
-    EIADDesReadFailed,                          // 0x0d  ident 9
-    EIADConfigurationInvalid,                   // 0x0e  ident 0
-    EIADInvalidCtrlMessage,                     // 0x0f  ident 4
-    EIADCmtConnectionNotInit,                   // 0x10  ident 0
-    EIADCmtConnectionLost,                      // 0x11  ident 4
-    EIADTooManyBytesToPresent,                  // 0x12  ident 0
-    EIADChannelOpenedBeforePhysicalLayerInit,   // 0x13  ident 0
-    EIADWrongTypeOfOpenPending,                 // 0x14  ident 2
-    EIADBufferNotReleased,                      // 0x15  ident 0
-    EIADUnknownPipeFCType,                      // 0x16  ident 2
-    EIADWrongPipeHandle,                        // 0x17  ident 10
-    EIADUnknownPipeOrPepMsg,                    // 0x18  ident 2
-    EIADUnkownMedia,                            // 0x19  ident 0
-    EIADIndicationOrderFailed,                  // 0x2a  ident 0
-    EIADNotSupported,                           // 0x2b  ident 5
-    EIADCommon,                                 // 0x2c  ident 0
-    EIADOverTheLimits,                          // 0x2d  ident 43
-    EIADDesWriteFailed,                         // 0x2e  ident 4
+    EIADDesReadFailed,                          // 0x0c  ident 9
+    EIADConfigurationInvalid,                   // 0x0d  ident 0
+    EIADInvalidCtrlMessage,                     // 0x0e  ident 4
+    EIADCmtConnectionNotInit,                   // 0x0f  ident 0
+    EIADCmtConnectionLost,                      // 0x10  ident 4
+    EIADTooManyBytesToPresent,                  // 0x11  ident 0
+    EIADChannelOpenedBeforePhysicalLayerInit,   // 0x12  ident 0
+    EIADWrongTypeOfOpenPending,                 // 0x13  ident 2
+    EIADBufferNotReleased,                      // 0x14  ident 0
+    EIADUnknownPipeFCType,                      // 0x15  ident 2
+    EIADWrongPipeHandle,                        // 0x16  ident 10
+    EIADUnknownPipeOrPepMsg,                    // 0x17  ident 2
+    EIADUnkownMedia,                            // 0x18  ident 0
+    EIADIndicationOrderFailed,                  // 0x19  ident 0
+    EIADNotSupported,                           // 0x1a  ident 5
+    EIADCommon,                                 // 0x1b  ident 0
+    EIADOverTheLimits,                          // 0x1c  ident 43
+    EIADDesWriteFailed,                         // 0x1d  ident 4
     };
 // Used to identify code line where reset happens
 enum TIADFaultIdentifier
@@ -89,24 +89,24 @@
     EIADFaultIdentifier23,                       // 0x17
     EIADFaultIdentifier24,                       // 0x18
     EIADFaultIdentifier25,                       // 0x19
-    EIADFaultIdentifier26,                       // 0x20
-    EIADFaultIdentifier27,                       // 0x21
-    EIADFaultIdentifier28,                       // 0x22    
-    EIADFaultIdentifier29,                       // 0x23    
-    EIADFaultIdentifier30,                       // 0x24    
-    EIADFaultIdentifier31,                       // 0x25    
-    EIADFaultIdentifier32,                       // 0x26    
-    EIADFaultIdentifier33,                       // 0x27    
-    EIADFaultIdentifier34,                       // 0x28    
-    EIADFaultIdentifier35,                       // 0x29    
-    EIADFaultIdentifier36,                       // 0x2a    
-    EIADFaultIdentifier37,                       // 0x2b    
-    EIADFaultIdentifier38,                       // 0x2c    
-    EIADFaultIdentifier39,                       // 0x2d    
-    EIADFaultIdentifier40,                       // 0x2e    
-    EIADFaultIdentifier41,                       // 0x2f    
-    EIADFaultIdentifier42,                       // 0x30    
-    EIADFaultIdentifier43,                       // 0x31    
+    EIADFaultIdentifier26,                       // 0x1a
+    EIADFaultIdentifier27,                       // 0x1b
+    EIADFaultIdentifier28,                       // 0x1c    
+    EIADFaultIdentifier29,                       // 0x1d    
+    EIADFaultIdentifier30,                       // 0x1e    
+    EIADFaultIdentifier31,                       // 0x1f    
+    EIADFaultIdentifier32,                       // 0x20    
+    EIADFaultIdentifier33,                       // 0x21    
+    EIADFaultIdentifier34,                       // 0x22    
+    EIADFaultIdentifier35,                       // 0x23    
+    EIADFaultIdentifier36,                       // 0x24    
+    EIADFaultIdentifier37,                       // 0x25    
+    EIADFaultIdentifier38,                       // 0x26    
+    EIADFaultIdentifier39,                       // 0x27    
+    EIADFaultIdentifier40,                       // 0x28    
+    EIADFaultIdentifier41,                       // 0x29    
+    EIADFaultIdentifier42,                       // 0x2a    
+    EIADFaultIdentifier43,                       // 0x2b    
     };
     
 //ISCE
--- a/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -256,16 +256,19 @@
             iChannelTable[ aChannelId ].iChannel = NULL;
             iChannelTable[ aChannelId ].iWaitingChannel = NULL;
             iChannelTable[ aChannelId ].iType = ENormalOpen;
-            const TInt indicationCancelOrderSize( 2 );
-            TDes8& cancelOrder = AllocateBlock( indicationCancelOrderSize );
-            cancelOrder.Append( 0x00 );
-            cancelOrder.Append( 0x00 );
-            // Order internally, so no return values above ::Close { 0x00, 0x00 } 8-bit cancel indication.
-            TInt error( OrderIndication( cancelOrder, aChannelId, EFalse ) );
-            C_TRACE( ( _T( "DRouter::Close open->close indication order returned %d 0x%x" ), error, aChannelId ) );
-            OstTraceExt2( TRACE_NORMAL, DROUTER_CLOSE, "DRouter::Close open->close indication order returned;error=%d;aChannelId=%x", error, aChannelId );
-            ASSERT_RESET_ALWAYS( KErrNone == error, EIADIndicationOrderFailed | static_cast<TUint8>( ( aChannelId << KChannelNumberShift ) ) );
-            DeAllocateBlock( cancelOrder );
+            if( iConnectionStatus == EIADConnectionOk )
+                {
+                const TInt indicationCancelOrderSize( 2 );
+                TDes8& cancelOrder = AllocateBlock( indicationCancelOrderSize );
+                cancelOrder.Append( 0x00 );
+                cancelOrder.Append( 0x00 );
+                // Order internally, so no return values above ::Close { 0x00, 0x00 } 8-bit cancel indication.
+                TInt error( OrderIndication( cancelOrder, aChannelId, EFalse ) );
+                C_TRACE( ( _T( "DRouter::Close open->close indication order returned %d 0x%x" ), error, aChannelId ) );
+                OstTraceExt2( TRACE_NORMAL, DROUTER_CLOSE, "DRouter::Close open->close indication order returned;error=%d;aChannelId=%x", error, aChannelId );
+                ASSERT_RESET_ALWAYS( KErrNone == error, EIADIndicationOrderFailed | static_cast<TUint8>( ( aChannelId << KChannelNumberShift ) ) );
+                DeAllocateBlock( cancelOrder );
+                }
 #if (NCP_COMMON_SOS_VERSION_SUPPORT >= SOS_VERSION_95)
             }
         else
@@ -275,6 +278,7 @@
             iChannelTable[ aChannelId ].iType = ENormalOpen;
             iChannelTable[ aChannelId ].iChannel = iChannelTable[ aChannelId ].iWaitingChannel;
             iChannelTable[ aChannelId ].iWaitingChannel = NULL;
+            // TODO: When pipe functionality working, call PipeLoanReturned
             }
 #endif
         }
@@ -649,6 +653,12 @@
                 iNameService->Receive( aMessage );
                 C_TRACE( ( _T( "DRouter::SendMessage sending to NAMESERVICE<" ) ) );
                 }
+            else if ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ||
+                      msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_PC )
+                {
+                C_TRACE( ( _T( "DRouter::SendMessage to 0x%x" ), msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] ) );
+                this->MessageReceived( aMessage );
+                }
             else // Normal way
                 {
                 // The IST shall deallocate the block when it's approriate to do.
@@ -664,7 +674,10 @@
         OstTraceExt2( TRACE_NORMAL, DUP1_DROUTER_SENDMESSAGE, "DRouter::SendMessage;aCh=%hx;error=%d", aCh, error );
         // Deallocate the block.
         TRACE_ASSERT_INFO( 0, (TUint8)aCh<<KChannelNumberShift | (TUint8)error );
-        this->DeAllocateBlock( aMessage );
+        if ( error != KErrNotReady ) // No deallocation if no connection
+            {
+            this->DeAllocateBlock( aMessage );
+            }
         // TODO: who should NULL the block? IST or IAD
         }
     C_TRACE( ( _T( "DRouter::SendMessage 0x%x %d %d <-" ), &aMessage, aCh, error ) );
@@ -1274,14 +1287,19 @@
     TUint8* msgBlockPtr = const_cast<TUint8*>( aMessage.Ptr() );
     ASSERT_RESET_ALWAYS( aMessage.Length() > ISI_HEADER_OFFSET_MEDIA, EIADOverTheLimits | EIADFaultIdentifier10 << KFaultIdentifierShift  );
     if ( aCh == EIADNokiaUsbPhonetLink )
- 	      {
+        {
         msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
-        SET_RECEIVER_DEV( msgBlockPtr, OTHER_DEVICE_1 );
+        C_TRACE( ( _T( "DRouter::SetSenderInfo 0x%x 0x%x 0x%x" ), aMessage.Ptr()[0], msgBlockPtr[ ISI_HEADER_OFFSET_MEDIA ], PN_MEDIA_SOS ) );
+        if( GET_RECEIVER_DEV( msgBlockPtr ) != PN_DEV_OWN)
+      	    {
+      	    C_TRACE( ( _T( "DRouter::SetSenderInfo to OTHER_DEVICE_1" ) ) );
+            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 )
+        if( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN || msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_PC )
             {
             C_TRACE( ( _T( "DRouter::SetSenderInfo message to APE from APE" ) ) );
             SET_SENDER_DEV( msgBlockPtr, PN_DEV_OWN );
@@ -1384,8 +1402,7 @@
 //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 ) );
-    Kern::Printf( "IADRouter::Connect" );
+    C_TRACE( ( _T( "MISIObjectRouterIf::Connect %d 0x%x 0x%x>" ), aUID, aObjId, aCallback ) );
     //Connect( aUID, aObjId, aCallback );
     if( aUID == KNameServiceUID )
         {
@@ -1411,7 +1428,6 @@
 TInt DRouter::Send( TDes8& aMessage, const TUint8 aObjId )
     {
   	C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x>" ), &aMessage, aObjId ) );
-    Kern::Printf( "IADRouter::Send" );
     if( aObjId == PN_OBJ_EVENT_MULTICAST ) //from communicationmanager
         {
         // Don't put to mainrxqueue
--- a/connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/isaaccessldd_ldd/src/isauserchannel.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -216,6 +216,21 @@
         delete iDataRxDeAllocate;
         iDataRxDeAllocate = NULL;
         }
+    if( iCleanDfc )
+        {
+        C_TRACE( ( _T( "DISAUserChannel::~DISAUserChannel iCleanDfc 0x%x" ), iCleanDfc ) );
+        iCleanDfc->Cancel();
+        delete iCleanDfc;
+        iCleanDfc = NULL;
+        }
+    if( iCleanDataDfc )
+        {
+        C_TRACE( ( _T( "DISAUserChannel::~DISAUserChannel iCleanDataDfc 0x%x" ), iCleanDataDfc ) );
+        iCleanDataDfc->Cancel();
+        delete iCleanDataDfc;
+        iCleanDataDfc = NULL;
+        }
+
     // Not owned
     OstTraceExt4( TRACE_NORMAL, DUP9_DISAUSERCHANNEL_DISAUSERCHANNEL, "DISAUserChannel::~DISAUserChannel;iIADConnectionStatusPtr=%x;iIADFlowControlStatusPtr=%x;iReceiveBufPtr=%x;iDataReceiveBufPtr=%x", (TUint)iIADConnectionStatusPtr, (TUint)iIADFlowControlStatusPtr, (TUint)iReceiveBufPtr, (TUint)iDataReceiveBufPtr );
     
@@ -290,8 +305,16 @@
     if( !Kern::CurrentThreadHasCapability( ECapabilityCommDD, __PLATSEC_DIAGNOSTIC_STRING( "Check by: ISAAccessDriver" ) ) ) return KErrPermissionDenied;  
     ASSERT_RESET_ALWAYS( anInfo, EIADChannelNumberNotSpecifiedInInfo | EIADFaultIdentifier1 << KFaultIdentifierShift );
     // Check for channel number inside anInfo.
-    ASSERT_RESET_ALWAYS( anInfo->Length() > 0 , EIADOverTheLimits | EIADFaultIdentifier39 << KFaultIdentifierShift );                                                
-    TUint16 channel = static_cast<TUint16>( ( *anInfo )[ 0 ] );
+    TUint8* buffer = reinterpret_cast<TUint8*>( Kern::Alloc( 1 ) );
+    ASSERT_RESET_ALWAYS( buffer, EIADMemoryAllocationFailure | EIADFaultIdentifier25 << KFaultIdentifierShift );
+    
+    TPtr8* bufferPtr = new TPtr8( buffer, 1 );    
+    ASSERT_RESET_ALWAYS( bufferPtr, EIADMemoryAllocationFailure | EIADFaultIdentifier26 << KFaultIdentifierShift );
+    
+    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, anInfo, *bufferPtr, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier10 << KFaultIdentifierShift );
+    ASSERT_RESET_ALWAYS( bufferPtr->Length() > 0 , EIADOverTheLimits | EIADFaultIdentifier39 << KFaultIdentifierShift );
+    
+    TUint16 channel = static_cast<TUint16>( ( *bufferPtr )[ 0 ] );
     ASSERT_RESET_ALWAYS( ( channel < EIADNokiaLastUserChannel ),EIADWrongParameter | EIADFaultIdentifier19 << KFaultIdentifierShift );
     iChannelNumber = ~channel; // In user thread context thread in CS, cannot be pre-empted.
     C_TRACE( ( _T( "DISAUserChannel::DoCreate channelnumber 0x%x 0x%x" ), iChannelNumber, this ) );
@@ -313,7 +336,10 @@
     TInt threadOpen( thread->Open() );
     TRACE_ASSERT_INFO( threadOpen == KErrNone, (TUint8)iChannelNumber << KChannelNumberShift );
     C_TRACE( ( _T( "DISAUserChannel::DoCreate 0x%x %d <-" ), iChannelNumber, threadOpen ) );
-
+    
+    Kern::Free( buffer );
+    delete bufferPtr;
+    
     OstTraceExt3( TRACE_NORMAL, DISAUSERCHANNEL_DOCREATE_EXIT, "<DISAUserChannel::DoCreate;iChannelNumber=%hx;this=%x;retVal=%d", iChannelNumber, (TUint)this, threadOpen );    
     return threadOpen;
     }
@@ -1168,30 +1194,34 @@
             case EIADAsyncSend:
                 {
                 C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSend" ) ) );
-                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-                TAny* secondParam = reinterpret_cast<TAny*>( tablePtr[ KSecondParam ] );
-                ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier23 << KFaultIdentifierShift  );
-                TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
-                C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSend 0x%x %d" ), secondParam, msgLength ) );
-                OstTraceExt2( TRACE_NORMAL, DUP10_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSend;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );
-                
-                TInt error( KErrBadDescriptor );
-                if( msgLength > 0 )
+                TInt error(KErrNotReady);
+                if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                     {
-                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
-                    // one copy from user to allocated block that is to be send.
-                    TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
-                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier2 << KFaultIdentifierShift );
-                    TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                    OstTraceExt2( TRACE_NORMAL, DUP16_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSend;sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+                    TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                    TAny* secondParam = reinterpret_cast<TAny*>( tablePtr[ KSecondParam ] );
+                    ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier23 << KFaultIdentifierShift  );
+                    TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSend 0x%x %d" ), secondParam, msgLength ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP10_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSend;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );
                     
-                    error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
-                    }
-                else
-                    {
-                    error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
-                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                    error = KErrBadDescriptor;
+                    if( msgLength > 0 )
+                        {
+                        // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
+                        // one copy from user to allocated block that is to be send.
+                        TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
+                        ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier2 << KFaultIdentifierShift );
+                        TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                        C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                        OstTraceExt2( TRACE_NORMAL, DUP16_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSend;sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+                        
+                        error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
+                        }
+                    else
+                        {
+                        error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
+                        TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                        }
                     }
                 CompleteChannelRequest( aRequest, error );
                 break;
@@ -1199,39 +1229,43 @@
             case EIADAsyncDataSend:
                 {
                 C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend" ) ) );
-                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-                TAny* secondParam = reinterpret_cast<TAny*>( tablePtr[ KSecondParam ] );
-                ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier24 << KFaultIdentifierShift  );
-                TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADAsyncDataSend 0x%x %d" ), secondParam, msgLength ) );
-                OstTraceExt2( TRACE_NORMAL, DUP9_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );                
-                TInt error( KErrBadDescriptor );
-                if( msgLength > KErrNone )
+                TInt error(KErrNotReady);
+                if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                     {
-                    // Allocate a block for data. Allocation adds +11 to the msglength for pipe headers
-                    TDes8& sendBlock = iExtensionApi->AllocateDataBlock( msgLength );
-                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend max %d length %d" ), sendBlock.MaxLength(), sendBlock.Length() ) );
-                    // Use pre-allocated TPtr (no memory allocation from heap nor stack).
-                    // Set it to point to +11 from sendblock and to be as long as data to be send
-                    TInt tmpMaxLength( sendBlock.MaxLength() - KPipeDataHeader );
-                    TUint8* tmpPtr( const_cast<TUint8*>( ( sendBlock.Ptr() + KPipeDataHeader ) ) );
-                    TPtr* test = static_cast<TPtr8*>( &sendBlock );
-                    test->Set( tmpPtr, 0, tmpMaxLength );
-                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, *test, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier3 << KFaultIdentifierShift );
-                    TInt tmpMaxLength2( sendBlock.MaxLength() + KPipeDataHeader );
-                    TInt tmpLength2( sendBlock.Length() + KPipeDataHeader );
-                    TUint8* tmpPtr2( const_cast<TUint8*>( ( sendBlock.Ptr() - KPipeDataHeader ) ) );
-                    test->Set( tmpPtr2, tmpLength2, tmpMaxLength2 );
-                    TRACE_ASSERT_INFO( sendBlock.Length() > msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                    OstTraceExt4( TRACE_NORMAL, DUP15_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend;sendBlock=%x;sendBlock.MaxLength()=%d;sendBlock.Length()=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.MaxLength(), sendBlock.Length(), iChannelNumber );
-                    
-                    error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
-                    }
-                else
-                    {
-                    error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
-                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                    TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                    TAny* secondParam = reinterpret_cast<TAny*>( tablePtr[ KSecondParam ] );
+                    ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier24 << KFaultIdentifierShift  );
+                    TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADAsyncDataSend 0x%x %d" ), secondParam, msgLength ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP9_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );                
+                    error = KErrBadDescriptor;
+                    if( msgLength > KErrNone )
+                        {
+                        // Allocate a block for data. Allocation adds +11 to the msglength for pipe headers
+                        TDes8& sendBlock = iExtensionApi->AllocateDataBlock( msgLength );
+                        C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend max %d length %d" ), sendBlock.MaxLength(), sendBlock.Length() ) );
+                        // Use pre-allocated TPtr (no memory allocation from heap nor stack).
+                        // Set it to point to +11 from sendblock and to be as long as data to be send
+                        TInt tmpMaxLength( sendBlock.MaxLength() - KPipeDataHeader );
+                        TUint8* tmpPtr( const_cast<TUint8*>( ( sendBlock.Ptr() + KPipeDataHeader ) ) );
+                        TPtr* test = static_cast<TPtr8*>( &sendBlock );
+                        test->Set( tmpPtr, 0, tmpMaxLength );
+                        ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, *test, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier3 << KFaultIdentifierShift );
+                        TInt tmpMaxLength2( sendBlock.MaxLength() + KPipeDataHeader );
+                        TInt tmpLength2( sendBlock.Length() + KPipeDataHeader );
+                        TUint8* tmpPtr2( const_cast<TUint8*>( ( sendBlock.Ptr() - KPipeDataHeader ) ) );
+                        test->Set( tmpPtr2, tmpLength2, tmpMaxLength2 );
+                        TRACE_ASSERT_INFO( sendBlock.Length() > msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                        C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                        OstTraceExt4( TRACE_NORMAL, DUP15_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncDataSend;sendBlock=%x;sendBlock.MaxLength()=%d;sendBlock.Length()=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.MaxLength(), sendBlock.Length(), iChannelNumber );
+                        
+                        error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
+                        }
+                    else
+                        {
+                        error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
+                        TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                        }
                     }
                 CompleteChannelRequest( aRequest, error );
                 break;
@@ -1240,33 +1274,37 @@
             case EIADAsyncSubscribeIndications32Bit:
                 {
                 C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications | EIADAsyncSubscribeIndications32Bit" ) ) );
-                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-                TAny* secondParam = reinterpret_cast<TAny*>(tablePtr[ KSecondParam ]);
-                ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier25 << KFaultIdentifierShift  );
-                TInt orderLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
-                C_TRACE( ( _T( "DISAUserChannel::DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications | EIADAsyncSubscribeIndications32Bit 0x%x %d" ), secondParam, orderLength ) );
-                OstTraceExt2( TRACE_NORMAL, DUP12_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications(8/32bit);secondParam=%x;orderLength=%d", (TUint)secondParam, orderLength );
-                
-                TInt error( KErrBadDescriptor );
-                if( orderLength > 0 )
+                TInt error(KErrNotReady);
+                if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                     {
-                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
-                    // one copy from user to allocated block that is to be send.
-                    TDes8& sendBlock = iExtensionApi->AllocateBlock( ( orderLength ) );
-                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier4 << KFaultIdentifierShift );
-                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications | EIADAsyncSubscribeIndications32Bit 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                    OstTraceExt2( TRACE_NORMAL, DUP14_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications(8/32bit);sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+                    TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                    TAny* secondParam = reinterpret_cast<TAny*>(tablePtr[ KSecondParam ]);
+                    ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier25 << KFaultIdentifierShift  );
+                    TInt orderLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
+                    C_TRACE( ( _T( "DISAUserChannel::DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications | EIADAsyncSubscribeIndications32Bit 0x%x %d" ), secondParam, orderLength ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP12_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications(8/32bit);secondParam=%x;orderLength=%d", (TUint)secondParam, orderLength );
                     
-                    TRACE_ASSERT_INFO( sendBlock.Length() == orderLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                    // No return values check needed. Request completed with error value by multiplexer
-                    TBool thirtyTwoBit( ( EIADSubscribeIndications32Bit == aRequest ) ? ETrue : EFalse );
-                    error = iExtensionApi->OrderIndication( sendBlock, iChannelNumber, thirtyTwoBit );
-                    iExtensionApi->DeAllocateBlock( sendBlock );
-                    }
-                else
-                    {
-                    error = orderLength;
-                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );                    
+                    error = KErrBadDescriptor;
+                    if( orderLength > 0 )
+                        {
+                        // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
+                        // one copy from user to allocated block that is to be send.
+                        TDes8& sendBlock = iExtensionApi->AllocateBlock( ( orderLength ) );
+                        ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier4 << KFaultIdentifierShift );
+                        C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications | EIADAsyncSubscribeIndications32Bit 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                        OstTraceExt2( TRACE_NORMAL, DUP14_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSubscribeIndications(8/32bit);sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+                        
+                        TRACE_ASSERT_INFO( sendBlock.Length() == orderLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                        // No return values check needed. Request completed with error value by multiplexer
+                        TBool thirtyTwoBit( ( EIADSubscribeIndications32Bit == aRequest ) ? ETrue : EFalse );
+                        error = iExtensionApi->OrderIndication( sendBlock, iChannelNumber, thirtyTwoBit );
+                        iExtensionApi->DeAllocateBlock( sendBlock );
+                        }
+                    else
+                        {
+                        error = orderLength;
+                        TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );                    
+                        }
                     }
                 CompleteChannelRequest( aRequest, error );
                 break;
@@ -1274,29 +1312,33 @@
             case EIADAsyncSendIndication:
                 {
                 C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication" ) ) );
-                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-                TAny* secondParam = reinterpret_cast<TAny*>(tablePtr[ KSecondParam ]);
-                ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier26 << KFaultIdentifierShift  );
-                TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
-                C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication TBR 0x%x %d" ), secondParam, msgLength ) );
-                OstTraceExt2( TRACE_NORMAL, DUP11_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );                
-                TInt error( KErrBadDescriptor );
-                if( msgLength > 0 )
+                TInt error(KErrNotReady);
+                if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                     {
-                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made now only
-                    // one copy from user to allocated block that is to be send.
-                    TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
-                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier5 << KFaultIdentifierShift );
-                    TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication 0x%x %d %d 0x%x" ), &sendBlock, sendBlock.Length(), msgLength, iChannelNumber ) );
-                    OstTraceExt5( TRACE_NORMAL, DUP13_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication;sendBlock=%x;sendBlock.Length()=%d;sendBlock.MaxLength()=%d;msgLength=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), sendBlock.MaxLength(), msgLength, iChannelNumber );
-                    
-                    error = iExtensionApi->SendIndication( sendBlock, iChannelNumber );
-                    }
-                else
-                    {
-                    error = msgLength;
-                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );
+                    TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                    TAny* secondParam = reinterpret_cast<TAny*>(tablePtr[ KSecondParam ]);
+                    ASSERT_RESET_ALWAYS( secondParam, EIADNullParameter | EIADFaultIdentifier26 << KFaultIdentifierShift  );
+                    TInt msgLength( Kern::ThreadGetDesLength( iThread, secondParam ) );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication TBR 0x%x %d" ), secondParam, msgLength ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP11_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication;secondParam=%x;msgLength=%d", (TUint)secondParam, msgLength );                
+                    error = KErrBadDescriptor;
+                    if( msgLength > 0 )
+                        {
+                        // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made now only
+                        // one copy from user to allocated block that is to be send.
+                        TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
+                        ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, secondParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier5 << KFaultIdentifierShift );
+                        TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                        C_TRACE( ( _T( "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication 0x%x %d %d 0x%x" ), &sendBlock, sendBlock.Length(), msgLength, iChannelNumber ) );
+                        OstTraceExt5( TRACE_NORMAL, DUP13_DISAUSERCHANNEL_HANDLEASYNCREQUEST, "DISAUserChannel::HandleAsyncRequest EIADAsyncSendIndication;sendBlock=%x;sendBlock.Length()=%d;sendBlock.MaxLength()=%d;msgLength=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), sendBlock.MaxLength(), msgLength, iChannelNumber );
+                        
+                        error = iExtensionApi->SendIndication( sendBlock, iChannelNumber );
+                        }
+                    else
+                        {
+                        error = msgLength;
+                        TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );
+                        }
                     }
                 CompleteChannelRequest( aRequest, error );
                 break;
@@ -1395,70 +1437,78 @@
         case EIADSend:
             {
             C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSend" ) ) );
-            TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-            TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
-            ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier27 << KFaultIdentifierShift  );
-            TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
-            C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSend 0x%x %d" ), firstParam, msgLength ) );
-            OstTraceExt2( TRACE_NORMAL, DUP2_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSend;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );
-            
-            if( msgLength > 0 )
-                {
-                // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
-                // one copy from user to allocated block that is to be send.
-                TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
-                ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier6 << KFaultIdentifierShift );
-                TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                OstTraceExt2( TRACE_NORMAL, DUP13_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSend;sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+            error = KErrNotReady;
+            if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
+                {                
+                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
+                ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier27 << KFaultIdentifierShift  );
+                TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
+                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSend 0x%x %d" ), firstParam, msgLength ) );
+                OstTraceExt2( TRACE_NORMAL, DUP2_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSend;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );
                 
-                error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
-                }
-            else
-                {
-                error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
-                TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                if( msgLength > 0 )
+                    {
+                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
+                    // one copy from user to allocated block that is to be send.
+                    TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
+                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier6 << KFaultIdentifierShift );
+                    TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP13_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSend;sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );
+                    
+                    error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
+                    }
+                else
+                    {
+                    error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
+                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                    }
                 }
             break;
             }
         case EIADDataSend:
             {
             C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADDataSend" ) ) );
-            TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-            TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
-            ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier32 << KFaultIdentifierShift  );
-            TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
-            C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADDataSend 0x%x %d" ), firstParam, msgLength ) );
-            OstTraceExt2( TRACE_NORMAL, DUP3_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADDataSend;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );            
-            if( msgLength > 0 )
-                {
-                // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
-                // one copy from user to allocated block that is to be send.
-                
-                // Allocate a block for data. Allocation adds +11 to the msglength for pipe headers
-                TDes8& sendBlock = iExtensionApi->AllocateDataBlock( msgLength );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest max %d length %d" ), sendBlock.MaxLength(), sendBlock.Length() ) );
-                // Use pre-allocated TPtr (no memory allocation from heap nor stack).
-                // Set it to point to +11 from sendblock and to be as long as data to be send
-                TInt tmpMaxLength( sendBlock.MaxLength() - KPipeDataHeader );
-                TUint8* tmpPtr( const_cast<TUint8*>( ( sendBlock.Ptr() + KPipeDataHeader ) ) );
-                TPtr* test = static_cast<TPtr8*>( &sendBlock );
-                test->Set( tmpPtr, 0, tmpMaxLength );
-                ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, *test, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier7 << KFaultIdentifierShift );
-                TInt tmpMaxLength2( sendBlock.MaxLength() + KPipeDataHeader );
-                TInt tmpLength2( sendBlock.Length() + KPipeDataHeader );
-                TUint8* tmpPtr2( const_cast<TUint8*>( ( sendBlock.Ptr() - KPipeDataHeader ) ) );
-                test->Set( tmpPtr2, tmpLength2, tmpMaxLength2 );
-                TRACE_ASSERT_INFO( sendBlock.Length() > msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADDataSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                OstTraceExt4( TRACE_NORMAL, DUP4_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADDataSend;sendBlock=%x;Length=%x;MaxLength=%x;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), sendBlock.MaxLength(), iChannelNumber );
-                
-                error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
-                }
-            else
-                {
-                error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
-                TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+            error = KErrNotReady;
+            if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
+                {                
+                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
+                ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier32 << KFaultIdentifierShift  );
+                TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
+                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADDataSend 0x%x %d" ), firstParam, msgLength ) );
+                OstTraceExt2( TRACE_NORMAL, DUP3_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADDataSend;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );            
+                if( msgLength > 0 )
+                    {
+                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
+                    // one copy from user to allocated block that is to be send.
+                    
+                    // Allocate a block for data. Allocation adds +11 to the msglength for pipe headers
+                    TDes8& sendBlock = iExtensionApi->AllocateDataBlock( msgLength );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest max %d length %d" ), sendBlock.MaxLength(), sendBlock.Length() ) );
+                    // Use pre-allocated TPtr (no memory allocation from heap nor stack).
+                    // Set it to point to +11 from sendblock and to be as long as data to be send
+                    TInt tmpMaxLength( sendBlock.MaxLength() - KPipeDataHeader );
+                    TUint8* tmpPtr( const_cast<TUint8*>( ( sendBlock.Ptr() + KPipeDataHeader ) ) );
+                    TPtr* test = static_cast<TPtr8*>( &sendBlock );
+                    test->Set( tmpPtr, 0, tmpMaxLength );
+                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, *test, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier7 << KFaultIdentifierShift );
+                    TInt tmpMaxLength2( sendBlock.MaxLength() + KPipeDataHeader );
+                    TInt tmpLength2( sendBlock.Length() + KPipeDataHeader );
+                    TUint8* tmpPtr2( const_cast<TUint8*>( ( sendBlock.Ptr() - KPipeDataHeader ) ) );
+                    test->Set( tmpPtr2, tmpLength2, tmpMaxLength2 );
+                    TRACE_ASSERT_INFO( sendBlock.Length() > msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADDataSend 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                    OstTraceExt4( TRACE_NORMAL, DUP4_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADDataSend;sendBlock=%x;Length=%x;MaxLength=%x;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), sendBlock.MaxLength(), iChannelNumber );
+                    
+                    error = iExtensionApi->SendMessage( sendBlock, iChannelNumber );
+                    }
+                else
+                    {
+                    error = ( msgLength == KErrNone ) ? KErrBadDescriptor : msgLength;
+                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)msgLength );
+                    }
                 }
             break;
             }
@@ -1466,59 +1516,67 @@
         case EIADSubscribeIndications32Bit:
             {
             C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications | EIADSubscribeIndications32Bit" ) ) );
-            TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-            TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
-            ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier29 << KFaultIdentifierShift  );
-            TInt orderLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
-            C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications | EIADSubscribeIndications32Bit 0x%x %d" ), firstParam, orderLength ) );
-            OstTraceExt2( TRACE_NORMAL, DUP5_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications(8/32bit);firstParam=%x;orderLength=%d", (TUint)firstParam, orderLength );
-            
-            if( orderLength > KErrNone )
+            error = KErrNotReady;
+            if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                 {
-                // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
-                // one copy from user to allocated block that is to be send.
-                TDes8& sendBlock = iExtensionApi->AllocateBlock( ( orderLength ) );
-                ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier8 << KFaultIdentifierShift );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
-                OstTraceExt2( TRACE_NORMAL, DUP7_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications(8/32bit);sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );                
-                TRACE_ASSERT_INFO( sendBlock.Length() == orderLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                // No return values check needed. Request completed with error value by multiplexer
-                TBool thirtyTwoBit( ( EIADSubscribeIndications32Bit == aRequest ) ? ETrue : EFalse );
-                error = iExtensionApi->OrderIndication( sendBlock, iChannelNumber, thirtyTwoBit );
-                iExtensionApi->DeAllocateBlock( sendBlock );
-                }
-            else
-                {
-                error = orderLength;
-                TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error);
+                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
+                ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier29 << KFaultIdentifierShift  );
+                TInt orderLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
+                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications | EIADSubscribeIndications32Bit 0x%x %d" ), firstParam, orderLength ) );
+                OstTraceExt2( TRACE_NORMAL, DUP5_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications(8/32bit);firstParam=%x;orderLength=%d", (TUint)firstParam, orderLength );
+                
+                if( orderLength > KErrNone )
+                    {
+                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made no only
+                    // one copy from user to allocated block that is to be send.
+                    TDes8& sendBlock = iExtensionApi->AllocateBlock( ( orderLength ) );
+                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier8 << KFaultIdentifierShift );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications 0x%x 0x%x" ), &sendBlock, iChannelNumber ) );
+                    OstTraceExt2( TRACE_NORMAL, DUP7_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSubscribeIndications(8/32bit);sendBlock=%x;iChannelNumber=%hx", (TUint)&sendBlock, iChannelNumber );                
+                    TRACE_ASSERT_INFO( sendBlock.Length() == orderLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                    // No return values check needed. Request completed with error value by multiplexer
+                    TBool thirtyTwoBit( ( EIADSubscribeIndications32Bit == aRequest ) ? ETrue : EFalse );
+                    error = iExtensionApi->OrderIndication( sendBlock, iChannelNumber, thirtyTwoBit );
+                    iExtensionApi->DeAllocateBlock( sendBlock );
+                    }
+                else
+                    {
+                    error = orderLength;
+                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error);
+                    }
                 }
             break;
             }
         case EIADSendIndication:
             {
             C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSendIndication" ) ) );
-            TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
-            TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
-            ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier30 << KFaultIdentifierShift  );
-            TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
-            C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSendIndication TBR 0x%x %d" ), firstParam, msgLength ) );
-            OstTraceExt2( TRACE_NORMAL, DUP6_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSendIndication;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );
-            if( msgLength > KErrNone )
+            error = KErrNotReady;
+            if ( iExtensionApi->GetConnectionStatus() == EIADConnectionOk )
                 {
-                // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made now only
-                // one copy from user to allocated block that is to be send.
-                TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
-                ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier9 << KFaultIdentifierShift );
-                TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
-                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSendIndication 0x%x %d %d 0x%x" ), &sendBlock, sendBlock.Length(), msgLength, iChannelNumber ) );
-                OstTraceExt4( TRACE_NORMAL, DUP8_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSendIndication;sendBlock=%x;sendBlock.Length()=%d;msgLength=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), msgLength, iChannelNumber );
-                // No return values check needed. Request completed with error value by multiplexer
-                error = iExtensionApi->SendIndication( sendBlock, iChannelNumber );
-                }
-            else
-                {
-                error = msgLength;
-                TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );
+                TUint32* tablePtr = reinterpret_cast<TUint32*>( a1 );
+                TAny* firstParam = reinterpret_cast<TAny*>(tablePtr[ KFirstParam ]);
+                ASSERT_RESET_ALWAYS( firstParam, EIADNullParameter | EIADFaultIdentifier30 << KFaultIdentifierShift  );
+                TInt msgLength( Kern::ThreadGetDesLength( iThread, firstParam ) );
+                C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSendIndication TBR 0x%x %d" ), firstParam, msgLength ) );
+                OstTraceExt2( TRACE_NORMAL, DUP6_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSendIndication;firstParam=%x;msgLength=%d", (TUint)firstParam, msgLength );
+                if( msgLength > KErrNone )
+                    {
+                    // Previously there were Kern::Alloc (allocating from kernel memory a block where copy from user was made now only
+                    // one copy from user to allocated block that is to be send.
+                    TDes8& sendBlock = iExtensionApi->AllocateBlock( msgLength );
+                    ASSERT_RESET_ALWAYS( KErrNone == Kern::ThreadDesRead( iThread, firstParam, sendBlock, 0, KChunkShiftBy0 ), EIADDesReadFailed | EIADFaultIdentifier9 << KFaultIdentifierShift );
+                    TRACE_ASSERT_INFO( sendBlock.Length() == msgLength, (TUint8)iChannelNumber << KChannelNumberShift );
+                    C_TRACE( ( _T( "DISAUserChannel::HandleSyncRequest EIADSendIndication 0x%x %d %d 0x%x" ), &sendBlock, sendBlock.Length(), msgLength, iChannelNumber ) );
+                    OstTraceExt4( TRACE_NORMAL, DUP8_DISAUSERCHANNEL_HANDLESYNCREQUEST, "DISAUserChannel::HandleSyncRequest EIADSendIndication;sendBlock=%x;sendBlock.Length()=%d;msgLength=%d;iChannelNumber=%hx", (TUint)&sendBlock, sendBlock.Length(), msgLength, iChannelNumber );
+                    // No return values check needed. Request completed with error value by multiplexer
+                    error = iExtensionApi->SendIndication( sendBlock, iChannelNumber );
+                    }
+                else
+                    {
+                    error = msgLength;
+                    TRACE_ASSERT_INFO( 0, (TUint8)iChannelNumber << KChannelNumberShift | (TUint16)error );
+                    }
                 }
             break;
             }
--- a/connectivitylayer/isce/iscapi_dll/src/isaapi.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/iscapi_dll/src/isaapi.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -176,7 +176,11 @@
     TInt error( KErrInUse );
     if( KNotInitializedChannel == iChannelNumber )
         {
-        TBuf8<KInfoLength> info;
+        HBufC8* buffer = NULL;
+        TRAPD( err, buffer = HBufC8::NewL( KInfoLength ) );        
+        ASSERT_PANIC_ALWAYS( err == KErrNone, KErrNoMemory );
+        
+        TPtr8 info = buffer->Des();
         ASSERT_PANIC_ALWAYS( ( aChannelNumber < EIADNokiaLastUserChannel ), EIADChannelNumberOutofRange );
         C_TRACE( ( _T( "RIscApi::Open ldd" ) ) );
         OstTrace0( TRACE_NORMAL, RISCAPI_OPEN, "RIscApi::Open ldd" );        
@@ -187,6 +191,7 @@
                           NULL, 
                           &info, 
                           aType );
+        delete buffer;
         }
     if( KErrNone != error )
         {
--- a/connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -166,8 +166,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]  ) );
+            C_TRACE( ( _T( "<-DISINameService message to recDev: 0x%x" ),msgPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE]  ) );
+            C_TRACE( ( _T( "<-DISINameService message to recObj: 0x%x" ),msgPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT]  ) );
 
             //send data to router for handling
             iRouter->Send( *messagePtr, iObjId);
--- a/connectivitylayer/isce/p2prouter_dll/src/p2prouter.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isce/p2prouter_dll/src/p2prouter.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -309,7 +309,7 @@
         }
     // TODO:do more clever way to create links.
     // Configuration of links.
-    iLinksArray[ EP2PRpc ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PRpc, ETrxTest );
+    iLinksArray[ EP2PRpc ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PRpc, ETrxSharedMemory );
     iLinksArray[ EP2PTest ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PTest, ETrxTest );
     iLinksArray[ EP2PTest2 ] = MP2PRouterLinkIf::CreateLinkF( this, EP2PTest2, ETrxTest );
     iTrxPrecentDfc = new TDfc( TrxPrecentDfc, this, iP2PDfcQueList[ MP2PChRouterIf::EP2PDfcThread ], KDfcPriority );
--- a/connectivitylayer/isimessage/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isimessage/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -22,7 +22,7 @@
 
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 #if defined(NCP_COMMON_CELLMO_BRANCH_SUPPORT )\
  && (NCP_COMMON_CELLMO_BRANCH_SUPPORT==NCP_COMMON_CELLMO_BRANCH_WGMODEM25)
--- a/connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isimessage/isimessage_dll/src/tisi.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -554,7 +554,7 @@
     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 defined( __WINS__ ) || defined( __WINSCW__ ) || defined(ISI_LENGTH_BIG_ENDIAN)
         {
          if( iFinalLength == 0 )    // TIsiSend alternative constructor used
             {
--- a/connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/isimessage/isimessagekernel_dll/src/isikernel.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -561,7 +561,7 @@
     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 defined( __WINS__ ) || defined( __WINSCW__ ) || defined(ISI_LENGTH_BIG_ENDIAN)
         {
         if( iFinalLength == 0 )    // TIsiKernelSend alternative constructor used
             {               
--- a/connectivitylayer/usbphonetlink/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -19,7 +19,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 ../usbpnclient_dll/inc/rusbpnclient.h                           NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(rusbpnclient.h)
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnalt.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnalt.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -94,6 +94,10 @@
     OstTrace0( TRACE_NORMAL, CUSBPNALT_CUSBPNALT_DESTRUCTOR_ENTRY, "CUsbPnAlt::~CUsbPnAlt" );
     C_TRACE( ( _T( "CUsbPnAlt::~CUsbPnAlt()" ) ) );
 
+#ifndef NCP_COMMON_BRIDGE_FAMILY
+    SendControlMessage( PNS_USB_CABLE_UNPLUGGED );
+#endif /* NCP_COMMON_BRIDGE_FAMILY */
+
     Cancel();
 
     OstTrace0( TRACE_NORMAL, CUSBPNALT_CUSBPNALT_DESTRUCTOR_EXIT, "CUsbPnAlt::~CUsbPnAlt - return" );
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpninterface.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpninterface.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -129,7 +129,6 @@
         {
         delete iIsaReceiver;
         }
-    iIscApi.Close();
 
     if( iInitialised )
         {
@@ -141,6 +140,8 @@
         delete iAlt;
         }
 
+    iIscApi.Close();
+
     OstTrace0( TRACE_NORMAL, CUSBPNINTERFACE_CUSBPNINTERFACE_DESTRUCTOR_EXIT, "CUsbPnInterface::~CUsbPnInterface - return" );
     C_TRACE( ( _T( "CUsbPnInterface::~CUsbPnInterface() - return" ) ) );
     }
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -299,11 +299,12 @@
 
     OstTrace1( TRACE_DETAILED, CUSBPNISARECEIVER_CONSTRUCTMESSAGE, "CUsbPnIsaReceiver::ConstructMessage - Convert endianness;iRecvPtr.Length()=%d", iRecvPtr.Length() );
     E_TRACE( ( _T( "CUsbPnIsaReceiver::ConstructMessage() - Convert endianness - iRecvPtr.Length():%d" ), iRecvPtr.Length() ) );
+#ifdef ISI_LENGTH_LITTLE_ENDIAN
     TUint8 lsb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
     TUint8 msb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
     iRecvPtr[ISI_HEADER_OFFSET_LENGTH] = msb;
     iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = lsb;
-
+#endif // ISI_LENGTH_LITTLE_ENDIAN
     OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_CONSTRUCTMESSAGE_EXIT, "CUsbPnIsaReceiver::ConstructMessage - return void" );
     C_TRACE( ( _T( "CUsbPnIsaReceiver::ConstructMessage() - return void" ) ) );
     }
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -132,7 +132,14 @@
     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel()" ) ) );
 
     iLdd.ReadCancel( EEndpoint2 );
+
+#ifdef _DEBUG
     TRAPD(err, iPacket->ReleaseL());
+#elif defined OST_TRACE_COMPILER_IN_USE
+    TRAPD(err, iPacket->ReleaseL());
+#else
+    TRAP_IGNORE(iPacket->ReleaseL());
+#endif
 
     OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_DOCANCEL, "CUsbPnUsbReceiver::DoCancel - err=%d", err );
     C_TRACE( ( _T( "CUsbPnUsbReceiver::DoCancel() - err=%d" ), err ) );
@@ -232,14 +239,13 @@
             }
         default:
             {
-            TRACE_ASSERT_ALWAYS;
-            User::Panic( KUsbPnPanicCat, aError );
+            TRACE_ASSERT_ALWAYS;           
             break;
             }
         }
 
     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR_EXIT, "CUsbPnUsbReceiver::RunError - return" );
-    C_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() - return" ) ) );
+    C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError() - return" ) ) );
     return KErrNone;
     }
 
@@ -377,11 +383,13 @@
             iStorage = NULL;
             }
 
+#ifdef ISI_LENGTH_LITTLE_ENDIAN
         // Converts the endianess of message length
         TUint8 tmp4(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
         TUint8 tmp5(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
         iRecvPtr[ISI_HEADER_OFFSET_LENGTH] = tmp5;
         iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = tmp4;
+#endif // #ifdef ISI_LENGTH_LITTLE_ENDIAN
 
 #ifndef NCP_COMMON_BRIDGE_FAMILY
         // Message directly to APE Test Server.
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Wed Feb 17 13:58:55 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Wed Apr 21 14:29:55 2010 +0300
@@ -319,13 +319,12 @@
         default:
             {
             TRACE_ASSERT_ALWAYS;
-            User::Panic( KUsbPnPanicCat, aError );       
             break;     
             }
         }
 
     OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_RUNERROR_EXIT, "CUsbPnUsbSender::RunError - return" );
-    C_TRACE( ( _T( "CUsbPnUsbSender::RunL() - return" ) ) );
+    C_TRACE( ( _T( "CUsbPnUsbSender::RunError() - return" ) ) );
     return KErrNone;
     }
 
--- a/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/group/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -19,7 +19,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 #include "../rom/bld.inf"
 #include "../adaptationlayer/group/bld.inf"
--- a/rom/bld.inf	Wed Feb 17 13:58:55 2010 +0200
+++ b/rom/bld.inf	Wed Apr 21 14:29:55 2010 +0300
@@ -20,7 +20,7 @@
 #include <non_foundation_paths.hrh>
 
 PRJ_PLATFORMS
-DEFAULT
+BASEDEFAULT
 
 PRJ_EXPORTS
 modemadaptation.iby					NON_FOUNDATION_CORE_ADAPT_LAYER_IBY_EXPORT_PATH(modemadaptation.iby)