Revision: 201039 RCL_3 PDK_3.0.4
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 14:43:49 +0300
branchRCL_3
changeset 72 4b59561a31c0
parent 64 1934667b0e2b
Revision: 201039 Kit: 201041
bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp
bluetoothengine/bthid/keyboard/src/keyboard.cpp
bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h
bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h
bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp
bluetoothengine/btmac/src/btmonobearer/bmbcmdlistener.cpp
bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h
bluetoothengine/btnotif/inc/BTNGenericQueryNotifier.h
bluetoothengine/btnotif/inc/btnauthnotifier.h
bluetoothengine/btnotif/inc/btnenterpriseitsecurityinfonotifier.h
bluetoothengine/btnotif/inc/btninqnotifier.h
bluetoothengine/btnotif/inc/btnobexpinnotifier.h
bluetoothengine/btnotif/inc/btnotifier.h
bluetoothengine/btnotif/inc/btnotifpanic.h
bluetoothengine/btnotif/inc/btnpaireddevsettnotifier.h
bluetoothengine/btnotif/inc/btnpairnotifier.h
bluetoothengine/btnotif/inc/btnpbappinnotifier.h
bluetoothengine/btnotif/inc/btnpinnotifier.h
bluetoothengine/btnotif/inc/btnpwrnotifier.h
bluetoothengine/btnotif/inc/btnssppasskeyentrynotifier.h
bluetoothengine/btnotif/inc/btnumcmpnotifier.h
bluetoothengine/btnotif/inc/btuserconfnotifier.h
bluetoothengine/btnotif/src/BTNAuthNotifier.cpp
bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp
bluetoothengine/btnotif/src/BTNGenericQueryNotifier.cpp
bluetoothengine/btnotif/src/BTNInqNotifier.cpp
bluetoothengine/btnotif/src/BTNObexPinNotifier.cpp
bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp
bluetoothengine/btnotif/src/BTNPinNotifier.cpp
bluetoothengine/btnotif/src/BTNPwrNotifier.cpp
bluetoothengine/btnotif/src/BTNotifier.cpp
bluetoothengine/btnotif/src/btnenterpriseitsecurityinfonotifier.cpp
bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp
bluetoothengine/btnotif/src/btnpairnotifier.cpp
bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp
bluetoothengine/btnotif/src/btnumcmpnotifier.cpp
bluetoothengine/btnotif/src/btuserconfnotifier.cpp
bluetoothengine/btsac/btrcc/group/btrcc.mmp
bluetoothengine/btsac/btrcc/inc/btrccLinker.h
bluetoothengine/btsac/btrcc/inc/btrccplayerstarter.h
bluetoothengine/btsac/btrcc/src/btrccLinker.cpp
bluetoothengine/btsac/btrcc/src/btrccplayerstarter.cpp
bluetoothengine/btsac/src/btsacGavdp.cpp
bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp
bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp
bluetoothengine/btui/devmodel/src/btpairedmodel.cpp
cbsatplugin/atmisccmdplugin/data/2002C3BA.rss
cbsatplugin/atmisccmdplugin/data/2002DCE5_TDSCDMA.rss
cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp
cbsatplugin/atmisccmdplugin/group/atmisccmdplugin_td.mmp
cbsatplugin/atmisccmdplugin/group/bld.inf
cbsatplugin/atmisccmdplugin/inc/atcommandparser.h
cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h
cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h
cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cgmmcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cgmrcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cmgdcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cmgwcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/cmserror.h
cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h
cbsatplugin/atmisccmdplugin/inc/scpbrcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/scpbwcommandhandler.h
cbsatplugin/atmisccmdplugin/inc/telephonywrapper.h
cbsatplugin/atmisccmdplugin/rom/atmisccmdplugin.iby
cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp
cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp
cbsatplugin/atmisccmdplugin/src/cgmicommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cgmmcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cgmrcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cgsncommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cmgwcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/hvercommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/scpbrcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/scpbwcommandhandler.cpp
cbsatplugin/atmisccmdplugin/src/telephonywrapper.cpp
--- a/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -699,7 +699,6 @@
     TRACE_INFO( ( _L( "[CBTEngSrvSettingsMgr]\t Using HCI API v2 power manager" ) ) )
     User::LeaveIfError( iPowerMgr.Open() );
 #ifndef __WINS__
-
     TRequestStatus reqStatus;
     iPowerMgr.SetPower( EBTOff, NULL, reqStatus );
     User::WaitForRequest( reqStatus );
--- a/bluetoothengine/bthid/keyboard/src/keyboard.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/bthid/keyboard/src/keyboard.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -1189,6 +1189,17 @@
         TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::WindowGroupForKeyEvent: type %d, kc 0x%08x, sc 0x%08x, mod 0x%06x, rep %d]"),
                         aType, aKeyEvent.iCode, aKeyEvent.iScanCode,
                         aKeyEvent.iModifiers, aKeyEvent.iRepeats));
+    _LIT(KBackDrop, "*EiksrvBackdrop*");
+
+    if (EStdKeyApplication0 == aKeyEvent.iScanCode && (EEventKeyDown == aType
+            || EEventKeyUp == aType))
+        {
+        // Application key up/down events go to the Eikon server
+        // Use this old way for application key
+        TInt result = iWsSession.FindWindowGroupIdentifier(0, KBackDrop); //This was in A2.x __EIKON_SERVER_NAME
+        DBG(if (KErrNotFound == result) RDebug::Print(_L("[HID]\tCHidKeyboardDriver::WindowGroupForKeyEvent(): BackDropWindowGroup Name not found!")));
+        return result;
+        }
 
     if (EKeyDevice2 == aKeyEvent.iCode && EEventKey == aType)
         {
@@ -1369,33 +1380,7 @@
 void CHidKeyboardDriver::LaunchApplicationL(TInt aAppUid)
     {
         TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::LaunchApplication: UID 0x%08x"), aAppUid));
-    
-    //KeyLock or phone auto lock is on, refuse to continue    
-    if (iKeyLock.IsKeyLockEnabled())
-        {        
-        TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF KEYLOCK"));
-        return;
-        }
-    
-    TInt devLockStatus( EAutolockStatusUninitialized );
-    TInt err = RProperty::Get(  KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, devLockStatus );
-                    
-    if (!err)
-        {
-        if ( EAutolockOff != devLockStatus && EAutolockStatusUninitialized != devLockStatus)
-            {
-            //Auto lock is on, refuse to continue
-            TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF AUTO LOCK"));
-            return;
-            }
-        }
-    else
-        {
-        //failed to get AUTO LOCK status
-        TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF FAILED TO GET AUTO LOCK STATUS"));
-        return;
-        }
-    
+
     TApaTaskList taskList(iWsSession);
     TUid uid = TUid::Uid(aAppUid);
     TApaTask task = taskList.FindApp(uid);
@@ -1481,8 +1466,6 @@
             // fall through
         case EStdKeyF8:
             // fall through
-        case EStdKeyApplication0: 	 
-            // fall through
         case EStdKeyApplication2:
             // fall through
         case EStdKeyApplication3:
@@ -1960,15 +1943,6 @@
 
             break;
             }
-        case EStdKeyApplication0:
-			{ 	  	 
-			TRACE_INFO((_L("[HID]\tAPPLICATION KEY(Alt+Tab) >>> TSW"))); 	  	 
-					 
-			// Dedicated Application key 	  	 
-			scancode = EStdKeyApplication0; 	  	 
-			isMmKey = ETrue; 	  	 
-			break; 	  	 
-			}            
         case EStdKeyF8:
             // fall through
         case EStdKeyApplication2:
--- a/bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h	Wed Oct 13 14:43:49 2010 +0300
@@ -90,7 +90,7 @@
         RProperty iATRespProperty;
 
 		// At command buffer
-        RBuf8 iAtCmdBuf;
+		TBuf8<KDefaultCmdBufLength> iAtCmdBuf;
     };
 
 #endif
--- a/bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h	Wed Oct 13 14:43:49 2010 +0300
@@ -133,11 +133,10 @@
     MATExtObserver& iObserver;
     
     RATExt iATExtClient;
-    // reserve buffers from the heap
-    RBuf8 iCmdBuffer;
-    RBuf8 iSystemReply;
-    TBuf8<KDefaultCmdBufLength> *iRecvBuffer;
-    TBuf8<KDefaultCmdBufLength> *iReplyBuffer;
+    TBuf8<KDefaultCmdBufLength> iCmdBuffer;
+    TBuf8<KDefaultCmdBufLength> iRecvBuffer;
+    TBuf8<KDefaultCmdBufLength> iReplyBuffer;
+    TBuf8<512> iSystemReply;
     
     TInt iRemainingReplyLength;
     TPckg<TInt> iRemainingReplyLengthPckg;
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -49,24 +49,20 @@
         {
         iATExtClient.Close();
         }
-   iCmdBuffer.Close();
-   iSystemReply.Close();
-   delete iRecvBuffer;
-   delete iReplyBuffer;
 }
 
 void CHFPAtCmdHandler::HandleCommand(const TDesC8& aAT, const TDesC8& aReply)
     {
     TRACE_INFO((_L8("default reply '%S'"), &aReply))
     iCmdBuffer.Copy(aAT);
-    iReplyBuffer->Zero();
+    iReplyBuffer.Zero();
     if (aReply.Length())
         {
-        iReplyBuffer->Copy(aReply);
+        iReplyBuffer.Copy(aReply);
         iSystemReply.Copy(aReply);
-        } 
+        }
     iATExtClient.HandleCommand(iCommander->iStatus, 
-            iCmdBuffer, *iReplyBuffer, iRemainingReplyLengthPckg, iReplyTypePckg);
+            iCmdBuffer, iReplyBuffer, iRemainingReplyLengthPckg, iReplyTypePckg);
     iCommander->GoActive(); 
     }
 
@@ -83,16 +79,16 @@
                 if (iRemainingReplyLengthPckg())
                     {
                     TRACE_INFO((_L8("reply '%S'"), &iReplyBuffer))
-                    iObserver.ATExtHandleReplyReceivedL(err, *iReplyBuffer);
+                    iObserver.ATExtHandleReplyReceivedL(err, iReplyBuffer);
                     do 
                         {
                         TRACE_INFO((_L8("iRemainingReplyLength '%d'"), iRemainingReplyLengthPckg()))
                         RBuf8 reply;
                         reply.CreateL(iRemainingReplyLengthPckg());
-                        err = iATExtClient.GetNextPartOfReply(*iRecvBuffer, iRemainingReplyLengthPckg());
+                        err = iATExtClient.GetNextPartOfReply(iRecvBuffer, iRemainingReplyLengthPckg());
                         if (!err)
                             {
-                            reply.Insert(0, *iRecvBuffer);
+                            reply.Insert(0, iRecvBuffer);
                             }
                         TRACE_INFO((_L8("reply '%S'"), &reply))
                         iObserver.ATExtHandleReplyReceivedL(err, reply);
@@ -102,8 +98,8 @@
                     }
                 else
                     {
-                    TRACE_INFO((_L8("reply '%S'"), iReplyBuffer))
-                    iObserver.ATExtHandleReplyReceivedL(err, *iReplyBuffer);
+                    TRACE_INFO((_L8("reply '%S'"), &iReplyBuffer))
+                    iObserver.ATExtHandleReplyReceivedL(err, iReplyBuffer);
                     }
                 }
             else
@@ -163,10 +159,6 @@
     
     StartUrc();
     iCommander = CBtmcActive::NewL(*this, CActive::EPriorityStandard, EHandleCommandRequest);
-    iCmdBuffer.CreateL(KDefaultCmdBufLength);
-    iRecvBuffer = new (ELeave) TBuf8<KDefaultCmdBufLength>();
-    iReplyBuffer = new (ELeave) TBuf8<KDefaultCmdBufLength>();
-    iSystemReply.CreateL(KDefaultUrcBufLength);
     TRACE_FUNC_EXIT
     }
     
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -94,15 +94,13 @@
             TInt result = KErrNone;
             if (!aErr)
                 {
-                RBuf8 buf;
-                buf.CreateL(KDefaultCmdBufLength);
+                TBuf8<KDefaultCmdBufLength> buf;
                 aErr = iRespProperty.Get(buf);
                 if (!aErr && buf.Length() >= sizeof(TInt))
                     {
                     const TUint8* ptr = buf.Ptr();
                     result = *((const TInt*)ptr);
                     }
-                buf.Close();
                 }
             TRACE_INFO((_L("resp %d"), result))
             TATId atid = EATOK;
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -399,23 +399,21 @@
         {
         return;
         }
-    RBuf8 cmddes;
-    cmddes.CreateL(KDefaultCmdBufLength);
-    CleanupClosePushL(cmddes);
-    if (iInDataBuf.NextCommand(cmddes) || cmddes.Length() == 0)
+    TBuf8<KDefaultCmdBufLength> cmddes;
+    if (iInDataBuf.NextCommand(cmddes))
         {
-        CleanupStack::PopAndDestroy(&cmddes);
         return;
         }
-    
+    if (cmddes.Length() == 0)
+        {
+        return;
+        }
     TRACE_INFO_SEG(
         {
-        RBuf8 buf;
-        buf.CreateL(KDefaultCmdBufLength);
+        TBuf8<KDefaultCmdBufLength> buf;
         buf = cmddes;
         buf.Trim();
         Trace(_L8("[HFP] [I] %S"), &buf);
-        buf.Close();
         })
 
     CATCommand* cmd = NULL;
@@ -425,16 +423,13 @@
       	if(iAtExt)
         	{
       		iAtExt->HandleCommand(cmddes, _L8("\n\rERROR\n\r"));
-      		CleanupStack::PopAndDestroy(&cmddes);
         	return;
         	}
         CATResult* nok = CATResult::NewLC(EATERROR);
         SendResponseL(*nok);
         CleanupStack::PopAndDestroy(nok);
-        CleanupStack::PopAndDestroy(&cmddes);
         return;
         }
-    CleanupStack::PopAndDestroy(&cmddes);
     CleanupStack::PushL(cmd);
     iHandleCmdPending = ETrue;
 	TATId id = cmd->Id();
@@ -1085,17 +1080,14 @@
     {
     TRACE_INFO((_L("credit %d"), iCredit))
     TInt count = iOutgoPacketQueue->MdcaCount();
-    RBuf8 buf;
-    buf.CreateL(KDefaultCmdBufLength);
-    CleanupClosePushL(buf);
     for (TInt i = 0; iCredit >0 && i < count; i++)
         {
         iCredit--;
+        TBuf8<KDefaultCmdBufLength> buf;
         buf.Copy(iOutgoPacketQueue->MdcaPoint(0));
         iObserver.SendProtocolDataL(buf);
         iOutgoPacketQueue->Delete(0);
         }
-    CleanupStack::PopAndDestroy(&buf);
     }
 
 void CBtmcProtocol::StartTimerL(TInt aService, TInt aTimeout)
--- a/bluetoothengine/btmac/src/btmonobearer/bmbcmdlistener.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btmac/src/btmonobearer/bmbcmdlistener.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -35,7 +35,6 @@
    	Cancel();
    	iATCmdProperty.Close();
    	iATRespProperty.Close();
-   	iAtCmdBuf.Close();
     }
 
 // ---------------------------------------------------------------------------
@@ -61,7 +60,6 @@
 	TRACE_FUNC
     LEAVE_IF_ERROR(iATCmdProperty.Attach(KPSUidBluetoothEnginePrivateCategory, KBTHfpATCommand));
 	LEAVE_IF_ERROR(iATRespProperty.Attach(KPSUidBluetoothEnginePrivateCategory, KBTHfpATResponse));
-	iAtCmdBuf.CreateL(KDefaultCmdBufLength);
 	Subscribe();
     }
 
--- a/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -58,15 +58,15 @@
         TPtrC8 StartL(const TDesC8& aBuffer );
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
  
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/BTNGenericQueryNotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/BTNGenericQueryNotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -59,16 +59,17 @@
 	 */
 	TPtrC8 StartL(const TDesC8& aBuffer);
 
-    /**
-    * From CBTNotifierBase
-    * Used in asynchronous notifier launch to start the actual processing
-    * of parameters received in StartL. StartL just stores a copy of the
-    * parameter buffer, schedules a callback to call this method and returns
-    * ASAP, so the actual work begins here, safely outside of the StartL
-    * context so that waiting dialogs can be freely used if need be.
-    * @return None.
-    */
-	void ProcessStartParamsL();
+	/**
+	 * From CBTNotifierBase Used in asynchronous notifier launch to
+	 * store received parameters into members variables and
+	 * make needed initializations.
+	 * @param aBuffer A buffer containing received parameters
+	 * @param aReturnVal The return value to be passed back.
+	 * @param aMessage Should be completed when the notifier is deactivated.
+	 * @return None.
+	 */
+	void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
+			const RMessagePtr2& aMessage);
 
 	/**
 	 * From CBTNotifierBase Updates a currently active notifier.
--- a/bluetoothengine/btnotif/inc/btnauthnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnauthnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -68,16 +68,17 @@
         */
         void Cancel();
 
+        
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
 
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/btnenterpriseitsecurityinfonotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnenterpriseitsecurityinfonotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -50,16 +50,16 @@
 	*/
 	TPtrC8 StartL(const TDesC8& aBuffer);
 
-    /**
-    * From CBTNotifierBase
-    * Used in asynchronous notifier launch to start the actual processing
-    * of parameters received in StartL. StartL just stores a copy of the
-    * parameter buffer, schedules a callback to call this method and returns
-    * ASAP, so the actual work begins here, safely outside of the StartL
-    * context so that waiting dialogs can be freely used if need be.
-    * @return None.
-    */
-	void ProcessStartParamsL();
+	/**
+	* From CBTNotifierBase Used in asynchronous notifier launch to 
+	* store received parameters into members variables and 
+	* make needed initializations.
+	* @param aBuffer A buffer containing received parameters
+	* @param aReturnVal The return value to be passed back.
+	* @param aMessage Should be completed when the notifier is deactivated.
+	* @return None.
+	*/
+	void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
 
 	/**
 	* From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/btninqnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btninqnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -63,15 +63,15 @@
         void Cancel();
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
 		
         /**
          * From MBTNDeviceSearchObserver Called when device search and selection completes.
--- a/bluetoothengine/btnotif/inc/btnobexpinnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnobexpinnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -51,15 +51,15 @@
         TNotifierInfo RegisterL();
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
                
     private:
 
--- a/bluetoothengine/btnotif/inc/btnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -89,14 +89,16 @@
         virtual void ConstructL();
 
         /**
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * Used in asynchronous notifier launch to store received parameters
+        * into members variables and make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        virtual void ProcessStartParamsL() = 0;
+        virtual void GetParamsL(const TDesC8& aBuffer,
+                                TInt aReplySlot,
+                                const RMessagePtr2& aMessage)=0;
 
         /**
         * A utility function for setting the power status of Bluetooth.
@@ -280,28 +282,24 @@
          */
         TBool CheckQueryInterval();
 
-        static TInt ProcessStartParamsCallBack(TAny* aNotif);
-
     protected: // Data
 
         RMessagePtr2                iMessage;               // Received message
         TInt                        iReplySlot;             // Reply slot
-        HBufC8*                     iParamBuffer;           // Copy of the param buffer received in StartL
-
-        CAsyncCallBack*             iProcessStartParamsCallBack;
-
         TNotifierInfo               iInfo;                  // Notifier parameters structure
         TBTRegistryQueryState       iBTRegistryQueryState;
         CBTDeviceArray*             iDeviceArray;  // for getting device from registry
         CBTDevice*                  iDevice;                // Current Bluetooth device
         TBTDevAddr                  iBTAddr; // Gotten from PckBuffer, constant no matter how iDevice changes.
         CBTNotifUIUtil*             iNotifUiUtil;           // Utility to show UI notes & queries
-        CBTNotifUIUtil*             iAuthoriseDialog;       // to show Authorisation dialogs
         CBTEngSettings*             iBTEngSettings;
         TBool                       iIsCoverUI;
 
     private:
         CBTEngDevMan*               iDevMan;  // for BT registry manipulation
+
+
+
     };
 
 #endif
--- a/bluetoothengine/btnotif/inc/btnotifpanic.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnotifpanic.h	Wed Oct 13 14:43:49 2010 +0300
@@ -22,10 +22,7 @@
 
 enum TBtNotifPanic
     {
-    EiDeviceNullWhenCallingGetDeviceFromRegL    = 0,
-    EiParamBufferLeakedFromPreviousActivation   = 1,
-    EiParamBufferNullInProcessStartParams       = 2,
-    EiMessageNullInProcessStartParams           = 3,
+    EiDeviceNullWhenCallingGetDeviceFromRegL = 0,
     };
 
 template <typename XAny>
--- a/bluetoothengine/btnotif/inc/btnpaireddevsettnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnpaireddevsettnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -58,15 +58,15 @@
         void Cancel();        
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
 
 		/**
         * From CBTNotifierBase Updates a currently active notifier.
--- a/bluetoothengine/btnotif/inc/btnpairnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnpairnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -46,15 +46,15 @@
         virtual TNotifierInfo RegisterL();
         
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        virtual void ProcessStartParamsL();
+        virtual void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
         
         virtual void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
         
--- a/bluetoothengine/btnotif/inc/btnpbappinnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnpbappinnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -51,15 +51,15 @@
         TNotifierInfo RegisterL();
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
         
     private:
 
--- a/bluetoothengine/btnotif/inc/btnpinnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnpinnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -53,15 +53,15 @@
         TNotifierInfo RegisterL();
         
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters
 
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/btnpwrnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnpwrnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -55,15 +55,15 @@
         TNotifierInfo RegisterL();
 
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
 
     private:
 
--- a/bluetoothengine/btnotif/inc/btnssppasskeyentrynotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnssppasskeyentrynotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -60,15 +60,15 @@
         TPtrC8 UpdateL(const TDesC8& aBuffer);                         
                
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
-        * @return None.
-        */
-        void ProcessStartParamsL();
+         * From CBTNotifierBase Used in asynchronous notifier launch to 
+         * store received parameters into members variables and 
+         * make needed initializations.
+         * @param aBuffer A buffer containing received parameters
+         * @param aReturnVal The return value to be passed back.
+         * @param aMessage Should be completed when the notifier is deactivated.
+         * @return None.
+         */
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters
 
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/btnumcmpnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnumcmpnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -57,15 +57,15 @@
 
         
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters
                                          
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/inc/btuserconfnotifier.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btuserconfnotifier.h	Wed Oct 13 14:43:49 2010 +0300
@@ -90,15 +90,15 @@
 
         
         /**
-        * From CBTNotifierBase
-        * Used in asynchronous notifier launch to start the actual processing
-        * of parameters received in StartL. StartL just stores a copy of the
-        * parameter buffer, schedules a callback to call this method and returns
-        * ASAP, so the actual work begins here, safely outside of the StartL
-        * context so that waiting dialogs can be freely used if need be.
+        * From CBTNotifierBase Used in asynchronous notifier launch to 
+        * store received parameters into members variables and 
+        * make needed initializations.
+        * @param aBuffer A buffer containing received parameters
+        * @param aReturnVal The return value to be passed back.
+        * @param aMessage Should be completed when the notifier is deactivated.
         * @return None.
         */
