201011
authorhgs
Sat, 24 Apr 2010 00:12:05 +0300
changeset 25 9c3798b88e30
parent 24 8930e1d1d530
child 26 b78e66e88238
201011
atcommands/group/bld.inf
atcommands/lccustomplugin/group/bld.inf
atcommands/lccustomplugin/group/lccustomplugin.mmp
atcommands/lccustomplugin/inc/debug.h
atcommands/lccustomplugin/inc/debugconfig.h
atcommands/lccustomplugin/inc/lccustomplugin.h
atcommands/lccustomplugin/inc/lclistallcmd.h
atcommands/lccustomplugin/inc/prjconfig.h
atcommands/lccustomplugin/rom/lccustomplugin.iby
atcommands/lccustomplugin/src/20021360.rss
atcommands/lccustomplugin/src/lccustomplugin.cpp
atcommands/lccustomplugin/src/lclistallcmd.cpp
atcommands/lccustomplugin/src/proxy.cpp
atcommands/modematplugin/group/bld.inf
atcommands/modematplugin/group/modematplugin.mmp
atcommands/modematplugin/inc/atcopscmd.h
atcommands/modematplugin/inc/cmdpluginobserver.h
atcommands/modematplugin/inc/debug.h
atcommands/modematplugin/inc/debugconfig.h
atcommands/modematplugin/inc/modematplugin.h
atcommands/modematplugin/inc/prjconfig.h
atcommands/modematplugin/rom/modematplugin.iby
atcommands/modematplugin/src/20029fbf.rss
atcommands/modematplugin/src/atcopscmd.cpp
atcommands/modematplugin/src/modematplugin.cpp
atcommands/modematplugin/src/proxy.cpp
bluetoothengine/bteng/btfeatures/btfeatures.cpp
bluetoothengine/bteng/btfeatures/btfeatures.mmp
bluetoothengine/bteng/bttoggle/inc/bttoggle.h
bluetoothengine/bteng/bttoggle/src/bttoggle.cpp
bluetoothengine/bteng/cenrep/keys_bteng.xls
bluetoothengine/bteng/conf/bteng.confml
bluetoothengine/bteng/conf/bteng_10204DAC.crml
bluetoothengine/bteng/inc/btengincpair.h
bluetoothengine/bteng/inc/btengprivatecrkeys.h
bluetoothengine/bteng/src/btengincpair.cpp
bluetoothengine/bteng/src/btengpairman.cpp
bluetoothengine/bteng/src/btengserver.cpp
bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp
bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def
bluetoothengine/bthid/bthidclient/src/bthidclient.cpp
bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp
bluetoothengine/bthid/mouse/Sesame_client/inc/pointmsgqueue.h
bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp
bluetoothengine/bthid/mouse/Sesame_server/group/animation_server.mmp
bluetoothengine/bthid/mouse/Sesame_server/inc/mousecursorsrv.h
bluetoothengine/bthid/mouse/Sesame_server/src/mousecursorimage.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp
bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h
bluetoothengine/btnotif/inc/btnotifier.h
bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp
bluetoothengine/btnotif/src/BTNotifier.cpp
bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp
bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp
group/bld.inf
tsrc/public/basic/conf/obexservapitest.cfg
tsrc/public/basic/conf/test.xml
tsrc/public/basic/group/bld.inf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/group/bld.inf	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project ?myapp
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+#include "../modematplugin/group/bld.inf"
+#include "../lccustomplugin/group/bld.inf"
+
+PRJ_EXPORTS
+
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/group/bld.inf	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides the information required for building the
+*                whole of DUN utilities
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+../rom/lccustomplugin.iby         CORE_MW_LAYER_IBY_EXPORT_PATH(lccustomplugin.iby)
+
+PRJ_MMPFILES
+lccustomplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/group/lccustomplugin.mmp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project LCCustomPlugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET                  lccustomplugin.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x20021360
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  lccustomplugin.cpp
+SOURCE                  lclistallcmd.cpp
+
+START RESOURCE          ../src/20021360.rss
+TARGET                  lccustomplugin.rsc
+END
+
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+LIBRARY	ecom.lib
+LIBRARY euser.lib
+LIBRARY atextpluginbase.lib
+
+DEBUGLIBRARY flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/inc/debug.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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:  Logging definitions
+*
+*/
+
+
+#ifndef PRJ_LOGGING_H
+#define PRJ_LOGGING_H
+
+#include <e32base.h>
+#include "debugconfig.h"
+
+#ifdef PRJ_ENABLE_TRACE
+
+#ifdef PRJ_FILE_TRACE
+#include <flogger.h>
+#else
+#include <e32debug.h>
+#endif
+
+NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+    {
+public:
+    void Overflow(TDes16& /*aDes*/) {}
+    };
+
+NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+    {
+public:
+    void Overflow(TDes8& /*aDes*/) {}
+    };
+
+inline void Trace(TRefByValue<const TDesC16> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+#ifdef PRJ_FILE_TRACE
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+#else
+    TBuf16<KMaxLogLineLength> theFinalString;
+    theFinalString.Append(KTracePrefix16);
+    TOverflowTruncate16 overflow;
+    theFinalString.AppendFormatList(aFmt,list,&overflow);
+    RDebug::Print(theFinalString);
+#endif
+    }
+
+inline void Trace(TRefByValue<const TDesC8> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list, aFmt);
+#ifdef PRJ_FILE_TRACE
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+#else
+    TOverflowTruncate8 overflow;
+    TBuf8<KMaxLogLineLength> buf8;
+    buf8.Append(KTracePrefix8);
+    buf8.AppendFormatList(aFmt, list, &overflow);
+    TBuf16<KMaxLogLineLength> buf16(buf8.Length());
+    buf16.Copy(buf8);
+    TRefByValue<const TDesC> tmpFmt(_L("%S"));
+    RDebug::Print(tmpFmt, &buf16);
+#endif
+    }
+
+inline void TracePanic(
+    char* aFile,
+    TInt aLine,
+    TInt aPanicCode,
+    const TDesC& aPanicCategory)
+    {
+    TPtrC8 fullFileName((const TUint8*)aFile);
+    TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+    TBuf8<KMaxLogLineLength> buf;
+    buf.Append(KPanicPrefix8);
+    buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName);
+    Trace(buf);
+    User::Panic(aPanicCategory, aPanicCode);
+    }
+
+inline void TraceLeave(char* aFile, TInt aLine, TInt aReason)
+    {
+    TPtrC8 fullFileName((const TUint8*)aFile);
+    TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+    TBuf8<KMaxLogLineLength> buf;
+    buf.Append(KLeavePrefix8);
+    buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName);
+    Trace(buf);
+    User::Leave(aReason);
+    }
+
+#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
+
+#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
+
+#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
+
+#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
+
+#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
+
+#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
+
+#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
+
+#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
+
+#define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeave(__FILE__, __LINE__, PTR);}
+
+#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
+
+#define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
+
+#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
+
+#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
+
+#define TRACE_STATIC_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
+
+#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
+
+#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
+
+#else // PRJ_ENABLE_TRACE not defined
+
+#define TRACE_INFO(p)
+
+#define TRACE_ERROR(p)
+
+#define TRACE_STATE(p)
+
+#define TRACE_WARNING(p)
+
+#define TRACE_INFO_SEG(p)
+
+#define TRACE_ASSERT(GUARD, CODE)
+
+#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
+
+#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
+
+#define LEAVE_IF_NULL(PTR) {static_cast<void>(User::LeaveIfNull(PTR));}
+
+#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
+
+#define TRACE_STATIC_FUNC_ENTRY
+
+#define TRACE_FUNC_ENTRY
+
+#define TRACE_FUNC_EXIT
+
+#define TRACE_STATIC_FUNC
+
+#define TRACE_FUNC
+
+#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
+#endif // PRJ_ENABLE_TRACE
+
+#endif // PRJ_LOGGING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/inc/debugconfig.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  Logging configure file
+*
+*/
+
+
+#ifndef ATEXT_DEBUGCONFIG_H
+#define ATEXT_DEBUGCONFIG_H
+
+#include "prjconfig.h"
+
+/**
+ * Custom logging variations.
+ */
+#ifdef PRJ_FILE_TRACE
+_LIT(KLogFile,"lccustomplugin.txt");
+_LIT(KLogDir,"LCCUSTOMPLUGIN");
+#endif
+
+#ifdef PRJ_ENABLE_TRACE
+_LIT(KTracePrefix16, "[LCCUSTOMPLUGIN] ");
+_LIT8(KTracePrefix8, "[LCCUSTOMPLUGIN] ");
+_LIT8(KFuncFormat8, "><%S");
+_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
+_LIT8(KFuncEntryFormat8, ">%S");
+_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
+_LIT8(KFuncExitFormat8, "<%S");
+
+_LIT(KPanicCategory, "lccustomplugin");
+_LIT8(KPanicPrefix8, "PANIC code ");
+_LIT8(KLeavePrefix8, "LEAVE code ");
+#endif
+
+const TInt KMaxLogLineLength = 512;
+
+#define KPRINTERROR        0x00000001 // Tracing level: error
+#define KPRINTINFO        0x00000002 // Tracing level: function trace
+#define KPRINTSTATE        0x00000004 // Tracing level: state machine info
+#define KPRINTWARNING   0x00000008 // Tracing level: warning
+
+const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING;
+
+#endif // ATEXT_DEBUGCONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/inc/lccustomplugin.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,476 @@
+/*
+* 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:  Main handler for incoming requests
+*
+*/
+
+#ifndef C_LCCUSTOMPLUGIN_H
+#define C_LCCUSTOMPLUGIN_H
+
+#include <atextpluginbase.h>
+
+class CLcCustomPlugin;
+
+/** Character types: carriage return, line feed or backspace */
+enum TCharacterTypes
+    {
+    ECharTypeCR,  // Carriage return
+    ECharTypeLF,  // Line feed
+    ECharTypeBS   // Backspace
+    };
+
+/** Type of modes (quiet, verbose) */
+enum TModeTypes
+    {
+    EModeTypeQuiet,   // Quiet mode
+    EModeTypeVerbose  // Verbose mode
+    };
+
+/**  Handler types for the four types */
+enum TCmdHandlerType
+    {
+    ECmdHandlerTypeUndefined = KErrNotFound,
+    ECmdHandlerTypeBase      = 0x01,  // For command "AT+COMMAND"
+    ECmdHandlerTypeSet       = 0x02,  // For command "AT+COMMAND="
+    ECmdHandlerTypeRead      = 0x04,  // For command "AT+COMMAND?"
+    ECmdHandlerTypeTest      = 0x08,  // For command "AT+COMMAND=?"
+    };
+
+/**  Detected commands */
+enum TDetectedCmd
+    {
+    EDetectedCmdUndefined,
+    EDetectedCmdCLAC  // For command "AT+CLAC"
+    };
+
+/**
+ *  Class for common AT command handler interface
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CLcCustomPluginBase )
+    {
+
+public:
+
+    virtual ~CLcCustomPluginBase() {};
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    virtual TBool IsCommandSupported( const TDesC8& aCmd ) = 0;
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since S60 5.0
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    virtual void HandleCommand( const TDesC8& aCmd,
+                                RBuf8& aReply,
+                                TBool aReplyNeeded ) = 0;
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    virtual void HandleCommandCancel() = 0;
+
+    };
+
+/**
+ *  Class for accessing plugin information and common functionality
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( MLcCustomPlugin )
+    {
+
+public:
+
+    /**
+     * Creates an AT command reply based on the reply type and completes the
+     * request to ATEXT. Uses iReplyBuffer for reply storage.
+     *
+     * @since S60 5.0
+     * @param aReplyType Type of reply
+     * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
+     * @param aError Completion code. If not KErrNone then other arguments are
+     *               ignored and the request is completed to ATEXT with
+     *               EReplyTypeUndefined.
+     * @return None
+     */
+    virtual TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                         const TDesC8& aSrcBuffer=KNullDesC8,
+                                         TInt aError=KErrNone ) = 0;
+
+    /**
+     * Creates a buffer for "OK" or "ERROR" reply based on the line settings
+     *
+     * @since S60 5.0
+     * @param aReplyBuffer Destination buffer for the created reply
+     * @param aOkReply ETrue if "OK" reply needed,
+     *                 EFalse if "ERROR" reply needed
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                                       TBool aOkReply ) = 0;
+
+    /**
+     * Checks if the command is a base, set, read or test type of command
+     *
+     * @since TB9.2
+     * @param aCmdBase Base part of the command to check
+     * @param aCmdFull Full command to check
+     * @return Type of command
+     */
+    virtual TCmdHandlerType CheckCommandType( const TDesC8& aCmdBase,
+                                              const TDesC8& aCmdFull ) = 0;
+
+    /**
+     * Returns the array of supported commands
+     *
+     * @since S60 5.0
+     * @param aCmd Array of supported commands
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetSupportedCommands( RPointerArray<HBufC8>& aCmds ) = 0;
+
+    /**
+     * Returns plugin's character value settings (from CATExtPluginBase)
+     *
+     * @since S60 5.0
+     * @param aCharType Character's type
+     * @param aChar Character's value matching aCharType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar ) = 0;
+
+    /**
+     * Returns plugin's mode value settings (from CATExtPluginBase)
+     *
+     * @since S60 5.0
+     * @param aModeType Mode type
+     * @param aMode Mode value matching aModeType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetModeValue( TModeTypes aModeType, TBool& aMode ) = 0;
+
+    };
+
+/**
+ *  Class for selecting handlers for different AT commands
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CLcCustomPlugin ) : public CATExtPluginBase,
+                                       public MLcCustomPlugin
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @return Instance of self
+     */
+    static CLcCustomPlugin* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CLcCustomPlugin();
+
+private:
+
+    CLcCustomPlugin();
+
+    void ConstructL();
+
+    /**
+     * Reports connection identifier name to the extension plugin.
+     *
+     * @since S60 5.0
+     * @param aName Connection identifier name
+     * @return None
+     */
+    void ReportConnectionName( const TDesC8& aName );
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    TBool IsCommandSupported( const TDesC8& aCmd );
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since S60 5.0
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    void HandleCommandCancel();
+
+    /**
+     * Next reply part's length.
+     * The value must be equal or less than KDefaultCmdBufLength.
+     * When the reply from this method is zero, ATEXT stops calling
+     * GetNextPartOfReply().
+     *
+     * @since S60 5.0
+     * @return Next reply part's length if zero or positive
+     */
+    TInt NextReplyPartLength();
+
+    /**
+     * Gets the next part of reply initially set by HandleCommandComplete().
+     * Length of aNextReply must be equal or less than KDefaultCmdBufLength.
+     *
+     * @since S60 5.0
+     * @param aNextReply Next reply
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetNextPartOfReply( RBuf8& aNextReply );
+
+    /**
+     * Receives unsolicited results. Cancelling of the pending request is done
+     * by ReceiveUnsolicitedResultCancel(). The implementation in the extension
+     * plugin should be asynchronous.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    void ReceiveUnsolicitedResult();
+
+    /**
+     * Cancels a pending ReceiveUnsolicitedResult request.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    void ReceiveUnsolicitedResultCancel();
+
+    /**
+     * Reports NVRAM status change to the plugins.
+     *
+     * @since S60 5.0
+     * @param aNvram New NVRAM status. Each call of this function is a result
+     *               of DUN extracting the form notified by
+     *               CATExtCommonBase::SendNvramStatusChange(). Each of the
+     *               settings from SendNvramStatusChange() is separated to
+     *               one call of ReportNvramStatusChange().
+     * @return None
+     */
+    void ReportNvramStatusChange( const TDesC8& aNvram );
+
+    /**
+     * Reports about external handle command error condition.
+     * This is for cases when for example DUN decided the reply contained an
+     * error condition but the plugin is still handling the command internally.
+     * Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
+     * "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
+     * different reply types the condition is "ERROR" and DUN ends processing.
+     * This solution keeps the pointer to the last AT command handling plugin
+     * inside ATEXT and calls this function there to report the error.
+     * It is to be noted that HandleCommandCancel() is not sufficient to stop
+     * the processing as the command handling has already finished.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    void ReportExternalHandleCommandError();
+
+    /**
+     * Creates part of reply from the global reply buffer to the destination
+     * buffer. Used with APIs which need the next part of reply in multipart
+     * reply requests.
+     *
+     * @since S60 5.0
+     * @param aDstBuffer Destination buffer; the next part of reply is stored to
+     *                   this buffer.
+     * @return None
+     */
+    TInt CreatePartOfReply( RBuf8& aDstBuffer );
+
+// from base class MLcCustomPlugin
+
+    /**
+     * From MLcCustomPlugin.
+     * Creates an AT command reply based on the reply type and completes the
+     * request to ATEXT. Uses iReplyBuffer for reply storage.
+     *
+     * @since S60 5.0
+     * @param aReplyType Type of reply
+     * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
+     * @param aError Completion code. If not KErrNone then other arguments are
+     *               ignored and the request is completed to ATEXT with
+     *               EReplyTypeUndefined.
+     * @return None
+     */
+    TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                 const TDesC8& aSrcBuffer=KNullDesC8,
+                                 TInt aError=KErrNone );
+
+    /**
+     * From MLcCustomPlugin.
+     * Creates a buffer for "OK" or "ERROR" reply based on the line settings
+     *
+     * @since S60 5.0
+     * @param aReplyBuffer Destination buffer for the created reply
+     * @param aOkReply ETrue if "OK" reply needed,
+     *                 EFalse if "ERROR" reply needed
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                               TBool aOkReply );
+
+    /**
+     * From MLcCustomPlugin.
+     * Checks if the command is a base, set, read or test type of command
+     *
+     * @since S60 5.0
+     * @param aCmdBase Base part of the command to check
+     * @param aCmdFull Full command to check
+     * @return Type of command
+     */
+    TCmdHandlerType CheckCommandType( const TDesC8& aCmdBase,
+                                      const TDesC8& aCmdFull );
+
+    /**
+     * From MLcCustomPlugin.
+     * Returns the array of supported commands
+     *
+     * @since S60 5.0
+     * @param aCmd Array of supported commands
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetSupportedCommands( RPointerArray<HBufC8>& aCmds );
+
+    /**
+     * From MLcCustomPlugin.
+     * Returns plugin's character value settings (from CATExtPluginBase)
+     *
+     * @since S60 5.0
+     * @param aCharType Character's type
+     * @param aChar Character's value matching aCharType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar );
+
+    /**
+     * From MLcCustomPlugin.
+     * Returns plugin's mode value settings (from CATExtPluginBase)
+     *
+     * @since S60 5.0
+     * @param aModeType Mode type
+     * @param aMode Mode value matching aModeType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetModeValue( TModeTypes aModeType, TBool& aMode );
+
+private:  // data
+
+    /**
+     * AT commands handler array. Used for mapping HandleCommand() to
+     * IsCommandSupported() and to limit the number of string comparisons.
+     */
+    RPointerArray<CLcCustomPluginBase> iHandlers;
+
+    /**
+     * Current AT command handler in iHandlers.
+     * Used when IsCommandSupported() detects a matching handler class.
+     */
+    CLcCustomPluginBase* iHandler;
+
+    /**
+     * Buffer for handle command's command
+     * Not own.
+     */
+    const TDesC8* iHcCmd;
+
+    /**
+     * Buffer for handle command reply
+     * Not own.
+     */
+    RBuf8* iHcReply;
+
+    /**
+     * Global reply buffer for the AT command replies
+     */
+    RBuf8 iReplyBuffer;
+
+    };
+
+#endif  // C_LCCUSTOMPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/inc/lclistallcmd.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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:  Handles the commands "AT+CLAC=?" and "AT+CLAC"
+*
+*/
+
+#ifndef C_LCLISTALLCMD_H
+#define C_LCLISTALLCMD_H
+
+#include "lccustomplugin.h"
+
+/**
+ *  Class for handling commands "AT+CLAC=?" and "AT+CLAC"
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CLcListAllCmd ) : public CLcCustomPluginBase
+{
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aCallback Callback
+     * @return Instance of self
+     */
+    static CLcListAllCmd* NewL( MLcCustomPlugin* aCallback );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CLcListAllCmd();
+
+private:
+
+    CLcListAllCmd( MLcCustomPlugin* aCallback );
+
+    void ConstructL();
+
+    /**
+     * Checks command types
+     *
+     * @since TB9.2
+     * @param aCmd Command to check
+     * @return ETrue if command understood, EFalse otherwise
+     */
+    TBool CheckCommand( const TDesC8& aCmd );
+
+    /**
+     * Main command handler (leaving version)
+     *
+     * @since TB9.2
+     * @return ETrue if command understood, EFalse otherwise
+     */
+    TBool HandleCommandL();
+
+// from base class MLcCustomPluginBase
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    TBool IsCommandSupported( const TDesC8& aCmd );
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since S60 5.0
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since S60 5.0
+     * @return None
+     */
+    void HandleCommandCancel();
+
+    /**
+     * Creates a linearized list of supported commands
+     *
+     * @since S60 5.0
+     * @param aReply List of supported commands
+     * @return ETrue if "ERROR" condition detected, EFalse otherwise
+     */
+    TBool CreateSupportedList( RBuf8& aReply );
+
+private:  // data
+
+    /**
+     * Callback to call when accessing plugin information
+     */
+    MLcCustomPlugin* iCallback;
+
+    /**
+     * Handler type for the two AT commands
+     */
+    TCmdHandlerType iCmdHandlerType;
+
+    /**
+     * Detected command
+     */
+    TDetectedCmd iDetectedCmd;
+
+};
+
+#endif  // C_LCLISTALLCMD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/inc/prjconfig.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project configure file
+*
+*/
+
+
+#ifndef ATEXT_PRJCONFIG_H
+#define ATEXT_PRJCONFIG_H
+
+/**
+ * Traces are enabled in _DEBUG build, by default.
+ */
+#ifdef _DEBUG
+#define PRJ_ENABLE_TRACE
+#endif
+
+/**
+ * traces to file if this is defined.
+ */
+//#define PRJ_FILE_TRACE
+
+
+/**
+ * build the project for module test purpose if this is defined
+ */
+//#define PRJ_MODULETEST_BUILD
+
+/**
+ * build the project using stubs to replace the dependencies if this is defined
+ */
+//#define PRJ_USE_STUB
+
+
+#endif // ATEXT_PRJCONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/rom/lccustomplugin.iby	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project LCCustomPlugin
+*
+*/
+
+
+#ifndef __LCCUSTOMPLUGIN_IBY__
+#define __LCCUSTOMPLUGIN_IBY__
+
+ECOM_PLUGIN( lccustomplugin.dll, lccustomplugin.rsc )
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/src/20021360.rss	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project lccustomplugin
+*
+*/
+
+
+#include <atext_interfaceuid.h>
+#include <registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x20021360;
+	// Declare array of interface info
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = ATEXT_INTERFACE_DUN_UID; 
+			implementations =
+				{
+				// Info for BTSAC
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x20021375;
+					version_no = 1;
+					display_name = "LC Custom Plugin DUN";
+					default_data=  "MAT+CLAC";
+					opaque_data = "";
+					}
+				};
+			},
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = ATEXT_INTERFACE_HFP_UID; 
+			implementations =
+				{
+				// Info for BTSAC
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x20021376;
+					version_no = 1;
+					display_name = "LC Custom Plugin HFP";
+					default_data=  "MAT+CLAC";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/src/lccustomplugin.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,476 @@
+/*
+* 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:  Main handler for incoming requests
+*
+*/
+
+#include "lccustomplugin.h"
+#include "lclistallcmd.h"
+#include "debug.h"
+
+const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CLcCustomPlugin* CLcCustomPlugin::NewL()
+    {
+    CLcCustomPlugin* self = new (ELeave) CLcCustomPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CLcCustomPlugin::~CLcCustomPlugin()
+	{
+	iHandlers.ResetAndDestroy();
+	iHandlers.Close();
+    iReplyBuffer.Close();
+	}
+
+// ---------------------------------------------------------------------------
+// CLcCustomPlugin::CLcCustomPlugin
+// ---------------------------------------------------------------------------
+//
+CLcCustomPlugin::CLcCustomPlugin() : CATExtPluginBase()
+    {
+    iHandler = NULL;
+    iHcCmd = NULL;
+    iHcReply = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CLcCustomPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ConstructL()
+    {
+    CLcCustomPluginBase* handler = NULL;
+    handler = CLcListAllCmd::NewL( this );
+    CleanupStack::PushL( handler );
+    iHandlers.AppendL( handler );
+    CleanupStack::Pop( handler );
+   	}
+
+// ---------------------------------------------------------------------------
+// Reports connection identifier name to the extension plugin.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ReportConnectionName( const TDesC8& /*aName*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Reports the support status of an AT command. This is a synchronous API.
+// ---------------------------------------------------------------------------
+//
+TBool CLcCustomPlugin::IsCommandSupported( const TDesC8& aCmd )
+    {
+    TRACE_FUNC_ENTRY
+    iHcCmd = NULL;
+    iHcReply = NULL;
+    TInt i;
+    TInt count = iHandlers.Count();
+    for ( i=0; i<count; i++ )
+        {
+        CLcCustomPluginBase* handler = iHandlers[i];
+        TBool supported = handler->IsCommandSupported( aCmd );
+        if ( supported )
+            {
+            iHandler = handler;
+            TRACE_FUNC_EXIT
+            return ETrue;
+            }
+        }
+    iHandler = NULL;
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an AT command. Cancelling of the pending request is done by
+// HandleCommandCancel(). The implementation in the extension plugin should
+// be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::HandleCommand( const TDesC8& aCmd,
+                                     RBuf8& aReply,
+                                     TBool aReplyNeeded )
+	{
+	TRACE_FUNC_ENTRY
+	if ( iHandler )
+	    {
+	    iHcCmd = &aCmd;
+	    iHcReply = &aReply;
+	    iHandler->HandleCommand( aCmd, aReply, aReplyNeeded );
+	    }
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels a pending HandleCommand request.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::HandleCommandCancel()
+    {
+    TRACE_FUNC_ENTRY
+	if ( iHandler )
+	    {
+	    iHandler->HandleCommandCancel();
+	    }
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Next reply part's length.
+// The value must be equal or less than KDefaultCmdBufLength.
+// When the reply from this method is zero, ATEXT stops calling
+// GetNextPartOfReply().
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::NextReplyPartLength()
+    {
+    TRACE_FUNC_ENTRY
+    if ( iReplyBuffer.Length() < KDefaultCmdBufLength )
+        {
+        TRACE_FUNC_EXIT
+        return iReplyBuffer.Length();
+        }
+    TRACE_FUNC_EXIT
+    return KDefaultCmdBufLength;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the next part of reply initially set by HandleCommandComplete().
+// Length of aNextReply must be equal or less than KDefaultCmdBufLength.
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::GetNextPartOfReply( RBuf8& aNextReply )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = CreatePartOfReply( aNextReply );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// Receives unsolicited results. Cancelling of the pending request is done by
+// by ReceiveUnsolicitedResultCancel(). The implementation in the extension
+// plugin should be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ReceiveUnsolicitedResult()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels a pending ReceiveUnsolicitedResult request.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ReceiveUnsolicitedResultCancel()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Reports NVRAM status change to the plugins.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ReportNvramStatusChange( const TDesC8& /*aNvram*/ )
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Reports about external handle command error condition.
+// This is for cases when for example DUN decided the reply contained an
+// error condition but the plugin is still handling the command internally.
+// Example: "AT+TEST;+TEST2" was given in command line; "AT+TEST" returns
+// non-EReplyTypeError condition and "AT+TEST2" returns EReplyTypeError.
+// As the plugin(s) returning the non-EReplyTypeError may still have some
+// ongoing operation then these plugins are notified about the external
+// EReplyTypeError in command line processing. It is to be noted that
+// HandleCommandCancel() is not sufficient to stop the processing as the
+// command handling has already finished.
+// ---------------------------------------------------------------------------
+//
+void CLcCustomPlugin::ReportExternalHandleCommandError()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Creates part of reply from the global reply buffer to the destination
+// buffer. Used with APIs which need the next part of reply in multipart reply
+// requests.
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::CreatePartOfReply( RBuf8& aDstBuffer )
+    {
+    TRACE_FUNC_ENTRY
+    if ( iReplyBuffer.Length() <= 0 )
+        {
+        TRACE_FUNC_EXIT
+        return KErrGeneral;
+        }
+    TInt partLength = NextReplyPartLength();
+    if ( iReplyBuffer.Length() < partLength )
+        {
+        TRACE_FUNC_EXIT
+        return KErrNotFound;
+        }
+    aDstBuffer.Create( iReplyBuffer, partLength );
+    iReplyBuffer.Delete( 0, partLength );
+    if ( iReplyBuffer.Length() == 0 )
+        {
+        iReplyBuffer.Close();
+        }
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates an AT command reply based on the reply type and completes the
+// request to ATEXT. Uses iReplyBuffer for reply storage.
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                              const TDesC8& aSrcBuffer,
+											  TInt aError )
+    {
+    TRACE_FUNC_ENTRY
+    iReplyBuffer.Close();
+    if ( aError != KErrNone )
+        {
+        HandleCommandCompleted( aError, EReplyTypeUndefined );
+        iHcCmd = NULL;
+        iHcReply = NULL;
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    if ( !iHcReply )
+        {
+        TRACE_FUNC_EXIT
+        return KErrGeneral;
+        }
+    switch ( aReplyType )
+        {
+        case EReplyTypeOther:
+            if ( iQuietMode )
+                {
+                iReplyBuffer.Create( KNullDesC8 );
+                }
+            else
+                {
+                iReplyBuffer.Create( aSrcBuffer );
+                }
+            break;
+        case EReplyTypeOk:
+            CreateOkOrErrorReply( iReplyBuffer, ETrue );
+            break;
+        case EReplyTypeError:
+            CreateOkOrErrorReply( iReplyBuffer, EFalse );
+            break;
+        default:
+            TRACE_FUNC_EXIT
+            return KErrGeneral;
+        }
+    CreatePartOfReply( *iHcReply );
+    HandleCommandCompleted( KErrNone, aReplyType );
+    iHcCmd = NULL;
+    iHcReply = NULL;
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates a buffer for "OK" or "ERROR" reply based on the line settings
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                                            TBool aOkReply )
+    {
+    TRACE_FUNC_ENTRY
+    if ( iQuietMode )
+        {
+        TRACE_FUNC_EXIT
+        return iReplyBuffer.Create( KNullDesC8 );
+        }
+    _LIT8( KErrorReplyVerbose, "ERROR" );
+    _LIT8( KOkReplyVerbose,    "OK" );
+    _LIT8( KErrorReplyNumeric, "4" );
+    _LIT8( KOkReplyNumeric,    "0" );
+    TBuf8<KErrorReplyLength> replyBuffer;
+    if ( iVerboseMode )
+        {
+        replyBuffer.Append( iCarriageReturn );
+        replyBuffer.Append( iLineFeed );
+        if ( aOkReply )
+            {
+            replyBuffer.Append( KOkReplyVerbose );
+            }
+        else
+            {
+            replyBuffer.Append( KErrorReplyVerbose );
+            }
+        replyBuffer.Append( iCarriageReturn );
+        replyBuffer.Append( iLineFeed );
+        }
+    else
+        {
+        if ( aOkReply )
+            {
+            replyBuffer.Append( KOkReplyNumeric );
+            }
+        else
+            {
+            replyBuffer.Append( KErrorReplyNumeric );
+            }
+        replyBuffer.Append( iCarriageReturn );
+        }
+    TInt retVal = aReplyBuffer.Create( replyBuffer );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Checks if the command is a base, set, read or test type of command
+// ---------------------------------------------------------------------------
+//
+TCmdHandlerType CLcCustomPlugin::CheckCommandType(
+    const TDesC8& aCmdBase,
+    const TDesC8& aCmdFull )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retTemp = KErrNone;
+    TBuf8<KDefaultCmdBufLength> atCmdBuffer;
+    atCmdBuffer.Copy( aCmdBase );
+    // Check "base" command ("AT+COMMAND")
+    retTemp = aCmdFull.Compare( atCmdBuffer );
+    if ( retTemp == 0 )
+        {
+        TRACE_FUNC_EXIT
+        return ECmdHandlerTypeBase;
+        }
+    // Check "read" command ("AT+COMMAND?")
+    // Add last question mark
+    atCmdBuffer.Append( '?' );
+    retTemp = aCmdFull.Compare( atCmdBuffer );
+    if ( retTemp == 0 )
+        {
+        TRACE_FUNC_EXIT
+        return ECmdHandlerTypeRead;
+        }
+    // Check "test" command ("AT+COMMAND=?")
+    // Add "=" before the question mark
+    _LIT8( KAssignmentMark, "=" );
+    atCmdBuffer.Insert( atCmdBuffer.Length()-1, KAssignmentMark );
+    retTemp = aCmdFull.Compare( atCmdBuffer );
+    if ( retTemp == 0 )
+        {
+        TRACE_FUNC_EXIT
+        return ECmdHandlerTypeTest;
+        }
+    // Check "set" command ("AT+COMMAND=")
+    // Remove last question mark
+    atCmdBuffer.SetLength( atCmdBuffer.Length() - 1 );
+    retTemp = aCmdFull.Compare( atCmdBuffer );
+    if ( retTemp == 0 )
+        {
+        TRACE_FUNC_EXIT
+        return ECmdHandlerTypeSet;
+        }
+    TRACE_FUNC_EXIT
+    return ECmdHandlerTypeUndefined;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns the array of supported commands
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::GetSupportedCommands( RPointerArray<HBufC8>& aCmds )
+    {
+    TRACE_FUNC_ENTRY
+    // Force superclass call here:
+    TInt retVal = CATExtPluginBase::GetSupportedCommands( aCmds );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns plugin's character value settings (from CATExtPluginBase)
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::GetCharacterValue( TCharacterTypes aCharType,
+                                         TChar& aChar )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = KErrNone;
+    switch ( aCharType )
+        {
+        case ECharTypeCR:
+            aChar = iCarriageReturn;
+            break;
+        case ECharTypeLF:
+            aChar = iLineFeed;
+            break;
+        case ECharTypeBS:
+            aChar = iBackspace;
+            break;
+        default:
+            retVal = KErrNotFound;
+            break;
+        }
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns plugin's mode value settings (from CATExtPluginBase)
+// ---------------------------------------------------------------------------
+//
+TInt CLcCustomPlugin::GetModeValue( TModeTypes aModeType, TBool& aMode )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = KErrNone;
+    switch ( aModeType )
+        {
+        case EModeTypeQuiet:
+            aMode = iQuietMode;
+            break;
+        case EModeTypeVerbose:
+            aMode = iVerboseMode;
+            break;
+        default:
+            retVal = KErrNotFound;
+            break;
+        }
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/src/lclistallcmd.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* 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:  Handles the commands "AT+CLAC?" and "AT+CLAC"
+*
+*/
+
+#include "lclistallcmd.h"
+#include "debug.h"
+
+const TInt KCrLfLength    = 2;  // CR+LF
+const TInt KOkReplyLength = 6;  // CR+LF+"OK"+CR+LF
+
+_LIT8( KClacCmd, "AT+CLAC" );
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CLcListAllCmd* CLcListAllCmd::NewL( MLcCustomPlugin* aCallback )
+    {
+    CLcListAllCmd* self = new (ELeave) CLcListAllCmd( aCallback );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CLcListAllCmd::~CLcListAllCmd()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CLcListAllCmd::CLcListAllCmd
+// ---------------------------------------------------------------------------
+//
+CLcListAllCmd::CLcListAllCmd( MLcCustomPlugin* aCallback ) :
+    iCallback( aCallback )
+    {
+    iCmdHandlerType = ECmdHandlerTypeUndefined;
+    }
+
+// ---------------------------------------------------------------------------
+// CLcListAllCmd::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CLcListAllCmd::ConstructL()
+    {
+    if ( !iCallback )
+        {
+        User::Leave( KErrGeneral );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Checks command types
+// ---------------------------------------------------------------------------
+//
+TBool CLcListAllCmd::CheckCommand( const TDesC8& aCmd )
+    {
+    TRACE_FUNC_ENTRY
+    // The AT+CLAC command supports two types: base and test
+    iCmdHandlerType = iCallback->CheckCommandType( KClacCmd, aCmd );
+    if ( iCmdHandlerType==ECmdHandlerTypeBase ||
+         iCmdHandlerType==ECmdHandlerTypeTest )
+        {
+        iDetectedCmd = EDetectedCmdCLAC;
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Reports the support status of an AT command. This is a synchronous API.
+// ---------------------------------------------------------------------------
+//
+TBool CLcListAllCmd::IsCommandSupported( const TDesC8& aCmd )
+    {
+    TRACE_FUNC_ENTRY
+    // Set all to undefined if either the command or its type is unknown
+    // HandleCommand() should be round only when both are set
+    TBool cmdUnderstood = CheckCommand( aCmd );
+    if ( cmdUnderstood )
+        {
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+    iCmdHandlerType = ECmdHandlerTypeUndefined;
+    iDetectedCmd = EDetectedCmdUndefined;
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an AT command. Cancelling of the pending request is done by
+// HandleCommandCancel(). The implementation in the extension plugin should
+// be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CLcListAllCmd::HandleCommand( const TDesC8& /*aCmd*/,
+                                   RBuf8& /*aReply*/,
+                                   TBool aReplyNeeded )
+    {
+    TRACE_FUNC_ENTRY
+    if ( !aReplyNeeded )
+        {
+        TRACE_FUNC_EXIT
+        return;
+        }
+    if ( iCmdHandlerType == ECmdHandlerTypeTest )
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeOk );
+        TRACE_FUNC_EXIT
+        return;
+        }
+    // Else here means ECmdHandlerTypeBase
+    // First check the quiet mode and verbose mode.
+    // These are handled in CreateReplyAndComplete()
+    TInt retTemp;
+    TBool quietMode = EFalse;
+    retTemp  = iCallback->GetModeValue( EModeTypeQuiet, quietMode );
+    if ( retTemp != KErrNone )
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeError );
+        TRACE_FUNC_EXIT
+        return;
+        }
+    RBuf8 reply;
+    if ( quietMode )
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeOther, reply );
+        reply.Close();
+        TRACE_FUNC_EXIT
+        return;
+        }
+    TBool error = CreateSupportedList( reply );
+    if ( error )
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeError );
+        reply.Close();
+        TRACE_FUNC_EXIT
+        return;
+        }
+    RBuf8 okReply;
+    iCallback->CreateOkOrErrorReply( okReply, ETrue );
+    reply.Append( okReply );
+    okReply.Close();
+    iCallback->CreateReplyAndComplete( EReplyTypeOther, reply );
+    reply.Close();
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels a pending HandleCommand request.
+// ---------------------------------------------------------------------------
+//
+void CLcListAllCmd::HandleCommandCancel()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Creates a linearized list of supported commands
+// ---------------------------------------------------------------------------
+//
+TBool CLcListAllCmd::CreateSupportedList( RBuf8& aReply )
+    {
+    TRACE_FUNC_ENTRY
+    // First get the unsorted list from ATEXT
+    RPointerArray<HBufC8> commands;
+    iCallback->GetSupportedCommands( commands );
+    // Next linearize the list for a reply
+    if ( commands.Count() <= 0 )
+        {
+        commands.Close();
+        TRACE_FUNC_EXIT
+        return EFalse;
+        }
+    TInt i;
+    TInt linearSize = KOkReplyLength;
+    TInt count = commands.Count();
+    for ( i=0; i<count; i++ )
+        {
+        linearSize += (*commands[i]).Length();
+        if ( i < count-1 )
+            {
+            linearSize += KCrLfLength;
+            }
+        }
+    linearSize += KCrLfLength;
+    // Now we have the length of the linear region,
+    // use that to create the reply
+    TChar carriageReturn;
+    TChar lineFeed;
+    TInt retTemp;
+    retTemp  = aReply.Create( linearSize );
+    retTemp |= iCallback->GetCharacterValue( ECharTypeCR, carriageReturn );
+    retTemp |= iCallback->GetCharacterValue( ECharTypeLF, lineFeed );
+    if ( retTemp != KErrNone )
+        {
+        commands.ResetAndDestroy();
+        commands.Close();
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+    for ( i=0; i<count; i++ )
+        {
+        aReply.Append( *commands[i] );
+        if ( i < count-1 )
+            {
+            aReply.Append( carriageReturn );
+            aReply.Append( lineFeed );
+            }
+        }
+    aReply.Append( carriageReturn );
+    aReply.Append( lineFeed );
+    // Delete the array as it is no longer needed
+    commands.ResetAndDestroy();
+    commands.Close();
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/lccustomplugin/src/proxy.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Export ECom interface implementations
+*
+*/
+
+
+#ifndef REFERENCE_ATEXT_H
+#define REFERENCE_ATEXT_H
+
+#include <e32base.h>
+#include <ecom/implementationproxy.h>
+#include "lccustomplugin.h"
+
+// ---------------------------------------------------------------------------
+// An array of TImplementationProxy objects which onnect each
+// implemeation with its instantiation function
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x20021375, CLcCustomPlugin::NewL),  // DUN
+	IMPLEMENTATION_PROXY_ENTRY(0x20021376, CLcCustomPlugin::NewL)   // HFP
+	};
+
+// ---------------------------------------------------------------------------
+// Exported proxy function to resolve instantiation methods for an Ecom
+// plug-in DLL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/group/bld.inf	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides the information required for building the
+*                modem at plugin
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+../rom/modematplugin.iby         CORE_MW_LAYER_IBY_EXPORT_PATH(modematplugin.iby)
+
+PRJ_MMPFILES
+modematplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/group/modematplugin.mmp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project modematplugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET                  modematplugin.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x20029FBF 
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  modematplugin.cpp
+SOURCE                  atcopscmd.cpp
+
+START RESOURCE          ../src/20029fbf.rss  
+TARGET                  modematplugin.rsc
+END
+
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+LIBRARY	ECom.lib
+LIBRARY euser.lib
+LIBRARY atextpluginbase.lib
+LIBRARY etelmm.lib 
+LIBRARY etel.lib
+LIBRARY etelpckt.lib
+LIBRARY customapi.lib
+
+DEBUGLIBRARY flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/atcopscmd.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,434 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles the commands "AT+COPS=..." and "AT+COPS?"
+*
+*/
+
+
+#ifndef C_CATCOPSCMD_H
+#define C_CATCOPSCMD_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+#include <rmmcustomapi.h>
+#include <etelpckt.h>
+#include <etelmm.h>
+#include <mmretrieve.h>
+#include "modematplugin.h"
+
+class MCmdPluginObserver; 
+class CRetrieveMobilePhoneDetectedNetworks; 
+
+/**  Handler types for the AT commands */
+enum TCmdHandlerType
+    {
+    ECmdHandlerTypeUndefined,
+    ECmdHandlerTypeTest,  // For command "AT+COPS=?"
+    ECmdHandlerTypeRead,  // For command "AT+COPS?"
+    ECmdHandlerTypeSet    // For command "AT+COPS=..."
+    };
+
+/**  Keeps track of the current operation for the state machine */
+enum TCurrentOperation
+    {
+    EIdle 										= 0, 
+    EInspectModeAndProcessCommand 				= 1,
+    EAutomaticallyRegisterToNetwork 			= 2,
+    EManuallyRegisterToNetwork 					= 3,
+    EManuallyRegisterToNetworkAndChooseAccTech 	= 4,
+    EGetNetworkInfoOperatorName 				= 5, 
+    ESetSystemNetworkBand 						= 6, 
+    EUpdateAvailableNetworkOperators 			= 7, 
+    EListAvailableNetworkOperators 				= 8    
+    };
+
+/** These are in the same order as in 3GPP TS 27.007 V8.4.1  */ 
+enum TOperatorFormat
+    {
+    EFormatLong, 
+    EFormatShort, 
+    EFormatNumeric  
+    }; 
+
+/** These are in the same order as in 3GPP TS 27.007 V8.4.1  */ 
+enum TNetworkRegistrationMode
+    {
+    EModeAutomatic, 
+    EModeManual, 
+    EModeDeregister, 
+    EModeSetFormatParameter, 
+    EModeManualAutomatic, 
+    }; 
+
+/** Currently selected access technology for outgoing replies. 
+*		S60 uses definitions from RMobilePhone class, but they are 
+* 	in diffent order and cannot be used directly. 
+*		These are in the same order as in 3GPP TS 27.007 V8.4.1  */ 
+enum TAccessTechnology
+    {
+    EGSM 					= 0, 
+    EGSMCompact 			= 1,  
+    EUDMA 					= 2, 
+    EGSMwithEGPRS 			= 3, 
+    EHSDPA 					= 4, 
+    EHSUPA 					= 5,  
+    EUDMAwithHSDPAandHSUPA 	= 6, 
+    EAccTechNotSet 			= 255
+    }; 
+
+/**
+ *  Class for handling commands "AT+COPS?" and "AT+COPS=..."
+ *
+ *  @since TB9.2
+ */
+NONSHARABLE_CLASS( CATCOPSCmd ) : public CActive, public CATCommandHandlerBase    
+{
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aCallback Callback
+     * @return Instance of self
+     */
+    static CATCOPSCmd* NewL( MCmdPluginObserver* aCallback );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CATCOPSCmd();
+
+protected:
+    /**
+    * From CActive. Called when asynchronous request completes.
+    * @since TB9.2
+    * @param None
+    * @return None
+    */
+    virtual void RunL();
+         
+    virtual void DoCancel();
+
+private:
+
+    CATCOPSCmd( MCmdPluginObserver* aCallback );
+
+    void ConstructL();
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    TBool IsCommandSupported( const TDesC8& aCmd );
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since TB9.2
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since TB9.2
+     * @return None
+     */
+    void HandleCommandCancel();
+
+
+private: 
+
+
+    void HandleCommandTest( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+    void HandleCommandRead( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+    void HandleCommandSet( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+    void HandleError(); 
+
+    /**
+     * This method parses the parameter part of command and populates 
+     * iParamArray class member. Quotation marks are removed in process. 
+     *
+     * @since TB9.2
+     * @param aCmd The AT command. 
+     * @return Leaves in out of memory case. 
+     */
+    void ExtractParametersL(const TDesC8& aCmd); 
+
+    /**
+     * This method strips all quotation parms from the string passed in. 
+     *
+     * @since TB9.2
+     * @param aParameter one parameter from AT command as extracted by ExtractParametersL. 
+     * @return None
+     */
+    void RemoveQuotationMarks(TPtr8& aParameter); 
+
+    /**
+     * This method returns the selected mode in aMode. 
+     * It also checks that there are enough parameters for the mode in question. 
+     *
+     * @since TB9.2
+     * @param aParameter one parameter from AT command as extracted by ExtractParametersL. 
+     * @param aMode contains the converted parameter if method completed successfully. 
+     * @return 	KErrArgument if mode is invalid or there is not enough parameters. 
+     *					KErrNone if iParamArray contains all the parameters the mode requires. 
+     */
+    TInt GetModeAndCheckParameterCount(const TDesC8& aParameter, TNetworkRegistrationMode &aMode); 
+
+    /**
+     * This method converts an AT command parameter to numeric format value and checks it is valid. 
+     *
+     * @since TB9.2
+     * @param aParameter one parameter from AT command as extracted by ExtractParametersL. 
+     * @param aFormat contains the converted parameter if method completed successfully. 
+     * @return 	KErrArgument if format is invalid. 
+     *					KErrNone if format is valid. 
+     */
+    TInt GetFormatFromParameter(const TDesC8& aParameter, RMmCustomAPI::TOperatorNameType &aFormat);  
+
+    /**
+     * This method converts an AT command parameter to numeric access technology value and checks it is valid. 
+     *
+     * @since TB9.2
+     * @param aParameter one parameter from AT command as extracted by ExtractParametersL. 
+     * @param aAccTech contains the converted parameter if method completed successfully. 
+     * @return 	KErrArgument if acc. tech. is invalid. 
+     *					KErrNone if acc. tech. is valid. 
+     */
+    TInt GetAccTechFromParameter(const TDesC8& aParameter, TAccessTechnology &aAccTech); 
+    
+    /**
+     * This method converts an AT command parameter to ETel compatible operator values 
+     *
+     * @since TB9.2
+     * @param aDetectedNetworks contains the list of networks. May be NULL. 
+     * @param aFormat contains the format (numeric/text) of operator parameter. 
+     * @param aOperatorParameter contains the operator parameter string. 
+     * @param aMcc contains the converted parameter if method completed successfully. 
+     * @param aMnc contains the converted parameter if method completed successfully. 
+     * @return 	KErrArgument 	if operator parameter invalid, 
+     *					KErrNotFound 	if operator list exists but the operator is not in it, 
+     *												or the operator list is missing. (Required if aFormat is text.) 
+     *					KErrNone if conversion succeeds. aMcc and aMnc contain ETel compatible operator values. 
+     */
+    TInt ConvertOperatorToMccMnc(const CMobilePhoneNetworkListV2 *aDetectedNetworks,
+                                            const RMmCustomAPI::TOperatorNameType aFormat, 
+                                            const TBuf<KMaxOperatorNameLength>& aOperatorParameter, 
+                                            RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                            RMobilePhone::TMobilePhoneNetworkIdentity& aMnc); 
+
+    /**
+     * This method initiates an automatic network registration.  
+     *
+     * @since TB9.2
+     * @return 	None
+     */
+    void AutomaticNetworkRegistration(); 
+
+    /**
+     * This method initiates a manual network registration.  
+     *
+     * @since TB9.2
+     * @param aMcc contains the country code part of ETel operator info. 
+     * @param aMnc contains the network code part of ETel operator info. 
+     * @return 	None
+     */
+    void ManualNetworkRegistration(const RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                   const RMobilePhone::TMobilePhoneNetworkIdentity& aMnc); 
+
+    /**
+     * This method initiates a manual network registration and access technology selection.  
+     *
+     * @since TB9.2
+     * @param aMcc contains the country code part of ETel operator info. 
+     * @param aMnc contains the network code part of ETel operator info. 
+     * @param aAccTech contains the access technology in ETel compatible format. 
+     * @return 	None
+     */
+    void ManualNetworkRegistration(	const RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                    const RMobilePhone::TMobilePhoneNetworkIdentity& aMnc, 
+                                    const TAccessTechnology aAccTech); 
+
+    /**
+     * This is a helper function used by RunL 
+     *
+     * @since TB9.2
+     * @return 	standard Symbian OS return code. 
+     */
+    TInt InspectModeAndProcessCommand(); 
+
+    /**
+     * This method contructs a response for the test command. 
+     *
+     * @since TB9.2
+     * @return 	None. Leaves with standar symbian OS error code on error.  
+     */
+    void ConstructNetworkListResponseL(); 
+
+    /**
+     * This method contructs a response for the read command. 
+     *
+     * @since TB9.2
+     * @return 	standard Symbian OS return code. 
+     */
+    TInt ConstructNetworkInfoResponse(); 
+
+    /**
+     * This helper method converts the ETel access technology into 
+     * 3GPP TS 27.007 V8.4.1 compatible format. 
+     *
+     * @since TB9.2
+     * @param aAccTech contains the access technology in ETel compatible format. 
+     * @return 	Standard Symbian OS return code. 
+     */
+    TInt SolveAccessTechnology(RMobilePhone::TMobilePhoneNetworkAccess &aAccessTech); 
+
+    /**
+     * This helper method finalises the response and sends it. 
+     *
+     * @since TB9.2
+     * @param aIsOK tells whether to create an OK or ERROR response. 
+     * @param aReply contains the response string to be sent before OK, if any. 
+     * @return 	None
+     */
+    void CreateReply(TBool aIsOK, const TDesC8 &aReply = KNullDesC8); 
+
+private:  // data
+
+    /**
+     * Callback to call when accessing plugin information
+     */
+    MCmdPluginObserver* iCallback;
+
+    /**
+     * Handler type for the three AT commands
+     */
+    TCmdHandlerType iCmdHandlerType;
+
+    /**
+     * Telephony server instance. 
+     */
+	RTelServer iServer;
+
+    /**
+     * Phone instance, used for network selection. 
+     */
+	RMobilePhone iPhone;
+
+	/**
+     * Telephony Custom API instance, used for setting 
+     * the access technology (only GSM and UDMA supported).  
+     */
+    RMmCustomAPI iCustomApi;
+
+    /**
+     * Current network info collected via the RMobilePhone is stored here.   
+     */
+    RMobilePhone::TMobilePhoneNetworkInfoV2 iNetworkInfo; 
+
+    /**
+     * The parameters extracted from the AT command are stored here. 
+     */
+	RPointerArray<HBufC8> iParamArray; 
+
+    /**
+     * Used for getting the static packet capabilities of the phone. 
+     * This is needed for supporting more detailed access technology. 
+     */
+	RPacketService iPacketService; 
+
+    /**
+     * The format of the operator parameter is stored here. 
+     * it is used both for interpreting the incoming operator and 
+     * responding with correctly formatted outgoing operator info. 
+     * this can be done because it is specified that the latest incoming 
+     * format info is also used for responses from that onwards. 
+     */
+	RMmCustomAPI::TOperatorNameType iFormat; 
+
+    /**
+     * The requested/current network registration mode is stored here. It is used 
+     * also when responding to the Read command. This can be done because the two 
+     * operations are completely independent. 
+     */
+	TNetworkRegistrationMode iRegistrationMode; 
+
+    /**
+     * The requested/current access tehcnology is stored here. It is used 
+     * also when responding to the Read and Test commands. This can be done 
+     * because the operations are completely independent. 
+     */
+	TAccessTechnology iAccTech; 
+
+    /**
+     * The incoming reply buffer is kept here. Not owned. 
+     */
+  RBuf8* iReply; 
+
+    /**
+     * The currently running operation is kept here. 
+     */
+  TCurrentOperation iCurrentOperation; 
+
+    /**
+     * The country code part of ETel compatible operator info. 
+     */
+    RMobilePhone::TMobilePhoneNetworkCountryCode iMcc;  
+
+    /**
+     * The network code part of ETel compatible operator info. 
+     */
+    RMobilePhone::TMobilePhoneNetworkIdentity iMnc; 
+
+    /**
+     * Used for retrieving a list of networks the phone detected. 
+     */
+    CRetrieveMobilePhoneDetectedNetworks *iRetrieveDetectedNetworks; 
+
+    /**
+     * Used for reading the list the CRetrieveMobilePhoneDetectedNetworks returned. 
+     */
+    CMobilePhoneNetworkListV2 *iDetectedNetworks; 
+}; 
+
+#endif  // C_LCLISTALLCMD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/cmdpluginobserver.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles the commands "AT+COPS=..." and "AT+COPS?"
+*
+*/
+
+
+#ifndef M_CMDPLUGINOBSERVER_H
+#define M_CMDPLUGINOBSERVER_H
+
+
+enum TCharacterTypes
+    {
+    ECharTypeCR,  // Carriage return
+    ECharTypeLF,  // Line feed
+    ECharTypeBS   // Backspace
+    };
+
+enum TModeTypes
+    {
+    EModeTypeQuiet,   // Quiet mode
+    EModeTypeVerbose  // Verbose mode
+    };
+
+
+/**
+ *  Class for accessing plugin information and common functionality
+ *
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( MCmdPluginObserver )
+    {
+
+public:
+
+    /**
+     * Creates an AT command reply based on the reply type and completes the
+     * request to ATEXT. Uses iReplyBuffer for reply storage.
+     *
+     * @since TB9.2
+     * @param aReplyType Type of reply
+     * @param aDstBuffer Destination buffer; used for the API requiring the
+     *                   AT command reply
+     * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
+     * @param aError Completion code. If not KErrNone then other arguments are
+     *               ignored and the request is completed to ATEXT with
+     *               EReplyTypeUndefined.
+     * @return None
+     */
+    virtual TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                         const TDesC8& aSrcBuffer=KNullDesC8,
+                                         TInt aError=KErrNone ) = 0;
+
+    /**
+     * Creates a buffer for "OK" or "ERROR" reply based on the line settings
+     *
+     * @since TB9.2
+     * @param aReplyBuffer Destination buffer for the created reply
+     * @param aOkReply ETrue if "OK" reply needed,
+     *                 EFalse if "ERROR" reply needed
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                                       TBool aOkReply ) = 0;
+
+    /**
+     * Returns the array of supported commands
+     *
+     * @since TB9.2
+     * @param aCmd Array of supported commands
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetSupportedCommands( RPointerArray<HBufC8>& aCmds ) = 0;
+
+    /**
+     * Returns plugin's character value settings (from CATExtPluginBase)
+     *
+     * @since TB9.2
+     * @param aCharType Character's type
+     * @param aChar Character's value matching aCharType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar ) = 0;
+
+    /**
+     * Returns plugin's mode value settings (from CATExtPluginBase)
+     *
+     * @since TB9.2
+     * @param aModeType Mode type
+     * @param aMode Mode value matching aModeType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    virtual TInt GetModeValue( TModeTypes aModeType, TBool& aMode ) = 0;
+
+    };
+
+
+#endif  // M_CMDPLUGINOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/debug.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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:  Logging definitions
+*
+*/
+
+
+#ifndef PRJ_LOGGING_H
+#define PRJ_LOGGING_H
+
+#include <e32base.h>
+#include "debugconfig.h"
+
+#ifdef PRJ_ENABLE_TRACE
+
+#ifdef PRJ_FILE_TRACE
+#include <flogger.h>
+#else
+#include <e32debug.h>
+#endif
+
+NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+    {
+public:
+    void Overflow(TDes16& /*aDes*/) {}
+    };
+
+NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+    {
+public:
+    void Overflow(TDes8& /*aDes*/) {}
+    };
+
+inline void Trace(TRefByValue<const TDesC16> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list,aFmt);
+#ifdef PRJ_FILE_TRACE
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+#else
+    TBuf16<KMaxLogLineLength> theFinalString;
+    theFinalString.Append(KTracePrefix16);
+    TOverflowTruncate16 overflow;
+    theFinalString.AppendFormatList(aFmt,list,&overflow);
+    RDebug::Print(theFinalString);
+#endif
+    }
+
+inline void Trace(TRefByValue<const TDesC8> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START(list, aFmt);
+#ifdef PRJ_FILE_TRACE
+    RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+#else
+    TOverflowTruncate8 overflow;
+    TBuf8<KMaxLogLineLength> buf8;
+    buf8.Append(KTracePrefix8);
+    buf8.AppendFormatList(aFmt, list, &overflow);
+    TBuf16<KMaxLogLineLength> buf16(buf8.Length());
+    buf16.Copy(buf8);
+    TRefByValue<const TDesC> tmpFmt(_L("%S"));
+    RDebug::Print(tmpFmt, &buf16);
+#endif
+    }
+
+inline void TracePanic(
+    char* aFile,
+    TInt aLine,
+    TInt aPanicCode,
+    const TDesC& aPanicCategory)
+    {
+    TPtrC8 fullFileName((const TUint8*)aFile);
+    TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+    TBuf8<KMaxLogLineLength> buf;
+    buf.Append(KPanicPrefix8);
+    buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName);
+    Trace(buf);
+    User::Panic(aPanicCategory, aPanicCode);
+    }
+
+inline void TraceLeave(char* aFile, TInt aLine, TInt aReason)
+    {
+    TPtrC8 fullFileName((const TUint8*)aFile);
+    TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
+    TBuf8<KMaxLogLineLength> buf;
+    buf.Append(KLeavePrefix8);
+    buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName);
+    Trace(buf);
+    User::Leave(aReason);
+    }
+
+#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
+
+#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
+
+#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
+
+#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
+
+#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
+
+#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
+
+#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
+
+#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
+
+#define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeave(__FILE__, __LINE__, PTR);}
+
+#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
+
+#define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
+
+#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
+
+#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
+
+#define TRACE_STATIC_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
+
+#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
+
+#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
+
+#else // PRJ_ENABLE_TRACE not defined
+
+#define TRACE_INFO(p)
+
+#define TRACE_ERROR(p)
+
+#define TRACE_STATE(p)
+
+#define TRACE_WARNING(p)
+
+#define TRACE_INFO_SEG(p)
+
+#define TRACE_ASSERT(GUARD, CODE)
+
+#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
+
+#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
+
+#define LEAVE_IF_NULL(PTR) {static_cast<void>(User::LeaveIfNull(PTR));}
+
+#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
+
+#define TRACE_STATIC_FUNC_ENTRY
+
+#define TRACE_FUNC_ENTRY
+
+#define TRACE_FUNC_EXIT
+
+#define TRACE_STATIC_FUNC
+
+#define TRACE_FUNC
+
+#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
+#endif // PRJ_ENABLE_TRACE
+
+#endif // PRJ_LOGGING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/debugconfig.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  Logging configure file
+*
+*/
+
+
+#ifndef MODEMATPLUGIN_DEBUGCONFIG_H
+#define MODEMATPLUGIN_DEBUGCONFIG_H
+
+#include "prjconfig.h"
+
+/**
+ * Custom logging variations.
+ */
+#ifdef PRJ_FILE_TRACE
+_LIT(KLogFile,"modematplugin.txt");
+_LIT(KLogDir,"MODEMATPLUGIN");
+#endif
+
+#ifdef PRJ_ENABLE_TRACE
+_LIT(KTracePrefix16, "[MODEMATPLUGIN] ");
+_LIT8(KTracePrefix8, "[MODEMATPLUGIN] ");
+_LIT8(KFuncFormat8, "><%S");
+_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
+_LIT8(KFuncEntryFormat8, ">%S");
+_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
+_LIT8(KFuncExitFormat8, "<%S");
+
+_LIT(KPanicCategory, "modematplugin");
+_LIT8(KPanicPrefix8, "PANIC code ");
+_LIT8(KLeavePrefix8, "LEAVE code ");
+#endif
+
+const TInt KMaxLogLineLength = 512;
+
+#define KPRINTERROR        0x00000001 // Tracing level: error
+#define KPRINTINFO        0x00000002 // Tracing level: function trace
+#define KPRINTSTATE        0x00000004 // Tracing level: state machine info
+#define KPRINTWARNING   0x00000008 // Tracing level: warning
+
+const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING;
+
+#endif // MODEMATPLUGIN_DEBUGCONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/modematplugin.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,356 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main handler for incoming requests
+*
+*/
+
+
+#ifndef C_MODEMATPLUGIN_H
+#define C_MODEMATPLUGIN_H
+
+#include <atextpluginbase.h>
+#include "cmdpluginobserver.h" 
+
+
+/**
+ *  Class for common AT command handler interface
+ *
+ *  @since S60 TB9.2 
+ */
+NONSHARABLE_CLASS( CATCommandHandlerBase )
+    {
+
+public:
+
+    virtual ~CATCommandHandlerBase() {};
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    virtual TBool IsCommandSupported( const TDesC8& aCmd ) = 0;
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since S60 TB9.2
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    virtual void HandleCommand( const TDesC8& aCmd,
+                                RBuf8& aReply,
+                                TBool aReplyNeeded ) = 0;
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since S60 TB9.2
+     * @return None
+     */
+    virtual void HandleCommandCancel() = 0;
+
+    };
+
+
+/**
+ *  Class for selecting handlers for different AT commands
+ *
+ *  @since TB9.2 
+ */
+NONSHARABLE_CLASS( CModemAtPlugin ) : public CATExtPluginBase, public MCmdPluginObserver 
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @return Instance of self
+     */
+    static CModemAtPlugin* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CModemAtPlugin();
+
+private:
+
+    CModemAtPlugin();
+
+    void ConstructL();
+
+    /**
+     * Reports connection identifier name to the extension plugin.
+     *
+     * @since TB9.2 
+     * @param aName Connection identifier name
+     * @return None
+     */
+    void ReportConnectionName( const TDesC8& aName );
+
+    /**
+     * Reports the support status of an AT command. This is a synchronous API.
+     *
+     * @param aCmd The AT command. Its format may vary depending on the
+     *             specification. E.g. in BT HFP case, the command may contain
+     *             a character carriage return (<cr>) in the end.
+     * @return ETrue if the command is supported; EFalse otherwise.
+     */
+    TBool IsCommandSupported( const TDesC8& aCmd );
+
+    /**
+     * Handles an AT command. Cancelling of the pending request is done by
+     * HandleCommandCancel(). The implementation in the extension plugin should
+     * be asynchronous.
+     *
+     * The extension plugin which accepts this command is responsible to supply
+     * the result codes and response and to format result codes properly, e.g.
+     * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
+     *
+     * After an extension plugin has handled or decided to reject the given AT
+     * command, it must inform ATEXT by HandleCommandCompleted() with a proper
+     * error code.
+     *
+     * @since TB9.2 
+     * @param aCmd The AT command to be handled. Its format may vary depending
+     *             on the specification. E.g. in BT HFP case, the command may
+     *             contain a character carriage return (<cr>) in the end.
+     * @param aReply When passed in, contains the built in answer filled by
+     *               ATEXT if it is not empty; when command handling completes
+     *               successfully, contains the result codes and responses to
+     *               this command; Its ownership always belongs to ATEXT, plugin
+     *               may reallocate its space when needed.
+     * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
+     *                     the aReply must not contain the reply, otherwise it
+     *                     must contain verbose or numeric reply (ATV0/1) or an
+     *                     empty string reply (with ATQ).
+     * @return None
+     */
+    void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
+
+    /**
+     * Cancels a pending HandleCommand request.
+     *
+     * @since TB9.2 
+     * @return None
+     */
+    void HandleCommandCancel();
+
+    /**
+     * Next reply part's length.
+     * The value must be equal or less than KDefaultCmdBufLength.
+     * When the reply from this method is zero, ATEXT stops calling
+     * GetNextPartOfReply().
+     *
+     * @since TB9.2 
+     * @return Next reply part's length if zero or positive
+     */
+    TInt NextReplyPartLength();
+
+    /**
+     * Gets the next part of reply initially set by HandleCommandComplete().
+     * Length of aNextReply must be equal or less than KDefaultCmdBufLength.
+     *
+     * @since TB9.2 
+     * @param aNextReply Next reply
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetNextPartOfReply( RBuf8& aNextReply );
+
+    /**
+     * Receives unsolicited results. Cancelling of the pending request is done
+     * by ReceiveUnsolicitedResultCancel(). The implementation in the extension
+     * plugin should be asynchronous.
+     *
+     * @since TB9.2 
+     * @return None
+     */
+    void ReceiveUnsolicitedResult();
+
+    /**
+     * Cancels a pending ReceiveUnsolicitedResult request.
+     *
+     * @since TB9.2 
+     * @return None
+     */
+    void ReceiveUnsolicitedResultCancel();
+
+    /**
+     * Reports NVRAM status change to the plugins.
+     *
+     * @since TB9.2 
+     * @param aNvram New NVRAM status. Each call of this function is a result
+     *               of DUN extracting the form notified by
+     *               CATExtCommonBase::SendNvramStatusChange(). Each of the
+     *               settings from SendNvramStatusChange() is separated to
+     *               one call of ReportNvramStatusChange().
+     * @return None
+     */
+    void ReportNvramStatusChange( const TDesC8& aNvram );
+
+    /**
+     * Reports about external handle command error condition.
+     * This is for cases when for example DUN decided the reply contained an
+     * error condition but the plugin is still handling the command internally.
+     * Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
+     * "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
+     * different reply types the condition is "ERROR" and DUN ends processing.
+     * This solution keeps the pointer to the last AT command handling plugin
+     * inside ATEXT and calls this function there to report the error.
+     * It is to be noted that HandleCommandCancel() is not sufficient to stop
+     * the processing as the command handling has already finished.
+     *
+     * @since TB9.2 
+     * @return None
+     */
+    void ReportExternalHandleCommandError();
+
+    /**
+     * Creates part of reply from the global reply buffer to the destination
+     * buffer. Used with APIs which need the next part of reply in multipart
+     * reply requests.
+     *
+     * @since TB9.2 
+     * @param aDstBuffer Destination buffer; the next part of reply is stored to
+     *                   this buffer.
+     * @return None
+     */
+    TInt CreatePartOfReply( RBuf8& aDstBuffer );
+
+// from base class MCmdPluginObserver
+
+    /**
+     * From MCmdPluginObserver.
+     * Creates an AT command reply based on the reply type and completes the
+     * request to ATEXT. Uses iReplyBuffer for reply storage.
+     *
+     * @since TB9.2 
+     * @param aReplyType Type of reply
+     * @param aDstBuffer Destination buffer; used for the API requiring the
+     *                   AT command reply
+     * @param aSrcBuffer Source buffer; used only if aReplyType is EReplyTypeOther
+     * @param aError Completion code. If not KErrNone then other arguments are
+     *               ignored and the request is completed to ATEXT with
+     *               EReplyTypeUndefined.
+     * @return None
+     */
+    TInt CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                 const TDesC8& aSrcBuffer=KNullDesC8,
+                                 TInt aError=KErrNone );
+
+    /**
+     * From MCmdPluginObserver.
+     * Creates a buffer for "OK" or "ERROR" reply based on the line settings
+     *
+     * @since TB9.2 
+     * @param aReplyBuffer Destination buffer for the created reply
+     * @param aOkReply ETrue if "OK" reply needed,
+     *                 EFalse if "ERROR" reply needed
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                               TBool aOkReply );
+
+    /**
+     * From MCmdPluginObserver.
+     * Returns the array of supported commands
+     *
+     * @since TB9.2 
+     * @param aCmd Array of supported commands
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetSupportedCommands( RPointerArray<HBufC8>& aCmds );
+
+    /**
+     * From MCmdPluginObserver.
+     * Returns plugin's character value settings (from CATExtPluginBase)
+     *
+     * @since TB9.2 
+     * @param aCharType Character's type
+     * @param aChar Character's value matching aCharType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetCharacterValue( TCharacterTypes aCharType, TChar& aChar );
+
+    /**
+     * From MCmdPluginObserver.
+     * Returns plugin's mode value settings (from CATExtPluginBase)
+     *
+     * @since TB9.2 
+     * @param aModeType Mode type
+     * @param aMode Mode value matching aModeType
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TInt GetModeValue( TModeTypes aModeType, TBool& aMode );
+
+private:  // data
+
+    /**
+     * AT commands handler array. Used for mapping HandleCommand() to
+     * IsCommandSupported() and to limit the number of string comparisons.
+     */
+    RPointerArray<CATCommandHandlerBase> iHandlers;
+
+    /**
+     * Current AT command handler in iHandlers.
+     * Used when IsCommandSupported() detects a matching handler class.
+     */
+    CATCommandHandlerBase* iHandler;
+
+    /**
+     * Buffer for handle command's command
+     * Not own.
+     */
+    const TDesC8* iHcCmd;
+
+    /**
+     * Buffer for handle command reply
+     * Not own.
+     */
+    RBuf8* iHcReply;
+
+
+    /**
+     * Global reply buffer for the AT command replies
+     */
+    RBuf8 iReplyBuffer;
+
+    };
+
+#endif  // C_MODEMPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/inc/prjconfig.h	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project configure file
+*
+*/
+
+
+#ifndef MODEMATPLUGIN_PRJCONFIG_H
+#define MODEMATPLUGIN_PRJCONFIG_H
+
+/**
+ * Traces are enabled in _DEBUG build, by default.
+ */
+#ifdef _DEBUG
+#define PRJ_ENABLE_TRACE
+#endif
+
+/**
+ * traces to file if this is defined.
+ */
+//#define PRJ_FILE_TRACE
+
+
+/**
+ * build the project for module test purpose if this is defined
+ */
+//#define PRJ_MODULETEST_BUILD
+
+/**
+ * build the project using stubs to replace the dependencies if this is defined
+ */
+//#define PRJ_USE_STUB
+
+
+#endif // MODEMATPLUGIN_PRJCONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/rom/modematplugin.iby	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project modematplugin
+*
+*/
+
+
+#ifndef __MODEMATPLUGIN_IBY__
+#define __MODEMATPLUGIN_IBY__
+
+ECOM_PLUGIN( modematplugin.dll, modematplugin.rsc )
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/src/20029fbf.rss	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project modematplugin 
+*
+*/
+
+
+#include <registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x20029FBF;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001CBEE;  // ATEXT_INTERFACE_DUN_UID
+            implementations =
+                {
+                // Info for modematplugin
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2002B3EB; 
+                    version_no = 1;
+                    display_name = "Modem AT Plugin";
+                    default_data=  "MAT+COPS";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/src/atcopscmd.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,1120 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles the commands "AT+COPS?", "AT+COPS=?" and "AT+COPS=..."
+*
+*/
+
+
+#include <mmtsy_names.h>
+#include "atcopscmd.h"
+#include "cmdpluginobserver.h"
+#include "debug.h"
+
+_LIT8( KCOPSTestCmd, "AT+COPS=?");
+_LIT8( KCOPSReadCmd, "AT+COPS?");
+_LIT8( KCOPSSetCmd,  "AT+COPS=");
+
+_LIT8(KSupportedModesStr, ",(0,1,3,4)");
+_LIT8(KSupportedFormatsStr, ",(0,1,2)"); 
+
+// The parameters are in predefined indexes in an incoming AT command. 
+const TInt KModeParameterIndex     			= 0;  
+const TInt KFormatParameterIndex   			= 1;  
+const TInt KOperatorParameterIndex 			= 2;  
+const TInt KAccessTechnologyParameterIndex  = 3;  
+
+const TInt KMinimumParameterCountWhenModePresent       = 1;  
+const TInt KMinimumParameterCountWhenFormatPresent     = 2;  
+const TInt KMinimumParameterCountWhenOperatorPresent   = 3;  
+const TInt KMinimumParameterCountWhenAccTechPresent    = 4;  
+
+// These parameter lengths are derived from 3GPP TS 27.007 V8.4.1
+const TInt KShortOperatorNameFormatLength 			= 10; 
+const TInt KLongOperatorNameFormatLength 			= 20; 
+const TInt KNumericOperatorNameFormatLength 		= 5; 
+const TInt KMaxNetworkTestResponseAdditionalSize 	= 17; // The maximun length of parts of fixed length. 
+const TInt KMaxNetworkReadResponseAdditionalSize 	= 28 ; // The maximun length of parts fixed length.
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CATCOPSCmd* CATCOPSCmd::NewL( MCmdPluginObserver* aCallback )
+    {
+    CATCOPSCmd* self = new (ELeave) CATCOPSCmd( aCallback );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CATCOPSCmd::~CATCOPSCmd()
+    {
+    iParamArray.ResetAndDestroy(); 
+    iParamArray.Close(); 
+    iPacketService.Close(); 
+    iCustomApi.Close(); 
+    iPhone.Close(); 
+    iServer.Close();
+    delete iDetectedNetworks;
+    delete iRetrieveDetectedNetworks; 
+    }
+
+// ---------------------------------------------------------------------------
+// CATCOPSCmd::CATCOPSCmd
+// ---------------------------------------------------------------------------
+//
+CATCOPSCmd::CATCOPSCmd( MCmdPluginObserver* aCallback ) :
+    CActive(EPriorityStandard),
+    iCallback( aCallback ), 
+	iFormat(RMmCustomAPI::EOperatorNameMccMnc), 
+    iRegistrationMode(EModeAutomatic), 
+    iAccTech(EAccTechNotSet), 
+    iCurrentOperation(EIdle)
+    {
+    iCmdHandlerType = ECmdHandlerTypeUndefined;
+    }
+
+// ---------------------------------------------------------------------------
+// CATCOPSCmd::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::ConstructL()
+    {
+    if ( !iCallback )
+        {
+        User::Leave( KErrGeneral );
+        }
+    CActiveScheduler::Add(this);
+    LEAVE_IF_ERROR(iServer.Connect());
+    LEAVE_IF_ERROR(iServer.LoadPhoneModule(KMmTsyModuleName));
+    LEAVE_IF_ERROR(iPhone.Open(iServer, KMmTsyPhoneName));
+    LEAVE_IF_ERROR(iCustomApi.Open(iPhone));
+    LEAVE_IF_ERROR(iPacketService.Open(iPhone));
+    iRetrieveDetectedNetworks = CRetrieveMobilePhoneDetectedNetworks::NewL(iPhone); 
+    }
+
+// ---------------------------------------------------------------------------
+// Reports the support status of an AT command. This is a synchronous API.
+// ---------------------------------------------------------------------------
+//
+TBool CATCOPSCmd::IsCommandSupported( const TDesC8& aCmd )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retTemp = KErrNone;
+
+		// First test if "test" command, because the pattern is similar with the "set" command, 
+		// this is just one extra question mark longer than that. 
+    retTemp = aCmd.Compare( KCOPSTestCmd );
+    if ( retTemp == 0 )
+        {
+        iCmdHandlerType = ECmdHandlerTypeTest;
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+
+    retTemp = aCmd.Compare( KCOPSReadCmd );
+    if ( retTemp == 0 )
+        {
+        iCmdHandlerType = ECmdHandlerTypeRead;
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+
+	// Test if the beginning matches the test command pattern. We're skipping parameters 
+	// here on purpose, because "set" handler will create an error reply later if 
+	// parameters are not valid. 
+    retTemp = aCmd.Left(KCOPSSetCmd().Length()).Compare(KCOPSSetCmd);
+    if ( retTemp == 0 )
+        {
+        iCmdHandlerType = ECmdHandlerTypeSet;
+        TRACE_FUNC_EXIT
+        return ETrue;
+        }
+
+    iCmdHandlerType = ECmdHandlerTypeUndefined;
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an AT command. Cancelling of the pending request is done by
+// HandleCommandCancel(). The implementation in the extension plugin should
+// be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::HandleCommand( const TDesC8& aCmd,
+                                   RBuf8& aReply,
+                                   TBool aReplyNeeded )
+    {
+    TRACE_FUNC_ENTRY
+
+    if ( !aReplyNeeded )
+        {
+        TRACE_FUNC_EXIT
+        return;
+        }
+
+    if(iCurrentOperation != EIdle)  
+        {
+        // only one call at time allowed. If another one is passed in, 
+        // then cancel the previous and reply with an error.   
+        HandleCommandCancel(); 
+        CreateReply(EFalse); 
+        }
+    
+    if ( iCmdHandlerType == ECmdHandlerTypeUndefined )
+        {
+		CreateReply(EFalse); 
+		}
+
+    if ( iCmdHandlerType == ECmdHandlerTypeTest )
+        {
+        // Collect network data and complete in RunL 
+        iRetrieveDetectedNetworks->StartV2(iStatus); 
+        iCurrentOperation = EListAvailableNetworkOperators; 
+        SetActive(); 
+        TRACE_FUNC_EXIT
+        return;
+        }
+
+/*
+Read command returns the current mode, the currently selected operator 
+and the current Access Technology. If no operator is selected, <format>, 
+<oper> and < AcT>  are omitted.
+*/
+    if ( iCmdHandlerType == ECmdHandlerTypeRead )
+        {
+        // Collect data in two steps. First read operator name. Continue in RunL() 
+        RMobilePhone::TMobilePhoneNetworkSelectionV1 selection; 
+        RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg nwSelectionSetting(selection); 
+        iPhone.GetNetworkSelectionSetting(nwSelectionSetting);
+        switch(selection.iMethod)
+            {
+            case RMobilePhone::ENetworkSelectionAutomatic: 
+                iRegistrationMode = EModeAutomatic;
+                break; 
+            case RMobilePhone::ENetworkSelectionManual: 
+                iRegistrationMode = EModeManual;
+                break; 
+            default: 
+                // Cannot get a known selection mode! 
+                TRACE_INFO(_L("CATCOPSCmd::HandleCommand() -- Cannot get a known selection mode!"));
+                CreateReply(EFalse); 
+                TRACE_FUNC_EXIT
+                return; 
+            }
+        RMobilePhone::TMobilePhoneNetworkInfoV2Pckg nwInfo(iNetworkInfo); 
+        iPhone.GetCurrentNetwork(iStatus, nwInfo); 
+        iCurrentOperation = EGetNetworkInfoOperatorName; 
+		SetActive(); 
+        TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+        TRACE_FUNC_EXIT
+        return;
+        }
+
+    // Getting this far means ECmdHandlerTypeSet. There must be parameter(s), too.   
+    TRAPD(err, ExtractParametersL(aCmd)); 
+
+    // Check that we got some parameters, at least the "mode". If not, return an error: 
+	if(iParamArray.Count() < KMinimumParameterCountWhenModePresent) 
+        {
+        // Return error response, there were no parameters! 
+        TRACE_INFO(_L("CATCOPSCmd::HandleCommand() -- no parameters!"));
+        CreateReply(EFalse); 
+        TRACE_FUNC_EXIT
+        return; 
+        }
+
+	// At least the mode parameter is present at this point. Inspect it and check other parameters. 
+	TNetworkRegistrationMode mode; 
+	err = GetModeAndCheckParameterCount(iParamArray[KModeParameterIndex]->Des(), mode); 
+	if(err != KErrNone) 
+		{
+        // Return error response, invalid mode or other parameters! 
+		TRACE_INFO(_L("CATCOPSCmd::HandleCommand() -- invalid mode or other parameters!"));
+        CreateReply(EFalse); 
+	    TRACE_FUNC_EXIT
+        return; 
+		}
+
+    // At this point the iRegistrationMode is stored and the parameters are valid. 
+	iRegistrationMode = mode; 
+	TRACE_INFO(( _L("CATCOPSCmd::HandleCommand() mode stored (%d)"), iRegistrationMode));
+		
+	if(iParamArray.Count() > 1) 
+		{
+		// If also format is present, extract it and store for later reference. 
+        RMmCustomAPI::TOperatorNameType format;
+        err = GetFormatFromParameter(iParamArray[KFormatParameterIndex]->Des(), format); 
+		if(err != KErrNone) 
+		    {
+		    // Return an error, invalid format. 
+			// Previously set format is still in use. 
+	 		TRACE_INFO(_L("CATCOPSCmd::HandleCommand() -- invalid format!"));
+            CreateReply(EFalse); 
+	 		TRACE_FUNC_EXIT
+			return; 
+			}
+		// Format parameter is OK, keep it.
+		iFormat = format;  
+		TRACE_INFO(( _L("CATCOPSCmd::HandleCommand() format stored (%d)"), iFormat));
+		}
+
+	// We're done with the required parameters, it's time to start processing the command. 
+	// So do a self complete and continue in RunL(): 
+	iReply = &aReply;  // Store the reply for later reference in RunL. 
+	iCurrentOperation = EInspectModeAndProcessCommand; 
+	TRequestStatus *status = &iStatus;  
+	User::RequestComplete(status, KErrNone); 
+	SetActive(); 
+	TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Parses the aCmd parameter and stores results in iParamArray.
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::ExtractParametersL(const TDesC8& aCmd) 
+	{
+    TRACE_FUNC_ENTRY
+
+    TRACE_INFO(( _L8("CATCOPSCmd::ExtractParameters() extracting (%S)"), &aCmd));
+
+    TPtrC8 parameters = aCmd.Right(aCmd.Length() - KCOPSSetCmd().Length()); 
+
+    iParamArray.ResetAndDestroy(); 
+
+    // Parse the parameters into the parameter array: 
+    TInt separatorPos;  
+    while((separatorPos = parameters.Locate(',')) != KErrNotFound)
+        {
+        TRACE_INFO(( _L("CATCOPSCmd::ExtractParameters() separator position (%d)"), separatorPos));
+        TPtrC8 param = parameters.Left(separatorPos);
+        parameters.Set(parameters.Right(parameters.Length() - (separatorPos + 1))); // Remove the extracted part + separator 
+        HBufC8 *heapParam = param.AllocL();    
+        CleanupStack::PushL( heapParam );
+        // Strip the quotation marks from the parameter: 
+        TPtr8 ptr = heapParam->Des(); 
+        RemoveQuotationMarks(ptr); 
+        TRACE_INFO(( _L8("CATCOPSCmd::ExtractParameters() appending (%S)"), &ptr));
+        iParamArray.Append(heapParam); 
+        CleanupStack::Pop( heapParam );
+        }
+
+    // Finally append the last piece of parameters: 
+    HBufC8 *param = parameters.AllocL(); 
+    CleanupStack::PushL( param );
+    TPtr8 ptr = param->Des(); 
+    RemoveQuotationMarks(ptr); 
+    TRACE_INFO(( _L8("CATCOPSCmd::ExtractParameters() appending (%S)"), &ptr));
+    iParamArray.Append(param); 
+    CleanupStack::Pop( param );
+
+    TRACE_FUNC_EXIT
+	}
+
+// ---------------------------------------------------------------------------
+// Strips all quotation parms from the string passed in. 
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::RemoveQuotationMarks(TPtr8& aParameter) 
+    {
+    TRACE_FUNC_ENTRY
+    // Strip the quotation marks from the parameter: 
+    TInt quotePos;  
+    while((quotePos = aParameter.Locate('"')) != KErrNotFound)
+    {
+        aParameter.Delete(quotePos,1); 
+    }
+    TRACE_FUNC_EXIT
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns the selected mode in aMode and checks the parameter count. 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::GetModeAndCheckParameterCount(const TDesC8& aParameter, TNetworkRegistrationMode &aMode) 
+	{
+  TRACE_FUNC_ENTRY
+	TLex8 lex;
+	lex.Assign(aParameter);
+	TInt mode(0); 
+
+	TInt err = lex.Val(mode); 
+	TRACE_INFO(( _L("CATCOPSCmd::GetModeAndCheckParameterCount() mode (%d)"), mode));
+
+	if( err != KErrNone )
+		{
+        TRACE_INFO(_L("CATCOPSCmd::GetModeAndCheckParameterCount() TLex error!)"));
+        TRACE_FUNC_EXIT
+        return KErrArgument; 
+		}			
+
+  if(mode < EModeAutomatic || mode > EModeManualAutomatic || mode == EModeDeregister)
+      {
+      // Not a valid mode. 
+      TRACE_FUNC_EXIT
+      return KErrArgument; 
+      }
+
+  if( (mode == EModeManual || mode == EModeManualAutomatic)  &&  iParamArray.Count() < KMinimumParameterCountWhenOperatorPresent )
+      {
+      // Valid modes but not enough parameters. At least format and operator needed.  
+      TRACE_INFO(( _L("CATCOPSCmd::GetModeAndCheckParameterCount() not enough parameters (%d)"), iParamArray.Count()));
+      TRACE_FUNC_EXIT
+      return KErrArgument; 
+      }
+  if( mode == EModeSetFormatParameter && iParamArray.Count() < KMinimumParameterCountWhenFormatPresent )
+      {
+      // Valid mode, but not enough parameters. Format is needed.  
+      TRACE_INFO(_L("CATCOPSCmd::GetModeAndCheckParameterCount() no format parameter)"));
+      TRACE_FUNC_EXIT
+      return KErrArgument; 
+      }
+
+  // Valid mode and enough parameters. 
+  aMode = static_cast<TNetworkRegistrationMode>(mode);
+
+	TRACE_FUNC_EXIT
+	return KErrNone; 
+	}
+
+// ---------------------------------------------------------------------------
+// Converts an AT command parameter to numeric format value and checks it is valid. 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::GetFormatFromParameter(const TDesC8& aParameter, RMmCustomAPI::TOperatorNameType &aFormat) 
+	{
+    TRACE_FUNC_ENTRY
+    TLex8 lex;
+    lex.Assign(aParameter);
+    TInt format(0); 
+    TInt err = lex.Val(format); 
+
+    if(err != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument; 
+        }
+    switch(format)
+        {
+        case EFormatLong: // long by 3GPP TS 27.007 V8.4.1  
+            TRACE_INFO(_L("Format is long by 3GPP TS 27.007 V8.4.1"));
+            aFormat = RMmCustomAPI::EOperatorNameNitzFull; 
+            break; 
+        case EFormatShort: // short by 3GPP TS 27.007 V8.4.1 
+            TRACE_INFO(_L("Format is short by 3GPP TS 27.007 V8.4.1"));
+            aFormat = RMmCustomAPI::EOperatorNameNitzShort; 
+            break; 
+        case EFormatNumeric: // numeric by 3GPP TS 27.007 V8.4.1 
+            TRACE_INFO(_L("Format is numeric by 3GPP TS 27.007 V8.4.1"));
+            aFormat = RMmCustomAPI::EOperatorNameMccMnc; 
+            // Operator is numeric, conver it into S60 style. 
+            break; 
+        default: 
+            TRACE_FUNC_EXIT
+            return KErrArgument;
+        }
+
+    TRACE_FUNC_EXIT
+    return KErrNone; 
+    }
+
+// ---------------------------------------------------------------------------
+// Converts an AT command parameter to numeric access technology value and checks it is valid. 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::GetAccTechFromParameter(const TDesC8& aParameter, TAccessTechnology& aAccTech) 
+    {
+    TRACE_FUNC_ENTRY
+    TLex8 lex;
+    lex.Assign(aParameter);
+    TInt accTech(0); 
+    TInt err = lex.Val(accTech); 
+
+    if(err != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument; 
+        }
+
+    if(accTech != EGSM && accTech != EUDMA) // The only allowed access technologies. 
+        {
+        TRACE_FUNC_EXIT
+        return KErrArgument; 
+        }
+ 
+    aAccTech = static_cast<TAccessTechnology>(accTech);
+
+    TRACE_FUNC_EXIT
+    return KErrNone; 
+    }
+
+// ---------------------------------------------------------------------------
+// Converts an AT command parameter to ETel compatible operator values 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::ConvertOperatorToMccMnc(const CMobilePhoneNetworkListV2 *aDetectedNetworks, 
+                                        const RMmCustomAPI::TOperatorNameType aFormat, 
+                                        const TBuf<KMaxOperatorNameLength>& aOperatorParameter, 
+                                        RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                        RMobilePhone::TMobilePhoneNetworkIdentity& aMnc) 
+    {
+    TRACE_FUNC_ENTRY
+
+    if(aFormat == RMmCustomAPI::EOperatorNameMccMnc) 
+        {
+        // Check first that there are at least five characters passed in. 
+       	TChar nextChar; 
+        if(aOperatorParameter.Length() < 5)
+        	{
+			return KErrArgument; 
+        	}
+        for(int i = 0; i < 5; ++i)
+        	{
+            nextChar = aOperatorParameter[i]; 
+            if(!nextChar.IsDigit()) 
+                {
+                return KErrArgument; 
+                }
+      		}
+        // Operator is in three digit country code + two digit network code format.  
+	    // Must be converted to ETel style. The possible extra will be simply discarded. 
+     	TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() operator is all digits, convert it into ETel data types."));
+	    aMcc.Copy(aOperatorParameter.Left(3)); 
+	    aMnc.Copy(aOperatorParameter.Right(2)); 
+	    }
+    else  // The short or long text string formats. 
+        {
+        // Find the requested operator from the operator array.  
+        // If array is empty, return an error. 
+        if(!aDetectedNetworks)
+            {
+            TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() No detected networks!"));
+            TRACE_FUNC_EXIT
+            return KErrNotFound; 
+            }
+
+        RMobilePhone::TMobilePhoneNetworkInfoV2 nwInfo; 
+        for(TInt i=0; i < iDetectedNetworks->Enumerate(); ++i)
+            {
+            TRAPD(err, nwInfo = iDetectedNetworks->GetEntryL(i))  
+            if(err != KErrNone)
+                {
+                return KErrNotFound; 
+                }
+
+            if(aFormat == RMmCustomAPI::EOperatorNameNitzShort)
+                {
+                TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() Operator is in short format, comparing."));
+                if(nwInfo.iShortName.Compare(aOperatorParameter) == 0)
+                    {
+                    TRACE_INFO(_L("Match found."));
+                    aMcc = nwInfo.iCountryCode; 
+                    aMnc = nwInfo.iNetworkId; 
+                    TRACE_FUNC_EXIT
+                    return KErrNone; 
+                    } 
+                }
+            else if(aFormat == RMmCustomAPI::EOperatorNameNitzFull)
+                {
+                TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() Operator is in long format, comparing."));
+                if(nwInfo.iLongName.Compare(aOperatorParameter) == 0)
+                    {
+                    TRACE_INFO(_L("Match found."));
+                    aMcc = nwInfo.iCountryCode; 
+                    aMnc = nwInfo.iNetworkId; 
+                    TRACE_FUNC_EXIT
+                    return KErrNone; 
+                    } 
+                }
+            else        
+                {
+                TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() Unknown operator format!"));
+                TRACE_FUNC_EXIT
+                return KErrArgument; 
+                }
+            }
+        TRACE_INFO(_L("CATCOPSCmd::ConvertOperatorToMccMnc() Operator was not found in list!"));
+        TRACE_FUNC_EXIT
+        return KErrNotFound; 
+        }
+
+    TRACE_FUNC_EXIT
+    return KErrNone; 
+    }
+
+
+// ---------------------------------------------------------------------------
+// Initiates an automatic network registration.  
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::AutomaticNetworkRegistration() 
+    {
+    TRACE_FUNC_ENTRY
+    RMobilePhone::TMobilePhoneNetworkManualSelection nwInfo; 
+	iCurrentOperation = EAutomaticallyRegisterToNetwork; 
+	nwInfo.iCountry = KNullDesC;
+	nwInfo.iNetwork = KNullDesC;
+	iPhone.SelectNetwork(iStatus, EFalse, nwInfo); 
+	SetActive();  // Response will be sent in RunL 
+	TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+	TRACE_FUNC_EXIT
+	}
+
+// ---------------------------------------------------------------------------
+// Initiates a manual network registration.  
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::ManualNetworkRegistration(const RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                           const RMobilePhone::TMobilePhoneNetworkIdentity& aMnc) 
+    {
+	TRACE_FUNC_ENTRY
+	RMobilePhone::TMobilePhoneNetworkManualSelection nwInfo; 
+	iCurrentOperation = EManuallyRegisterToNetwork; 
+	nwInfo.iCountry.Append(aMcc);
+	nwInfo.iNetwork.Append(aMnc);
+	iPhone.SelectNetwork(iStatus, ETrue, nwInfo); 
+	SetActive(); 	// Response will be sent in RunL 
+	TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Initiates a manual network registration and access technology selection.  
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::ManualNetworkRegistration(const RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc, 
+                                           const RMobilePhone::TMobilePhoneNetworkIdentity& aMnc, 
+                                           const TAccessTechnology aAccTech) 
+    {
+    TRACE_FUNC_ENTRY
+	// Store access technology for later reference: 
+    iAccTech = aAccTech; 
+	// Call another overload to start the first phase of the operation: 
+	ManualNetworkRegistration(aMcc, aMnc); 
+	// Set the state again so the RunL knows to launch the next phase: 
+	iCurrentOperation = EManuallyRegisterToNetworkAndChooseAccTech; 
+  	TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// CATCOPSCmd::RunL 
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::RunL()
+    {
+    TRACE_FUNC_ENTRY
+	TInt err = KErrNone; 
+	if(iStatus != KErrNone)   
+	    {
+        HandleError(); 
+	    TRACE_FUNC_EXIT
+        return; 
+	    }
+    // Proceed to next step or return a response if all is done.
+    switch(iCurrentOperation)
+        {
+        case EListAvailableNetworkOperators: 
+            TRACE_INFO((_L("CATCOPSCmd::HandleCommand() completing operation (%d)"), iCurrentOperation));
+            if(iDetectedNetworks)
+                {
+                delete iDetectedNetworks;
+                iDetectedNetworks = NULL; 
+                }
+            iDetectedNetworks = iRetrieveDetectedNetworks->RetrieveListV2L(); 
+            // Then create a response. 
+            TRAP(err, ConstructNetworkListResponseL()); 
+            if(err != KErrNone)
+                {
+                // An error here means that no response has been sent. Reply with an error. 
+                CreateReply(EFalse); 
+                }
+            break; 
+        
+        case EInspectModeAndProcessCommand: 
+            // Check the mode and act accordingly 
+            TRACE_INFO((_L("CATCOPSCmd::HandleCommand() completing operation (%d)"), iCurrentOperation));
+            err = InspectModeAndProcessCommand(); 
+            if(err != KErrNone)
+                {
+                CreateReply(EFalse); 
+                }
+            break; 
+
+        case EGetNetworkInfoOperatorName: 
+            if(ConstructNetworkInfoResponse() != KErrNone)
+                {
+                // An error means that no response has been sent. Reply with an error. 
+                CreateReply(EFalse); 
+                }
+            break; 
+
+        case EManuallyRegisterToNetworkAndChooseAccTech: 
+            TRACE_INFO((_L("CATCOPSCmd::HandleCommand() completing operation (%d)"), iCurrentOperation));
+            switch(iAccTech)
+                {
+                case EGSM: 
+                    iCustomApi.SetSystemNetworkMode(iStatus, RMmCustomAPI::KCapsNetworkModeGsm);
+                    iCurrentOperation = ESetSystemNetworkBand; 
+                    SetActive(); 
+                    break; 
+                case EUDMA: 
+                    iCustomApi.SetSystemNetworkMode(iStatus, RMmCustomAPI::KCapsNetworkModeUmts);
+                    iCurrentOperation = ESetSystemNetworkBand; 
+                    SetActive(); 
+                    break; 
+                default:
+                    // No automatic registering requested, so send back an error response. 
+                    TRACE_INFO( _L("CATCOPSCmd::RunL() incorrect acc.tech., reply an error."));
+                    CreateReply(EFalse); 
+                }
+            TRACE_INFO((_L("CATCOPSCmd::HandleCommand() starting operation (%d)"), iCurrentOperation));
+            break; 
+
+        case EManuallyRegisterToNetwork: 
+        case EAutomaticallyRegisterToNetwork: 
+        case ESetSystemNetworkBand: 
+            TRACE_INFO((_L("CATCOPSCmd::HandleCommand() completing operation (%d)"), iCurrentOperation));
+            // Last step completed successfully, so create OK response. 
+            CreateReply(ETrue); 
+            break; 
+
+        default: 
+            TRACE_INFO(( _L("CATCOPSCmd::RunL() default operation (%d)!"), iCurrentOperation));
+            break; 
+        }
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an error in async call. 
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::HandleError()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_INFO(( _L("CATCOPSCmd::RunL() failure (%d) in operation (%d)!"), iStatus.Int(), iCurrentOperation));
+
+    // In case of failure check the operation. In some cases failures are OK.
+    switch(iCurrentOperation)
+        {
+        case EManuallyRegisterToNetwork: 
+            if(iRegistrationMode == EModeManualAutomatic)
+                {
+                // Manual registration failed, try automatic next. 
+                TRACE_INFO( _L("CATCOPSCmd::RunL() registration mode manual automatic, try automatic."));
+                AutomaticNetworkRegistration(); 
+                }
+            else 
+                {
+                // No automatic registering requested, so send back an error response. 
+                TRACE_INFO( _L("CATCOPSCmd::RunL() reply an error."));
+                CreateReply(EFalse); 
+                }
+            break; 
+        case ESetSystemNetworkBand: 
+        case EManuallyRegisterToNetworkAndChooseAccTech: 
+			if(iRegistrationMode == EModeManualAutomatic)
+                {
+                // Manual registration failed, try automatic next. 
+                TRACE_INFO( _L("CATCOPSCmd::RunL() registration mode manual automatic, try automatic."));
+                AutomaticNetworkRegistration(); 
+				break;
+                }
+            else 
+                {
+				// Cannot set the access technology, so set it back to EAccTechNotSet. 
+				// This prevents replying to queries with outdated or incorrect acc tech information. 
+				TRACE_INFO( _L("CATCOPSCmd::RunL() couldn't set system network band, so reset access tech."));
+				iAccTech = EAccTechNotSet; 
+				// Fall through to default, because these require an error response. 
+				}
+        default: 
+            // In all other cases send back an error response. 
+            TRACE_INFO( _L("CATCOPSCmd::RunL() reply an error."));
+            CreateReply(EFalse); 
+            break; 
+        }
+    TRACE_FUNC_EXIT
+    }
+
+
+// ---------------------------------------------------------------------------
+// Cancels a pending HandleCommand request.
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::HandleCommandCancel()
+    {
+    TRACE_FUNC_ENTRY
+    Cancel(); 
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// CATCOPSCmd::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::DoCancel()
+    {
+    TRACE_FUNC_ENTRY
+    switch(iCurrentOperation)
+        {
+        case EAutomaticallyRegisterToNetwork:
+        case EManuallyRegisterToNetwork:
+        case EManuallyRegisterToNetworkAndChooseAccTech:
+            iPhone.CancelAsyncRequest(EMobilePhoneSelectNetworkCancel);  
+            break; 
+        case EGetNetworkInfoOperatorName:
+            iPhone.CancelAsyncRequest(EMobilePhoneGetCurrentNetworkCancel);  
+            break; 
+        case ESetSystemNetworkBand:
+            iCustomApi.CancelAsyncRequest(ECustomSetSystemNetworkModeIPC); 
+            break; 
+        case EListAvailableNetworkOperators:
+            iRetrieveDetectedNetworks->Cancel();  
+            break; 
+        default: 
+            break; 
+        }
+
+    iCurrentOperation = EIdle; 
+
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Helper method for RunL() 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::InspectModeAndProcessCommand()
+    {
+    TRACE_FUNC_ENTRY
+    TBuf<KMaxOperatorNameLength> buf;
+    TInt err; 
+
+    switch (iRegistrationMode)
+        {
+        case EModeAutomatic: 
+            AutomaticNetworkRegistration(); 
+            break; 
+        case EModeManual: 
+        case EModeManualAutomatic: // see also RunL() 
+            if(iParamArray.Count() < KMinimumParameterCountWhenOperatorPresent)
+                {
+                TRACE_FUNC_EXIT
+                return KErrArgument; 
+                }
+            
+            // At least the operator is present, so convert it into S60 format. 
+            buf.Copy(iParamArray[KOperatorParameterIndex]->Des()); 
+            err = ConvertOperatorToMccMnc(iDetectedNetworks, iFormat, buf, iMcc, iMnc); 
+            if(err != KErrNone)
+                {
+                TRACE_INFO(_L("CATCOPSCmd::HandleCommand() -- operator conversion failed!"));
+                TRACE_FUNC_EXIT
+                return KErrArgument; 
+                }
+
+            if (iParamArray.Count() >= KMinimumParameterCountWhenAccTechPresent) 
+                {
+                // Also access tech. is present. Convert it to ETel compatible value.  
+                TAccessTechnology accTech; 
+                TInt err = GetAccTechFromParameter(iParamArray[KAccessTechnologyParameterIndex]->Des(), accTech); 
+                if(err != KErrNone)
+                    {
+                    // Parameter problem, return an error. 
+                    TRACE_FUNC_EXIT
+                    return KErrArgument; 
+                    }
+                // Register both operator and access technology manually.
+                ManualNetworkRegistration(iMcc, iMnc, accTech); 
+                }
+            else 
+                {
+                // No access technology parameter, so register just the operator. 
+                ManualNetworkRegistration(iMcc, iMnc); 
+                }
+            break; 
+        case EModeDeregister: // Deregister from network 
+            // Not supported, return an error. 
+			TRACE_FUNC_EXIT
+            return KErrArgument; 
+        case EModeSetFormatParameter: 
+            // Storing format parameter was done already, so just reply OK. 
+            CreateReply(ETrue); 
+			TRACE_FUNC_EXIT
+            return KErrNone; 
+        default: 
+            return KErrArgument; 
+        }
+    TRACE_FUNC_EXIT
+    return KErrNone; 
+    }
+
+// ---------------------------------------------------------------------------
+// Converts the ETel access technology into 3GPP TS 27.007 V8.4.1 compatible format. 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::SolveAccessTechnology(RMobilePhone::TMobilePhoneNetworkAccess &aAccessTech)
+    {
+    TRACE_FUNC_ENTRY
+
+    TUint caps;
+    if(iPacketService.GetStaticCaps(caps, RPacketContext::EPdpTypePPP) != KErrNone)
+        {
+        TRACE_FUNC_EXIT
+        return KErrGeneral;     
+        }
+
+    TRACE_INFO(( _L8("CATCOPSCmd::SolveAccessTechnology() static caps gotten (%b)"), caps));
+
+    switch(aAccessTech)
+        {
+        case RMobilePhone::ENetworkAccessGsm: 
+            if(caps & RPacketService::KCapsEGPRSSupported)
+                {
+                iAccTech = EGSMwithEGPRS; 
+                }
+            else 
+                {
+                iAccTech = EGSM; 
+                }
+            break; 
+        case RMobilePhone::ENetworkAccessGsmCompact: 
+            iAccTech = EGSMCompact; 
+            break; 
+        case RMobilePhone::ENetworkAccessUtran: 
+            if(caps & RPacketService::KCapsHSDPASupported) 
+                {
+                if(caps & RPacketService::KCapsHSUPASupported)
+                    {
+                    iAccTech = EUDMAwithHSDPAandHSUPA;  
+                    }
+                else 
+                    {
+                    iAccTech = EHSDPA;  
+                    }
+                }
+            else if(caps & RPacketService::KCapsHSUPASupported) 
+                {
+                iAccTech = EHSUPA;  
+                }
+            else 
+                {
+                iAccTech = EUDMA;  
+                }
+            break;
+        default: 
+            TRACE_INFO( _L("CATCOPSCmd::SolveAccessTechnology() unknown access tech!"));
+            iAccTech = EAccTechNotSet; 
+            return KErrArgument; 
+		}
+    TRACE_FUNC_EXIT
+    return KErrNone;  
+    }
+
+// ---------------------------------------------------------------------------
+// Contructs a response for the read command. 
+// ---------------------------------------------------------------------------
+//
+TInt CATCOPSCmd::ConstructNetworkInfoResponse()
+    {
+    TRACE_FUNC_ENTRY
+    RBuf8 reply;
+    TInt size(KMaxNetworkTestResponseAdditionalSize + KLongOperatorNameFormatLength);       
+    TChar carriageReturn;
+    TChar lineFeed;
+    TInt err;
+    err = reply.Create(size);
+	err |= iCallback->GetCharacterValue( ECharTypeCR, carriageReturn );
+	err |= iCallback->GetCharacterValue( ECharTypeLF, lineFeed );		
+	if(err != KErrNone) 
+		{
+		return err; 
+		}
+
+	// Some PC Software expects and extra CR+LF, hence those are added twice: 
+	reply.Append( carriageReturn ); 
+	reply.Append( lineFeed );
+    reply.Append( carriageReturn );
+    reply.Append( lineFeed );  
+    reply.Append(_L("+COPS: "));  
+    reply.AppendNum(iRegistrationMode);  
+    reply.Append(_L(","));  
+    switch(iFormat)
+        {
+        case RMmCustomAPI::EOperatorNameNitzFull:   
+            reply.AppendNum(EFormatLong);  
+            reply.Append(_L(",")); 
+            reply.Append(_L("\""));   
+            TRACE_INFO(( _L8("CATCOPSCmd::ConstructNetworkInfoResponse() appending (%S)"), 
+                    &iNetworkInfo.iLongName));
+            reply.Append(iNetworkInfo.iLongName);  
+            break; 
+        case RMmCustomAPI::EOperatorNameNitzShort:
+            reply.AppendNum(EFormatShort); 
+            reply.Append(_L(",")); 
+            reply.Append(_L("\"")); 
+            TRACE_INFO(( _L8("CATCOPSCmd::ConstructNetworkInfoResponse() appending (%S)"), 
+                    &iNetworkInfo.iShortName));
+            reply.Append(iNetworkInfo.iShortName); 
+            break; 
+        case RMmCustomAPI::EOperatorNameMccMnc: 
+            reply.AppendNum(EFormatNumeric); 
+            reply.Append(_L(",")); 
+            reply.Append(_L("\"")); 
+            TRACE_INFO(( _L8("CATCOPSCmd::ConstructNetworkInfoResponse() appending codes (%S) and (%S)"), 
+                            &iNetworkInfo.iCountryCode, &iNetworkInfo.iNetworkId));
+            reply.Append(iNetworkInfo.iCountryCode); 
+            reply.Append(iNetworkInfo.iNetworkId); 
+            break; 
+        }
+    reply.Append(_L("\"")); 
+
+    if(SolveAccessTechnology(iNetworkInfo.iAccess) == KErrNone && iAccTech != EAccTechNotSet) 
+        {
+        TRACE_INFO((_L("CATCOPSCmd::ConstructNetworkInfoResponse() appending acc. tech. (%d)"), 
+                            iAccTech));
+        reply.Append(_L(",")); 
+        reply.AppendNum(iAccTech); 
+        }
+
+    reply.Append( carriageReturn );
+    reply.Append( lineFeed );
+
+    CreateReply(ETrue, reply); 
+
+    TRACE_FUNC_EXIT
+    return KErrNone;  
+    }
+
+
+// ---------------------------------------------------------------------------
+// Contructs a response for the test command. 
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::ConstructNetworkListResponseL()
+    {
+    TRACE_FUNC_ENTRY
+    RBuf8 reply;
+    TChar carriageReturn;
+    TChar lineFeed;
+
+    TInt maxItemSize(KMaxNetworkReadResponseAdditionalSize  
+            + KShortOperatorNameFormatLength 
+            + KLongOperatorNameFormatLength 
+            + KNumericOperatorNameFormatLength
+            + KSupportedModesStr().Length()
+            + KSupportedFormatsStr().Length()); 
+
+    CleanupClosePushL(reply); 
+
+    User::LeaveIfNull(iDetectedNetworks); 
+    User::LeaveIfError(reply.Create( maxItemSize * iDetectedNetworks->Enumerate())); 
+    User::LeaveIfError(iCallback->GetCharacterValue( ECharTypeCR, carriageReturn ));
+    User::LeaveIfError(iCallback->GetCharacterValue( ECharTypeLF, lineFeed ));		
+
+    // Some PC Software expects and extra CR+LF, hence those are added twice: 
+    reply.Append( carriageReturn );
+    reply.Append( lineFeed );
+    reply.Append( carriageReturn );
+    reply.Append( lineFeed );
+    reply.Append( _L("+COPS: ") ); 
+
+    RMobilePhone::TMobilePhoneNetworkInfoV2 nwInfo; 
+    for(TInt i = 0; i < iDetectedNetworks->Enumerate(); ++i)
+        {
+		if(i > 0) // Add CR+LF after the first cycle. 
+			{
+            reply.Append( carriageReturn );
+            reply.Append( lineFeed );
+			}
+        nwInfo = iDetectedNetworks->GetEntryL(i);  
+
+        reply.Append(_L("(")); 
+        reply.AppendNum(nwInfo.iStatus); 
+        reply.Append(_L(",")); 
+		reply.Append(_L("\"")); 
+        reply.Append(nwInfo.iLongName); 
+		reply.Append(_L("\"")); 
+        reply.Append(_L(",")); 
+		reply.Append(_L("\"")); 
+        reply.Append(nwInfo.iShortName); 
+		reply.Append(_L("\"")); 
+        reply.Append(_L(",")); 
+		reply.Append(_L("\"")); 
+        reply.Append(nwInfo.iCountryCode); 
+        reply.Append(nwInfo.iNetworkId); 
+		reply.Append(_L("\"")); 
+        if(SolveAccessTechnology(nwInfo.iAccess) == KErrNone && iAccTech != EAccTechNotSet) 
+            {
+            TRACE_INFO((_L("CATCOPSCmd::ConstructNetworkListResponse() appending acc. tech. (%d)"), iAccTech));
+            reply.Append(_L(",")); 
+            reply.AppendNum(iAccTech); 
+            }
+        reply.Append(_L(")")); 
+        reply.Append(_L(",")); 
+		TRACE_INFO( _L("CATCOPSCmd::ConstructNetworkListResponse() -- entry added to reply."));
+        }
+    reply.Append(KSupportedModesStr); // Supported modes as defined in 3GPP TS 27.007 V8.4.1
+    reply.Append(KSupportedFormatsStr);  // Supported formats as defined in 3GPP TS 27.007 V8.4.1
+
+    reply.Append( carriageReturn );
+    reply.Append( lineFeed );
+
+		// Finally append the "OK". CreateOkOrErrorReply returns verbose or numeric version. 
+    RBuf8 okReply;
+    CleanupClosePushL(okReply); 
+    iCallback->CreateOkOrErrorReply( okReply, ETrue );
+    reply.Append( okReply);
+    CreateReply(ETrue, reply); 
+    CleanupStack::PopAndDestroy(&okReply);   
+    CleanupStack::PopAndDestroy(&reply);   
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Finalises the response and sends it. 
+// ---------------------------------------------------------------------------
+//
+void CATCOPSCmd::CreateReply(TBool aIsOK, const TDesC8 &aReply) 
+    {
+    if(aIsOK == EFalse)
+        {
+        iCallback->CreateReplyAndComplete( EReplyTypeError);
+        }
+    else 
+        {
+        if(aReply.Length() > 0)
+            {
+            iCallback->CreateReplyAndComplete( EReplyTypeOther,
+                                           aReply );
+            }
+        else 
+            {
+            iCallback->CreateReplyAndComplete( EReplyTypeOk);
+            }
+        }
+    iCurrentOperation = EIdle; 
+    TRACE_FUNC_EXIT
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/src/modematplugin.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,429 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main handler for incoming requests
+*
+*/
+
+
+#include "modematplugin.h"
+#include "atcopscmd.h"
+#include "debug.h"
+
+const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CModemAtPlugin* CModemAtPlugin::NewL()
+    {
+    CModemAtPlugin* self = new (ELeave) CModemAtPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CModemAtPlugin::~CModemAtPlugin()
+	{
+    TRACE_FUNC_ENTRY
+	iHandlers.ResetAndDestroy();
+	iHandlers.Close();
+    iReplyBuffer.Close();
+    TRACE_FUNC_EXIT
+	}
+
+// ---------------------------------------------------------------------------
+// CModemAtPlugin::CModemAtPlugin
+// ---------------------------------------------------------------------------
+//
+CModemAtPlugin::CModemAtPlugin() : CATExtPluginBase()
+    {
+    TRACE_FUNC_ENTRY
+    iHandler = NULL;
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// CModemAtPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ConstructL()
+    {
+    TRACE_FUNC_ENTRY
+    CATCommandHandlerBase* handler = NULL;
+    handler = CATCOPSCmd::NewL( this );
+    CleanupStack::PushL( handler );
+    iHandlers.AppendL( handler );
+    CleanupStack::Pop( handler );
+    TRACE_FUNC_EXIT
+   	}
+
+// ---------------------------------------------------------------------------
+// Reports connection identifier name to the extension plugin.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ReportConnectionName( const TDesC8& /*aName*/ )
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Reports the support status of an AT command. This is a synchronous API.
+// ---------------------------------------------------------------------------
+//
+TBool CModemAtPlugin::IsCommandSupported( const TDesC8& aCmd )
+    {
+    TRACE_FUNC_ENTRY
+    TInt i;
+    TInt count = iHandlers.Count();
+    for ( i=0; i<count; i++ )
+        {
+        CATCommandHandlerBase* handler = iHandlers[i]; 
+        TBool supported = handler->IsCommandSupported( aCmd );
+        if ( supported )
+            {
+            iHandler = handler;
+            TRACE_FUNC_EXIT
+            return ETrue;
+            }
+        }
+    iHandler = NULL;
+    TRACE_FUNC_EXIT
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an AT command. Cancelling of the pending request is done by
+// HandleCommandCancel(). The implementation in the extension plugin should
+// be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::HandleCommand( const TDesC8& aCmd,
+                                     RBuf8& aReply,
+                                     TBool aReplyNeeded )
+	{
+	TRACE_FUNC_ENTRY
+	if ( iHandler )
+	    {
+        iHcCmd = &aCmd;
+        iHcReply = &aReply;
+	    iHandler->HandleCommand( aCmd, aReply, aReplyNeeded );
+	    }
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels a pending HandleCommand request.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::HandleCommandCancel()
+    {
+    TRACE_FUNC_ENTRY
+	if ( iHandler )
+	    {
+	    iHandler->HandleCommandCancel();
+	    }
+	TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Next reply part's length.
+// The value must be equal or less than KDefaultCmdBufLength.
+// When the reply from this method is zero, ATEXT stops calling
+// GetNextPartOfReply().
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::NextReplyPartLength()
+    {
+    TRACE_FUNC_ENTRY
+    if ( iReplyBuffer.Length() < KDefaultCmdBufLength )
+        {
+        TRACE_FUNC_EXIT
+        return iReplyBuffer.Length();
+        }
+    TRACE_FUNC_EXIT
+    return KDefaultCmdBufLength;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the next part of reply initially set by HandleCommandComplete().
+// Length of aNextReply must be equal or less than KDefaultCmdBufLength.
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::GetNextPartOfReply( RBuf8& aNextReply )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = CreatePartOfReply( aNextReply );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// Receives unsolicited results. Cancelling of the pending request is done by
+// by ReceiveUnsolicitedResultCancel(). The implementation in the extension
+// plugin should be asynchronous.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ReceiveUnsolicitedResult()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels a pending ReceiveUnsolicitedResult request.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ReceiveUnsolicitedResultCancel()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Reports NVRAM status change to the plugins.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ReportNvramStatusChange( const TDesC8& /*aNvram*/ )
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Reports about external handle command error condition.
+// This is for cases when for example DUN decided the reply contained an
+// error condition but the plugin is still handling the command internally.
+// Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
+// "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
+// different reply types the condition is "ERROR" and DUN ends processing.
+// This solution keeps the pointer to the last AT command handling plugin
+// inside ATEXT and calls this function there to report the error.
+// It is to be noted that HandleCommandCancel() is not sufficient to stop
+// the processing as the command handling has already finished.
+// ---------------------------------------------------------------------------
+//
+void CModemAtPlugin::ReportExternalHandleCommandError()
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_FUNC_EXIT
+    }
+
+// ---------------------------------------------------------------------------
+// Creates part of reply from the global reply buffer to the destination
+// buffer. Used with APIs which need the next part of reply in multipart reply
+// requests.
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::CreatePartOfReply( RBuf8& aDstBuffer )
+    {
+    TRACE_FUNC_ENTRY
+    if ( iReplyBuffer.Length() <= 0 )
+        {
+        TRACE_FUNC_EXIT
+        return KErrGeneral;
+        }
+    TInt partLength = NextReplyPartLength();
+    if ( iReplyBuffer.Length() < partLength )
+        {
+        TRACE_FUNC_EXIT
+        return KErrNotFound;
+        }
+    aDstBuffer.Create( iReplyBuffer, partLength );
+    iReplyBuffer.Delete( 0, partLength );
+    if ( iReplyBuffer.Length() == 0 )
+        {
+        iReplyBuffer.Close();
+        }
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates an AT command reply based on the reply type and completes the
+// request to ATEXT. Uses iReplyBuffer for reply storage.
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::CreateReplyAndComplete( TATExtensionReplyType aReplyType,
+                                              const TDesC8& aSrcBuffer,
+                                              TInt aError )
+    {
+    TRACE_FUNC_ENTRY
+    iReplyBuffer.Close();
+    if ( aError != KErrNone )
+        {
+        HandleCommandCompleted( aError, EReplyTypeUndefined );
+        iHcCmd = NULL;
+        iHcReply = NULL;
+        TRACE_FUNC_EXIT
+        return KErrNone;
+        }
+    if ( !iHcReply )
+        {
+        TRACE_FUNC_EXIT
+        return KErrGeneral;
+        }
+    switch ( aReplyType )
+        {
+        case EReplyTypeOther:
+            if ( iQuietMode )  //  In quite mode there should be no response at all. 
+                {
+                iReplyBuffer.Create( KNullDesC8 );
+                }
+            else
+                {
+                iReplyBuffer.Create( aSrcBuffer ); 
+                }
+            break;
+        case EReplyTypeOk:
+            CreateOkOrErrorReply( iReplyBuffer, ETrue );
+            break;
+        case EReplyTypeError:
+            CreateOkOrErrorReply( iReplyBuffer, EFalse );
+            break;
+        default:
+            TRACE_FUNC_EXIT
+            return KErrGeneral;
+        }
+    CreatePartOfReply( *iHcReply );
+    HandleCommandCompleted( KErrNone, aReplyType );
+    iHcCmd = NULL;
+    iHcReply = NULL;
+    TRACE_FUNC_EXIT
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates a buffer for "OK" or "ERROR" reply based on the line settings
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::CreateOkOrErrorReply( RBuf8& aReplyBuffer,
+                                            TBool aOkReply )
+    {
+    TRACE_FUNC_ENTRY
+    if ( iQuietMode )
+        {
+        TRACE_FUNC_EXIT
+        return iReplyBuffer.Create( KNullDesC8 );
+        }
+    _LIT8( KErrorReplyVerbose, "ERROR" );
+    _LIT8( KOkReplyVerbose,    "OK" );
+    _LIT8( KErrorReplyNumeric, "4" );
+    _LIT8( KOkReplyNumeric,    "0" );
+    TBuf8<KErrorReplyLength> replyBuffer;
+    if ( iVerboseMode )
+        {
+        replyBuffer.Append( iCarriageReturn );
+        replyBuffer.Append( iLineFeed );
+        if ( aOkReply )
+            {
+            replyBuffer.Append( KOkReplyVerbose );
+            }
+        else
+            {
+            replyBuffer.Append( KErrorReplyVerbose );
+            }
+        replyBuffer.Append( iCarriageReturn );
+        replyBuffer.Append( iLineFeed );
+        }
+    else
+        {
+        if ( aOkReply )
+            {
+            replyBuffer.Append( KOkReplyNumeric );
+            }
+        else
+            {
+            replyBuffer.Append( KErrorReplyNumeric );
+            }
+        replyBuffer.Append( iCarriageReturn );
+        }
+    TInt retVal = aReplyBuffer.Create( replyBuffer );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns the array of supported commands
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::GetSupportedCommands( RPointerArray<HBufC8>& aCmds )
+    {
+    TRACE_FUNC_ENTRY
+    // Force superclass call here:
+    TInt retVal = CATExtPluginBase::GetSupportedCommands( aCmds );
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns plugin's character value settings (from CATExtPluginBase)
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::GetCharacterValue( TCharacterTypes aCharType,
+                                         TChar& aChar )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = KErrNone;
+    switch ( aCharType )
+        {
+        case ECharTypeCR:
+            aChar = iCarriageReturn;
+            break;
+        case ECharTypeLF:
+            aChar = iLineFeed;
+            break;
+        case ECharTypeBS:
+            aChar = iBackspace;
+            break;
+        default:
+            retVal = KErrNotFound;
+            break;
+        }
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// From MLcCustomPlugin.
+// Returns plugin's mode value settings (from CATExtPluginBase)
+// ---------------------------------------------------------------------------
+//
+TInt CModemAtPlugin::GetModeValue( TModeTypes aModeType, TBool& aMode )
+    {
+    TRACE_FUNC_ENTRY
+    TInt retVal = KErrNone;
+    switch ( aModeType )
+        {
+        case EModeTypeQuiet:
+            aMode = iQuietMode;
+            break;
+        case EModeTypeVerbose:
+            aMode = iVerboseMode;
+            break;
+        default:
+            retVal = KErrNotFound;
+            break;
+        }
+    TRACE_FUNC_EXIT
+    return retVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/modematplugin/src/proxy.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Export ECom interface implementations
+*
+*/
+
+
+#ifndef REFERENCE_ATEXT_H
+#define REFERENCE_ATEXT_H
+
+#include <e32base.h>
+#include <ecom/implementationproxy.h>
+#include "modematplugin.h"
+
+// ---------------------------------------------------------------------------
+// An array of TImplementationProxy objects which onnect each
+// implemeation with its instantiation function
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY(0x2002B3EB, CModemAtPlugin::NewL),  // DUN
+	};
+
+// ---------------------------------------------------------------------------
+// Exported proxy function to resolve instantiation methods for an Ecom
+// plug-in DLL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
+#endif
--- a/bluetoothengine/bteng/btfeatures/btfeatures.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/btfeatures/btfeatures.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -16,19 +16,11 @@
 */
 
 
-#include <btfeaturescfg.h> 
-#include <featmgr/featurecontrol.h>
-#include <featmgr/featmgr.h>
+#include <btfeaturescfg.h>
 
-/**
-	Device supports bluetooth data profiles disabled.
-*/
-const TInt KFeatureIdTempFfBluetoothDataProfilesDisabled = 0x1000001;
-	
-/**
-	Device supports bluetooth disabled.
-*/
-const TInt KFeatureIdTempFfBluetoothDisabled = 0x1000002;
+#include <centralrepository.h> 
+
+#include "btengprivatecrkeys.h"
 
 
 EXPORT_C void BluetoothFeatures::SetEnterpriseEnablementL(BluetoothFeatures::TEnterpriseEnablementMode aMode)
@@ -40,54 +32,72 @@
 	if ( proc.SecureId() != KDcmoServerSecureUid )
 		{
 		User::Leave(KErrPermissionDenied);
-		}	
-
-	const TUid KBtDisabledUid = {KFeatureIdTempFfBluetoothDisabled};
-	const TUid KBtDataProfilesDisabledUid = {KFeatureIdTempFfBluetoothDataProfilesDisabled};
-
-	RFeatureControl featureControl;
-	User::LeaveIfError(featureControl.Connect());
-	CleanupClosePushL(featureControl);
-	switch ( aMode )
+		}
+	
+	// get ready to use the central repository.
+	CRepository* cenRep = CRepository::NewL(KCRUidBTEngPrivateSettings);
+	CleanupStack::PushL(cenRep);
+	
+	switch(aMode)
 		{
 	case EDisabled:
-		User::LeaveIfError(featureControl.EnableFeature(KBtDisabledUid));
-		User::LeaveIfError(featureControl.DisableFeature(KBtDataProfilesDisabledUid));
+		User::LeaveIfError(cenRep->Set(KBluetoothEnterpriseState, EBluetoothEnterpriseDisabled));
 		break;
 	case EDataProfilesDisabled:
-		User::LeaveIfError(featureControl.DisableFeature(KBtDisabledUid));
-		User::LeaveIfError(featureControl.EnableFeature(KBtDataProfilesDisabledUid));
+		User::LeaveIfError(cenRep->Set(KBluetoothEnterpriseState, EBluetoothEnterpriseDataProfilesDisabled));
 		break;
 	case EEnabled:
-		User::LeaveIfError(featureControl.DisableFeature(KBtDisabledUid));
-		User::LeaveIfError(featureControl.DisableFeature(KBtDataProfilesDisabledUid));
+		User::LeaveIfError(cenRep->Set(KBluetoothEnterpriseState, EBluetoothEnterpriseEnabled));
 		break;
 	default:
 		User::Leave(KErrArgument);
 		break;
 		}
-	CleanupStack::PopAndDestroy(&featureControl);
+	
+	CleanupStack::PopAndDestroy(cenRep);
 	}
 
 EXPORT_C BluetoothFeatures::TEnterpriseEnablementMode BluetoothFeatures::EnterpriseEnablementL()
 	{
-	TEnterpriseEnablementMode mode = EDisabled;
+	TEnterpriseEnablementMode mode = EEnabled;
+	TInt setting = EBluetoothEnterpriseEnabled;
+	
+	// get the value out of the repository.
+	CRepository* cenRep = CRepository::NewL(KCRUidBTEngPrivateSettings);
+	CleanupStack::PushL(cenRep);
 	
-	FeatureManager::InitializeLibL();
-    const TBool bluetoothDisabled = FeatureManager::FeatureSupported(KFeatureIdTempFfBluetoothDisabled);
-    if ( !bluetoothDisabled )
+	TInt err = cenRep->Get(KBluetoothEnterpriseState, setting);
+	if(err == KErrNotFound)
 		{
-		const TBool dataProfilesDisabled = FeatureManager::FeatureSupported(KFeatureIdTempFfBluetoothDataProfilesDisabled);
-		if ( dataProfilesDisabled )
+		// not found in repository, so assume enabled by default
+		mode = EEnabled;
+		}
+	else if(err == KErrNone)
+		{
+		// Got a value from repository, convert it as appropriate.
+		switch(setting)
 			{
+		case EBluetoothEnterpriseDisabled:
+			mode = EDisabled;
+			break;
+		case EBluetoothEnterpriseDataProfilesDisabled:
 			mode = EDataProfilesDisabled;
-			}
-		else
-			{
+			break;
+		case EBluetoothEnterpriseEnabled:
 			mode = EEnabled;
-			}	
+			break;
+		default:
+			User::Leave(KErrUnknown);
+			break;
+			}
 		}
-    FeatureManager::UnInitializeLib();
-    
+	else
+		{
+		// Some other error accessing the central repository.
+		User::Leave(err);
+		}
+	
+	CleanupStack::PopAndDestroy(cenRep);
+	
 	return mode;
 	}
--- a/bluetoothengine/bteng/btfeatures/btfeatures.mmp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/btfeatures/btfeatures.mmp	Sat Apr 24 00:12:05 2010 +0300
@@ -28,9 +28,10 @@
 SOURCEPATH		.
 SOURCE			btfeatures.cpp
 
+USERINCLUDE		../../inc
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY			euser.lib
-LIBRARY			featmgr.lib
+LIBRARY			centralrepository.lib
 
 deffile ~/btfeatures.def
--- a/bluetoothengine/bteng/bttoggle/inc/bttoggle.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/bttoggle/inc/bttoggle.h	Sat Apr 24 00:12:05 2010 +0300
@@ -143,10 +143,10 @@
 
     enum TToggleActiveNotifier
       {
-      ENoneQuery = 0,		    
+      ENoneQuery = 0,
       EPowerModeQuery,
       ECloseConnectionQuery, 
-      EFakeNotif
+      EPowerModeChangeNote
       };
 
   private: //Data	
--- a/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -177,21 +177,21 @@
     //BT Connected or error obtaining link count (in the case of error, we are cautious and assume BT is connected)
     if (errLinkCount || linkCount > 0)
       {
-      TRACE_INFO((_L("[BTENG][BTTOGGLE]Ongoing BT connection") ))								
+      TRACE_INFO((_L("[BTENG][BTTOGGLE]Ongoing BT connection") ))
       __ASSERT_DEBUG(iActiveNotifier == ENoneQuery, Panic(EBTToggleInvalidStateCloseConnectionQuery));
 
-      iActiveNotifier = ECloseConnectionQuery;						
+      iActiveNotifier = ECloseConnectionQuery;
       iPckgGenericQuery().iMessageType = EBTSwitchOffAnyway;
       iPckgGenericQuery().iNameExists = EFalse;
-      iNotifier.StartNotifierAndGetResponse(iStatus, KBTGenericQueryNotifierUid, iPckgGenericQuery, iConnQuery );			
-      SetActive();															
-      }	
+      iNotifier.StartNotifierAndGetResponse(iStatus, KBTGenericQueryNotifierUid, iPckgGenericQuery, iConnQuery );
+      SetActive();
+      }
     //No open connections
     else
       {
       TRACE_INFO((_L("[BTENG][BTTOGGLE] No BT connections") ))
       ChangeBtPowerMode(EBTPowerOff);
-      }					 
+      }
     }
   TRACE_FUNC_EXIT	
   }
@@ -241,20 +241,17 @@
   TRACE_FUNC_ENTRY
   __ASSERT_DEBUG(iActiveNotifier == ENoneQuery, Panic(EBTToggleInvalidStateChangeBtPowerMode));
 
-  TRequestStatus *stat = &iStatus; 
-  TInt errPower = iSettings->SetPowerState(aNewPowerState);					
-
+  TInt errPower = iSettings->SetPowerState(aNewPowerState);
   if (KErrNone == errPower)
     {
     ShowNotification( static_cast<TBool>(aNewPowerState) );
+    iActiveNotifier = EPowerModeChangeNote; 
+    iStatus = KRequestPending;
+    SetActive();
     }
-  iActiveNotifier = EFakeNotif; 
-  iStatus = KRequestPending;
-  User::RequestComplete(stat, KErrNone);
-  SetActive();
 
   TRACE_FUNC_EXIT
-  return errPower; 	
+  return errPower;
   }
 
 // ==========================================================
@@ -284,7 +281,7 @@
   Cancel();
 
   //Start new notification
-  iNotifier.StartNotifier(KBTGenericInfoNotifierUid, pckgGenericInfo, result);	
+  iNotifier.StartNotifierAndGetResponse(iStatus, KBTGenericInfoNotifierUid, pckgGenericInfo, result);	
 
   TRACE_FUNC_EXIT
   }
@@ -304,7 +301,11 @@
   else if ( ECloseConnectionQuery == iActiveNotifier ) 
     {
     iNotifier.CancelNotifier(KBTGenericQueryNotifierUid); 
-    }
+    }  
+  else if ( EPowerModeChangeNote == iActiveNotifier ) 
+      {
+      iNotifier.CancelNotifier(KBTGenericQueryNotifierUid); 
+      }
 
   // For all cancels, we must reset iActiveNotifier back to ENoneQuery
   // to permit another request to be made.
@@ -328,10 +329,10 @@
   // to permit another request to be made.
   switch (iActiveNotifier)
     {							
-    case EPowerModeQuery:				
+    case EPowerModeQuery:
       iActiveNotifier = ENoneQuery;
-      ShowNotification(ETrue);
-      CActiveScheduler::Stop();
+      ShowNotification(ETrue);    
+      SetActive();
       break; 			
     case ECloseConnectionQuery:							
       iActiveNotifier = ENoneQuery;
@@ -343,8 +344,8 @@
         {
         CActiveScheduler::Stop();
         }																				
-      break;											
-    default: //ENoneQuery or EFakeNotif
+      break;
+    default: //ENoneQuery or EPowerModeChangeNote
       iActiveNotifier = ENoneQuery;
       CActiveScheduler::Stop();
     }						
Binary file bluetoothengine/bteng/cenrep/keys_bteng.xls has changed
Binary file bluetoothengine/bteng/conf/bteng.confml has changed
Binary file bluetoothengine/bteng/conf/bteng_10204DAC.crml has changed
--- a/bluetoothengine/bteng/inc/btengincpair.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/inc/btengincpair.h	Sat Apr 24 00:12:05 2010 +0300
@@ -176,6 +176,7 @@
      */
     RTimer iPairingOkTimer;
     CBTEngActive* iActivePairingOk;
+    TBool iUserAwarePairing;
     };
 
 #endif /*BTENGINCPAIR_H_*/
--- a/bluetoothengine/bteng/inc/btengprivatecrkeys.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/inc/btengprivatecrkeys.h	Sat Apr 24 00:12:05 2010 +0300
@@ -79,8 +79,6 @@
  */
 const TUint32 KBTSapEnabled	= 0x00000003;
 
-const TUint32 KBtHidKeyboardLayout = 0x00000004;
-
 /**  Enumeration for Bluetooth SAP setting */
 enum TBTSapMode
     {
@@ -88,5 +86,16 @@
     EBTSapEnabled
     };
 
+const TUint32 KBtHidKeyboardLayout = 0x00000004;
+
+const TUint32 KBluetoothEnterpriseState = 0x00000005;
+
+enum TBluetoothEnterpriseState
+	{
+	EBluetoothEnterpriseDisabled = 0,
+	EBluetoothEnterpriseDataProfilesDisabled = 1,
+	EBluetoothEnterpriseEnabled = 2,
+	};
+
 
 #endif // BTENG_PRIVATE_CR_KEYS_H
--- a/bluetoothengine/bteng/src/btengincpair.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/src/btengincpair.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -99,6 +99,8 @@
     if ( iAddr == aAddr )
         {
         err = KErrNone;
+        iUserAwarePairing = ETrue; // This function is called by a notifier, which means the UI has been involved
+        // Therefore we can display it in the paired devices list
         if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() )
             {
             // If we are observing physical link, or showing user a note,
@@ -171,46 +173,46 @@
         iActivePairingOk->CancelRequest();
         UnSetPairResult();  // we might have set it before (if the link went down) so we want to reset it.   
         }
-    switch ( aDev.LinkKeyType() )
-        {
-        case ELinkKeyUnauthenticatedNonUpgradable:
-            {
-            // If an application uses btengconnman API to connect a service of 
-            // this device and JW pairing occurred as part of security enforcement,
-            // it shall be a user aware pairing, and we shall add this device in paired
-            // view. In this way, user is able to disconnect the device from our UI.
-            // Otherwise the link key has been created by a device without IO requesting 
-            // a service connection with phone. We won't take any action (e.g. remove 
-            // link key) in this case. As the result, this device can't be seen in our UI, 
-            // however other applications are still freely to use its services.
-            TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) )
-            TBTEngConnectionStatus status = iParent.IsDeviceConnected( aDev.Address() );
-            if ( status == EBTEngConnecting || status == EBTEngConnected )
-                {
-                // the return error is ingore as we can not have other proper 
-                // exception handling option:
-                (void) iParent.AddUiCookieJustWorksPaired( aDev );
-                }
-            iParent.RenewPairer( NULL );
-            break;
-            }
-        case ELinkKeyUnauthenticatedUpgradable:
-            {
-            // The linkkey has been created  by an incoming OBEX service request
-            // which resulted a pairing event received from pair server.
-            TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) )
-            iParent.RenewPairer( NULL );
-            break;
-            }
-        default:
-            {
-            // Other pairing model than Just Works:
-            CancelPlaNotification();
-            SetPairResult( KErrNone );
-            ShowPairingNoteAndAuthorizeQuery();
-            break;
-            }
-        }
+    if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing)
+		{
+		// If an application uses btengconnman API to connect a service of 
+		// this device and JW pairing occurred as part of security enforcement,
+		// it shall be a user aware pairing, and we shall add this device in paired
+		// view. In this way, user is able to disconnect the device from our UI.
+		// Otherwise the link key has been created by a device without IO requesting 
+		// a service connection with phone. We won't take any action (e.g. remove 
+		// link key) in this case. As the result, this device can't be seen in our UI, 
+		// however other applications are still freely to use its services.
+		TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) )
+		TBTEngConnectionStatus status = iParent.IsDeviceConnected( aDev.Address() );
+		if ( status == EBTEngConnecting || status == EBTEngConnected )
+			{
+			// the return error is ingore as we can not have other proper 
+			// exception handling option:
+			(void) iParent.AddUiCookieJustWorksPaired( aDev );
+			}
+		iParent.RenewPairer( NULL );
+		}
+    else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing)
+		{
+		// The linkkey has been created  by an incoming OBEX service request
+		// which resulted a pairing event received from pair server.
+		TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) )
+		iParent.RenewPairer( NULL );
+		}
+    else
+		{
+		if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable)
+			{
+			// The user was involved in the pairing, so display in the paired devices list
+			(void) iParent.AddUiCookieJustWorksPaired(aDev);
+			}
+		TRACE_INFO(_L("[BTEng]: CBTEngIncPair: Non-JW pairing"))
+		// Other pairing model than Just Works:
+		CancelPlaNotification();
+		SetPairResult( KErrNone );
+		ShowPairingNoteAndAuthorizeQuery();
+		}
     TRACE_FUNC_EXIT
     }
 
