New release based on our 2010wk08 release
authormikaruus <mika.a.ruuskanen@nokia.com>
Wed, 17 Feb 2010 13:58:55 +0200
changeset 7 fa67e03b87df
parent 6 942573423a60
child 8 6295dc2169f3
New release based on our 2010wk08 release
adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp
adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_adaptation.h
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_trcommand.h
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_adaptation.cpp
adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_trcommand.cpp
adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/src/ssm_misc_adaptation.cpp
adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp
adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h
adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_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/cmmstaticutility.h
adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h
adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.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/cmmphonebookoperationwrite.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp
adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp
adaptationlayer/tsy/simatktsy_dll/inc/satcc.h
adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp
adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp
adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp
adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp
connectivitylayer/isce/group/bld.inf
connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp
connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h
connectivitylayer/isce/isaaccessextension_dll/inc/router.h
connectivitylayer/isce/isaaccessextension_dll/src/router.cpp
connectivitylayer/isce/isicommunicationmanager_dll/group/isicommunicationmanager.mmp
connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanager.h
connectivitylayer/isce/isicommunicationmanager_dll/inc/isiindicationhandler.h
connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp
connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp
connectivitylayer/isce/isinameservice_dll/eabi/isinameserviceu.def
connectivitylayer/isce/isinameservice_dll/group/isinameservice.mmp
connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h
connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp
connectivitylayer/isce/isirouter_dll/eabi/isirouteru.def
connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h
connectivitylayer/isce/isirouter_dll/inc/isirouter.h
connectivitylayer/isce/isirouter_dll/inc/misichannelrouterif.h
connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp
connectivitylayer/isce/isirouter_dll/src/isirouter.cpp
connectivitylayer/isce/rom/isce.iby
connectivitylayer/isimessage/isimessage_dll/group/isimessage.mmp
connectivitylayer/usbphonetlink/group/bld.inf
connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisareceiver.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbreceiver.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbsender.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnaltobserver.h
connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp
connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp
layers.sysdef.xml
--- a/adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/dataport/dataport_csy/src/dpflowctrl.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -137,6 +137,7 @@
             iFlowCtrlDp2Dcs = EFlowControlOn;
             iFlowCtrlDcs2Dp = EFlowControlOn;
             iPifDcs.SetPipeState( CDpPif::EDpPipeDisconnected );
+            iDataPort.ISAHandle().ResetBuffers();
             break;
             }
         default:
--- a/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/modematadaptation/modematext_dll/src/modemat_atext.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -20,8 +20,6 @@
 #include "modemat_atext.h"
 #include "modemattrace.h"
 
-const TInt KMaxCommandCount(137);
-
 const char* const atCommands[] =
     {
     ("ATS0"),
@@ -161,8 +159,11 @@
     ("AT"),
     ("LAST")
     };
- const TInt KPartLength = KDefaultCmdBufLength;
- const TInt KPackets = 10;
+
+const TInt KMaxCommandCount(sizeof(atCommands)/sizeof(const char*));
+
+const TInt KPartLength = KDefaultCmdBufLength;
+const TInt KPackets = 10;
 
 _LIT8(KATDCommand,"ATD");
 _LIT8(KATICommand,"ATI");
--- a/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_adaptation.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_adaptation.h	Wed Feb 17 13:58:55 2010 +0200
@@ -4,19 +4,19 @@
 *  Part of:        SSMA EmergencyCallRfAdaptation
 *  Interface:      N/A
 *  Description:    Declaration of CEmergencyCallRfAdaptation class
-*  %version:       1 %
-*  %date_modified: Tue Dec 29 15:37:57 2009 %
+*  %version:       2 %
+*  %date_modified: Thu Feb 04 15:16:30 2010 %
 * 
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-*
+* 
 * Contributors:
 *
 * Description:
--- a/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_trcommand.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/inc/ssm_emergencycallrf_trcommand.h	Wed Feb 17 13:58:55 2010 +0200
@@ -4,19 +4,19 @@
 *  Part of:        SSMA EmergencyCallRfAdaptation
 *  Interface:      N/A
 *  Description:    Declaration of CEmergencyCallRfTrCommand class
-*  %version:       1 %
-*  %date_modified: Tue Dec 29 15:38:00 2009 %
+*  %version:       2 %
+*  %date_modified: Thu Feb 04 15:16:34 2010 %
 *
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
-*
+* 
 * Contributors:
 *
 * Description:
--- a/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_adaptation.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_adaptation.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -4,18 +4,18 @@
 *  Part of:        SSMA EmergencyCallRfAdaptation
 *  Interface:      N/A
 *  Description:    Declaration of CEmergencyCallRfAdaptation class
-*  %version:       1 %
-*  %date_modified: Tue Dec 29 15:38:36 2009 %
+*  %version:       3 %
+*  %date_modified: Fri Feb 12 10:59:11 2010 %
 *
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
-* Nokia Corporation - initial contribution.
+* Nokia Corporation - initial contribution
 *
 * Contributors:
 *
@@ -496,9 +496,9 @@
     TUint8 transId( isiMsg.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
     TUint8 messageId( isiMsg.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
 
-    OstTraceExt3( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_2,
+/*    OstTraceExt3( TRACE_NORMAL, CEMERGENCYCALLRFADAPTATION_RECEIVEISIMESSAGEL_2,
                "SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL - ISI message Id(0x%x, 0x%x, 0x%x)",
-               resourceId, transId, messageId ); 
+               resourceId, transId, messageId ); */
     INTERNAL_TRACE((_L("SSMA - CEmergencyCallRfAdaptation::ReceiveIsiMessageL - ISI message Id(0x%x, 0x%x, 0x%x)"),
                         resourceId, transId, messageId ));
 
--- a/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_trcommand.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_emergencycallrf_adaptation_dll/src/ssm_emergencycallrf_trcommand.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -4,18 +4,18 @@
 *  Part of:        SSMA EmergencyCallRfAdaptation
 *  Interface:      N/A
 *  Description:    Implementation of CEmergencyCallRfTrCommand class
-*  %version:       1 %
-*  %date_modified: Tue Dec 29 15:38:38 2009 %
+*  %version:       2 %
+*  %date_modified: Thu Feb 04 15:16:42 2010 %
 *
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
-* Nokia Corporation - initial contribution.
+* Nokia Corporation - initial contribution
 *
 * Contributors:
 *
--- a/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/src/ssm_misc_adaptation.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/systemstatemanageradaptation/ssm_misc_adaptation_dll/src/ssm_misc_adaptation.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -4,8 +4,8 @@
 *  Part of:        SSMA MiscAdaptation
 *  Interface:      N/A
 *  Description:    Implementation of CMiscAdaptation class
-*  %version:       1 %
-*  %date_modified: Tue Dec 29 15:31:50 2009 %
+*  %version:       2 %
+*  %date_modified: Fri Feb 12 10:56:14 2010 %
 *
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
@@ -294,7 +294,7 @@
         languageList.Append(StartupAdaptation::EPrefLangEnglish);
         }
 
-    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_1,
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_2,
                "SSMA # CMiscAdaptation::GetSimLanguages - write languages to stream." );
     INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetSimLanguages - write languages to stream." ) );
 
@@ -309,7 +309,7 @@
     CleanupStack::PopAndDestroy();
     languageList.Close();
 
-    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_2,
+    OstTrace0( TRACE_NORMAL, CMISCADAPTATION_GETSIMLANGUAGES_3,
                "SSMA # CMiscAdaptation::GetSimLanguages - return void" );
     INTERNAL_TRACE( _L( "SSMA # CMiscAdaptation::GetSimLanguages - return void" ) );
     }
--- a/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/group/nokiatsy_dll.mmp	Wed Feb 17 13:58:55 2010 +0200
@@ -65,9 +65,11 @@
 SOURCE        cmmphonebookoperationread.cpp
 SOURCE        cmmphonebookoperationread3g_adn.cpp
 SOURCE        cmmphonebookoperationcache.cpp
+SOURCE        cmmphonebookoperationcache3g_adn.cpp
 SOURCE        cmmphonebookoperationwrite.cpp
 SOURCE        cmmenstoremesshandler.cpp
 SOURCE        cmmphonebookoperationdelete.cpp
+SOURCE        cmmphonebookoperationwrite3g_adn.cpp
 
 // SMS & other messaging
 SOURCE        cmmsmsmesshandler.cpp
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcallmesshandler.h	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -469,6 +469,20 @@
             TUint8 origPresentInd);
 
         /**
+        * Read all address connected (needed for COLP)
+        * @param aMobileCallInfo Call info
+        * @param aTargetOrig Target origin
+        * @param aIsiMessage Received ISI message
+        * @param aSbStartOffSet Subblock start offset
+        * @return void
+        */
+        void ReadAllAddressConnected(
+            RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
+            TBuf16<RMobilePhone::KMaxMobileTelNumberSize>& aTargetOrig,
+            const TIsiReceiveC &aIsiMessage,
+            TUint& aSbStartOffSet);
+
+        /**
         * Read origin call info
         * @param aMobileCallInfo Call info
         * @param aTargetOrigName Target origin name
@@ -793,6 +807,9 @@
         // call control result
         TUint8 iCcResult;
 
+        // flag telling whether resource control needs to be disabled
+        TUint8 iResourceControlSuppress;
+
     public:     // Friend classes
         // None
     protected:  // Friend classes
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmcustommesshandler.h	Wed Feb 17 13:58:55 2010 +0200
@@ -98,6 +98,8 @@
 const TUint8 KSimNumberOfCbMsgIds = 15;
 const TUint KUnusedCbMsgId = 0xffff;
 
+const TUint8 KCustomTransId = 6;
+
 // MACROS
     //None
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationcache.h	Wed Feb 17 13:58:55 2010 +0200
@@ -70,8 +70,8 @@
         */
         ~CMmPhoneBookOperationCache();
 
-    private:
-
+    protected:
+        
         /**
         * By default Symbian OS constructor is private.
         */
@@ -117,7 +117,8 @@
         // None
 
     protected: // Data
-        // None
+        // Store information about operation has been canceled or not
+        TBool iCancelOperation;
 
     private: // Data
 
@@ -132,9 +133,6 @@
         
         // To Store the information about no of entries filled in commontsy araay
         TInt iNumOfEntriesFilled;
-        
-        // Store information about operation has been canceled or not
-        TBool iCancelOperation;
 
         // Attribute to Store Entry
         TPBEntry* iStoreEntry;
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationinit3g_adn.h	Wed Feb 17 13:58:55 2010 +0200
@@ -144,31 +144,6 @@
         */
 
         TInt HandleUICCPbResp3GADN(const TDesC8 &aFileData, TInt aStatus, TUint8 aTransId );
-
-        /**
-        * Send Request to read Type 1 file info for ADN 3G initialization
-        * @param TDesC8& aFileData
-        * @return TInt: KErrNone or error value.
-        */
-
-        TInt FetchType1FileFromPBR(const TDesC8 &aFileData);
-
-        /**
-        * Send Request to read Type 2 file info for ADN 3G initialization
-        * @param TDesC8& aFileData
-        * @return TInt: KErrNone or error value.
-        */
-
-        TInt FetchType2FileFromPBR(const TDesC8 &aFileData);
-
-        /**
-        * Send Request to read Type 3 file info for ADN 3G initialization
-        * @param TDesC8& aFileData
-        * @return TInt: KErrNone or error value.
-        */
-
-        TInt FetchType3FileFromPBR(const TDesC8 &aFileData);
-
         
         /**
         * Handles FileData of Type 1 file info for ADN 3G initialization
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h	Wed Feb 17 13:58:55 2010 +0200
@@ -65,6 +65,7 @@
         */
         static CMmPhoneBookOperationWrite* NewL(
             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+            CMmUiccMessHandler* aUiccMessHandler,
             const CMmDataPackage* aDataPackage );
 
         /**
@@ -82,13 +83,54 @@
         static CMmPhoneBookOperationWrite* Build(
             TName aPhonebookType,
             TInt aIpc );
-
-  private:
-
+        
         /**
         * By default Symbian OS constructor is private.
         */
         CMmPhoneBookOperationWrite();
+        
+    protected:
+        
+        /**
+        * 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 );
+
+        /**
+        * Creates and sends ISI message in order to wite an entry to SIM
+        *
+        * @param aTraId Transaction id
+        * @param aIndex Location index
+        * @param aDataToWrite Entry to write
+        * @return KErrNone or error value
+        */
+        TInt UiccPbReqWriteL(
+            TUint8 aTraId,
+            TInt16 aIndex,
+            CPhoneBookStoreEntry& aDataToWrite );
+
+        /**
+        * Handles SimPbResp ISI -message
+        *
+        * @param aIsiMessage
+        * @param aComplete Indicates if request can remove from
+        *        operationlist or not.
+        * @return KErrNone or error value.
+        */
+        TBool HandleUICCPbRespL(
+                TInt aStatus,
+                TUint8 aDetails,
+                const TDesC8& aFileData,
+                TInt aTransId );
+
+
+
+  private:
+
 
         /**
         * Class attributes are created in ConstructL.
@@ -108,20 +150,6 @@
             TUint8 aTransId );
 
         /**
-        * Handles SimPbResp ISI -message
-        *
-        * @param aIsiMessage
-        * @param aComplete Indicates if request can remove from
-        *        operationlist or not.
-        * @return KErrNone or error value.
-        */
-        TBool HandleUICCPbRespL(
-                TInt aStatus,
-                TUint8 aDetails,
-                const TDesC8& aFileData,
-                TInt aTransId );
-
-        /**
         * Handles HandleWriteReadEntryResp aFileData
         *
         * @param aFileData
@@ -248,19 +276,6 @@
         * @param aDataToWrite Entry to write
         * @return KErrNone or error value
         */
-        TInt UiccPbReqWriteL(
-            TUint8 aTraId,
-            TInt16 aIndex,
-            CPhoneBookStoreEntry& aDataToWrite );
-
-        /**
-        * Creates and sends ISI message in order to wite an entry to SIM
-        *
-        * @param aTraId Transaction id
-        * @param aIndex Location index
-        * @param aDataToWrite Entry to write
-        * @return KErrNone or error value
-        */
         TInt UiccPBReqWriteEntry(
                 TUint16 aFileId,
                 TUint8 aIndex,
@@ -323,15 +338,6 @@
                 TUint8 aIndex,
                 TUint8 aTransId );
         
-        /**
-        * 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 );
-
         
         /**
         * Creates and sends ISI message in order to write MBI Profile form first record
@@ -345,15 +351,14 @@
         // None
 
     protected:  // Data
-        // none
-
-    private:    // Data
-
         // Attribute to hold the write enty while delete -request is on
         CPhoneBookStoreEntry* iPhoneBookEntry;
 
         // Keep track on current write -phase
         TPBWritePhases iCurrentWritePhase;
+
+        // Attribute Store the information if it is location search
+        TBool iLocationSearch;
         
         // Array to Store new EXT records
         RArray<TInt> iExtRecordArrayToBeWrite;
@@ -361,14 +366,15 @@
         // Array to store EXT record nos to be delete
        RArray<TInt> iExtRecordArrayToBeDelete; 
        
-       // EXT record number to be read
-       TInt iExtRecordNo;
-       
        // Store the no of ext records already written
        TUint8 iExtRecordWritten;
        
-       // Attribute Store the information if it is location search
-       TBool iLocationSearch;
+        
+    private:    // Data
+
+
+       // EXT record number to be read
+       TInt iExtRecordNo;
        
        // Attribute to store the information if delete EXT operation going on 
        TBool iExtDeleteOperation;
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoremesshandler.h	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -35,7 +35,7 @@
 #include "cmmuiccmesshandler.h"
 
 //  CONSTANTS
-    //none
+const TInt KUnusedLocation( 0xFF );
 
 //  MACROS
 
@@ -72,11 +72,23 @@
     MSISDNConfData,
     };
 
+struct TIapInfo
+    {
+    TUint16 fileId;
+    TUint8 fileSfi;
+    TUint8 fileTag;
+    TUint8 recordNo;
+    };
+
 struct TPBEntry
     {
     RArray<TInt> PBEntryExtRecord;
     TBool iEntryPresent;
-    TUint8 iEntryIndex;
+    TInt iEntryIndex;
+    TUint8 fileId;
+    TUint8 fileSFI;
+    RArray<TInt> groupNameIdentifiers;
+    RArray<TIapInfo> iapInfo;
     };
 
 struct TPBEntryList
@@ -89,26 +101,35 @@
     {
 public:
     TPrimitiveInitInfo();
-    
+
     void GetPBEntryFromUICCData( const TDesC8 &aFileData, TDes8& aNumber, TDes8& aName);
-    
-    
+
+
     TUint16 iNoOfRecords;          // 2 byte long
     TUint16 iAlphaStringlength;    // 2 byte long
     TUint16 iNumlength;          // 2 byte long
     TUint16 iExtNoOfRec;
-    TUint8 iMbiRecLen;          
+    TUint8 iMbiRecLen;
     TBool iExtension;
+
+    // Store ADN 3G realted Data also
+    TInt iPBRNoOfRecords;
+    TInt iIAPRecordLength;
+    TInt iANRNoOfRecords;
+    TInt iSNENoOfRecords;
+    TInt iSNEStringLength;
+    TInt iEmailNoOfRecords;
+    TInt iEmailStringLength;
     };
 
 
-// Struct 
+// Struct
 
 
 // look up table for BCD digits
 
-const TUint8 LookupArray[16]= 
-      {    
+const TUint8 LookupArray[16]=
+      {
               '0','1','2','3','4','5','6','7','8','9',    /* 0-9 */
               '*',                                        /* 0xA */
               '#',                                        /* 0xB */
@@ -117,8 +138,8 @@
               UICC_EXPANSION_CHAR,                     /* 0xE, Expansion digit */
       };
 
-const TUint8 LookupArrayAdn[16]= 
-      {    
+const TUint8 LookupArrayAdn[16]=
+      {
               '0','1','2','3','4','5','6','7','8','9',    /* 0-9 */
               '*',                                        /* 0xA */
               '#',                                        /* 0xB */
@@ -152,8 +173,8 @@
 * GSM-specific PBStore ISI messages.
 */
 class CMmPhoneBookStoreMessHandler
-    : public CBase, 
-      public MMmMessHandlerBase, 
+    : public CBase,
+      public MMmMessHandlerBase,
       public MMmMessageReceiver,
       public MUiccOperationBase
     {
@@ -183,7 +204,7 @@
             TInt aIpc,
             const CMmDataPackage* aDataPackage );
 
-        
+
         /**
         * Handles a received message by calling the specific
         * message handling method.
@@ -193,8 +214,12 @@
         * @param aFileData reference to Data received in message
         * @return KErrNone or error code
         */
-        TInt ProcessUiccMsg( TInt aTransactionId, TInt aStatus, TUint8 aDetails, const TDesC8 &aFileData );
-        
+        TInt ProcessUiccMsg(
+            TInt aTransactionId,
+            TInt aStatus,
+            TUint8 aDetails,
+            const TDesC8 &aFileData );
+
         /**
         * Creates entry point to correct operation.
         *
@@ -205,7 +230,7 @@
         CMmPhoneBookStoreOperationBase* CreateNewOperationL(
             const CMmDataPackage* aDataPackage,
             TInt aIpc );
-        
+
         /**
         * Store Phonebook Entry from UICC -message
         *
@@ -225,34 +250,70 @@
                                           const TBool aMailboxIdExist );
 
         /**
+        * Store ANR to phonebook entry
+        *
+        * @param aAnr Additional number
+        * @param aEntry Phonebook entry where ANR is added
+        * @param aFileId File ID
+        * @return none
+        */
+        static void StoreAnrToPhonebookEntryL(
+            TDes8& aAnr,
+            CPhoneBookStoreEntry& aEntry,
+            const TUint16 aFileId );
+
+
+        /**
+        * Store SNE or EMAIL to phonebook entry
+        * @param aString Second name/email address string
+        * @param aEntry Phonebook entry where SNE/EMAIL is added
+        * @param aFileTypeTag Tag indicating file type
+        * @return none
+        */
+        static void StoreSneEmailToPbEntryL(
+            TDes8& aString,
+            CPhoneBookStoreEntry& aEntry,
+            TUint8 aFileTypeTag );
+
+        /**
         * Handle number to convert in Ascii Format
         * @param const TDesC8& aSource: Message to be converted in Ascii
         * @param TDes16 aTarget : After conversion data to be staored in
         */
-        static void ConvertToUcs2FromBCD( const TDesC8 &aSource,TDes16 &aTarget, const TUint16 aFileData );
-        
+        static void ConvertToUcs2FromBCD(
+            const TDesC8 &aSource,
+            TDes16 &aTarget,
+            const TUint16 aFileData );
+
         /**
         * Handle number to convert in BCD format from UCS2 Format
         * @param const TDesC16& aSource: Message to be converted in BCD
         * @param TDes8 aTarget : After conversion data to be stored in target buffer
         */
-        static TInt ConvertToBCDFromUCS2( TDes16 &aSource, TDes8 &aTarget, TUint16 aFileId );
-        
+        static TInt ConvertToBCDFromUCS2(
+            TDesC16 &aSource,
+            TDes8 &aTarget,
+            TUint16 aFileId );
+
         /**
         * Handle number to convert in BCD format from UCS2 Format
         * @param TInt16 aUCSCharacter: Character to be converted
         * @param const TUint16 aFileId :File id
         * @return The BCD number
         */
-        static TInt GetBCDCodeforUCS( TUint16 aUCSCharacter, TUint16 aFileId );
-        
+        static TInt GetBCDCodeforUCS(
+            TUint16 aUCSCharacter,
+            TUint16 aFileId );
+
         /**
         * Sets PhoneBook Entry to PhoneBook Entry List.
         *
         * @param aStoreEntry.
         * @return None
         */
-        void StoreEntryToPhoneBookList( TPBEntry* aStoreEntry, TUint8 aPBIndex );
+        void StoreEntryToPhoneBookList(
+            TPBEntry* aStoreEntry,
+            TUint8 aPBIndex );
 
         /**
         * Reset phonebook entry in phoneBook entry list.
@@ -269,7 +330,10 @@
         * @param aStoreEntry.
         * @return None
         */
-        TBool IndexCheckInPBList( TUint8 aIndex, TUint8 aPBIndex, TPBEntry& aEntry );
+        TBool IndexCheckInPBList(
+            TUint8 aIndex,
+            TUint8 aPBIndex,
+            TPBEntry& aEntry );
 
         /**
         * Find Index for Present Entry
@@ -313,21 +377,48 @@
         void SetNumberOfFdnInfoResps( TUint8 aNumber );
 
         /**
-        * Remove the main Entry Information from Stored list 
+        * Remove the main Entry Information from Stored list
         *
         * @param aIndex - Index to be removed.
         * @return None
         */
-        void UpdateEntryFromList( TPBEntry* aEntry, TUint8 aIndex , TUint8 aPBIndex);
+        void UpdateEntryFromList(
+            TPBEntry* aEntry,
+            TUint8 aIndex,
+            TUint8 aPBIndex);
 
         /**
-        * Remove the EXT records Information from Stored list 
+        * Remove the EXT records Information from Stored list
         *
         * @param aIndex - Index of Ext record to be removed.
         * @return None
         */
         void RemoveExtEntryFromList( TUint8 aIndex, TUint8 aPBIndex);
-        
+
+
+        /**
+        * Finds entry from iPBEntryList
+        *
+        * @param TUint8 aIndex:
+        * @param TUint8 aRecordNo: record to be found
+        * @return TPBEntry*: pointer to found entry or NULL
+        */
+        TPBEntry* FindEntryFromPbList( TUint8 aIndex, TUint8 aRecordNo );
+
+
+        /**
+        * Finds corresponding ADN entry for type 2 file
+        *
+        * @param aCurrentType2EfIndex Index of current elementary file
+        * @param aCurrentRecordNum Current record number
+        * @param aArray ADN entry IDs are stored here
+        * @return None
+        */
+        void GetEntriesForType2FileId(
+            const TInt aCurrentType2EfIndex,
+            const TInt aCurrentRecordNum,
+            RArray<TInt>& aArray );
+
         /**
         * Gets pointer to CMmMessageRouter class.
         *
@@ -336,7 +427,7 @@
         */
         CMmMessageRouter* MessageRouter();
 
-        
+
         /**
         * Gets pointer to CMmUiccMessHandler class
         *
@@ -352,7 +443,7 @@
         * @return Pointer to CMmPhoNetSender object.
         */
         CMmPhoNetSender* PhoNetSender();
-        
+
     protected:
         // None
 
@@ -395,16 +486,16 @@
 
         // Pointer to the UICC Messhandler
         CMmUiccMessHandler* iMmUiccMessHandler;
-        
+
         // Array for storing objects of operations.
         CMmPhoneBookStoreOperationList* iOperationlist;
 
         // Number of FDN info responses
         TUint8 iNumberOfFdnInfoResps;
-        
-        // to store CardType 
+
+        // to store CardType
         TUint8 iCardType;
-        
+
         // Array to Store PhoneBook Entry Status and EXT record no list
         TFixedArray< TPBEntryList,UICC_MAX_PB_NUM > iPBEntryList;
 };
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookstoreoperationbase.h	Wed Feb 17 13:58:55 2010 +0200
@@ -122,6 +122,15 @@
 const TUint8 KFileIdentifier1 = 3;
 const TUint8 KFileStatus1     = 4;
 
+const TUint8 KAdditionalData  = 0x02;
+const TUint8 KExtRecordSize  = 13;
+const TUint8 KAdnMandatoryBytes = 13;
+const TUint8 KAnrExtRecIdOffset = 14;
+const TUint8 KExtRecLenWithoutRecId = 12;
+const TUint8 KIapRecordsToBeSearched        = 0 ;     // constant to find unused bytes
+const TUint8 KMaxNoOfRecInOneEf = 254;
+
+
 // UICC constants
 #define MF_FILE                             0x3F00 //Master file
 #define DF_CURRENT_APP                      0x7FFF //
@@ -453,7 +462,7 @@
         * @param aPBType
         * @return TUint8
         */
-        static TUint16 ConvertToPBfileId( const TName& aPBType, TUint16& aFileIdExt );
+        static TUint16 ConvertToPBfileId( const TName& aPBType, TUint16& aFileIdExt,TUint8 aCardType );
 
 
         /**
@@ -529,6 +538,18 @@
         */
         TInt EmptyEntryCheck( const TDesC8 &aFileData );
 
+        /**
+        * 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, 
+            RArray <TPrimitiveTag>& aFileList );
+
     protected:
 
 
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/cmmstaticutility.h	Wed Feb 17 13:58:55 2010 +0200
@@ -63,6 +63,10 @@
 // Call Life Timer index value for PMM. Reserver index '1'.
 const TUint16 KCallLifeTimerPmmIndexValue = 0x0001;
 
+const TUint8 KSw1Index = 0x00;
+const TUint8 KSw2Index = 0x01;
+const TUint8 KResultIndex = 0x02;
+
 // MACROS
     // None
 
@@ -267,6 +271,18 @@
             TInt aIndex );         //Index
 
         /**
+        * Maps sw1, sw2 and result to client specific error value
+        * @param aSw1: sw1 to be mapped
+        * @param aSw2: sw2 to be mapped
+        * @param aResult:  result to be mapped
+        * @return TInt: mapped error value
+        */
+        static TInt MapSw1Sw2ToEpocError( 
+            const TUint8 aSw1, 
+            const TUint8 aSw2, 
+            const TUint8 aResult );
+
+        /**
         * Set value for oper info
         * THIS IS ONLY FOR WINSCW TESTING USE
         */
--- a/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/inc/nokiatsy_release.h	Wed Feb 17 13:58:55 2010 +0200
@@ -22,7 +22,7 @@
 #define NOKIATSY_RELEASE_H
 
 // UPDATE THIS STRING FOR EVERY RELEASE!!!
-#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> modemadaptation-MCL_201002"
+#define NOKIATSY_RELEASE_STR "TSY: RELEASE --> modemadaptation-MCL_201006"
 #endif // NOKIATSY_RELEASE_H
            
 // End of File
\ No newline at end of file
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -92,6 +92,10 @@
 
 const TUint8 KInvalidPipeHandle = 0xFF;
 
+const TUint8 KConnectedAddressCpnMask = 0x60;
+
+const TUint8 KInternationalPhoneNumberPrefix = '+';
+
 // From 3GPP TS 31.111, 7.3.1.6 Structure of ENVELOPE (CALL CONTROL)
 const TUint8 KCcResultAllowedNoModification     = 0x00;
 const TUint8 KCcResultNotAllowed                = 0x01;
@@ -245,6 +249,7 @@
     iVideoCallReleased = EFalse;
     iCallControlCallId = CALL_MODEM_ID_NONE;
     iCcResult = KCcResultAllowedNoModification;
+    iResourceControlSuppress = EFalse;
     }
 
 // -----------------------------------------------------------------------------
@@ -690,10 +695,14 @@
                         // Prevent FDN check if call is SIM originated (SET UP CALL)
                         if ( RMobileCall::EOriginatorSIM == recentCallParamsV7.iCallParamOrigin )
                             {
+TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - iNoFdnCheck = ETrue");
+OstTrace0( TRACE_NORMAL, DUP9_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - iNoFdnCheck = ETrue" );
                             iNoFdnCheck = ETrue;
                             }
                         else
                             {
+TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - iNoFdnCheck = EFalse");
+OstTrace0( TRACE_NORMAL, DUP10_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - iNoFdnCheck = EFalse" );
                             iNoFdnCheck = EFalse;
                             }
                         }
@@ -844,6 +853,14 @@
                 ret = ActivateUUS( aDataPackage );
                 break;
                 }
+            case ESatNotifySetUpCallPCmd:
+                {
+TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - ESatNotifySetUpCallPCmd");
+OstTrace0( TRACE_NORMAL, DUP11_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - ESatNotifySetUpCallPCmd" );
+                iResourceControlSuppress = ETrue;
+                ret = KErrNone;
+                break;
+                }
             default:
                 {
 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
@@ -2031,7 +2048,8 @@
                 postAddressStarts = i;
                 break; // Exit for loop
                 }
-            else if ( '+' == ( aTelNumber )[i] && preAddressLength == i )
+            else if ( KInternationalPhoneNumberPrefix ==
+                ( aTelNumber )[i] && preAddressLength == i )
                 {
                 // Destination address part contains "+" character. For example
                 // +35850123456 or *140#+35850123456. Don't add "+" char to the
@@ -2230,7 +2248,8 @@
             iUusData.iUUI.Zero();
             iUusData.iServiceReq = 0;
             }
-        if ( iNoFdnDial )
+
+        if ( iNoFdnDial || iNoFdnCheck )
             {
 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- Create check info sub block");
 OstTrace0( TRACE_NORMAL, DUP9_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- Create check info sub block" );
@@ -2259,6 +2278,27 @@
 OstTraceExt1( TRACE_NORMAL, DUP21_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_CHECK_INFO - Subblock Count=%hhu", aNumOfSbInMsg );
 
             }
+
+        if ( iResourceControlSuppress )
+            {
+TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - suppressing resource control for this call");
+OstTrace0( TRACE_NORMAL, DUP20_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock - suppressing resource control for this call" );
+            TBuf8<SIZE_CALL_MODEM_SB_RESOURCE_CHECK_INFO> buffer;
+            TIsiSubBlock resourceCheckSb(
+                buffer,
+                CALL_MODEM_SB_RESOURCE_CHECK_INFO,
+                EIsiSubBlockTypeId8Len8 );
+
+            buffer.Append( CALL_MODEM_RES_ID_MO_INIT >> KShiftByOneByte );
+            buffer.Append( CALL_MODEM_RES_ID_MO_INIT );
+
+            aCallIsiMsg.CopyData(
+                aCurrentMsgOffset, resourceCheckSb.CompleteSubBlock() );
+            aCurrentMsgOffset += buffer.Length();
+            aNumOfSbInMsg++;
+
+            iResourceControlSuppress = EFalse;
+            }
         }
     // No else
     }
@@ -3108,7 +3148,7 @@
     const TDes16& aOrigAddress,
     RMobileCall::TMobileCallDirection aDirection ) const
     {
-TFLOGSTRING3("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. OrigAdr: %s. CallDirection:%d", &aOrigAddress, aDirection);
+TFLOGSTRING3("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. OrigAdr: %S. CallDirection:%d", &aOrigAddress, aDirection);
 OstTraceExt2( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber;OrigAddr=%S;CallDirection=%d", aOrigAddress, aDirection );
 
     // Find out if telephone number is allowed to be presented.
@@ -3418,8 +3458,26 @@
             {
 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock");
 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock" );
-
-            ReadAllAddressDestination( mobileCallInfo, targetOrig, aIsiMessage, sbStartOffSet, origPresentInd );
+            ReadAllAddressDestination(
+                 mobileCallInfo,
+                 targetOrig,
+                 aIsiMessage,
+                 sbStartOffSet,
+                 origPresentInd );
+            }
+        else if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+            ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
+            CALL_MODEM_SB_CONNECTED_ADDRESS,
+            EIsiSubBlockTypeId8Len8,
+            sbStartOffSet ) )
+            {
+TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CONNECTED_ADDRESS subblock");
+OstTrace0( TRACE_NORMAL, DUP19_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CONNECTED_ADDRESS subblock" );
+            ReadAllAddressConnected(
+                mobileCallInfo,
+                targetOrig,
+                aIsiMessage,
+                sbStartOffSet );
             }
             // No else
 
@@ -3599,7 +3657,7 @@
             // MT calls which went waiting can alert twice
             // reset stored incoming call information only after they actually rang
             // or when MT call is answered
-            if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA || 
+            if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA ||
                  CALL_MODEM_STATUS_ANSWERED == callStatusISA )
                 {
                 ResetIncomingCallInfo( iIncomingCallInfo );
@@ -3794,7 +3852,7 @@
             {
             // Add '+' character back to the string
             address2.Append( KCallPadding ); // Padding
-            address2.Append( '+' );
+            address2.Append( KInternationalPhoneNumberPrefix );
             }
         // No else
 
@@ -4126,7 +4184,7 @@
         {
         // Add '+' character back to the string
         address2.Append( KCallPadding ); // Padding
-        address2.Append( '+' );
+        address2.Append( KInternationalPhoneNumberPrefix );
         }
     // No else
 
@@ -4180,6 +4238,108 @@
     }
 
 // -----------------------------------------------------------------------------
+// CMmCallMessHandler::ReadAllAddressConnected
+// Read All Address Destination
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMmCallMessHandler::ReadAllAddressConnected(
+    RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
+    TBuf16<RMobilePhone::KMaxMobileTelNumberSize>& aTargetOrig,
+    const TIsiReceiveC &aIsiMessage,
+    TUint& aSbStartOffSet)
+    {
+TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressConnected");
+OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_READALLADDRESSCONNECTED, "CMmCallMessHandler::ReadAllAddressConnected" );
+
+    TUint8 origAddressType( aIsiMessage.Get8bit(
+        aSbStartOffSet + CALL_MODEM_SB_CONNECTED_ADDRESS_OFFSET_ADDRTYPE ) );
+    TUint8 origPresentInd( aIsiMessage.Get8bit(
+        aSbStartOffSet + CALL_MODEM_SB_CONNECTED_ADDRESS_OFFSET_PRESENTATION ) );
+    origPresentInd &= KConnectedAddressCpnMask;
+
+    // Get destinationAddress Length
+    TUint8 destinationAddressLength( aIsiMessage.Get8bit(
+        aSbStartOffSet + CALL_MODEM_SB_CONNECTED_ADDRESS_OFFSET_ADDRLEN ) );
+
+    // Get address (telephone number)
+    TPtrC8 address( aIsiMessage.GetData(
+        aSbStartOffSet + CALL_MODEM_SB_CONNECTED_ADDRESS_OFFSET_ADDR,
+        destinationAddressLength * 2 ) );
+
+    TBuf8<RMobilePhone::KMaxMobileTelNumberSize * 2> address2;
+
+    // Check if number is international and addrDataLength is bigger
+    // than zero. The length of the string does not have to be checked
+    // since the original max length was 100. When the string was sent
+    // to ISA side the '+' character was cut off and now we just put
+    // it back. (three bits (5-7) contain type of number)
+    if ( ( CALL_MODEM_NBR_TYPE_INTERNATIONAL ==
+         ( origAddressType & KMaskBits5to7 ) )
+         && ( 0 != address.Length() ) )
+        {
+        // Add '+' character back to the string
+        address2.Append( KCallPadding ); // Padding
+        address2.Append( KInternationalPhoneNumberPrefix );
+        }
+    // No else
+
+    address2.Append( address ); //append tel number to address2
+
+    if ( address.Length() )
+        {
+        // Get address type
+        FillNumberPlanAndType( aMobileCallInfo, origAddressType );
+        }
+    // No else
+
+    // Copy 8-bit address to the 16-bit target using correct endianess
+    TIsiUtility::CopyFromBigEndian( address2, aTargetOrig );
+
+TFLOGSTRING2("TSY: CMmCallMessHandler::ReadAllAddressConnected;aTargetOrig=%S", &aTargetOrig);
+OstTraceExt1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_READALLADDRESSCONNECTED, "CMmCallMessHandler::ReadAllAddressConnected;aTargetOrig=%S", aTargetOrig );
+
+    if ( CALL_MODEM_PRESENTATION_ALLOWED == origPresentInd )
+        {
+TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN ALLOWED");
+OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_READALLADDRESSCONNECTED, "TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN ALLOWED" );
+        aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
+            RMobileCall::ERemoteIdentityAvailable;
+        // Copy the actual number
+        aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Copy(
+            aTargetOrig );
+        }
+    else if ( CALL_MODEM_PRESENTATION_RESTRICTED == origPresentInd )
+        {
+TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN RESTRICTED");
+OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_READALLADDRESSCONNECTED, "TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN RESTRICTED" );
+        aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
+            RMobileCall::ERemoteIdentitySuppressed;
+        aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN UNKNOWN");
+OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_READALLADDRESSCONNECTED, "TSY: CMmCallMessHandler::ReadAllAddressConnected; CPN UNKNOWN" );
+        aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
+            RMobileCall::ERemoteIdentityUnknown;
+        aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
+        }
+
+    aMobileCallInfo.iValid |=
+        RMobileCall::KCallRemoteParty | RMobileCall::KCallDialledParty;
+
+    // Add dialled party information
+    if ( 0 < aTargetOrig.Length() )
+        {
+        // Copy dialled party number
+        aMobileCallInfo.iDialledParty.iTelNumber.Copy( aTargetOrig );
+        }
+    // No else
+
+    }
+
+// -----------------------------------------------------------------------------
 // CMmCallMessHandler::ReadCallInfo
 // Read All Address Destination
 // (other items were commented in a header).