-        void ProcessStartParamsL();
+        void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters
                                          
         /**
         * From CBTNotifierBase
--- a/bluetoothengine/btnotif/src/BTNAuthNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNAuthNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -107,14 +107,22 @@
     }
 
 // ----------------------------------------------------------
-// CBTAuthNotifier::ProcessStartParamsL
+// CBTAuthNotifier::GetParamsL
 // Initialize parameters and check if device is already
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTAuthNotifier::ProcessStartParamsL()
+void CBTAuthNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL()"));
+
+    if( !iMessage.IsNull())
+        {
+        User::Leave(KErrInUse);
+        }
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
 
     if ( AutoLockOnL() )
         {
@@ -126,7 +134,7 @@
     
     TBTAuthorisationParams param;
     TPckgC<TBTAuthorisationParams> pckg(param);
-    pckg.Set(*iParamBuffer);
+    pckg.Set(aBuffer);
 
     iServiceUid = pckg().iUid.iUid;  // Pick up service uid from message
     iBTAddr = pckg().iBDAddr;
@@ -163,13 +171,13 @@
         }
 
 #ifdef _DEBUG
-    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::ProcessStartParamsL() Executing authorisation..."));
+    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL() Executing authorisation..."));
     TBuf<12> deviceAddressString;
     pckg().iBDAddr.GetReadable(deviceAddressString);
     FTRACE(FPrint(_L("[BTNOTIF]\t  BT Address: %S"), &deviceAddressString));
-    FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::ProcessStartParamsL Service Uid: %d = 0x%X"), iServiceUid, iServiceUid ));
+    FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL Service Uid: %d = 0x%X"), iServiceUid, iServiceUid ));
 #endif
-    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::ProcessStartParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -97,14 +97,22 @@
     }
 
 // ----------------------------------------------------------
-// CBTGenericInfoNotifier::ProcessStartParamsL
+// CBTGenericInfoNotifier::GetParamsL
 // Mandatory for BT Notifiers when using asynchronous launch. 
 // ----------------------------------------------------------
 //
-void CBTGenericInfoNotifier::ProcessStartParamsL()
+void CBTGenericInfoNotifier::GetParamsL(const TDesC8& aBuffer, 
+                                     TInt /*aReplySlot*/, 
+                                     const RMessagePtr2& aMessage )
     {
-	FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::ProcessStartParamsL"));  
- 	ProcessParamBufferL(*iParamBuffer, EFalse);
+	FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::GetParamsL"));  
+	if (!iMessage.IsNull())
+	    {
+	    aMessage.Complete(KErrInUse);
+	    return;
+	    }
+    iMessage = aMessage;
+ 	ProcessParamBufferL(aBuffer, EFalse);
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNGenericQueryNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNGenericQueryNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -135,20 +135,31 @@
     }
 
 // ----------------------------------------------------------
-// CBTGenericQueryNotifier::ProcessStartParamsL
+// CBTGenericQueryNotifier::GetParamsL
 // Mandatory for BT Notifiers when using asynchronous launch.
 // This notifier is synchronous so no implementation is needed.
 // ----------------------------------------------------------
 //
-void CBTGenericQueryNotifier::ProcessStartParamsL()
+void CBTGenericQueryNotifier::GetParamsL(const TDesC8& aBuffer,
+                                     TInt aReplySlot,
+                                     const RMessagePtr2& aMessage)
     {
-   	FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::ProcessStartParamsL"));
+   	FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::GetParamsL"));
 
-	ProcessParamBufferL(*iParamBuffer);
+   	if (iMessage.Handle())
+   	    {
+   	    aMessage.Complete(KErrInUse);
+   	    return;
+   	    }
+
+	ProcessParamBufferL(aBuffer);
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
 
     ShowQueryAndCompleteL();
 
-   	FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::ProcessStartParamsL Complete"));
+   	FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::GetParamsL Complete"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNInqNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNInqNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -77,21 +77,30 @@
     }
 
 // ----------------------------------------------------------
-// CBTInqNotifier::ProcessStartParamsL
+// CBTInqNotifier::GetParamsL
 // Initialize parameters and launch device search.
 // ----------------------------------------------------------
 //
-void CBTInqNotifier::ProcessStartParamsL()
+void CBTInqNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTInqNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTInqNotifier::GetParamsL()"));
 
+    if( !iMessage.IsNull() )
+        {
+        aMessage.Complete(KErrInUse);
+        return;
+        }
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
     TBTDeviceClass cod;
     TBTDeviceSelectionParamsPckg pckg;
-    pckg.Copy(*iParamBuffer); 
+    pckg.Copy(aBuffer); 
 
     LaunchInquiryL(pckg().DeviceClass());
     
-    FLOG(_L("[BTNOTIF]\t CBTInqNotifier::ProcessStartParamsL() completed "));
+    FLOG(_L("[BTNOTIF]\t CBTInqNotifier::GetParamsL() completed "));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNObexPinNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNObexPinNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -72,13 +72,21 @@
     }
 
 // ----------------------------------------------------------
-// CBTObexPinNotifier::ProcessStartParamsL
+// CBTObexPinNotifier::GetParamsL
 // Initialize parameters. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTObexPinNotifier::ProcessStartParamsL()
+void CBTObexPinNotifier::GetParamsL(const TDesC8& /* aBuffer */, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::GetParamsL()"));
+
+    if( !iMessage.IsNull())
+        {
+        User::Leave(KErrInUse);
+        }
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
 
     if ( AutoLockOnL() )
         {
@@ -90,7 +98,7 @@
  
     ShowNoteCompleteMessageL();
 
-    FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::ProcessStartParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -80,14 +80,22 @@
     }
 
 // ----------------------------------------------------------
-// CBTPBAPPinNotifier::ProcessStartParamsL
+// CBTPBAPPinNotifier::GetParamsL
 // Initialize parameters. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTPBAPPinNotifier::ProcessStartParamsL()
+void CBTPBAPPinNotifier::GetParamsL(const TDesC8& /* aBuffer */, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL()"));
 
+    if( !iMessage.IsNull())
+        {
+        User::Leave(KErrInUse);
+        }
+    
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
     if ( AutoLockOnL() )
         {
         // The phone is locked, access denied.
@@ -98,7 +106,7 @@
 
     ShowNoteCompleteMessageL();
 
-    FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ProcessStartParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNPinNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNPinNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -99,15 +99,15 @@
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTPinNotifier::ProcessStartParamsL()
+void CBTPinNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTPinNotifier::ProcessStartParamsL() >>"));
+    FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GetParamsL() >>"));
 
-    CBTNPairNotifierBase::ProcessStartParamsL();
+    CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
 
     TBTPinCodeEntryNotifierParams param;
  	TPckgC<TBTPinCodeEntryNotifierParams> pckg(param);
- 	pckg.Set(*iParamBuffer);
+ 	pckg.Set(aBuffer);
 
     iBTAddr = pckg().DeviceAddress();
     if ( OtherOutgoPairing(iBTAddr) )
@@ -123,7 +123,7 @@
     iStrongPinRequired = pckg().StrongPinCodeRequired();
     ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
     
-    FLOG(_L("[BTNOTIF]\t CBTPinNotifier::ProcessStartParamsL() <<"));
+    FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GetParamsL() <<"));
     }
 
 // ----------------------------------------------------------
@@ -263,7 +263,6 @@
                 aRBuf, R_BT_MIN_PASSKEY_PROMPT, devName, 1 );
 
         RBuf tmpBuf;
-        tmpBuf.CreateL( aRBuf.MaxLength() );
         tmpBuf.CleanupClosePushL();
         tmpBuf.Swap( aRBuf );
         aRBuf.ReAllocL( aRBuf.MaxLength() + sizeof(TUint));
--- a/bluetoothengine/btnotif/src/BTNPwrNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNPwrNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -72,16 +72,22 @@
     }
 
 // ----------------------------------------------------------
-// CBTPwrNotifier::ProcessStartParamsL
+// CBTPwrNotifier::GetParamsL
 // Initialize parameters. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTPwrNotifier::ProcessStartParamsL()
+void CBTPwrNotifier::GetParamsL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL()"));
+
+    if( iReplySlot!=NULL || !iMessage.IsNull() )
+        User::Leave(KErrInUse);
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
 
     ShowNoteAndCompleteMessageL();
-    FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ProcessStartParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/BTNotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -93,10 +93,6 @@
     iBTEngSettings = CBTEngSettings::NewL();
     iDevMan = CBTEngDevMan::NewL( this );
     iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI );
-    iAuthoriseDialog = CBTNotifUIUtil::NewL( iIsCoverUI );
-
-    TCallBack processParamsCb(ProcessStartParamsCallBack, this);
-    iProcessStartParamsCallBack = new (ELeave) CAsyncCallBack(processParamsCb, CActive::EPriorityHigh);
     }
 
 // ----------------------------------------------------------
@@ -107,8 +103,6 @@
     {
     FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase()"));    
     Cancel();
-
-    delete iProcessStartParamsCallBack;
     FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase() -- Done"));    
     }
 
@@ -151,31 +145,16 @@
 //
 void CBTNotifierBase::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    if (!iMessage.IsNull())
-        {
-        // We're already active. The notifier server will complete the message if we leave.
-        User::Leave(KErrInUse);
-        }
-
-    __ASSERT_DEBUG(!iParamBuffer, BTNOTIF_PANIC(EiParamBufferLeakedFromPreviousActivation));
-
     if( !iNotifUiUtil )
         {
         iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI );    
         }
-    if( !iAuthoriseDialog )
+    
+    TRAPD(err, GetParamsL(aBuffer, aReplySlot, aMessage));
+    if (err)
         {
-        iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI );    
+        CompleteMessage(err);
         }
-
-    iParamBuffer    = aBuffer.AllocL(); // ProcessStartParamsCallBack responsible for deallocation
-    iMessage        = aMessage;
-    iReplySlot      = aReplySlot;
-
-    // Return from StartL as soon as possible - processing the parameters involves displaying
-    // waiting dialogs which would block the notifier server thus preventing other notifiers
-    // from running, were we to do it from here.
-    iProcessStartParamsCallBack->CallBack();
     }
 
 // ----------------------------------------------------------
@@ -187,23 +166,9 @@
     {
     FLOG(_L("[BTNOTIF]\t CBTNotifierBase::Cancel()"));    
 
-    // In case we are being called before ProcessStartParamsCallBack
-    // had a chance to run:
-    delete iParamBuffer;
-    iParamBuffer = NULL;
-
-    if (iProcessStartParamsCallBack)
-        {
-        iProcessStartParamsCallBack->Cancel();
-        // - the callback object is deleted in the destructor.
-        }
-
     delete iNotifUiUtil;
     iNotifUiUtil = NULL;
     
-    delete iAuthoriseDialog;
-    iAuthoriseDialog = NULL;
-    
 	delete iBTEngSettings;
     iBTEngSettings = NULL;
 
@@ -234,25 +199,6 @@
     return (ret);
     }
 
-TInt CBTNotifierBase::ProcessStartParamsCallBack(TAny* aNotif)
-    {
-    CBTNotifierBase* notif = static_cast<CBTNotifierBase*>(aNotif);
-
-    __ASSERT_DEBUG(notif->iParamBuffer, BTNOTIF_PANIC(EiParamBufferNullInProcessStartParams));
-    __ASSERT_DEBUG(!notif->iMessage.IsNull(), BTNOTIF_PANIC(EiMessageNullInProcessStartParams));
-
-    TRAPD(err, notif->ProcessStartParamsL());
-    if (err)
-        {
-        notif->CompleteMessage(err);
-        }
-
-    delete notif->iParamBuffer;
-    notif->iParamBuffer = NULL;
-
-    return 0;
-    }
-
 
 // ----------------------------------------------------------
 // CBTNotifierBase::AutoLockOnL
--- a/bluetoothengine/btnotif/src/btnenterpriseitsecurityinfonotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnenterpriseitsecurityinfonotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -94,11 +94,13 @@
     }
 
 // ----------------------------------------------------------
-// CBTEnterpriseItSecurityInfoNotifier::ProcessStartParamsL
+// CBTEnterpriseItSecurityInfoNotifier::GetParamsL
 // Mandatory for BT Notifiers when using asynchronous launch. 
 // ----------------------------------------------------------
 //
-void CBTEnterpriseItSecurityInfoNotifier::ProcessStartParamsL()
+void CBTEnterpriseItSecurityInfoNotifier::GetParamsL(const TDesC8& /*aBuffer*/,
+										 TInt /*aReplySlot*/,
+										 const RMessagePtr2& /*aMessage*/)
     {
     //nothing to do here
     }
--- a/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -86,18 +86,27 @@
 
 
 // ----------------------------------------------------------
-// CBTPairedDevSettNotifier::ProcessStartParamsL
+// CBTPairedDevSettNotifier::GetParamsL
 // Mandatory for BT Notifiers when using asynchronous launch. 
 // This notifier is synchronous so no implementation is needed.
 // ----------------------------------------------------------
 //
-void CBTPairedDevSettNotifier::ProcessStartParamsL()
+void CBTPairedDevSettNotifier::GetParamsL(const TDesC8& aBuffer, 
+                                     TInt aReplySlot, 
+                                     const RMessagePtr2& aMessage)
     {
-   	FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::ProcessStartParamsL"));    
+   	FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::GetParamsL"));    
 
-	ProcessParamBufferL(*iParamBuffer); 
+    if( iReplySlot != NULL || !iMessage.IsNull())
+        {
+        User::Leave(KErrInUse);
+        }
 
-	FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::ProcessStartParamsL Complete"));    
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+	ProcessParamBufferL(aBuffer); 
+
+	FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::GetParamsL Complete"));    
   	}
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/btnpairnotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnpairnotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -70,17 +70,27 @@
     }
 
 // ----------------------------------------------------------
-// CBTNPairNotifierBase::ProcessStartParamsL
+// CBTNPairNotifierBase::GetParamsL
 // ----------------------------------------------------------
 //
-void CBTNPairNotifierBase::ProcessStartParamsL()
+void CBTNPairNotifierBase::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
+    (void)aBuffer;
+    if( !iMessage.IsNull() )
+        {
+        User::Leave(KErrInUse);
+        }
+
+    iMessage = (RMessage2)aMessage;
+    iReplySlot = aReplySlot;
+
     if ( AutoLockOnL() )
         {
         // The phone is locked, access denied.
         //
         CompleteMessage(KErrCancel);
         }
+
     }
 
 // ----------------------------------------------------------
@@ -115,23 +125,13 @@
         BtNotifNameUtils::SetDeviceNameL(pckg().DeviceName(), *iDevice);
 
     // Finally show new prompt for dialog if it is still on the screen
-    // and user has not given a alias for device.
-        CBTNotifUIUtil* dialog = NULL;
-        if ( !iNotifUiUtil->IsQueryReleased())
-            {
-            dialog = iNotifUiUtil;
-            }
-        else if ( !iAuthoriseDialog->IsQueryReleased())
-            {
-            dialog = iAuthoriseDialog;
-            }
-                    
-        if( dialog && !iDevice->IsValidFriendlyName() )
+    // and user has not given a alias for device.   
+        if( !iNotifUiUtil->IsQueryReleased() && !iDevice->IsValidFriendlyName() )
             {
             RBuf prompt;
             prompt.CleanupClosePushL();
             GenerateQueryPromptL( prompt );
-            dialog->UpdateQueryDlgL( prompt );
+            iNotifUiUtil->UpdateQueryDlgL( prompt );
             CleanupStack::PopAndDestroy( &prompt );
             }
         }
@@ -213,9 +213,8 @@
 
     devName.Zero();
     // Show query for use to accept/reject incoming pairing request
-    TInt keypress = iAuthoriseDialog->ShowQueryL( prompt, R_BT_GENERIC_QUERY, 
-             ECmdBTnotifUnavailable, devName, CAknQueryDialog::EConfirmationTone);
-    
+    TInt keypress = iNotifUiUtil->ShowQueryL( prompt, R_BT_GENERIC_QUERY, 
+             ECmdBTnotifUnavailable, devName, CAknQueryDialog::EConfirmationTone );
     CleanupStack::PopAndDestroy( &prompt );
 
     if( iMessage.IsNull() ) // cancelled by the stack
--- a/bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -42,8 +42,6 @@
 #include <csxhelp/bt.hlp.hrh> // The bt hrh info is needed, for help launching
 #endif
 
-// ================= CONSTANT =======================
-const TInt KMaxPasskeyLength = 16;
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -94,19 +92,19 @@
     }
 
 // ----------------------------------------------------------
-// CBTSSPPasskeyEntryNotifier::ProcessStartParamsL
+// CBTSSPPasskeyEntryNotifier::GetParamsL
 // Initialize parameters and check if device is already
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()
+void CBTSSPPasskeyEntryNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL()"));
 
-    CBTNPairNotifierBase::ProcessStartParamsL();
+    CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
     
     TBTPasskeyDisplayParamsPckg pckg;
-    pckg.Copy(*iParamBuffer);
+    pckg.Copy(aBuffer);
     iBTAddr = pckg().DeviceAddress();
     if ( OtherOutgoPairing(iBTAddr) )
         {
@@ -122,7 +120,7 @@
 
     ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
     
-    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::ProcessStartParamsL() completed"));
+    FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
@@ -137,19 +135,8 @@
     
     TBTPasskeyDisplayUpdateParamsPckg pckg;
     pckg.Copy(aBuffer);
-    
-    // Update devicename if needed
-    CBTNPairNotifierBase::UpdateL(aBuffer);
-        
-    if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay 
-       || !iAuthoriseDialog->IsQueryReleased())
-        {
-        TPtrC8 ret(KNullDesC8);
-        return (ret);
-        }
-    
-    TInt length = iBuf.Length();
-    if (length > KMaxPasskeyLength )
+  
+    if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay)
         {
         TPtrC8 ret(KNullDesC8);
         return (ret);
@@ -173,10 +160,7 @@
         case EPasskeyDigitDeleted:
             {
             // remove an '*' from the tail of iBuf
-            if ( length )
-                {
-                iBuf.Delete(iBuf.Length()-1, 1);
-                }
+            iBuf.Delete(iBuf.Length()-1, 1);  
             break;
             }
         case EPasskeyCleared:
--- a/bluetoothengine/btnotif/src/btnumcmpnotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnumcmpnotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -90,19 +90,19 @@
     }
 
 // ----------------------------------------------------------
-// CBTNumCmpNotifier::ProcessStartParamsL
+// CBTNumCmpNotifier::GetParamsL
 // Initialize parameters and check if device is already
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTNumCmpNotifier::ProcessStartParamsL()
+void CBTNumCmpNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GetParamsL()"));
 
-    CBTNPairNotifierBase::ProcessStartParamsL();
+    CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
     
     TBTNumericComparisonParamsPckg pckg;
- 	pckg.Copy(*iParamBuffer);
+ 	pckg.Copy(aBuffer);
  	iBTAddr = pckg().DeviceAddress();
     if ( OtherOutgoPairing( iBTAddr) )
         {
@@ -120,7 +120,7 @@
 	// base class
 	ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
 	
-	FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::ProcessStartParamsL() completed"));
+	FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btnotif/src/btuserconfnotifier.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btnotif/src/btuserconfnotifier.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -90,19 +90,19 @@
     }
 
 // ----------------------------------------------------------
-// CBTUserConfNotifier::ProcessStartParamsL
+// CBTUserConfNotifier::GetParamsL
 // Initialize parameters and check if device is already
 // in registry. Jump to RunL as soon as possible.
 // ----------------------------------------------------------
 //
-void CBTUserConfNotifier::ProcessStartParamsL()
+void CBTUserConfNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
     {
-    FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::ProcessStartParamsL()"));
+    FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::GetParamsL()"));
 
-    CBTNPairNotifierBase::ProcessStartParamsL();
+    CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage );
     
     TBTUserConfirmationParamsPckgCopy pckg;
- 	pckg.Copy(*iParamBuffer);
+ 	pckg.Copy(aBuffer);
  	iBTAddr = pckg().DeviceAddress();
     if ( OtherOutgoPairing( iBTAddr) )
         {
@@ -117,7 +117,7 @@
 	// base class
 	ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() );
 	
-	FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::ProcessStartParamsL() completed"));
+	FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::GetParamsL() completed"));
     }
 
 // ----------------------------------------------------------
--- a/bluetoothengine/btsac/btrcc/group/btrcc.mmp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/group/btrcc.mmp	Wed Oct 13 14:43:49 2010 +0300
@@ -39,6 +39,7 @@
 SOURCE	btrccLinker.cpp
 SOURCE	btrccPlugin.cpp
 SOURCE	btrccAbsoluteVolumeLevelController.cpp 
+SOURCE	btrccplayerstarter.cpp
 SOURCE	btrccBrowsingAdapter.cpp
 SOURCE	btrccLegacyVolumeLevelController.cpp
 SOURCE	btrccVolumeLevelControllerBase.cpp
--- a/bluetoothengine/btsac/btrcc/inc/btrccLinker.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccLinker.h	Wed Oct 13 14:43:49 2010 +0300
@@ -45,6 +45,8 @@
 class CRemConInterfaceSelector;
 class CRemConCoreApiController;
 class CBTRCCVolumeLevelController;
+class CRemConCoreApiTarget;
+class CPlayerStarter;
 class CBTRCCBrowsingAdapter;
 
 // CLASS DECLARATION
@@ -291,6 +293,10 @@
 		
 		// For receiving the accessory battery status
         CRemConBatteryApiTarget *iRemConBatteryTgt;
+        
+	    CRemConCoreApiTarget* iCoreTarget; // not own
+	    
+	    CPlayerStarter* iPlayerStarter; // owned
 	    
         // For handling the browsing commands. 
 	    CBTRCCBrowsingAdapter *iBrowsingAdapter;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btsac/btrcc/inc/btrccplayerstarter.h	Wed Oct 13 14:43:49 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   This class implements starting Music play	