--- a/bluetoothengine/bteng/src/btengpairman.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/src/btengpairman.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -412,6 +412,7 @@
 
 TInt CBTEngPairMan::AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev )
     {
+	TRACE_FUNC_ENTRY
     TInt err( KErrNone );
     // There might be UI cookies used by other applications,
     // we should not overwrite them. 
@@ -426,6 +427,7 @@
         err = UpdateRegDevice( dev );
         TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair write Ui cookie ret %d"), err ) );
         }
+    TRACE_FUNC_EXIT
     return err;
     }
 
--- a/bluetoothengine/bteng/src/btengserver.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/src/btengserver.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -335,6 +335,7 @@
 void CBTEngServer::QueueTimer( CBTEngServer::TTimerQueued aTimer, TInt64 aInterval )
     {
     TRACE_FUNC_ARG( ( _L( "queueing timer %d" ), (TInt) aTimer ) )
+    __ASSERT_DEBUG( iTimer, PanicServer( EBTEngPanicMemberVarIsNull ) );
     iTimerQueued |= aTimer;
     TTimeIntervalMicroSeconds interval( aInterval );
     switch( aTimer )
@@ -364,6 +365,10 @@
 void CBTEngServer::RemoveTimer( CBTEngServer::TTimerQueued aTimer )
     {
     TRACE_FUNC_ARG( ( _L( "removing timer %d" ), (TInt) aTimer ) )
+    if(!iTimer)
+        {
+        return; // not fully constructed yet, don't do anything
+        }
     iTimerQueued &= ~aTimer;
     // Timers can be removed without being queued, no need to check.
     switch( aTimer )
--- a/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -402,7 +402,11 @@
     SetVisibilityModeL( EBTVisibilityModeHidden, 0 );
     TBTPowerState power = EBTOff;
     TInt err = GetHwPowerState( power );
-    if( !err && power )
+    // See p2.1.2.1.2 of the UI spec
+    // NB:  Please distinguish between TBTPowerState::EBTOff (defined in hcitypes.h)
+    //      and TBTPowerStateValue::EBTPowerOff (defined in btserversdkcrkeys.h)
+    //      because they have the opposite values
+    if( !err && (power != EBTOff))
         {
         // Show a notification to the user
         TBTGenericInfoNotiferParamsPckg pckg;
--- a/bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def	Sat Apr 24 00:12:05 2010 +0300
@@ -8,4 +8,5 @@
 	_ZN12RBTHidClient7ConnectEv @ 7 NONAME
 	_ZNK12RBTHidClient19CancelConnectDeviceEv @ 8 NONAME
 	_ZNK12RBTHidClient24CancelNotifyStatusChangeEv @ 9 NONAME
+	_ZNK12RBTHidClient7VersionEv @ 10 NONAME
 
--- a/bluetoothengine/bthid/bthidclient/src/bthidclient.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/bthidclient/src/bthidclient.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -57,7 +57,7 @@
 // Defines server version number
 // ---------------------------------------------------------
 //
-TVersion RBTHidClient::Version() const
+EXPORT_C TVersion RBTHidClient::Version() const
     {
     return (TVersion(KBTHIDServMajorVersionNumber,
             KBTHIDServMinorVersionNumber, KBTHIDServBuildVersionNumber));
--- a/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -164,6 +164,10 @@
         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
         SetRect( mainPaneRect );
         DrawNow();
+        if (iMouseInitialized)
+            {
+            iClientCommander.ImageCommand( KRedrawBTCursorAnim );
+            }
         }
     }
 
--- a/bluetoothengine/bthid/mouse/Sesame_client/inc/pointmsgqueue.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/Sesame_client/inc/pointmsgqueue.h	Sat Apr 24 00:12:05 2010 +0300
@@ -39,7 +39,8 @@
     KStartBTCursorAnim = 1,
     KStopBTCursorAnim = 2,
     KChangeCursor = 3,
-    KSendRawEvent = 4
+    KSendRawEvent = 4,
+    KRedrawBTCursorAnim = 5
     };
 
 class TPointBuffer
--- a/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -175,6 +175,11 @@
     {
     // Could optionally decode the commands here
     DBG(RDebug::Print(_L("RImageCommander::ImageCommand %d"), aCommand));
+    if ( aCommand == KRedrawBTCursorAnim ) 
+        {
+        //reset the current location to avoid sudden jumping 
+        iCurrentPoint.SetXY(0,0);
+        }
 
     RAnim::Command( aCommand );
     
@@ -230,7 +235,6 @@
     return KErrNone;
     }
 
-
 TBool RImageCommander::RestrictPos()
     {
     TBool notInScreen(EFalse);
@@ -242,6 +246,12 @@
         TInt mode(screen->CurrentScreenMode());
         screen->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
         }
+    
+    DBG(
+        RDebug::Print(_L("RImageCommander::RestrictPos sizeAndRotation.iPixelSize (%d,%d)"), sizeAndRotation.iPixelSize.iWidth, sizeAndRotation.iPixelSize.iHeight);
+        RDebug::Print(_L("RImageCommander::RestrictPos sizeAndRotation.iRotation (%d)"), sizeAndRotation.iRotation);
+        )
+
     TRect validRect(sizeAndRotation.iPixelSize);
     if (! validRect.Contains(iCurrentPoint))
         {
@@ -268,7 +278,11 @@
     DBG(
     if (outSide)
         {
-       RDebug::Print(_L("RImageCommander::CheckCurrentPoint not in screen (%d,%d)"), pos.iX, pos.iY);
+       RDebug::Print(_L("RImageCommander::CheckCurrentPoint NOT in screen (%d,%d)"), pos.iX, pos.iY);
+        }
+    else
+        {
+       RDebug::Print(_L("RImageCommander::CheckCurrentPoint DOES in screen (%d,%d)"), pos.iX, pos.iY);
         }
     )
     return outSide;
--- a/bluetoothengine/bthid/mouse/Sesame_server/group/animation_server.mmp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/Sesame_server/group/animation_server.mmp	Sat Apr 24 00:12:05 2010 +0300
@@ -21,7 +21,7 @@
 TARGETTYPE      ani
 
 // The second one is the UID of the server, different than main program's UID
-UID 0x10003b22 0x2001FE5A
+UID      0x10003B22 0x2001FE5A
 
 CAPABILITY      CAP_CLIENT_DLL
 VENDORID        VID_DEFAULT
--- a/bluetoothengine/bthid/mouse/Sesame_server/inc/mousecursorsrv.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/Sesame_server/inc/mousecursorsrv.h	Sat Apr 24 00:12:05 2010 +0300
@@ -49,9 +49,15 @@
      * Create an instance of the Animation Server image aType.
      * @param aType KAnimationSquare implies "construct a bouncing square"
      */
-    IMPORT_C CAnim* CreateInstanceL(TInt aType);
+    CAnim* CreateInstanceL(TInt aType);
 
     };
 
+/**
+ * Entry point function to Create the animation plugin
+ * Returns the object of the CMouseCursorSrv class
+ */
+IMPORT_C CAnimDll* CreateCAnimDllL();
+
 #endif // __MOUSECURSORSRV_H__
 // End of File
--- a/bluetoothengine/bthid/mouse/Sesame_server/src/mousecursorimage.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/bthid/mouse/Sesame_server/src/mousecursorimage.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -189,6 +189,18 @@
             iSpriteFunctions->Activate(EFalse);
             }
         break;