@@ -4754,7 +4914,8 @@
             postAddressStarts = i;
             break; // Exit for loop
             }
-        else if ( '+' == ( aTelNumber )[i] && preAddressLength == i )
+        else if ( KInternationalPhoneNumberPrefix ==
+            ( aTelNumber )[i] && preAddressLength == i )
             {
             // Destination address part contains "+" character. For example
             // +35850123456 or *140#+35850123456. Don't add "+" char to the
@@ -4962,7 +5123,7 @@
         // Create subblocks for CsdCallControlReq
         GetCSDCallControlReqSubBlock(
             dynamic_cast<TDesC16&>( iTelNumber ),
-            RMobileCall::ESendMyId,
+            iIdRestrict,
             csdIsiMsg,
             numOfSbInMessage,
             currentMsgOffset );
@@ -5108,7 +5269,7 @@
         // MO/MT video call released. we have to remove pipe.
         if ( iVideoCallReleased )
             {
-TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: call MO/MT releated");
+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();
@@ -5118,8 +5279,18 @@
     // CSD_VIDEO_CALL_STATUS_DISCONNECT arrives also when call establishment
     // fails
     // reset call direction to avoid further unnecessary IPC completions
-    iCallDirection = RMobileCall::EDirectionUnknown;
-
+    if ( iIsWaitingCall )
+        {
+TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd. call direction reset to MT");
+OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd. call direction reset to MT" );
+        iCallDirection = RMobileCall::EMobileTerminated;
+        }
+    else
+        {
+TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd. call direction reset to unknown");
+OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd. call direction reset to unknown" );
+        iCallDirection = RMobileCall::EDirectionUnknown;
+        }
 TFLOGSTRING2( "TSY: CMmCallMessHandler::CsdVideoCallStatusInd. VideoCallStatus: %d", iVideoCallStatus );
 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd. VideoCallStatus: %d", iVideoCallStatus );
     }
@@ -5325,7 +5496,7 @@
 
         // if CTSY does not set call id as valid we need to copy it from
         // data package
-        if ( 0 == callInfo->iValid & RMobileCall::KCallId )
+        if ( 0 == ( callInfo->iValid & RMobileCall::KCallId ) )
             {
 TFLOGSTRING("TSY: CMmCallMessHandler::DialDataCall. Copy call mode into call info");
 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_DIALDATACALL, "CMmCallMessHandler::DialDataCall. Copy call mode into call info" );
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmcustommesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -59,7 +59,6 @@
 
 // CONSTANTS
 // hard-coded transaction id for ISI messages
-const TUint8 KCustomTransId = 6;
 // const TUint8 KCustomWimTransId = 7;
 
 // Max length for HSXPA message request
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmmessagerouter.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -212,7 +212,7 @@
 
     iMmUiccMessHandler = CMmUiccMessHandler::NewL(
         iPhoNetSender,
-        iPhoNetReceiver, 
+        iPhoNetReceiver,
         this );
 
     iMmDtmfMessHandler = CMmDtmfMessHandler::NewL(
@@ -281,7 +281,7 @@
         iMmSecurityMessHandler,
         this,
         iMmUiccMessHandler );
-    
+
     iMmPhoneBookStoreMessHandler = CMmPhoneBookStoreMessHandler::NewL(
         this,
         iMmUiccMessHandler);
@@ -397,6 +397,7 @@
             case EEtelCallRecoverDataPort:
             // for call control purposes
             case ESatNotifyCallControlRequest:
+            case ESatNotifySetUpCallPCmd:
                 {
                 messHandler = iMmCallMessHandler;
                 break;
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmnetmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -26,6 +26,7 @@
 #include "cmmmessagerouter.h"
 #include "cmmpacketmesshandlercontextlist.h"
 #include "cmmpacketservicemesshandler.h"
+#include "cmmcustommesshandler.h"
 #include "tsylogger.h" // Logging
 #include "cmmuiccmesshandler.h"
 
@@ -932,6 +933,22 @@
             }
         else
             {
+            if ( KCustomTransId == aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) )
+                {
+                // Initialize default return values to ECustomGetOperatorNameIPC
+                // complete.
+                RMmCustomAPI::TOperatorNameInfo operNameInfo;
+                operNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
+                operNameInfo.iName.Zero();
+
+                // Packed parameter: a RMmCustomAPI::TOperatorNameInfo.
+                dataPackage.PackData( &operNameInfo );
+
+                iMessageRouter->Complete(
+                    ECustomGetOperatorNameIPC,
+                    &dataPackage,
+                    KErrNotReady );
+                }
             // Phone is not registered to any network.
             // Complete EMobilePhoneNotifyCurrentNetworkChange without
             // operator names.
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationcache.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -92,7 +92,7 @@
 CMmPhoneBookOperationCache* CMmPhoneBookOperationCache::NewL
     (
     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
-    CMmUiccMessHandler* /*aUiccMessHandler*/,
+    CMmUiccMessHandler* aUiccMessHandler,
     TInt /*aIpc*/,
     const CMmDataPackage* aDataPackage // Data
     )
@@ -115,6 +115,8 @@
     mmPhoneBookOperationCache->iMmPhoneBookStoreMessHandler =
         aMmPhoneBookStoreMessHandler;
 
+    mmPhoneBookOperationCache->iMmUiccMessHandler = aUiccMessHandler;
+    
     return mmPhoneBookOperationCache;
     }
 
@@ -211,7 +213,7 @@
         {
         // Convert Phone Book name to file id
         TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-        TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+        TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt,  iMmUiccMessHandler->GetCardType());
         TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
         
         switch(pbFileId)
@@ -241,7 +243,7 @@
                             // Seperate Entry data form UICC Server response message
                             // Case: <Data available to be filled into array>
                             iMmPhoneBookStoreMessHandler->
-                            iPBStoreConf[EPhonebookTypeAdn].
+                            iPBStoreConf[pbArrayIndex].
                             GetPBEntryFromUICCData( 
                                 aFileData,
                                 iNumberBuf,
@@ -253,7 +255,7 @@
                             // Length + 14 , minus 1 is for Array index Calculation 
                             //(it starts from 0)
                             if ( 0xFF == aFileData[iMmPhoneBookStoreMessHandler->
-                                         iPBStoreConf[EPhonebookTypeAdn].
+                                         iPBStoreConf[pbArrayIndex].
                                          iAlphaStringlength + 13]  )
                                 {
                                 // Append Entry to list
@@ -287,7 +289,7 @@
                                 iExtensionToRead = ETrue;
                                 // Record no to be read from EXT File
                                 TInt recordNo = aFileData[iMmPhoneBookStoreMessHandler->
-                                               iPBStoreConf[EPhonebookTypeAdn].
+                                               iPBStoreConf[pbArrayIndex].
                                                iAlphaStringlength + 13];
                                 
                                 // Append EXT record no.
@@ -457,8 +459,6 @@
 
     TInt ret( KErrNone );
     TInt appFileID ( APPL_FILE_ID );   // Application File id for DFphonebook
-    // get the index to be read from phonebook
-    TInt index( iIndexToRead );
 
     TUiccReadLinearFixed cmdParams;
     cmdParams.messHandlerPtr  = static_cast<MUiccOperationBase*> 
@@ -468,45 +468,68 @@
     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 ));
+    
+    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 );
-    
-    // get the corect Location to be read from phone book
-    if( PB_MBDN_FID == pbFileId)
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
+    TUint8 pbArrayIndex = ConvertToConfArrayIndex( pbFileId );
+
+    switch( pbFileId )
         {
-        // Index to be read contains two types of information.
-        // The least significant byte contains the profile number
-        // and the most significant byte contains the type.
-        index = index || 0x0100; // Only subscriber profile number 1 is supported
-        }
-
-        switch( pbFileId )
+        case PB_ADN_FID:
+        case PB_FDN_FID:
+        case PB_SDN_FID:
             {
-            case PB_ADN_FID:
+            // For 2G ADN Phonebook EXT1 will be the extension number store
+            cmdParams.trId = static_cast<TUiccTrId> ( aTransId );
+            cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+            cmdParams.record = aRecordNo;
+                
+            // Check for Extension Data is Present or not
+            if(!iExtensionToRead)
                 {
-                // For 2G ADN Phonebook EXT1 will be the extension number store
-                cmdParams.trId = static_cast<TUiccTrId> ( aTransId );
-                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                cmdParams.record = aRecordNo;
-                
-                // Check for Extension Data is Present or not
-                if(!iExtensionToRead)
+                // Check for the record Number to be 
+                //read is valid record number
+                if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[pbArrayIndex].iNoOfRecords)
                     {
-                    // Check for the record Number to be 
-                    //read is valid record number
-                    if( iIndexToRead <= iMmPhoneBookStoreMessHandler->
-                                   iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords)
+                    // Start from first location and Search for First Valid 
+                    //Entry in the Stored List And if some Entry is invalid
+                    // then Read From Sim and Check the Staus its Free 
+                    // or not till end of the records
+                    
+                    cmdParams.fileId = pbFileId;
+                    cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
+                    cmdParams.record = aRecordNo;
+                    // till End of Record
+                    cmdParams.dataAmount = 0;
+                    // Start from begining of record
+                    cmdParams.dataOffset = 0;
+                    }
+                else
+                    {
+                    ret = KErrNotFound;
+                    }
+                } // end of if case for checking extension data
+            else
+                {
+                // Send Request to Read Extension Data
+                // Check for UST Table supports for EXT File
+                if( iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[pbArrayIndex].iExtension )
+                    {
+                    // Check for Extension data record in valid
+                    if(iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[pbArrayIndex].iExtNoOfRec >= aRecordNo)
                         {
-                        // Start from first location and Search for First Valid 
-                        //Entry in the Stored List And if some Entry is invalid
-                        // then Read From Sim and Check the Staus its Free 
-                        // or not till end of the records
-                        
-                        cmdParams.fileId = PB_ADN_FID;
+                        // Read Request to read that index
+                        cmdParams.fileId = fileIdExt;
                         cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
                         cmdParams.record = aRecordNo;
                         // till End of Record
@@ -516,67 +539,32 @@
                         }
                     else
                         {
-                        ret = KErrNotFound;
-                        }
-                    } // end of if case for checking extension data
-                else
-                    {
-                    // Send Request to Read Extension Data
-                    // Check for UST Table supports for EXT File
-                    if( iMmPhoneBookStoreMessHandler->
-                        iPBStoreConf[EPhonebookTypeAdn].iExtension )
-                        {
-                        // Check for Extension data record in valid
-                        if(iMmPhoneBookStoreMessHandler->
-                           iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec > aRecordNo)
-                            {
-                            // Read Request to read that index
-                            cmdParams.fileId = PB_EXT1_FID;
-                            cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                            cmdParams.record = aRecordNo;
-                            // till End of Record
-                            cmdParams.dataAmount = 0;
-                            // Start from begining of record
-                            cmdParams.dataOffset = 0;
-                            }
-                        else
-                            {
-                            ret = KErrGeneral;
-                            }
-                        }
-                    else
-                        {
                         ret = KErrGeneral;
                         }
                     }
-                break;
+                else
+                    {
+                    ret = KErrGeneral;
+                    }
                 }
-            case PB_FDN_FID:
-                {
-                // For FDN Phonebook EXT2 will be the extension number store
-                cmdParams.trId = ETrIdPbReadFdn;
-                cmdParams.fileId = PB_EXT2_FID;
-
-                cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
-                cmdParams.record = aRecordNo;
                 break;
-                }
-            default:
-                {
+            }
+        default:
+            {
 TFLOGSTRING("TSY: CMmPhoneBookOperationRead::USimPbReqRead - PhoenBook Not supported");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead - PhoneBook not supported" );
                 break;
-                }
             }
+        }
         
 
-        if( KErrNone == ret )
-            {
-            ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
-                CreateUiccApplCmdReq( cmdParams );
+    if( KErrNone == ret )
+        {
+        ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
+        CreateUiccApplCmdReq( cmdParams );
 TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONCACHE_USIMPBREQREAD, "CMmPhoneBookOperationCache::USimPbReqRead;ret=%hd", ret );
-            }
+        }
     return ret;
     }
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationdelete.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -141,7 +141,7 @@
     iIpc = aIpc;
     iTransId = aTransId;
     // Convert phone book name to file id
-    iFileId = ConvertToPBfileId( iPhoneBookTypeName, iFileIdExt );
+    iFileId = ConvertToPBfileId( iPhoneBookTypeName, iFileIdExt, iMmUiccMessHandler->GetCardType() );
     // Find location from internal array
     iArrayIndex = ConvertToConfArrayIndex( iFileId );
 
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -260,8 +260,11 @@
         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 ));
+        if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+            {
+            cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+            cmdParams.filePath.Append(static_cast<TUint8>( DF_PHONEBOOK ));
+            }
 
         switch( iIniPhase )
             {
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit3g_adn.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -59,7 +59,7 @@
 // ================= MEMBER FUNCTIONS =======================================
 
 // -----------------------------------------------------------------------------
-// CMmPhoneBookOperationInit::CMmPhoneBookOperationInit
+// CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit
 // C++ default constructor can NOT contain any code, that
 // might leave.
 // -----------------------------------------------------------------------------
@@ -69,13 +69,12 @@
     // None
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn" );
-
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn" );
     }
 
 // -----------------------------------------------------------------------------
-// CMmPhoneBookOperationInit::~CMmPhoneBookOperationInit
+// CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit
 // C++ destructor.
 // -----------------------------------------------------------------------------
 //
@@ -84,13 +83,13 @@
     // None
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
-    OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit3G_adn" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CMmPhoneBookOperationInit3G_adn");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CMMPHONEBOOKOPERATIONINIT3G_ADN, "CMmPhoneBookOperationInit3G_adn::~CMmPhoneBookOperationInit3G_adn" );
 
     }
 
 // -----------------------------------------------------------------------------
-// CmmPhonebookOperatorInit::NewL
+// CMmPhoneBookOperationInit3G_adn::NewL
 // Two-phased constructor.
 // Creates a new CmmPhonebookOperatorInit object instance.
 // -----------------------------------------------------------------------------
@@ -102,8 +101,8 @@
     const CMmDataPackage* aDataPackage // Data
     )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::NewL");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_NEWL, "CMmPhoneBookOperationInit3G_adn::NewL" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::NewL");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_NEWL, "CMmPhoneBookOperationInit3G_adn::NewL" );
 
 
     TName phonebookTypeName;
@@ -145,9 +144,8 @@
 
 
 
-
 // -----------------------------------------------------------------------------
-// CMmPhoneBookOperationInit::ConstructL
+// CMmPhoneBookOperationInit3G_adn::ConstructL
 // Initialises object attributes.
 // -----------------------------------------------------------------------------
 //
@@ -156,8 +154,8 @@
     // None
     )
     {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::ConstructL" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CONSTRUCTL, "CMmPhoneBookOperationInit3G_adn::ConstructL" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::ConstructL" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CONSTRUCTL, "CMmPhoneBookOperationInit3G_adn::ConstructL" );
 
     iPBStoreInfoData = new( ELeave ) CStorageInfoData();
 
@@ -165,8 +163,6 @@
     iServiceType = 0;
     iNumOfPBRRecords = 0;
 
-
-
 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
     TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
         INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is ON.");
@@ -177,12 +173,9 @@
     TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler. \
         INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS is OFF.");
 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
-
-
     }
 
 
-
 // -----------------------------------------------------------------------------
 // CMmPhoneBookOperationInit3G_adn::UICCCreateReq
 // For USIM Separate different request to correct function
@@ -195,8 +188,8 @@
     TUint8 aTransId
     )
     {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCCreateReq" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationInit3G_adn::UICCCreateReq" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCCreateReq" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationInit3G_adn::UICCCreateReq" );
 
     TInt ret( KErrNotSupported );
 
@@ -211,7 +204,6 @@
                     {
                     // Initialization is starting. Turn the flag on.
                     iInternalInit = ETrue;
-
                     }
 
                 iServiceType = UICC_APPL_FILE_INFO;
@@ -230,10 +222,8 @@
         default:
             {
             // Nothing to do here
-            TFLOGSTRING2( "TSY: CMmPhoneBookOperationInit3G_adn::UICCCreateReq - \
-            Unknown IPC: %d", aIpc );
-            OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationInit3G_adn::UICCCreateReq;Unknown IPC =%d", aIpc );
-
+TFLOGSTRING2( "TSY: CMmPhoneBookOperationInit3G_adn::UICCCreateReq - Unknown IPC: %d", aIpc );
+OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCCREATEREQ, "CMmPhoneBookOperationInit3G_adn::UICCCreateReq;Unknown IPC =%d", aIpc );
             break;
             }
         } // switch-case ends
@@ -241,8 +231,6 @@
     }
 
 
-
-
 // -----------------------------------------------------------------------------
 // CMmPhoneBookOperationInit3G_adn::UICCCreateReq
 // For USIM Separate different request to correct function
@@ -250,23 +238,22 @@
 //
 TInt CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN( TUint8 aTransId)
     {
-    TInt ret(KErrNone);
-
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN" );
 
-        TInt appFileID( APPL_FILE_ID );
-        TUiccReadLinearFixed cmdParams;
-        cmdParams.messHandlerPtr =
-            static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
-        cmdParams.trId = static_cast<TUiccTrId>( aTransId );
+    TInt ret(KErrNone);
+    TInt appFileID( APPL_FILE_ID );
+    TUiccReadLinearFixed cmdParams;
+    cmdParams.messHandlerPtr =
+        static_cast<MUiccOperationBase*>( iMmPhoneBookStoreMessHandler );
+    cmdParams.trId = static_cast<TUiccTrId>( aTransId );
 
-        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE >> 8 ));
-        cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
-        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 ));
+    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 ));
 
     switch( iIniPhase )
         {
@@ -274,9 +261,8 @@
             {
             // Send Request to UICC Server to Read file Info of PBR file
             // No. of records in PBR file
-            TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - \
-            File Info Read Request for EF-PBR " );
-            OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR " );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_UICCINITIALIZEREQ3GADN, "CMmPhoneBookOperationInit3G_adn::UICCInitializeReq3GADN - File Info Read Request for EF-PBR" );
 
             cmdParams.fileId = PB_PBR_FID;
             cmdParams.serviceType = iServiceType;
@@ -285,19 +271,22 @@
             }
         case EPBInitPhase_3GADN_Type1:
             {
-            // read Type 1 Files File descriptor, File Data and Extension File data
+            // read Type 1 Files File descriptor, File Data and Extension File
+            // data
             ret = CreateReqFetchTypeFile( cmdParams, UICC_TYPE1_FILE );
             break;
             }
         case EPBInitPhase_3GADN_Type2:
             {
-            // read Type 2 Files File descriptor, File Data and Extension File data
+            // read Type 2 Files File descriptor, File Data and Extension File
+            // data
             ret = CreateReqFetchTypeFile( cmdParams, UICC_TYPE2_FILE );
             break;
             }
         case EPBInitPhase_3GADN_Type3:
             {
-            // read Type 3 Files File descriptor, File Data and Extension File data
+            // read Type 3 Files File descriptor, File Data and Extension File
+            // data
             ret = CreateReqFetchTypeFile( cmdParams, UICC_TYPE3_FILE );
             break;
             }
@@ -307,9 +296,8 @@
             }
         }
 
-    // if intialization for USIM ADN phonebook has not been completed till now then send the
-    // request for the correct phase
-
+    // if intialization for USIM ADN phonebook has not been completed till
+    // now then send the request for the correct phase
     if( EPBIniPhase_3GADNDone != iIniPhase )
         {
         ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->
@@ -321,22 +309,18 @@
     }
 
 
-
 // -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::CreateReqFetchTypeFile
+// CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile
 // Creates data to fetch EF of type 1, Type2 and Type3 in PBR file TLV for File
 //Info or File Data
 // -----------------------------------------------------------------------------
 //
-
-
 TInt CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile(
-        TUiccReadLinearFixed & aparams,
-        const TUint8 aFileType)
+    TUiccReadLinearFixed & aparams,
+    const TUint8 aFileType)
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile" );
-
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile" );
 
     TInt ret( KErrNone );
     TUint16 fileFID ( 0 );
@@ -345,32 +329,31 @@
     switch( aFileType )
         {
         case UICC_TYPE1_FILE:
-                {
-                TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 1 File " );
-                OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 1 File  " );
+            {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 1 File " );
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 1 File  " );
 
-                fileFID = iType1FileArray[iCurrentArrayCounter].tagFID;
-                fileSFI = iType1FileArray[iCurrentArrayCounter].tagSFI;
-                }
+            fileFID = iType1FileArray[iCurrentArrayCounter].tagFID;
+            fileSFI = iType1FileArray[iCurrentArrayCounter].tagSFI;
             break;
+            }
         case UICC_TYPE2_FILE:
             {
-                TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 2 File  " );
-                OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 2 File " );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 2 File  " );
+OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 2 File " );
 
-                fileFID = iType2FileArray[iCurrentArrayCounter].tagFID;
-                fileSFI = iType2FileArray[iCurrentArrayCounter].tagSFI;
-                }
+            fileFID = iType2FileArray[iCurrentArrayCounter].tagFID;
+            fileSFI = iType2FileArray[iCurrentArrayCounter].tagSFI;
             break;
+            }
         case UICC_TYPE3_FILE:
-                {
-                TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 3 File  " );
-                OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 3 File " );
-
-                fileFID = iType3FileArray[iCurrentArrayCounter].tagFID;
-                fileSFI = iType3FileArray[iCurrentArrayCounter].tagSFI;
-                }
+            {
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 3 File  " );
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT3G_ADN_CREATEREQFETCHTYPEFILE, "CMmPhoneBookOperationInit3G_adn::CreateReqFetchTypeFile - Create req for Type 3 File " );
+            fileFID = iType3FileArray[iCurrentArrayCounter].tagFID;
+            fileSFI = iType3FileArray[iCurrentArrayCounter].tagSFI;
             break;
+            }
         default:
             {
             break;
@@ -388,18 +371,18 @@
 
 
 // -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::HandleUICCPbRespL
+// CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL
 // HAndle response for all phase init response in USIM
 // -----------------------------------------------------------------------------
 //
 
 TBool CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL
-        (
-        TInt aStatus,
-        TUint8 /*aDetails*/,
-        const TDesC8 &aFileData,
-        TInt aTransId
-        )
+    (
+    TInt aStatus,
+    TUint8 /*aDetails*/,
+    const TDesC8 &aFileData,
+    TInt aTransId
+    )
     {
     TInt ret( KErrNone );
     TBool complete( EFalse );
@@ -407,9 +390,8 @@
     // break immediatelly in case of internal init
     if ( iInternalInit )
         {
-        TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Internal Init->Break");
-        OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Internal Init-> Break" );
-
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Internal Init->Break");
+OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Internal Init-> Break" );
 
         iIniPhase = EPBIniPhase_Unknown;
 
@@ -418,59 +400,60 @@
         return KErrNone;
         }
 
-        switch(iIniPhase)
+    switch(iIniPhase)
+        {
+        case EPBInitPhase_3GADN_PBR:
+        case EPBInitPhase_3GADN_Type1:
+        case EPBInitPhase_3GADN_Type2:
+        case EPBInitPhase_3GADN_Type3:
             {
-            case EPBInitPhase_3GADN_PBR:
-            case EPBInitPhase_3GADN_Type1:
-            case EPBInitPhase_3GADN_Type2:
-            case EPBInitPhase_3GADN_Type3:
-            {
-            TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN PhoneBook Init" );
-            OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN Phonebook init" );
-
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN PhoneBook Init" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. USIM ADN Phonebook init" );
             ret = HandleUICCPbResp3GADN( aFileData, aStatus, aTransId );
+            break;
             }
-            break;
-            case EPBInitPhaseFDN:
-            case EPBInitPhaseSDN:
-            case EPBInitPhaseMBDN:
-            case EPBInitPhaseMSISDN:
+        case EPBInitPhaseFDN:
+        case EPBInitPhaseSDN:
+        case EPBInitPhaseMBDN:
+        case EPBInitPhaseMSISDN:
             {
-            TFLOGSTRING( "TSY: CMmPhoneBookOperationInit::HandleUICCPbRespL. Other PhoneBook Init" );
-            OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Other Phonebook Init" );
-
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit::HandleUICCPbRespL. Other PhoneBook Init" );
+OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESPL, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbRespL. Other Phonebook Init" );
             // For all other phoenbook handling is same as 2g Phonebook
             ret = HandlePBRespL( aFileData, aStatus, aTransId );
-            }
             break;
-            default:
-                // Not to handle anything if card type is not available
-                break;
-
+            }
+        default:
+            {
+            // Not to handle anything if card type is not available
+            break;
             }
+        }
 
-         // Complete, if phonebook initalization is complete or there is some error in UICC server
-         if ( KErrNone != ret || EPBIniPhase_PBInitialized == iIniPhase )
-             {
-             CPhoneBookDataPackage phoneBookData;
-             phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
-             phoneBookData.PackData( iPBStoreInfoData );
+     // Complete, if phonebook initalization is complete or there is some
+     // error in UICC server
+     if ( KErrNone != ret || EPBIniPhase_PBInitialized == iIniPhase )
+         {
+         CPhoneBookDataPackage phoneBookData;
+         phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
+         phoneBookData.PackData( iPBStoreInfoData );
 
-             if ( UICC_STATUS_OK != aStatus )
-                 {
-                 ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
-                 }
+         if ( UICC_STATUS_OK != aStatus )
+             {
+             ret = CMmStaticUtility::UICCCSCauseToEpocError( aStatus );
+             }
 
-             iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
-                     EMmTsyPhoneBookStoreInitIPC,
-                     &phoneBookData,
-                     ret );
+         iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
+                 EMmTsyPhoneBookStoreInitIPC,
+                 &phoneBookData,
+                 ret );
 
-             complete = ETrue;
-             }
+         complete = ETrue;
+         }
     return complete;
+    }
 
-    }
+
 // -----------------------------------------------------------------------------
 // CmmPhonebookOperationInit::HandleUICCPbResp3GADN
 // Handle response for ADN phone book init in USIM
@@ -482,100 +465,102 @@
     TInt aStatus,
     TUint8 aTransId )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESP3GADN, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLEUICCPBRESP3GADN, "CMmPhoneBookOperationInit3G_adn::HandleUICCPbResp3GADN" );
 
     TInt ret( KErrNone );
 
-        switch(iIniPhase)
+    switch(iIniPhase)
+        {
+        case EPBInitPhase_3GADN_PBR:
             {
-            case EPBInitPhase_3GADN_PBR:
+            if(UICC_STATUS_OK == aStatus)
                 {
-                if(UICC_STATUS_OK == aStatus)
+                // For File Info , get the no of records in PBR file to get
+                // the total no of entries in 3G ADN phonebook
+                if( UICC_APPL_FILE_INFO == iServiceType )
                     {
-                    TInt offSet( 0 );
-                    // For File Info , get the no of records in PBR file to get the total no of entries in 3G ADN phonebook
-                    if( UICC_APPL_FILE_INFO == iServiceType )
-                        {
-                        TFci fci( aFileData );
-                        iNumOfPBRRecords = fci.GetNumberOfRecords();
-
-                        ret = KErrNone;
-                        iServiceType = UICC_APPL_READ_LINEAR_FIXED;
-                        }
-                    else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
-                        {
-                        // Get the offset for  Type 1 file tag "KTagConstructedTagA8"
-                        offSet = aFileData.Find( &KTagConstructedTagA8, 1 );
-                        if( offSet != KErrNotFound )
-                            {
-                            // Fetch Type 1 files and store fileId , File tag, and SFI value in iType1FileArray
-                            ret = FetchType1FileFromPBR( aFileData );
-                            }
+                    TFci fci( aFileData );
+                    iNumOfPBRRecords = fci.GetNumberOfRecords();
 
-                        // Get the offset for type 2 Files
-                        offSet = aFileData.Find( &KTagConstructedTagA9, 1 );
-                        if( offSet != KErrNotFound )
-                            {
-                            // Fetch Type2 files and store fileId , File tag, and SFI value in iType2FileArray
-                            ret = FetchType2FileFromPBR( aFileData );
-                            }
+                    ret = KErrNone;
+                    iServiceType = UICC_APPL_READ_LINEAR_FIXED;
+                    }
+                else if( UICC_APPL_READ_LINEAR_FIXED == iServiceType )
+                    {
+                    // Get the offset for  Type 1 file tag
+                    // "KTagConstructedTagA8"
+                    ret = FetchFileListFromPBR(
+                        aFileData,
+                        KTagConstructedTagA8,
+                        iType1FileArray );
 
-                        // Get the offset for type 3 Files
-                        offSet = aFileData.Find( &KTagConstructedTagAA, 1 );
-                        if( offSet != KErrNotFound )
-                            {
-                            // Fetch Type 3 files and store fileId , File tag, and SFI value in iType3FileArray
-                            ret = FetchType3FileFromPBR( aFileData );
-                            }
-
-                        // Consistency check for File ids and if there is same file IDs then remove those File Ids
-                        ret = CheckForFileId();
+                    // Get the offset for type 2 Files
+                    ret = FetchFileListFromPBR(
+                        aFileData,
+                        KTagConstructedTagA9,
+                        iType2FileArray );
 
-                        // Consistency Check for Type 1 file should not be type 2 or type3
-                        ret = CheckForSameType1AndType2Files();
+                    // Get the offset for type 3 Files
+                    ret = FetchFileListFromPBR(
+                        aFileData,
+                        KTagConstructedTagAA,
+                        iType3FileArray );
 
-                        iServiceType = UICC_APPL_FILE_INFO;
-                        iIniPhase = EPBInitPhase_3GADN_Type1;
-                        }
-                    }
-                else
-                    {
-                    iADNPbInitilized = EFalse;
-                    GetNextPhoneBookInitPhase(iIniPhase);
+                    // Consistency check for File ids and if there is same
+                    // file IDs then remove those File Ids
+                    ret = CheckForFileId();
+
+                    // Consistency Check for Type 1 file should not be
+                    // type 2 or type3
+                    ret = CheckForSameType1AndType2Files();
+
+                    iServiceType = UICC_APPL_FILE_INFO;
+                    iIniPhase = EPBInitPhase_3GADN_Type1;
                     }
                 }
-                break;
-            case EPBInitPhase_3GADN_Type1:
+            else
                 {
-                HandleType1FileResp( aFileData, aStatus );
-                }
-                break;
-            case EPBInitPhase_3GADN_Type2:
-                {
-                HandleType2FileResp( aFileData, aStatus );
+                iADNPbInitilized = EFalse;
+                GetNextPhoneBookInitPhase(iIniPhase);
                 }
-                break;
-            case EPBInitPhase_3GADN_Type3:
-                {
-                HandleType3FileResp( aFileData, aStatus );
-                }
-                break;
-            default:
-                break;
+            break;
+            }
+        case EPBInitPhase_3GADN_Type1:
+            {
+            HandleType1FileResp( aFileData, aStatus );
+            break;
+            }
+        case EPBInitPhase_3GADN_Type2:
+            {
+            HandleType2FileResp( aFileData, aStatus );
+            break;
             }
+        case EPBInitPhase_3GADN_Type3:
+            {
+            HandleType3FileResp( aFileData, aStatus );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
 
-    if(KErrNone == ret)
+    if( KErrNone == ret )
         {
         if( iIniPhase == EPBIniPhase_3GADNDone )
             {
             // Call Create requuest for otyher phone books
             // Check for FDN enabled or disabled
             if( iMmUiccMessHandler->GetServiceStatus(UICC_FDN_SERVICE_NUM) )
+                {
                 iIniPhase = EPBInitPhaseFDN;
+                }
             else
                 {
-                // get the next Phone book available in UST OR SST Table (for 2G)table
+                // get the next Phone book available in UST OR SST Table
+                // (for 2G)table
                 iIniPhase = GetNextAvailablePbUicc( UICC_FDN_SERVICE_NUM );
                 }
             iServiceType = UICC_APPL_FILE_INFO;
@@ -591,184 +576,17 @@
     return ret;
     }
 
-
 // -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::FetchType1FileFromPBR
-// Fetch Type 1 File ID data and store that data in iType1FileArray
-// -----------------------------------------------------------------------------
-//
-TInt CMmPhoneBookOperationInit3G_adn::FetchType1FileFromPBR( const TDesC8 &aFileData )
-    {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::FetchType1FileFromPBR" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_FETCHTYPE1FILEFROMPBR, "CMmPhoneBookOperationInit3G_adn::FetchType1FileFromPBR" );
-
-    TInt ret( KErrNone );
-    TPrimitiveTag primTag;
-
-    // Get the type 1 file Tag offset
-    TInt offset = aFileData.Find( &KTagConstructedTagA8, 1 );
-
-    // Get the Type 1 File Tag Length
-    TUint8 aTagLength = aFileData[offset + 1];
-
-    // Offset+2 to get offset for first File tag
-    offset = offset+2;
-
-    // Store Type 1 file data in iType1FileArray array
-    for( TInt i = 0; i < aTagLength; )
-        {
-        // Get the Tag name
-        primTag.tagValue = aFileData[offset + i];
-
-        // get the File ID which is 2byte long
-        primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData, ( offset+i+2 ));
-
-        // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
-        if(KLengthWithSFI == aFileData[offset + i+1])
-            {
-            primTag.tagSFI = aFileData[offset+i+4];
-            // get the offset for next file tag
-            i = i+5;
-            }
-        else if(KLengthWithOutSFI == aFileData[offset+i+1])
-            {
-            primTag.tagSFI = 0;
-            // get the offset for next file tag
-            i = i+4;
-            }
-        else
-            {
-            ret = KErrGeneral;
-            break;
-            }
-        iType1FileArray.Append( primTag );
-        }
-    return ret;
-    }
-
-
-
-// -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::FetchType2FileFromPBR
-// Fetch Type 2 File ID data and store that data in iType2FileArray
-// -----------------------------------------------------------------------------
-//
-TInt CMmPhoneBookOperationInit3G_adn::FetchType2FileFromPBR(const TDesC8 &aFileData)
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::FetchType2FileFromPBR");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_FETCHTYPE2FILEFROMPBR, "CMmPhoneBookOperationInit3G_adn::FetchType2FileFromPBR" );
-
-
-    TInt ret( KErrNone );
-    TPrimitiveTag primTag;
-
-    // Get the type 1 file Tag offset
-    TInt offset = aFileData.Find( &KTagConstructedTagA9,1 );
-    // Get the Type 1 File Tag Length
-    TUint8 aTagLength = aFileData[offset+1];
-
-    offset = offset + 2;
-
-    // Store Type 1 file data in iType1FileArray array
-    for( TInt i = 0; i < aTagLength; )
-        {
-        // Get the Tag name
-        primTag.tagValue = aFileData[offset+i];
-        // get the File ID which is 2byte long
-        primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData, ( offset+i+2 ));
-
-        // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
-        if(KLengthWithSFI == aFileData[offset+i+1])
-            {
-            primTag.tagSFI = aFileData[offset+i+4];
-            // get the offset for next file tag
-            i = i+5;
-            }
-        else if(KLengthWithOutSFI == aFileData[offset+i+1])
-            {
-            primTag.tagSFI = 0;
-            // get the offset for next file tag
-            i = i+4;
-            }
-        else
-            {
-            ret = KErrGeneral;
-            break;
-            }
-        iType2FileArray.Append( primTag );
-        }
-    return ret;
-    }
-
-
-
-// -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::FetchType3FileFromPBR
-// Fetch Type 3 File ID data and store that data in iType3FileArray
-// -----------------------------------------------------------------------------
-//
-TInt CMmPhoneBookOperationInit3G_adn::FetchType3FileFromPBR(const TDesC8& aFileData)
-    {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::FetchType3FileFromPBR");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_FETCHTYPE3FILEFROMPBR, "CMmPhoneBookOperationInit3G_adn::FetchType3FileFromPBR" );
-
-        TInt ret( KErrNone );
-        TPrimitiveTag primTag;
-
-        // Get the type 1 file Tag offset
-        TInt offset = aFileData.Find( &KTagConstructedTagAA,1 );
-
-        // Get the Type 1 File Tag Length
-        TUint8 aTagLength = aFileData[offset+1];
-
-        // To get the offset fot first File tag value
-        offset = offset + 2;
-
-        // Store Type 1 file data in iType1FileArray array
-        for( TInt i=0; i < aTagLength; )
-            {
-            // Get the Tag name
-            primTag.tagValue = aFileData[offset+i];
-
-            // get the File ID which is 2byte long
-            primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData,
-            	                                          ( offset + i + 2 ));
-
-            // if file Tag length is 3 the SFI is available and if file tag length is 2 the only File ID is present
-            if(KLengthWithSFI == aFileData[offset+i+1])
-                {
-                primTag.tagSFI = aFileData[offset+i+4];
-                i = i+5;
-                }
-            else if(KLengthWithOutSFI == aFileData[offset+i+1])
-                {
-                primTag.tagSFI = 0;
-                i = i+4;
-                }
-            else
-                {
-                ret = KErrGeneral;
-                break;
-                }
-            iType3FileArray.Append( primTag );
-            }
-        return ret;
-
-    }
-
-
-
-// -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::HandleType1FileResp
+// CMmPhoneBookOperationInit3G_adn::HandleType1FileResp
 // HAndles Data for type 1 File response
 // -----------------------------------------------------------------------------
 //