+*
+*
+*/
+
+
+#ifndef BTRCCPLAYERSTATER_H
+#define BTRCCPLAYERSTATER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <remconcoreapitargetobserver.h>
+
+// FORWARD DECLARATIONS
+class CRemConCoreApiTarget;
+
+/**
+*  This class listens to AVRCP PLAY command by headset,if music player is not running 
+*  when such a command is received, it will be launched and requested to start playing.
+* */
+NONSHARABLE_CLASS(CPlayerStarter) : 
+    public CActive, public MRemConCoreApiTargetObserver
+	{
+	
+public:
+
+	/**
+	* Two-phased constructor.
+	*      
+	*/
+	static CPlayerStarter* NewL();
+
+	/**
+	 * Set the reference for AVRCP Core API command receiving and
+	 * responses to those command.
+	 */
+	void SetCoreTarget(CRemConCoreApiTarget& aTarget);
+	
+	/**
+	* Destructor.
+	*/
+	~CPlayerStarter();
+	
+private:  // From CActive
+
+    /**
+    * Informs the observer that an accessory has created a control 
+    * connection to our device.
+    * @param                            None.
+    * @return                           None.
+    */
+    void RunL();
+
+    /**
+    * Handles a possible leave from RunL().
+    * @param aError                     The leave code from RunL().
+    * @return                           KErrNone.
+    */
+    TInt RunError(TInt aError);
+
+    /**
+    * Cancels the volume change operation.
+    * @param                            None.
+    * @return                           None.
+    */
+    void DoCancel();
+    
+    // from base class MRemConCoreApiTargetObserver
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'play' command has been received.
+     *
+     * @param aSpeed The playback speed.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoPlay(
+        TRemConCoreApiPlaybackSpeed aSpeed,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A command has been received.
+     *
+     * @param aOperationId The operation ID of the command.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoCommand(
+        TRemConCoreApiOperationId aOperationId,
+        TRemConCoreApiButtonAction aButtonAct );
+
+private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPlayerStarter();
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+         * Start music player if it is not running yet.
+         */
+        void StartPlayIfNeeded();
+        
+        /**
+         * Tells if MPX music player is running or not.
+         */
+        TBool IsMusicPlayerRunning();
+        
+        /**
+         * Tells if Video player is running or not.
+         */
+        TBool IsVideoPlayerRunning();
+
+        /**
+         * Launch MPX player.
+         */
+        void LaunchMusicPlayerL();
+        
+private:
+    enum TOpState
+        {
+        EIdle = 0, 
+        ERespondPlayOk , // responding OK to play command is outstanding
+        ERespondPlayNok,   // responding NOT OK to play command is outstanding
+        EPlayMusicTiming,  // scheduling internal PLAY command to player
+        };
+    
+private:    // Data
+    
+    CRemConCoreApiTarget* iCoreTarget; // not own
+    
+	RTimer iTimer;
+	
+	TOpState iState;
+    };
+
+#endif      // BTRCCACLLINKLISTENER_H
+            
+// End of File
--- a/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -21,12 +21,14 @@
 #include <btaccObserver.h>
 #include <remconinterfaceselector.h>  
 #include <remconaddress.h> 
+#include <remconcoreapitarget.h>
 #include <apacmdln.h>
 #include <apgcli.h>
 #include "btaudioremconpskeys.h"
 #include "btrccLegacyVolumeLevelController.h"
 #include "btrccAbsoluteVolumeLevelController.h"
 #include "btrccLinker.h"
+#include "btrccplayerstarter.h"
 #include "btrccBrowsingAdapter.h"
 #include "debug.h"
 #include <btnotif.h>
@@ -120,6 +122,10 @@
         // If volume control is not supported, we'll need another interface selector session for disconnecting. 
         iInterfaceSelectorForDisconnectingTargetSession = CRemConInterfaceSelector::NewL(); 
     	}
+    
+    iPlayerStarter = CPlayerStarter::NewL();
+    iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *iPlayerStarter);
+    iPlayerStarter->SetCoreTarget(*iCoreTarget);
 
     iRemConBatteryTgt = CRemConBatteryApiTarget::NewL(*iInterfaceSelector, *this);
 
@@ -150,6 +156,7 @@
 	
     delete iAbsoluteVolController;
     delete iLegacyVolController;
+	delete iPlayerStarter;
 	Cancel();
     iStateArray.ResetAndDestroy();
     iStateArray.Close();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btsac/btrcc/src/btrccplayerstarter.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class launchs music player, then send play command