+        
+        case KRedrawBTCursorAnim:
+            {
+            iSpriteFunctions->Activate(EFalse);
+            iSpriteGc->Reset();
+            iSpriteFunctions->SetPosition(TPoint());
+            iSpriteFunctions->SizeChangedL();
+            iSpriteFunctions->Activate(ETrue);
+            DrawCursor();
+            }
+        break;
+        
         case KChangeCursor:
             {
             TPoint pos = *(TPoint *)aArgs;
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -203,11 +203,15 @@
         diff1 = Abs( aPrevPhVol - iAccSpkrVol );
         diff2 = Abs( iPhnSpkrVol - iAccSpkrVol );
         
-        if( diff2 >= diff1  )
+        if (diff2 > diff1)
             {
             // the previous phone volume is closer to current headset volume setting
             volClick = ( aPrevPhVol < iPhnSpkrVol ) ? KPSVolumeDownClicked : KPSVolumeUpClicked;
             }
+        else if ( (diff2 == diff1) && (diff1 !=0) )
+            {
+            volClick = ( aPrevPhVol < iPhnSpkrVol ) ? KPSVolumeDownClicked : KPSVolumeUpClicked;
+            }
         // otherwise we have roughly synchronized vol in both ends.
         }
     else if( iAccSpkrVol != iPhnSpkrVol )