-
-
-void CMmPhoneBookOperationInit3G_adn::HandleType1FileResp( const TDesC8 &aFileData, TInt aStatus )
+void CMmPhoneBookOperationInit3G_adn::HandleType1FileResp(
+    const TDesC8 &aFileData,
+    TInt aStatus )
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType1FileResp");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE1FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType1FileResp" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType1FileResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE1FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType1FileResp" );
 
     TInt ret( KErrNone );
     TInt recordLength( 0 );
@@ -783,7 +601,7 @@
         TFci fci( aFileData );
         recordLength = fci.GetRecordLength();
         noOfRecords = fci.GetNumberOfRecords();
-			
+
         // Check for No of records in Type 1 file
         if( UICC_EF_ADN_TAG != tagValue )
             {
@@ -791,7 +609,6 @@
             }
         }
 
-
     if( iCurrentArrayCounter < iType1FileArray.Count() )
         {
         if( UICC_STATUS_OK  == aStatus )
@@ -801,102 +618,167 @@
                 case UICC_EF_ADN_TAG:
                     {
                     // get total no of entries in all PBR records
-                    iPBStoreInfoData->iADNNumOfEntries = noOfRecords* iNumOfPBRRecords;
+                    iPBStoreInfoData->iADNNumOfEntries =
+                        noOfRecords * iNumOfPBRRecords;
 
                     iPBStoreInfoData->iADNTextLengthMax = ( recordLength - 14 );
 
                     // To get the total length of number, need to read Ext1 file
-                    iPBStoreInfoData->iADNNumberLengthMax =  UICC_NO_EXT_MAX_NUM_LEN;
+                    iPBStoreInfoData->iADNNumberLengthMax =
+                        UICC_NO_EXT_MAX_NUM_LEN;
                     iADNPbInitilized = ETrue;
+
+                    // Store valuue to Internal configuration buffer
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iAlphaStringlength =
+                            iPBStoreInfoData->iADNTextLengthMax;
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iNoOfRecords =
+                            iPBStoreInfoData->iADNNumOfEntries;
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iNumlength =
+                            iPBStoreInfoData->iADNNumberLengthMax;
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iExtension = EFalse;
+                    break;
                     }
-                    break;
                 case UICC_EF_ANR_TAG:
                     {
-                    // Check for if No of records for this File is same as ADN phonebook no of records
+                    // Check for if No of records for this File is same as ADN
+                    // phonebook no of records
                     if(KErrNone == ret)
                         {
                         // Check for fixed size record length
-                        ret = CheckRecordSizeForFixedLength( 1, UICC_EF_ANR_TAG,recordLength );
+                        ret = CheckRecordSizeForFixedLength(
+                            1,
+                            UICC_EF_ANR_TAG,
+                            recordLength );
                         if( KErrNone == ret )
                             {
                             // total no of entries in all ANR files
-                            iPBStoreInfoData->iANRNumOfEntries = ( noOfRecords* iNumOfPBRRecords );
+                            iPBStoreInfoData->iANRNumOfEntries =
+                                ( noOfRecords* iNumOfPBRRecords );
                             // For this need to know about the ext files
-                            iPBStoreInfoData->iANRNumLengthMax = UICC_NO_EXT_MAX_NUM_LEN;
+                            iPBStoreInfoData->iANRNumLengthMax =
+                                UICC_NO_EXT_MAX_NUM_LEN;
                             // No of entries in every EF
-                            iPBStoreInfoData->iANRNumOfEntriesPerEntry = noOfRecords;
+                            iPBStoreInfoData->iANRNumOfEntriesPerEntry =
+                                noOfRecords;
                             // no ot ANR file per ADN phonebook
                             iType1ANRFiles++;
+
+                            iMmPhoneBookStoreMessHandler->
+                                iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords
+                                = iPBStoreInfoData->iANRNumOfEntries;
                             }
                         }
+                    break;
                     }
-                    break;
                 case UICC_EF_EMAIL_TAG:
                     {
-                    if(KErrNone == ret)
+                    if( KErrNone == ret )
                         {
                         // get the total no of records in Email EF
-                        iPBStoreInfoData->iEmailNumOfEntries = ( noOfRecords* iNumOfPBRRecords );
+                        iPBStoreInfoData->iEmailNumOfEntries =
+                            ( noOfRecords* iNumOfPBRRecords );
 
-                        // get record Length from filedata, In Type1 file case email text length will be same as record length
+                        // get record Length from filedata, In Type1 file case
+                        // email text length will be same as record length
                         iPBStoreInfoData->iEmailTextLengthMax = recordLength;
 
-                        iPBStoreInfoData->iEmailNumOfEntriesPerEntry = noOfRecords;
+                        iPBStoreInfoData->iEmailNumOfEntriesPerEntry =
+                            noOfRecords;
 
                         // no of type1 email files per ADN Phonebook
                         iType1EmailFiles++;
+
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
+                                iPBStoreInfoData->iEmailNumOfEntries;
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iEmailStringLength =
+                                iPBStoreInfoData->iEmailTextLengthMax;
                         }
+                    break;
                     }
-                    break;
+
                 case UICC_EF_GRP_TAG:
                     {
-                    if(KErrNone == ret)
+                    if( KErrNone == ret )
                         {
                         // get the record record no from file info data
-                        iPBStoreInfoData->iGRPNumOfEntriesPerEntry = noOfRecords;
+                        iPBStoreInfoData->iGRPNumOfEntriesPerEntry =
+                            noOfRecords;
                         }
+                    break;
                     }
-                    break;
                 case UICC_EF_IAP_TAG:
                     {
                     // This File is mandatory only when there are Type 2 Files
                     if( iType2FileArray.Count()== 0 )
+                        {
                         ret = KErrGeneral;
+                        }
+                    if( KErrNone == ret )
+                        {
+                        // Store IAP record record length in internal buffer
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iIAPRecordLength =
+                                recordLength;
+                        }
+                    break;
                     }
-                    break;
                 case UICC_EF_PBC_TAG:
                     {
                     if( KErrNone == ret )
                         {
-                        if( KErrNone != CheckRecordSizeForFixedLength(1, UICC_EF_PBC_TAG,recordLength) )
+                        if( KErrNone != CheckRecordSizeForFixedLength(
+                            1,
+                            UICC_EF_PBC_TAG,
+                            recordLength) )
                             {
                             // remove this entry from Array
                             iType1FileArray[iCurrentArrayCounter].tagFID = 0x00;
                             iType1FileArray[iCurrentArrayCounter].tagSFI = 0x00;
-                            iType1FileArray[iCurrentArrayCounter].tagValue = 0x00;
+                            iType1FileArray[iCurrentArrayCounter].tagValue =
+                                0x00;
                             }
                         }
+                    break;
                     }
-                    break;
                 case UICC_EF_SNE_TAG:
                     {
                     if( KErrNone == ret )
                         {
-                        iPBStoreInfoData->iSNENumOfEntries = noOfRecords * iNumOfPBRRecords;
-                        iPBStoreInfoData->iSNENumOfEntriesPerEntry = noOfRecords;
+                        iPBStoreInfoData->iSNENumOfEntries =
+                            noOfRecords * iNumOfPBRRecords;
+                        iPBStoreInfoData->iSNENumOfEntriesPerEntry =
+                            noOfRecords;
                         iPBStoreInfoData->iSNETextLengthMax = recordLength;
                         // Get the no of Type 1 SNE Files per ADN phonebook
                         iType1SNEFiles++;
+
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
+                                iPBStoreInfoData->iSNENumOfEntries;
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iSNEStringLength =
+                                iPBStoreInfoData->iSNETextLengthMax;
                         }
+                    break;
                     }
-                    break;
                 case UICC_EF_UID_TAG:
+                    {
                     break;
+                    }
                 default:
+                    {
                     break;
+                    }
                 }
 
-            // Check if error is there then remove that file ID and tag from iType1FileArray
+            // Check if error is there then remove that file ID and tag from
+            // iType1FileArray
             if( KErrNone != ret )
                 {
                 iType1FileArray.Remove(iCurrentArrayCounter);
@@ -912,14 +794,14 @@
             if( UICC_EF_ADN_TAG == tagValue)
                 {
                 iADNPbInitilized = EFalse;
-                // ADN phonebook is not valid and check for other phonebooks parameters
+                // ADN phonebook is not valid and check for other phonebooks
+                // parameters
                 iIniPhase = EPBIniPhase_3GADNDone;
                 return;
                 }
             iCurrentArrayCounter++;
             }
 
-
         // Check for next Phase
         if( iCurrentArrayCounter == iType1FileArray.Count() )
             {
@@ -929,10 +811,14 @@
             if( 0 != iType2FileArray.Count() )
                 iIniPhase = EPBInitPhase_3GADN_Type2;
 
-            if( 0 != iType3FileArray.Count() )
+            else if( 0 != iType3FileArray.Count() )
+                {
                 iIniPhase = EPBInitPhase_3GADN_Type3;
+                }
             else
+                {
                 iIniPhase = EPBIniPhase_3GADNDone;
+                }
             }
         } // End of Type 1 file array handling
     }
@@ -943,12 +829,12 @@
 // HAndles Data for Type 2 file Response
 // -----------------------------------------------------------------------------
 //
-
-
-void CMmPhoneBookOperationInit3G_adn::HandleType2FileResp(const TDesC8 &aFileData, TInt aStatus)
+void CMmPhoneBookOperationInit3G_adn::HandleType2FileResp(
+    const TDesC8 &aFileData,
+    TInt aStatus)
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType2FileResp");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE2FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType2FileResp" );
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::HandleType2FileResp");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE2FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType2FileResp" );
 
     TInt ret(KErrNone);
     TInt recordLength( 0 );
@@ -973,51 +859,74 @@
                 {
                 case UICC_EF_ANR_TAG:
                     {
-                    ret = CheckRecordSizeForFixedLength( 2, UICC_EF_PBC_TAG,recordLength );
+                    ret = CheckRecordSizeForFixedLength(
+                        UICC_TYPE2_FILE,
+                        UICC_EF_ANR_TAG,recordLength );
 
                     if(KErrNone == ret)
                         {
                         // total no of entries in all ANR files
-                        iPBStoreInfoData->iANRNumOfEntries = noOfRecords* iNumOfPBRRecords;
+                        iPBStoreInfoData->iANRNumOfEntries =
+                            noOfRecords* iNumOfPBRRecords;
                         // For this need to know about the ext files
-                        iPBStoreInfoData->iANRNumLengthMax = UICC_NO_EXT_MAX_NUM_LEN;
+                        iPBStoreInfoData->iANRNumLengthMax =
+                            UICC_NO_EXT_MAX_NUM_LEN;
                         // No of entries in every EF
-                        iPBStoreInfoData->iANRNumOfEntriesPerEntry = noOfRecords;
+                        iPBStoreInfoData->iANRNumOfEntriesPerEntry =
+                            noOfRecords;
                         // no of ANR Files type2 per ADN phonebook
                         iType2ANRFiles++;
+
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iANRNoOfRecords =
+                                iPBStoreInfoData->iANRNumOfEntries;
                         }
+                    break;
                     }
-                    break;
                 case UICC_EF_EMAIL_TAG:
                     {
                     // get the total no of entries in all EF in PBR Files
-                    iPBStoreInfoData->iEmailNumOfEntries = noOfRecords * iNumOfPBRRecords;
+                    iPBStoreInfoData->iEmailNumOfEntries =
+                        noOfRecords * iNumOfPBRRecords;
                     // get no of entries per Email EF
                     iPBStoreInfoData->iEmailNumOfEntriesPerEntry = noOfRecords;
 
-                    // get record Length from filedata, In Type2 and type3 files case email text length will be 2 less than record length
+                    // get record Length from filedata, In Type2 and type3 files
+                    // case email text length will be 2 less than record length
                     iPBStoreInfoData->iEmailTextLengthMax = recordLength - 2;
 
                     // get the no of type2 email files in every ADN Phonebook
                     iType2EmailFiles++;
+
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iEmailNoOfRecords =
+                            iPBStoreInfoData->iEmailNumOfEntries;
+                    break;
                     }
-                    break;
                 case UICC_EF_SNE_TAG:
                     {
-                    iPBStoreInfoData->iSNENumOfEntries = noOfRecords * iNumOfPBRRecords;
+                    iPBStoreInfoData->iSNENumOfEntries =
+                        noOfRecords * iNumOfPBRRecords;
                     iPBStoreInfoData->iSNENumOfEntriesPerEntry = noOfRecords;
 
-                    // get record Length from filedata, In Type2 and type 3 file case SNE text length will be 2 less than record length
+                    // get record Length from filedata, In Type2 and type 3 file
+                    // case SNE text length will be 2 less than record length
                     iPBStoreInfoData->iSNETextLengthMax = recordLength - 2;
 
                     // Get the no of Type 2 SNE Files per ADN phonebook
                     iType2SNEFiles++;
+
+                    iMmPhoneBookStoreMessHandler->
+                        iPBStoreConf[EPhonebookTypeAdn].iSNENoOfRecords =
+                            iPBStoreInfoData->iSNENumOfEntries;
+                    break;
                     }
-                    break;
                 default:
+                    {
                     break;
+                    }
                 }
-            if(KErrNone != ret)
+            if( KErrNone != ret )
                 {
                 iType2FileArray.Remove(iCurrentArrayCounter);
                 }
@@ -1041,7 +950,6 @@
                 iIniPhase = EPBIniPhase_3GADNDone;
             }
         }
-
     }
 
 
@@ -1050,19 +958,17 @@
 // HAndles Data received for Type 3 file request
 // -----------------------------------------------------------------------------
 //
-
-
-void CMmPhoneBookOperationInit3G_adn::HandleType3FileResp(const TDesC8 &aFileData, TInt aStatus)
+void CMmPhoneBookOperationInit3G_adn::HandleType3FileResp(
+    const TDesC8 &aFileData,
+    TInt aStatus)
     {
     TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::HandleType3FileResp" );
     OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_HANDLETYPE3FILERESP, "CMmPhoneBookOperationInit3G_adn::HandleType3FileResp" );
 
-
     TInt ret( KErrNone );
     TInt recordLength( 0 );
     TInt noOfRecords(0);
 
-
     if( UICC_STATUS_OK  == aStatus )
         {
         TFci fci( aFileData );
@@ -1080,37 +986,57 @@
             switch( tagValue )
                 {
                 case UICC_EF_AAS_TAG:
+                    {
                     break;
+                    }
                 case UICC_EF_EXT1_TAG:
-                {
+                    {
                     // Check for Fixed record length
-                    ret = CheckRecordSizeForFixedLength( 3, UICC_EF_EXT1_TAG,recordLength );
+                    ret = CheckRecordSizeForFixedLength(
+                        3,
+                        UICC_EF_EXT1_TAG,recordLength );
 
                     // check for Error if Length doesn'nt match
                     if( KErrNone == ret )
                         {
-                        // Get the file file length for extension data only (remove record type and Identifier 2 bytes)
+                        // Get the file file length for extension data only
+                        // (remove record type and Identifier 2 bytes)
                         TInt fileLength ( ( recordLength - 2 ) * noOfRecords );
-                            iPBStoreInfoData->iADNNumberLengthMax = UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
+                            iPBStoreInfoData->iADNNumberLengthMax =
+                                UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
 
-                            // Check file is not invalid
-                            if( UICC_NO_EXT_MAX_NUM_LEN == iPBStoreInfoData->iANRNumLengthMax )
+                        // Check file is not invalid
+                        if( UICC_NO_EXT_MAX_NUM_LEN ==
+                            iPBStoreInfoData->iANRNumLengthMax )
                             {
-                            iPBStoreInfoData->iANRNumLengthMax = UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
+                            iPBStoreInfoData->iANRNumLengthMax =
+                                UICC_NO_EXT_MAX_NUM_LEN+(2*fileLength);
                             }
+
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iNumlength =
+                                  iPBStoreInfoData->iADNNumberLengthMax;
+                        iMmPhoneBookStoreMessHandler->
+                            iPBStoreConf[EPhonebookTypeAdn].iExtNoOfRec =
+                                ( noOfRecords * iNumOfPBRRecords );
                         }
                     break;
-                  }
+                    }
                 case UICC_EF_GAS_TAG:
+                    {
                     break;
+                    }
                 case UICC_EF_CCP1_TAG:
+                    {
                     break;
+                    }
                 default:
+                    {
                     break;
+                    }
                 }
             }
 
-
         if( KErrNone != ret )
             {
             // remove from teh Array
@@ -1132,71 +1058,72 @@
 
 
 
-
 // -----------------------------------------------------------------------------
-// CmmPhonebookOperationInit::CheckForFileId
-// Check for no any 2 file id scould be same in any type 1, Type2 and tyoe3 files
+// CMmPhoneBookOperationInit3G_adn::CheckForFileId
+// Check for no any 2 file id should be same in any type 1, Type2 and type3
+// files
 // -----------------------------------------------------------------------------
 //
 
 TInt CMmPhoneBookOperationInit3G_adn::CheckForFileId()
     {
-    TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CheckForFileId");
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORFILEID, "CMmPhoneBookOperationInit3G_adn::CheckForFileId" );
-
+TFLOGSTRING("TSY: CMmPhoneBookOperationInit3G_adn::CheckForFileId");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORFILEID, "CMmPhoneBookOperationInit3G_adn::CheckForFileId" );
 
     TInt ret( KErrNone );
 
-    // Check for Type1 File Id's with all Type1  , Type2 and Type3 file Id's
-        for( TInt j=0; j< iType1FileArray.Count(); j++ )
+    // Check for Type1 File Id's with all Type1, Type2 and Type3 file Id's
+    for( TInt j=0; j < iType1FileArray.Count(); j++ )
+        {
+        // Check for Type 1 files
+        for( TInt i = (j+1); i< (iType1FileArray.Count()-j); i++ )
             {
-            // Check for Type 1 files
-            for( TInt i = (j+1); i< (iType1FileArray.Count()-j); i++ )
+            if( iType1FileArray[i].tagFID == iType1FileArray[j].tagFID )
                 {
-                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;
+                else
                     {
-                    // Check if it is a ADN EF then it will be a failure case
-                    if( iType1FileArray[i].tagValue == UICC_ADN_PRIM_TAG )
-                    ret = KErrGeneral;
-                    else
-                        {
-                        // remove Entry
-                        iType1FileArray.Remove(i);
-                        iType1FileArray.Remove(j);
-                        }
+                    // remove Entry
+                    iType1FileArray.Remove(i);
+                    iType1FileArray.Remove(j);
                     }
                 }
-            // Check for Type2 file id's
-            for(TInt i=0; i<iType2FileArray.Count(); i++)
+            }
+        // Check for Type2 file id's
+        for(TInt i=0; i<iType2FileArray.Count(); i++)
+            {
+            if( iType2FileArray[i].tagFID == iType1FileArray[j].tagFID )
                 {
-                if( iType2FileArray[i].tagFID == iType1FileArray[j].tagFID )
+                // Check for ADN file
+                if( iType1FileArray[j].tagValue == UICC_ADN_PRIM_TAG )
                     {
-                    // Check for ADN file
-                    if( iType1FileArray[j].tagValue == UICC_ADN_PRIM_TAG )
-                        ret = KErrGeneral;
-                    else
-                        {
-                        // remove thise Entries
-                        iType1FileArray.Remove(j);
-                        iType2FileArray.Remove(i);
-                        }
+                    ret = KErrGeneral;
+                    }
+                else
+                    {
+                    // remove thise Entries
+                    iType1FileArray.Remove(j);
+                    iType2FileArray.Remove(i);
                     }
                 }
-            // 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);
-                        }
+            }
+        // 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);
                     }
                 }
+            }
 
         // Check for Type2 File Id's with all Type2 and Type3 file Id's
         for( TInt j=0; j< iType2FileArray.Count(); j++ )
@@ -1205,35 +1132,33 @@
             for( TInt i = (j+1); i< ( iType2FileArray.Count()-j ); i++ )
                 {
                 if( iType2FileArray[i].tagFID == iType2FileArray[j].tagFID)
-                        {
-                        iType2FileArray.Remove(j);
-                        iType2FileArray.Remove(i);
-                        }
+                    {
+                    iType2FileArray.Remove(j);
+                    iType2FileArray.Remove(i);
                     }
+                }
             // Check for Type 3 File Id's
             for( TInt i=0; i<iType3FileArray.Count(); i++ )
                 {
                 if( iType3FileArray[i].tagFID == iType2FileArray[j].tagFID )
-                        {
-                        iType2FileArray.Remove(j);
-                        iType3FileArray.Remove(i);
-                        }
+                    {
+                    iType2FileArray.Remove(j);
+                    iType3FileArray.Remove(i);
+                    }
                 }
             }
 
         //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);
-
-                        }
+                    {
+                    iType3FileArray.Remove(j);
+                    iType3FileArray.Remove(i);
+                    }
                 }
             }
 
@@ -1248,14 +1173,15 @@
 
 TInt CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords( TInt aNoOfRecord )
     {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORNOOFRECORDS, "CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
-
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORNOOFRECORDS, "CMmPhoneBookOperationInit3G_adn::CheckForNoOfRecords" );
 
     TInt ret( KErrNone );
 
-            if( iPBStoreInfoData->iADNNumOfEntries != aNoOfRecord )
-                ret = KErrGeneral;
+    if( iPBStoreInfoData->iADNNumOfEntries != aNoOfRecord )
+        {
+        ret = KErrGeneral;
+        }
     return ret;
     }
 
@@ -1268,13 +1194,12 @@
 
 TInt CMmPhoneBookOperationInit3G_adn::CheckForSameType1AndType2Files()
     {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForSameType1AndType2Files" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORSAMETYPE1ANDTYPE2FILES, "CMmPhoneBookOperationInit3G_adn::CheckForSameType1AndType2Files" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckForSameType1AndType2Files" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKFORSAMETYPE1ANDTYPE2FILES, "CMmPhoneBookOperationInit3G_adn::CheckForSameType1AndType2Files" );
 
     TInt ret( KErrNone );
 
     // Check for No any File can be both Type1 and Type2
-
     for( TInt i=0; i<iType1FileArray.Count();i++ )
         {
         for( TInt j=0; j<iType2FileArray.Count(); j++ )
@@ -1283,7 +1208,9 @@
                 {
                 // Check for if it is ADN File
                 if( iType1FileArray[i].tagValue == UICC_ADN_PRIM_TAG )
+                    {
                     ret = KErrGeneral;
+                    }
                 else
                     {
                     iType1FileArray.Remove(i);
@@ -1296,17 +1223,19 @@
     }
 
 
-
 // -----------------------------------------------------------------------------
 // CmmPhonebookOperationInit::CheckRecordSizeForFixedLength
 //Check for if Fixed length file correct or not
 // -----------------------------------------------------------------------------
 //
 
-TInt CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength( TInt aFileType, TInt aFileId, TInt aRecordLength)
+TInt CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength(
+    TInt aFileType,
+    TInt aFileId,
+    TInt aRecordLength)
     {
-    TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength" );
-    OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKRECORDSIZEFORFIXEDLENGTH, "CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength" );
+TFLOGSTRING( "TSY: CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT3G_ADN_CHECKRECORDSIZEFORFIXEDLENGTH, "CMmPhoneBookOperationInit3G_adn::CheckRecordSizeForFixedLength" );
 
     TInt ret( KErrNone );
 
@@ -1315,31 +1244,41 @@
         {
         case UICC_EF_ANR_TAG:
             {
-                if(( 1 == aFileType ) && ( 15 != aRecordLength ))
+                if( ( 1 == aFileType ) && ( 15 != aRecordLength ) )
+                    {
                     ret = KErrGeneral;
+                    }
                 else
                     {
-                    if(( 2== aFileType )&& ( 17!=aRecordLength ))
+                    if( ( 2== aFileType )&& ( 17!=aRecordLength ) )
+                        {
                         ret =KErrNone;
+                        }
                     }
             break;
             }
         case UICC_EF_PBC_TAG:
             {
             if( 2!=aRecordLength )
+                {
                 ret = KErrGeneral;
+                }
             break;
             }
         case UICC_EF_UID_TAG:
             {
             if( 2!= aRecordLength )
+                {
                 ret = KErrGeneral;
+                }
             break;
             }
         case UICC_EF_EXT1_TAG:
             {
             if( 13 != aRecordLength )
+                {
                 ret = KErrGeneral;
+                }
             break;
             }
         }
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationread.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -226,14 +226,19 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+    
     cmdParams.serviceType = UICC_APPL_READ_LINEAR_FIXED;
     cmdParams.record = aRecordNo;
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
     // Convert Phone Book name to file id
     TUint16 fileIdExt ( 0x0000 );
-    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
     TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
     
     // get the corect Location to be read from phone book
@@ -405,7 +410,7 @@
 
     // Convert Phone Book name to file id
     TUint16 fileIdExt( 0x0000 );
-    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
     TUint8 arrayIndex = ConvertToConfArrayIndex( pbFileId );
 
     if ( UICC_STATUS_OK == aStatus )
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationwrite.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -66,8 +66,7 @@
 //
 CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite()
     {
-TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::\
-        CMmPhoneBookOperationWrite");
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_CMMPHONEBOOKOPERATIONWRITE, "CMmPhoneBookOperationWrite::CMmPhoneBookOperationWrite" );
     iPhoneBookEntry = NULL;
     }
@@ -79,8 +78,7 @@
 //
 CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite()
     {
-TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::\
-        ~CMmPhoneBookOperationWrite");
+TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite");
 OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_CMMPHONEBOOKOPERATIONWRITE, "CMmPhoneBookOperationWrite::~CMmPhoneBookOperationWrite" );
     }
 
@@ -92,6 +90,7 @@
 
 CMmPhoneBookOperationWrite* CMmPhoneBookOperationWrite::NewL(
     CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
+    CMmUiccMessHandler* aUiccMessHandler,
     const CMmDataPackage* aDataPackage ) // Data
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::NewL");
@@ -112,6 +111,7 @@
     mmPhoneBookOperationWrite->iMmPhoneBookStoreMessHandler =
         aMmPhoneBookStoreMessHandler;
 
+    mmPhoneBookOperationWrite->iMmUiccMessHandler = aUiccMessHandler;
     return mmPhoneBookOperationWrite;
     }
 
@@ -142,7 +142,7 @@
 TFLOGSTRING2("TSY: CMmPhoneBookOperationWrite::UICCCreateReq Ipc: %d", aIpc);
 OstTraceExt1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONWRITE_UICCCREATEREQ, "CMmPhoneBookOperationWrite::UICCCreateReq;aIpc=%hd", aIpc );
     
-    TInt ret (KErrNone);
+    TInt ret (KErrNotSupported);
     const CPhoneBookDataPackage* phoneBookData =
         static_cast<const CPhoneBookDataPackage*>( aDataPackage );
 
@@ -159,7 +159,11 @@
                     
                     // Convert Phone Book name to file id
                     TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-                    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+                    TUint16 pbFileId = ConvertToPBfileId( 
+                                         iPhoneBookTypeName,
+                                         fileIdExt,
+                                         iMmUiccMessHandler->GetCardType() );
+                                         
                     TUint8 pbArrayIndex ( ConvertToConfArrayIndex( pbFileId ) );
 
                     if( PB_MBDN_FID == pbFileId )
@@ -170,7 +174,8 @@
                                 iPBStoreConf[pbArrayIndex].iMbiRecLen )
                             {
                             iCurrentWritePhase = EPBWritePhase_Read_MBI_profile;
-                            // read MBDN record number from MBI first record Profile number
+                            // read MBDN record number from MBI first record 
+                            //Profile number
                             ret = UiccPbReqReadMBI( index, aTransId );
                             }
                         else
@@ -232,7 +237,10 @@
 
     // Convert Phone Book name to file id
     TUint16 fileIdExt ( UICC_ILLEGAL_FILE_ID );
-    TUint16 pbFileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint16 pbFileId = ConvertToPBfileId( 
+                          iPhoneBookTypeName,
+                          fileIdExt,
+                          iMmUiccMessHandler->GetCardType() );
 
     if( UICC_ILLEGAL_FILE_ID != pbFileId )
         {
@@ -255,15 +263,20 @@
                     // Check if Entry is present or not 
                     if( entry.iEntryPresent )
                         {
-                        // Check if no if ext records are sufficient from previous Entry
+                        // 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
+                            // 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++ )
+                                for( TInt i=0; 
+                                      i < entry.PBEntryExtRecord.Count();
+                                      i++ )
                                     {
-                                    // Append record number to be write from old Entry
+                                    // Append record number to be write from 
+                                    //old Entry
                                     iExtRecordArrayToBeWrite.Append( 
                                             entry.PBEntryExtRecord[i] );
                                     iExtRecordArrayToBeDelete.Append( 
@@ -281,7 +294,8 @@
                                     iExtRecordNo,
                                     aTransId);
                             }
-                        else  // when reocrds to be delete and write are 0 or to be write record less
+                        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 ) && 
@@ -300,7 +314,8 @@
                                 // 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
+                                    // Append record number to be write from old
+                                    //Entry
                                     iExtRecordArrayToBeWrite.Append(
                                             entry.PBEntryExtRecord[i]);
                                     iExtRecordArrayToBeDelete.Append(
@@ -308,9 +323,12 @@
                                     }
                                 // Update records needs to be deleted
                                 // From old Entry
-                                for( TInt i=extRecordNo; i <  entry.PBEntryExtRecord.Count(); i++ )
+                                for( TInt i=extRecordNo;
+                                       i < entry.PBEntryExtRecord.Count();
+                                       i++ )
                                     {
-                                    // Append record number to be deleted from old Entry
+                                    // Append record number to be deleted from 
+                                    //old Entry
                                     iExtRecordArrayToBeDelete.Append( 
                                             entry.PBEntryExtRecord[i]);
                                     }
@@ -359,7 +377,8 @@
                     }   // 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
+                    // 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 );
                     
@@ -432,7 +451,11 @@
 // Constructs an ISI-message to Write main Entry data
 // ---------------------------------------------------------------------------
 //
-TInt CMmPhoneBookOperationWrite::UiccPBReqWriteEntry( TUint16 aFileId, TUint8 aIndex, TUint8 aTransId, CPhoneBookStoreEntry& aDataToWrite )
+TInt CMmPhoneBookOperationWrite::UiccPBReqWriteEntry( 
+             TUint16 aFileId,
+             TUint8 aIndex,
+             TUint8 aTransId,
+             CPhoneBookStoreEntry& aDataToWrite )
     {
 TFLOGSTRING("TSY: CMmPhoneBookOperationWrite::UiccPBReqWriteEntry");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONWRITE_UICCPBREQWRITEENTRY, "CMmPhoneBookOperationWrite::UiccPBReqWriteEntry" );
@@ -446,14 +469,20 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
+    
     cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
     cmdParams.fileId = aFileId;
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
     // Check for valid record number
     TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
-    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iNoOfRecords )
+    if( aIndex <= iMmPhoneBookStoreMessHandler->
+                     iPBStoreConf[arrayIndex].iNoOfRecords )
         {
         cmdParams.record = aIndex;
         }
@@ -491,7 +520,9 @@
     if( numberBuf.Length() < UICC_EF_EXT_REC_NUM_LEN )
         {
         // fill  rest of the bytes
-        for( TInt count = numberBuf.Length(); count < UICC_EF_EXT_REC_NUM_LEN; count++)
+        for( TInt count = numberBuf.Length();
+               count < UICC_EF_EXT_REC_NUM_LEN;
+               count++)
             {
             numberBuf.Append( KTagUnusedbyte );
             }
@@ -558,8 +589,13 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    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 = aFileIdExt;
     cmdParams.serviceType = UICC_APPL_UPDATE_LINEAR_FIXED;
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
@@ -667,8 +703,12 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
+        {
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
+        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        }
     
     // Append transaction id 
     cmdParams.trId = static_cast<TUiccTrId>( aTransId );
@@ -682,7 +722,8 @@
     
     TUint8 arrayIndex( ConvertToConfArrayIndex( aFileId ) );
     // Check for the valid index neds to be read
-    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec )
+    if( aIndex <= iMmPhoneBookStoreMessHandler->
+                   iPBStoreConf[arrayIndex].iExtNoOfRec )
         {
         // Append recor number
         cmdParams.record = aIndex;
@@ -726,13 +767,19 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    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>( aTransId );
     cmdParams.fileId = aFileId;
     cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
     TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
-    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iNoOfRecords )
+    if( aIndex <= iMmPhoneBookStoreMessHandler->
+                    iPBStoreConf[arrayIndex].iNoOfRecords )
         {
         cmdParams.record = aIndex;
         }
@@ -776,8 +823,13 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    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>( aTransId );
     cmdParams.fileId = aFileIdExt;
     cmdParams.serviceType =  UICC_APPL_UPDATE_LINEAR_FIXED ;
@@ -785,7 +837,8 @@
     TUint8 arrayIndex ( ConvertToConfArrayIndex( aFileId ) );
 
     
-    if( aIndex <= iMmPhoneBookStoreMessHandler->iPBStoreConf[arrayIndex].iExtNoOfRec)
+    if( aIndex <= iMmPhoneBookStoreMessHandler->
+                   iPBStoreConf[arrayIndex].iExtNoOfRec)
         {
         cmdParams.record = aIndex;
         }
@@ -834,8 +887,13 @@
         cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
         cmdParams.filePath.Append( APPL_FILE_ID>>8);
         cmdParams.filePath.Append( APPL_FILE_ID);
-        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-        cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+        
+        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>( aTransId );
         cmdParams.fileId = PB_MBI_FID;
         cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
@@ -876,8 +934,13 @@
     cmdParams.filePath.Append( static_cast<TUint8>( MF_FILE ));
     cmdParams.filePath.Append( APPL_FILE_ID>>8);
     cmdParams.filePath.Append( APPL_FILE_ID);
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK >> 8 ));
-    cmdParams.filePath.Append( static_cast<TUint8>( DF_PHONEBOOK ));
+    
+    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>( aTransId );
     cmdParams.fileId = PB_MBI_FID;
     cmdParams.serviceType =  UICC_APPL_READ_LINEAR_FIXED ;
@@ -922,7 +985,7 @@
     TInt ret ( KErrNone );
     
     TUint16 fileIdExt ( 0x0000 );
-    TUint16 fileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt );
+    TUint16 fileId = ConvertToPBfileId( iPhoneBookTypeName, fileIdExt, iMmUiccMessHandler->GetCardType() );
     //// Check for PhoenBook Index for which needs to checked
     TUint8 pbArrayIndex = ConvertToConfArrayIndex( fileId );
 
@@ -1226,7 +1289,8 @@
                     iCurrentWritePhase = EPBWritePhase_Write_Ext_Entry;
                     iExtDeleteOperation= ETrue;
                     //last index