+*                to the player at 2 seconds timeout.
+*
+*/
+
+
+// INCLUDE FILES
+#include <apacmdln.h>
+#include <apgcli.h>
+#include <e32property.h>
+#include <remconcoreapitarget.h>
+#include "btrccplayerstarter.h"
+#include "btaudioremconpskeys.h"
+#include "debug.h"
+
+// MODULE DATA STRUCTURES
+
+// mpx playeris name is mpx.exe in 5.0.
+// it is musicplayer.exe in 3.2.
+_LIT(KMpxPlayerExeName, "mpx.exe");
+
+_LIT(KMpxPlayerSearchPatternBySID, "*102072c3*");
+_LIT(KVideoPlayerSearchPatternBySID, "*200159B2*");
+
+static const TInt KPlayCmdToPlayerDelay = 6000000; // value will be tuned later 
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CPlayerStarter* CPlayerStarter::NewL()
+	{
+	CPlayerStarter* self = new (ELeave) CPlayerStarter();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+void CPlayerStarter::SetCoreTarget(CRemConCoreApiTarget& aTarget)
+    {
+    iCoreTarget = &aTarget;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::CPlayerStarter
+// C++ constructor.
+// -----------------------------------------------------------------------------
+//
+CPlayerStarter::CPlayerStarter()
+  :CActive(EPriorityNormal)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::ConstructL
+// Symbian 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CPlayerStarter::ConstructL()
+    {
+    TRACE_FUNC
+    iTimer.CreateLocal();
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CPlayerStarter::~CPlayerStarter()
+	{
+	TRACE_FUNC
+	// Starting player is not finished yet, send play command. Just wish the player 
+	// can receive it.
+	if (IsActive() && iState != ERespondPlayNok)
+	    {
+        RProperty::Set(KBTAudioRemCon, KBTAudioPlayerControl, 
+                EBTAudioResumePlayer);	    
+	    }
+	Cancel();
+	iTimer.Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::RunL
+// -----------------------------------------------------------------------------
+//
+void CPlayerStarter::RunL()
+    {
+    TRACE_INFO((_L("CPlayerStarter::RunL() state %d, status %d"), iState, iStatus.Int()));
+    if (iStatus != KErrNone)
+        {
+        iState = EIdle;
+        return;
+        }
+    switch (iState)
+        {
+        case ERespondPlayOk:
+            {
+            // Response OK has been sent to the remote device, start timer waiting
+            // for player's initialization.
+            iTimer.After(iStatus, KPlayCmdToPlayerDelay);
+            SetActive();
+            iState = EPlayMusicTiming;
+            TRACE_INFO(_L("schedule PLAY command ..."));
+            break;
+            }
+        case EPlayMusicTiming:
+            {
+            // Player should have fully up and running. Send PLAY command to it
+            // through our internal Play API.
+            RProperty::Set(KBTAudioRemCon, KBTAudioPlayerControl, 
+                    EBTAudioResumePlayer);
+            TRACE_INFO(_L("PLAY command sent to btmonobearer"));
+            iState = EIdle;
+            break;
+            }
+        default:
+            {
+            iState = EIdle;
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CPlayerStarter::RunError(TInt aError)
+    {
+    TRACE_FUNC
+    (void) aError;
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CPlayerStarter::DoCancel()
+    {
+    TRACE_FUNC
+    switch (iState)
+        {
+        case ERespondPlayOk:
+        case ERespondPlayNok:
+            {
+            // This cancel won't cancel the response sending to the remote 
+            // device. (RemCon FW's cancel mechanism is only completing client's request.
+            // the real operation in its server side won't be stopped.)
+            iCoreTarget->Cancel();
+            break;
+            }
+        case EPlayMusicTiming:
+            {
+            iTimer.Cancel();
+            break;
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// A 'play' command has been received.
+// ---------------------------------------------------------------------------
+//
+void CPlayerStarter::MrccatoPlay(
+    TRemConCoreApiPlaybackSpeed /* aSpeed */,
+    TRemConCoreApiButtonAction aButtonAct )
+    {
+    TRACE_FUNC
+    if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+        ( aButtonAct == ERemConCoreApiButtonPress ) )
+        {
+        StartPlayIfNeeded();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// A command has been received.
+// ---------------------------------------------------------------------------
+//
+void CPlayerStarter::MrccatoCommand(
+    TRemConCoreApiOperationId aOperationId,
+    TRemConCoreApiButtonAction aButtonAct )
+    {
+    TRACE_INFO((_L("CPlayerStarter::MrccatoCommand opId %d, button %d"), 
+        aOperationId, aButtonAct));
+    switch (aOperationId)
+        {
+        case ERemConCoreApiPlay:
+            {
+            if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+                ( aButtonAct == ERemConCoreApiButtonPress ) )
+                {
+                StartPlayIfNeeded();
+                }
+            break;
+            }
+        case ERemConCoreApiStop:
+        case ERemConCoreApiPause:
+            {
+            if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+                ( aButtonAct == ERemConCoreApiButtonPress ) )
+                {
+                // if starting player is ongoing, possibly PLAY command has been scheduled
+                // need to abort it.
+                Cancel();
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CPlayerStarter::StartPlayIfNeeded
+// -----------------------------------------------------------------------------
+//
+void CPlayerStarter::StartPlayIfNeeded() 
+    {
+    TRACE_FUNC
+    // unfinished business ongoing, eat the event.
+    if (IsActive())
+        {
+        return;
+        }
+    if (!IsMusicPlayerRunning() && !IsVideoPlayerRunning())
+         {
+         TRAPD(err, LaunchMusicPlayerL());
+         // Send the response of play command to remote device
+         iCoreTarget->PlayResponse(iStatus, err);
+         SetActive();
+         iState = (err) ? ERespondPlayNok : ERespondPlayOk;
+         }
+    }
+
+TBool CPlayerStarter::IsMusicPlayerRunning()
+    {
+    TRACE_FUNC
+    // Music player is running if we can find a thread whose name contains 
+    // S60 Music Player's SID.
+    TFindThread findt(KMpxPlayerSearchPatternBySID);
+    TFullName result;
+    TBool running(EFalse);
+    if (!findt.Next(result))
+        {
+        TRACE_INFO((_L("Thread '%S'is found"), &result));
+        running = ETrue;
+        }
+    return running;
+    }
+
+TBool CPlayerStarter::IsVideoPlayerRunning()
+    {
+    TRACE_FUNC
+    // Video player is running if we can find a thread whose name contains 
+    // Video Player's SID.
+    TFindThread findt(KVideoPlayerSearchPatternBySID);
+    TFullName result;
+    TBool running(EFalse);
+    if (!findt.Next(result))
+        {
+        TRACE_INFO((_L("Thread '%S'is found"), &result));
+        running = ETrue;
+        }
+    return running;
+    }
+
+void CPlayerStarter::LaunchMusicPlayerL()
+    {
+    RApaLsSession ls;
+    User::LeaveIfError(ls.Connect());
+    CleanupClosePushL(ls);
+    CApaCommandLine* cmd = CApaCommandLine::NewL();
+    CleanupStack::PushL(cmd);
+    cmd->SetExecutableNameL( KMpxPlayerExeName );
+    cmd->SetCommandL( EApaCommandOpen );
+    User::LeaveIfError(ls.StartApp( *cmd ));
+    CleanupStack::PopAndDestroy(2); // cmd, ls
+    }
+
+
+//  End of File  
--- a/bluetoothengine/btsac/src/btsacGavdp.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btsac/src/btsacGavdp.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -663,15 +663,25 @@
 	TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() Got a bearer, for session %d"), aAddr.Session()))
 
 	// AV sockets don't foward opts yet so use addr version
+	TBTDevAddr RemoteBDAddr = aAddr.BTAddr();
 	RBTPhysicalLinkAdapter phy;
-	TBTDevAddr RemoteBDAddr = aAddr.BTAddr(); 
 	TInt err = phy.Open(iSockServ, RemoteBDAddr);
-	TUint16 packets = EAnyACLPacket;
-	err = phy.RequestChangeSupportedPacketTypes(packets);
-	TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() Modified PHY, result %d"), err))
-
-	// state handles the call-back
-	iObserver->GAVDP_BearerReady(aNewSocket, aAddr);
+	TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() RBTPhysicalLinkAdapter::Open returned %d"), err))
+	if ( !err )
+		{
+		TUint16 packets = EAnyACLPacket;
+		err = phy.RequestChangeSupportedPacketTypes(packets);
+		TRACE_INFO((_L("CBTSACGavdp::GAVDP_BearerReady() Modified PHY, result %d"), err))
+		phy.Close();
+		}
+	if ( err )
+		{
+		iObserver->GAVDP_Error(err, KNullDesC8());
+		}
+	else
+		{
+		iObserver->GAVDP_BearerReady(aNewSocket, aAddr);
+		}
 	}
 ///////////////////// Call Backs from GAVDP End.///////////////////	
 
--- a/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -426,6 +426,14 @@
         return EKeyWasConsumed;
         }
 
+    // Show popup commands window if selection or enter key is pressed.
+	// It should not go to here, unless | EAknEnableMSK is not set
+    if ((aKeyEvent.iCode == EKeyDevice3) || (aKeyEvent.iCode == EKeyEnter))
+        {
+        iView->ProcessCommandL(EAknSoftkeyContextOptions);        
+        return EKeyWasConsumed;
+        }
+
     if ((aKeyEvent.iCode != EKeyLeftArrow) && 
         (aKeyEvent.iCode != EKeyRightArrow))
         {
--- a/bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -905,23 +905,22 @@
             OpenWaitNoteL(iWaitForConnectDlg,R_BT_CONNECTING_TO_WAIT_NOTE,R_BT_CONNECTING_TO ,
                 ECmdShowBtWaitConnectingToNote,aDevice.iName); 
 	        }
+	    
+	    __ASSERT_DEBUG(iConnectDevice == NULL,PANIC(EBTPanicClassMemberVariableNotNull));
 		iConnectDevice=new(ELeave) TBTDevice(aDevice);            
 		iConnectDevice->iOperation=EOpConnect;
 		     
 		if( currentPowerMode == EBTPowerOff )
 			{
-				// turn on the flag IsConnectDevice
-				//
-				iIsConnectDevice = ETrue;
+            // turn on the flag IsConnectDevice
+            iIsConnectDevice = ETrue;
 			}
         else
         	{	
-        		// connect device
-        		//
-        		iModel->ChangeDevice(*iConnectDevice);
-        		
-        		// reset IsConnectDevice flag
-        		iIsConnectDevice = EFalse;
+            // connect device
+            iModel->ChangeDevice(*iConnectDevice);        		
+            // reset IsConnectDevice flag
+            iIsConnectDevice = EFalse;
         	}
         }
     TRACE_FUNC_EXIT
--- a/bluetoothengine/btui/devmodel/src/btpairedmodel.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/bluetoothengine/btui/devmodel/src/btpairedmodel.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -59,6 +59,7 @@
 	
     delete iConnMan;
     delete iPairingDevice;
+    delete iDisconnectDevice;
     delete iLinks;
     delete iBtEngSettings;
     iSocketServ.Close();    
@@ -131,45 +132,48 @@
     	{    	
     	if( iState != EDisconnectBeforeOperationState)
     		{
-    			// disconnect by CBTEngConnMan if connected that way.
-    			if (aDevice.iStatus & static_cast<TInt>(EStatusBtuiConnected ) )
-    				{
-    				TInt code=KErrNone;
-		    		TRAPD(err,
-		    		iState=EDisconnectBeforeOperationState;
-			    		iDisconnectDevice=new(ELeave) TBTDevice(aDevice);
-			    		code=iConnMan->Disconnect(aDevice.iAddr,EBTDiscImmediate);    				
-			    		);
-					// if the return code is KErrNone then there will be
-					// a callback. However if it fails, there will not be any.
-					// So the execution will go on inside this method, if there was an error.
-					if(err == KErrNone && code==KErrNone )
-						{
-						return KErrNone;
-						}
-						
-    				}
-    			else // try disconnecting from the link layer
-    				{
-    				TInt code=KErrNone;
-    				TRAPD(err,
-					iState=EDisconnectBeforeOperationState;
-						iDisconnectDevice=new(ELeave) TBTDevice(aDevice);
-						code=iLinks->Disconnect(aDevice.iAddr);
-						);
-					// if the return code is KErrNone then there will be
-					// a callback. However if it fails, there will not be any.
-					// So the execution will go on inside this method, if there was an error.
-					if(err == KErrNone && code==KErrNone )
-						{
-						return KErrNone;
-						}
-    				}
-    		}
-   		else    
-			iState=EIdleState;
-    
+            TInt code = KErrNone;
+            iState=EDisconnectBeforeOperationState;
+            __ASSERT_DEBUG(iDisconnectDevice == NULL,PANIC(EBTPanicClassMemberVariableNotNull));
+            iDisconnectDevice = new TBTDevice(aDevice);   				
+
+            if( iDisconnectDevice )
+                {
+                // disconnect by CBTEngConnMan if connected that way.
+                if ( aDevice.iStatus & static_cast<TInt>(EStatusBtuiConnected ) )
+                    {
+                    code = iConnMan->Disconnect(aDevice.iAddr,EBTDiscImmediate);    				
+                    }
+                else // try disconnecting from the link layer
+                    {
+                    code = iLinks->Disconnect(aDevice.iAddr);
+                    }
+                }
+            else 
+                {
+                code = KErrNoMemory;
+                }
+            // if the return code is KErrNone then there will be
+            // a callback. However if it fails, there will not be any.
+            // So the execution will go on inside this method, if there was an error.
+            if( code == KErrNone )
+                {
+                return code;
+                }
+            else
+                {
+                // Reset the state if error happened
+                TRACE_INFO((_L("[BTUI] CBTPairedModel::DoChangeDeviceL disconnect error = %d, operation %d"), code, aDevice.iOperation));
+                delete iDisconnectDevice;
+                iDisconnectDevice = NULL;
+                iState = EIdleState; 
+                }
+            }
     	}
+    else
+        {
+        iState=EIdleState;
+        }
     	
     if(	aDevice.iOperation ==EOpPair)
     	{
@@ -179,12 +183,7 @@
     	}
     
     TInt err = CBTDevModelBase::DoChangeDeviceL(aDevice);
-    if(iDisconnectDevice!= NULL)
-    	{
-    	delete iDisconnectDevice;
-    	iDisconnectDevice=NULL;
-    	}
-    
+       
     if (err != KErrNone)
         {      
         TBTDevAddr addr;
@@ -207,6 +206,7 @@
             	}
             case EOpDisconnect:
             	{
+                __ASSERT_DEBUG(iDisconnectDevice == NULL,PANIC(EBTPanicClassMemberVariableNotNull));
             	iDisconnectDevice=new(ELeave) TBTDevice(aDevice);            		            		           	
 				if (aDevice.iStatus & static_cast<TInt>(EStatusBtuiConnected ) )            	
 					{
@@ -216,7 +216,14 @@
 					{
 					err=iLinks->Disconnect(aDevice.iAddr);
 					}
-                
+                // Reset the state if error happened
+				if( err )
+				    {
+                    TRACE_INFO((_L("[BTUI] CBTPairedModel::DoChangeDeviceL disconnect error = %d, operation %d"), err, aDevice.iOperation));
+                    delete iDisconnectDevice;
+                    iDisconnectDevice = NULL;
+                    iState = EIdleState;
+				    }
                 break;
             	}
             default:
--- a/cbsatplugin/atmisccmdplugin/data/2002C3BA.rss	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/data/2002C3BA.rss	Wed Oct 13 14:43:49 2010 +0300
@@ -31,7 +31,7 @@
 	                implementation_uid = 0x2002DC6B;// KUidATMiscCmdEcomImpl;
 	                version_no = 1;
 	                display_name = "Miscellaneous AT commands Implementation";
-	                default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE|MAT+CGSN|MAT+CGMR|MAT+CGMI|MAT+GMI|MAT+GMR|MAT+GSN|MAT+CGMM|MAT+GMM|MATI|MATI0|MATI1|MATI2|MATI3|MATI4";
+	                default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE";
 	                opaque_data = "";
 	                }
 				};
--- a/cbsatplugin/atmisccmdplugin/data/2002DCE5_TDSCDMA.rss	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-// Contributors:
-//
-
-#include "../inc/atmisccmdpluginuids.hrh"
-#include <ecom/registryinfo.rh>
-#include <atext_interfaceuid.h>
-    
-RESOURCE REGISTRY_INFO theInfo
-	{
-	// UID for the DLL
-	dll_uid = 0x2002DCE5;//KUidATCFunEcomDll; 
-	// Declare array of interface info
-	interfaces =
-		{
-		INTERFACE_INFO
-			{
-			// UID of interface that is implemented
-			interface_uid = 0x2001CBEE; // ATEXT_INTERFACE_DUN_UID; 
-			implementations =
-				{
-                IMPLEMENTATION_INFO
-	                {
-	                implementation_uid = 0x2002DC6B;// KUidATMiscCmdEcomImpl;
-	                version_no = 1;
-	                display_name = "Miscellaneous AT commands Implementation";
-	                default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE|MAT^HVER|MAT+CGSN|MAT+CGMR|MAT+CGMI|MAT+CMGD|OAT+CMGF|MAT+GMI|MAT+GMR|MAT+GSN|MAT+CGMM|MAT+GMM|MATI|MATI0|MATI1|MATI2|MATI3|MATI4|MAT^SCPBR|MAT^SCPBW";
-	                opaque_data = "";
-	                }
-				};
-			}
-		};
-	}
-
-// End of file
--- a/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp	Wed Oct 13 14:43:49 2010 +0300
@@ -41,27 +41,16 @@
 SOURCE          cbccommandhandler.cpp
 SOURCE          ussdreadmessageimpl.cpp
 SOURCE          ussdsendmessageimpl.cpp
-SOURCE          hvercommandhandler.cpp 
-SOURCE          cgsncommandhandler.cpp 
-SOURCE          cgmrcommandhandler.cpp 
-SOURCE          cmgwcommandhandler.cpp 
-SOURCE          cgmicommandhandler.cpp
-SOURCE			cmgdcommandhandler.cpp
-SOURCE			telephonywrapper.cpp
-SOURCE			cgmmcommandhandler.cpp 
-SOURCE			scpbrcommandhandler.cpp
-SOURCE			scpbwcommandhandler.cpp
+
 
 USERINCLUDE     ../inc
 
 MW_LAYER_SYSTEMINCLUDE
 
-// Resources
 START RESOURCE  ../data/2002C3BA.rss
 TARGET          atmisccmdplugin.rsc
 END
 
-
 LIBRARY	        ecom.lib
 LIBRARY         euser.lib
 LIBRARY         atextpluginbase.lib
@@ -75,8 +64,9 @@
 
 LIBRARY			etel3rdparty.lib
 LIBRARY			sysutil.lib 
-LIBRARY			customapi.lib
+
+LIBRARY		    flogger.lib
 
-DEBUGLIBRARY	flogger.lib
-
+MACRO _DEBUG
+MACRO USE_FILE_LOGGING
 // End of File
--- a/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin_td.mmp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../inc/atmisccmdpluginuids.hrh"
-
-CAPABILITY 	    CAP_ECOM_PLUGIN 
-VENDORID        VID_DEFAULT
-TARGET          atmisccmdplugin_td.dll
-TARGETTYPE	    PLUGIN
-UID             0x10009D8D 0x2002DCE5
-
-SOURCEPATH      ../src
-SOURCE          main.cpp
-SOURCE          atmisccmdplugin.cpp 
-SOURCE          atcmdasyncbase.cpp
-SOURCE          atcmdsyncbase.cpp  
-SOURCE          atcommandparser.cpp
-SOURCE          clckcommandhandler.cpp 
-SOURCE          securitycodeverifier.cpp
-SOURCE          securityeventhandler.cpp
-SOURCE          cbsettinghandler.cpp
-SOURCE          cpwdcommandhandler.cpp
-SOURCE          cpincommandhandler.cpp
-SOURCE          cusdcommandhandler.cpp 
-SOURCE          cnumcommandhandler.cpp
-SOURCE          cfuncommandhandler.cpp 
-SOURCE          cbccommandhandler.cpp
-SOURCE          ussdreadmessageimpl.cpp
-SOURCE          ussdsendmessageimpl.cpp
-SOURCE          hvercommandhandler.cpp 
-SOURCE          cgsncommandhandler.cpp 
-SOURCE          cgmrcommandhandler.cpp 
-SOURCE          cmgwcommandhandler.cpp 
-SOURCE          cgmicommandhandler.cpp
-SOURCE			cmgdcommandhandler.cpp
-SOURCE			telephonywrapper.cpp
-SOURCE			cgmmcommandhandler.cpp 
-SOURCE			scpbrcommandhandler.cpp
-SOURCE			scpbwcommandhandler.cpp
-
-USERINCLUDE     ../inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-// Resources
-START RESOURCE ../data/2002DCE5_TDSCDMA.rss
-	TARGET atmisccmdplugin_td.rsc
-END
-
-
-LIBRARY	        ecom.lib
-LIBRARY         euser.lib
-LIBRARY         atextpluginbase.lib
-LIBRARY         bafl.lib
-LIBRARY         etelmm.lib
-LIBRARY         etel.lib
-LIBRARY         hash.lib
-
-LIBRARY         ProfileEng.lib
-LIBRARY         StarterClient.lib 
-
-LIBRARY			etel3rdparty.lib
-LIBRARY			sysutil.lib 
-LIBRARY			customapi.lib
-
-DEBUGLIBRARY	flogger.lib
-
-// End of File
--- a/cbsatplugin/atmisccmdplugin/group/bld.inf	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/group/bld.inf	Wed Oct 13 14:43:49 2010 +0300
@@ -27,7 +27,6 @@
 
 PRJ_MMPFILES
 atmisccmdplugin.mmp
-atmisccmdplugin_td.mmp
 
 PRJ_TESTMMPFILES
 
--- a/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h	Wed Oct 13 14:43:49 2010 +0300
@@ -53,27 +53,7 @@
         ECmdAtCpin,
         ECmdAtCusd,
         ECmdAtCnum,
-		ECmdAtCmee,
-        ECmdAtHver,
-        ECmdAtCgsn,
-        ECmdAtGsn,
-        ECmdAtCgmr,
-        ECmdAtGmr,
-        ECmdAtCgmi,
-        ECmdAtGmi,
-        ECmdAtCmgw,
-        ECmdAtCmgd,
-        ECmdAtCmgf,
-        ECmdAtCgmm,
-        ECmdAtGmm,
-        ECmdAtI,
-        ECmdAtI0,
-        ECmdAtI1,
-        ECmdAtI2,
-        ECmdAtI3,
-        ECmdAtI4,
-		ECmdAtScpbr,
-		ECmdAtScpbw
+        ECmdAtCmee
         };
 public:
     TAtCommandParser();
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h	Wed Oct 13 14:43:49 2010 +0300
@@ -81,13 +81,6 @@
      */
     virtual void CreateCMEReplyAndComplete(TInt aError) = 0;
 
-    /*
-     * Complete the AT command request with AT CMS error code according to given Symbian error code
-     * @param aError Symbian error code 
-     */
-    
-    virtual void CreateCMSReplyAndComplete(TInt aError) = 0;
-
     /**
      * Returns plugin's character value settings (from CATExtPluginBase)
      *
@@ -144,10 +137,6 @@
 
     virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
                                TBool aOkReply );
-
-    virtual TInt CreateEditModeBuffer( RBuf8& aReplyBuffer );
-    virtual void CreateCMSReplyAndComplete(TInt aError);
-
     virtual void CreateCMEReplyAndComplete(TInt aError);
     virtual TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar );
     virtual TInt GetModeValue( TModeTypes aModeType, TBool& aMode );    
@@ -159,8 +148,7 @@
     
     TInt CreatePartOfReply( RBuf8& aBuffer );
     void HandleCMEECommand();
-    void HandleCMGFCommand();
-
+    
     /*
      * Utility function that connect to Etel server and establish a subsession to RMobilePhone
      * Caller must close session and subsession after use.
@@ -187,18 +175,7 @@
     CATCmdAsyncBase* iCNUMHandler;
     CATCmdAsyncBase* iCFUNHandler;
     CATCmdAsyncBase* iCBCHandler;
-
-    // TDSCDMA only
-	CATCmdSyncBase* iHVERHandler;
-    CATCmdSyncBase* iCGSNHandler;
-    CATCmdSyncBase* iCGMRHandler;
-    CATCmdSyncBase* iCGMIHandler;
-    CATCmdAsyncBase* iCMGWHandler;
-    CATCmdAsyncBase* iCMGDHandler;
-    CATCmdSyncBase* iCGMMHandler;
-	CATCmdAsyncBase* iSCPBRHandler;
-    CATCmdAsyncBase* iSCPBWHandler;
- 
+    
     /**
      * Buffer for handle command's command
      * Not own.
--- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h	Wed Oct 13 14:43:49 2010 +0300
@@ -21,20 +21,15 @@
 _LIT8(KCRLF, "\r\n");
 _LIT8(KOKCRLF, "\r\n\r\nOK\r\n");
 
-_LIT8(KAtCLCK, "\r\n+CLCK: ");
+_LIT8(KAtCLCK, "+CLCK: ");
 _LIT8(KAtCFUN, "+CFUN: ");
 _LIT8(KAtCBC, "+CBC: ");
 _LIT8(KAtCUSD, "+CUSD: ");
-_LIT8(KAtCMGW, "+CMGW: ");
-_LIT8(KSCPBR, "\r\n^SCPBR: ");
-_LIT8(KCLCKSupportedCmdsList, "\r\n+CLCK: (\"PS\",\"SC\",\"AO\",\"OI\",\"OX\",\"AI\",\"IR\",\"AB\",\"AG\",\"AC\")\r\n\r\nOK\r\n");
-_LIT8(KCFUNSupportedCmdsList, "\r\n+CFUN: (0,1,4),(0,1)\r\n\r\nOK\r\n");
-_LIT8(KCBCSupportedCmdsList, "\r\n+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n");
+
+_LIT8(KCLCKSupportedCmdsList, "+CLCK: (\"PS\",\"SC\",\"AO\",\"OI\",\"OX\",\"AI\",\"IR\",\"AB\",\"AG\",\"AC\")\r\n\r\nOK\r\n");
+_LIT8(KCFUNSupportedCmdsList, "+CFUN: (0,1,4),(0,1)\r\n\r\nOK\r\n");
+_LIT8(KCBCSupportedCmdsList, "+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n");
 _LIT8(KCUSDSupportedCmdsList, "+CUSD: (0,1)\r\n\r\nOK\r\n");
-_LIT8(KCMGDSupportedCmdsList, "\r\n+CMGD: (%S), (0,1,2,3,4)\r\n");
-_LIT8(KSCPBRSupportedEntriesIndexList,"\r\n^SCPBR:(1-%d),%d,%d,%d \r\n"); 
-_LIT8(KSCPBRReplyOneEntry,"%d,\"%S\",,\"%S\",,\"%S\",,\"%S\",,\"%S\",,\"%S\"");
-_LIT8(KSCPBWSupportedCmdsList, "\r\n^SCPBW: (1-%d),%d,(),%d,%d\r\n");
 
 _LIT8(KATCLCKPS, "PS");
 _LIT8(KATCLCKSC, "SC");
@@ -47,19 +42,7 @@
 _LIT8(KATCLCKAG, "AG");
 _LIT8(KATCLCKAC, "AC");
 
-_LIT8(KHVERModelString, "RM-");
-
-_LIT8(KCMSErr, "+CMS ERROR: ");
-
 // Max buffer length for an MD5 digest - originally defined in SCPServerInterface.h
 const TInt KSCPMaxHashLength( 32 );
 
-const TInt KSCPBRDefaultSizeOfOneEntry( 400 );
-const TInt KSCPBRMaxNameLength( 64 );
-const TInt KSCPBRMaxNumberLength( 32 );
-const TInt KSCPBRMaxEmailLength( 64 );
-const TInt KSCPBRMaxNumberCount( 4 );
-const TInt KSCPBRMaxEntryCount( 1000 );
-
-const TInt KBufBlockSize (1024);
 #endif // ATMISCCMDPLUGINCONSTS_H
--- a/cbsatplugin/atmisccmdplugin/inc/cgmicommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CGMICommandHandler class declaration for AT+CGMI command
- * 
- */
-
-#ifndef CGMICOMMANDHANDLER_H
-#define CGMICOMMANDHANDLER_H
-
-#include "atcmdsyncbase.h"
-
-#include <etel3rdparty.h>
-
-/**
- *  AT+CGMI command handler implementation class
- */
-NONSHARABLE_CLASS( CCGMICommandHandler ) : public CATCmdSyncBase
-    {
-public:
-    static CCGMICommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCGMICommandHandler();
-    
-public:
-    void SetManufacturer(const TDesC8& aManufacturer);
-    void SetTelephonyError(TInt aTelError); 
-
-private: // methods from CATCmdSyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CCGMICommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-private:
-    TInt    iTelError;
-    TBuf8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
-    
-    RBuf8 iReply;
-    };
-
-#endif /* CGMICOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cgmmcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CGMMCommandHandler class declaration for AT+CGMM command
- * 
- */
-
-#ifndef CGMMCOMMANDHANDLER_H
-#define CGMMCOMMANDHANDLER_H
-
-#include "atcmdsyncbase.h"
-
-#include <etel3rdparty.h>
-
-/**
- *  AT+CGMM command handler implementation class
- */
-NONSHARABLE_CLASS( CCGMMCommandHandler ) : public CATCmdSyncBase
-    {
-public:
-    static CCGMMCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCGMMCommandHandler();
-    
-public:
-    void SetManufacturer(const TDesC8& aManufacturer);
-    void SetModelID(const TDesC8& aModelID);
-    void SetTelephonyError(TInt aTelError); 
-
-private: // methods from CATCmdSyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CCGMMCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-private:
-    TInt    iTelError;
-    TBuf8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
-    TBuf8<CTelephony::KPhoneModelIdSize> iModel;
-    
-    RBuf8 iReply;
-    };
-
-#endif /* CGMMCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cgmrcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CGMRCommandHandler class declaration for AT+CGMR command
- * 
- */
-
-#ifndef CGMRCOMMANDHANDLER_H
-#define CGMRCOMMANDHANDLER_H
-
-
-#include "atcmdsyncbase.h"
-
-/**
- *  AT+CGMR command handler implementation class
- */
-NONSHARABLE_CLASS( CCGMRCommandHandler ) : public CATCmdSyncBase
-    {
-public:
-    static CCGMRCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCGMRCommandHandler();
-    
-private: // methods from CATCmdSyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CCGMRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-    TInt GetSoftwareVersion();
-    
-private:    
-    RBuf8 iReply;
-    };
-
-#endif /* CGMRCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cgsncommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CGSNCommandHandler class declaration for AT+CGSN command
- * 
- */
-
-#ifndef CGSNCOMMANDHANDLER_H
-#define CGSNCOMMANDHANDLER_H
-
-#include "atcmdsyncbase.h"
-
-#include <etel3rdparty.h>
-
-/**
- *  AT+CGSN command handler implementation class
- */
-NONSHARABLE_CLASS( CCGSNCommandHandler ) : public CATCmdSyncBase
-    {
-public:
-    static CCGSNCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCGSNCommandHandler();
-    
-public:
-    void SetSerialNum(const TDesC8& aSerial);
-    void SetTelephonyError(TInt aTelError);  
-
-private: // methods from CATCmdSyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CCGSNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-private:
-    TInt    iTelError;
-    TBuf8<CTelephony::KPhoneSerialNumberSize> iSN;
-    
-    RBuf8   iReply;
-    };
-
-#endif /* CGSNCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cmgdcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CCMGDCommandHandler class declaration for AT+CMGD command
- * 
- */
-
-#ifndef CMGDCOMMANDHANDLER_H
-#define CMGDCOMMANDHANDLER_H
-
-#include "atcmdasyncbase.h"
-
-#include <etelmm.h>
-
-class CMobilePhoneGsmSmsList;
-class CRetrieveMobilePhoneSmsList;
-/**
- *  AT+CMGD command handler implementation class
- */
-NONSHARABLE_CLASS( CCMGDCommandHandler ) : public CATCmdAsyncBase
-    {
-private:
-/**
- * States for CMGD command handler
- */
-enum TCMGDState
-    {
-    ECMGDStateIdle,
-    ECMGDStateRetrieveAllIndices,
-    ECMGDStateDeleteOneEntry,
-    ECMGDStateDeleteFilteredEntries,
-    ECMGDStateDeleteAllEntries,
-    ECMGDStateSimStoreNotSupported
-    };
-
-enum TCMGDFilter
-    {
-    ECMGDFilterReadMessagesOnly,
-    ECMGDFilterReadAndSentMessages,
-    ECMGDFilterReadSentAndUnsentMessages
-    };
-
-public:
-    static CCMGDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCMGDCommandHandler();
-    
-private: // methods from CActive
-    
-    virtual void RunL();
-    virtual void DoCancel();
-    virtual TInt RunError(TInt aError);
-
-private: // methods from CATCmdAsyncBase    
-    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    
-    CCMGDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-    TInt ParseParameters();
-    TInt DoHandleCommand();
-    
-    void GetMessageIndexListL();
-    void FilterMessageListL();
-    
-private:
-    
-    RMobileSmsMessaging     iMobileSmsMessaging;
-    RMobileSmsStore         iMobileSmsStore;
-    
-    CRetrieveMobilePhoneSmsList* iRetrieveSmsList;
-    CMobilePhoneGsmSmsList*      iGsmSmsList;
-    
-    TCMGDState  iHandlerState;
-    TCMGDFilter    iFilterType;
-    TInt iIndex;
-    TInt iDelFlag;
-    RArray<TInt> iDeleteList;
-    
-    RBuf8 iReply;
-    };
-
-#endif /* CMGDCommandHandler_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cmgwcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CMGWCommandHandler class declaration for AT+CMGW command
- * 
- */
-
-#ifndef CMGWCOMMANDHANDLER_H
-#define CMGWCOMMANDHANDLER_H
-
-#include "atcmdasyncbase.h"
-
-#include <etel3rdparty.h>
-#include <etelmm.h>
-
-class CRetrieveMobilePhoneSmspList;
-class CMobilePhoneSmspList;
-
-/**
- *  AT+CMGW command handler implementation class
- */
-NONSHARABLE_CLASS( CCMGWCommandHandler ) : public CATCmdAsyncBase
-    {
-private:
-    enum TCMGWState
-        {
-        ECMGWStateIdle,                     // Idle
-        ECMGWStateEditMode,                 // Edit mode
-        ECMGWStateRetrieveSCA,              // Retrieve SCA
-        ECMGWStatePreparePDU,
-        ECMGWStateWritePDU,                 // Write PDU
-        ECMGWStateSimStoreNotSupported      // Sim store not supported
-        };
-    
-public:
-    static CCMGWCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CCMGWCommandHandler();
-    
-    void SetMessageFormat(TInt aFormat);
-    
-private: // methods from CActive
-    virtual void RunL();
-    virtual void DoCancel();
-    virtual TInt RunError (TInt aError);
-
-private: // methods from CATCmdAsyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CCMGWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-
-    void HandleEditModeCommand( const TDesC8& aCmd );
-    TInt ParseParameters();
-    TInt CreateSmsEntry();
-    TInt ExtractSCA();
-    
-private:
-    RMobileSmsMessaging     iMobileSmsMessaging;
-    RMobileSmsStore         iMobileSmsStore;
-    CRetrieveMobilePhoneSmspList* iRetrieveMobilePhoneSmspList;
-    CMobilePhoneSmspList*   iMobilePhoneSmspList;
-    RMobileSmsMessaging::TMobileSmspEntryV1 iMobileSmspEntry;
-    
-    RMobilePhone::TMobileAddress iServiceCentre;
-    
-    TCMGWState iState;
-    RBuf8 iTPDU;
-    
-    TInt iTPDULength;
-    TInt iTPDUStat;
-    TUint8 iSCALength;
-    RMobileSmsStore::TMobileSmsStoreStatus iMessageStatus;
-      
-    RMobileSmsStore::TMobileGsmSmsEntryV1 iEntry;
-    RMobileSmsStore::TMobileGsmSmsEntryV1Pckg iEntryPckg;
-    
-    RBuf8 iReply;
-    
-    TInt iMsgFormat;
-    };
-
-#endif /* CMGWCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/cmserror.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description : define all +CMS Error codes.
- * Reference:
- *    3GPP TS 27.007 version 6.9.0 Release 6 118 ETSI TS 127 007 V6.9.0 (2007-06)
- *
- */
-
-#ifndef CMSERROR_H
-#define CMSERROR_H
-
-enum TATCMSError
-    {
-    EATCmsErrGeneral = 0,
-    EATCMSErr301 = 301,
-    EATCMSErr304 = 304,
-    EATCMSErr310 = 310,
-    EATCMSErr311 = 311,
-    EATCMSErr312 = 312,
-    EATCMSErr316 = 316,
-    EATCMSErr320 = 320,
-    EATCMSErr321 = 321,
-    EATCMSErr322 = 322
-    };
-
-#endif /* CMSERROR_H */
--- a/cbsatplugin/atmisccmdplugin/inc/hvercommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CHVERCommandHandler class declaration for AT^HVER command
- * 
- */
-
-#ifndef CHVERCOMMANDHANDLER_H
-#define CHVERCOMMANDHANDLER_H
-
-#include "atcmdsyncbase.h"
-#include "debug.h"
-
-#include <etel3rdparty.h>
-
-/**
- *  AT^HVER command handler implementation class
- */
-NONSHARABLE_CLASS( CHVERCommandHandler ) : public CATCmdSyncBase
-    {
-public:
-    static CHVERCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CHVERCommandHandler();
-    
-public:
-    void SetHWVersion(const TDesC8& aHWVersion);
-    void SetTelephonyError(TInt aTelError); 
-
-private: // methods from CATCmdSyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CHVERCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-    
-    void ParseSWVersion(const TDesC8& aSWVersion);
-    
-private:
-    TInt    iTelError;
-    TBuf8<CTelephony::KPhoneModelIdSize> iModel;
-
-    RBuf8 iSWVersion;
-    RBuf8 iReply;
-    };
-
-#endif /* CHVERCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/scpbrcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CSCPBRCommandHandler class declaration for AT^SCPBR command
- * 
- */
-
-#ifndef SCPBRCOMMANDHANDLER_H_
-#define SCPBRCOMMANDHANDLER_H_
-
-#include <e32base.h>
-#include <etelmm.h>
-#include <e32cmn.h>
-#include <rmmcustomapi.h>
-
-#include "atcmdasyncbase.h"
-#include "atmisccmdpluginconsts.h"
-
-class CPhoneBookBuffer;
-
-/**
- *  AT^SCPBR command handler implementation class
- */
-NONSHARABLE_CLASS( CSCPBRCommandHandler ) : public CATCmdAsyncBase
-	{
-private:
-
-	/**
-	 * SCPBR States
-	 */
-	enum TSCPBRState
-	    {
-        ESCPBRStateIdle,                  // Idle
-        ESCPBRStateRead,                  // Read
-        ESCPBRStateGetPhoneBookInfo,      // Get phone book info.
-        ESCPBRStateGet3GPBInfo,           // Get 3G phone book info.
-        ESCPBRStateNotSupported           // phone book store not supported
-	    };
-private:
-	/**
-	 *  The data structure of phone book entry.
-	 *  Inner class used by CSCPBRCommandHandler only.
-	 */
-	class TPhoneBookEntry
-	    {
-    public:
-	    TPhoneBookEntry(): iIndex(-1)
-            {
-            }
-	    
-	    void Externalize( TDes8& aDes ) const;
-
-        TInt iIndex;
-
-        TBuf8<KSCPBRMaxNumberLength> iNumber1;
-        TBuf8<KSCPBRMaxNumberLength> iNumber2;
-        TBuf8<KSCPBRMaxNumberLength> iNumber3;
-        TBuf8<KSCPBRMaxNumberLength> iNumber4;
-
-        TBuf8<KSCPBRMaxNameLength> iName;
-
-        TBuf8<KSCPBRMaxEmailLength> iEmail;
-	    };
-	
-public:
-	static CSCPBRCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
-	
-	virtual ~CSCPBRCommandHandler();
-
-private: // from CATCmdAsyncBase
-	virtual void HandleCommand(const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded);
-	
-private: // from CActive
-	virtual void RunL();
-	virtual void DoCancel();
-	virtual TInt RunError(TInt aError);
-	
-private:	
-	CSCPBRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone );
-	void ConstructL();
-
-	void ExtractEntriesL();
-	void CopyToPhonebookEntryField(TDes8& aDest, const TDesC16& aSrc);
-	void FormatReplyL();
-	TInt ParseParameters();
-	void AppendEntryL(const TPhoneBookEntry& aEntry);
-	
-private:
-	/**
-	 * The first index to be read from phonebook store.
-	 */
-    TInt iIndex1;
-
-	/**
-	 * The last index to be read from phonebook store.
-	 */
-    TInt iIndex2;
-
-	/**
-	 * The reply
-	 */
-    RBuf8 iReply;
-
-	/**
-	 * The phone book store. used to get entries information and entries.
-	 */
-    RMobilePhoneBookStore iPhoneBookStore;
-    
-	/**
-	 * used to save the entries information.
-	 */
-    RArray<TPhoneBookEntry> iEntries;
-
-	/**
-	 * Used to parse the content get from PhoneBookStore.
-	 */
-    CPhoneBookBuffer* iPhoneBookBuffer;
-    
-	/**
-	 * The buffer to get phonebookstore entries content.
-	 */
-    RBuf8 iContactsBuf; 
-    
-	/**
-	 * Current state
-	 */
-    TSCPBRState iState;
-    
-	/**
-	 * The PhonebookInfo, used to get phone book entries information.
-	 */
-    RMobilePhoneBookStore::TMobilePhoneBookInfoV1 iPhoneBookInfo;
-    
-    /**
-     * Total entries supported by phonebook store.
-     */
-    TInt iTotalEntries;
-	/**
-	 * The max number length supported
-	 */
-    TInt iNLength;
-
-	/**
-	 * The max email length supported.
-	 */
-    TInt iMLength;
-
-	/**
-	 * The max text length supported.
-	 */
-    TInt iTLength;
-    
-	/**
-	 * Used to get 3GPBInfo.
-	 */ 
-    RMmCustomAPI iCustomApi;
-    
-	/**
-	 * Used to get 3GPBInfo.
-	 */
-    RMmCustomAPI::T3GPBInfo i3GPBInfo;
-
-    };
-
-#endif /* SCPBRCOMMANDHANDLER_H_ */
--- a/cbsatplugin/atmisccmdplugin/inc/scpbwcommandhandler.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * SCPBWCommandHandler class declaration for AT^SCPBW command
- * 
- */
-
-#ifndef SCPBWCOMMANDHANDLER_H
-#define SCPBWCOMMANDHANDLER_H
-
-#include "atcmdasyncbase.h"
-
-#include <etelmm.h>
-#include <rmmcustomapi.h>
-
-class CPhoneBookBuffer;
-
-/**
- *  AT^SCPBW command handler implementation class
- */
-NONSHARABLE_CLASS( CSCPBWCommandHandler ) : public CATCmdAsyncBase
-    {
-private:
-    enum TSCPBWState
-        {
-        ESCPBWStateIdle,
-        ESCPBWStateGetPhonebookInfo,
-        ESCPBWStateGet3GPBInfo,
-        ESCPBWStateWrite,
-        ESCPBWStateDelete,
-        ESCPBWStateSimStoreNotSupported 
-        };
-    
-public:
-    static CSCPBWCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    ~CSCPBWCommandHandler();
-        
-private: // methods from CActive
-    virtual void RunL();
-    virtual void DoCancel();
-
-private: // methods from CATCmdAsyncBase    
-    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
-    
-private:
-    CSCPBWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
-    void ConstructL();
-
-    TInt ParseParameters( TBool& aIsDeleteRequest );
-    TInt CreateContactEntry();
-    void ResetParameters();    
-    void SetBuffer(TDes& aDest, const TDesC8& aSource);
-    
-private:
-
-    RMobilePhoneBookStore   iPhoneBookStore;
-    CPhoneBookBuffer*       iPhoneBookBuffer;
-    RMobilePhoneBookStore::TMobilePhoneBookInfoV1 iPhoneBookStoreInfo;
-    RMmCustomAPI    iMmCustomAPI;
-    RMmCustomAPI::T3GPBInfo i3GPBInfo;
-    
-    TInt    iIndex;
-    RBuf    iNum1;
-    TInt    iType1;
-    RBuf    iNum2;
-    TInt    iType2;
-    RBuf    iNum3;
-    TInt    iType3;
-    RBuf    iNum4;
-    TInt    iType4;
-    RBuf    iText;
-    TInt    iCoding;
-    RBuf    iEmail;
-    
-    TInt    iNumLength;
-    TInt    iTextLength;
-    TInt    iEmailLength;
-    TInt    iMaxEntries;
-
-    RBuf8   iPbData;
-    
-    TSCPBWState iState;
-    
-    RBuf8 iReply;
-    
-    };
-
-#endif /* SCPBWCOMMANDHANDLER_H */
--- a/cbsatplugin/atmisccmdplugin/inc/telephonywrapper.h	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * 
- * Description :
- * 
- * CTelephonyWrapper class declaration for wrapping CTelephony::GetPhoneId 
- * 
- */
-
-#ifndef TELEPHONYWRAPPER_H
-#define TELEPHONYWRAPPER_H
-
-#include <etel3rdparty.h>
-
-/**
- *  Synchronous wrapper for CTelephony::GetPhoneId 
- */
-NONSHARABLE_CLASS (CTelephonyWrapper) : public CActive   
-    {     
-public:
-    static CTelephonyWrapper* NewL();         
-    virtual ~CTelephonyWrapper();     
-
-    TInt SynchronousGetPhoneId(); 
-
-    const TDesC8& GetPhoneModel();
-    const TDesC8& GetPhoneSerialNum();
-    const TDesC8& GetPhoneManufacturer();
-
-private: // From CActive
-    virtual void RunL();
-    virtual void DoCancel();
-    
-private: // Constructors
-    CTelephonyWrapper();
-    void ConstructL();
-    
-private:                
-    CActiveSchedulerWait        iWaiter;
-    
-    CTelephony*                 iTelephony;
-    CTelephony::TPhoneIdV1      iPhoneIdV1;
-    CTelephony::TPhoneIdV1Pckg  iPhoneIdV1Pckg;    
-    
-    TBufC8<CTelephony::KPhoneModelIdSize> iModel;
-    TBufC8<CTelephony::KPhoneSerialNumberSize> iSn;
-    TBufC8<CTelephony::KPhoneManufacturerIdSize> iManufacturer;
-    
-    };
-
-#endif /* TELEPHONYWRAPPER_H */
--- a/cbsatplugin/atmisccmdplugin/rom/atmisccmdplugin.iby	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/rom/atmisccmdplugin.iby	Wed Oct 13 14:43:49 2010 +0300
@@ -16,11 +16,7 @@
 #ifndef ATMISCCMDPLUGIN_IBY
 #define ATMISCCMDPLUGIN_IBY
 
-#ifdef PROTOCOL_TDSCDMA
-ECOM_PLUGIN(atmisccmdplugin_td.dll, atmisccmdplugin_td.rsc)
-#else
 ECOM_PLUGIN(atmisccmdplugin.dll, atmisccmdplugin.rsc)
-#endif
 
 #endif // ATMISCCMDPLUGIN_IBY
 
--- a/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -58,27 +58,7 @@
     _LIT8(KAtCpin, "AT+CPIN");
     _LIT8(KAtCusd, "AT+CUSD");
     _LIT8(KAtCnum, "AT+CNUM");
-	_LIT8(KAtCmee, "AT+CMEE");
-    _LIT8(KAtHver, "AT^HVER");
-    _LIT8(KAtCgsn, "AT+CGSN");
-    _LIT8(KAtCgmr, "AT+CGMR");
-    _LIT8(KAtCgmi, "AT+CGMI");
-    _LIT8(KAtCmgw, "AT+CMGW");
-	_LIT8(KAtCmgd, "AT+CMGD");
-	_LIT8(KAtCmgf, "AT+CMGF");
-	_LIT8(KAtiBase, "ATI");
-	_LIT8(KAti0, "ATI0");
-	_LIT8(KAti1, "ATI1");
-	_LIT8(KAti2, "ATI2");
-	_LIT8(KAti3, "ATI3");
-	_LIT8(KAti4, "ATI4");
-	_LIT8(KAtGmr, "AT+GMR");
-	_LIT8(KAtGmi, "AT+GMI");
-	_LIT8(KAtGsn, "AT+GSN");
-	_LIT8(KAtCgmm, "AT+CGMM");
-	_LIT8(KAtGmm, "AT+GMM");
-	_LIT8(KAtScpbr, "AT^SCPBR");
-	_LIT8(KAtScpbw, "AT^SCPBW");
+    _LIT8(KAtCmee, "AT+CMEE");
     
     Trace(KDebugPrintS, "token: ", &token);
     // Determine the AT command type
@@ -110,89 +90,9 @@
         {
         iCmdType = ECmdAtCnum;
         }
-    else if(!token.CompareF(KAtCmee))
+    else if(!token.Compare(KAtCmee))
         {
         iCmdType = ECmdAtCmee;
-		}
-    else if(!token.CompareF(KAtHver))
-        {
-        iCmdType = ECmdAtHver;
-        }
-    else if(!token.CompareF(KAtCgsn))
-        {
-        iCmdType = ECmdAtCgsn;
-        }
-    else if(!token.CompareF(KAtGsn))
-        {
-        iCmdType = ECmdAtGsn;
-        }
-    else if(!token.CompareF(KAtCgmr))
-        {
-        iCmdType = ECmdAtCgmr;
-        }
-    else if(!token.CompareF(KAtGmr))
-        {
-        iCmdType = ECmdAtGmr;
-        }
-    else if(!token.CompareF(KAtCgmi))
-        {
-        iCmdType = ECmdAtCgmi;
-        }    
-    else if(!token.CompareF(KAtGmi))
-        {
-        iCmdType = ECmdAtGmi;
-        } 
-    else if(!token.CompareF(KAtCmgw))
-        {
-        iCmdType = ECmdAtCmgw;
-        }
-    else if(!token.CompareF(KAtCmgd))
-        {
-        iCmdType = ECmdAtCmgd;
-        }
-    else if(!token.CompareF(KAtCmgf))
-        {
-        iCmdType = ECmdAtCmgf;
-        }
-    else if(!token.CompareF(KAtCgmm))
-        {
-        iCmdType = ECmdAtCgmm;
-        }
-    else if(!token.CompareF(KAtGmm))
-        {
-        iCmdType = ECmdAtGmm;
-        }
-    else if(!token.CompareF(KAtiBase))
-        {
-        iCmdType = ECmdAtI;
-        }
-    else if(!token.CompareF(KAti0))
-        {
-        iCmdType = ECmdAtI0;
-        }
-    else if(!token.CompareF(KAti1))
-        {
-        iCmdType = ECmdAtI1;
-        }
-    else if(!token.CompareF(KAti2))
-        {
-        iCmdType = ECmdAtI2;
-        }
-    else if(!token.CompareF(KAti3))
-        {
-        iCmdType = ECmdAtI3;
-        }
-    else if(!token.CompareF(KAti4))
-        {
-        iCmdType = ECmdAtI4;
-        }
-	else if(!token.CompareF(KAtScpbr))
-        {
-        iCmdType = ECmdAtScpbr;
-        } 
-    else if(!token.CompareF(KAtScpbw))
-        {
-        iCmdType = ECmdAtScpbw;
         }
     else
         {
@@ -254,8 +154,8 @@
     if(!iCmd.Eos())
         {
         chr = iCmd.Peek();
-        while(!iCmd.Eos() && chr != ',' && !chr.IsControl())
-            {// Stop at any comma or control character
+        while(!iCmd.Eos() && chr != ',' && !chr.IsSpace() && !chr.IsControl())
+            {// Stop at any of those chars: comma, space or control
             iCmd.Inc();
             chr = iCmd.Peek();
             }
@@ -264,30 +164,12 @@
     // Extract the token at this point            
     TPtrC8 retVal = iCmd.MarkedToken();
     
-	//ignore all space characters at the end
-    if(retVal.Length() > 1)
-    {
-        TInt pos = retVal.Length() - 1; 
-        for ( ; pos >= 0; pos-- )
-            {
-            const TChar ch( retVal[pos] );
-            if( !ch.IsSpace() )
-                {
-                break;
-                }
-            }
-        retVal.Set( retVal.Mid( 0, pos + 1 ) );
-    }
-    
-    
     // Skip comma, space and control chars
-    do
-      {
-      iCmd.Inc();
-      chr = iCmd.Peek();
-      }
-    while(!iCmd.Eos() && (chr.IsSpace() || chr.IsControl()));
-    
+    while(!iCmd.Eos() && (chr == ',' || chr.IsSpace() || chr.IsControl()))
+        {
+        iCmd.Inc();
+        chr = iCmd.Peek();
+        }
     TRACE_FUNC_EXIT
     return retVal;
     }
@@ -328,21 +210,8 @@
         }
     else
         {
-        //check if param contains only digits - TLex doesn't do that
-        for(TInt pos = param.Length() - 1; pos >= 0; pos--)
-            {
-            if(( param[pos] < '0' ) || ( param[pos] > '9' ))
-                {
-                retVal = KErrArgument;
-                break;
-                }
-            }
-        
-        if(retVal == KErrNone)
-            {
-            TLex8 lex(param);
-            retVal = lex.Val(aValue);
-            }
+        TLex8 lex(param);
+        retVal = lex.Val(aValue);
         }
     TRACE_FUNC_EXIT
     return retVal;
--- a/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -24,44 +24,20 @@
 #include "cnumcommandhandler.h"
 #include "cfuncommandhandler.h"
 #include "cbccommandhandler.h"
-#include "hvercommandhandler.h"
-#include "cgsncommandhandler.h"
-#include "cgmrcommandhandler.h"
-#include "cgmicommandhandler.h"
-#include "cmgwcommandhandler.h"
-#include "cmgdcommandhandler.h"
-#include "telephonywrapper.h"
-#include "cgmmcommandhandler.h"
-#include "scpbrcommandhandler.h"
-#include "scpbwcommandhandler.h"
 
 #include "atmisccmdpluginconsts.h"
-#include "cmserror.h"
 #include "debug.h"
 
-#include <exterror.h>           // Additional RMobilePhone error code
-#include <etelmmerr.h>          // ETelMM error code
-#include <gsmerror.h>           // GSM error code
+#include <EXTERROR.H>           // Additional RMobilePhone error code
 
 // +CME error code
-_LIT8(KCMEMemoryFailure, "+CME ERROR: 23\r\n"); // Memory failure.\r\n
 _LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n
 _LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n
 _LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n
 _LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n
 _LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error
-_LIT8(KCMESimNotInserted, "+CME ERROR: 10\r\n"); // SIM not inserted 
-_LIT8(KCMEMemoryFull, "+CME ERROR: 20\r\n"); // Memory full
-_LIT8(KCMEInvalidIndex, "+CME ERROR: 21\r\n"); // Invalid index 
-_LIT8(KCMENotFound, "+CME ERROR: 22\r\n"); // Not found 
-_LIT8(KCMEDialStringTooLong, "+CME ERROR: 26\r\n"); // Dial string too long 
-_LIT8(KCMETextStringTooLong, "+CME ERROR: 24\r\n"); // Text string too long 
-_LIT8(KCMEInvalidCharacters, "+CME ERROR: 27\r\n"); // Invalid characters in dial string
-
-
 
 const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
-const TInt KEditorReplyLength = 4;  // CR+LF+'>'+' '
 
 CATMiscCmdPlugin* CATMiscCmdPlugin::NewL()
     {
@@ -83,16 +59,7 @@
     delete iCNUMHandler;
     delete iCFUNHandler;
     delete iCBCHandler;
-	delete iHVERHandler;
-	delete iCGSNHandler;
-    delete iCGMRHandler;
-    delete iCGMIHandler;
-    delete iCMGWHandler;
-    delete iCMGDHandler;
-    delete iCGMMHandler;
-	delete iSCPBRHandler;
-    delete iSCPBWHandler;  
-	
+    
     iPhone.Close();
     iTelServer.Close();
 	}
@@ -114,38 +81,6 @@
     iCNUMHandler = CCNUMCommandHandler::NewL(this, iCommandParser, iPhone, iTelServer);
     iCFUNHandler = CCFUNCommandHandler::NewL(this, iCommandParser, iPhone);
     iCBCHandler = CCBCCommandHandler::NewL(this, iCommandParser, iPhone);
-	iHVERHandler = CHVERCommandHandler::NewL(this, iCommandParser, iPhone);
-    iCGSNHandler = CCGSNCommandHandler::NewL(this, iCommandParser, iPhone);
-    iCGMRHandler = CCGMRCommandHandler::NewL(this, iCommandParser, iPhone);
-    iCGMIHandler = CCGMICommandHandler::NewL(this, iCommandParser, iPhone);
-    iCMGWHandler = CCMGWCommandHandler::NewL(this, iCommandParser, iPhone);
-    iCMGDHandler = CCMGDCommandHandler::NewL(this, iCommandParser, iPhone); 
-    iCGMMHandler = CCGMMCommandHandler::NewL(this, iCommandParser, iPhone);
-	iSCPBRHandler = CSCPBRCommandHandler::NewL(this, iCommandParser, iPhone);
-    iSCPBWHandler = CSCPBWCommandHandler::NewL(this, iCommandParser, iPhone);
-    
-   
-    // Get telephony information - Model, IMEI, Manufacturer
-    CTelephonyWrapper* telephonyWrapper = CTelephonyWrapper::NewL();
-    TInt result = telephonyWrapper->SynchronousGetPhoneId();
-
-    if (KErrNone == result)
-        {
-        static_cast<CHVERCommandHandler*>(iHVERHandler)->SetHWVersion(telephonyWrapper->GetPhoneModel());
-        static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetSerialNum(telephonyWrapper->GetPhoneSerialNum());
-        static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
-        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetManufacturer(telephonyWrapper->GetPhoneManufacturer());
-        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetModelID(telephonyWrapper->GetPhoneModel());
-        }
-    else // The result is used to determine whether to display CME error or not
-        {
-        static_cast<CHVERCommandHandler*>(iHVERHandler)->SetTelephonyError(result);
-        static_cast<CCGSNCommandHandler*>(iCGSNHandler)->SetTelephonyError(result);
-        static_cast<CCGMICommandHandler*>(iCGMIHandler)->SetTelephonyError(result);
-        static_cast<CCGMMCommandHandler*>(iCGMMHandler)->SetTelephonyError(result);
-        }
-    delete telephonyWrapper;
-    
     TRACE_FUNC_EXIT
    	}
 
@@ -215,69 +150,9 @@
             }
         case (TAtCommandParser::ECmdAtCmee):
             {
-            iCurrentHandler = NULL;	
-            break;
-			}
-        case (TAtCommandParser::ECmdAtHver):
-            {
-            iCurrentHandler = iHVERHandler;
-            break;
-            }
-        case (TAtCommandParser::ECmdAtCgsn): // intentional fall through
-        case (TAtCommandParser::ECmdAtGsn):
-        case (TAtCommandParser::ECmdAtI1):
-            {
-            iCurrentHandler = iCGSNHandler;
-            break;
-            }
-        case (TAtCommandParser::ECmdAtCgmr): // intentional fall through
-        case (TAtCommandParser::ECmdAtGmr):
-        case (TAtCommandParser::ECmdAtI2):
-        case (TAtCommandParser::ECmdAtI4):
-            {
-            iCurrentHandler = iCGMRHandler;
-            break;
-            }
-        case (TAtCommandParser::ECmdAtCgmi): // intentional fall through
-        case (TAtCommandParser::ECmdAtGmi):
-        case (TAtCommandParser::ECmdAtI):
-        case (TAtCommandParser::ECmdAtI0):
-            {
-            iCurrentHandler = iCGMIHandler;
-            break;
-            }
-        case (TAtCommandParser::ECmdAtCmgw):
-            {
-            iCurrentHandler = iCMGWHandler;
-            break;
-            }
-		case (TAtCommandParser::ECmdAtCmgd):
-            {
-            iCurrentHandler = iCMGDHandler;
-            break;
-            }
-		case (TAtCommandParser::ECmdAtCmgf):
-            {
             iCurrentHandler = NULL;
             break;
             }
-		case (TAtCommandParser::ECmdAtCgmm): // intentional fall through
-		case (TAtCommandParser::ECmdAtGmm):
-		case (TAtCommandParser::ECmdAtI3):
-            {
-            iCurrentHandler = iCGMMHandler;
-            break;
-            }
-		case (TAtCommandParser::ECmdAtScpbr):
-            {
-            iCurrentHandler = iSCPBRHandler;
-            break;
-            }    
-		case (TAtCommandParser::ECmdAtScpbw):
-            {
-            iCurrentHandler = iSCPBWHandler;
-            break;
-            }
         case (TAtCommandParser::EUnknown):
         default:
             {
@@ -304,11 +179,6 @@
         HandleCMEECommand();
         HandleCommandCompleted( KErrNone, EReplyTypeOk);
 	    }
-	else if (iCommandParser.Command() == TAtCommandParser::ECmdAtCmgf)
-	    {
-        HandleCMGFCommand();
-        HandleCommandCompleted( KErrNone, EReplyTypeOk);
-	    }
 	else if (iCurrentHandler != NULL)
 	    {
 	    iHcCmd = &aCmd;
@@ -408,29 +278,30 @@
     {
     TRACE_FUNC_ENTRY
     TInt ret = KErrNone;
+    TInt partLength;
     if ( iReplyBuffer.Length() <= 0 )
         {
         ret = KErrGeneral;
         }
     else
         {
-    	TInt partLength = NextReplyPartLength();
+        partLength = NextReplyPartLength();
         if ( iReplyBuffer.Length() < partLength )
             {
             ret =  KErrNotFound;
             }
-        else if (ret == KErrNone)
-			{
-			aBuffer.Create( iReplyBuffer, partLength );
-			iReplyBuffer.Delete( 0, partLength );
-			if ( iReplyBuffer.Length() == 0 )
-				{
-				iReplyBuffer.Close();
-				}
-			}
+        }
+    Trace(KDebugPrintD, "ret: ", ret);
+    if (ret == KErrNone)
+        {
+        aBuffer.Create( iReplyBuffer, partLength );
+        iReplyBuffer.Delete( 0, partLength );
+        if ( iReplyBuffer.Length() == 0 )
+            {
+            iReplyBuffer.Close();
+            }
         }
 
-    Trace(KDebugPrintD, "ret: ", ret);
     TRACE_FUNC_EXIT
     return ret;
     }
@@ -477,9 +348,6 @@
         {
         case EReplyTypeOther:
             break;
-        case EReplyTypeEditor:
-            CreateEditModeBuffer( iReplyBuffer );
-            break;
         case EReplyTypeOk:
             CreateOkOrErrorReply( iReplyBuffer, ETrue );
             break;
@@ -492,12 +360,9 @@
         }
     CreatePartOfReply( *iHcReply );
     HandleCommandCompleted( KErrNone, aReplyType );
-    if ( EReplyTypeEditor != aReplyType )
-        {
-        iHcCmd = NULL;
-        iHcReply = NULL;
-        iCurrentHandler = NULL;
-        }
+    iHcCmd = NULL;
+    iHcReply = NULL;
+    iCurrentHandler = NULL;
     TRACE_FUNC_EXIT
     return KErrNone;
     }
@@ -549,28 +414,6 @@
     }
 
 /**
- * @see MATMiscCmdPlugin::CreateEditModeBuffer
- */
-TInt CATMiscCmdPlugin::CreateEditModeBuffer( RBuf8& aReplyBuffer )
-    {
-    TRACE_FUNC_ENTRY
-    _LIT8( KReplyPromptAndSpace, "> " );
-    TBuf8<KEditorReplyLength> replyBuffer;
-    replyBuffer.Append( iCarriageReturn );
-    replyBuffer.Append( iLineFeed );
-    replyBuffer.Append( KReplyPromptAndSpace );
-
-    TInt err = aReplyBuffer.ReAlloc( aReplyBuffer.Length() + replyBuffer.Length() );
-    if (KErrNone != err)
-        {
-        return err;
-        }
-    aReplyBuffer.Append( replyBuffer );
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-/**
  * @see MATMiscCmdPlugin::GetCharacterValue
  */
 TInt CATMiscCmdPlugin::GetCharacterValue( TCharacterTypes aCharType,
@@ -658,64 +501,12 @@
                 response.Append(KCMENotAllowed);
                 break;
                 }
-			case KErrGsmMMImeiNotAccepted:
-	            {
-	            // Memory failure
-	            response.Append(KCMEMemoryFailure);
-	            break;
-	            }
             case KErrUnknown:
-            case KErrGsmSimServAnrFull:
                 {
                 // unknown error
                 response.Append(KCMEPhoneUnknown);
                 break;
                 }
-            case KErrNotFound:
-                {
-                response.Append(KCMENotFound);
-                break;
-                }
-            case KErrInUse:
-            case KErrGsmMMServiceOptionTemporaryOutOfOrder:
-                {
-                // SIM not inserted
-                response.Append(KCMESimNotInserted);
-                break;
-                }
-            case KErrArgument:
-            case KErrGsm0707InvalidIndex:
-            case KErrGsm0707NotFound:
-                {
-                // Invalid index
-                response.Append(KCMEInvalidIndex);
-                break;
-                }
-            case KErrGsm0707TextStringTooLong:
-                {
-                // Text string too long
-                response.Append(KCMETextStringTooLong);
-                break;
-                }
-            case KErrGsm0707DialStringTooLong:
-                {
-                // Dial string too long
-                response.Append(KCMEDialStringTooLong);
-                break;
-                }
-            case KErrGsmCCUnassignedNumber:
-            case KErrGsm0707InvalidCharsInDialString:
-                {
-                // Invalid characters in dial string
-                response.Append(KCMEInvalidCharacters);
-                break;
-                }
-            case KErrMMEtelMaxReached:
-                {
-                // Memory full
-                response.Append(KCMEMemoryFull);
-                break;
-                }
             default:
                 {
                 response.Append(KCMEPhoneError);
@@ -733,100 +524,6 @@
     TRACE_FUNC_EXIT
     }
 
-void CATMiscCmdPlugin::CreateCMSReplyAndComplete(TInt aError)
-    {
-    TRACE_FUNC_ENTRY
-    
-    if(iQuietMode)
-        {
-        CreateReplyAndComplete(EReplyTypeError);
-        }
-    else 
-        {
-        // return error code to AT client
-        RBuf8 response;
-        if (KErrNone != response.Create(KDefaultCmdBufLength))
-            {
-            CreateReplyAndComplete(EReplyTypeError);
-            return;
-            }
-       
-        // return error code to AT client
-        response.Append(KCRLF);
-        response.Append(KCMSErr);
-
-        switch(aError)
-            {
-            case KErrGsmSMSReserved:
-                {
-                // Other application cause SMS interface being reserved
-                response.AppendNum(EATCMSErr301);
-                break;
-                }
-            case KErrGsmSMSInvalidPDUModeParameter:
-                {
-                // Under the mode of PDU, PDU parameter error 
-                response.AppendNum(EATCMSErr304);
-                break;
-                }
-            case KErrGsm0707SimFailure:
-            case KErrGsmMMServiceOptionTemporaryOutOfOrder:
-                {    
-                // SIM card not inserted
-                response.AppendNum(EATCMSErr310);
-                break;
-                }
-            case KErrGsmSMSSimPin1Required:
-                {
-                // PIN request by SIM card
-                response.AppendNum(EATCMSErr311);
-                break;
-                }
-            case KErrGsmSMSPhoneToSimLockRequired:
-                {
-                // PH-(U) SIM PIN request by SIM card
-                response.AppendNum(EATCMSErr312);
-                break;
-                }
-            case KErrGsmSMSSimPuk1Required:
-                {
-                // PUK request by SIM card
-                response.AppendNum(EATCMSErr316);
-                break;
-                }
-            case KErrGsmSMSMemoryFailure:
-                {
-                // Memory error
-                response.AppendNum(EATCMSErr320);
-                break;
-                }
-            case KErrPathNotFound:
-            case KErrGsmSMSInvalidMemoryIndex:
-                {
-                // Invalid Memory index number 
-                response.AppendNum(EATCMSErr321);
-                break;
-                }
-            case KErrOverflow:
-            case KErrGsmSMSMemoryFull:
-                {
-                // Memory is full
-                response.AppendNum(EATCMSErr322);
-                break;
-                }
-            default:
-				{
-				response.AppendNum(EATCmsErrGeneral);
-				break;
-				}
-            }
-        CreateReplyAndComplete( EReplyTypeError, response );
-        response.Close();
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
 TInt CATMiscCmdPlugin::HandleUnsolicitedRequest(const TDesC8& aAT )
     {
     TRACE_FUNC_ENTRY
@@ -858,27 +555,6 @@
     TRACE_FUNC_EXIT
     }
 
-
-void CATMiscCmdPlugin::HandleCMGFCommand()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iCommandParser.CommandHandlerType();
-    
-    if (cmdHandlerType == TAtCommandParser::ECmdHandlerTypeSet)
-        {
-        TInt msgFormat = 0;
-        TInt ret = iCommandParser.NextIntParam(msgFormat);
-        if(ret == KErrNone && iCMGWHandler)
-            {
-            static_cast<CCMGWCommandHandler*> (iCMGWHandler)->SetMessageFormat(msgFormat);
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-  
-
 void CATMiscCmdPlugin::ConnectToEtelL(RTelServer& aTelServer, RMobilePhone& aPhone)
     {
     TRACE_FUNC_ENTRY
@@ -895,12 +571,6 @@
         }
     User::LeaveIfError(aTelServer.GetPhoneInfo(0, info));
     User::LeaveIfError(aPhone.Open(aTelServer, info.iName));
-    
-    if (iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)!=KErrNone)
-        {
-        User::LeaveIfError(iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorBasic));
-        }
-
     TRACE_FUNC_EXIT
     }
 
--- a/cbsatplugin/atmisccmdplugin/src/cgmicommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "cgmicommandhandler.h"
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-CCGMICommandHandler* CCGMICommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCGMICommandHandler* self = new (ELeave) CCGMICommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCGMICommandHandler::CCGMICommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMICommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.CreateL(KDefaultCmdBufLength);
-    TRACE_FUNC_EXIT
-    }
-
-CCGMICommandHandler::~CCGMICommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMICommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        case (TAtCommandParser::ECmdHandlerTypeBase):
-            {
-            if(iTelError == KErrNone)
-                {
-                if (iReply.Length() == 0)
-                    {
-                    iReply.Append( KCRLF );
-                    iReply.Append( iManufacturer );            
-                    iReply.Append( KCRLF );
-                    }
-              
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
-                }
-            else
-                {
-                iCallback->CreateCMEReplyAndComplete(iTelError);
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete(EReplyTypeError);
-            break;
-            }
-        }
-      
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMICommandHandler::SetManufacturer(const TDesC8& aManufacturer)
-    {
-    TRACE_FUNC_ENTRY
-    ASSERT( aManufacturer.Length() <= CTelephony::KPhoneModelIdSize );
-    iManufacturer.Zero();
-    iManufacturer.Copy(aManufacturer);
-    TRACE_FUNC_EXIT
-    }
-
-
-void CCGMICommandHandler::SetTelephonyError(TInt aTelError)
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = aTelError;
-    TRACE_FUNC_EXIT
-    }
-
-
--- a/cbsatplugin/atmisccmdplugin/src/cgmmcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "cgmmcommandhandler.h"
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-CCGMMCommandHandler* CCGMMCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCGMMCommandHandler* self = new (ELeave) CCGMMCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCGMMCommandHandler::CCGMMCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMMCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.CreateL(KDefaultCmdBufLength);
-    TRACE_FUNC_EXIT
-    }
-
-CCGMMCommandHandler::~CCGMMCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMMCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        case (TAtCommandParser::ECmdHandlerTypeBase):
-            {
-            if(iTelError == KErrNone)
-                {
-                if (iReply.Length() == 0)
-                    {
-                    _LIT8( KSpace, " " );
-                
-                    iReply.Append( KCRLF );
-                    iReply.Append( iManufacturer );
-                    iReply.Append( KSpace );
-                    iReply.Append( iModel );    
-                    iReply.Append( KCRLF );
-                    }
-              
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
-                }
-            else
-                {
-                iCallback->CreateCMEReplyAndComplete(iTelError);
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete(EReplyTypeError);
-            break;
-            }
-        }
-      
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMMCommandHandler::SetManufacturer(const TDesC8& aManufacturer)
-    {
-    TRACE_FUNC_ENTRY
-    iManufacturer.Zero();
-    if (aManufacturer.Length() <= CTelephony::KPhoneManufacturerIdSize)
-        {
-        iManufacturer.Copy(aManufacturer);
-        }
-    else
-        {
-        iManufacturer.Copy(aManufacturer.Left(CTelephony::KPhoneManufacturerIdSize));
-        }   
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMMCommandHandler::SetModelID(const TDesC8& aModelID)
-    {
-    TRACE_FUNC_ENTRY
-    iModel.Zero();
-    if (aModelID.Length() <= CTelephony::KPhoneModelIdSize)
-        {
-        iModel.Copy(aModelID);
-        }
-    else
-        {
-        iModel.Copy(aModelID.Left(CTelephony::KPhoneModelIdSize));
-        }    
-    TRACE_FUNC_EXIT
-    }
-
-
-void CCGMMCommandHandler::SetTelephonyError(TInt aTelError)
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = aTelError;
-    TRACE_FUNC_EXIT
-    }
-
-
--- a/cbsatplugin/atmisccmdplugin/src/cgmrcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include <sysutil.h>
-
-#include "cgmrcommandhandler.h"
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-CCGMRCommandHandler* CCGMRCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCGMRCommandHandler* self = new (ELeave) CCGMRCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCGMRCommandHandler::CCGMRCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMRCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.CreateL(KDefaultCmdBufLength);
-    TRACE_FUNC_EXIT
-    }
-
-CCGMRCommandHandler::~CCGMRCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CCGMRCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        case (TAtCommandParser::ECmdHandlerTypeBase):
-            {
-            TInt replyType = EReplyTypeOk;
-            if (iReply.Length() == 0)
-                {
-                replyType = GetSoftwareVersion();
-                }
-            
-            if ( (EReplyTypeOk != replyType) )
-                {
-                iCallback->CreateCMEReplyAndComplete(KErrUnknown);
-                }
-            else
-                {
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete(EReplyTypeError);
-            break;
-            }
-        }
-    TRACE_FUNC_EXIT
-    }
-
-TInt CCGMRCommandHandler::GetSoftwareVersion()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.Append( KCRLF );
-
-    // Get software version (e.g. 010.009)
-    TBuf<KSysUtilVersionTextLength> swVersion;   
-    TInt errorCode = SysUtil::GetSWVersion( swVersion );
-
-    if (KErrNone == errorCode)
-        {
-        TLex8 lex(swVersion.Collapse());
-        lex.SkipCharacters();
-        TPtrC8 token = lex.MarkedToken(); 
-        iReply.Append(token);
-        
-        iReply.Append( KCRLF );
-        TRACE_FUNC_EXIT
-        return EReplyTypeOk;
-        }
-    else
-        {
-        TRACE_FUNC_EXIT
-        return EReplyTypeError;
-        }
-    }
-
-
-
--- a/cbsatplugin/atmisccmdplugin/src/cgsncommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "cgsncommandhandler.h"
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-CCGSNCommandHandler* CCGSNCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCGSNCommandHandler* self = new (ELeave) CCGSNCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCGSNCommandHandler::CCGSNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CCGSNCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = KErrNone;
-    iReply.CreateL(KDefaultCmdBufLength);
-    TRACE_FUNC_EXIT
-    }
-
-CCGSNCommandHandler::~CCGSNCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CCGSNCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        case (TAtCommandParser::ECmdHandlerTypeBase):
-            {
-            if(iTelError == KErrNone)
-                {
-                if (iReply.Length() == 0)
-                    {
-                    iReply.Append( KCRLF );
-                    iReply.Append( iSN );     
-                    iReply.Append( KCRLF );
-                    }
-              
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
-                }
-            else
-                {
-                iCallback->CreateCMEReplyAndComplete(iTelError);
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete(EReplyTypeError);
-            break;
-            }
-        }
-      
-    TRACE_FUNC_EXIT
-    }
-
-void CCGSNCommandHandler::SetSerialNum(const TDesC8& aSerial)
-    {
-    TRACE_FUNC_ENTRY
-    ASSERT( aSerial.Length() <= CTelephony::KPhoneSerialNumberSize );
-    iSN.Zero();
-    iSN.Copy(aSerial);
-    TRACE_FUNC_EXIT
-    }
-
-void CCGSNCommandHandler::SetTelephonyError(TInt aTelError)
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = aTelError;
-    TRACE_FUNC_EXIT
-    }
-
-
--- a/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -719,6 +719,11 @@
                 }
             break;
             }