--- a/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Sat Apr 24 00:12:05 2010 +0300
@@ -80,7 +80,7 @@
 		* @param aBuffer A package buffer containing received parameters.
         * @return None.
         */
-		void ProcessParamBufferL(const TDesC8& aBuffer);
+		void ProcessParamBufferL(const TDesC8& aBuffer, TBool aSyncCall);
 		
         /**
         * C++ default constructor.
@@ -90,7 +90,7 @@
         /**
          * Show Information note and complete message. 
          */
-        void ShowNoteAndCompleteL();
+        void ShowNoteAndCompleteL(TBool aSyncCall);
         
     private:
         RBuf	iQueryMessage;
--- a/bluetoothengine/btnotif/inc/btnotifier.h	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btnotif/inc/btnotifier.h	Sat Apr 24 00:12:05 2010 +0300
@@ -293,9 +293,12 @@
         TBTDevAddr                  iBTAddr; // Gotten from PckBuffer, constant no matter how iDevice changes.
         CBTNotifUIUtil*             iNotifUiUtil;           // Utility to show UI notes & queries
         CBTEngSettings*             iBTEngSettings;
+        TBool                       iIsCoverUI;
+
     private:
         CBTEngDevMan*               iDevMan;  // for BT registry manipulation
-        TBool                       iIsCoverUI;
+
+
         
     };
 