-                    TUint8 index = iExtRecordArrayToBeDelete[ iExtRecordArrayToBeDelete.Count() -1 ];
+                    TUint8 index = iExtRecordArrayToBeDelete[
+                                        iExtRecordArrayToBeDelete.Count() -1 ];
                     ret = UiccPbReqWriteExtDelete(
                           aFileId,
                           aFileIdExt,
@@ -1363,7 +1427,8 @@
                     iCurrentWritePhase = EPBWritePhase_Write_Entry;
                     TUint8 index ( 0 );
                         // Start writing main Entry
-                    if( ( iPhoneBookEntry->iLocation == 0 )||( PB_MBDN_FID == aFileId ) )
+                    if( ( iPhoneBookEntry->iLocation == 0 )||
+                        ( PB_MBDN_FID == aFileId ) )
                         {
                         index = iEntryToWrite;
                         }
@@ -1489,12 +1554,17 @@
                          GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
             if( 0 <= index )
                 {
-                iMmPhoneBookStoreMessHandler->UpdateEntryFromList( iEntryToUpdateInList, index, arrayIndex );
+                iMmPhoneBookStoreMessHandler->UpdateEntryFromList( 
+                                                iEntryToUpdateInList,
+                                                index,
+                                                arrayIndex );
                 }
             else
                 {
                 // Append the Entry to the List
-                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( iEntryToUpdateInList, arrayIndex );
+                iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                                iEntryToUpdateInList,
+                                                arrayIndex );
                 }
             // If it is MBDN Phone Book then update MBI File also
             if( PB_MBDN_FID == aFileId)
@@ -1565,10 +1635,14 @@
                 iExtRecordArrayToBeDelete.Compress();
                 }
             // Remove old Entry from the list 
-            TInt index = iMmPhoneBookStoreMessHandler->GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+            TInt index = iMmPhoneBookStoreMessHandler->GetIndexForPresentEntry(
+                                                        iPhoneBookEntry->iLocation,
+                                                        arrayIndex );
             if( 0 <= index )
                 {
-                iMmPhoneBookStoreMessHandler->RemoveExtEntryFromList( index, arrayIndex);
+                iMmPhoneBookStoreMessHandler->RemoveExtEntryFromList(
+                                                index,
+                                                arrayIndex);
                 }
             
             if( iExtRecordArrayToBeDelete.Count() > 0 )
@@ -1577,7 +1651,11 @@
                 iExtDeleteOperation = ETrue;
                 TUint8 index = iExtRecordArrayToBeDelete[
                                iExtRecordArrayToBeDelete.Count() -1 ];
-                ret = UiccPbReqWriteExtDelete( aFileId, aFileIdExt, index, aTransId );
+                ret = UiccPbReqWriteExtDelete(
+                              aFileId,
+                              aFileIdExt,
+                              index,
+                              aTransId );
                 }
             else
                 {
@@ -1585,7 +1663,8 @@
                 iCurrentWritePhase = EPBWritePhase_Write_Entry;
                 TUint8 index ( 0 );
                 // Start writing main Entry
-                if( ( iPhoneBookEntry->iLocation == 0 )||( PB_MBDN_FID == aFileId ) )
+                if( ( iPhoneBookEntry->iLocation == 0 )||
+                      ( PB_MBDN_FID == aFileId ) )
                     {
                     index = iEntryToWrite;
                     }
@@ -1619,6 +1698,8 @@
             // first do the delete records
             if( iExtRecordArrayToBeWrite.Count() > 0 )
                 {
+                // increment Ext record written
+                iExtRecordWritten++;
                 iEntryToUpdateInList->PBEntryExtRecord.Append( iExtRecordArrayToBeWrite[0] );
                 TUint8 index = iExtRecordArrayToBeWrite[0];
                 ret = UiccPbReqWriteExt(
@@ -1632,15 +1713,22 @@
                 {
                 // Overwrite old Entry from the list 
                 TInt index = iMmPhoneBookStoreMessHandler->
-                             GetIndexForPresentEntry( iPhoneBookEntry->iLocation, arrayIndex );
+                                GetIndexForPresentEntry( 
+                                  iPhoneBookEntry->iLocation,
+                                  arrayIndex );
                 if( 0 <= index )
                     {
-                    iMmPhoneBookStoreMessHandler->UpdateEntryFromList( iEntryToUpdateInList, index, arrayIndex );
+                    iMmPhoneBookStoreMessHandler->UpdateEntryFromList(
+                                                   iEntryToUpdateInList,
+                                                   index,
+                                                   arrayIndex );
                     }
                 else
                     {
                     // Append the Entry to the List
-                    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList( iEntryToUpdateInList, arrayIndex );
+                    iMmPhoneBookStoreMessHandler->StoreEntryToPhoneBookList(
+                                                    iEntryToUpdateInList,
+                                                    arrayIndex );
                     }
                 // If it is MBDN PhoenBook then update MBI Profile also
                 if( PB_MBDN_FID == aFileId)
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoremesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -33,7 +33,9 @@
 #include "cmmphonebookoperationread.h"
 #include "cmmphonebookoperationread3g_adn.h"
 #include "cmmphonebookoperationcache.h"
+#include "cmmphonebookoperationcache3g_adn.h"
 #include "cmmphonebookoperationwrite.h"
+#include "cmmphonebookoperationwrite3g_adn.h"
 #include "cmmphonebookoperationdelete.h"
 #include "cmmphonebookstoreoperationlist.h"
 #include "cmmphonebookstoreoperationbase.h"
@@ -51,7 +53,8 @@
     // None
 
 // CONSTANTS
-    // None
+const TUint8 KMaxAnrLength( 100 );
+const TUint8 KMaxSneLength( 241 );
 
 // MACROS
     // None
@@ -97,43 +100,37 @@
 // Separate phonebook entry from ISI message
 // ---------------------------------------------------------------------------
 //
-
 void TPrimitiveInitInfo::GetPBEntryFromUICCData(
-     const TDesC8& aFileData,
-     TDes8& aNumber,
-     TDes8& aName)
+    const TDesC8& aFileData,
+    TDes8& aNumber,
+    TDes8& aName)
     {
-    TUint8 nameLength (0);
-    TUint8 numLength(0);
+    TUint8 nameLength( iAlphaStringlength );
+    TUint8 numLength( 0 );
 
-    // Maximum record length will be RecordLength -14
-    // Actual string length can be find the first FF , which indicates that after
-    // that its empty
-    nameLength = aFileData.Find(&KTagUnusedbyte,1);
-    // Check if MAX length is smaller than the MAX alpha string length
-    if( iAlphaStringlength < nameLength)
+    if ( iAlphaStringlength )
         {
-        // Max lenght wil be the valid alpha string Length
-        nameLength = iAlphaStringlength;
+        // If actual alpha string is shorter than defined in entry structure,
+        // copy it until the first 'FF'
+        TInt endOfAlphaString( aFileData.Find( &KTagUnusedbyte, 1 ) );
+        if ( endOfAlphaString > 0 && endOfAlphaString < iAlphaStringlength )
+            {
+            nameLength = endOfAlphaString;
+            }
+TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving name.");
+OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving Name" );
+        aName.Copy( aFileData.Mid( 0, nameLength ) );
         }
+    // No else. Alpha string length is 0 and it is not copied
 
     numLength = aFileData[iAlphaStringlength];
 
-    // Chekc for number Length also
+    // Check for number Length also
     if( iNumlength < numLength)
         {
         numLength = iNumlength;
         }
-
-    // Save name
-    if ( KMinLength < nameLength )
-        {
-TFLOGSTRING("TSY: TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving name.");
-OstTrace0( TRACE_NORMAL, TPRIMITIVEINITINFO_GETPBENTRYFROMUICCDATA, "TPrimitiveInitInfo::GetPBEntryFromUICCData. Saving Name" );
-
-        aName.Copy(aFileData.Mid(0,nameLength));
-        }
-    //no else
+    // no else
     // Save number
     if ( KMinLength < numLength )
         {
@@ -409,7 +406,7 @@
             if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
                 {
                 //call CmmPhonebookOperationCache Phonebook
-                pointer = CMmPhoneBookOperationCache::NewL(
+                pointer = CMmPhoneBookOperationCache3G_adn::NewL(
                         this,
                         iMmUiccMessHandler,
                         aIpc,
@@ -443,7 +440,7 @@
                 }
             else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
                 {
-                pointer = CMmPhoneBookOperationRead3g_adn::NewL(
+                pointer = CMmPhoneBookOperationRead::NewL(
                         this,
                         iMmUiccMessHandler,
                         aDataPackage );
@@ -457,13 +454,16 @@
                 //call CmmPhonebookOperationWrite
                 pointer = CMmPhoneBookOperationWrite::NewL(
                     this,
+                    iMmUiccMessHandler,
                     aDataPackage );
                 }
             else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
                 {
-                //call CmmPhonebookOperationWrite
-                pointer = CMmPhoneBookOperationWrite::NewL(
+                // needs to be changed after 3g ADN implmentation
+                // to be implemented for 3G
+                pointer = CMmPhoneBookOperationWrite3g_adn::NewL(
                     this,
+                    iMmUiccMessHandler,
                     aDataPackage );
                 }
             break;
@@ -485,6 +485,11 @@
             else if( UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType() )
                 {
                 // To be implemented for 3G
+                // needs to be changed after 3G ADN implementation
+                pointer = CMmPhoneBookOperationDelete::NewL(
+                    this,
+                    iMmUiccMessHandler,
+                    aDataPackage );
                 }
             break;
             }
@@ -592,6 +597,73 @@
     }
 
 
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::StoreAnrToPbEntry
+//
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::StoreAnrToPhonebookEntryL(
+    TDes8& aAnr,
+    CPhoneBookStoreEntry& aEntry,
+    const TUint16 aFileId )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::StoreAnrToPhonebookEntryL.");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_STOREANRTOPHONEBOOKENTRYL, "CMmPhoneBookStoreMessHandler::StoreAnrToPhonebookEntryL" );
+
+    TInt anrLength( aAnr.Length() );
+    if ( KMaxAnrLength < anrLength )
+        {
+        aAnr.SetLength( KMaxAnrLength );
+        }
+
+    TBufC8<KMaxAnrLength> anrSourceBuf( aAnr );
+    TBuf16<KMaxAnrLength> anrTargetBuf;
+
+    // Convert 8-bit number to 16-bit ascii code
+    ConvertToUcs2FromBCD( aAnr, anrTargetBuf, aFileId );
+    // Add ANR entry to cache
+    aEntry.iAnr->AppendL( anrTargetBuf );
+    }
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::StoreSneToPbEntry
+//
+// ---------------------------------------------------------------------------
+//
+
+void CMmPhoneBookStoreMessHandler::StoreSneEmailToPbEntryL(
+    TDes8& aString,
+    CPhoneBookStoreEntry& aEntry,
+    TUint8 aFileTypeTag )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::StoreSneToPbEntry.");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_STORESNETOPBENTRY, "CMmPhoneBookStoreMessHandler::StoreSneToPbEntry" );
+
+    if ( aString.Length() )
+        {
+        TBuf16<KMaxSneLength> targetString; // Final SNE/EMAIL for cache
+        TBuf8<KMaxSneLength> outputString; // Temporary for converting
+
+        CMmStaticUtility::ConvertGsmDataToUcs2(
+            aString,
+            aString.Length(),
+            outputString );
+        // From 8-bit to 16-bit
+        TIsiUtility::CopyFromBigEndian( outputString, targetString );
+
+        if ( UICC_SNE_PRIM_TAG == aFileTypeTag )
+            {
+            aEntry.iSne->AppendL( targetString );
+            }
+        else if ( UICC_EMAIL_PRIM_TAG == aFileTypeTag )
+            {
+            aEntry.iEmail->AppendL( targetString );
+            }
+        // No else
+        }
+    // No else. If no data, nothing is appended
+    }
 
 
 // -----------------------------------------------------------------------------
@@ -770,7 +842,7 @@
 //
 TInt CMmPhoneBookStoreMessHandler::ConvertToBCDFromUCS2
        (
-        TDes16 &aSource,
+        TDesC16 &aSource,
         TDes8 &aTarget,
         TUint16 aFileId )
     {
@@ -904,7 +976,10 @@
 // ---------------------------------------------------------------------------
 //
 
-TBool CMmPhoneBookStoreMessHandler::IndexCheckInPBList( TUint8 aIndex, TUint8 aPBIndex, TPBEntry& aEntry )
+TBool CMmPhoneBookStoreMessHandler::IndexCheckInPBList(
+                    TUint8 aIndex,
+                    TUint8 aPBIndex,
+                    TPBEntry& aEntry )
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::IndexCheckInPBList");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_INDEXCHECKINPBLIST, "CMmPhoneBookStoreMessHandler::IndexCheckInPBList" );
@@ -928,7 +1003,9 @@
 // ---------------------------------------------------------------------------
 //
 
-TInt CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry( TUint8 aIndex, TUint8 aPBIndex )
+TInt CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry(
+                    TUint8 aIndex,
+                    TUint8 aPBIndex )
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETINDEXFORPRESENTENTRY, "CMmPhoneBookStoreMessHandler::GetIndexForPresentEntry" );
@@ -975,7 +1052,10 @@
 // ---------------------------------------------------------------------------
 //
 
-void CMmPhoneBookStoreMessHandler::UpdateEntryFromList( TPBEntry* aEntry, TUint8 aIndex , TUint8 aPBIndex)
+void CMmPhoneBookStoreMessHandler::UpdateEntryFromList(
+             TPBEntry* aEntry,
+             TUint8 aIndex ,
+             TUint8 aPBIndex)
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveEntryFromList");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveEntryFromList" );
@@ -990,7 +1070,9 @@
 // ---------------------------------------------------------------------------
 //
 
-void CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList( TUint8 aIndex , TUint8 aPBIndex)
+void CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList(
+               TUint8 aIndex ,
+               TUint8 aPBIndex)
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_REMOVEEXTENTRYFROMLIST, "CMmPhoneBookStoreMessHandler::RemoveExtEntryFromList" );
@@ -1046,5 +1128,66 @@
     return iPhoNetSender;
     }
 
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::FindEntryFromPbList
+// Finds PB entry from iPBEntryList
+// ---------------------------------------------------------------------------
+//
+TPBEntry* CMmPhoneBookStoreMessHandler::FindEntryFromPbList(
+                 TUint8 aIndex,
+                 TUint8 aRecordNo )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::FindEntryFromPbList");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_FINDENTRYFROMPBLIST, "CMmPhoneBookStoreMessHandler::FindEntryFromPbList" );
+
+    TPBEntry* ret( NULL );
+
+    for( int i = 0; i < iPBEntryList[aIndex].iEntryList.Count(); i++ )
+        {
+        if( aRecordNo == iPBEntryList[aIndex].iEntryList[i]->iEntryIndex )
+            {
+            ret = iPBEntryList[aIndex].iEntryList[i];
+            break;
+            }
+        }
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMmPhoneBookStoreMessHandler::GetEntryForType2FileId
+// Finds PB entry from iPBEntryList
+// ---------------------------------------------------------------------------
+//
+void CMmPhoneBookStoreMessHandler::GetEntriesForType2FileId(
+    const TInt aCurrentType2EfIndex,
+    const TInt aCurrentRecordNum,
+    RArray<TInt>& aArray )
+    {
+TFLOGSTRING("TSY: CMmPhoneBookStoreMessHandler::GetEntryForType2FileId");
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREMESSHANDLER_GETENTRYFORTYPE2FILEID, "CMmPhoneBookStoreMessHandler::GetEntryForType2FileId" );
+    TInt numOfEntries( iPBEntryList[EPhonebookTypeAdn].iEntryList.Count() );
+
+    // Loop all entries that have been created
+    for ( TInt i( 0 ); i < numOfEntries; i++ )
+        {
+        TPBEntry* entry( iPBEntryList[EPhonebookTypeAdn].iEntryList[i] );
+        if ( entry )
+            {
+            RArray<TIapInfo> iapInfo( entry->iapInfo );
+            // There are as many IAP infos in entry as type 2 files in PBR
+            // Those have been stored in same order as type 2 files in PBR
+            // So when elementary file order number is known, corresponding
+            // IAP info is known. If recored number there is same as current
+            // record number, this type 2 file belongs to this ADN entry
+            if ( ( aCurrentType2EfIndex < iapInfo.Count() ) &&
+                ( aCurrentRecordNum == iapInfo[aCurrentType2EfIndex].recordNo) )
+                {
+                aArray.Append( entry->iEntryIndex );
+                }
+            }
+        }
+    }
+
 
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookstoreoperationbase.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -41,7 +41,8 @@
     // None
 
 // CONSTANTS
-//const TUint8 KMinLength = 1;
+const TUint8 KPbrTlvLengthWithSfi( 5 );
+const TUint8 KPbrTlvLengthWithoutSfi( 4 );
 
 
 // MACROS
@@ -160,7 +161,7 @@
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetPhoneBookName - PhoenbookName");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_GETPHONEBOOKNAME, "CMmPhoneBookStoreOperationBase::GetPhoneBookName - PhoneBookName" );
-    
+
     return iPhoneBookTypeName;
     }
 
@@ -247,7 +248,7 @@
         case EPhonebookTypeVMBX:
             apbName.Copy(KETelIccVoiceMailBox);
             break;
-            
+
         default:
             break;
         }
@@ -309,7 +310,7 @@
 // ---------------------------------------------------------------------------
 //
 TUint16 CMmPhoneBookStoreOperationBase::ConvertToPBfileId(
-    const TName& aPBType, TUint16 &aFileIdExt )
+    const TName& aPBType, TUint16 &aFileIdExt, TUint8 aCardType )
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBfileId");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBFILEID, "CMmPhoneBookStoreOperationBase::ConvertToPBfileId" );
@@ -348,8 +349,15 @@
         }
     else if ( 0 == aPBType.CompareF( KETelIccMsisdnPhoneBook ) )
         {
+        if( UICC_CARD_TYPE_UICC == aCardType )
+            {
+            aFileIdExt = PB_EXT5_FID;
+            }
+        else
+            {
+            aFileIdExt = PB_EXT1_FID;
+            }
         fileId = PB_MSISDN_FID;
-        aFileIdExt = PB_EXT1_FID;
         }
     else
         {
@@ -358,7 +366,7 @@
         }
 TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::ConvertToPBfileId phonebookfileid: %d", fileId);
 OstTraceExt1( TRACE_NORMAL, DUP2_CMMPHONEBOOKSTOREOPERATIONBASE_CONVERTTOPBFILEID, "CMmPhoneBookStoreOperationBase::ConvertToPBfileId;fileId=%hu", fileId );
-    
+
 
     return fileId;
     }
@@ -412,7 +420,7 @@
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::GetTransId");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId" );
-    
+
 
     TUint8 transId( 0 );
 
@@ -527,7 +535,7 @@
                 {
 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;
                 }
             }
@@ -609,7 +617,7 @@
 
 TFLOGSTRING2("TSY: CMmPhoneBookStoreOperationBase::GetTransId : Get transaction id: %d", transId);
 OstTraceExt1( TRACE_NORMAL, DUP4_CMMPHONEBOOKSTOREOPERATIONBASE_GETTRANSID, "CMmPhoneBookStoreOperationBase::GetTransId;transId=%hhu", transId );
-    
+
     return transId;
     }
 
@@ -749,11 +757,11 @@
     {
 TFLOGSTRING("TSY: CMmPhoneBookStoreOperationBase::EmptyEntryCheck");
 OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONREAD_EMPTYENTRYCHECK, "CMmPhoneBookStoreOperationBase::EmptyEntryCheck" );
-    
+
 
     TInt ret( KErrNone);
-    
-    if(( 0xFF == aFileData[0]) 
+
+    if(( 0xFF == aFileData[0])
        || (0xFF == aFileData[1]))
         {
         ret = KErrNotFound;
@@ -761,4 +769,69 @@
     return ret;
     }
 
+// -----------------------------------------------------------------------------
+// CMmPhoneBookStoreOperationBase::FetchFileListFromPBR
+// Search wanted file list from EFpbr
+// -----------------------------------------------------------------------------
+//
+TInt CMmPhoneBookStoreOperationBase::FetchFileListFromPBR(
+    const TDesC8 &aFileData,
+    const TUint8 aTag,
+    RArray <TPrimitiveTag>& aFileList )
+    {
+TFLOGSTRING( "TSY: CMmPhoneBookStoreOperationBase::FetchFileListFromPBR" );
+OstTrace0( TRACE_NORMAL, CMMPHONEBOOKSTOREOPERATIONBASE_FETCHFILELISTFROMPBR, "CMmPhoneBookStoreOperationBase::FetchFileListFromPBR" );
+
+    TInt ret( KErrNone );
+    TPrimitiveTag primTag;
+
+    TInt offset( aFileData.Find( &aTag, 1 ) );
+    TInt nextOffset( 0 );
+
+    if( offset != KErrNotFound )
+        {
+        // Get the File Tag Length
+        offset++;
+        TUint8 tagLength = aFileData[offset++];
+
+        for( TInt i = 0; i < tagLength; i += nextOffset )
+            {
+            // Get the Tag name
+            primTag.tagValue = aFileData[offset++];
+            TUint8 len( aFileData[offset++] );
+
+            // Get the File ID which is 2byte long
+            primTag.tagFID = CMmStaticUtility::Get16Bit( aFileData, offset );
+            offset += 2;
+
+            // If file Tag length is 3 the SFI is available and if file tag
+            // length is 2 the only File ID is present
+            if( KLengthWithSFI == len )
+                {
+                primTag.tagSFI = aFileData[offset++];
+                // get the offset for next file tag
+                nextOffset = KPbrTlvLengthWithSfi;
+                }
+            else if( KLengthWithOutSFI == len )
+                {
+                primTag.tagSFI = 0;
+                // get the offset for next file tag
+                nextOffset = KPbrTlvLengthWithoutSfi;
+                }
+            else
+                {
+                ret = KErrGeneral;
+                break;
+                }
+            aFileList.Append( primTag );
+            }
+        }
+    else
+        {
+        ret = KErrNotFound;
+        }
+
+    return ret;
+    }
+
 // End of File
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmstaticutility.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -52,7 +52,8 @@
     // None
 
 // CONSTANTS
-    // None
+const TUint8 KNotAllowed = 0x01;
+const TUint8 KAllowedWithModifications = 0x02;
 
 // MACROS
     // None
@@ -261,6 +262,12 @@
                             KErrGsmCallRejected );
                         break;
                         }
+                    case CALL_MODEM_CAUSE_INCOMPATIBLE_DEST:
+                        {
+                        epocError = EpocErrorCode( KErrGeneral,
+                            KErrGsmCCBearerCapabilityNotAuthorised );
+                        break;
+                        }
                     // Not used by GSM ISA Call server: checking of
                     // parameters has been left to the client's responsibility
                     case CALL_MODEM_CAUSE_INVALID_ADDRESS:
@@ -2492,6 +2499,93 @@
 #endif // __WINSCW__
     }
 
+// ----------------------------------------------------------------------------
+// CMmStaticUtility::ProcessIfIdentityServices
+// Checks if this is related to identity services
+// -----------------------------------------------------------------------------
+//
+TInt CMmStaticUtility::MapSw1Sw2ToEpocError( 
+    const TUint8 aSw1, 
+    const TUint8 aSw2, 
+    const TUint8 aResult )
+    {
+TFLOGSTRING4("TSY:CMmSupplServMessHandler::MapSw1Sw2ToEpocError: sw1: 0x%x sw2: 0x%x result: 0x%x", aSw1, aSw2, aResult );
+
+    TInt ret( KErrGeneral );
+
+    //These are the ok responses ( for envelope )
+    //-90 00 normal ending of the command
+    //-91 XX normal ending of the command with extra information from the
+    // proactive SIM containing a command for ME length XX of response data
+    //-9E XX length XX of the response data given in case of a SIM data
+
+    // download error
+    //-9F XX length XX of the response data
+    //This is the busy response
+    //-93 00 SAT is busy. Command cannot be executed at present, further
+    // normal commands are allowed
+    //This is the memory status
+    //-92 0X command succesful but after using and internal update retry
+    // routine x times
+    //-92 40 memory problem
+    //Application independent errors
+    //-67 XX incorrect parameter P3
+    //-6B XX incorrect parameter P1 or P2
+    //-6E XX wrong instruction class given in the command
+    //-6F XX technical problem with no diagnostic given.
+    //Also possible
+    //-94 02 P1 or P2 is caused by the addressed record being out of range
+
+    switch( aSw1 )
+        {
+        case 0x90:
+        case 0x91:
+        case 0x9F:
+            {
+            if( KNotAllowed == aResult )
+                {
+                ret = CMmStaticUtility::EpocErrorCode( 
+                    KErrGeneral,
+                    KErrGsmCCCallRejected );
+                }
+            else if( KAllowedWithModifications == aResult )
+                {
+                ret = CMmStaticUtility::EpocErrorCode( 
+                    KErrAccessDenied,
+                    KErrSatControl );
+                }
+            break;
+            }
+        case 0x93:
+            {
+            if( 0x00 == aSw2 )
+                {
+                ret = CMmStaticUtility::EpocErrorCode( 
+                    KErrAccessDenied,
+                    KErrSatBusy );
+                }
+            break;
+            }
+        case 0x6F:
+            {
+            ret = CMmStaticUtility::EpocErrorCode( 
+                KErrGeneral,
+                KErrGsmCallControlBase );
+            break;
+            }
+        default:
+            {
+TFLOGSTRING("TSY:CMmSupplServMessHandler::MapSw1Sw2ToEpocError: default");
+            ret = CMmStaticUtility::EpocErrorCode( 
+                KErrGeneral,
+                KErrGsmCallControlBase );
+            break;
+            }
+        }
+
+    return ret;
+    }
+
 // -----------------------------------------------------------------------------
 // CMmStaticUtility::SetOperinfoApac
 // Sets internal oper info value. THIS IS ONLY FOR WINSCW USE
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmsupplservmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -607,8 +607,9 @@
             // FDN check should not be done for SAT originated requests
             iFdnCheck = EFalse;
 
-            // In this case also resource control is suppressed.
-            iResourceControlSuppress = ETrue;
+            // Let's check is resource control suppress needed. This info is set
+            // by simatktsy when extFuncL is called with IPC ESatNotifySendSsPCmd
+            aDataPackage->UnPackData ( iResourceControlSuppress );
 
             break;
             }
@@ -1605,8 +1606,10 @@
                 {
                 //If cause value is KSsGsmSsNotAvailable (comes in SS_OTHER_ERROR sub block)
                 //this indicates that there is not network coverage.
-                if( SS_GSM_SS_NOT_AVAILABLE == aIsiMessage.Get8bit(
-                    sbStartOffset + SS_OTHER_ERROR_OFFSET_ERRORCODE ) )
+                TUint8 errorCode( aIsiMessage.Get8bit(
+                    sbStartOffset + SS_OTHER_ERROR_OFFSET_ERRORCODE ) );
+
+                if( SS_GSM_SS_NOT_AVAILABLE == errorCode )
                     {
                     errorToClient = CMmStaticUtility::EpocErrorCode(
                         KErrCouldNotConnect,
@@ -1615,6 +1618,38 @@
              Cause: KSsGsmSsNotAvailable => No network coverage." );
 OstTrace0( TRACE_NORMAL, DUP2_CMMSUPPLSERVMESSHANDLER_SSSERVICEFAILEDRESP, "CMmSupplServMessHandler::SsServiceFailedResp, Cause: KSsGsmSsNotAvailable => No network coverage" );
                     }
+                else if( SS_RESOURCE_CONTROL_DENIED == errorCode )
+                    {
+                     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+                         ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP,
+                         SS_SB_RESOURCE_CONTROL_INFO,
+                         EIsiSubBlockTypeId8Len8,
+                         sbStartOffset ) )
+                         {
+                         TUint8 dataLen( aIsiMessage.Get8bit(
+                             sbStartOffset + SS_SB_RESOURCE_CONTROL_INFO_OFFSET_DATALENGTH ) );
+
+                         TPtrC8 data( aIsiMessage.GetData(
+                             sbStartOffset + SS_SB_RESOURCE_CONTROL_INFO_OFFSET_DATA,
+                             dataLen ) );
+                         // sw1, sw2 and result is inserted to SS_SB_RESOURCE_CONTROL_INFO
+                         // by simatktsy and ther order from first byte is: sw1, sw2 and result
+                         TUint8 sw1 = data[KSw1Index];
+                         TUint8 sw2 = data[KSw2Index];
+                         TUint8 result = data[KResultIndex];
+                         errorToClient = CMmStaticUtility::MapSw1Sw2ToEpocError( 
+                             sw1, 
+                             sw2, 
+                             result );
+                         }
+                     else
+                         {
+                         errorToClient = CMmStaticUtility::CSCauseToEpocError(
+                            PN_SS,
+                            subBlockId,
+                            errorCode );
+                         }
+                    }
                 else
                     {
                     // Translate error to epoc world
--- a/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/nokiatsy_dll/src/cmmussdmesshandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -241,21 +241,24 @@
             {
             // User has requested to send MO USSD
             case RMobileUssdMessaging::EUssdMORequest:
+            case RMobileUssdMessaging::EUssdMOReply:
+                {
                 ussdType = SS_GSM_USSD_COMMAND;
                 break;
-            // User is replying to MT USSD.
-            case RMobileUssdMessaging::EUssdMOReply:
-                ussdType = SS_GSM_USSD_MT_REPLY;
-                break;
+                }
             // User is signing for the MT request
             case RMobileUssdMessaging::EUssdMOAcknowledgement:
+                {
                 ussdType = SS_GSM_USSD_NOTIFY;
                 break;
+                }
             // Unknown or illegal cases return error to client
             default:
+                {
                 // ussd type is unknown, report error
                 ret = KErrArgument;
                 break;
+                }
             }
         }
     else
@@ -508,6 +511,7 @@
 
     // offset where the subblock starts
     TUint sbStartOffset( KErrNone );
+    TBool errorMappingNeeded( ETrue );
 
     //create package.
     CMmDataPackage package;
@@ -549,9 +553,40 @@
         EIsiSubBlockTypeId8Len8,
         sbStartOffset ) )
         {
-        causeType = SS_OTHER_ERROR;
-        causeValue = aIsiMessage.Get8bit(
-            sbStartOffset + SS_OTHER_ERROR_OFFSET_ERRORCODE );
+        TUint8 errorCode( aIsiMessage.Get8bit(
+            sbStartOffset + SS_OTHER_ERROR_OFFSET_ERRORCODE ) );
+
+        if( SS_RESOURCE_CONTROL_DENIED == errorCode )
+            {
+            if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
+                ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP,
+                SS_SB_RESOURCE_CONTROL_INFO,
+                EIsiSubBlockTypeId8Len8,
+                sbStartOffset ) )
+                {
+                TUint8 dataLen( aIsiMessage.Get8bit(
+                sbStartOffset + SS_SB_RESOURCE_CONTROL_INFO_OFFSET_DATALENGTH ) );
+
+                TPtrC8 data( aIsiMessage.GetData(
+                sbStartOffset + SS_SB_RESOURCE_CONTROL_INFO_OFFSET_DATA,
+                dataLen ) );
+                // sw1, sw2 and result is inserted to SS_SB_RESOURCE_CONTROL_INFO
+                // by simatktsy and ther order from first byte is: sw1, sw2 and result
+                TUint8 sw1 = data[KSw1Index];
+                TUint8 sw2 = data[KSw2Index];
+                TUint8 result = data[KResultIndex];
+                epocError = CMmStaticUtility::MapSw1Sw2ToEpocError( 
+                    sw1, 
+                    sw2, 
+                    result );
+                errorMappingNeeded = EFalse;
+                }
+            }
+        else
+            {
+            causeType = SS_OTHER_ERROR;
+            causeValue = errorCode;
+            }
         }
     else if( KErrNone == aIsiMessage.FindSubBlockOffsetById(
         ISI_HEADER_SIZE + SIZE_SS_SERVICE_FAILED_RESP,
@@ -580,11 +615,14 @@
         }
     else
         {
-        // Translate error to epoc world, Fix RFState problem
-        epocError = CMmStaticUtility::CSCauseToEpocError(
-            PN_SS,
-            causeType,
-            causeValue );
+        if( errorMappingNeeded )
+            {
+            // Translate error to epoc world, Fix RFState problem
+            epocError = CMmStaticUtility::CSCauseToEpocError(
+                PN_SS,
+                causeType,
+                causeValue );
+            }
         }
 
     if ( iIsSendReleaseCalled )
--- a/adaptationlayer/tsy/simatktsy_dll/inc/satcc.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/inc/satcc.h	Wed Feb 17 13:58:55 2010 +0200
@@ -249,12 +249,16 @@
         /**
         * Creates resource control response for modem SS server
         * @param aTcc internally stored call control structure
+        * @param aSw1 sw1 value inserted to the message
+        * @param aSw2 sw2 value inserted to the message
         * @param aResult call control result from (U)SIM
         * @param aAtkData possible additional response data provided by (U)SIM
         * @return none
         */
         void SendSsResourceControlReq(
             const TCallControl& aTcc,
+            const TUint8 aSw1,
+            const TUint8 aSw2,
             const TUint8 aResult,
             TPtrC8 aAtkData );
 
--- a/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satcc.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -65,6 +65,7 @@
     4;      //CALL_MODEM_SB_CAUSE
 
 const TUint8 KMSBMask = 0x80;
+const TUint8 KSw1Sw2Unknown = 0;
 
 
 // ==================== MEMBER FUNCTIONS ====================================
@@ -417,7 +418,12 @@
             // impossible. Remove the created CcStruct from the CC array and
             // send CC event response.
             TPtrC8 atkData;
-            SendSsResourceControlReq( aCcstruct, KError, atkData );
+            SendSsResourceControlReq( 
+                aCcstruct, 
+                KSw1Sw2Unknown, 
+                KSw1Sw2Unknown, 
+                KError, 
+                atkData );
 
             TInt index( GetArrayIndexById( aCcstruct.iTransId ) );
             if ( index != KErrNotFound )
@@ -588,6 +594,8 @@
                         {
                         SendSsResourceControlReq(
                             ( *iCallControlArray )[ccIndex],
+                            sw1,
+                            sw2,
                             result,
                             apduData );
                         break;
@@ -1452,6 +1460,8 @@
 //
 void CSatCC::SendSsResourceControlReq(
         const TCallControl& aTcc,
+        const TUint8 aSw1,
+        const TUint8 aSw2,
         const TUint8 aResult,
         TPtrC8 aApduData )
     {
@@ -1654,6 +1664,18 @@
             }
         }
 
+    // SS_SB_RESOURCE_CONTROL_INFO [O] with sw1, sw2 and result 
+    TIsiSubBlock resourceCtrlInfo(
+        isiMessage,
+        SS_SB_RESOURCE_CONTROL_INFO,
+        EIsiSubBlockTypeId8Len8 );
+    isiMessage.Append( 3 ); // data size is 3 (sw1 + sw2 + result)
+    isiMessage.Append( aSw1 );
+    isiMessage.Append( aSw2 );
+    isiMessage.Append( ccresult );
+    sbcount++;
+    resourceCtrlInfo.CompleteSubBlock();
+
     TBuf8<1> numOfSubblocks;
     numOfSubblocks.Append( sbcount);
     isiMessage.Insert( 1, numOfSubblocks );
--- a/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satdatadownload.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -211,7 +211,7 @@
     TUint8 causeType( ENone == aTpFailure ?
         SMS_CAUSE_TYPE_COMMON : SMS_CAUSE_TYPE_EXT );
     TUint8 smsCause( ENone == aTpFailure ?
-        SMS_OK : SMS_ERR_PP_RESERVED );
+        SMS_OK : SMS_EXT_ERR_PROTOCOL_ERROR );
 
     TUint16 dataLen( aUserData.Length() );
 
@@ -237,7 +237,8 @@
     msgBuffer.Append( 0 );           // no of sublocks
 
     // Add SMS_SB_DELIVER_REPORT subblock if any failure is there
-    if( ENone != aTpFailure )
+    if( ENone != aTpFailure || 
+        0 < dataLen )
         {
         TFLOGSTRING("TSY:CSatDataDownload::BuildSimMsgReport \
                  Adding SMS_SB_DELIVER_REPORT" );
@@ -253,7 +254,6 @@
         msgBuffer.Append( 0x00 ); // SMS_MTI_DELIVER_REPORT
 
         msgBuffer.Append( aTpFailure ); // GSM-TP Failure cause
-        msgBuffer.AppendFill( KPadding, 2);
         // Increment number of subblock
         msgBuffer[5]++;
         deliverReport.CompleteSubBlock();
--- a/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -45,6 +45,7 @@
 const TUint8 KSmControlAllowed          = 0;
 const TUint8 KSmControlNotAllowed       = 1;
 const TUint8 KSmControlAllowedWithModif = 2;
+const TUint8 KSmsSubmitAddrDataIndex    = 3;
 
 // ==================== MEMBER FUNCTIONS ====================================
 
@@ -565,9 +566,14 @@
 OstTrace0( TRACE_NORMAL, DUP3_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVED, "CSatMoSmsCtrl::SmsResourceIndReceived, Send envelope" );
 
             // The envelope is sent if MO SMS is activated
+            // iAddressSubblock is not sent as it's received
+            // from SMS server because of iAddressSubblock's first
+            // byte is length of the address data and MO SMS Control envelope
+            // is NOT allowed to contain that in address data. So length
+            // field is skipped
             SendMoSmsCtrlEnvelope(
                 iMoSmsCtrlEnvelopeTransactionId,
-                iAddressSubblock,
+                iAddressSubblock.Mid( 1, iAddressSubblock.Length() - 1 ),
                 addressData2
                 );
             }