+        default:
+            {
+            TRACE_FUNC_EXIT
+            return KErrArgument;
+            }
         }
     
     // if phone password is required it needs to be hashed before verification
--- a/cbsatplugin/atmisccmdplugin/src/cmgdcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,462 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "cmgdcommandhandler.h"
-#include <mmtsy_names.h> 
-#include <mmretrieve.h>
-#include <exterror.h>
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-const TInt KDefaultListLength = 256;
-
-CCMGDCommandHandler* CCMGDCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCMGDCommandHandler* self = new (ELeave) CCMGDCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCMGDCommandHandler::CCMGDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdAsyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGDCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    iReply.CreateL(KDefaultCmdBufLength);
-    
-    User::LeaveIfError( iMobileSmsMessaging.Open(iPhone) );
-
-    TInt err = iMobileSmsStore.Open(iMobileSmsMessaging, KETelIccSmsStore);
-    if (err != KErrNone)
-        {
-        iHandlerState = ECMGDStateSimStoreNotSupported;
-        }
-    
-    iRetrieveSmsList = CRetrieveMobilePhoneSmsList::NewL(iMobileSmsStore, RMobileSmsStore::KETelMobileGsmSmsEntryV1);
-    
-    TRACE_FUNC_EXIT
-    }
-
-CCMGDCommandHandler::~CCMGDCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    Cancel();
-    delete iGsmSmsList;
-    delete iRetrieveSmsList;
-    iMobileSmsStore.Close();
-    iMobileSmsMessaging.Close();
-    iReply.Close();
-    iDeleteList.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGDCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    if (iHandlerState == ECMGDStateSimStoreNotSupported)
-        {
-        // Reply "ERROR" if SIM store is not supported
-        iCallback->CreateReplyAndComplete(EReplyTypeError);
-        TRACE_FUNC_EXIT
-        return;
-        }
-    
-    TInt ret = KErrNone;
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iRetrieveSmsList->Start(iStatus);
-            iHandlerState = ECMGDStateRetrieveAllIndices;
-            SetActive();
-            }
-            break;
-        case (TAtCommandParser::ECmdHandlerTypeSet):
-            {
-            ret = ParseParameters();
-            if (ret == KErrNone)
-                {
-                Trace(_L("index = %d"), iIndex);
-                Trace(_L("delflag = %d"), iDelFlag);
-                ret = DoHandleCommand();
-                }
-            else
-                {
-                ret = KErrArgument;
-                }
-            break;
-            }
-        default:
-            {
-            ret = KErrNotSupported;
-            break;
-            }
-        }
-    if (ret == KErrGsmSMSInvalidMemoryIndex)
-        {
-        iCallback->CreateCMSReplyAndComplete(ret);
-        }
-    else if (ret != KErrNone)
-        {
-        iCallback->CreateReplyAndComplete(EReplyTypeError);
-        }
-
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGDCommandHandler::RunL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    Trace(_L("Error = %d"), iStatus.Int());
-    Trace(_L("State = %d"), iHandlerState);
-    
-    iReply.Zero();
-    
-    TInt err = iStatus.Int();
-    if(err == KErrNone)
-        {
-        switch (iHandlerState)
-            {
-            case ECMGDStateRetrieveAllIndices:
-                {
-                GetMessageIndexListL();
-                iDeleteList.Reset();
-                break;
-                }
-            case ECMGDStateDeleteOneEntry:                
-            case ECMGDStateDeleteAllEntries:
-                {
-                // do nothing
-                break;
-                }
-            case ECMGDStateDeleteFilteredEntries:
-                {
-                FilterMessageListL();
-                break;
-                }
-            default:
-                {
-                iHandlerState = ECMGDStateIdle;
-                iCallback->CreateReplyAndComplete(EReplyTypeError);
-                TRACE_FUNC_EXIT
-                return;
-                }
-            }
-        
-        if (iDeleteList.Count() != 0)
-            {
-            // delete the first entry in the list
-            iMobileSmsStore.Delete(iStatus, iDeleteList[0]);
-            iDeleteList.Remove(0);
-            iHandlerState = ECMGDStateDeleteOneEntry;
-            SetActive();                    
-            }
-        else
-            {
-            // deleting finished
-            iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-            }
-        }
-    else if (err == KErrNotFound)
-        {
-        // no message found in SIM
-        switch (iHandlerState)
-            {
-            case ECMGDStateRetrieveAllIndices:
-                {
-                iHandlerState = ECMGDStateIdle;
-                iReply.Format(KCMGDSupportedCmdsList, &KNullDesC8);
-                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-                break;
-                }
-            case ECMGDStateDeleteFilteredEntries:
-                {
-                iMobileSmsStore.DeleteAll(iStatus);
-                iHandlerState = ECMGDStateDeleteAllEntries;
-                SetActive();
-                break;
-                }
-            default:
-                iHandlerState = ECMGDStateIdle;
-                iCallback->CreateCMSReplyAndComplete(err);
-                break;
-            }
-        }
-    else 
-        {
-        iHandlerState = ECMGDStateIdle;
-        iCallback->CreateCMSReplyAndComplete(err);
-        }
-
-    TRACE_FUNC_EXIT
-    }
-
-TInt CCMGDCommandHandler::RunError(TInt aError)
-    {
-    TRACE_FUNC_ENTRY
-    
-    iCallback->CreateCMSReplyAndComplete(aError);
-    
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-void CCMGDCommandHandler::DoCancel() 
-    {
-    TRACE_FUNC_ENTRY
-    
-    switch (iHandlerState)
-        {
-        case ECMGDStateRetrieveAllIndices:
-        case ECMGDStateDeleteFilteredEntries:
-            {
-            iRetrieveSmsList->Cancel();
-            break;
-            }
-        case ECMGDStateDeleteOneEntry:
-            {
-            iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
-            break;
-            }
-        case ECMGDStateDeleteAllEntries:
-            {
-            iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreDeleteAll);
-            break;
-            }
-        }
-
-    TRACE_FUNC_EXIT
-    }
-
-TInt CCMGDCommandHandler::ParseParameters()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt ret = KErrNone;
-    TInt index = 0;
-    TInt delflag = 0; // default value
-    TInt otherParams = 0;
-    
-    // get index 
-    TInt retIndex = iATCmdParser.NextIntParam(index);
-    // get delflag
-    TInt retDelflag = iATCmdParser.NextIntParam(delflag);
-    // get other params
-    TInt retOther = iATCmdParser.NextIntParam(otherParams);
-    // Syntax error happens if
-    // a)there is no param2 or param2 error 
-    // b)there is no param1 but param2==0
-    // c)there are too many params
-    TBool noParam = (retIndex!=KErrNone && retDelflag!=KErrNone || retDelflag==KErrGeneral );
-    TBool noParam1 = (retIndex!=KErrNone && retDelflag==KErrNone && delflag==0);
-    TBool tooManyParams = (retOther!=KErrNotFound);
-    
-    if (noParam || noParam1 || tooManyParams)
-        {
-        ret = KErrArgument;
-        }
-    else
-        {
-        iIndex = index;
-        iDelFlag = delflag;
-        }
-
-    TRACE_FUNC_EXIT
-    return ret;
-    }
-
-TInt CCMGDCommandHandler::DoHandleCommand()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = KErrNone;
-    
-    switch (iDelFlag)
-        {
-        case 0:
-            // deletes the designated message with <index>.
-            {
-            if (iIndex == 0)
-                {
-                // The first position in SIM store is 1,
-                // so zero is not in the supported range.
-                err = KErrGsmSMSInvalidMemoryIndex;
-                }
-            else
-                {
-                iDeleteList.Reset();
-                iMobileSmsStore.Delete(iStatus, iIndex);
-                iHandlerState = ECMGDStateDeleteOneEntry;
-                SetActive();
-                }
-            }
-            break;
-        case 1:
-            // deletes all read message in first-choice memory and reserves unread message, 
-            // sent message and unsent message.
-            {
-            iRetrieveSmsList->Start(iStatus);
-            iHandlerState = ECMGDStateDeleteFilteredEntries;
-            iFilterType = ECMGDFilterReadMessagesOnly;
-            SetActive();
-            }
-            break;
-        case 2:
-            // deletes all read message and sent message in first-choice memory 
-            // and reserves unread message and unsent message.
-            {
-            iRetrieveSmsList->Start(iStatus);
-            iHandlerState = ECMGDStateDeleteFilteredEntries;
-            iFilterType = ECMGDFilterReadAndSentMessages;
-            SetActive();            
-            }
-            break;
-        case 3:
-            // deletes all read message, sent message and unsent message in first-choice memory 
-            // and reserves unread message.
-            {
-            iRetrieveSmsList->Start(iStatus);
-            iHandlerState = ECMGDStateDeleteFilteredEntries;
-            iFilterType = ECMGDFilterReadSentAndUnsentMessages;
-            SetActive();            
-            }
-            break;
-        case 4:
-            // deletes all messages in first-choice memory, including unread message.
-            {
-            iDeleteList.Reset();
-            iMobileSmsStore.DeleteAll(iStatus);
-            iHandlerState = ECMGDStateDeleteAllEntries;
-            SetActive();
-            }
-            break;
-            
-        default:
-            err = KErrNotSupported;
-            break;
-        }
-    
-    TRACE_FUNC_EXIT
-    return err;
-    }
-
-void CCMGDCommandHandler::GetMessageIndexListL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    iReply.Zero();
-    delete iGsmSmsList;
-    iGsmSmsList = NULL;
-    
-    RBuf8 list;
-    list.CreateL(KDefaultListLength);
-    CleanupClosePushL(list);
-
-    iGsmSmsList = iRetrieveSmsList->RetrieveGsmListL();
-    TInt entriesNum = iGsmSmsList->Enumerate();
-    
-    if (entriesNum > 0)
-        {
-        // Append 1st item
-        RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
-        entry = iGsmSmsList->GetEntryL(0);
-        list.AppendNum(entry.iIndex);
-        
-        for (TInt i=1; i<entriesNum; ++i)
-            {
-            entry = iGsmSmsList->GetEntryL(i);
-            list.Append(',');
-            list.AppendNum(entry.iIndex);
-            }
-        }
-    iReply.Format(KCMGDSupportedCmdsList, &list);
-    
-    CleanupStack::PopAndDestroy(&list); //list
-    
-    TRACE_FUNC_EXIT
-    }
-
-/**
- * Filter message list with iFilterType
- * ECMGDFilterReadSentAndUnsentMessages: read, sent and unsent messages
- * ECMGDFilterReadAndSentMessages: read and sent messages
- * ECMGDFilterReadMessagesOnly: read messages
- */
-void CCMGDCommandHandler::FilterMessageListL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    delete iGsmSmsList;
-    iGsmSmsList = NULL;
-        
-    iDeleteList.Reset();
-    
-    iGsmSmsList = iRetrieveSmsList->RetrieveGsmListL();
-    TInt entriesNum = iGsmSmsList->Enumerate();
-    
-    for (TInt i=0; i<entriesNum; ++i)
-        {
-        RMobileSmsStore::TMobileGsmSmsEntryV1 entry = iGsmSmsList->GetEntryL(i);
-        switch (iFilterType)
-            {
-            case ECMGDFilterReadSentAndUnsentMessages:
-                {
-                // add unsent message 
-                if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageUnsent)
-                    {
-                    iDeleteList.AppendL(entry.iIndex);
-                    break;
-                    }
-                }
-            case ECMGDFilterReadAndSentMessages:
-                {
-                // add sent message 
-                if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageSent)
-                    {
-                    iDeleteList.AppendL(entry.iIndex);
-                    break;
-                    }
-                }
-            case ECMGDFilterReadMessagesOnly:
-                {
-                // add read message 
-                if (entry.iMsgStatus == RMobileSmsStore::EStoredMessageRead )
-                    {
-                    iDeleteList.AppendL(entry.iIndex);
-                    break;
-                    }
-                }
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    }
--- a/cbsatplugin/atmisccmdplugin/src/cmgwcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,552 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "cmgwcommandhandler.h"
-#include <mmretrieve.h>
-#include <mmlist.h> 
-#include <exterror.h>
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-const TUint KEOT = 26;    // End of Transmission
-const TUint KESC = 27;   // Escape
-
-const TUint8 KSCATonBitMask = 0x70;
-const TUint8 KSCANpiBitMask = 0x0F;
-
-CCMGWCommandHandler* CCMGWCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CCMGWCommandHandler* self = new (ELeave) CCMGWCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CCMGWCommandHandler::CCMGWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdAsyncBase(aCallback, aATCmdParser, aPhone),
-    iEntryPckg(iEntry)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGWCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iReply.CreateL(KDefaultCmdBufLength);
-    iTPDU.CreateL(KDefaultCmdBufLength);
-    
-    User::LeaveIfError( iMobileSmsMessaging.Open(iPhone) );
-
-    TInt err = iMobileSmsStore.Open(iMobileSmsMessaging, KETelIccSmsStore);
-    if (err != KErrNone)
-        {
-        iState = ECMGWStateSimStoreNotSupported;
-        }
-    iRetrieveMobilePhoneSmspList = CRetrieveMobilePhoneSmspList::NewL(iMobileSmsMessaging);
-
-    TRACE_FUNC_EXIT
-    }
-
-CCMGWCommandHandler::~CCMGWCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    Cancel();
-    delete iRetrieveMobilePhoneSmspList;
-    delete iMobilePhoneSmspList;
-    iMobileSmsStore.Close();
-    iMobileSmsMessaging.Close();
-    iReply.Close();
-    iTPDU.Close();
-    TRACE_FUNC_EXIT
-    }
-
-/**
- * Set message format
- * 0: PDU mode
- * 1: Text mode - not supported
- */
-void CCMGWCommandHandler::SetMessageFormat(TInt aFormat)
-    {
-    TRACE_FUNC_ENTRY
-    if (aFormat == 0 || aFormat == 1)
-        {
-        iMsgFormat = aFormat;
-        }
-    Trace(_L("Message format: %d"), iMsgFormat);
-    TRACE_FUNC_ENTRY
-    }
-
-void CCMGWCommandHandler::HandleCommand(const TDesC8& aCmd, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    if (iMsgFormat == 1 || iState == ECMGWStateSimStoreNotSupported )
-        {
-        // Reply "ERROR" if text mode is set
-        // Reply "ERROR" if SIM store is not supported
-        iCallback->CreateReplyAndComplete( EReplyTypeError );
-        TRACE_FUNC_EXIT
-        return;
-        }
-    
-    TInt err = KErrNone;
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        case (TAtCommandParser::ECmdHandlerTypeSet): 
-            {
-            switch(iState)
-                {
-                case ECMGWStateIdle:
-                    {
-                    // Parse parameters
-                    err = ParseParameters();
-                    if (err == KErrNone)
-                        {
-                        Trace(_L("Parse parameters OK."));
-                        Trace(_L("Length = %d"), iTPDULength);
-                        Trace(_L("stat = %d"), iTPDUStat);
-                        
-                        iTPDU.Zero();
-                        iState = ECMGWStateEditMode;
-                        iCallback->CreateReplyAndComplete( EReplyTypeEditor );
-                        }
-                    else
-                        {
-                        // Syntax error
-                        Trace(_L("Syntax error. err = %d"), err);
-                        iState = ECMGWStateIdle;
-                        iCallback->CreateReplyAndComplete(EReplyTypeError);
-                        }
-                    break;
-                    }
-                case ECMGWStateEditMode:   // Edit state
-                    {
-                    HandleEditModeCommand(aCmd);
-                    break;
-                    }
-                default:    // Other states
-                    {
-                    Cancel();
-                    iCallback->CreateReplyAndComplete( EReplyTypeError );
-                    }
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeError );
-            break;
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGWCommandHandler::HandleEditModeCommand( const TDesC8& aCmd )
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = KErrNone;
-    TUint8 cmdCharVal = 0;
-    if (aCmd.Length())
-        {
-        cmdCharVal = aCmd[0];
-        }
-
-    switch ( cmdCharVal ) 
-        {
-        case KEOT:  // End of Transmission: Now write the message
-            {
-            // Extract SCA fro PDU
-            err = ExtractSCA();
-            if (err == KErrNotFound)
-                {
-                // SCA not provided by client
-                if (iMobileSmspEntry.iServiceCentre.iTelNumber.Length() == 0)
-                    {
-                    // Retrieve SMS parameter list
-                    iRetrieveMobilePhoneSmspList->Start(iStatus);
-                    iState = ECMGWStateRetrieveSCA;
-                    SetActive();
-                    }
-                else
-                    {
-                    // Got the SCA from SIM params already - self complete
-                    iServiceCentre = iMobileSmspEntry.iServiceCentre;
-                    
-                    TRequestStatus* status = &iStatus;
-                    User::RequestComplete(status, KErrNone);
-                    iState = ECMGWStatePreparePDU;
-                    SetActive();
-                    }
-                }
-            else if( err == KErrNone )
-                {
-                // Got the SCA from client (in iService Centre) - self complete
-                TRequestStatus* status = &iStatus;
-                User::RequestComplete(status, KErrNone);
-                iState = ECMGWStatePreparePDU;
-                SetActive();            
-                }
-            else
-                {
-                // Extract SCA failed
-                iState = ECMGWStateIdle;
-                iCallback->CreateCMSReplyAndComplete(KErrGsmSMSInvalidPDUModeParameter);
-                }
-             break;
-            }
-        case KESC:  // Escape
-            {
-            iState = ECMGWStateIdle;
-            iCallback->CreateReplyAndComplete( EReplyTypeOk );
-            break;
-            }
-        default:    // Still entering PDU data
-            {
-            iTPDU.Append( aCmd );
-            iCallback->CreateReplyAndComplete( EReplyTypeEditor );
-            break;
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CCMGWCommandHandler::RunL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    iReply.Zero();
-    TInt err = iStatus.Int();
-    Trace(_L("State = %d, err = %d"), iState, err);
-    
-    if (err == KErrNone)
-        {
-        switch (iState)
-            {
-            case ECMGWStateRetrieveSCA:
-                {
-                // Got SCA from SIM params - update iServiceCentre
-                iMobilePhoneSmspList = iRetrieveMobilePhoneSmspList->RetrieveListL();
-                iMobileSmspEntry = iMobilePhoneSmspList->GetEntryL(0);
-                iServiceCentre = iMobileSmspEntry.iServiceCentre;
-                
-                // Complete self to send PDU in next state
-                TRequestStatus* status = &iStatus;
-                User::RequestComplete(status, KErrNone);
-                iState = ECMGWStatePreparePDU;
-                SetActive();
-                }
-                break;
-            case ECMGWStatePreparePDU:
-                {
-                // Create an SMS entry from PDU
-                iEntry.iServiceCentre = iServiceCentre;
-                
-                err = CreateSmsEntry();
-                if (err == KErrNone)
-                    {
-                    Trace(_L("Create SMS entry OK."));
-                    Trace(_L("Service center: %S"),
-                            &iEntry.iServiceCentre.iTelNumber);
-                    Trace(_L("Type of number: %d"),
-                            iEntry.iServiceCentre.iTypeOfNumber);
-                    Trace(_L("Number plan: %d"),
-                            iEntry.iServiceCentre.iNumberPlan);
-                    Trace(_L("Message status: %d"), iEntry.iMsgStatus);
-
-                    // Start to write PDU
-                    iEntry.iIndex = -1;
-                    iMobileSmsStore.Write(iStatus, iEntryPckg);
-                    iState = ECMGWStateWritePDU;
-                    SetActive();
-                    }
-                else
-                    {
-                    // Create failed
-                    iState = ECMGWStateIdle;
-                    iCallback->CreateCMSReplyAndComplete(KErrGsmSMSInvalidPDUModeParameter);
-                    }                
-                break;
-                }
-            case ECMGWStateWritePDU:
-                {
-                Trace(_L("Write successful. Index = %d"), iEntry.iIndex);
-                
-                iReply.Append(KCRLF);
-                iReply.Append(KAtCMGW);
-                iReply.AppendNum(iEntry.iIndex);
-                iState = ECMGWStateIdle;
-                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-                }
-                break;
-            default:
-                iState = ECMGWStateIdle;
-                iCallback->CreateReplyAndComplete(EReplyTypeError);
-                break;
-            }
-        }
-    else
-        {
-        iState = ECMGWStateIdle;
-        iCallback->CreateCMSReplyAndComplete(err);
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
-TInt CCMGWCommandHandler::RunError(TInt aError)
-    {
-    TRACE_FUNC_ENTRY
-    
-    delete iMobilePhoneSmspList;
-    iMobilePhoneSmspList = NULL;
-    iState = ECMGWStateIdle;
-    iCallback->CreateCMSReplyAndComplete(aError);
-    
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-void CCMGWCommandHandler::DoCancel() 
-    {
-    TRACE_FUNC_ENTRY
-    
-    switch (iState)
-        {
-        case ECMGWStateRetrieveSCA:
-            {
-            iRetrieveMobilePhoneSmspList->Cancel();
-            break;
-            }
-        case ECMGWStateWritePDU:
-            {
-            iMobileSmsStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
-            break;
-            }
-        }
-    iState = ECMGWStateIdle;
-    
-    TRACE_FUNC_EXIT
-    }
-/**
- * Parse parameters of +CMGW=<length>,<stat>
- */
-TInt CCMGWCommandHandler::ParseParameters()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt ret = KErrNone;
-    iTPDULength = 0;
-    iTPDUStat = 0; // default value
-    TInt otherParams = 0;
-    // Get length
-    TInt retLength = iATCmdParser.NextIntParam(iTPDULength);
-    // Get status
-    TInt retStat = iATCmdParser.NextIntParam(iTPDUStat);
-    // Get other parameters
-    TInt retOther = iATCmdParser.NextIntParam(otherParams);
-    // syntax error happens if
-    // a)there is no param 1
-    // b)there are 3 params
-    // c)param 2 is not 0,1,2 or 3
-    TBool noParam1 = (retLength != KErrNone);
-    TBool badParam2 = (retStat == KErrGeneral);
-    TBool tooManyParams = (retOther != KErrNotFound);
-    
-    if (noParam1 || badParam2 || tooManyParams)
-        {
-        ret = KErrArgument;
-        }
-    else
-        {
-        switch (iTPDUStat)
-            {
-            case 0:
-                // to receive unread message
-                iMessageStatus = RMobileSmsStore::EStoredMessageUnread;
-                break;
-            case 1:
-                // to receive read message
-                iMessageStatus = RMobileSmsStore::EStoredMessageRead;
-                break;
-            case 2:
-                // Unsent is not supported in this version
-                ret = KErrNotSupported;
-                break;
-            case 3:
-                // Sent is not supported in this version
-                ret = KErrNotSupported;
-                break;
-            default:
-                ret = KErrArgument;
-                break;
-            }
-        iEntry.iMsgStatus = iMessageStatus;
-        }
-    
-    TRACE_FUNC_EXIT
-    return ret;
-    }
-
-/**
- * Create an SMS entry from the PDU string
- */
-TInt CCMGWCommandHandler::CreateSmsEntry()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = KErrNone;
-    
-    // Check the length
-    if (iTPDU.Length() != (iSCALength+iTPDULength+1)*2)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    RBuf8 buf;
-    err = buf.Create(iTPDULength);
-    if (err != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return err;
-        }
-    // Convert to binary format
-    for(TInt i=(iSCALength+1)*2; i< iTPDU.Length(); i+=2)
-        {
-        TLex8 lex(iTPDU.Mid(i, 2));
-        TUint8 val = 0;
-        err = lex.Val(val, EHex);
-        if (err != KErrNone)
-            {
-            buf.Close();
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        buf.Append(val);
-        }
-    iEntry.iMsgData.Copy(buf);
-    
-    buf.Close();
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-/**
- * Extract the SMS service center address from the head of PDU string
- */
-TInt CCMGWCommandHandler::ExtractSCA()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = KErrNone;
-    TLex8 lex;
-    RMobilePhone::TMobileAddress sca;
-    // SCA length
-    lex.Assign(iTPDU.Left(2));
-    err = lex.Val(iSCALength, EHex); 
-    if (err != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return err;
-        }
-    TInt length = iTPDU.Length();
-    if (iSCALength == 0)
-        {
-        // Service center is not found in PDU
-        err = KErrNotFound;
-        }
-    else if (iSCALength > (length-2)/2)
-        {
-        // Service certer length error
-        err = KErrArgument;
-        }
-    else
-        {
-        // SCA is given
-        // Parse SCA TON and NPI
-        TUint8 val = 0;
-        lex.Assign(iTPDU.Mid(2,2));
-        err = lex.Val(val, EHex);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        TUint8 ton = (val&KSCATonBitMask)>>4;
-        TUint8 npi = val&KSCANpiBitMask;
-        switch (ton) // TON
-            {
-            case 0: // 000
-                sca.iTypeOfNumber = RMobilePhone::EUnknownNumber;
-                break;
-            case 1: // 001
-                sca.iTypeOfNumber = RMobilePhone::EInternationalNumber;
-                sca.iTelNumber.Append('+');
-                break;
-            case 2: // 010
-                sca.iTypeOfNumber = RMobilePhone::ENationalNumber;
-                break;
-            default: 
-                // CMCC doesn't support other types
-                TRACE_FUNC_EXIT
-                return KErrArgument;
-            }
-        switch (npi) // NPI
-            {
-            case 0: // 0000
-                sca.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
-                break;
-            case 1: // 0001
-                sca.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
-                break;
-            default:
-                // CMCC doesn't support other number plans
-                TRACE_FUNC_EXIT
-                return KErrArgument;
-            }
-        // Extract SCA number
-        for (TInt i=4; i<(iSCALength+1)*2; i+=2)
-            {
-            sca.iTelNumber.Append(iTPDU[i+1]);
-            sca.iTelNumber.Append(iTPDU[i]);
-            }
-        if(sca.iTelNumber[sca.iTelNumber.Length()-1] == 'F' 
-                || sca.iTelNumber[sca.iTelNumber.Length()-1] == 'f')
-            {
-            sca.iTelNumber.Delete(sca.iTelNumber.Length()-1, 1);
-            }
-        iServiceCentre = sca;
-        }
-    TRACE_FUNC_EXIT
-    return err;
-    }
-
-
--- a/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Wed Oct 13 14:43:49 2010 +0300
@@ -18,7 +18,7 @@
 #include "cpincommandhandler.h"
 
 #include <mmretrieve.h>         // define AO wrapper
-#include <exterror.h>           // Additional RMobilePhone error code
+#include <EXTERROR.H>           // Additional RMobilePhone error code
 
 #include "debug.h"
 
--- a/cbsatplugin/atmisccmdplugin/src/hvercommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "hvercommandhandler.h"
-#include <sysutil.h>
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-const TUint KCommaValue = 44;
-const TUint KSpaceValue = 32;
-
-CHVERCommandHandler* CHVERCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CHVERCommandHandler* self = new (ELeave) CHVERCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CHVERCommandHandler::CHVERCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CHVERCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = KErrNone;
-    iSWVersion.CreateL(KSysUtilVersionTextLength);
-    iReply.CreateL(KDefaultCmdBufLength);
-    TRACE_FUNC_EXIT
-    }
-
-CHVERCommandHandler::~CHVERCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    iSWVersion.Close();
-    iReply.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CHVERCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    if (cmdHandlerType != TAtCommandParser::ECmdHandlerTypeBase)
-        {
-        iCallback->CreateReplyAndComplete(EReplyTypeError);
-        }
-    else if(iTelError == KErrNone)
-        {
-        if (iReply.Length() == 0)
-            {
-            // Get model
-            iReply.Append( KCRLF );
-            iReply.Append( iModel );
-    
-            TChar commaValue = KCommaValue;
-            TChar spaceValue = KSpaceValue;            
-            iReply.Append( commaValue );
-            iReply.Append( spaceValue );
-            
-            // Get software version (RM-xxx)
-            TBuf<KSysUtilVersionTextLength> swVersion;
-            TInt errorCode = SysUtil::GetSWVersion( swVersion );
-    
-            if (KErrNone == errorCode)
-                {
-                ParseSWVersion(swVersion.Collapse());
-                iReply.Append(iSWVersion);
-                }
-            iReply.Append( KCRLF );
-            }
-        iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
-        }
-    else
-        {
-        iCallback->CreateCMEReplyAndComplete(iTelError);
-        }
-   
-    TRACE_FUNC_EXIT
-    }
-
-void CHVERCommandHandler::ParseSWVersion(const TDesC8& aSWVersion)
-    {  
-    TRACE_FUNC_ENTRY
-    if (iSWVersion.Length() != 0)
-        {
-        TRACE_FUNC_EXIT
-        return;
-        }
-    
-    TInt start = aSWVersion.Find(KHVERModelString);
-    
-    if ( KErrNotFound != start )
-        {
-        TLex8 lex(aSWVersion);
-        lex.Inc(start);
-        lex.Mark(); 
-        lex.SkipCharacters();
-        TPtrC8 token = lex.MarkedToken(); 
-    
-        iSWVersion.Append(token);
-        }
-    TRACE_FUNC_EXIT
-    }
-
-void CHVERCommandHandler::SetHWVersion(const TDesC8& aHWVersion)
-    {
-    TRACE_FUNC_ENTRY
-    iModel.Zero();
-    if (aHWVersion.Length() <= CTelephony::KPhoneModelIdSize)
-        {
-        iModel.Copy(aHWVersion);
-        }
-    else
-        {
-        iModel.Copy(aHWVersion.Left(CTelephony::KPhoneModelIdSize));
-        }    
-    TRACE_FUNC_EXIT
-    }
-
-
-
-void CHVERCommandHandler::SetTelephonyError(TInt aTelError)
-    {
-    TRACE_FUNC_ENTRY
-    iTelError = aTelError;
-    TRACE_FUNC_EXIT
-    }
-
--- a/cbsatplugin/atmisccmdplugin/src/scpbrcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,452 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "scpbrcommandhandler.h"
-
-#include <mpbutil.h>
-#include "debug.h"
-#include "atmisccmdpluginconsts.h"
-
-CSCPBRCommandHandler::CSCPBRCommandHandler( 
-		MATMiscCmdPlugin* aCallback, 
-		TAtCommandParser& aATCmdParser, 
-		RMobilePhone& aPhone) 
-		: CATCmdAsyncBase( aCallback, aATCmdParser, aPhone )
-	{
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-	}
-
-CSCPBRCommandHandler::~CSCPBRCommandHandler()
-	{
-    TRACE_FUNC_ENTRY
-    Cancel();
-    iPhoneBookStore.Close();
-    iCustomApi.Close();
-    iReply.Close();
-    delete iPhoneBookBuffer;
-    iEntries.Close();
-    iContactsBuf.Close();
-    TRACE_FUNC_EXIT
-	}
-
-void CSCPBRCommandHandler::ConstructL()
-	{
-    TRACE_FUNC_ENTRY
-    TInt err = iPhoneBookStore.Open( iPhone, KETelIccAdnPhoneBook);
-    if( err != KErrNone )  // if the phonebookstore can't be opened or error occurs when try to open it.
-        {
-        iState = ESCPBRStateNotSupported;
-        TRACE_FUNC_EXIT
-        return;
-        }
-    err = iCustomApi.Open( iPhone );
-    if( err != KErrNone )  // If the custom api can't be opened.
-        {
-        iPhoneBookStore.Close();
-        iState = ESCPBRStateNotSupported;
-        TRACE_FUNC_EXIT
-        return;
-        }
-    iReply.CreateL( KBufBlockSize );
-	iPhoneBookBuffer = new ( ELeave ) CPhoneBookBuffer();	
-    TRACE_FUNC_EXIT
-	}
-
-CSCPBRCommandHandler* CSCPBRCommandHandler::NewL( 
-		MATMiscCmdPlugin* aCallback, 
-		TAtCommandParser& aATCmdParser, 
-		RMobilePhone& aPhone )
-	{
-    TRACE_FUNC_ENTRY
-	CSCPBRCommandHandler * self = new ( ELeave ) CSCPBRCommandHandler( aCallback, aATCmdParser, aPhone );
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop( self );
-    TRACE_FUNC_EXIT
-	return self;
-	}
-
-void CSCPBRCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/ )
-	{
-    TRACE_FUNC_ENTRY
-    if( iState == ESCPBRStateIdle )  // Not supported or have unfinished task.
-        {
-        iReply.Zero();  
-        TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-        switch( cmdHandlerType )
-            {
-            case TAtCommandParser::ECmdHandlerTypeTest: // command: AT^SCPBR=?
-                {
-                if( iTotalEntries == 0 )
-                    {
-                    iState = ESCPBRStateGetPhoneBookInfo;
-                    RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg pkg( iPhoneBookInfo );
-                    iPhoneBookStore.GetInfo( iStatus, pkg );
-                    SetActive();
-                    }
-                else if ( iMLength ==0 )
-                    {
-                    iState = ESCPBRStateGet3GPBInfo;
-                    iCustomApi.Get3GPBInfo( iStatus, i3GPBInfo );
-                    SetActive();
-                    }
-                else
-                    {
-                    iReply.Format( KSCPBRSupportedEntriesIndexList, 
-                            iTotalEntries, iNLength, iTLength, iMLength );
-                    iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
-                    }
-                break;
-                }
-            case TAtCommandParser::ECmdHandlerTypeSet:  // command: AT^SCPBR=<index1>[,<index2>]
-                {
-                if( ParseParameters() == KErrNone )
-                    {
-                    iEntries.Reset();
-                    TInt amountOfEntries = iIndex2 - iIndex1 + 1;  // the amount of entries.
-                    Trace( _L8("The amount of entries: %d "), amountOfEntries );
-                    iContactsBuf.Zero();
-                    TInt bufSize;
-                    if( amountOfEntries >= KSCPBRMaxEntryCount )
-                        {
-                        bufSize= KSCPBRMaxEntryCount * KSCPBRDefaultSizeOfOneEntry;
-                        amountOfEntries = KSCPBRMaxEntryCount;
-                        }
-                    else
-                        {
-                        bufSize = amountOfEntries * KSCPBRDefaultSizeOfOneEntry;
-                        }
-                    
-                    if( bufSize >= iContactsBuf.MaxLength() )
-                        {
-                        TInt err = iContactsBuf.ReAlloc( bufSize );
-                        Trace( _L8("The error code of the realloc: %d "), err );
-                        if( err != KErrNone )
-                            {
-                            iState = ESCPBRStateIdle;
-                            iCallback->CreateReplyAndComplete( EReplyTypeError );
-                            break;
-                            }
-                        }
-                    iState = ESCPBRStateRead;
-                    iPhoneBookStore.Read( iStatus,  iIndex1, amountOfEntries, iContactsBuf );
-                    SetActive();
-                    }
-                else
-                    {
-                    iCallback->CreateReplyAndComplete( EReplyTypeError );
-                    }
-                break;
-                }
-            default:
-                {
-                iCallback->CreateReplyAndComplete( EReplyTypeError );
-                break;
-                }
-            }
-        }
-    else
-        {
-        iCallback->CreateReplyAndComplete( EReplyTypeError );
-        } 
-       TRACE_FUNC_EXIT
-	}
-
-TInt CSCPBRCommandHandler::ParseParameters()
-    {
-    TRACE_FUNC_ENTRY
-    iIndex1 = 0; 
-    iIndex2 = 0;
-    TInt index3;
-    TInt ret1 = iATCmdParser.NextIntParam( iIndex1 );
-    TInt ret2 = iATCmdParser.NextIntParam( iIndex2 );
-    TInt ret3 = iATCmdParser.NextIntParam( index3 );
-    
-    if( ret1 != KErrNone 
-            || ( ret2 != KErrNone && ret2 != KErrNotFound )
-            || ret3 != KErrNotFound )
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    if( ret2 == KErrNotFound )
-        {
-        iIndex2 = iIndex1;
-        }
-    if (iIndex2 < iIndex1)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-void CSCPBRCommandHandler::RunL()
-	{
-    TRACE_FUNC_ENTRY
-    iReply.Zero();
-    TInt result = iStatus.Int();
-    if( result == KErrNone )
-        {
-        switch( iState )
-            {
-            case ESCPBRStateRead:
-                {
-                ExtractEntriesL();
-                FormatReplyL();
-                iState = ESCPBRStateIdle;
-                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-                break;
-                }
-            case ESCPBRStateGetPhoneBookInfo:
-                {
-                iTotalEntries = iPhoneBookInfo.iTotalEntries;
-                iNLength = iPhoneBookInfo.iMaxNumLength;
-                iTLength = iPhoneBookInfo.iMaxTextLength;
-                if (iMLength == 0)
-                    {
-                    iState = ESCPBRStateGet3GPBInfo;
-                    iCustomApi.Get3GPBInfo( iStatus, i3GPBInfo );
-                    SetActive();
-                    }
-                else 
-                    {
-                    iReply.Format( KSCPBRSupportedEntriesIndexList, 
-                            iTotalEntries, iNLength, iTLength, iMLength );
-                    iState = ESCPBRStateIdle;
-                    iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
-                    }
-                break;
-                }
-            case ESCPBRStateGet3GPBInfo:
-                {
-                iMLength = i3GPBInfo.iMaxLenEmail;
-                iReply.Format( KSCPBRSupportedEntriesIndexList, 
-                        iTotalEntries, iNLength, iTLength, iMLength );
-                iState = ESCPBRStateIdle;
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
-                break;
-                }
-            default: 
-                {
-                iState = ESCPBRStateIdle;
-                iCallback->CreateReplyAndComplete( EReplyTypeError );
-                break;
-                }
-            }
-        }
-    else
-        {
-        iState = ESCPBRStateIdle;
-        iCallback->CreateCMEReplyAndComplete( result );
-        }
-    TRACE_FUNC_EXIT
-	}
-
-TInt CSCPBRCommandHandler::RunError(TInt aError)
-    {
-    TRACE_FUNC_ENTRY
-    iState = ESCPBRStateIdle;
-    iCallback->CreateReplyAndComplete( EReplyTypeError );
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-void CSCPBRCommandHandler::ExtractEntriesL()
-    {
-    TRACE_FUNC_ENTRY
-    iPhoneBookBuffer->Set( &iContactsBuf );
-    iPhoneBookBuffer->StartRead();
-    TUint8 fieldTag;
-    CPhoneBookBuffer::TPhBkTagType dataType;
-    TInt numCount = 0;
-	// clear entry arry for use.
-    iEntries.Reset();
-    User::LeaveIfError(iPhoneBookBuffer->GetTagAndType( fieldTag, dataType ));
-    if( fieldTag != RMobilePhoneBookStore::ETagPBNewEntry )
-        {
-        // Buffer corrupt
-        User::Leave(KErrCorrupt);
-        }
-    TInt ret = KErrNone;
-    TInt index = -1; // at least one entry
-    while (ret != KErrNotFound) // if reach the buffer end.
-        {
-        switch (fieldTag)
-            {
-            case RMobilePhoneBookStore::ETagPBNewEntry:
-                {
-                TPhoneBookEntry entry;
-                iEntries.AppendL(entry);
-                ++index;
-                numCount = 0; // set the number count of new entry to 0. 
-                break;
-                }
-            case RMobilePhoneBookStore::ETagPBAdnIndex:
-                {
-                TUint16 simIndex = 0;
-                if (dataType != CPhoneBookBuffer::EPhBkTypeInt16)
-                    {
-                    User::Leave(KErrCorrupt);
-                    }
-                User::LeaveIfError( iPhoneBookBuffer->GetValue(simIndex) );
-
-                iEntries[index].iIndex = simIndex;
-                break;
-                }
-            case RMobilePhoneBookStore::ETagPBText:
-                {
-                TPtrC16 text;
-                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
-                    {
-                    User::Leave(KErrCorrupt);
-                    }
-                User::LeaveIfError( iPhoneBookBuffer->GetValue(text) );
-                CopyToPhonebookEntryField(iEntries[index].iName, text);
-                break;
-                }
-            case RMobilePhoneBookStore::ETagPBNumber:
-                {
-                TPtrC16 number;
-                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
-                    {
-                    User::Leave(KErrCorrupt);
-                    }
-                User::LeaveIfError( iPhoneBookBuffer->GetValue(number) );
-                ++numCount;
-                switch (numCount)
-                    {
-                    case 1: // The first number
-                        CopyToPhonebookEntryField(iEntries[index].iNumber1, number);
-                        break;
-                    case 2: // The Second number
-                        CopyToPhonebookEntryField(iEntries[index].iNumber2, number);
-                        break;
-                    case 3: // the Third number
-                        CopyToPhonebookEntryField(iEntries[index].iNumber3, number);
-                        break;
-                    case 4: // the fourth number.
-                        CopyToPhonebookEntryField(iEntries[index].iNumber4, number);
-                        break;
-                    }
-                break;
-                }
-            case RMobilePhoneBookStore::ETagPBEmailAddress:
-                {
-                TPtrC16 email;
-                if (dataType != CPhoneBookBuffer::EPhBkTypeDes16)
-                    {
-                    User::Leave(KErrCorrupt);
-                    }
-                User::LeaveIfError( iPhoneBookBuffer->GetValue(email) );
-                CopyToPhonebookEntryField(iEntries[index].iEmail, email);
-                break;
-                }
-            default:
-                {
-                iPhoneBookBuffer->SkipValue(dataType);
-                break;
-                }
-            }
-        ret = iPhoneBookBuffer->GetTagAndType(fieldTag, dataType);
-        }
- 
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBRCommandHandler::CopyToPhonebookEntryField(TDes8& aDest, const TDesC16& aSrc)
-    {
-    TRACE_FUNC_ENTRY
-    TInt maxLength = aDest.MaxLength();
-    if ( aSrc.Length() <= maxLength )
-        {
-        aDest.Copy(aSrc);
-        }
-    else
-        {
-        aDest.Copy( aSrc.Left(maxLength) );
-        }
-    TRACE_FUNC_EXIT    
-    }
-
-void CSCPBRCommandHandler::FormatReplyL()
-    {
-    TRACE_FUNC_ENTRY
-
-    TInt count = iEntries.Count();
-    for (TInt i = 0; i < count; ++i)
-        {
-        AppendEntryL(iEntries[i]);
-        }
-    iReply.Append(KCRLF);
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBRCommandHandler::AppendEntryL(const TPhoneBookEntry& aEntry)
-    {
-    TRACE_FUNC_ENTRY
-    TBuf8<KSCPBRDefaultSizeOfOneEntry> entryBuffer;
-    aEntry.Externalize(entryBuffer);
-    
-    TInt length = entryBuffer.Length() + KSCPBR().Length(); 
-    if (length + iReply.Length() > iReply.MaxLength())
-        {
-        iReply.ReAllocL(iReply.MaxLength()+KBufBlockSize);
-        }
-    
-    iReply.Append(KSCPBR);
-    iReply.Append(entryBuffer);
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBRCommandHandler::DoCancel()
-	{
-    TRACE_FUNC_ENTRY
-    switch( iState )
-        {
-        case ESCPBRStateRead:
-            {
-            iPhoneBookStore.CancelAsyncRequest( EMobilePhoneStoreRead );
-            break;
-            }
-        case ESCPBRStateGetPhoneBookInfo:
-            {
-            iPhoneBookStore.CancelAsyncRequest( EMobilePhoneStoreGetInfo );
-            break;
-            }
-        case ESCPBRStateGet3GPBInfo:
-            {
-            iPhoneBookStore.CancelAsyncRequest( EGet3GPBInfoIPC );
-            break;
-            }
-        default:
-            break;
-        }
-    iState = ESCPBRStateIdle;
-    TRACE_FUNC_EXIT
-	}
-
-
-void CSCPBRCommandHandler::TPhoneBookEntry::Externalize(TDes8& aDes) const
-    {
-    TRACE_FUNC_ENTRY
-    
-    aDes.Format(KSCPBRReplyOneEntry, iIndex, &iNumber1, &iNumber2, &iNumber3, &iNumber4, &iName, &iEmail);
-    
-    TRACE_FUNC_EXIT
-    }
--- a/cbsatplugin/atmisccmdplugin/src/scpbwcommandhandler.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,616 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "scpbwcommandhandler.h"
-#include <mpbutil.h> 
-#include <exterror.h>
-#include <etelmmerr.h>
-
-#include "atmisccmdpluginconsts.h"
-#include "debug.h"
-
-const TInt KMaxContactEntrySize = 512;
-const TInt KMaxTextLength = 64;
-const TInt KMaxNumberLength = 64;
-const TInt KMaxEmailLength = 64;
-
-CSCPBWCommandHandler* CSCPBWCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    CSCPBWCommandHandler* self = new (ELeave) CSCPBWCommandHandler(aCallback, aATCmdParser, aPhone);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    }
-
-CSCPBWCommandHandler::CSCPBWCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
-    CATCmdAsyncBase(aCallback, aATCmdParser, aPhone)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBWCommandHandler::ConstructL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = iPhoneBookStore.Open(iPhone, KETelIccAdnPhoneBook);
-    if (err != KErrNone)
-        {
-        iState = ESCPBWStateSimStoreNotSupported;
-        TRACE_FUNC_EXIT
-        return;
-        }
-    err = iMmCustomAPI.Open(iPhone);
-    if (err != KErrNone)
-        {
-        iPhoneBookStore.Close();
-        iState = ESCPBWStateSimStoreNotSupported;
-        TRACE_FUNC_EXIT
-        return;
-        }
-    iPhoneBookBuffer = new (ELeave) CPhoneBookBuffer;
-    
-    iReply.CreateL(KDefaultCmdBufLength);
-    iNum1.CreateL(KMaxNumberLength);
-    iNum2.CreateL(KMaxNumberLength);
-    iNum3.CreateL(KMaxNumberLength);
-    iNum4.CreateL(KMaxNumberLength);
-    iText.CreateL(KMaxTextLength);
-    iEmail.CreateL(KMaxEmailLength);
-    iPbData.CreateL(KMaxContactEntrySize);
-    
-    TRACE_FUNC_EXIT
-    }
-
-CSCPBWCommandHandler::~CSCPBWCommandHandler()
-    {
-    TRACE_FUNC_ENTRY
-    Cancel();
-    delete iPhoneBookBuffer;
-    iPhoneBookStore.Close();
-    iMmCustomAPI.Close();
-    iPbData.Close();
-    iReply.Close();
-    iNum1.Close();
-    iNum2.Close();
-    iNum3.Close();
-    iNum4.Close();
-    iText.Close();
-    iEmail.Close();
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBWCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
-    {
-    TRACE_FUNC_ENTRY
-    
-    if (iState != ESCPBWStateIdle)
-        {
-        // Reply "ERROR" if handler is not in idle
-        iCallback->CreateReplyAndComplete(EReplyTypeError);
-        TRACE_FUNC_EXIT
-        return;
-        }
-    TInt err = KErrNone;
-    
-    TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
-    
-    switch (cmdHandlerType)
-        {
-        case (TAtCommandParser::ECmdHandlerTypeTest):
-            {
-            if (iMaxEntries == 0)
-                {
-                RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg pckg(iPhoneBookStoreInfo);
-                iPhoneBookStore.GetInfo(iStatus, pckg);
-                iState = ESCPBWStateGetPhonebookInfo;
-                SetActive();
-                }
-            else if (iEmailLength == 0)
-                {
-                iState = ESCPBWStateGet3GPBInfo;
-                iMmCustomAPI.Get3GPBInfo(iStatus, i3GPBInfo);
-                SetActive();
-                }
-            else
-                {
-                // Phonebook info has been obtained
-                iReply.Zero();
-                iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
-                iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply );
-                }
-            }
-            break;
-        case (TAtCommandParser::ECmdHandlerTypeSet): 
-            {
-            ResetParameters();
-            TBool isDeleteRequest = EFalse;
-            err = ParseParameters(isDeleteRequest);
-            Trace(_L("Parse completed, err = %d"), err);
-            if (isDeleteRequest)
-                {
-                // Delete entry at iIndex
-                iState = ESCPBWStateDelete;
-                iPhoneBookStore.Delete(iStatus, iIndex);
-                SetActive();
-                }
-            else if (err == KErrNone)
-                {
-                // Create an entry
-                err = CreateContactEntry();
-                if (err == KErrNone)
-                    {
-                    iPhoneBookStore.Write(iStatus, iPbData, iIndex);
-                    iState = ESCPBWStateWrite;
-                    SetActive();
-                    }
-                else
-                    {
-                    iCallback->CreateReplyAndComplete( EReplyTypeError );
-                    }
-                }
-            else
-                {
-                iCallback->CreateReplyAndComplete( EReplyTypeError );
-                }
-            break;
-            }
-        default:
-            {
-            iCallback->CreateReplyAndComplete( EReplyTypeError );
-            break;
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBWCommandHandler::RunL()
-    {
-    TRACE_FUNC_ENTRY
-    
-    iReply.Zero();
-    TInt err = iStatus.Int();
-    Trace(_L("State = %d, err = %d"), iState, err);
-    
-    if (err == KErrNone)
-        {
-        switch (iState)
-            {
-            case ESCPBWStateGetPhonebookInfo:
-                {
-                Trace(_L("Get info successful."));
-                iNumLength = iPhoneBookStoreInfo.iMaxNumLength;
-                iTextLength = iPhoneBookStoreInfo.iMaxTextLength;
-                iMaxEntries = iPhoneBookStoreInfo.iTotalEntries;
-                if (iEmailLength == 0)
-                    {
-                    iMmCustomAPI.Get3GPBInfo(iStatus, i3GPBInfo);
-                    iState = ESCPBWStateGet3GPBInfo;
-                    SetActive();
-                    }
-                else
-                    {
-                    iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
-                    iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-                    iState = ESCPBWStateIdle;
-                    }
-                }
-                break;
-            case ESCPBWStateGet3GPBInfo:
-                {
-                Trace(_L("Get 3GPB info successful."));
-                iEmailLength = i3GPBInfo.iMaxLenEmail;
-                iReply.Format(KSCPBWSupportedCmdsList, iMaxEntries, iNumLength, iTextLength, iEmailLength);
-                iCallback->CreateReplyAndComplete(EReplyTypeOk, iReply);
-                iState = ESCPBWStateIdle;
-                }
-                break;
-            case ESCPBWStateWrite:
-                {
-                Trace(_L("Write successful. Index = %d"), iIndex);
-                iCallback->CreateReplyAndComplete(EReplyTypeOk);
-                iState = ESCPBWStateIdle;
-                }
-                break;
-            case ESCPBWStateDelete:
-                {
-                Trace(_L("Delete successful."));
-                iCallback->CreateReplyAndComplete(EReplyTypeOk);
-                iState = ESCPBWStateIdle;
-                }
-                break;
-            default:
-                {
-                iState = ESCPBWStateIdle;
-                iCallback->CreateReplyAndComplete(EReplyTypeError);
-                break;
-                }
-            }
-        }
-    else
-        {
-        iState = ESCPBWStateIdle; 
-        iCallback->CreateCMEReplyAndComplete(err);
-        }
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBWCommandHandler::DoCancel() 
-    {
-    TRACE_FUNC_ENTRY
-    
-    switch (iState)
-        {
-        case ESCPBWStateGetPhonebookInfo:
-            {
-            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
-            }
-            break;
-        case ESCPBWStateGet3GPBInfo:
-            {
-            iMmCustomAPI.CancelAsyncRequest(EGet3GPBInfoIPC);
-            }
-            break;
-        case ESCPBWStateDelete:
-            {
-            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
-            }
-            break;
-        case ESCPBWStateWrite:
-            {
-            iPhoneBookStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
-            }
-            break;
-        }
-    iState = ESCPBWStateIdle;
-    
-    TRACE_FUNC_EXIT
-    }
-
-TInt CSCPBWCommandHandler::ParseParameters( TBool& aIsDeleteRequest )
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt ret = KErrNone;
-    // Paese index
-    ret = iATCmdParser.NextIntParam(iIndex); 
-    Trace(_L("Parse index err: %d"), ret);
-    Trace(_L("index: %d"), iIndex);
-    if (ret != KErrNone && ret != KErrNotFound)
-        {
-        // Bad index
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    TPtrC8 ptrc;
-    // Parse num1
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse num1 OK: %S"), &ptrc);
-        SetBuffer(iNum1, ptrc);
-        }
-    else if (ret == KErrNone )
-        {
-        // Only index given
-        Trace(_L("Only index given."));
-        aIsDeleteRequest = ETrue;
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else 
-        {
-        // no num1 found
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    ret = iATCmdParser.NextIntParam(iType1);
-    if (ret == KErrNotFound)
-        {
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else if (ret != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    // Parse num2
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse num2 OK: %S"), &ptrc);
-        SetBuffer(iNum2, ptrc);
-        }
-    else 
-        {
-        // no num2 found
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    ret = iATCmdParser.NextIntParam(iType2);
-    if (ret == KErrNotFound)
-        {
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else if (ret != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    // Parse num3
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse num3 OK: %S"), &ptrc);
-        SetBuffer(iNum3, ptrc);
-        }
-    else
-        {
-        // no num3 found
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    ret = iATCmdParser.NextIntParam(iType3);
-    if (ret == KErrNotFound)
-        {
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else if (ret != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    // Parse num4
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse num4 OK: %S"), &ptrc);
-        SetBuffer(iNum4, ptrc);
-        }
-    else
-        {
-        // no num4 found
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    ret = iATCmdParser.NextIntParam(iType4);
-    if (ret == KErrNotFound)
-        {
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else if (ret != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    // Parse text
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse text OK: %S"), &ptrc);
-        SetBuffer(iText, ptrc);
-        }
-    else
-        {
-        // no text found
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    ret = iATCmdParser.NextIntParam(iCoding);
-    if (ret == KErrNotFound)
-        {
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    else if (ret != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    // Parse email
-    ptrc.Set(iATCmdParser.NextParam());
-    if (ptrc.Length() != 0)
-        {
-        Trace(_L("Parse email OK: %S"), &ptrc);
-        SetBuffer(iEmail, ptrc);
-        }
-    else
-        {
-        // no email found
-        TRACE_FUNC_EXIT
-        return KErrNone;
-        }
-    
-    if (iATCmdParser.NextParam().Length() != 0)
-        {
-        // too many parameters
-        Trace(_L("Too many parameters."));
-        TRACE_FUNC_EXIT
-        return KErrArgument;
-        }
-    
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-TInt CSCPBWCommandHandler::CreateContactEntry()
-    {
-    TRACE_FUNC_ENTRY
-    
-    TInt err = KErrNone;
-    iPhoneBookBuffer->Set(&iPbData);
-    // Add new entry tag
-    err = iPhoneBookBuffer->AddNewEntryTag();
-    Trace(_L("New entry tag added, err = %d"), err);
-    if (err != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return err;
-        }
-    // Put index into the entry
-    err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBAdnIndex, (TUint16)iIndex);
-    Trace(_L("Index added, err = %d"), err);
-    if (err != KErrNone)
-        {
-        TRACE_FUNC_EXIT
-        return err;
-        }
-    // Put text into the entry
-    if (iText.Length() != 0)
-        {
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBText, iText);
-        Trace(_L("Text added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }
-    // Put num1 into the entry
-    if (iNum1.Length() != 0)
-        {
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum1);
-        Trace(_L("Number 1 added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }
-    // Put num2 into the entry
-    if (iNum2.Length() != 0)
-        {
-        // Add anr tag 
-        err = iPhoneBookBuffer->AddNewNumberTag();
-        Trace(_L("New number tag added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum2);
-        Trace(_L("Number 2 added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }
-    // Put num3 into the entry
-    if (iNum3.Length() != 0)
-        {
-        // Add anr tag 
-        err = iPhoneBookBuffer->AddNewNumberTag();
-        Trace(_L("New number tag added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum3);
-        Trace(_L("Number 3 added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }
-    // Put num4 into the entry
-    if (iNum4.Length() != 0)
-        {
-        // Add anr tag 
-        err = iPhoneBookBuffer->AddNewNumberTag();
-        Trace(_L("New number tag added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBNumber, iNum4);
-        Trace(_L("Number 4 added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }    
-    // Put email address into the entry
-    if (iEmail.Length() != 0)
-        {
-        err = iPhoneBookBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBEmailAddress, iEmail);
-        Trace(_L("Email added, err = %d"), err);
-        if (err != KErrNone)
-            {
-            TRACE_FUNC_EXIT
-            return err;
-            }
-        }
-    
-    TRACE_FUNC_EXIT
-    return KErrNone;
-    }
-
-void CSCPBWCommandHandler::ResetParameters()
-    {
-    TRACE_FUNC_ENTRY
-    
-    iPbData.Zero();
-    iIndex = -1;
-    iNum1.Zero();
-    iType1 = 0x91; // International & ISDN
-    iNum2.Zero();
-    iType2 = 0x91;
-    iNum3.Zero();
-    iType3 = 0x91;
-    iNum4.Zero();
-    iType4 = 0x91;
-    iText.Zero();
-    iCoding = 0; // GSM 7 bit
-    iEmail.Zero();
-    
-    TRACE_FUNC_EXIT
-    }
-
-void CSCPBWCommandHandler::SetBuffer(TDes& aDest, const TDesC8& aSource)
-    {
-    TRACE_FUNC_ENTRY
-    TInt maxLength = aDest.MaxLength();
-    if (aSource.Length() <= maxLength)
-        {
-        aDest.Copy(aSource);
-        }
-    else
-        {
-        aDest.Copy(aSource.Left(maxLength));
-        }
-    TRACE_FUNC_EXIT
-    }
-
-
--- a/cbsatplugin/atmisccmdplugin/src/telephonywrapper.cpp	Wed Sep 15 12:23:51 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- * Description :
- *
- */
-
-#include "telephonywrapper.h"
-#include "debug.h"
-
-CTelephonyWrapper* CTelephonyWrapper::NewL()    
-    {
-    TRACE_FUNC_ENTRY
-    CTelephonyWrapper* self = new (ELeave) CTelephonyWrapper();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    TRACE_FUNC_EXIT
-    return self;
-    } 
-
-CTelephonyWrapper::CTelephonyWrapper() :
-        CActive(CActive::EPriorityStandard), 
-        iPhoneIdV1Pckg(iPhoneIdV1)
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    } 
-    
-void CTelephonyWrapper::ConstructL()    
-    {
-    TRACE_FUNC_ENTRY
-    CActiveScheduler::Add(this);
-    iTelephony = CTelephony::NewL();
-    TRACE_FUNC_EXIT
-    } 
-    
-CTelephonyWrapper::~CTelephonyWrapper()    
-    {
-    TRACE_FUNC_ENTRY
-    Cancel();
-    delete iTelephony;
-    TRACE_FUNC_EXIT
-    }    
-    
-TInt CTelephonyWrapper::SynchronousGetPhoneId()    
-    {
-    TRACE_FUNC_ENTRY
-    
-    if (!IsActive())
-        {
-        iTelephony->GetPhoneId(iStatus, iPhoneIdV1Pckg);
-        SetActive();
-        iWaiter.Start();
-        
-        if (KErrNone == iStatus.Int())
-            {
-            iModel = iPhoneIdV1.iModel.Collapse();
-            iSn = iPhoneIdV1.iSerialNumber.Collapse();
-            iManufacturer = iPhoneIdV1.iManufacturer.Collapse();
-            }
-        }
-    else
-        {
-        TRACE_FUNC_EXIT
-        return KErrInUse;
-        }
-       
-    TRACE_FUNC_EXIT
-    return iStatus.Int();    
-    } 
-
-const TDesC8& CTelephonyWrapper::GetPhoneModel()
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    return iModel;
-    }
-
-const TDesC8& CTelephonyWrapper::GetPhoneSerialNum()
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    return iSn;
-    }
-
-const TDesC8& CTelephonyWrapper::GetPhoneManufacturer()
-    {
-    TRACE_FUNC_ENTRY
-    TRACE_FUNC_EXIT
-    return iManufacturer;
-    }
-
-void CTelephonyWrapper::RunL()    
-    {
-    TRACE_FUNC_ENTRY
-    iWaiter.AsyncStop();
-    TRACE_FUNC_EXIT
-    } 
-
-void CTelephonyWrapper::DoCancel()    
-    {
-    TRACE_FUNC_ENTRY
-    iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
-    iWaiter.AsyncStop();
-    TRACE_FUNC_EXIT
-    }
-
-