--- a/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -85,10 +85,13 @@
 TPtrC8 CBTGenericInfoNotifier::StartL( const TDesC8& aBuffer )
     {
     FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::StartL()"));
- 	ProcessParamBufferL(aBuffer);
+    if( !iNotifUiUtil )
+        {
+        iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI );
+        }
+    ProcessParamBufferL(aBuffer, ETrue);
+    FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::StartL() completed"));
 
-	FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::StartL() completed"));
-	
     TPtrC8 ret(KNullDesC8);
     return (ret);
     }
@@ -109,7 +112,7 @@
 	    return;
 	    }
     iMessage = aMessage;
- 	ProcessParamBufferL(aBuffer);
+ 	ProcessParamBufferL(aBuffer, EFalse);
     }
 
 // ----------------------------------------------------------
@@ -117,10 +120,10 @@
 // Parse the data out of the message that is sent by the
 // client of the notifier.
 // ----------------------------------------------------------
-void CBTGenericInfoNotifier::ProcessParamBufferL(const TDesC8& aBuffer)
+void CBTGenericInfoNotifier::ProcessParamBufferL(const TDesC8& aBuffer, TBool aSyncCall)
 	{
 	TBTGenericInfoNotifierParams bParams;
-	TPckgC<TBTGenericInfoNotifierParams> bPckg(bParams);	
+	TPckgC<TBTGenericInfoNotifierParams> bPckg(bParams);
 		
 	bPckg.Set( aBuffer );
 	iSecondaryDisplayCommand = ECmdBTnotifUnavailable;
@@ -222,7 +225,7 @@
 		}
 	else
 	    {
-	    ShowNoteAndCompleteL();
+	    ShowNoteAndCompleteL(aSyncCall);
 	    }
 	}
 	