@@ -886,12 +892,12 @@
         const TDes8& address2
         )
     {
+    TFLOGSTRING("TSY: CSatMoSmsCtrl::FormSmsResourceReqSb");
     // First three mandatory subblocks
     TIsiSubBlock resource( data, SMS_SB_RESOURCE ,
         EIsiSubBlockTypeId16Len16 );    // Message ID and Subblock length
     data.Append( iResourceId >> 8 );      // SMS resource IDs MSB same as received in indication
     data.Append( iResourceId );           // SMS resource IDs LSB
-    data.AppendFill( KPadding, 2 );       // Filler Bytes
     resource.CompleteSubBlock();
 
     // Add Sequence ID subblock
@@ -899,7 +905,6 @@
     TIsiSubBlock resourceSeqId( data, SMS_SB_RESOURCE_SEQ_ID ,
         EIsiSubBlockTypeId16Len16 );
     data.Append( iSequenceId );           // Sequence ID same as received in indication message
-    data.AppendFill( KPadding, 3 );
     resourceSeqId.CompleteSubBlock();
 
     // Add Resource Status subblock
@@ -907,7 +912,6 @@
     TIsiSubBlock resourceStatus( data, SMS_SB_RESOURCE_STATUS ,
         EIsiSubBlockTypeId16Len16 );
     data.Append( status );                // Resource status
-    data.AppendFill( KPadding, 3 );
     resourceStatus.CompleteSubBlock();
 
     if(iIsMoSmsCtrlActivated)
@@ -919,65 +923,50 @@
               data[1]++;
               // Copy address subblocks from Indication message
               // Add Address Subblock
-              TIsiSubBlock address( data, SMS_SB_ADDRESS ,
-              EIsiSubBlockTypeId16Len16 );
+              TIsiSubBlock address( 
+                  data, 
+                  SMS_SB_ADDRESS ,
+                  EIsiSubBlockTypeId16Len16 );
               data.Append( SMS_SMSC_ADDRESS );            // Address type
               data.Append( iAddressSubblock.Length() );     // Address data length
               data.Append( iAddressSubblock );
               // Filler Bytes calculation
-              TUint8 fillbytes = 0;
-              if((6 + iAddressSubblock.Length())%4)
-                  fillbytes = 4 - (( 6 + iAddressSubblock.Length())%4 );
-
-              data.AppendFill( KPadding,fillbytes );
               address.CompleteSubBlock();
 
               // increment subblock
               data[1]++;
               // Add User Data Subblock
-              TIsiSubBlock userData( data, SMS_SB_TPDU ,
+              TIsiSubBlock userData( 
+                  data, 
+                  SMS_SB_TPDU ,
                   EIsiSubBlockTypeId16Len16 );
               data.Append( iUserDataSubblock.Length() );        // data Length
               data.Append( KPadding );        // Filler Byte
               data.Append( iUserDataSubblock ); // Data Bytes
-
-              // Filler Bytes calculation
-              fillbytes = 0;
-              if((6 + iUserDataSubblock.Length())%4)
-                  fillbytes = 4-(( 6 + iUserDataSubblock.Length())%4 );
-
-              data.AppendFill( KPadding,fillbytes );
               userData.CompleteSubBlock();
-
               }
         else
               {
               // when resource is allowed with modification
               // then copy SIM data in address subblock
-              TUint8 fillBytes = 0;
               if ( address1.Length() )
                   {
                   // Add Address subblock
                   data[1]++;          // increase no of subblocks
 
-                  TIsiSubBlock address( data, SMS_SB_ADDRESS ,
+                  TIsiSubBlock address( 
+                      data, 
+                      SMS_SB_ADDRESS ,
                       EIsiSubBlockTypeId16Len16 );
                   data.Append(SMS_SMSC_ADDRESS);            // Address Type
 
-                  // Calculate needed number of filler bytes
-                  while ( ( fillBytes + 6 + address1.Length() ) % 4 )
-                      {
-                      fillBytes++;
-                      }
                   // Data in bytes
                   // First byte is the address length in 3GPP, GSM_0411 format
-                  // "data length in bytes, including TON & NPI"
-                  data.Append( address1.Length() );
-                  // Actual address data
-                  data.Append( address1 );
-                  // Filler bytes
-                  data.AppendFill( KPadding, fillBytes );
-
+                  // "data length in bytes, including TON & NPI".
+                  data.Append( address1.Length() + 1 );
+                  // Actual address data. 
+                  data.Append( address1.Length());
+                  data.Append( address1 ); 
                   address.CompleteSubBlock();
                   }       // end of Service centre Address Subblock
 
@@ -988,19 +977,11 @@
                       data[1]++;
 
                       // For User Data Subblock
-                      TIsiSubBlock userDataSb( data, SMS_SB_TPDU,
+                      TIsiSubBlock userDataSb( 
+                          data, 
+                          SMS_SB_TPDU,
                           EIsiSubBlockTypeId16Len16 );
 
-                      // Calculate needed number of filler bytes
-                      fillBytes = 0;
-                      while ( ( fillBytes + 6 + address2.Length() ) % 4 )
-                          {
-                          fillBytes++;
-                          }
-
-                      data.Append( fillBytes + 6 + address2.Length() );        // Data length
-                      data.Append( KPadding );                  // Filler Byte
-
                       // Check what type of TPDU to be sent
                       switch( iMessageType )
                           {
@@ -1037,47 +1018,54 @@
                                   {
                                   iUserDataSubblock[i+6] = address2[i];
                                   }
-                           break;
-                              }
+                               break;
+                               }
                           case KSmsSubmitType:
                               {
-                               // Data in bytes
-                               // First byte is the address length in 3GPP, GSM_0340 format
-                               // "number of useful semioctets ( = digits ), excluding TON & NPI "
-                               if ( 1 == address2.Length() ||
-                                  ( 1 < address2.Length() &&
-                                  ( KReservedTonNpi1 == address2[0]
-                                  || KReservedTonNpi2 == address2[0] ) )
-                                  )
-                                   {
-                                   // Only Ton&Npi is present
-                                   // or TON6NPI has a reserved value
-                                   iUserDataSubblock[3] = 0x00;
-                                   }
-                               else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) )
-                                       {
-                                       // Odd length destination address
-                                       // Destination address lenght ( in semioctets )
-                                       iUserDataSubblock[2] = ( ( address2.Length() * 2 ) - 1 );
-                                       }
-                                    else
-                                       {
-                                       // Even length destination address
-                                       iUserDataSubblock[2] = ( address2.Length() * 2 );
-                                       }
-                               for(TUint8 i = 0; i<address2.Length(); i++)
-                               {
-                                    iUserDataSubblock[i+3] = address2[i];
-                               }
-                               break;
+                              TUint8 oldAddrLen( ( iUserDataSubblock[ 2 ] + 1 ) / 2 );
+                              // Data in bytes
+                              // First byte is the address length in 3GPP, GSM_0340 format
+                              // "number of useful semioctets ( = digits ), excluding TON & NPI "
+                              if ( 1 == address2.Length() ||
+                                 ( 1 < address2.Length() &&
+                                 ( KReservedTonNpi1 == address2[0]
+                                 || KReservedTonNpi2 == address2[0] ) )
+                                 )
+                                  {
+                                  // Only Ton&Npi is present
+                                  // or TON6NPI has a reserved value
+                                  iUserDataSubblock[3] = 0x00;
+                                  }
+                              else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) )
+                                  {
+                                  // Odd length destination address
+                                  // Destination address lenght ( in semioctets )
+                                  iUserDataSubblock[2] = ( ( ( address2.Length() - 1 ) * 2 ) - 1 );
+                                  }
+                              else
+                                  {
+                                  // Even length destination address
+                                  iUserDataSubblock[2]  = ( ( address2.Length() - 1 ) * 2 );
+                                  }
+
+                              // old addresss needs to be deleted before new one can be inserted
+                              // to the tpdu
+                              iUserDataSubblock.Delete( 
+                                  KSmsSubmitAddrDataIndex, 
+                                  oldAddrLen + 1 );
+                              iUserDataSubblock.Insert( 
+                                  KSmsSubmitAddrDataIndex,
+                                  address2 );
+                              break;
                               }
                           default:
                               {
                               break;
                               }
                           }
-                      data.Append(iUserDataSubblock);
-
+                      data.Append( iUserDataSubblock.Length() );
+                      data.Append( KPadding );           // Filler Byte
+                      data.Append( iUserDataSubblock );
                       userDataSb.CompleteSubBlock();
                       }
               }
@@ -1085,11 +1073,12 @@
             {
             // Add SMS_SB_CAUSE subblock
             data[1]++;           //Increment no of subblocks
-            TIsiSubBlock cause( data, SMS_SB_CAUSE ,
-            EIsiSubBlockTypeId16Len16 );
+            TIsiSubBlock cause( 
+                data, 
+                SMS_SB_CAUSE ,
+                EIsiSubBlockTypeId16Len16 );
             data.Append( SMS_CAUSE_TYPE_COMMON );            // Cause type
             data.Append( SMS_ERR_ROUTE_NOT_ALLOWED );    // Cause
-            data.AppendFill( KPadding, 2 );
             cause.CompleteSubBlock();
             }
         }
--- a/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/adaptationlayer/tsy/simatktsy_dll/src/satnotifications.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -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"
@@ -3778,11 +3778,16 @@
         // Notify NokiaTSY that next SS request is SAT originated
         if ( KErrNone == ret )
             {
-            TFLOGSTRING("TSY: Inform NokiaTSY SS request being SAT originated");
-            OstTrace0( TRACE_NORMAL, DUP1_CSATNOTIFYSENDSS_MESSAGERECEIVED, "Inform NokiaTSY SS request being SAT originated" );
+            TFLOGSTRING("TSY: Inform NokiaTSY SS request being SAT originated, resource control needed");
+            OstTrace0( TRACE_NORMAL, DUP1_CSATNOTIFYSENDSS_MESSAGERECEIVED, "Inform NokiaTSY SS request being SAT originated, resource control needed" );
+
+            TBool resourceControlSuppress( EFalse );
+            CMmDataPackage dataPackage;
+            dataPackage.PackData( &resourceControlSuppress );
+
             iSatMessaging->GetMessageRouter()->ExtFuncL(
                 ESatNotifySendSsPCmd,
-                NULL );
+                &dataPackage );
             }
 #endif
         }
@@ -5762,12 +5767,20 @@
                 OstTrace0( TRACE_NORMAL, DUP3_CSATNOTIFYCALLCONTROLREQUEST_COMPLETENOTIFICATIONL, "CSatNotifyCallControlRequest::CompleteNotificationL SetSendSsDetails" );
                 // Set SS string to struct
                 callControl.SetSendSsDetails( tempSs );
-                // Notify NokiaTSY that next SS request is SAT originated
-                TFLOGSTRING("TSY: Inform NokiaTSY SS request being Call Control originated");
-                OstTrace0( TRACE_NORMAL, DUP4_CSATNOTIFYCALLCONTROLREQUEST_COMPLETENOTIFICATIONL, "Inform NokiaTSY SS request being Call Control originated" );
-                iSatMessaging->GetMessageRouter()->ExtFuncL(
-                    ESatNotifyCallControlRequest,
-                    NULL );
+                if ( ATK_CHANGED == aCcResult )
+                    {
+                    // Notify NokiaTSY that next SS request is SAT originated, because this is changed action made by SAT server
+                    TFLOGSTRING("TSY: Inform NokiaTSY SS request being Call Control originated, no further call control actions needed");
+                    OstTrace0( TRACE_NORMAL, DUP4_CSATNOTIFYCALLCONTROLREQUEST_COMPLETENOTIFICATIONL, "Inform NokiaTSY SS request being Call Control originated, no further call control actions needed" );
+
+                    TBool resourceControlSuppress( ETrue );
+                    CMmDataPackage dataPackage;
+                    dataPackage.PackData( &resourceControlSuppress );
+
+                    iSatMessaging->GetMessageRouter()->ExtFuncL(
+                        ESatNotifySendSsPCmd,
+                        &dataPackage );
+                    }
                 }
             else
                 {
@@ -5938,6 +5951,19 @@
                 SetCallSetUpDetails");
             OstTrace0( TRACE_NORMAL, DUP12_CSATNOTIFYCALLCONTROLREQUEST_COMPLETENOTIFICATIONL, "CSatNotifyCallControlRequest::CompleteNotificationL SetCallSetUpDetails" );
             callControl.SetCallSetUpDetails( tempCallParams );
+            if ( ATK_CHANGED == aCcResult )
+                {
+                // Notify NokiaTSY that next dial request is SAT originated, because this is changed action made by SAT server
+                TFLOGSTRING("TSY: CSatNotifyCallControlRequest::CompleteNotificationL: Notify NTSY next dial request is SAT-originated");
+                OstTrace0( TRACE_NORMAL, DUP16_CSATNOTIFYCALLCONTROLREQUEST_COMPLETENOTIFICATIONL, "CSatNotifyCallControlRequest::CompleteNotificationL: Notify NTSY next dial request is SAT-originated" );
+                TBool resourceControlSuppress( ETrue );
+                CMmDataPackage dataPackage;
+                dataPackage.PackData( &resourceControlSuppress );
+                iSatMessaging->GetMessageRouter()->ExtFuncL(
+                    ESatNotifySetUpCallPCmd,
+                    &dataPackage );
+                }
+            // No else
             }
         // Check if alpha id present
         TPtrC8 sourceString; // Used with conversions
--- a/connectivitylayer/isce/group/bld.inf	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
@@ -16,7 +16,7 @@
 */
 
 
-
+//#define INTERNAL_FLAG_ISI_ROUTER_IN_USE // see nameservice,communicationmanager too
 #include <non_foundation_paths.hrh>
 
 #define NCP_COMMON_RD_ISCE_IN_USE
@@ -43,6 +43,10 @@
 ../isinameservice_dll/inc/nsisi.h                   NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(nsisi.h)
 
 // ISC & ISI
+
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+../isirouter_dll/inc/misiif.h                  NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(misiif.h)
+#endif
 ../isaaccessextension_dll/inc/isakernelapi.h        NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(isakernelapi.h)
 ../isaaccessextension_dll/inc/iscnokiadefinitions.h NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(iscnokiadefinitions.h)
 ../iscapi_dll/inc/iscdefinitions.h                  NON_FOUNDATION_ADAPT_LAYER_EXPORT_PATH(iscdefinitions.h)
@@ -57,15 +61,17 @@
 ../p2prouter_dll/group/p2prouter.mmp
 ../p2papi_dll/group/p2papi.mmp
 // ISC & ISI
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+../isirouter_dll/group/isirouter.mmp
+../isiapi_dll/group/isiapi.mmp
+../isinameservice_dll/group/isinameservice_isirouter.mmp
+../isicommunicationmanager_dll/group/isicommunicationmanager_isirouter.mmp
+#endif
 ../isaaccessextension_dll/group/isaaccessextension.mmp
 ../isaaccessldd_ldd/group/isaaccessesldd.mmp
 ../iscapi_dll/group/isauserapi.mmp
-// NameService
 ../isinameservice_dll/group/isinameservice.mmp
-// CommunicationManager
 ../isicommunicationmanager_dll/group/isicommunicationmanager.mmp
-
-#else
 // No actions
 #endif // NCP_COMMON_RD_ISCE_IN_USE
 
--- a/connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/group/isaaccessextension.mmp	Wed Feb 17 13:58:55 2010 +0200
@@ -42,7 +42,6 @@
 SOURCEPATH      ../src
 SOURCE          isakernelapi.cpp
 SOURCE          iadtrace.cpp
-SOURCE          indicationhandler.cpp
 SOURCE          isaaccessextension.cpp
 SOURCE          isakernelchannel.cpp
 SOURCE          queue.cpp
@@ -61,8 +60,11 @@
 USERINCLUDE     ../../ismpmultiplexer_dll/inc
 // ISCE
 USERINCLUDE     ../../memmanager_dll/inc
+USERINCLUDE     ../../isicommunicationmanager_dll/inc
 // ISCE
-
+// ISI
+USERINCLUDE    ../../isirouter_dll/inc
+//ISI
 USERINCLUDE     ../traces
 
 OS_LAYER_SYSTEMINCLUDE
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/internalapi.h	Wed Feb 17 13:58:55 2010 +0200
@@ -42,8 +42,8 @@
 
 #include "iadinternaldefinitions.h"    // For TIADConnectionStatus
 //#include "mist2iadapi.h"  // For TIADConnectionStatus // 
-#include "misiobjectrouterif.h"
-#include "misirouterobjectif.h"
+#include "../../isirouter_dll/inc/misiobjectrouterif.h"
+#include "../../isirouter_dll/inc/misirouterobjectif.h"
 
 // abstract interface for both channels user & kernel 
 // called by extension, provided by extension
--- a/connectivitylayer/isce/isaaccessextension_dll/inc/router.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/inc/router.h	Wed Feb 17 13:58:55 2010 +0200
@@ -34,7 +34,6 @@
 #endif
 //ISCE class MIAD2ISTApi;
 class DRouter;
-class DIndicationHandler;
 class MIAD2ChannelApi;
 class DQueue;
 
@@ -168,7 +167,14 @@
         static DRouter* iThisPtr;
         MISIRouterObjectIf* iNameService;
         MISIRouterObjectIf* iCommunicationManager;
+        /*
+        * See comments from MISIChannelRouterIf
+        */
+        TDfcQue* GetDfcThread( const TISIDfcQThreadType aType );
 
+        void FreeDfcThread( TDfcQue* aThread );
+
+   
     private:
         static void CommonRxDfc( TAny* aPtr );
 
@@ -220,7 +226,6 @@
 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
         DPipeHandler*                                   iPipeHandler;
 #endif
-        DIndicationHandler*                             iIndicationHandler;
         DQueue*                                         iCommonRxQueue;
         TIADChannel                                     iChannelTable[ EIADSizeOfChannels ];
         //static TDfc*                                    iConnStatusBcDfc;
--- a/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isaaccessextension_dll/src/router.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -23,7 +23,6 @@
 #include "router.h"
 #include "iadtrace.h"                   // For C_TRACE..
 #include "isaaccessextension.h"         // For DIsaAccessExtension
-#include "indicationhandler.h"          // For DIndicationHandler
 #include "queue.h"                      // For DQueue
 #include "iadinternaldefinitions.h"     // For EIADAsync...
 #include "iadhelpers.h"                 // For GET_RECEIVER
@@ -41,6 +40,7 @@
 // ISCE
 #include "memapi.h"                     // For MemApi
 #include "trxdefs.h"                    // For ETrx...
+#include "ape_commgrisi.h"              // For APE_COMMGR...
 // ISCE
 
 // CONSTS
@@ -48,6 +48,17 @@
 const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
 const TUint32 KNameServiceUID( 0x2002A5A1 );
 
+const TUint8 K8BitResourceId( 2 );
+const TUint8 K32BitResourceId( 5 );
+const TUint8 K32BitResourceOffsetByte1( 0 );
+const TUint8 K32BitResourceOffsetByte2( 1 );
+const TUint8 K32BitResourceOffsetByte3( 2 );
+const TUint8 K32BitResourceOffsetByte4( 3 );
+const TUint8 K8BitResourceOffset( 0 );
+const TUint8 KEventOffset32Bit( 4 );
+const TUint8 KEventOffset8Bit( 1 );
+const TUint8 KFiller( 0 );
+const TUint8 KNoResource( 0 );
 // TODO: change this to use UnuqueID instead and to extension..
 void DRouter::CheckDfc()
 {
@@ -90,9 +101,7 @@
 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
     iPipeHandler = new DPipeHandler( *this );
 #endif
-    iIndicationHandler = new DIndicationHandler( *this );
     iCommonRxQueue = new DQueue( KIADExtensionRxQueueSize );
-    ASSERT_RESET_ALWAYS( /*iPipeHandler &&*/ iIndicationHandler && iCommonRxQueue, EIADMemoryAllocationFailure | EIADFaultIdentifier17 << KFaultIdentifierShift );
     // Initialize channels to NULL when channel is opened !NULL.
     for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
         {
@@ -156,11 +165,6 @@
         iPipeHandler = NULL;
         }
 #endif
-    if( iIndicationHandler )
-        {
-        delete iIndicationHandler;
-        iIndicationHandler = NULL;
-        }
     if( iCommonRxQueue )
         {
         delete iCommonRxQueue;
@@ -523,12 +527,72 @@
     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
     if( KErrNone == msgOk )
         {
-        msgOk = iIndicationHandler->Subscribe( anOrder, aCh, a32Bit );
-        TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
+        TInt numOfOrders( 0 );
+        if( a32Bit == EFalse )
+            {
+            if( anOrder.Ptr()[ K8BitResourceOffset ] == KNoResource ) //Subscription remove
+                {
+                numOfOrders = 0x00;
+                }
+            else{
+                numOfOrders = ( anOrder.Length() / K8BitResourceId );
+                }
+            }
+        else
+            {
+            if( anOrder.Ptr()[ K32BitResourceOffsetByte4 ] == KNoResource ) //Subscription remove
+                {
+                numOfOrders = 0x00;
+                }
+            else{
+                numOfOrders = ( anOrder.Length() / K32BitResourceId );
+                }
+            }
+        TUint16 msgLength = ( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ + ( SIZE_APE_COMMGR_SUBSCRIBE_SB * numOfOrders ) );
+        TDes8& desPtr = MemApi::AllocBlock( msgLength );
+        desPtr.SetLength( msgLength );
+        TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
+        ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+        SET_RECEIVER_DEV( ptr, PN_DEV_OWN );
+        SET_SENDER_DEV( ptr, PN_DEV_OWN );
+        ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
+        SET_LENGTH( ptr, ( desPtr.Length() - PN_HEADER_SIZE ) );
+        SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
+        SET_SENDER_OBJ( ptr, aCh );
+        ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_TRANSID ] = 0x00;
+        ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_REQ;
+        ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_FILLERBYTE1 ] = numOfOrders;
+        ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_SUBBLOCKCOUNT ] = 0x00;
+        TInt orderIndex( 0 );
+        //TODO automatically generated ape_commgrisi.h is totally wrong and not according to the specification
+        for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKID ); subBlockOffset < msgLength; subBlockOffset += SIZE_APE_COMMGR_SUBSCRIBE_SB )
+            {
+            ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKID ] = APE_COMMGR_SUBSCRIBE_SB;
+            ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKLENGTH ] = SIZE_APE_COMMGR_SUBSCRIBE_SB;
+            ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ] = PN_DEV_HOST;
+            if( a32Bit == EFalse )
+                {
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ]  = ( anOrder.Ptr()[ orderIndex + KEventOffset8Bit ] );
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] = KFiller;
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE2 ] = KFiller;
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE3 ] = KFiller;
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_MESSAGEID ]   = ( anOrder.Ptr()[ orderIndex + K8BitResourceOffset ] );
+                }
+            else
+                {
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ]  = ( anOrder.Ptr()[ orderIndex + KEventOffset32Bit ] );
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte1 ] );
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE2 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte2 ] );
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE3 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte3 ]) ;
+                ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_MESSAGEID ]   = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte4 ] );
+                }
+            orderIndex = ( a32Bit == EFalse ) ? orderIndex + K8BitResourceId : orderIndex + K32BitResourceId;
+            }
+        iCommunicationManager->Receive( desPtr );
         }
-    C_TRACE( ( _T( "DRouter::OrderIndication 0x%x 0x%x %d %d <-" ), &anOrder, aCh, a32Bit, msgOk ) );
-    
-    OstTrace1( TRACE_NORMAL, DROUTER_ORDERINDICATION, "<DRouter::OrderIndication;msgOk=%x", msgOk );    
+    TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );    
+    C_TRACE( ( _T( "DRouter::OrderIndication order:0x%x channel:0x%x  32bit:%d msgok:%d <-" ), &anOrder, aCh, a32Bit, msgOk ) );
+    OstTrace1( TRACE_NORMAL, DROUTER_ORDERINDICATION, "<DRouter::OrderIndication;msgOk=%x", msgOk );
     return msgOk;
     }
 
@@ -570,22 +634,6 @@
             }
         else
             {
-            // Route indication to possible subscribers in this device
-            if( GET_RECEIVER_OBJ( msgBlockPtr ) == PN_OBJ_EVENT_MULTICAST &&
-                IS_DEV_HOST( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] ) )
-                {
-                DATA_DUMP_TRACE( aMessage, ETrue );
-                OstTraceData( TRACE_ISIMSG, DROUTER_SENDMESSAGE_DATA, "DRouter::SendMsg indication TX: %hx", aMessage.Ptr(), aMessage.Length() );
-                C_TRACE( ( _T( "DRouter::SendMessage routing indication to device PN_DEV_SOS 0x%x" ), &aMessage ) );
-                OstTrace0( TRACE_NORMAL, DUP2_DROUTER_SENDMESSAGE, "DRouter::SendMessage indication to PN_DEV_SOS" );
-                TDes8& tmpIndication = AllocateBlock( aMessage.Length() );
-                tmpIndication.SetLength( aMessage.Length() );
-                tmpIndication.Copy( aMessage );
-                TUint8* indicationPtr = const_cast<TUint8*>( tmpIndication.Ptr() );
-                SET_RECEIVER_DEV( indicationPtr, THIS_DEVICE );
-                SET_RECEIVER_OBJ( indicationPtr, KIADEventSubscriptionObjId );
-                this->MessageReceived( tmpIndication );
-                }
             // To communicationmanager
             if( ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_EVENT_MULTICAST  )
                && ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
@@ -634,8 +682,20 @@
     OstTraceExt2( TRACE_NORMAL, DROUTER_SENDINDICATION_ENTRY, ">DRouter::SendIndication;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x ->" ), &aMessage, aCh ) );
     TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
-    SET_RECEIVER_DEV( msgPtr,OTHER_DEVICE_1 );
     SET_RECEIVER_OBJ( msgPtr,PN_OBJ_EVENT_MULTICAST );
+    if( GET_RECEIVER_DEV( aMessage ) != PN_DEV_OWN )
+        {
+        SET_RECEIVER_DEV( msgPtr, OTHER_DEVICE_1 );
+        // Copy for receivers in this device -> fake event from modem
+        TDes8& tmpIndication = MemApi::AllocBlock( aMessage.Length() );
+        tmpIndication.SetLength( aMessage.Length() );
+        tmpIndication.Copy( aMessage );
+        TUint8* indicationPtr = const_cast<TUint8*>( tmpIndication.Ptr() );
+        SET_SENDER_DEV( indicationPtr, PN_DEV_HOST );
+        SET_RECEIVER_DEV( indicationPtr, PN_DEV_OWN );
+        indicationPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
+        this->MessageReceived( tmpIndication );
+        }
     TInt error( SendMessage( aMessage, aCh ) );
     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x %d <-" ), &aMessage, aCh, error ) );
     OstTrace1( TRACE_NORMAL, DROUTER_SENDINDICATION_EXIT, "<DRouter::SendIndication;error=%d", error );
@@ -716,7 +776,7 @@
     C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x ->" ), &aMsg ) );
     TUint8* msg = const_cast<TUint8*>( aMsg.Ptr() );
     // Message from MODEM to APE, or from APE to APE. If Media SOS -> come through link. If dev OWN -> from APE nameservice
-    if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
+    if( ( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS ) || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
         {
         const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
         C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
@@ -737,8 +797,16 @@
             {
             if( iChannelTable[ rcvObjId ].iChannel )
                 {
-                iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
-                // DeAllocation done by the channel after writing to client's address space.
+                if( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_APE_COMMGR )
+                    {
+                    C_TRACE( ( _T( "DRouter::HandleIsiMessage to channel from COMMUNICATIONMANAGER deallocate" ) ) );
+                    DeAllocateBlock( aMsg );
+                    }
+                else
+                    {
+                    iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
+                    // DeAllocation done by the channel after writing to client's address space.
+                    }
                 }
             else
                 {
@@ -882,7 +950,7 @@
     // Message to symbian side (media sos).
     if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS )
         {
-        if( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == THIS_DEVICE )
+        if( ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == THIS_DEVICE ) || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
             {
             switch( msg[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] )
                 {
@@ -978,7 +1046,6 @@
             }
         case EIndicationMsg:
             {
-            aTmp.iIndicationHandler->Multicast( aMsg );
             // De-allocate, message is multicasted to subsribers as new
             // message and the original is ready to be deallocated.
             aTmp.DeAllocateBlock( aMsg );
@@ -1077,10 +1144,9 @@
     // Filler
     tempPtr.Append( 0x00 );
 
-//    ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier2 << KFaultIdentifierShift );
     if( msgTmpPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN )
         {
-        MessageReceived( *reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) ) );
+        MessageReceived( tempPtr );
         }
     else
         {
@@ -1318,7 +1384,8 @@
 //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 ) );
+    C_TRACE( ( _T( "MISIObjectRouterIf::Connect  %d 0x%x 0x%x>" ), aUID, aObjId, aCallback ) );
+    Kern::Printf( "IADRouter::Connect" );
     //Connect( aUID, aObjId, aCallback );
     if( aUID == KNameServiceUID )
         {
@@ -1344,6 +1411,7 @@
 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
@@ -1357,5 +1425,22 @@
   	return KErrNone;
     }
 
+TDfcQue* DRouter::GetDfcThread(
+        const TISIDfcQThreadType // aType
+        )
+    {
+    C_TRACE( ( _T( "DRouter::GetDfcThread<>" ) ) );  
+    Kern::Printf( "IADRouter::GetDfcThread" );
+    return DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue );
+    //ASSERT_RESET_ALWAYS( 0, -1003 );
+    //return NULL;
+    }
+
+void DRouter::FreeDfcThread( TDfcQue* aThread )
+    {
+    C_TRACE( ( _T( "DRouter::FreeDfcThread 0x%x>" ), aThread ) );
+    Kern::Printf( "IADRouter::FreeDfcThread" );
+    ASSERT_RESET_ALWAYS( 0, -1002 );
+    }
 // End of file.
 
--- a/connectivitylayer/isce/isicommunicationmanager_dll/group/isicommunicationmanager.mmp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/group/isicommunicationmanager.mmp	Wed Feb 17 13:58:55 2010 +0200
@@ -19,7 +19,6 @@
 #include        <platform_paths.hrh>
 #include        "kernel/kern_ext.mmh"
 
-
 TARGET          isicommunicationmanager.dll
 TARGETTYPE      kext
 linkas          isicommunicationmanager.dll
@@ -38,6 +37,7 @@
 
 
 USERINCLUDE     ../inc
+USERINCLUDE     ../../isirouter_dll/inc
 USERINCLUDE     ../../isaaccessextension_dll/inc
 USERINCLUDE     ../../memmanager_dll/inc
 USERINCLUDE     ../../isinameservice_dll/inc
--- a/connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanager.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/isicommunicationmanager.h	Wed Feb 17 13:58:55 2010 +0200
@@ -47,9 +47,15 @@
         */
         void Receive( const TDesC8& aMessage );
 
+    private:
+
         void SendNameAddReqs();
         
-        void SendPNSSubscribeResp( const TDesC8& aMessage );
+        void SendPnsSubscribeResp( const TDesC8& aMessage );
+        
+        void SendCommServiceNotIdentifiedResp( const TDesC8& aMessage );
+        
+        void SendCommIsiVersionGetResp( const TDesC8& aMessage );
         
     private:
 
@@ -62,6 +68,7 @@
         TUint8                 iObjId;
         // Not owned
         MISIObjectRouterIf*    iRouter;
+        TUint8                 iBootMsgCount;
         
     };
 
--- a/connectivitylayer/isce/isicommunicationmanager_dll/inc/isiindicationhandler.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/inc/isiindicationhandler.h	Wed Feb 17 13:58:55 2010 +0200
@@ -28,7 +28,7 @@
 NONSHARABLE_CLASS( DISIIndicationHandler ) : public DBase
     {
 
-    public:
+    private:
 
         class TDeviceIdLink
             {
@@ -60,7 +60,9 @@
                 TUint8      iObjId;
                 SDblQueLink iSubscriberLink;
             };
-
+    
+    public:
+    
         /*
         * Constructor
         */
@@ -75,13 +77,15 @@
         * Multicast and Subscribe must be called in same DFC thread.
         * If not then take a deep look at synchronization.
         */
-        //void Multicast( TDes8& aIndication );
+        void Multicast( TDes8& aIndication );
 
         /*
         * Multicast and Subscribe must be called in same DFC thread.
         * If not then take a deep look at synchronization.
         */
-        TInt Subscribe( TDes8& aSubscriptionReq );
+        void Subscribe( TDes8& aSubscriptionReq );
+
+
 
     private:
 
@@ -91,8 +95,12 @@
 
         void AddServer( TDeviceIdLink& aDeviceLink, const TUint32 aResourceId, const TUint8 aIndication, const TUint16 aObjId );
 
+        void AddServer( TDeviceIdLink& aDeviceLink, const TUint32 aResourceId );
+
         TDeviceIdLink* GetDeviceLink( const TUint8 aDeviceId );
 
+        TDeviceIdLink* GetExternalDeviceLink( const TUint8 aDeviceId );
+
         TServerIdLink* GetServerLink( TDeviceIdLink& aDeviceLink, const TUint32 aResourceId );
 
         TIndicationLink* GetIndicationLink( TServerIdLink& aServerLink, const TUint8 aIndication );
@@ -103,12 +111,13 @@
 
         void RemoveSubscription( const TUint16 aObjId );
 
-        TInt SendSubscription( TDeviceIdLink& aDevice );
+        void SendSubscription( TDeviceIdLink& aDevice );
 
     private:
 
         // Owned
         SDblQue         iDeviceQ;
+        SDblQue         iExternalDeviceQ;
         // Not owned
         MISIObjectRouterIf* iRouter;
 
--- a/connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/src/isicommunicationmanager.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -17,19 +17,27 @@
 
 
 #include <kernel.h>                       // For Kern
-#include "isicommunicationmanager.h"      // For DISINameService
+#include "isicommunicationmanager.h"      // For DISICommunicationManager
 #include "misiobjectrouterif.h"           // For MISIObjectRouterIf
 #include "isicommunicationmanagertrace.h" // For C_TRACE, ASSERT_RESET.. and fault codes
 #include "memapi.h"                       // For MemApi
 #include <phonetisi.h>                    // For ISI_HEADER_SIZE
 #include <pn_const.h>                     // For PN_OBJ_ROUTING_REQ...
 #include "nsisi.h"                        // For PN_NAMESERVICE
-#include "misiobjectrouterif.h"           // For MISIObjectRouterIf
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+#include "isihelpers.h"                   // For SET_RECEIVER_OBJ...
+#include "isirouter.h"                    // For GetDFCThread
+#else
+//#include "misiobjectrouterif.h"           // For MISIObjectRouterIf
+#include "isaaccessextension.h"           // For DIsaAccessExtension
+
 #include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
+#endif
 #include <iscnokiadefinitions.h>          // For THIS_DEVICE
-#include "isaaccessextension.h"           // For DIsaAccessExtension
 #include "isiindicationhandler.h"         // For DISIIndicationHandler
 #include "ape_commgrisi.h"                // For APE_COMMGR..
+#include "misicommunicationmanagerif.h"   // For MISICommunicationManagerIf
+#include <commisi.h>                      // For Common messages
 
 
 // Faults
@@ -41,6 +49,7 @@
     EISICommunicationManagerUnknownMessage,
     EISICommunicationManagerMutexCreateFailed,
     EISICommunicationManagerMutexWaitFailed,
+    EISICommunicationManagerWrongMessageOrder,
     };
 
 
@@ -103,12 +112,13 @@
 const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
 const TUint8 KFiller( 0 );
 const TInt KInitDfcPriority( 7 );
-
+const TUint8 KDone( 0 );
 
 DISICommunicationManager::DISICommunicationManager(
         // None
         )
-    : iObjId( 0x00 )
+    : iObjId( 0x00 ),
+      iBootMsgCount( 0x04 ) // 2xRESP, 2xIND
     {
     C_TRACE( ( _T( "DISICommunicationManager::DISICommunicationManager 0x%x 0x%x>" ), iObjId, iRouter ) );
     iRouter = MISIObjectRouterIf::Connect( KCommunicationManagerUID, iObjId, this );
@@ -116,7 +126,11 @@
     // Must be > KMutexOrdGeneral1 for nesting purposes because trx shared memory uses KMutexOrdGeneral1
     TInt err( Kern::MutexCreate( iCommunicationManagerMutex, KCommunicationManagerMutex, KMutexOrdGeneral2 ) );
     ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexCreateFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE    
+    iInitDfc = new TDfc( InitDfc, this, iRouter->GetDfcThread( MISIObjectRouterIf::EISIKernelMainThread ), KInitDfcPriority );
+#else
     iInitDfc = new TDfc( InitDfc, this, DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue ), KInitDfcPriority );
+#endif    
     ASSERT_RESET_ALWAYS( iInitDfc, ( EISICommunicationManagerMemAllocFailure | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
     iISIIndicationHandler = new DISIIndicationHandler( iRouter );
     ASSERT_RESET_ALWAYS( iISIIndicationHandler, ( EISICommunicationManagerMemAllocFailure1 | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
@@ -164,6 +178,7 @@
     addMsg2.Copy( addMsg );
     TUint8* addPtr2 = const_cast<TUint8*>( addMsg2.Ptr() );
     PUTB32( &addPtr2[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_NAME ], PN_APE_COMMGR );
+    //Register PN_APE_COMMGR and PN_COMMGR
     iRouter->Send( addMsg, PN_OBJ_EVENT_MULTICAST );
     iRouter->Send( addMsg2, PN_OBJ_EVENT_MULTICAST );
     C_TRACE( ( _T( "DISICommunicationManager::SendNameAddReqs<" ) ) );    
@@ -183,6 +198,10 @@
     iInitDfc->Cancel();
     delete iInitDfc;
     iInitDfc = NULL;
+    if( iCommunicationManagerMutex )
+        {
+        ((DObject*)iCommunicationManagerMutex)->Close( NULL );
+        }
     iCommunicationManagerMutex = NULL;
     C_TRACE( ( _T( "DISICommunicationManager::~DISICommunicationManager<" ) ) );
     }
@@ -193,64 +212,94 @@
     C_TRACE( ( _T( "DISICommunicationManager::Receive 0x%x>" ), &aMessage ) );
     TInt err( Kern::MutexWait( *iCommunicationManagerMutex ) );
     ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISICommunicationManagerMutexWaitFailed | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
-    //TODO check nameadd resps for own nameadd success
-    for( TInt i( 0 ); i < aMessage.Length(); i++ )
-        {
-        C_TRACE( ( _T( "index[ %d ] data 0x%x"), i, aMessage.Ptr()[i] ) );
-        }
-    
     const TUint8* msgPtr( aMessage.Ptr() );
     TDes8* blockPtr = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMessage) );
-    
-    switch( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] )
+    if( iBootMsgCount == KDone )
         {
-        case PN_COMMGR:
+        if( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE )
             {
-            C_TRACE( ( _T( "DISICommunicationManager message to PN_COMMGR" ) ) );
-            break;
+            switch( msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] )
+                {
+                case COMM_ISA_ENTITY_NOT_REACHABLE_RESP:
+                    {
+                    C_TRACE( ( _T( "DISICommunicationManager::Received not reachable resp" ) ) );
+                    break;
+                    }
+                case COMM_ISI_VERSION_GET_REQ:
+                    {
+                    C_TRACE( ( _T( "DISICommunicationManager::Received version get req" ) ) );
+                    SendCommIsiVersionGetResp( *blockPtr );
+                    break;
+                    }
+                default:
+                    {
+                    C_TRACE( ( _T( "DISICommunicationManager::Received unknown common message" ) ) );
+                    SendCommServiceNotIdentifiedResp( *blockPtr );
+                    break;
+                    }
+                }
             }
-        case PN_APE_COMMGR: //PN_APE_COMMGR
+        else if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_APE_COMMGR )
+            || ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_COMMGR ) )
             {
-            if( msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == APE_COMMGR_SUBSCRIBE_REQ )
+            C_TRACE( ( _T( "DISICommunicationManager::Receive subscription" ) ) );
+            SendPnsSubscribeResp( *blockPtr );
+            if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
                 {
-                SendPNSSubscribeResp( *blockPtr );
-                if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
-                    {
-           	        C_TRACE( ( _T( "DISICommunicationManager PNS_SUBSCRIBE_REQ from APE" ) ) );
-                    iISIIndicationHandler->Subscribe( *blockPtr );
-                    }
+       	        C_TRACE( ( _T( "DISICommunicationManager PNS_SUBSCRIBE_REQ from APE" ) ) );
+                iISIIndicationHandler->Subscribe( *blockPtr );
+                }
+            }
+        else
+            {
+            if( ( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] != PN_DEV_OWN )
+                || ( MISICommunicationManagerIf::IsValidResource( *blockPtr ) ) )
+                {
+                C_TRACE( ( _T( "DISICommunicationManager::Receive indication" ) ) );
+                iISIIndicationHandler->Multicast( *blockPtr );
                 }
             else
                 {
-          	    C_TRACE( ( _T( "DISICommunicationManager unknown PN_APE_COMMGR message" ) ) );
+                C_TRACE( ( _T( "DISICommunicationManager not allowed resource from APE" ) ) );
                 }
-            break;
             }
-       default:
-           {
-           C_TRACE( ( _T( "DISICommunicationManager unknown message to communication manager" ) ) );
-           break;	
-           }
+        }
+    else
+        {
+        C_TRACE( ( _T( "DISICommunicationManager not indication %d" ), iBootMsgCount ) );
+        // From PN_NAMESERVICE && ( IND || successfull RESP )
+        if( ( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_NAMESERVICE )
+            && ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_IND
+            || ( msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_SUBFUNCTION ]== PNS_NAME_ADD_RESP 
+            && msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] == PN_NAME_OK ) ) )
+            {
+            C_TRACE( ( _T( "DISICommunicationManager::Receive from NAMESERVICE message id 0x%x" ), msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_SUBFUNCTION ]  ) );
+            iBootMsgCount--;
+            }
+        else
+            {
+            ASSERT_RESET_ALWAYS( 0, ( EISICommunicationManagerWrongMessageOrder | EDISICommunicationManagerTraceId << KClassIdentifierShift ) );
+            }
         }
     MemApi::DeallocBlock( *blockPtr );
     Kern::MutexSignal( *iCommunicationManagerMutex );
     C_TRACE( ( _T( "DISICommunicationManager::Receive<" ) ) );
     }
 
-void DISICommunicationManager::SendPNSSubscribeResp( const TDesC8& aMessage )
+void DISICommunicationManager::SendPnsSubscribeResp( const TDesC8& aMessage )
     {
-    C_TRACE( ( _T( "DISICommunicationManager::SendPNSSubscribeResp 0x%x>" ), &aMessage ) );
+    C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp 0x%x>" ), &aMessage ) );
     TUint16 msgLength( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_RESP );
     TDes8& respMsg = MemApi::AllocBlock( msgLength );
     respMsg.SetLength( msgLength );
     TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
     TUint8* respPtr = const_cast<TUint8*>( respMsg.Ptr() );
     respPtr[ ISI_HEADER_OFFSET_MEDIA ] = msgPtr[ ISI_HEADER_OFFSET_MEDIA ];
-    SET_RECEIVER_DEV( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] );
+    SET_RECEIVER_DEV( respPtr, GET_SENDER_DEV( aMessage ) );
     SET_SENDER_DEV( respPtr, PN_DEV_OWN );
     respPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
     SET_LENGTH( respPtr, ( msgLength - PN_HEADER_SIZE ) );
-    SET_RECEIVER_OBJ( respPtr, msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+    SET_RECEIVER_OBJ( respPtr, GET_SENDER_OBJ( aMessage ) );
     SET_SENDER_OBJ( respPtr, PN_OBJ_ROUTER );
     respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_TRANSID ] = msgPtr[ ISI_HEADER_OFFSET_TRANSID ];
     respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_RESP;
@@ -261,16 +310,59 @@
     else
         {
         respPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_RESP_OFFSET_RESULT ] = APE_COMMGR_NOT_ALLOWED;	
-        }
-      
-    
-    for( TInt i( 0 ); i < respMsg.Length(); i++ )
-        {
-        C_TRACE( ( _T( "indeksi[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
-        }
-    
+        }    
+    iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST );
+	  C_TRACE( ( _T( "DISICommunicationManager::SendPnsSubscribeResp<" ) ) );
+    }
+
+
+void DISICommunicationManager::SendCommServiceNotIdentifiedResp( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp 0x%x>" ), &aMessage ) );
+    TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP );
+    TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) );
+    const TUint8* msgPtr( aMessage.Ptr() );
+    ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+    SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) );
+    SET_SENDER_DEV( ptr, PN_DEV_OWN );
+    ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
+    SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) );
+    SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_TRANSACTIONID ] = 0x00;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_SUBMESSAGEID ] = COMM_SERVICE_NOT_IDENTIFIED_RESP;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_MESSAGEID ];
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE1 ] = KFiller;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_NOTSERVEDSUBMESSAGEID ] = msgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ];
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE2 ] = KFiller;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_SERVICE_NOT_IDENTIFIED_RESP_OFFSET_FILLERBYTE3 ] = KFiller;
     iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST );
-	  C_TRACE( ( _T( "DISICommunicationManager::SendPNSSubscribeResp<" ) ) );
+    C_TRACE( ( _T( "DISICommunicationManager::SendCommServiceNotIdentifiedResp<" ) ) );
+    }
+
+
+void DISICommunicationManager::SendCommIsiVersionGetResp( const TDesC8& aMessage )
+    {
+    C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp 0x%x>" ), &aMessage ) );
+    TDes8& respMsg = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP );
+    TUint8* ptr( const_cast<TUint8*>( respMsg.Ptr() ) );
+    const TUint8* msgPtr( aMessage.Ptr() );
+    ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
+    SET_RECEIVER_DEV( ptr, GET_SENDER_DEV( aMessage ) );
+    SET_SENDER_DEV( ptr, PN_DEV_OWN );
+    ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
+    SET_RECEIVER_OBJ( ptr, GET_SENDER_OBJ( aMessage ) );
+    SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_TRANSACTIONID ] = 0x00;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_MESSAGEID ] = COMMON_MESSAGE;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_SUBMESSAGEID ] = COMM_ISI_VERSION_GET_RESP;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONZZZ ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Z;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_ISIVERSIONYYY ] = APE_COMMUNICATION_MANAGER_SERVER_ISI_VERSION_Y;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE1 ] = KFiller;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE2 ] = KFiller;
+    ptr[ ISI_HEADER_SIZE + COMMON_MESSAGE_COMM_ISI_VERSION_GET_RESP_OFFSET_FILLERBYTE3 ] = KFiller;
+    iRouter->Send( respMsg, PN_OBJ_EVENT_MULTICAST );
+    C_TRACE( ( _T( "DISICommunicationManager::SendCommIsiVersionGetResp<" ) ) );
     }
 
 
--- a/connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -15,7 +15,6 @@
 *
 */
 
-#include <iscnokiadefinitions.h>
 #include <pn_eventmodem_extisi.h>         // PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_...
 #include <phonetisi.h>                    // For ISI_HEADER_SIZE
 #include <pn_const.h>                     // For PN_HEADER_SIZE
@@ -23,10 +22,14 @@
 #include "isicommunicationmanagertrace.h" // For C_TRACE..
 #include "misiobjectrouterif.h"           // For DISICommunicationManager
 #include "memapi.h"                       // For MemApi
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+#include "isihelpers.h"                   // For SET_RECEIVER_OBJ...
+#else
 #include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
+#endif
 #include "nsisi.h"                        // For PN_MEDIA_ROUTING_REQ
 #include "ape_commgrisi.h"                // For APE_COMMGR..
-
+#include <iscnokiadefinitions.h>
 
 /* PUTB8 macro writes byte value to given address.
  * This macro is used mainly by other PUTBXX macros.
@@ -73,6 +76,10 @@
 #define GETB32(p) \
     (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
 
+const TUint8 KMaxAmountOfResources( 255 );
+const TUint8 KPnsSubscribedResourcesExtendLength( 12 );
+const TUint8 KResourceArraySize( 4 );
+
 // Faults
 enum TISIIndincationHandlerFaults
     {
@@ -81,6 +88,32 @@
     EISIIndicationHandlerMemAllocFailure1,
     EISIIndicationHandlerMemAllocFailure2,
     EISIIndicationHandlerMemAllocFailure3,
+    EISIIndicationHandlerMemAllocFailure4,
+    EISIIndicationHandlerMemAllocFailure5,
+    EISIIndicationHandlerQueNULLPointer,
+    EISIIndicationHandlerQueNULLPointer1,
+    EISIIndicationHandlerQueNULLPointer2,
+    EISIIndicationHandlerQueNULLPointer3,
+    EISIIndicationHandlerQueNULLPointer4,
+    EISIIndicationHandlerQueNULLPointer5,
+    EISIIndicationHandlerQueNULLPointer6,
+    EISIIndicationHandlerQueNULLPointer7,
+    EISIIndicationHandlerQueNULLPointer8,
+    EISIIndicationHandlerQueNULLPointer9,
+    EISIIndicationHandlerQueNULLPointer10,
+    EISIIndicationHandlerQueNULLPointer11,
+    EISIIndicationHandlerQueNULLPointer12,
+    EISIIndicationHandlerQueNULLPointer13,
+    EISIIndicationHandlerQueNULLPointer14,
+    EISIIndicationHandlerQueNULLPointer15,
+    EISIIndicationHandlerQueNULLPointer16,
+    EISIIndicationHandlerQueNULLPointer17,
+    EISIIndicationHandlerQueNULLPointer18,
+    EISIIndicationHandlerQueNULLPointer19,
+    EISIIndicationHandlerQueNULLPointer20,
+    EISIIndicationHandlerQueNULLPointer21,
+    EISIIndicationHandlerQueNULLPointer22,
+    EISIIndicationHandlerQueNULLPointer23
     };
 
 
@@ -127,17 +160,20 @@
     while( deviceAnchor != next )
         {
         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer1 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler device: 0x%x"), deviceLink->iDeviceId ) );
         serverAnchor = &deviceLink->iServerQ.iA;
         serverNext = serverAnchor->iNext;
         while( serverAnchor != serverNext )
             {
             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer2 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
             indicationAnchor = &serverLink->iIndicationQ.iA;
             indicationNext = indicationAnchor->iNext;
             while( indicationAnchor != indicationNext )
                 {
                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer3 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                 C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler indication: 0x%x"), indicationLink->iIndication ));
                 // get next link already in case if particular link is to be deleted
                 indicationNext = indicationNext->iNext;
@@ -146,6 +182,7 @@
                 while( subscriberAnchor != subscriberNext )
                     {
                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                    ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer4 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                     C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler subscriber: 0x%x"), subscriberLink->iObjId ));
                     TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
                     subscriberLink->iSubscriberLink.Deque();
@@ -195,62 +232,106 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt DISIIndicationHandler::Subscribe(
+void DISIIndicationHandler::Subscribe(
         TDes8& aSubscriptionReq
         )
     {
     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe 0x%x>" ), &aSubscriptionReq ) );
     
     TUint8* msgPtr( const_cast<TUint8*>( aSubscriptionReq.Ptr() ) );
-    
-    TInt msgLength( aSubscriptionReq.Length() ); 
+    TInt msgLength( aSubscriptionReq.Length() );
     TUint32 resourceId( 0 );
     TUint8 deviceId( 0 );
-    TUint8 indication( 0 );
     TUint16 objId( 0 );
-      
-    objId = msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ];
+          
+    objId = GET_SENDER_OBJ( aSubscriptionReq );
     RemoveSubscription( objId );
-    for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ ); subBlockOffset < msgLength; subBlockOffset += ( SIZE_APE_COMMGR_SUBSCRIBE_SB ) )
+
+    if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
+        {            
+        //If any subblocks
+        if( msgPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_FILLERBYTE1 ] != 0 )
+            {
+            TUint8 indication( 0 );
+            for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ ); subBlockOffset < msgLength; subBlockOffset += ( SIZE_APE_COMMGR_SUBSCRIBE_SB ) )
+                {
+                deviceId = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ];
+                resourceId = GETB32( &msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] ); //resource offset
+                indication = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ];
+                C_TRACE( ( _T("DISIIndicationHandler indication 0x%x objId 0x%x resource 0x%x device 0x%x"), indication, objId, resourceId, deviceId ) );
+                TDeviceIdLink* deviceLink = GetDeviceLink( deviceId );
+                if( !deviceLink )
+                    {
+                    C_TRACE( ( _T("DISIIndicationHandler::Subscribe device not found yet -> create: 0x%x"), deviceId ) );
+                    deviceLink = new TDeviceIdLink();
+                    ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+                    deviceLink->iDeviceId = deviceId;
+                    iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
+                    }
+                AddServer( *deviceLink, resourceId, indication, objId );
+                }
+            }
+#ifdef _DEBUG
+#ifdef COMPONENT_TRACE_FLAG
+        PrintSubscriptions();
+#endif // COMPONENT_TRACE_FLAG
+#endif // _DEBUG
+    
+        TDeviceIdLink* deviceLink = NULL;
+        SDblQueLink* anchor = &iDeviceQ.iA;
+        SDblQueLink* next = anchor->iNext;
+        while( anchor != next )
+            {
+            deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+            ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer5 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+            C_TRACE( ( _T("DISIIndicationHandler::Subscribe device: 0x%x"), deviceLink->iDeviceId ) );
+            if( deviceLink->iDeviceId != PN_DEV_OWN )
+                {
+                C_TRACE( ( _T("DISIIndicationHandler::Subscribe send subscription to device: 0x%x"), deviceLink->iDeviceId ) );
+                SendSubscription( *deviceLink );
+                }
+            next = next->iNext;
+            }
+        }
+    else
         {
-        deviceId = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ];
-        resourceId = GETB32( &msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] ); //resource offset
-        indication = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ];
-        C_TRACE( ( _T("DISIIndicationHandler indication 0x%x objId 0x%x resource 0x%x device 0x%x"), indication, objId, resourceId, deviceId ) );
-        TDeviceIdLink* deviceLink = GetDeviceLink( deviceId );
+        deviceId = GET_SENDER_DEV( aSubscriptionReq );
+        TDeviceIdLink* deviceLink = GetExternalDeviceLink( deviceId );
         if( !deviceLink )
             {
-            C_TRACE( ( _T("DISIIndicationHandler::Subscribe device not found yet -> create: 0x%x"), deviceId ) );
+            C_TRACE( ( _T("DISIIndicationHandler::Subscribe external device not found yet -> create: 0x%x"), deviceId ) );
             deviceLink = new TDeviceIdLink();
-            ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+            ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure4 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
             deviceLink->iDeviceId = deviceId;
             iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
             }
-        AddServer( *deviceLink, resourceId, indication, objId );
-        }
-        
-#ifdef _DEBUG
-#ifdef COMPONENT_TRACE_FLAG
-    PrintSubscriptions();
-#endif // COMPONENT_TRACE_FLAG
-#endif // _DEBUG
-    
-    TDeviceIdLink* deviceLink = NULL;
-    SDblQueLink* anchor = &iDeviceQ.iA;
-    SDblQueLink* next = anchor->iNext;
-    while( anchor != next )
-        {
-        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
-        C_TRACE( ( _T("DISIIndicationHandler::Subscribe device: 0x%x"), deviceLink->iDeviceId ) );
-        if( deviceLink->iDeviceId != PN_DEV_OWN )
+        else
             {
-            C_TRACE( ( _T("DISIIndicationHandler::Subscribe send subscription to device: 0x%x"), deviceLink->iDeviceId ) );
-            SendSubscription( *deviceLink );
+            SDblQueLink* serverAnchor = NULL;
+            SDblQueLink* serverNext = NULL;
+            TServerIdLink* serverLink = NULL;
+            serverAnchor = &deviceLink->iServerQ.iA;
+            serverNext = serverAnchor->iNext;
+            while( serverAnchor != serverNext )
+                {
+                serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+                ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer6 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+                C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler remove server: 0x%x"), serverLink->iResourceId ));
+                serverLink->iServerLink.Deque();
+                delete serverLink;
+                serverLink = NULL;
+                serverNext = serverNext->iNext;           
+                }
             }
-        next = next->iNext;
+        for( TInt subBlockOffset( ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST );
+            subBlockOffset < msgLength; subBlockOffset += KResourceArraySize )
+            {
+            resourceId = GETB32( &msgPtr[ subBlockOffset ] );
+            C_TRACE( ( _T("DISIIndicationHandler resource 0x%x device 0x%x"), resourceId, deviceId ) );
+            AddServer( *deviceLink, resourceId );
+            }
         }
     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe<" ) ) );
-    return KErrNone;
     }
 
 
@@ -280,6 +361,31 @@
     AddIndication( *serverLink, aIndication, aObjId );
     C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x 0x%x 0x%x<" ), &aDeviceLink, aResourceId, aIndication, aObjId ) );
     }
+    
+
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::AddServer
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::AddServer(
+        TDeviceIdLink& aDeviceLink,
+        const TUint32 aResourceId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::AddServer external 0x%x 0x%x>" ), &aDeviceLink, aResourceId ) );
+    TServerIdLink* serverLink = GetServerLink( aDeviceLink, aResourceId );
+    if( !serverLink )
+        {
+        C_TRACE( ( _T("DISIIndicationHandler::AddServer external resource: 0x%x not found, create"), aResourceId ));
+        serverLink = new TServerIdLink();
+        ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerMemAllocFailure5 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        serverLink->iResourceId = aResourceId;
+        aDeviceLink.iServerQ.Add( &( serverLink->iServerLink ) );
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x<" ), &aDeviceLink, aResourceId ) );
+    }
+
 
 // -----------------------------------------------------------------------------
 // DISIIndicationHandler::AddIndication
@@ -351,6 +457,7 @@
     while( anchor != next )
         {
         tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( tmpDeviceLink, ( EISIIndicationHandlerQueNULLPointer7 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
         if( tmpDeviceLink->iDeviceId == aDeviceId )
             {
@@ -363,6 +470,35 @@
     return deviceLink;
     }
 
+// -----------------------------------------------------------------------------
+// DISIIndicationHandler::GetExternalDeviceLink
+//
+// -----------------------------------------------------------------------------
+//
+DISIIndicationHandler::TDeviceIdLink* DISIIndicationHandler::GetExternalDeviceLink(
+        const TUint8 aDeviceId
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink 0x%x ->" ), aDeviceId ) );
+    TDeviceIdLink* deviceLink = NULL;
+    TDeviceIdLink* tmpDeviceLink = NULL;
+    SDblQueLink* anchor = &iExternalDeviceQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( tmpDeviceLink, ( EISIIndicationHandlerQueNULLPointer8 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
+        if( tmpDeviceLink->iDeviceId == aDeviceId )
+            {
+            deviceLink = tmpDeviceLink;
+            break;
+            }
+        next = next->iNext;
+        }
+    C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink 0x%x <-" ), deviceLink ) );
+    return deviceLink;
+    }
 
 // -----------------------------------------------------------------------------
 // DISIIndicationHandler::GetServerLink
@@ -383,6 +519,7 @@
     while( anchor != next ) // servers
         {
         tmpServerLink = _LOFF( next, TServerIdLink, iServerLink );
+        ASSERT_RESET_ALWAYS( tmpServerLink, ( EISIIndicationHandlerQueNULLPointer9 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink server: 0x%x"), tmpServerLink->iResourceId ) );
         if( tmpServerLink->iResourceId == aResourceId )
             {
@@ -414,6 +551,7 @@
     while( anchor != next )
         {
         tmpIndicationLink = _LOFF( next, TIndicationLink, iIndicationLink );
+        ASSERT_RESET_ALWAYS( tmpIndicationLink, ( EISIIndicationHandlerQueNULLPointer10 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         if( tmpIndicationLink->iIndication == aIndication )
             {
             indicationLink = tmpIndicationLink;
@@ -442,7 +580,8 @@
     SDblQueLink* next = anchor->iNext;
     while( anchor != next )
         {
-        tmpSubscriberLink= _LOFF( next, TSubscriberLink, iSubscriberLink );
+        tmpSubscriberLink = _LOFF( next, TSubscriberLink, iSubscriberLink );
+        ASSERT_RESET_ALWAYS( tmpSubscriberLink, ( EISIIndicationHandlerQueNULLPointer11 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         if ( tmpSubscriberLink->iObjId == aObjId )
             {
             subscriberLink = tmpSubscriberLink;
@@ -479,25 +618,28 @@
     while( anchor != next )
         {
         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer12 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions device: 0x%x"), deviceLink->iDeviceId ) );
         serverAnchor = &deviceLink->iServerQ.iA;
         serverNext = serverAnchor->iNext;
         while( serverAnchor != serverNext )
             {
             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer13 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
             C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions server: 0x%x"), serverLink->iResourceId ) );
             indicationAnchor = &serverLink->iIndicationQ.iA;
             indicationNext = indicationAnchor->iNext;
             while( indicationAnchor != indicationNext )
                 {
                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer14 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                 C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions indication: 0x%x"), indicationLink->iIndication ) );
                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
                 subscriberNext = subscriberAnchor->iNext;
-                while( subscriberAnchor != subscriberNext)
+                while( subscriberAnchor != subscriberNext )
                     {
                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
-                    subscriberLink = subscriberLink;
+                    ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer15 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                     C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions objid: 0x%x"), subscriberLink->iObjId ) );
                     subscriberNext = subscriberNext->iNext;
                     }
@@ -540,17 +682,20 @@
     while( deviceAnchor != next )
         {
         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer16 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription device: 0x%x"), deviceLink->iDeviceId ) );
         serverAnchor = &deviceLink->iServerQ.iA;
         serverNext = serverAnchor->iNext;
         while( serverAnchor != serverNext )
             {
             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
+            ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer17 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
             indicationAnchor = &serverLink->iIndicationQ.iA;
             indicationNext = indicationAnchor->iNext;
             while( indicationAnchor != indicationNext )
                 {
                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
+                ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer18 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                 C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription indication: 0x%x"), indicationLink->iIndication ));
                 // get next link already in case if particular link is to be deleted
                 indicationNext = indicationNext->iNext;
@@ -559,6 +704,7 @@
                 while( subscriberAnchor != subscriberNext )
                     {
                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                    ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer19 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
                     C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription objid: 0x%x"), subscriberLink->iObjId ));
                     if( subscriberLink->iObjId == aObjId )
                         {
@@ -611,23 +757,104 @@
     }
 
 // -----------------------------------------------------------------------------
+// DIndicationHandler::
+//
+// -----------------------------------------------------------------------------
+//
+void DISIIndicationHandler::Multicast(
+        TDes8& aIndication
+        )
+    {
+    C_TRACE( ( _T( "DISIIndicationHandler::Multicast 0x%x ->" ), &aIndication ) );
+
+    TUint8* ptr = const_cast<TUint8*>( aIndication.Ptr() );
+
+    TDeviceIdLink* deviceLink = NULL;
+    SDblQueLink* anchor = &iDeviceQ.iA;
+    SDblQueLink* next = anchor->iNext;
+    while( anchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer20 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        C_TRACE( ( _T("DISIIndicationHandler::Multicast device: 0x%x"), deviceLink->iDeviceId ) );
+        TServerIdLink* serverLink = GetServerLink( *deviceLink, ptr[ ISI_HEADER_OFFSET_RESOURCEID ] );
+        TIndicationLink* indicationLink = NULL;
+        TSubscriberLink* subscriberLink = NULL;
+        if( serverLink )
+            {
+            indicationLink = GetIndicationLink( *serverLink, ptr[ ISI_HEADER_OFFSET_MESSAGEID ] );
+            }
+        if( indicationLink )
+            {
+            SDblQueLink* subscriberAnchor = NULL;
+            SDblQueLink* subscriberNext = NULL;
+            subscriberAnchor = &indicationLink->iSubscriberQ.iA;
+            subscriberNext = subscriberAnchor->iNext;
+            while( subscriberAnchor != subscriberNext )
+                {
+                subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
+                ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer21 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+                C_TRACE( ( _T("DISIIndicationHandler::Multicast Subscriber objid: 0x%x"), subscriberLink->iObjId ));
+                // Make a copy to every subscriber
+                TDes8& tempPtr = MemApi::AllocBlock( aIndication.Length() );
+                tempPtr.Copy( ptr, aIndication.Length() );
+                TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
+                SET_RECEIVER_OBJ( ptr, subscriberLink->iObjId );
+                iRouter->Send( tempPtr, PN_OBJ_EVENT_MULTICAST );
+                subscriberNext = subscriberNext->iNext;
+                }
+            }
+        next = next->iNext;
+        }
+    deviceLink = NULL;
+    anchor = &iExternalDeviceQ.iA;
+    next = anchor->iNext;
+    while( anchor != next )
+        {
+        deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
+        ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer22 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
+        C_TRACE( ( _T("DISIIndicationHandler::Multicast external device: 0x%x"), deviceLink->iDeviceId ) );
+        TServerIdLink* serverLink = GetServerLink( *deviceLink, ptr[ ISI_HEADER_OFFSET_RESOURCEID ] );
+        if( serverLink )
+            {
+            C_TRACE( ( _T("DISIIndicationHandler::Multicast resource: 0x%x"), serverLink->iResourceId ));
+            // Make a copy to every external subscriber
+            TDes8& tempPtr = MemApi::AllocBlock( aIndication.Length() );
+            tempPtr.Copy( ptr, aIndication.Length() );
+            TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
+            SET_RECEIVER_DEV( tempPtr, deviceLink->iDeviceId );
+            tempPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = ptr[ ISI_HEADER_OFFSET_RESOURCEID ];
+            SET_RECEIVER_OBJ( tempPtr, PN_OBJ_EVENT_MULTICAST );
+            SET_SENDER_OBJ( tempPtr, ptr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
+            iRouter->Send( tempPtr, PN_OBJ_EVENT_MULTICAST );
+            }
+        next = next->iNext;
+        }    
+    C_TRACE( ( _T( "DISIIndicationHandler::Multicast 0x%x <-" ), &aIndication ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
 // DISIIndicationHandler::SendSubscription
 //
 // -----------------------------------------------------------------------------
 //
-TInt DISIIndicationHandler::SendSubscription( TDeviceIdLink& aDevice )
+void DISIIndicationHandler::SendSubscription( TDeviceIdLink& aDevice )
     {
-    C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription>" ) ) );
-    const TUint8 KMaxAmountOfResources( 255 );
-    const TUint8 KPnsSubscribedResourcesExtendLength( 12 );
-    const TUint8 KResourceArraySize( 4 );
-    
+    C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription>" ) ) );    
     TDes8& desPtr = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_PNS_SUBSCRIBED_RESOURCES_EXTEND_IND + ( KMaxAmountOfResources * KResourceArraySize ) );
 
     TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
     ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
-    SET_RECEIVER_DEV( ptr, aDevice.iDeviceId );
-    SET_SENDER_DEV( ptr, PN_DEV_OWN );
+    // TODO a bug? SET_RECEIVER_DEV( ptr, aDevice.iDeviceId );
+#ifdef NCP_COMMON_BRIDGE_FAMILY
+    SET_SENDER_DEV( ptr, PN_DEV_HOST );
+		SET_RECEIVER_DEV( ptr, PN_DEV_MODEM );    
+#else
+    SET_SENDER_DEV( ptr, PN_DEV_SOS );
+		SET_RECEIVER_DEV( ptr, PN_DEV_HOST );
+#endif    
     ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_COMMGR;
     SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
     SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
@@ -643,29 +870,19 @@
     while( anchor != next )
         {
         serverLink = _LOFF( next, TServerIdLink, iServerLink );
+        ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer23 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
         TUint32 resourceId = serverLink->iResourceId;
         C_TRACE( ( _T("DISIIndicationHandler::SendSubscription Server: 0x%08x"), resourceId ) );
-        PUTB32( &ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST ], resourceId );
+        PUTB32( &ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST + ( resourceCount * KResourceArraySize ) ], resourceId );
         resourceCount++;
         next = next->iNext;
         }
     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCECOUNT ] = resourceCount;
     TInt messageLength( ( resourceCount * KResourceArraySize ) + KPnsSubscribedResourcesExtendLength );
-    while( messageLength % 4 != 0 )
-        {
-        TRACE_ASSERT_INFO(0, messageLength);
-        messageLength++;
-        }
     desPtr.SetLength( messageLength );
     SET_LENGTH( ptr, messageLength - PN_HEADER_SIZE );
-      
-    for( TInt i( 0 ); i < desPtr.Length(); i++ )
-        {
-        C_TRACE( ( _T( "index[ %d ] data 0x%x"), i, desPtr.Ptr()[i] ) );
-        }
-    TInt error = iRouter->Send( desPtr, PN_OBJ_EVENT_MULTICAST );
+    iRouter->Send( desPtr, PN_OBJ_EVENT_MULTICAST );
     C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription<" ) ) );  
-    return error;
     }
 
 // End of file.
--- a/connectivitylayer/isce/isinameservice_dll/eabi/isinameserviceu.def	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isinameservice_dll/eabi/isinameserviceu.def	Wed Feb 17 13:58:55 2010 +0200
@@ -1,3 +1,3 @@
 EXPORTS
-	_ZN15DISINameService15IsValidResourceERK6TDesC8 @ 1 NONAME
+	_ZN26MISICommunicationManagerIf15IsValidResourceERK6TDesC8 @ 1 NONAME
 
--- a/connectivitylayer/isce/isinameservice_dll/group/isinameservice.mmp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isinameservice_dll/group/isinameservice.mmp	Wed Feb 17 13:58:55 2010 +0200
@@ -19,7 +19,6 @@
 #include        <platform_paths.hrh>
 #include        "kernel/kern_ext.mmh"
 
-
 TARGET          isinameservice.dll
 TARGETTYPE      kext
 linkas          isinameservice.dll
@@ -39,6 +38,7 @@
 
 
 USERINCLUDE     ../inc
+USERINCLUDE     ../../isirouter_dll/inc
 USERINCLUDE     ../../isaaccessextension_dll/inc
 USERINCLUDE     ../../memmanager_dll/inc
 
--- a/connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isinameservice_dll/inc/isinameservice.h	Wed Feb 17 13:58:55 2010 +0200
@@ -28,7 +28,7 @@
 /*
 * ISI router.
 */
-NONSHARABLE_CLASS( DISINameService ) : public DBase, public MISIRouterObjectIf, MISICommunicationManagerIf
+NONSHARABLE_CLASS( DISINameService ) : public DBase, public MISIRouterObjectIf, public MISICommunicationManagerIf
     {
 
     public:
@@ -63,12 +63,17 @@
         */
         void BuildAndSendCommIsaEntityNotReachableResp( const TDesC8& aMsg );
 
+        static DISINameService* iThisptr;
+
+        static DMutex*      iNameServiceMutex;
+
+        DNameRecords*       iNameRecords;
+
     private:
 
         MISIObjectRouterIf* iRouter;
         TUint8              iObjId;
-        DNameRecords*       iNameRecords;
-        static DMutex*      iNameServiceMutex;
+        
 
     };
 
--- a/connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isinameservice_dll/src/isinameservice.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -24,8 +24,12 @@
 #include <phonetisi.h>            // For ISI_HEADER_SIZE
 #include <pn_const.h>             // For PN_NAMESERVICE
 #include <nsisi.h>                // For PN
-#include "misiobjectrouterif.h"   // For MISIObjectRouterIf
+
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+#include "isihelpers.h"           // For SET_RECEIVER_OBJ...
+#else
 #include "iadhelpers.h"           // For SET_RECEIVER_OBJ...
+#endif
 #include "namerecords.h"          // For DNameRecords
 #include <iscnokiadefinitions.h>  // For THIS_DEVICE
 #include <commisi.h>              // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
@@ -96,6 +100,7 @@
 const TUint32 KNameServiceUID( 0x2002A5A1 );
 const TUint8 KFiller( 0 );
 
+DISINameService* DISINameService::iThisptr = NULL;
 DMutex* DISINameService::iNameServiceMutex = NULL;
 _LIT8( KNameServiceMutex, "KNameServiceMutex" );
 
@@ -177,16 +182,13 @@
     Kern::MutexSignal( *iNameServiceMutex );
     C_TRACE( ( _T( "DISINameService::DISINameService<" ) ) );
     }
-
 void DISINameService::HandleNameQueryResp( const TDesC8& aMessage, const TUint8* msgPtr )
     {
     C_TRACE( ( _T( "DISINameService::HandleNameQueryResp>" ) ) );
     TUint32 name = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_NAME ] );
     TUint32 mask = GETB32( &msgPtr[ ISI_HEADER_SIZE + PNS_NAME_QUERY_REQ_OFFSET_BITMASK ] );
-
     RArray <TNameTable*> nameTable;
     TInt32 count = iNameRecords->NameQuery( name, mask, &nameTable );
-
     TUint16 msgLength = ( SIZE_PNS_NAME_QUERY_RESP + ( count * SIZE_PN_NAME_SRV_ITEM_STR ) );
     TDes8& respMsg = MemApi::AllocBlock( msgLength );
     respMsg.SetLength( msgLength );