@@ -231,10 +234,13 @@
 // Shows the notifier in backround 
 // ----------------------------------------------------------
 //
-void CBTGenericInfoNotifier::ShowNoteAndCompleteL()
+void CBTGenericInfoNotifier::ShowNoteAndCompleteL(TBool aSyncCall)
 	{
 	iNotifUiUtil->ShowInfoNoteL( iQueryMessage, iSecondaryDisplayCommand );
-    CompleteMessage(KErrNone);
+	if (!aSyncCall)
+		{
+        CompleteMessage(KErrNone);
+        }
     FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::ShowNoteAndComplete() complete"));
 	}
 
@@ -248,7 +254,7 @@
     BluetoothUiUtil::LoadResourceAndSubstringL( 
             iQueryMessage, iMessageResourceId, name, 0);      
     
-    ShowNoteAndCompleteL();
+    ShowNoteAndCompleteL(EFalse);
 
     FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::HandleGetDeviceComplete() Complete"));        
     }
--- a/bluetoothengine/btnotif/src/BTNotifier.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btnotif/src/BTNotifier.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -490,16 +490,20 @@
     iDevice->DeleteLinkKey();
  
     iBTRegistryQueryState = ESetDeviceBlocked;
+    TInt err = KErrNone;
     if( !iDevMan )
         {
-        iDevMan = CBTEngDevMan::NewL( this );    
+        TRAP(err, iDevMan = CBTEngDevMan::NewL( this ));    
+        }
+    if( !err )
+        {
+        err = iDevMan->ModifyDevice( *iDevice );
         }
-    TInt devManErr = iDevMan->ModifyDevice( *iDevice );     
-            
-    // if error, complete message, otherwise waiting for devman callback
-    //
-    if(devManErr != KErrNone)
-        CompleteMessage(devManErr); 
+    if( err )
+        {
+        // if error, complete message, otherwise waiting for devman callback
+        CompleteMessage(err); 
+        }
     }
 
 void CBTNotifierBase::ChangeAuthorizeState( TBool aTrust )
@@ -511,17 +515,19 @@
     iDevice->SetGlobalSecurity(sec);
  
     iBTRegistryQueryState = ESetDeviceAuthorizeState;
+    TInt err = KErrNone;
     if( !iDevMan )
-        {
-        iDevMan = CBTEngDevMan::NewL( this );    
+        {    
+        TRAP(err, iDevMan = CBTEngDevMan::NewL( this ));
         }
-    TInt devManErr = iDevMan->ModifyDevice( *iDevice );     
-            
-    // if error, complete message, otherwise waiting for devman callback
-    //
-    if(devManErr != KErrNone)
+    if( !err )
         {
-        CompleteMessage(devManErr); 
+        err = iDevMan->ModifyDevice( *iDevice );
+        }
+    if( err )
+        {
+        // if error, complete message, otherwise waiting for devman callback        
+        CompleteMessage(err); 
         TBTNotifLockPublish::DeleteNotifLocks( 
                 EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() );
         }
--- a/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -141,7 +141,7 @@
         }
     else
         {
-        iNotifUiUtil->ShowErrorNoteL( ETrue, stringholder, iSecondaryDisplayCommand, name );
+        iNotifUiUtil->ShowErrorNoteL( EFalse, stringholder, iSecondaryDisplayCommand, name );
         }
     CleanupStack::PopAndDestroy( &stringholder );
       