@@ -312,15 +314,7 @@
         case PNS_NAME_QUERY_REQ:
             {
             C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ>" ) ) );
-//            if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == THIS_DEVICE )
-//                {
-                C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_RESP>" ) ) );
-                HandleNameQueryResp( aMessage, msgPtr );
-//                }
-//            else
-//                {
-//                C_TRACE( ( _T( "DISINameService::HandlePNSNameMessage PNS_NAME_QUERY_REQ from other device, ignore" ) ) );
-//                }
+            HandleNameQueryResp( aMessage, msgPtr );
             C_TRACE( ( _T( "DISINameService PNS_NAME_QUERY_REQ<" ) ) );
             break;
             }
@@ -351,18 +345,12 @@
                 TUint8 flags = msgPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_REQ_OFFSET_NAMEENTRY + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ];
                 err = iNameRecords->AddName( name, phonetAddr, flags );
                 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = err;
-                for( TInt i( 0 ); i < respMsg.Length(); i++ )
-                    {
-                    C_TRACE( ( _T( "PNS_NAME_ADD_RESP index[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
-                    }
                 iRouter->Send( respMsg, iObjId );
                 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from this device<" ) ) );
                 if( err == PN_NAME_OK )
                     {
                     C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND>" ) ) );
-                    RArray <TNameTable*>* nameTable = NULL;
-                    nameTable = iNameRecords->GetNameTable();
-                    msgLength = ( SIZE_PNS_NAME_ADD_IND + ( SIZE_PN_NAME_SRV_ITEM_STR * nameTable->Count() ) );
+                    msgLength = ( SIZE_PNS_NAME_ADD_IND + ( SIZE_PN_NAME_SRV_ITEM_STR ) );
                     TDes8& indMsg = MemApi::AllocBlock( msgLength );
                     indMsg.SetLength( msgLength );
                     TUint8* indPtr = const_cast<TUint8*>( indMsg.Ptr() );
@@ -385,10 +373,6 @@
                     PUTB16( &indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_DEV ], phonetAddr );
                     indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_FLAGS ] = flags;
                     indPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_IND_OFFSET_NAMEENTRYTBL + PN_NAME_SRV_ITEM_STR_OFFSET_RESERVED ] = KFiller;
-                    for( TInt i( 0 ); i < indMsg.Length(); i++ )
-                        {
-                        C_TRACE( ( _T( "PNS_NAME_ADD_IND index[ %d ] data 0x%x"), i, indMsg.Ptr()[i] ) );
-                        }
                     iRouter->Send( indMsg, iObjId );
                     C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_IND<" ) ) );
                     }
@@ -397,10 +381,6 @@
                 {
                 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_REQ from other device>" ) ) );
                 respPtr[ ISI_HEADER_SIZE + PNS_NAME_ADD_RESP_OFFSET_REASON ] = PN_NAME_NOT_ALLOWED;
-                for( TInt i( 0 ); i < respMsg.Length(); i++ )
-                    {
-                    C_TRACE( ( _T( "PNS_NAME_ADD_RESP index[ %d ] data 0x%x"), i, respMsg.Ptr()[i] ) );
-                    }
                 iRouter->Send( respMsg, iObjId );
                 C_TRACE( ( _T( "DISINameService PNS_NAME_ADD_RESP from other device<" ) ) );
                 }
@@ -426,16 +406,27 @@
     }
 
 
-EXPORT_C TBool DISINameService::IsValidResource(
+EXPORT_C TBool MISICommunicationManagerIf::IsValidResource(
         const TDesC8& aMessage
         )
     {
-    TInt err( Kern::MutexWait( *iNameServiceMutex ) );
+    C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x>" ), &aMessage ) );
+    TInt err( Kern::MutexWait( *DISINameService::iThisptr->iNameServiceMutex ) );
     ASSERT_RESET_ALWAYS( ( KErrNone == err ), ( EISINameServiceMutexWaitFailed | EDISINameServiceTraceId << KClassIdentifierShift ) );
-    C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x>" ), &aMessage ) );
-    C_TRACE( ( _T( "DISINameService::IsValidResource 0x%x<" ), &aMessage ) );
-    Kern::MutexSignal( *iNameServiceMutex );
-    return ETrue;
+    TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
+    TUint16 phonetAddress( 0 );
+    DISINameService::iThisptr->iNameRecords->LookupPhonetAddress( msgPtr[ ISI_HEADER_OFFSET_RESOURCEID ], &phonetAddress );
+    Kern::MutexSignal( *DISINameService::iThisptr->iNameServiceMutex );
+    if( phonetAddress == GET_SENDER_OBJ( aMessage ) )
+        {
+        C_TRACE( ( _T( "DISINameService::IsValidResource phonetAddress found 0x%x" ), phonetAddress ) );
+        return ETrue;
+        }
+    else
+        {
+        C_TRACE( ( _T( "DISINameService::IsValidResource phonetAddress not found 0x%x" ), phonetAddress ) );
+        return EFalse;
+        }
     }
 
 
@@ -445,6 +436,7 @@
     // Create a container extension
     DISINameService* extension = new DISINameService();
     TRACE_ASSERT( extension );
+    DISINameService::iThisptr = static_cast< DISINameService* >( extension );
     Kern::Printf( "ISI Name Service extension<" );
     return extension ? KErrNone : KErrNoMemory;
     }
@@ -494,7 +486,6 @@
 
     TDes8* block = reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) );
     MemApi::DeallocBlock( *block );
-
     C_TRACE( ( _T( "DISINameService::SendCommIsaEntityNotReachableResp 0x%x <-" ), &aMsg ) );
     }
 
--- a/connectivitylayer/isce/isirouter_dll/eabi/isirouteru.def	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/eabi/isirouteru.def	Wed Feb 17 13:58:55 2010 +0200
@@ -1,4 +1,5 @@
 EXPORTS
 	_Z19CreateLogicalDevicev @ 1 NONAME
 	_ZN6MISIIf8NewISIIfElRh @ 2 NONAME
+	_ZN18MISIObjectRouterIf7ConnectElRhP18MISIRouterObjectIf @ 3 NONAME
 
--- a/connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/inc/isicltransceiver.h	Wed Feb 17 13:58:55 2010 +0200
@@ -21,6 +21,7 @@
 #include "misilinkrouterif.h"     // For MISILinkRouterIf
 #include "isiinternaldefs.h"      // For KMaxNumOfObjId
 
+
 class MISIRouterLinkIf;
 class DISIRouter;
 
@@ -43,7 +44,10 @@
         TInt RouteISIMessage( TDes8& aMessage );
 
     private:
-
+    
+        //From objectapi
+        TInt Send( TDes8& aMessage, const TUint8 aObjId );
+    
         enum TISIMedias
             {
             EISIMediaSharedMemory = 0x00,
@@ -53,7 +57,11 @@
 
         MISIRouterLinkIf**   iLinksArray;
         DISIRouter*          iRouter;
-
+    
+    public:
+     
+        static DISICLTransceiver* iThisPtr;   
+        
     };
 
 #endif /* __ISICLTRANSCEIVER_H__ */
--- a/connectivitylayer/isce/isirouter_dll/inc/isirouter.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/inc/isirouter.h	Wed Feb 17 13:58:55 2010 +0200
@@ -24,8 +24,11 @@
 #include "misilinkrouterif.h"     // For MISILinkRouterIf
 #include "misichannelrouterif.h"  // For MISIChannelRouterIf
 #include "isiinternaldefs.h"      // For KMaxAmountOfObjId
+//#include "misiobjectrouterif.h"
+
 
 class MISIRouterChannelIf;
+class MISIRouterObjectIf;
 class MISIRouterLinkIf;
 class DISICLTransceiver;
 class DISIThreadContainer;
@@ -123,10 +126,14 @@
         static void InitializeDfc( TAny* aPtr );
         
                         
-    private:
-                
+    public:
         // Written only once no need to synch.
-        static DISIRouter*   iSelfPtr;
+        static DISIRouter*   iSelfPtr;  
+        MISIRouterObjectIf*  iNameService;
+        MISIRouterObjectIf*  iCommunicationManager; 
+                                
+    private:     
+
         // Owned, synchronized internally with fastmutexes.
         RArray< TStaticId* > iStaticObjIdTable;
         // Owned, synchronized internally with fastmutexes.
@@ -139,6 +146,7 @@
         DISICLTransceiver*   iCLTransceiver;
         DISIThreadContainer* iClientThreadContainer;
 
+
     };
 
 #endif /* __ISIROUTER_H__ */
--- a/connectivitylayer/isce/isirouter_dll/inc/misichannelrouterif.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/inc/misichannelrouterif.h	Wed Feb 17 13:58:55 2010 +0200
@@ -21,40 +21,24 @@
 #define __ISICHANNELROUTERIF_H__
 
 #include <e32def.h>     // For TInt, TAny
+#include "misiobjectrouterif.h"
 
 class MISIRouterChannelIf;
 
 /*
 * Abstract interface for channel to use router services.
 */
-class MISIChannelRouterIf
+class MISIChannelRouterIf : public MISIObjectRouterIf
     {
 
     public:
 
-        enum TISIDfcQThreadType
-            {
-    	      EISIKernelMainThread = 0,
-            EISIKernelRequestCompletionThread,
-            EISIUserMainThread,
-            EISIUserRequestCompletionThread
-            };
-
         /*
         * Informs router that channel is closed.
         */
         virtual void Disconnect( const TUint8 aObjId ) = 0;
 
         /*
-        * Returns thread according to TISIDfcThread enums.
-        * @param aThreadIndex, threads index in table
-        * @return pointer to thread
-        */
-        virtual TDfcQue* GetDfcThread( const TISIDfcQThreadType aType ) = 0;
-
-        virtual void FreeDfcThread( TDfcQue* aThread ) = 0;
-
-        /*
         * Returns the interface.
         * @return pointer to the interface
         */
--- a/connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/src/isicltransceiver.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -25,12 +25,16 @@
 #include "memapi.h"               // For MemApi
 #include <trxdefs.h>              // For ETrxTest...
 #include "isicltransceiver.h"     // For DISICLTransceiver
-
+#include <nsisi.h>                // For PN_NAMESERVICE... TODO:Remove this
 
 #define PN_MEDIA_TEST 0xBB //not real
-#define PN_DEV_MODEM 0x12
+//#define PN_DEV_MODEM 0x12
 #define PN_DEV_DUMMYIST 0x13
-#define PN_DEV_APE 0x14
+#define PN_DEV_OWN 0x6C
+
+// CONSTS
+DISICLTransceiver* DISICLTransceiver::iThisPtr = NULL;
+
 
 // Faults
 enum TISICLTransceiverFaults
@@ -120,7 +124,6 @@
 		    tempPtr.Append( 0x00 );
 		    // Filler
             tempPtr.Append( 0x00 );
-		    RouteISIMessage( tempPtr );
             error = RouteISIMessage( tempPtr );
    		    }
 		else
@@ -136,34 +139,22 @@
 	 C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x>" ), &aMessage ) );
 	TInt error( ValidateISIMessage( aMessage ) );
     TBool sendOk( EFalse );
-	TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
-    switch( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] )
+    if(GET_RECEIVER_DEV( aMessage ) == PN_DEV_OWN )
+        {
+        C_TRACE( ( _T( "DISIRouter msg to PN_DEV_APE" ) ) );
+        sendOk = iRouter->Receive( aMessage, GET_RECEIVER_OBJ( aMessage ) );
+        C_TRACE( ( _T( "DISIRouter router sendOk %d" ), sendOk ) );
+        }
+    else
         {
-        case PN_DEV_APE:
-            {
-            C_TRACE( ( _T( "DISIRouter msg to PN_DEV_APE" ) ) );
-            if( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_ROUTING_REQ )
-                {
-                //route with resource and nameservice
-                }
-            else{
-            	  sendOk = iRouter->Receive( aMessage, messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] );
-                C_TRACE( ( _T( "DISIRouter router sendOk %d" ), sendOk ) );
-                }
-            break;
-            }
-        default:
-            {
-            C_TRACE( ( _T( "DISIRouter msg to other device" ) ) );
-            TUint8 linkId = MapDeviceToMedia( messageBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] );
-	          ASSERT_RESET_ALWAYS( linkId < EISIAmountOfMedias, ( EISICLTransceiverNotSupportedMedia | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
-            MISIRouterLinkIf* link = iLinksArray[ linkId ];
-            ASSERT_RESET_ALWAYS( link, ( EISICLTransceiverNULLPtr | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
-            sendOk = link->Send( aMessage );
-            C_TRACE( ( _T( "DISIRouter link sendOk %d" ), sendOk ) );
-            break;
-            }
-        }
+         C_TRACE( ( _T( "DISIRouter msg to other device" ) ) );
+         TUint8 linkId = MapDeviceToMedia( GET_RECEIVER_DEV( aMessage ) );
+	       ASSERT_RESET_ALWAYS( linkId < EISIAmountOfMedias, ( EISICLTransceiverNotSupportedMedia | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
+         MISIRouterLinkIf* link = iLinksArray[ linkId ];
+         ASSERT_RESET_ALWAYS( link, ( EISICLTransceiverNULLPtr | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
+         sendOk = link->Send( aMessage );
+         C_TRACE( ( _T( "DISIRouter link sendOk %d" ), sendOk ) );
+         }   
     if( !sendOk )
         {
         SendCommIsaEntityNotReachableResp( aMessage );
--- a/connectivitylayer/isce/isirouter_dll/src/isirouter.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/isirouter_dll/src/isirouter.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -24,8 +24,13 @@
 #include "misirouterchannelif.h"  // For MISIRouterChannelIf
 #include "isithreadcontainer.h"   // For DISIThreadContainer
 #include "isicltransceiver.h"     // For DISICLTransceiver
+#include "misirouterobjectif.h"
 
-#define PN_DEV_APE 0x14 //TODO take from real location in future
+#define PN_DEV_OWN 0x6C //TODO take from real location in future
+
+const TInt KDfcPriority( 5 );
+const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
+const TUint32 KNameServiceUID( 0x2002A5A1 );
 
 DISIRouter* DISIRouter::iSelfPtr = NULL;
 
@@ -43,7 +48,7 @@
     EISIRouterNULLThreadPointer,
     };
 
-const TInt KDfcPriority( 5 );
+
 
 void DISIRouter::Connect(
         const TInt32 aUID,
@@ -146,12 +151,14 @@
         )
     {
     C_TRACE( ( _T( "DISIRouter::GetDfcThread<>" ) ) );  
+    Kern::Printf( "ISIRouter::GetDfcThread" );
     return iClientThreadContainer->AllocateThread( aType );
     }
 
 void DISIRouter::FreeDfcThread( TDfcQue* aThread )
     {
     C_TRACE( ( _T( "DISIRouter::FreeDfcThread 0x%x>" ), aThread ) );
+    Kern::Printf( "ISIRouter::FreeDfcThread" );
     iClientThreadContainer->DeallocateThread( aThread );
     C_TRACE( ( _T( "DISIRouter::FreeDfcThread 0x%x<" ), aThread ) );
     }
@@ -250,28 +257,65 @@
         )
     {
     C_TRACE( ( _T( "DISIRouter::Send 0x%x 0x%x>" ), &aMessage, aObjId ) );
-    TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
-    SET_SENDER_DEV( messageBlockPtr, PN_DEV_APE );
-    SET_SENDER_OBJ( messageBlockPtr, aObjId );
-    iCLTransceiver->RouteISIMessage( aMessage );
+    Kern::Printf( "ISIRouter::Send" );
+
+    if( ( aObjId != PN_OBJ_ROUTING_REQ ) 
+     && ( aObjId != PN_OBJ_EVENT_MULTICAST ) )
+        {
+        TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
+        SET_SENDER_DEV( messageBlockPtr, PN_DEV_OWN );
+        SET_SENDER_OBJ( messageBlockPtr, aObjId );
+        }
+    TInt error = iCLTransceiver->RouteISIMessage( aMessage );
     C_TRACE( ( _T( "DISIRouter::Send 0x%x %d 0x%x<" ), &aMessage, aObjId ) );
-    return KErrNone;
+    return error;
     }
 
 TBool DISIRouter::Receive( TDes8& aMessage, const TUint8 aObjId )
     {
     C_TRACE( ( _T( "DISIRouter::Receive 0x%x 0x%x>" ), &aMessage, aObjId ) );
-    NKern::FMWait( iClientTableFastMutex );
-    if( iClientTable[ aObjId ] )
+    TBool error( EFalse );
+    TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) ); 
+    switch( GET_RECEIVER_OBJ( aMessage ) )
         {
-        NKern::FMSignal( iClientTableFastMutex );
-        ( iClientTable[ aObjId ]->iChannel )->ReceiveMsg( aMessage ); //may not be safe, consider receive/delete sync
-        C_TRACE( ( _T( "DISIRouter::Receive ok 0x%x 0x%x>" ), &aMessage, aObjId ) );
-        return ETrue;
-    	  }
-    NKern::FMSignal( iClientTableFastMutex );
-    C_TRACE( ( _T( "DISIRouter::Receive failed 0x%x 0x%x<" ), &aMessage, aObjId ) );
-    return EFalse;
+        case PN_OBJ_ROUTING_REQ:
+            {
+            C_TRACE( ( _T( "DISIRouter msg to PN_OBJ_ROUTING_REQ: nameservice" ) ) );
+            //route with resource and nameservice
+            iNameService->Receive( aMessage );
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to NAMESERVICE<" ) ) );
+            error = ETrue;
+            break;
+            }
+        case PN_OBJ_EVENT_MULTICAST:
+            {
+            C_TRACE( ( _T( "DISIRouter msg to PN_OBJ_EVENT_MULTICAST: communication manager" ) ) );
+            iCommunicationManager->Receive( aMessage );
+            C_TRACE( ( _T( "DRouter::HandleIsiMessage to Communication Manager<" ) ) );
+            error = ETrue;
+            break;
+            }           
+        default:
+            {   //default regular channel
+             NKern::FMWait( iClientTableFastMutex );
+             if( iClientTable[ aObjId ] )
+                {
+                NKern::FMSignal( iClientTableFastMutex );
+                ( iClientTable[ aObjId ]->iChannel )->ReceiveMsg( aMessage ); //may not be safe, consider receive/delete sync
+                C_TRACE( ( _T( "DISIRouter::Receive ok 0x%x 0x%x>" ), &aMessage, aObjId ) );
+                error = ETrue;
+	              }
+	          else
+	              {
+                NKern::FMSignal( iClientTableFastMutex );
+                C_TRACE( ( _T( "DISIRouter::Receive failed 0x%x 0x%x<" ), &aMessage, aObjId ) );
+                error = EFalse;
+                }
+            break;    
+            }
+         }   
+     return error;
+
     }
 
 DECLARE_STANDARD_EXTENSION()
@@ -293,3 +337,30 @@
     return( device );
     }
 
+//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( "ISIRouter::Connect" );
+    if( aUID == KNameServiceUID )
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf was nameservice" ) ) );
+        DISIRouter::iSelfPtr->iNameService = aCallback;
+        aObjId = PN_OBJ_ROUTING_REQ; // 0x00
+        }
+    else if( aUID == KCommunicationManagerUID )
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf was communicationmanager" ) ) );
+        DISIRouter::iSelfPtr->iCommunicationManager = aCallback;
+        aObjId = PN_OBJ_EVENT_MULTICAST; // 0x20
+        }
+    else
+        {
+        C_TRACE( ( _T( "MISIObjectRouterIf unknown object api client" ) ) );
+        }
+    MISIObjectRouterIf* tmp =  DISIRouter::iSelfPtr;
+    C_TRACE( ( _T( "MISIObjectRouterIf::Connect %d 0x%x 0x%x<" ), aUID, aObjId, aCallback ) );
+    return tmp;
+    }
+
--- a/connectivitylayer/isce/rom/isce.iby	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isce/rom/isce.iby	Wed Feb 17 13:58:55 2010 +0200
@@ -16,19 +16,32 @@
 */
 
 
-
+//#define INTERNAL_FLAG_ISI_ROUTER_IN_USE // see communicationmanager too
 // TODO KEXT start order with one .iby if possible (no coreos..ibys)
 
 #ifndef __ISCE_IBY__
 #define __ISCE_IBY__
+
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\memmanager.dll         \Sys\Bin\memmanager.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\ismpmultiplexer.dll    \Sys\Bin\ismpmultiplexer.dll
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\p2prouter.dll          \Sys\Bin\p2prouter.dll
 file=ABI_DIR\DEBUG_DIR\p2papi.dll                            SHARED_LIB_DIR\p2papi.dll
+
 #define ISAACCESSDRIVER_IBY // To prevent problems with old IAD
+
+#ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
+
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isirouter.dll          \Sys\Bin\isirouter.dll
+file=ABI_DIR\DEBUG_DIR\isiapi.dll                            SHARED_LIB_DIR\isiapi.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isinameservice_isirouter.dll     \Sys\Bin\isinameservice_isirouter.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isicommunicationmanager_isirouter.dll     \Sys\Bin\isicommunicationmanager_isirouter.dll
+
+#endif // INTERNAL_FLAG_ISI_ROUTER_IN_USE
+
 file=ABI_DIR\DEBUG_DIR\iscapi.dll                             SHARED_LIB_DIR\iscapi.dll
 device[VARID]=KERNEL_DIR\DEBUG_DIR\isaaccessldd.ldd           SHARED_LIB_DIR\isaaccessldd.ldd
 extension[VARID]=KERNEL_DIR\DEBUG_DIR\isaaccessextension.dll  \Sys\Bin\isaaccessextension.dll
-extension[VARID]=KERNEL_DIR\DEBUG_DIR\isinameservice.dll      \Sys\Bin\isinameservice.dll
-extension[VARID]=KERNEL_DIR\DEBUG_DIR\isicommunicationmanager.dll      \Sys\Bin\isicommunicationmanager.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isinameservice.dll     \Sys\Bin\isinameservice.dll
+extension[VARID]=KERNEL_DIR\DEBUG_DIR\isicommunicationmanager.dll     \Sys\Bin\isicommunicationmanager.dll
+
 #endif // __ISCE_IBY__
--- a/connectivitylayer/isimessage/isimessage_dll/group/isimessage.mmp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/isimessage/isimessage_dll/group/isimessage.mmp	Wed Feb 17 13:58:55 2010 +0200
@@ -35,8 +35,8 @@
 USERINCLUDE     ../inc
 USERINCLUDE     ../traces
 SYSTEMINCLUDE     /epoc32/include 
+OS_LAYER_SYSTEMINCLUDE
 NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE
-OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY           euser.lib        // Basic EPOC library
 
--- a/connectivitylayer/usbphonetlink/group/bld.inf	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/group/bld.inf	Wed Feb 17 13:58:55 2010 +0200
@@ -35,4 +35,3 @@
     // Project doesn't support WINSCW
 #endif
 
-PRJ_TESTMMPFILES
--- a/connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnclient_dll/src/rusbpnclient.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -165,19 +165,20 @@
 
         User::LeaveIfError( CreateSession( KUsbPnServerName, TVersion(1,0,0) ) );
 
-        OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP7, "RUsbPnClient::ConnectL() - session created" );
-        E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session created" ) ) );
+        OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP7, "RUsbPnClient::ConnectL() - session created1" );
+        E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session created1" ) ) );
         }
     else if ( err )
         {
-        // Session not created, reason unknown
+        OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP8, "RUsbPnClient::ConnectL() - session not created, reason uknown" );
+        E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session not created, reason uknown" ) ) );            
         TRACE_ASSERT_ALWAYS;
         User::Leave( err );
         }
     else
         {
-        OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP8, "RUsbPnClient::ConnectL() - session created" );
-        E_TRACE( ( _T( "RUsbPnClient::ConnectL() - session created" ) ) );
+        OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP9, "RUsbPnClient::ConnectL() - session created2" );
+        E_TRACE( ( _T( "RUsbPnClient::ConnectL() - session created2" ) ) );
         }
     OstTrace0( TRACE_API, RUSBPNCLIENT_CONNECTL_EXIT, "RUsbPnClient::ConnectL() - return void" );
     A_TRACE( ( _T( "RUsbPnClient::ConnectL() - return void" ) ) );
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisareceiver.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisareceiver.h	Wed Feb 17 13:58:55 2010 +0200
@@ -106,6 +106,12 @@
         */
         void ConstructMessage();
 
+        /**
+        * Set active for receiving next packet from ISC API
+        */
+        void ReceivingNextPacket();
+
+
 
     private:    // Data
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h	Wed Feb 17 13:58:55 2010 +0200
@@ -59,13 +59,14 @@
         * From MUsbPnControlObserver. Returns usable circular packet if any.
         * @return CUsbPnPacket&. Packet for receiver.
         */
-        CUsbPnPacket& PacketL();
+        CUsbPnPacket& GetNextPacketL();
 
         /**
         * From MUsbPnControlObserver. Adds packet to send queue.
-        * @param aPacket
+        * @param CUsbPnPacket&. Packet for Send
+        * @return void
         */
-        void Send( CUsbPnPacket& aPacket );
+        void AddPacketToSendingQueue( CUsbPnPacket& aPacket );
 
 
     protected:  // Functions from base classes
@@ -108,6 +109,10 @@
         */
         void TryToSendPacket( CUsbPnPacket& );
 
+        /**
+        * Delete circular buffer objects
+        */
+        void DeletePackets();
 
     private:    // Data
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbreceiver.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbreceiver.h	Wed Feb 17 13:58:55 2010 +0200
@@ -114,6 +114,23 @@
         */
         void ConstructMessageL();
 
+        /**
+        * Set message complete flag
+        * @param aMsgComplete ETrue says message constructed
+        */
+        void SetMessageComplete( const TBool aMsgComplete );
+
+        /**
+        * Set message byte count
+        * @param aByteCount counts packet bytes. Append to previous if next msg
+        */
+        void SetByteCount( const TUint aByteCount );
+
+        /**
+        * Set message length
+        * @param aMessageLength ISI msg length  
+        */
+        void SetMessageLength( const TUint aMessageLength );
 
     private:    // Data
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbsender.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnusbsender.h	Wed Feb 17 13:58:55 2010 +0200
@@ -56,14 +56,13 @@
         * Adds message to sending queue.
         * @param CUsbPnPacket& aPacket. Cell of circular buffer holding received data.
         */
-        void Send( CUsbPnPacket& aPacket );
+        void AddPacketToSendingQueue( CUsbPnPacket& aPacket );
 
         /**
         * Get next free packet from pool.
         * @return reference to usable packet for receiver.
         */
-        CUsbPnPacket& PacketL();
-
+        CUsbPnPacket& GetNextPacketL();
 
     protected:  // Functions from base classes
 
@@ -105,6 +104,10 @@
         */
         void TryToSendPacket( const CUsbPnPacket& );
 
+        /**
+        * Delete circular buffer objects
+        */
+        void DeletePackets();
 
     private:    // Data
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnaltobserver.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpnaltobserver.h	Wed Feb 17 13:58:55 2010 +0200
@@ -33,9 +33,6 @@
 
         /**
         * Handles alternate setting changes.
-        * @since Series ?XX ?SeriesXX_version
-        * @param ?arg1 ?description
-        * @return ?description
         */
         virtual void HandleDeviceStateChange( TUint ) = 0;
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/inc/musbpncontrolobserver.h	Wed Feb 17 13:58:55 2010 +0200
@@ -35,12 +35,12 @@
         /**
         * Get packet for sending.
         */
-        virtual CUsbPnPacket& PacketL() = 0;
+        virtual CUsbPnPacket& GetNextPacketL() = 0;
 
         /**
         * Send packet.
         */
-        virtual void Send( CUsbPnPacket& aPacket ) = 0;
+        virtual void AddPacketToSendingQueue( CUsbPnPacket& aPacket ) = 0;
 
     };
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisareceiver.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -35,16 +35,7 @@
 #include <mediaisi.h>           // For Media specific message ID
 #endif /* NCP_COMMON_BRIDGE_FAMILY */
 
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES
-// CONSTANTS
-// MACROS
-// LOCAL CONSTANTS AND MACROS
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-// FORWARD DECLARATIONS
 
-// ============================= LOCAL FUNCTIONS ===============================
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -55,14 +46,14 @@
 //
 CUsbPnIsaReceiver::CUsbPnIsaReceiver( RIscApi& aIscApi )
 #ifdef NCP_COMMON_ENOSW_IN_USE
-    // CUsbPnUsbSender uses ECommTransmitPriority=100.
-    // Set priority lower than 100, so that CUsbPnUsbSender can send packages.
+// CUsbPnUsbSender uses ECommTransmitPriority=100,
+// Set priority lower so that CUsbPnUsbSender can send packages.
     :CActive( 99 )
 #else
     :CActive( CActive::EPriorityStandard - 1 )
 #endif
     ,iIscApi(aIscApi)
-    ,iRecvPtr(0,0)
+    ,iRecvPtr( NULL, NULL )
     ,iForwardFlag(EFalse)
     {
     OstTrace1( TRACE_NORMAL, CUSBPNISARECEIVER_CUSBPNISARECEIVER_ENTRY, "CUsbPnIsaReceiver::CUsbPnIsaReceiver;aIscApi=%x", ( TUint )&( aIscApi ) );
@@ -121,6 +112,7 @@
     if( iUsbSender )
         {
         delete iUsbSender;
+        iUsbSender = NULL;
         }
 
     OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_CUSBPNISARECEIVER_DESTRUCTOR_EXIT, "CUsbPnIsaReceiver::~CUsbPnIsaReceiver - return" );
@@ -129,8 +121,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaReceiver::DoCancel
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaReceiver::DoCancel( )
@@ -146,8 +136,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaReceiver::RunL
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaReceiver::RunL( )
@@ -166,23 +154,17 @@
         {
         OstTrace0( TRACE_API, CUSBPNISARECEIVER_RUNL, "CUsbPnIsaReceiver::RunL - Media specific resp" );
         A_TRACE( ( _T( "CUsbPnIsaReceiver::RunL - Media specific resp" )));
-        // Empty packet buffer and receive next packet to it.
         iPacket->ReleaseL();
-        iRecvPtr.Set( iPacket->Buffer().Des() );
-        iIscApi.Receive( iStatus, iRecvPtr, iNeededLength );
-        OstTrace0( TRACE_DETAILED, CUSBPNISARECEIVER_RUNL_DUP1, "CUsbPnIsaReceiver::RunL - receiving new" );
-        E_TRACE((_T("CUsbPnUsbReceiver::RunL - Receiving new")));
-        SetActive();
+        ReceivingNextPacket();
         }
     else
 #endif /* NCP_COMMON_BRIDGE_FAMILY */
         {
-
         //Normal case
         if( iForwardFlag )
             {
             ConstructMessage();
-            iUsbSender->Send( *iPacket );
+            iUsbSender->AddPacketToSendingQueue( *iPacket );
             Receive( iForwardFlag );
             }
 
@@ -191,13 +173,8 @@
             {
             OstTrace0( TRACE_API, CUSBPNISARECEIVER_RUNL_DUP2, "CUsbPnIsaReceiver::RunL - Discarding" );
             A_TRACE( ( _T( "CUsbPnIsaReceiver::RunL - Discarding" )));
-            // Empty packet buffer and receive next packet to it.
             iPacket->ReleaseL();
-            iRecvPtr.Set( iPacket->Buffer().Des() );
-            iIscApi.Receive( iStatus, iRecvPtr, iNeededLength );
-            OstTrace0( TRACE_DETAILED, CUSBPNISARECEIVER_RUNL_DUP3, "CUsbPnIsaReceiver::RunL - receiving new" );
-            E_TRACE((_T("CUsbPnUsbReceiver::RunL - Receiving new")));
-            SetActive();
+            ReceivingNextPacket();
             }
         }
 
@@ -206,9 +183,24 @@
     }
 
 // -----------------------------------------------------------------------------
+// CUsbPnIsaReceiver::ReceivingNextPacket
+// -----------------------------------------------------------------------------
+//
+void CUsbPnIsaReceiver::ReceivingNextPacket()
+    {
+    OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_RECEIVINGNEXTPACKET_ENTRY, "CUsbPnIsaReceiver::ReceivingNextPacket" );
+    C_TRACE( ( _T( "CUsbPnIsaReceiver::ReceivingNextPacket()" ) ) );
+    iRecvPtr.Set( iPacket->Buffer().Des() );
+    iIscApi.Receive( iStatus, iRecvPtr, iNeededLength );
+    OstTrace0( TRACE_DETAILED, CUSBPNISARECEIVER_RECEIVINGNEXTPACKET_DUP1, "CUsbPnIsaReceiver::ReceivingNextPacket - receiving new" );
+    E_TRACE((_T("CUsbPnIsaReceiver::ReceivingNextPacket - Receiving new")));
+    SetActive();
+    OstTrace0( TRACE_API, CUSBPNISARECEIVER_RECEIVINGNEXTPACKET_EXIT, "CUsbPnIsaReceiver::ReceivingNextPacket - return void" );
+    A_TRACE( ( _T( "CUsbPnIsaReceiver::ReceivingNextPacket() - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
 // CUsbPnIsaReceiver::RunError
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CUsbPnIsaReceiver::RunError( TInt aError )
@@ -226,11 +218,7 @@
             TRAP( aError, iPacket->ReallocBufferL( iNeededLength ) );
             if( aError == KErrNone )
                 {
-                iRecvPtr.Set( iPacket->Buffer().Des() );
-                iIscApi.Receive( iStatus, iRecvPtr, iNeededLength );
-                OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_RUNERROR_DUP1, "CUsbPnIsaReceiver::RunError - Receiving into bigger" );
-                C_TRACE( ( _T( "CUsbPnIsaReceiver::RunError - Receiving into bigger" )) );
-                SetActive();
+                ReceivingNextPacket();
                 }
             break;
             }
@@ -238,8 +226,7 @@
             {
             OstTrace0( TRACE_DETAILED, CUSBPNISARECEIVER_RUNERROR_DUP2, "CUsbPnIsaReceiver::RunError - Release ISC buffer." );
             E_TRACE( ( _T( "CUsbPnIsaReceiver::RunError - Release ISC buffer." )));
-            aError = KErrNone;
-            iIscApi.ResetBuffers(); // Clear ISC buffer. (connection was probably down, so the old messages are not needed)
+            iIscApi.ResetBuffers(); // Connection was probably down, so the old messages are not needed
             break;
             }
         default:
@@ -252,7 +239,7 @@
 
     OstTrace1( TRACE_NORMAL, CUSBPNISARECEIVER_RUNERROR_EXIT, "CUsbPnIsaReceiver::RunError - return;aError=%d", aError );
     C_TRACE( ( _T( "CUsbPnIsaReceiver::RunError() return - aError:%d )" ), aError ) );
-    return aError;
+    return KErrNone;
     }
 
 // -----------------------------------------------------------------------------
@@ -266,22 +253,17 @@
     OstTrace1( TRACE_NORMAL, CUSBPNISARECEIVER_RECEIVE_ENTRY, "CUsbPnIsaReceiver::Receive;aForward=%d", aForward );
     C_TRACE( ( _T( "CUsbPnIsaReceiver::Receive( aForward:%d)" ), aForward ));
 
-    iForwardFlag = aForward;
+    SetForwardFlag( aForward );
 
     if(!IsActive())
         {
-        TRAPD( err, iPacket = &iUsbSender->PacketL() );
+        TRAPD( err, iPacket = &iUsbSender->GetNextPacketL() );
         if(!err)
             {
-            iRecvPtr.Set( iPacket->Buffer().Des() );
-            iIscApi.Receive( iStatus, iRecvPtr, iNeededLength );
-            OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_RECEIVE, "CUsbPnIsaReceiver::Receive - Receiving" );
-            C_TRACE( ( _T( "CUsbPnIsaReceiver::Receive - Receiving" )) );
-            SetActive();
+            ReceivingNextPacket();
             }
         else
             {
-            // No free packets so receiving not activated until sender
             OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_RECEIVE_DUP1, "CUsbPnIsaReceiver::Receive - Sender tells when to continue" );
             C_TRACE( ( _T( "CUsbPnIsaReceiver::Receive - Sender tells when to continue" )) );
             }
@@ -293,8 +275,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaReceiver::SetForwardFlag
-// aForward should be ETrue only when Phonet connection is open to PC
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaReceiver::SetForwardFlag( TBool aForward )
@@ -310,8 +290,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaReceiver::ConstructMessage
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaReceiver::ConstructMessage()
@@ -319,13 +297,12 @@
     OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_CONSTRUCTMESSAGE_ENTRY, "CUsbPnIsaReceiver::ConstructMessage" );
     C_TRACE( ( _T( "CUsbPnIsaReceiver::ConstructMessage()" ) ) );
 
-    // Converts the endianess of message length
     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() ) );
-    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;
+    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;
 
     OstTrace0( TRACE_NORMAL, CUSBPNISARECEIVER_CONSTRUCTMESSAGE_EXIT, "CUsbPnIsaReceiver::ConstructMessage - return void" );
     C_TRACE( ( _T( "CUsbPnIsaReceiver::ConstructMessage() - return void" ) ) );
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnisasender.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -29,16 +29,9 @@
 
 #include <iscapi.h>                 // For RIscApi
 
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES
-// CONSTANTS
-// MACROS
 // LOCAL CONSTANTS AND MACROS
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-// FORWARD DECLARATIONS
+const TInt KTotalIsaPacketCount( KPnIsaPacketCount + 1 );
 