--- a/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp	Fri Apr 23 23:54:40 2010 +0300
+++ b/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp	Sat Apr 24 00:12:05 2010 +0300
@@ -32,7 +32,7 @@
 #include "debug.h"               
 #include "btui.h" // Global declarations
 
-const TInt KBTNumberOfIcons = 13;    // Number of class of device icons
+const TInt KBTNumberOfIcons = 14;    // Number of class of device icons + extra one DEV_STATUS_AUTHORIZED
 	
 _LIT( DEV_TYPE_COMPUTER,"0\t");
 _LIT( DEV_TYPE_PHONE,"1\t");
--- a/group/bld.inf	Fri Apr 23 23:54:40 2010 +0300
+++ b/group/bld.inf	Sat Apr 24 00:12:05 2010 +0300
@@ -21,6 +21,7 @@
 #include "../btservices_plat/group/bld.inf"
 #include "../btservices_pub/group/bld.inf"
 #include "../bluetoothengine/group/bld.inf"
+#include "../atcommands/group/bld.inf"
 
 PRJ_EXPORTS
 
--- a/tsrc/public/basic/conf/obexservapitest.cfg	Fri Apr 23 23:54:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-[Test]
-title Get file system status
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester GetFileSystemStatus
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Get MMC file system status
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester GetMmcFileSystemStatus
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Get message center drive
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester GetMessageCentreDriveL
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Create default mtm service
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester CreateDefaultMtmServiceL
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Get cenrep key int value
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester GetCenRepKeyIntValueL
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Get PubSub key int value
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester GetPubSubKeyIntValue
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Create and remove outpox entry
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester CreateOutBoxEntry
-Message_Handler_Tester RemoveOutBoxEntry
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Crate and remove outpox entry
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester SaveObjToInbox
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Save object to inbox
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester SaveObjToInbox
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Create and save attacment
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester CreateEntryToInbox
-Message_Handler_Tester SaveRFileObjectToInbox
-delete Message_Handler_Tester
-[Endtest] 
-[Test]
-title Create and Remove attacment
-create obexservapitest Message_Handler_Tester
-Message_Handler_Tester CreateEntryToInbox
-Message_Handler_Tester RemoveObjectFromInbox
-delete Message_Handler_Tester
-[Endtest] 
-
--- a/tsrc/public/basic/conf/test.xml	Fri Apr 23 23:54:40 2010 +0300
+++ b/tsrc/public/basic/conf/test.xml	Sat Apr 24 00:12:05 2010 +0300
@@ -34,24 +34,7 @@
                             <param component-path="LCDo_APITestDrop/general"/>
                         </params>
                     </step>
-                    <step id="1.1.1.1.1.3" name="Install obex service test module" harness="STIF" significant="false">
-                        <command>install</command>
-                        <params>
-                            <param type="binary"/>
-                            <param src="obexservapitest.dll"/>
-                            <param dst="c:\sys\bin\obexservapitest.dll"/>
-                            <param component-path="LCDo_APITestDrop/components"/>
-                        </params>
-                    </step> 
-                    <step id="1.1.1.1.1.4" name="Install obex service test script" harness="STIF" enabled="true" passrate="100" significant="false">
-                        <command>install</command>
-                        <params>
-                            <param src="obexservapitest.cfg"/>
-                            <param dst="e:\testing\obexservapitest.cfg"/>
-                            <param component-path="LCDo_APITestDrop/general"/>
-                        </params>
-                    </step>
-                    <step id="1.1.1.1.1.5" name="Install AT EXT plugin API test module" harness="STIF" significant="false">
+                    <step id="1.1.1.1.1.3" name="Install AT EXT plugin API test module" harness="STIF" significant="false">
                         <command>install</command>
                         <params>
                             <param type="binary"/>
@@ -61,7 +44,7 @@
                         </params>
                     </step> 
                     
-                    <step id="1.1.1.1.1.6" name="Install AT EXT plugin API test script" harness="STIF" enabled="true" passrate="100" significant="false">
+                    <step id="1.1.1.1.1.4" name="Install AT EXT plugin API test script" harness="STIF" enabled="true" passrate="100" significant="false">
                         <command>install</command>
                         <params>
                             <param src="atextpluginapi_scripter.cfg"/>
@@ -70,7 +53,7 @@
                         </params>
                     </step>   
                     
-                    <step id="1.1.1.1.1.7" name="Install AT EXT plugin STUB" harness="STIF" significant="false">
+                    <step id="1.1.1.1.1.5" name="Install AT EXT plugin STUB" harness="STIF" significant="false">
                         <command>install</command>
                         <params>
                             <param type="binary"/>
@@ -79,7 +62,7 @@
                             <param component-path="LCDo_APITestDrop/components"/>
                         </params>
                     </step>
-                    <step id="1.1.1.1.1.8" name="Install AT EXT plugin STUB rsc" harness="STIF" significant="false">
+                    <step id="1.1.1.1.1.6" name="Install AT EXT plugin STUB rsc" harness="STIF" significant="false">
                         <command>install</command>
                         <params>
                             <param src="atextpluginstub.rsc"/>
@@ -89,39 +72,25 @@
                     </step>                    
                     
                                         
-										<step id="1.1.1.1.1.9" name="Create CTC log dir" harness="STIF" enabled="true" passrate="100" significant="false">
+										<step id="1.1.1.1.1.7" name="Create CTC log dir" harness="STIF" enabled="true" passrate="100" significant="false">
 												<command>makedir</command>
 														<params>
 																<param dir="c:\data\ctc\"/>
 														</params>
 										</step>
-                		<step id="1.1.1.1.1.10" name="Make logging dir" harness="STIF" enabled="true" passrate="100" significant="false">
+                		<step id="1.1.1.1.1.8" name="Make logging dir" harness="STIF" enabled="true" passrate="100" significant="false">
                     		<command>makedir</command>
                     		<params>
                         		<param dir="e:\logs\btengapitest"/>
                     		</params>
-                		</step>
-                		<step id="1.1.1.1.1.11" name="Make logging dir" harness="STIF" enabled="true" passrate="100" significant="false">
-                    		<command>makedir</command>
-                    		<params>
-                        		<param dir="e:\logs\ObexServAPItest"/>
-                    		</params>
-                		</step>         
-                		<step id="1.1.1.1.1.12" name="Make logging dir" harness="STIF" enabled="true" passrate="100" significant="false">
+                		</step>       
+                		<step id="1.1.1.1.1.9" name="Make logging dir" harness="STIF" enabled="true" passrate="100" significant="false">
                     		<command>makedir</command>
                     		<params>
                         		<param dir="e:\logs\atextpluginapitest"/>
                     		</params>
                 		</step>                    		       		
-		                <step id="1.1.1.1.1.101" name="Test obex service APIs" harness="STIF" enabled="true" passrate="100" significant="true">
-		                    <command>run-cases</command>
-		                    <params>
-		        							<param module="TestScripter"/>
-		        							<param testcase-file="e:\testing\obexservapitest.cfg"/>
-		        							<param timeout="6000"/>
-		                    </params>
-		                </step>	
-		                <step id="1.1.1.1.1.102" name="Test bteng APIs" harness="STIF" enabled="true" passrate="100" significant="true">
+		                <step id="1.1.1.1.1.101" name="Test bteng APIs" harness="STIF" enabled="true" passrate="100" significant="true">
 		                    <command>run-cases</command>
 		                    <params>
 		        							<param module="TestScripter"/>
@@ -129,7 +98,7 @@
 		        							<param timeout="6000"/>		        							
 		                    </params>
 		                </step>
-		                <step id="1.1.1.1.1.103" name="Test AT EXT Plugin APIs" harness="STIF" enabled="true" passrate="100" significant="true">
+		                <step id="1.1.1.1.1.102" name="Test AT EXT Plugin APIs" harness="STIF" enabled="true" passrate="100" significant="true">
 		                    <command>run-cases</command>
 		                    <params>
 		        							<param module="TestScripter"/>
@@ -162,18 +131,11 @@
                     <step id="1.1.1.1.1.203" name="Fetch test results" harness="STIF" enabled="true" passrate="100" significant="false">
                        <command>fetch-log</command>
                            <params>
-                               <param path="e:\logs\ObexServAPItest\*"/>
-                               <param delete="true"/>
-                           </params>                                                 
-                   </step>
-                    <step id="1.1.1.1.1.204" name="Fetch test results" harness="STIF" enabled="true" passrate="100" significant="false">
-                       <command>fetch-log</command>
-                           <params>
                                <param path="e:\logs\atextpluginapitest\*"/>
                                <param delete="true"/>
                            </params>                                                     
                    </step>          
-                    <step id="1.1.1.1.1.205" name="Fetch test results" harness="STIF" enabled="true" passrate="100" significant="false">
+                    <step id="1.1.1.1.1.204" name="Fetch test results" harness="STIF" enabled="true" passrate="100" significant="false">
                        <command>fetch-log</command>
                            <params>
                                <param path="c:\data\ctc\ctcdata.txt"/>
@@ -188,12 +150,10 @@
     		<file>LCDo_APITestDrop/images/LCDo_test_API_rnd.fpsx</file>
         <file>LCDo_APITestDrop/images/LCDo_test_API_rnd_erase.fpsx</file>
         <file>LCDo_APITestDrop/components/armv5_urel/btengapitest.dll</file>
-        <file>LCDo_APITestDrop/components/armv5_urel/obexservapitest.dll</file>
         <file>LCDo_APITestDrop/components/armv5_urel/atextpluginapitest.dll</file>
         <file>LCDo_APITestDrop/components/armv5_urel/atextpluginstub.dll</file>        
         <file>LCDo_APITestDrop/general/atextpluginstub.rsc</file>
         <file>LCDo_APITestDrop/general/btengapi_scripter.cfg</file>
-        <file>LCDo_APITestDrop/general/obexservapitest.cfg</file>
         <file>LCDo_APITestDrop/general/atextpluginapi_scripter.cfg</file>
     </files>
 
--- a/tsrc/public/basic/group/bld.inf	Fri Apr 23 23:54:40 2010 +0300
+++ b/tsrc/public/basic/group/bld.inf	Sat Apr 24 00:12:05 2010 +0300
@@ -19,7 +19,6 @@
 PRJ_PLATFORMS
 DEFAULT
 #include "../btengapitest/group/bld.inf"
-#include "../obexservapitest/group/bld.inf"
 #include "../atextpluginapitest/group/bld.inf"
 
 //build files for shortlinkconn