-// ============================= LOCAL FUNCTIONS ===============================
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -72,8 +65,7 @@
     OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_CONSTRUCTL_ENTRY, "CUsbPnIsaSender::ConstructL" );
     C_TRACE( ( _T( "CUsbPnIsaSender::ConstructL()" ) ) );
 
-    // Create circular buffer objects
-    for(TUint i = 1; i < (KPnIsaPacketCount + 1); i++)
+    for(TUint i = 1; i < KTotalIsaPacketCount; i++)
         {
         AddPacketBufferL(i);
         }
@@ -113,8 +105,23 @@
 
     Cancel();
 
-    // Delete circular buffer objects
-    CUsbPnPacket* packet;
+    DeletePackets();
+
+    iCurrentPacket = NULL;
+    iPacket = NULL;
+
+    OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_CUSBPNISASENDER_DESTRUCTOR_EXIT, "CUsbPnIsaSender::~CUsbPnIsaSender - return" );
+    C_TRACE( ( _T( "CUsbPnIsaSender::~CUsbPnIsaSender() - return" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPnIsaSender::DeletePackets
+// -----------------------------------------------------------------------------
+void CUsbPnIsaSender::DeletePackets( )
+    {
+    OstTrace0( TRACE_API, CUSBPNISASENDER_DELETEPACKETS_ENTRY, "CUsbPnIsaSender::DeletePackets" );
+    A_TRACE( ( _T( "CUsbPnIsaSender::DeletePackets()" ) ) );
+    CUsbPnPacket* packet = NULL;
     while(iPacketCount > 0)
         {
         iPacketCount--;
@@ -122,11 +129,8 @@
         delete iPacket;
         iPacket = packet;
         }
-    iCurrentPacket = NULL;
-    iPacket = NULL;
-
-    OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_CUSBPNISASENDER_DESTRUCTOR_EXIT, "CUsbPnIsaSender::~CUsbPnIsaSender - return" );
-    C_TRACE( ( _T( "CUsbPnIsaSender::~CUsbPnIsaSender() - return" ) ) );
+    OstTrace0( TRACE_API, CUSBPNISASENDER_DELETEPACKETS_EXIT, "CUsbPnIsaSender::DeletePackets - return void" );
+    A_TRACE( ( _T( "CUsbPnIsaSender::DeletePackets() - return void" ) ) );
     }
 
 // -----------------------------------------------------------------------------
@@ -137,8 +141,15 @@
     OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_ADDPACKETBUFFERL_ENTRY, "CUsbPnIsaSender::AddPacketBufferL" );
     C_TRACE((_T("CUsbPnIsaSender::AddPacketBuffer()")));
 
-    iPacketCount++;
-    iPacket = CUsbPnPacket::NewL( iPacket, aIndex );
+    if( aIndex <= KTotalIsaPacketCount )
+        {
+        iPacketCount++;
+        iPacket = CUsbPnPacket::NewL( iPacket, aIndex );
+        }
+    else
+        {
+        TRACE_ASSERT_ALWAYS;
+        }
 
     OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_ADDPACKETBUFFERL_EXIT, "CUsbPnIsaSender::AddPacketBufferL - return void" );
     C_TRACE((_T("CUsbPnIsaSender::AddPacketBuffer - return void")));
@@ -146,8 +157,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaSender::DoCancel
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaSender::DoCancel( )
@@ -163,8 +172,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaSender::RunL
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaSender::RunL( )
@@ -176,7 +183,7 @@
 
     iCurrentPacket->ReleaseL();
 
-    iBufferListener.Receive( ETrue/*dummy*/ );
+    iBufferListener.Receive( ETrue );
 
     iCurrentPacket = &iCurrentPacket->NextPacket();
     OstTraceExt2( TRACE_DETAILED, CUSBPNISASENDER_RUNL, "CUsbPnIsaSender::RunL;tail:%d,head:%d", iCurrentPacket->PacketNumber(), iPacket->PacketNumber() );
@@ -196,8 +203,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaSender::RunError
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CUsbPnIsaSender::RunError( TInt aError )
@@ -213,7 +218,6 @@
             {
             TRACE_ASSERT_ALWAYS;
             CActiveScheduler::Stop();
-            aError = KErrNone;
             break;
             }
         default:
@@ -226,18 +230,16 @@
 
     OstTrace1( TRACE_NORMAL, CUSBPNISASENDER_RUNERROR_EXIT, "CUsbPnIsaSender::RunError - return;aError=%d", aError );
     C_TRACE( ( _T( "CUsbPnIsaSender::RunError() return - aError:%d )" ), aError ) );
-    return aError;
+    return KErrNone;
     }
 // -----------------------------------------------------------------------------
-// CUsbPnIsaSender::Packet
-// ?implementation_description
-// (other items were commented in a header).
+// CUsbPnIsaSender::GetNextPacketL
 // -----------------------------------------------------------------------------
 //
-CUsbPnPacket& CUsbPnIsaSender::PacketL()
+CUsbPnPacket& CUsbPnIsaSender::GetNextPacketL()
     {
-    OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_PACKETL_ENTRY, "CUsbPnIsaSender::PacketL" );
-    C_TRACE( ( _T( "CUsbPnIsaSender::PacketL()" ) ) );
+    OstTrace0( TRACE_NORMAL, CUSBPNISASENDER_GETNEXTPACKETL_ENTRY, "CUsbPnIsaSender::GetNextPacketL" );
+    C_TRACE( ( _T( "CUsbPnIsaSender::GetNextPacketL()" ) ) );
 
     CUsbPnPacket& packet( iPacket->NextPacket() );
     TBool err = packet.PacketInUse();
@@ -246,29 +248,28 @@
         User::Leave( err );
         }
 
-    OstTrace1( TRACE_NORMAL, CUSBPNISASENDER_PACKETL_EXIT, "CUsbPnIsaSender::PacketL - return;packet=%d", packet.PacketNumber() );
-    C_TRACE((_T("CUsbPnIsaSender::PacketL() - return packet:%d"), packet.PacketNumber()));
+    OstTrace1( TRACE_NORMAL, CUSBPNISASENDER_GETNEXTPACKETL_EXIT, "CUsbPnIsaSender::GetNextPacketL - return;packet=%d", packet.PacketNumber() );
+    C_TRACE((_T("CUsbPnIsaSender::GetNextPacketL() - return packet:%d"), packet.PacketNumber()));
 
     return packet;
     }
 
 // -----------------------------------------------------------------------------
-// CUsbPnIsaSender::Send
-// ?implementation_description
-// (other items were commented in a header).
+// CUsbPnIsaSender::AddPacketToSendingQueue
 // -----------------------------------------------------------------------------
 //
-void CUsbPnIsaSender::Send( CUsbPnPacket& aPacket )
+void CUsbPnIsaSender::AddPacketToSendingQueue( CUsbPnPacket& aPacket )
     {
-    OstTrace1( TRACE_API, CUSBPNISASENDER_SEND_ENTRY, "CUsbPnIsaSender::Send;aPacket=%x", ( TUint )&( aPacket ) );
-    A_TRACE( ( _T( "CUsbPnIsaSender::Send( aPacket:0x%x)" ), &aPacket ) );
+    ASSERT( &aPacket );
+    OstTrace1( TRACE_API, CUSBPNISASENDER_ADDPACKETTOSENDINGQUEUE_ENTRY, "CUsbPnIsaSender::AddPacketToSendingQueue;aPacket=%x", ( TUint )&( aPacket ) );
+    A_TRACE( ( _T( "CUsbPnIsaSender::AddPacketToSendingQueue( aPacket:0x%x)" ), &aPacket ) );
 
     CUsbPnPacket& packet( iPacket->NextPacket() );
     if( &packet == &aPacket )
         {
         iPacket = &packet;
-        OstTrace1( TRACE_DETAILED, CUSBPNISASENDER_SEND, "CUsbPnIsaSender::Send;packet number:%d", iPacket->PacketNumber() );
-        E_TRACE( ( _T( "CUsbPnIsaSender::Send() - packet number:%d" ), iPacket->PacketNumber() ) );
+        OstTrace1( TRACE_DETAILED, CUSBPNISASENDER_ADDPACKETTOSENDINGQUEUE, "CUsbPnIsaSender::AddPacketToSendingQueue;packet number:%d", iPacket->PacketNumber() );
+        E_TRACE( ( _T( "CUsbPnIsaSender::AddPacketToSendingQueue() - packet number:%d" ), iPacket->PacketNumber() ) );
 
         TryToSendPacket( *iPacket );
         }
@@ -278,33 +279,35 @@
         User::Panic(_L("USBPNSERVER"), KErrTotalLossOfPrecision);
         }
 
-    OstTrace0( TRACE_API, CUSBPNISASENDER_SEND_EXIT, "CUsbPnIsaSender::Send - return void" );
-    A_TRACE( ( _T( "CUsbPnIsaSender::Send() - return void" ) ) );
+    OstTrace0( TRACE_API, CUSBPNISASENDER_ADDPACKETTOSENDINGQUEUE_EXIT, "CUsbPnIsaSender::AddPacketToSendingQueue - return void" );
+    A_TRACE( ( _T( "CUsbPnIsaSender::AddPacketToSendingQueue() - return void" ) ) );
     }
 
 
 // -----------------------------------------------------------------------------
 // CUsbPnIsaSender::TryToSendPacket
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnIsaSender::TryToSendPacket( CUsbPnPacket& aPacket )
     {
+    ASSERT( &aPacket );
     OstTrace1( TRACE_API, CUSBPNISASENDER_TRYTOSENDPACKET_ENTRY, "CUsbPnIsaSender::TryToSendPacket;aPacket=%x", ( TUint )&( aPacket ) );
     A_TRACE( ( _T( "CUsbPnIsaSender::TryToSendPacket( aPacket:0x%x )" ), &aPacket ) );
 
     if(!IsActive())
         {
-        if( &aPacket == &iCurrentPacket->NextPacket() || &aPacket == iCurrentPacket )
+        if( &aPacket == ( &iCurrentPacket->NextPacket() )
+            || &aPacket == iCurrentPacket )
             {
             OstTrace0( TRACE_DETAILED, CUSBPNISASENDER_TRYTOSENDPACKET, "CUsbPnIsaSender::TryToSendPacket - Send to ISA" );
             E_TRACE( ( _T( "CUsbPnIsaSender::TryToSendPacket() - Send to ISA")));
 
+            
 #ifdef EXTENDED_TRACE_FLAG
-            TInt i(0);
-            HBufC8& data(aPacket.Buffer());
-            while(i < data.Length() )
+
+			HBufC8& data(aPacket.Buffer());
+            TInt length( data.Length() );
+            for( TInt i = 0; i < length; i++ )
                 {
                 OstTraceExt2( TRACE_DETAILED, CUSBPNISASENDER_TRYTOSENDPACKET_DUP1, "CUsbPnIsaSender::Send([%d] = %x )", i, data[i] );
                 E_TRACE( ( _T( "CUsbPnIsaSender::Send([%d] = %x )" ), i, data[i] ) );
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbreceiver.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -36,16 +36,6 @@
 #include <iscnokiadefinitions.h>    // For APE Test Server channel ID
 #endif /* NCP_COMMON_BRIDGE_FAMILY */
 
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES
-// CONSTANTS
-// MACROS
-// LOCAL CONSTANTS AND MACROS
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-// FORWARD DECLARATIONS
-
-// ============================= LOCAL FUNCTIONS ===============================
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -57,8 +47,8 @@
 CUsbPnUsbReceiver::CUsbPnUsbReceiver( RDevUsbcClient& aLdd )
     :CActive( CActive::EPriorityStandard )
     , iLdd( aLdd )
-    , iRecvPtr(0,0)
-    , iStorage(0)
+    , iRecvPtr( NULL, NULL )
+    , iStorage( NULL )
     {
     OstTrace1( TRACE_NORMAL, CUSBPNUSBRECEIVER_CUSBPNUSBRECEIVER_ENTRY, "CUsbPnUsbReceiver::CUsbPnUsbReceiver;aLdd=%x", ( TUint )&( aLdd ) );
     C_TRACE( ( _T( "CUsbPnUsbReceiver::CUsbPnUsbReceiver( aLdd:0x%x )" ), &aLdd ) );
@@ -118,8 +108,8 @@
         {
         delete iIsaSender;
         }
-
-    iPacket = 0;
+    iIsaSender = NULL;
+    iPacket = NULL;
 
     if( iStorage )
         {
@@ -134,8 +124,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::DoCancel
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbReceiver::DoCancel( )
@@ -155,8 +143,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::RunL
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbReceiver::RunL( )
@@ -168,12 +154,10 @@
     ConstructMessageL();
     if( iMessageComplete )
         {
-        iIsaSender->Send( *iPacket );
-        iMessageComplete = EFalse;
-        iByteCount = 0;
-        iMessageLength = 0;
-
-        // Start fresh receive
+        iIsaSender->AddPacketToSendingQueue( *iPacket );
+        SetMessageComplete( EFalse );
+        SetByteCount( NULL );
+        SetMessageLength( NULL );
         Receive( ETrue );
         }
 
@@ -182,9 +166,44 @@
     }
 
 // -----------------------------------------------------------------------------
+// CUsbPnUsbReceiver::SetMessageComplete
+// -----------------------------------------------------------------------------
+void CUsbPnUsbReceiver::SetMessageComplete( const TBool aMsgComplete )
+    {
+    OstTrace1( TRACE_API, CUSBPNUSBRECEIVER_SETMESSAGECOMPLETE_ENTRY, "CUsbPnUsbReceiver::SetMessageComplete;aMsgComplete:%d", aMsgComplete );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetMessageComplete() aMsgComplete:%d" ), aMsgComplete ) );
+    iMessageComplete = aMsgComplete;
+    OstTrace0( TRACE_API, CUSBPNUSBRECEIVER_SETMESSAGECOMPLETE_EXIT, "CUsbPnUsbReceiver::SetMessageComplete - return void" );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetMessageComplete() - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CUsbPnUsbReceiver::SetByteCount
+// -----------------------------------------------------------------------------
+void CUsbPnUsbReceiver::SetByteCount( const TUint aByteCount )
+    {
+    OstTrace1( TRACE_API, CUSBPNUSBRECEIVER_SETBYTECOUNT_ENTRY, "CUsbPnUsbReceiver::SetByteCount;aByteCount:%d", aByteCount );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetByteCount() aByteCount:%d" ), aByteCount ) );
+    iByteCount = aByteCount;
+    OstTrace0( TRACE_API, CUSBPNUSBRECEIVER_SETBYTECOUNT_EXIT, "CUsbPnUsbReceiver::SetByteCount - return void" );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetByteCount() - return void" ) ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CUsbPnUsbReceiver::SetMessageLength
+// -----------------------------------------------------------------------------
+void CUsbPnUsbReceiver::SetMessageLength( const TUint aMessageLength )
+    {
+    OstTrace1( TRACE_API, CUSBPNUSBRECEIVER_SetMessageLength_ENTRY, "CUsbPnUsbReceiver::SetMessageLength;aMessageLength:%d", aMessageLength );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetMessageLength() aMessageLength:%d" ), aMessageLength ) );
+    iMessageLength = aMessageLength;
+    OstTrace0( TRACE_API, CUSBPNUSBRECEIVER_SetMessageLength_EXIT, "CUsbPnUsbReceiver::SetMessageLength - return void" );
+    A_TRACE( ( _T( "CUsbPnUsbReceiver::SetMessageLength() - return void" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::RunError
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CUsbPnUsbReceiver::RunError( TInt aError )
@@ -209,29 +228,26 @@
             {
             OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR, "CUsbPnUsbReceiver::RunError - Cable detached!" );
             C_TRACE( ( _T( "CUsbPnUsbReceiver::RunError - Cable detached!" )));
-            aError = KErrNone;
             break;
             }
         default:
             {
-            TRACE_ASSERT_ALWAYS;  // Log the errorcase.
-            aError = KErrNone; // Ignore error..
+            TRACE_ASSERT_ALWAYS;
+            User::Panic( KUsbPnPanicCat, aError );
             break;
             }
         }
 
     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RUNERROR_EXIT, "CUsbPnUsbReceiver::RunError - return" );
     C_TRACE( ( _T( "CUsbPnUsbReceiver::RunL() - return" ) ) );
-    return aError;
+    return KErrNone;
     }
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::Receive
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CUsbPnUsbReceiver::Receive( TBool /*aForward*/ )
+void CUsbPnUsbReceiver::Receive( TBool )
     {
     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE_ENTRY, "CUsbPnUsbReceiver::Receive" );
     C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive()" )) );
@@ -241,7 +257,7 @@
         {
         if(!IsActive())
             {
-            TRAPD( err, iPacket = &iIsaSender->PacketL() );
+            TRAPD( err, iPacket = &iIsaSender->GetNextPacketL() );
             if(!err)
                 {
                 iRecvPtr.Set( iPacket->Buffer().Des() );
@@ -252,7 +268,6 @@
                 }
             else
                 {
-                // No free packets so receiving not activated until sender
                 OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_RECEIVE_DUP1, "CUsbPnUsbReceiver::Receive - Sender tells when to continue" );
                 C_TRACE( ( _T( "CUsbPnUsbReceiver::Receive - Sender tells when to continue" )) );
                 }
@@ -265,8 +280,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::IsaSender
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 MUsbPnControlObserver* CUsbPnUsbReceiver::IsaSender()
@@ -280,8 +293,6 @@
     }
 // -----------------------------------------------------------------------------
 // CUsbPnUsbReceiver::SetEnumerated
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbReceiver::SetEnumerated( TBool aState )
@@ -316,7 +327,7 @@
         TUint16 lsb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1]);
         TUint16 msb(iRecvPtr[ISI_HEADER_OFFSET_LENGTH]);
 
-        iMessageLength = (lsb | (msb<<8));
+        iMessageLength = ( lsb | ( msb<<8 ) );
 
         OstTrace1( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP1, "CUsbPnUsbReceiver::ConstructMessageL;iMessageLength=%d", iMessageLength );
         E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - iMessageLength:%d" ), iMessageLength ) );
@@ -329,11 +340,9 @@
 
             if( ( PN_HEADER_SIZE + iMessageLength ) > packetLength )
                 {
-                // realloc
                 OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP3, "CUsbPnUsbReceiver::ConstructMessageL - partial message. Receive more" );
                 E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - partial message. Receive more")));
 
-                // Alloc temporary buffer to store data
                 iStorage = HBufC8::NewL( iMessageLength + PN_HEADER_SIZE );
                 TPtr8 tmp( iStorage->Des() );
                 tmp.Append( iPacket->Buffer() );
@@ -351,15 +360,14 @@
         tmp.Append( iPacket->Buffer() );
         }
 
-    // Ready to be sent?
-    if( iByteCount == iMessageLength + PN_HEADER_SIZE )
+    // message ready to be sent
+    if( iByteCount == ( iMessageLength + PN_HEADER_SIZE ) )
         {
         OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP5, "CUsbPnUsbReceiver::ConstructMessageL - message complete" );
         E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - message complete")));
 
         if( iByteCount > KPnPacketSize )
             {
-            // Realloc iPacket's buffer with needed length
             OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP6, "CUsbPnUsbReceiver::ConstructMessageL - realloc for whole message" );
             E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - realloc for whole message")));
             iPacket->ReallocBufferL( iMessageLength + PN_HEADER_SIZE );
@@ -376,31 +384,17 @@
         iRecvPtr[ISI_HEADER_OFFSET_LENGTH +1] = tmp4;
 
 #ifndef NCP_COMMON_BRIDGE_FAMILY
-        // Message directly to APE Test Server. Rare labeling case for optimized performance
+        // Message directly to APE Test Server.
         if( (iRecvPtr[ISI_HEADER_OFFSET_RESOURCEID] == PN_EPOC_TEST) &&
             (iRecvPtr[ISI_HEADER_OFFSET_MESSAGEID] == TS_SOS_FILE_WRITE_REQ ) )
             {
             OstTrace0( TRACE_DETAILED, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_DUP7, "CUsbPnUsbReceiver::ConstructMessageL - Message to APE Test Server" );
             E_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage - Message to APE Test Server")));
 
-            // Set Receiver device
-            //TUint8 recvDev = iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] & 0x03;
-            //iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = (recvDev | (PN_DEV_SOS & 0xFC));
-
             iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = PN_DEV_SOS;
-
-            // Set Receiver Object ID
-            TUint8 objIdHighBits = (EIscNokiaTest >> 8) & 0x03;
-            TUint8 objIdLowBits = (EIscNokiaTest & 0x00ff);
-
-            TUint8 receiverDevice( (iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] ) & 0xFC );
-
-            receiverDevice = (receiverDevice | objIdHighBits);
-            iRecvPtr[ISI_HEADER_OFFSET_RECEIVERDEVICE] = receiverDevice;
-
-            iRecvPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] = objIdLowBits;
+            iRecvPtr[ISI_HEADER_OFFSET_RECEIVEROBJECT] = EIscNokiaTest;
             }
-#endif /* NCP_COMMON_BRIDGE_FAMILY */
+#endif // NCP_COMMON_BRIDGE_FAMILY 
 
         iMessageComplete = ETrue;
         }
@@ -417,7 +411,7 @@
 
     OstTrace0( TRACE_NORMAL, CUSBPNUSBRECEIVER_CONSTRUCTMESSAGEL_EXIT, "CUsbPnUsbReceiver::ConstructMessageL - return void" );
     C_TRACE( ( _T( "CUsbPnUsbReceiver::ConstructMessage() - return void" ) ) );
-    }
+}    
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
--- a/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Fri Jan 22 10:04:04 2010 +0200
+++ b/connectivitylayer/usbphonetlink/usbpnserver_exe/src/cusbpnusbsender.cpp	Wed Feb 17 13:58:55 2010 +0200
@@ -29,16 +29,9 @@
 
 #include <d32usbc.h>                // RDevUsbcClient
 
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES
-// CONSTANTS
-// MACROS
 // LOCAL CONSTANTS AND MACROS
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-// FORWARD DECLARATIONS
+const TInt KTotalUsbPacketCount( KPnUsbPacketCount + 1 );
 
-// ============================= LOCAL FUNCTIONS ===============================
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -47,11 +40,12 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CUsbPnUsbSender::CUsbPnUsbSender( MUsbPnBufferListener& aListener, RDevUsbcClient& aLdd )
+CUsbPnUsbSender::CUsbPnUsbSender( MUsbPnBufferListener& aListener, 
+    RDevUsbcClient& aLdd )
     :CActive( 100 )  //ECommTransmitPriority=100 in es_prot.h
     ,iBufferListener( aListener )
     ,iLdd( aLdd )
-    ,iPacketCount( 0 )
+    ,iPacketCount( NULL )
     ,iPacket( NULL )
     {
     OstTraceExt2( TRACE_NORMAL, CUSBPNUSBSENDER_CUSBPNUSBSENDER_ENTRY, "CUsbPnUsbSender::CUsbPnUsbSender;aListener=%x;aLdd=%x", ( TUint )&( aListener ), ( TUint )&( aLdd ) );
@@ -73,8 +67,8 @@
     OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_CONSTRUCTL_ENTRY, "CUsbPnUsbSender::ConstructL" );
     C_TRACE( ( _T( "CUsbPnUsbSender::ConstructL()" ) ) );
 
-    // Create circular buffer objects
-    for(TUint i = 1; i < (KPnUsbPacketCount + 1); i++)
+    // Create circular buffer objects, start count in 1, otherwise one packet is not deleted in destructor
+    for(TUint i = 1; i < KTotalUsbPacketCount; i++)
         {
         AddPacketBufferL(i);
         }
@@ -98,7 +92,7 @@
 
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop();
+    CleanupStack::Pop( self );
 
     OstTrace1( TRACE_NORMAL, CUSBPNUSBSENDER_NEWL_EXIT, "CUsbPnUsbSender::NewL - return;self=%x", self );
     C_TRACE( ( _T( "CUsbPnUsbSender::NewL() - return 0x%x" ), self ) );
@@ -113,16 +107,8 @@
     C_TRACE( ( _T( "CUsbPnUsbSender::~CUsbPnUsbSender()" ) ) );
 
     Cancel();
-
-    // Delete circular buffer objects
-    CUsbPnPacket* packet;
-    while(iPacketCount > 0)
-        {
-        iPacketCount--;
-        packet = &iPacket->NextPacket();
-        delete iPacket;
-        iPacket = packet;
-        }
+    DeletePackets();
+    
     iCurrentPacket = NULL;
     iPacket = NULL;
 
@@ -131,77 +117,101 @@
     }
 
 // -----------------------------------------------------------------------------
+// CUsbPnUsbSender::DeletePackets
+// -----------------------------------------------------------------------------
+void CUsbPnUsbSender::DeletePackets( )
+    {
+    OstTrace0( TRACE_API, CUSBPNUSBSENDER_DELETEPACKETS_ENTRY, "CUsbPnUsbSender::DeletePackets" );
+    A_TRACE( ( _T( "CUsbPnUsbSender::DeletePackets()" ) ) );    
+    CUsbPnPacket* packet = NULL;
+    while(iPacketCount > 0)
+        {
+        iPacketCount--;
+        packet = &iPacket->NextPacket();
+        delete iPacket;
+        iPacket = packet;
+        }
+    OstTrace0( TRACE_API, CUSBPNUSBSENDER_DELETEPACKETS_EXIT, "CUsbPnUsbSender::DeletePackets - return void" );
+    A_TRACE( ( _T( "CUsbPnUsbSender::DeletePackets() - return void" ) ) );        
+    }            
+
+// -----------------------------------------------------------------------------
 // CUsbPnUsbSender::AddPacketBufferL
 // -----------------------------------------------------------------------------
-void CUsbPnUsbSender::AddPacketBufferL( TInt aIndex )
+void CUsbPnUsbSender::AddPacketBufferL( const TInt aIndex )
     {
-    OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_ADDPACKETBUFFERL_ENTRY, "CUsbPnUsbSender::AddPacketBufferL" );
-    C_TRACE((_T("CUsbPnUsbSender::AddPacketBuffer()")));
-
-    iPacketCount++;
-    iPacket = CUsbPnPacket::NewL( iPacket, aIndex );
+    OstTrace1( TRACE_NORMAL, CUSBPNUSBSENDER_ADDPACKETBUFFERL_ENTRY, "CUsbPnUsbSender::AddPacketBufferL aIndex %d", aIndex );
+    C_TRACE((_T("CUsbPnUsbSender::AddPacketBuffer() aIndex %d"), aIndex));
+        
+    if( aIndex <= KTotalUsbPacketCount )
+        {
+        iPacketCount++;
+        iPacket = CUsbPnPacket::NewL( iPacket, aIndex );
+        }       
+    else
+        {
+        TRACE_ASSERT_ALWAYS;
+        }
 
     OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_ADDPACKETBUFFERL_EXIT, "CUsbPnUsbSender::AddPacketBufferL - return void" );
     C_TRACE((_T("CUsbPnUsbSender::AddPacketBuffer - return void")));
     }
 
 // -----------------------------------------------------------------------------
-// CUsbPnUsbSender::PacketL
+// CUsbPnUsbSender::GetNextPacketL
 // -----------------------------------------------------------------------------
-CUsbPnPacket& CUsbPnUsbSender::PacketL()
+CUsbPnPacket& CUsbPnUsbSender::GetNextPacketL()
     {
-    OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_PACKETL_ENTRY, "CUsbPnUsbSender::PacketL" );
+    OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_GETNEXTPACKETL_ENTRY, "CUsbPnUsbSender::GetNextPacketL" );
     C_TRACE((_T("CUsbPnUsbSender::PacketL()")));
 
-    CUsbPnPacket& packet( iPacket->NextPacket() );
-    TBool err = packet.PacketInUse();
+    CUsbPnPacket& nextPacket( iPacket->NextPacket() );
+    TBool err = nextPacket.PacketInUse();
     if (EFalse != err)
         {
         User::Leave( err );
         }
+    OstTrace1( TRACE_NORMAL, CUSBPNUSBSENDER_GETNEXTPACKETL_EXIT, "CUsbPnUsbSender::GetNextPacketL - return;packet=%d", nextPacket.PacketNumber() );
+    C_TRACE((_T("CUsbPnUsbSender::GetNextPacketL() - return packet:%d"), nextPacket.PacketNumber()));
 
-    OstTrace1( TRACE_NORMAL, CUSBPNUSBSENDER_PACKETL_EXIT, "CUsbPnUsbSender::PacketL - return;packet=%d", packet.PacketNumber() );
-    C_TRACE((_T("CUsbPnUsbSender::PacketL() - return packet:%d"), packet.PacketNumber()));
-
-    return packet;
+    return nextPacket;
     }
 
 // -----------------------------------------------------------------------------
-// CUsbPnUsbSender::Send
-// ?implementation_description
-// (other items were commented in a header).
+// CUsbPnUsbSender::AddPacketToSendingQueue
 // -----------------------------------------------------------------------------
 //
-void CUsbPnUsbSender::Send( CUsbPnPacket& aPacket )
+void CUsbPnUsbSender::AddPacketToSendingQueue( CUsbPnPacket& aPacket )
     {
-    OstTrace0( TRACE_API, CUSBPNUSBSENDER_SEND_ENTRY, "CUsbPnUsbSender::Send" );
+    ASSERT( &aPacket );
+    OstTrace0( TRACE_API, CUSBPNUSBSENDER_ADDPACKETTOSENDINGQUEUE_ENTRY, "CUsbPnUsbSender::AddPacketToSendingQueue" );
     A_TRACE( ( _T( "CUsbPnUsbSender::Send()" ) ) );
 
     iPacket = &iPacket->NextPacket();
-    OstTrace1( TRACE_DETAILED, CUSBPNUSBSENDER_SEND, "CUsbPnUsbSender::Send;packet number:%d", iPacket->PacketNumber() );
-    E_TRACE( ( _T( "CUsbPnUsbSender::Send() - packet number:%d" ), iPacket->PacketNumber() ) );
+    OstTrace1( TRACE_DETAILED, CUSBPNUSBSENDER_ADDPACKETTOSENDINGQUEUE, "CUsbPnUsbSender::AddPacketToSendingQueue;packet number:%d", iPacket->PacketNumber() );
+    E_TRACE( ( _T( "CUsbPnUsbSender::AddPacketToSendingQueue() - packet number:%d" ), iPacket->PacketNumber() ) );
 
     TryToSendPacket( *iPacket );
 
-    OstTrace0( TRACE_API, CUSBPNUSBSENDER_SEND_EXIT, "CUsbPnUsbSender::Send - return void" );
-    A_TRACE( ( _T( "CUsbPnUsbSender::Send() - return void" ) ) );
+    OstTrace0( TRACE_API, CUSBPNUSBSENDER_ADDPACKETTOSENDINGQUEUE_EXIT, "CUsbPnUsbSender::AddPacketToSendingQueue - return void" );
+    A_TRACE( ( _T( "CUsbPnUsbSender::AddPacketToSendingQueue() - return void" ) ) );
     }
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbSender::TryToSendPacket
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbSender::TryToSendPacket( const CUsbPnPacket& aPacket )
     {
-    OstTraceExt2( TRACE_API, CUSBPNUSBSENDER_TRYTOSENDPACKET_ENTRY, "CUsbPnUsbSender::TryToSendPacket;aPacket=%d;iCurrentPacket=%d", aPacket.PacketNumber(), iCurrentPacket->PacketNumber() );
-    A_TRACE( ( _T( "CUsbPnUsbSender::TryToSendPacket( aPacketNumber:%d, iCurrentPacket:%d )" ), aPacket.PacketNumber(), iCurrentPacket->PacketNumber( ) ));
+    ASSERT( &aPacket );
+    OstTraceExt2( TRACE_API, CUSBPNUSBSENDER_TRYTOSENDPACKET_ENTRY, "CUsbPnUsbSender::TryToSendPacket;aPacket=0x%x;iCurrentPacket=%d", ( TUint )&( aPacket ), iCurrentPacket->PacketNumber() );
+    A_TRACE( ( _T( "CUsbPnUsbSender::TryToSendPacket( aPacketNumber:0x%x, iCurrentPacket:%d )" ), &aPacket, iCurrentPacket->PacketNumber( ) ));
 
     // Write message to USB
     if(!IsActive())
         {
-        if( &aPacket == &iCurrentPacket->NextPacket() || &aPacket == iCurrentPacket )
+        if( &aPacket == ( &iCurrentPacket->NextPacket() )
+            || &aPacket == iCurrentPacket )
             {
             OstTrace0( TRACE_DETAILED, CUSBPNUSBSENDER_TRYTOSENDPACKET, "CUsbPnUsbSender::TryToSendPacket - Write to socket" );
             E_TRACE( ( _T( "CUsbPnUsbSender::TryToSendPacket() - Write to socket")));
@@ -209,9 +219,7 @@
             HBufC8& data(aPacket.Buffer());
             TInt length( data.Length() );
 #ifdef EXTENDED_TRACE_FLAG
-            TInt i(0);
-
-            while(i < length )
+            for(TInt i = 0; i < length; i++)
                 {
                 OstTraceExt2( TRACE_DETAILED, CUSBPNUSBSENDER_TRYTOSENDPACKET_DUP1, "CUsbPnUsbSender::Send( [%d] = %x )", i, data[i] );
                 E_TRACE( ( _T( "CUsbPnUsbSender::Send([%d] = %x )" ), i, data[i] ) );
@@ -220,8 +228,13 @@
 #endif
 
             // ZLP flag setting is optional. Could be always true as driver checks against max packet size
-            TBool zlp( ( length != 0 ) && ( length % KPnPacketSize ) == 0 );
-
+            TBool zlp( ETrue );
+            if( length != 0 )
+                {
+                zlp = ( ( length != 0 ) && 
+                ( length % KPnPacketSize ) == 0 );
+                }
+				
             iLdd.Write( iStatus, EEndpoint1, data, length, zlp );
             SetActive();
             }
@@ -242,8 +255,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbSender::DoCancel
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbSender::DoCancel( )
@@ -257,8 +268,6 @@
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbSender::RunL
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 void CUsbPnUsbSender::RunL( )
@@ -274,20 +283,16 @@
 
     if(iCurrentPacket != iPacket)
         {
-        // Continue write
         OstTraceExt2( TRACE_DETAILED, CUSBPNUSBSENDER_RUNL, "CUsbPnUsbSender::RunL - Write next in queue;tail=%d;head=%d", iCurrentPacket->PacketNumber(), iPacket->PacketNumber() );
         E_TRACE( ( _T( "CUsbPnUsbSender::RunL() - Write next in queue tail:%d,head:%d " ), iCurrentPacket->PacketNumber(), iPacket->PacketNumber()));
         TryToSendPacket( iCurrentPacket->NextPacket() );
         }
-
     OstTrace0( TRACE_API, CUSBPNUSBSENDER_RUNL_EXIT, "CUsbPnUsbSender::RunL - return void" );
     A_TRACE( ( _T( "CUsbPnUsbSender::RunL() - return void" ) ) );
     }
 
 // -----------------------------------------------------------------------------
 // CUsbPnUsbSender::RunError
-// ?implementation_description
-// (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CUsbPnUsbSender::RunError( TInt aError )
@@ -309,17 +314,18 @@
             {
             OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_RUNERROR, "CUsbPnUsbSender::RunError - Cable detached!" );
             C_TRACE( ( _T( "CUsbPnUsbSender::RunError - Cable detached!" )));
-            aError = KErrNone;
             break;
             }
         default:
             {
             TRACE_ASSERT_ALWAYS;
+            User::Panic( KUsbPnPanicCat, aError );       
+            break;     
             }
         }
 
-    OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_RUNERROR_EXIT, "CUsbPnUsbSender::RunError - return void" );
-    C_TRACE( ( _T( "CUsbPnUsbSender::RunL() - return void" ) ) );
+    OstTrace0( TRACE_NORMAL, CUSBPNUSBSENDER_RUNERROR_EXIT, "CUsbPnUsbSender::RunError - return" );
+    C_TRACE( ( _T( "CUsbPnUsbSender::RunL() - return" ) ) );
     return KErrNone;
     }
 
--- a/layers.sysdef.xml	Fri Jan 22 10:04:04 2010 +0200
+++ b/layers.sysdef.xml	Wed Feb 17 13:58:55 2010 +0200
@@ -5,10 +5,12 @@
 
 <SystemDefinition name="modemadaptation" schema="1.4.0">
   <systemModel>
-    <layer name="adapt">
-        <module name="modemadaptation">
-                <unit name="modemadaptation_group" unitID="modemadaptation.group" bldFile="&layer_real_source_path;/group" mrp="" />
-       </module>
+    <layer name="ncp_layer">
+      <module name="corecom">
+        <component name="modemadaptation">
+          <unit unitID="modemadaptation" mrp="" bldFile="&layer_real_source_path;/group" name="modemadaptation" />
+        </component>
+      </module>
     </layer>
   </systemModel>
-</SystemDefinition>
\ No newline at end of file
+</SystemDefinition>