Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 21:51:05 +0300
branchRCL_3
changeset 13 b6f55cd40afd
parent 11 a42ed326b458
child 14 f7fbeaeb166a
Revision: 201011 Kit: 201013
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/group/backup_registration.xml
bluetoothengine/bteng/inc/btengincpair.h
bluetoothengine/bteng/inc/btengprivatecrkeys.h
bluetoothengine/bteng/src/btengactive.cpp
bluetoothengine/bteng/src/btengincpair.cpp
bluetoothengine/bteng/src/btengpairman.cpp
bluetoothengine/bteng/src/btengserver.cpp
bluetoothengine/bteng/src/btengsrvsettingsmgr.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/bwins/btcursor_serveru.def
bluetoothengine/bthid/mouse/Sesame_server/eabi/btcursor_serveru.def
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/group/BTMAC.mmp
bluetoothengine/btmac/inc/btmac/btmman.h
bluetoothengine/btmac/inc/btmac/btmpagescanparametersmanager.h
bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp
bluetoothengine/btmac/src/btmac/btmman.cpp
bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp
bluetoothengine/btmac/src/btmac/btmslisten.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
tsrc/public/basic/obexservapitest/Bmarm/ObexServAPItestU.DEF
tsrc/public/basic/obexservapitest/Bwins/ObexServAPItestU.DEF
tsrc/public/basic/obexservapitest/EABI/ObexServAPItestU.def
tsrc/public/basic/obexservapitest/group/bld.inf
tsrc/public/basic/obexservapitest/group/obexservapitest.mmp
tsrc/public/basic/obexservapitest/inc/ObexServAPItest.h
tsrc/public/basic/obexservapitest/inc/testlogger.h
tsrc/public/basic/obexservapitest/rom/obexservapitest.iby
tsrc/public/basic/obexservapitest/src/ObexServAPItest.cpp
tsrc/public/basic/obexservapitest/src/ObexServAPItestBlocks.cpp
tsrc/public/basic/obexservapitest/src/testlogger.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/atcommands/group/bld.inf	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/btfeatures/btfeatures.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/btfeatures/btfeatures.mmp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/bttoggle/inc/bttoggle.h	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp	Wed Mar 31 21:51: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/group/backup_registration.xml	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" standalone="yes"?>
-<backup_registration>
-    <proxy_data_manager sid = "0x10202BE9" />
-    <dbms_backup policy="0x100069CC" /> 
-    <restore requires_reboot = "no"/>
-</backup_registration>
-  
\ No newline at end of file
--- a/bluetoothengine/bteng/inc/btengincpair.h	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/inc/btengincpair.h	Wed Mar 31 21:51:05 2010 +0300
@@ -176,6 +176,7 @@
      */
     RTimer iPairingOkTimer;
     CBTEngActive* iActivePairingOk;
+    TBool iUserAwarePairing;
     };
 
 #endif /*BTENGINCPAIR_H_*/
--- a/bluetoothengine/bteng/inc/btengprivatecrkeys.h	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/inc/btengprivatecrkeys.h	Wed Mar 31 21:51: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/btengactive.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* 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:  Active object helper class.
-*
-*/
-
-
-
-#include <e32base.h>
-
-#include "btengactive.h"
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// C++ default constructor
-// ---------------------------------------------------------------------------
-//
-CBTEngActive::CBTEngActive(  MBTEngActiveObserver& aObserver, TInt aId, 
-    TInt aPriority )
-:   CActive( aPriority ),
-    iRequestId( aId ),
-    iObserver( aObserver )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-
-// ---------------------------------------------------------------------------
-// Symbian 2nd-phase constructor
-// ---------------------------------------------------------------------------
-//
-void CBTEngActive::ConstructL()
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CBTEngActive* CBTEngActive::NewL( MBTEngActiveObserver& aObserver, 
-    TInt aId, TInt aPriority )
-    {
-    CBTEngActive* self = new( ELeave ) CBTEngActive( aObserver, aId, aPriority );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CBTEngActive::~CBTEngActive()
-    {
-    Cancel();
-    }
-
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Called by the active scheduler when the request has been cancelled.
-// ---------------------------------------------------------------------------
-//
-void CBTEngActive::DoCancel()
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Called by the active scheduler when the request has been completed.
-// ---------------------------------------------------------------------------
-//
-void CBTEngActive::RunL()
-    {
-    iObserver.RequestCompletedL( this, iRequestId, iStatus.Int() );
-    }
-
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Called by the active scheduler when an error in RunL has occurred.
-// ---------------------------------------------------------------------------
-//
-TInt CBTEngActive::RunError( TInt aError )
-    {
-    iObserver.HandleError( this, iRequestId, aError );
-    return KErrNone;
-    }
--- a/bluetoothengine/bteng/src/btengincpair.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/src/btengincpair.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/src/btengpairman.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/src/btengserver.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp	Wed Mar 31 21:51: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/mouse/PaintCursor/src/paintcursorappview.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/PaintCursor/src/paintcursorappview.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/Sesame_client/inc/pointmsgqueue.h	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp	Wed Mar 31 21:51: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/bwins/btcursor_serveru.def	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-EXPORTS
-	?CreateCAnimDllL@@YAPAVCAnimDll@@XZ @ 1 NONAME ; class CAnimDll * CreateCAnimDllL(void)
-	?CreateInstanceL@CMouseCursorSrv@@UAEPAVCAnim@@H@Z @ 2 NONAME ; class CAnim * CMouseCursorSrv::CreateInstanceL(int)
-
--- a/bluetoothengine/bthid/mouse/Sesame_server/eabi/btcursor_serveru.def	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-EXPORTS
-	_Z15CreateCAnimDllLv @ 1 NONAME
-	_ZTI15CMouseCursorSrv @ 2 NONAME ; #<TI>#
-	_ZTI6CImage @ 3 NONAME ; #<TI>#
-	_ZTV15CMouseCursorSrv @ 4 NONAME ; #<VT>#
-	_ZTV6CImage @ 5 NONAME ; #<VT>#
-
--- a/bluetoothengine/bthid/mouse/Sesame_server/group/animation_server.mmp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/Sesame_server/group/animation_server.mmp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/Sesame_server/inc/mousecursorsrv.h	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/bthid/mouse/Sesame_server/src/mousecursorimage.cpp	Wed Mar 31 21:51: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/group/BTMAC.mmp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btmac/group/BTMAC.mmp	Wed Mar 31 21:51:05 2010 +0300
@@ -51,6 +51,7 @@
 SOURCE      btmstempd.cpp
 SOURCE      btmsreconnect.cpp
 SOURCE      btmsdisconnect.cpp
+SOURCE      btmpagescanparametersmanager.cpp
 
 USERINCLUDE ../inc/btmac ../common
 SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/ecom
--- a/bluetoothengine/btmac/inc/btmac/btmman.h	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btmac/inc/btmac/btmman.h	Wed Mar 31 21:51:05 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  the entry of this plugin.
-*  Version     : %version: 12.1.7 %
+*  Version     : %version: 12.1.8 %
 *
 */
 
@@ -38,6 +38,7 @@
 class CBtmState;
 class CBtmActive;
 class CBtmcHandlerApi;
+class CBtmPageScanParametersManager;
 
 /**
  * the main class of BTMAC.
@@ -167,7 +168,11 @@
      * @param aAddr the address of the remote device.
      */
     void SetCmdHandlerRvcSupport( const TBTDevAddr& aAddr );
-    
+
+    void StartedListenning();
+
+    void StoppedListenning();
+
 private:
     // From base class CBTAccPlugin
 
@@ -328,6 +333,8 @@
     TBool iEdr;
     
     CBTEngDiscovery* iBteng;
+
+    CBtmPageScanParametersManager* iPageScanParametersManager;
     };
 
 #endif // C_BTMMAN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btmac/inc/btmac/btmpagescanparametersmanager.h	Wed Mar 31 21:51:05 2010 +0300
@@ -0,0 +1,56 @@
+// 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:
+//
+
+#ifndef BTMPAGESCANPARAMETERSMANAGER_H
+#define BTMPAGESCANPARAMETERSMANAGER_H
+
+#include <e32base.h>
+#include <e32property.h>
+#include "btmactive.h"
+
+class CBtmPageScanParametersManager : public CBase, public MBtmActiveObserver
+    {
+public:
+    static CBtmPageScanParametersManager* NewL();
+    ~CBtmPageScanParametersManager();
+
+    void Activate();
+    void Deactivate();
+
+private:  // From MBtmActiveObserver
+    void RequestCompletedL(CBtmActive& aActive);
+    void CancelRequest(CBtmActive& aActive);
+
+private:
+    void StartTimer(TInt aService, TInt aTimeout);
+    void StopTimer();
+
+    void DisableFastConnection();
+
+protected:
+    CBtmPageScanParametersManager();
+    void ConstructL();
+
+protected:
+    RProperty       iCallStateKey;
+    CBtmActive*     iCallStateListener;
+    RProperty       iPageScanParametersKey;
+    CBtmActive*     iPageScanParametersListener;
+    RTimer          iTimer;
+    CBtmActive*     iTimerActive;
+    TBool           iIsBeingDeactivated;
+    };
+
+#endif // C_BTMSDISCONNECT_H
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcvolume.cpp	Wed Mar 31 21:51: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/btmac/src/btmac/btmman.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btmac/src/btmac/btmman.cpp	Wed Mar 31 21:51:05 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  CBtmMan definition
-*  Version     : %version: 15.1.8 %
+*  Version     : %version: 15.1.9 %
 *
 */
 
@@ -27,6 +27,7 @@
 #include "btmactive.h"
 #include "btmstate.h"
 #include "btmslisten.h"
+#include "btmpagescanparametersmanager.h"
 #include "debug.h"
 
 
@@ -71,6 +72,7 @@
     DeleteAllRegisteredServices();
     delete iBteng;
     iServices.Close();
+    delete iPageScanParametersManager;
     TRACE_FUNC_EXIT
     }
 
@@ -452,10 +454,30 @@
     iEdr = (edr == EBTEScoSupported) ? ETrue : EFalse;
     TRACE_INFO((_L("EDR feature %d"), iEdr))
     iBteng = CBTEngDiscovery::NewL();
+    TRAP_IGNORE(iPageScanParametersManager = CBtmPageScanParametersManager::NewL());
     CBtmState* state = CBtmsListen::NewL(*this);
     CleanupStack::PushL(state);
     ChangeStateL(state);
     CleanupStack::Pop(state);
     TRACE_FUNC_EXIT
     }
-    
+
+void CBtmMan::StartedListenning()
+    {
+    TRACE_FUNC_ENTRY
+    if (iPageScanParametersManager)
+        {
+        iPageScanParametersManager->Activate();
+        }
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmMan::StoppedListenning()
+    {
+    TRACE_FUNC_ENTRY
+    if (iPageScanParametersManager)
+        {
+        iPageScanParametersManager->Deactivate();
+        }
+    TRACE_FUNC_EXIT
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp	Wed Mar 31 21:51:05 2010 +0300
@@ -0,0 +1,295 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "btmpagescanparametersmanager.h"
+#include <ctsydomainpskeys.h>
+#include <bt_subscribe.h>
+#include <bt_subscribe_partner.h>
+#include <bttypespartner.h>
+#include "debug.h"
+
+// in the current configuration an incoming call ringing limit is 30 seconds
+// if for some reason we don't receive the call state change
+// we disable fast connection page scan settings in 35 seconds
+const TInt KFastConnectionTime              = 35000000;
+// a timeout for resetting page scan settings
+// if we don't receive a confirmation we try to reset again
+const TInt KRestoreStandardParametersTime   = 1000000;
+
+const TInt KCallStateListenerService            = 8;
+const TInt KPageScanParametersListenerService   = 9;
+const TInt KFastConnectionService               = 10;
+const TInt KRestoreStandardParametersService    = 11;
+
+CBtmPageScanParametersManager::CBtmPageScanParametersManager()
+    :  iIsBeingDeactivated(EFalse)
+    {
+    }
+
+CBtmPageScanParametersManager::~CBtmPageScanParametersManager()
+    {
+    TRACE_FUNC_ENTRY
+    delete iTimerActive;
+    iTimer.Close();
+    if (iCallStateKey.Handle())
+        {
+        iCallStateKey.Cancel();
+        }
+    delete iPageScanParametersListener;
+    iCallStateKey.Close();
+    if (iPageScanParametersKey.Handle())
+        {
+        iPageScanParametersKey.Cancel();
+        }
+    delete iCallStateListener;
+    iPageScanParametersKey.Close();
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmPageScanParametersManager::ConstructL()
+    {
+    TRACE_FUNC_ENTRY
+    LEAVE_IF_ERROR(iCallStateKey.Attach(KPSUidCtsyCallInformation, KCTsyCallState));
+    iCallStateListener = CBtmActive::NewL(*this, CActive::EPriorityStandard,
+                                          KCallStateListenerService);
+
+    LEAVE_IF_ERROR(iPageScanParametersKey.Attach(KPropertyUidBluetoothCategory,
+                                                 KPropertyKeyBluetoothGetPageScanParameters));
+    iPageScanParametersListener = CBtmActive::NewL(*this, CActive::EPriorityStandard,
+                                                   KPageScanParametersListenerService);
+
+    iTimerActive = CBtmActive::NewL(*this, CActive::EPriorityStandard, KFastConnectionService);
+    TRACE_FUNC_EXIT
+    }
+
+CBtmPageScanParametersManager* CBtmPageScanParametersManager::NewL()
+    {
+    TRACE_STATIC_FUNC_ENTRY
+    CBtmPageScanParametersManager* self = new( ELeave ) CBtmPageScanParametersManager();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CBtmPageScanParametersManager::StartTimer(TInt aService, TInt aTimeout)
+    {
+    if (!iTimerActive->IsActive())
+        {
+        TRACE_FUNC_ENTRY
+        iTimer.CreateLocal();
+        iTimer.After(iTimerActive->iStatus, aTimeout);
+        iTimerActive->SetRequestId(aService);
+        iTimerActive->GoActive();
+        TRACE_FUNC_EXIT
+        }
+    else
+        {
+        TRACE_WARNING(_L("WARNING, page scan manager timer is already active"))
+        }
+    }
+
+void CBtmPageScanParametersManager::StopTimer()
+    {
+    if (iTimerActive->IsActive())
+        {
+        TRACE_FUNC_ENTRY
+        iTimerActive->Cancel();
+        iTimer.Close();
+        TRACE_FUNC_EXIT
+        }
+    }
+
+void CBtmPageScanParametersManager::RequestCompletedL(CBtmActive& aActive)
+    {
+    TRACE_FUNC_ENTRY
+    TRACE_INFO((_L("request id %d status %d"), aActive.RequestId(), aActive.iStatus.Int()))
+    if (aActive.iStatus.Int() == KErrNone)
+        {
+        switch (aActive.RequestId())
+            {
+            case KCallStateListenerService:
+                {
+                iCallStateKey.Subscribe(aActive.iStatus);
+                aActive.GoActive();
+
+                TInt callState;
+                TInt ret = iCallStateKey.Get(callState);
+                if (ret == KErrNone)
+                    {
+                    TRACE_INFO((_L("call state received %d"), callState))
+                    if (callState == EPSCTsyCallStateRinging)
+                        {
+                        // an incoming call ringing => switch to fast page scanning
+                        TRACE_INFO((_L("switching to fast page scanning")))
+                        (void) RProperty::Set(KPropertyUidBluetoothCategory,
+                                              KPropertyKeyBluetoothSetPageScanParameters,
+                                              EFastConnectionPageScanParameters);
+
+                        // we will disable fast page scanning when the timer gets expired
+                        StartTimer(KFastConnectionService, KFastConnectionTime);
+                        }
+                    else if (iTimerActive->IsActive() && iTimerActive->RequestId() == KFastConnectionService)
+                        {
+                        // the incoming call is not ringing anymore => switch to standard page scanning
+                        TRACE_INFO((_L("switching to standard page scanning")))
+                        DisableFastConnection();
+                        }
+                    }
+                break;
+                }
+
+            case KPageScanParametersListenerService:
+                {
+                iPageScanParametersKey.Subscribe(aActive.iStatus);
+                aActive.GoActive();
+
+                TInt pageScanParameters;
+                TInt ret = iPageScanParametersKey.Get(pageScanParameters);
+                if (ret == KErrNone)
+                    {
+                    TRACE_INFO((_L("page scan parameters received %d"), pageScanParameters))
+                    if (iTimerActive->IsActive() && iTimerActive->RequestId() == KRestoreStandardParametersService
+                        && pageScanParameters == EStandardPageScanParameters)
+                        {
+                        TRACE_INFO((_L("standard page scan parameters enabled")))
+                        StopTimer();
+                        if (iIsBeingDeactivated)
+                            {
+                            TRACE_INFO((_L("page scan parameters service is stopped")))
+                            iPageScanParametersKey.Cancel();
+                            }
+                        }
+                    }
+                break;
+                }
+
+            case KFastConnectionService:
+            case KRestoreStandardParametersService:
+                {
+                // try to reset the page scan setting because it hasn't been confirmed yet
+                TRACE_INFO((_L("timer expired, switching to standard page scanning")))
+                DisableFastConnection();
+                break;
+                }
+
+            default:
+                {
+                TRACE_WARNING(_L("WARNING, unknown service"))
+                break;
+                }
+            }
+        }
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmPageScanParametersManager::CancelRequest(CBtmActive& aActive)
+    {
+    TRACE_FUNC_ENTRY
+    switch (aActive.RequestId())
+        {
+        case KFastConnectionService:
+        case KRestoreStandardParametersService:
+            {
+            iTimer.Cancel();
+            break;
+            }
+        default:
+            break;
+        }
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmPageScanParametersManager::DisableFastConnection()
+    {
+    TRACE_FUNC_ENTRY
+    StopTimer();
+
+    // switch to standard page scanning
+    (void) RProperty::Set(KPropertyUidBluetoothCategory,
+                          KPropertyKeyBluetoothSetPageScanParameters,
+                          EStandardPageScanParameters);
+
+    // we will disable fast page scanning when the timer gets expired
+    StartTimer(KRestoreStandardParametersService, KRestoreStandardParametersTime);
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmPageScanParametersManager::Activate()
+    {
+    TRACE_FUNC_ENTRY
+    iIsBeingDeactivated = EFalse;
+
+    if (!iCallStateListener->IsActive())
+        {
+        iCallStateKey.Subscribe(iCallStateListener->iStatus);
+        iCallStateListener->GoActive();
+        }
+    else
+        {
+        TRACE_WARNING(_L("WARNING, call state is already being listened"))
+        }
+
+    if (!iPageScanParametersListener->IsActive())
+        {
+        iPageScanParametersKey.Subscribe(iPageScanParametersListener->iStatus);
+        iPageScanParametersListener->GoActive();
+        }
+    else
+        {
+        TRACE_WARNING(_L("WARNING, call state is already being listened"))
+        }
+
+    TInt callState;
+    TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
+    if(err == KErrNone && callState == EPSCTsyCallStateRinging)
+        {
+        // an incoming call already ringing => switch to fast page scanning
+        TRACE_INFO((_L("call is already ringing, switching to fast page scanning")))
+        (void) RProperty::Set(KPropertyUidBluetoothCategory,
+                              KPropertyKeyBluetoothSetPageScanParameters,
+                              EFastConnectionPageScanParameters);
+
+        // we will disable fast page scanning when the timer gets expired
+        StartTimer(KFastConnectionService, KFastConnectionTime);
+        }
+    TRACE_FUNC_EXIT
+    }
+
+void CBtmPageScanParametersManager::Deactivate()
+    {
+    TRACE_FUNC_ENTRY
+    iIsBeingDeactivated = ETrue;
+
+    // stop call state listening
+    iCallStateKey.Cancel();
+
+    if (iTimerActive->IsActive())
+        {
+        // if fast page scanning is active, disable it
+        // if we're already switching to standard page scanning, do nothing
+        if (iTimerActive->RequestId() == KFastConnectionService)
+            {
+            TRACE_INFO((_L("deactivation started, switching to standard page scanning")))
+            DisableFastConnection();
+            }
+        }
+    else
+        {
+        // if no timer is active we just stop page scan parameters listening
+        iPageScanParametersKey.Cancel();
+        }
+    TRACE_FUNC_EXIT
+    }
--- a/bluetoothengine/btmac/src/btmac/btmslisten.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btmac/src/btmac/btmslisten.cpp	Wed Mar 31 21:51:05 2010 +0300
@@ -43,6 +43,7 @@
     {
     delete iHfpSock;
     delete iHspSock;
+    Parent().StoppedListenning();
     }
 
 void CBtmsListen::EnterL()
@@ -83,6 +84,7 @@
     TRACE_STATE((_L("[BTMAC State] Start EBTProfileHSP, last used port %d"), lastUsedPort)) 
     Parent().RegisterServiceL(ag, iHspSock->ListenL(ag, sec,lastUsedPort));
     iHspSock->SetService(EBTProfileHSP);
+    Parent().StartedListenning();
     }
 
 void CBtmsListen::OpenAudioLinkL(const TBTDevAddr& aAddr, TRequestStatus& aStatus)
--- a/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/inc/btnotifier.h	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/src/BTNotifier.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/group/bld.inf	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ /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	Mon Mar 15 12:41:15 2010 +0200
+++ b/tsrc/public/basic/conf/test.xml	Wed Mar 31 21:51: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	Mon Mar 15 12:41:15 2010 +0200
+++ b/tsrc/public/basic/group/bld.inf	Wed Mar 31 21:51: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
--- a/tsrc/public/basic/obexservapitest/Bmarm/ObexServAPItestU.DEF	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
-
--- a/tsrc/public/basic/obexservapitest/Bwins/ObexServAPItestU.DEF	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
-
--- a/tsrc/public/basic/obexservapitest/EABI/ObexServAPItestU.def	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
-
--- a/tsrc/public/basic/obexservapitest/group/bld.inf	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* Copyright (c) 2002 - 2007 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:  ?Description
-*
-*/
-
-
-
-PRJ_PLATFORMS
-// specify the platforms your component needs to be built for here
-// defaults to WINS MARM so you can ignore this if you just build these
-DEFAULT
-
-PRJ_TESTEXPORTS
-// NOTE: If using ARS requirements all export operations should be done under this.
-// 'abld test export'
-
-PRJ_EXPORTS
-// Specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-// Example: 
-/*
-/agnmodel/inc/AGMCOMON.H
-*/
-
-PRJ_TESTMMPFILES
-// NOTE: If using ARS requirements .mmp file operation should be done under this.
-// 'abld test build'
-
-PRJ_MMPFILES
-// Specify the .mmp files required for building the important component
-// releasables.
-//
-// Specify "tidy" if the component you need to build doesn't need to be
-// released. Specify "ignore" if the MMP file exists but should be
-// ignored.
-// Example:
-/*
-/agnmodel/group/agnmodel.mmp
-#if defined(MARM)
-/agnmodel/group/agsvexe.mmp
-#endif
-*/
-obexservapitest.mmp
-
-//  End of File
\ No newline at end of file
--- a/tsrc/public/basic/obexservapitest/group/obexservapitest.mmp	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*TYPE TESTCLASS*/
-/*
-* Copyright (c) 2002 - 2007 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:  ?Description
-*
-*/
-
-
-#if defined(__S60_)
-        // To get the OS_LAYER_SYSTEMINCLUDE-definition
-        #include <platform_paths.hrh>
-#endif
-
-TARGET          obexservapitest.dll
-TARGETTYPE      dll
-UID             0x1000008D 0x101FB3E3
-
-CAPABILITY      ALL -TCB
-/* Remove comments and replace 0x00000000 with correct vendor id */
-// VENDORID     0x00000000
-/* Remove comments and replace 0x00000000 with correct secure id */
-// SECUREID     0x00000000
-
-//TARGETPATH      ?target_path
-DEFFILE         ObexServAPItest.def
-
-SOURCEPATH      ../src
-SOURCE          ObexServAPItest.cpp
-SOURCE          ObexServAPItestBlocks.cpp
-SOURCE          testlogger.cpp
-
-
-USERINCLUDE     ../inc 
-
-MW_LAYER_SYSTEMINCLUDE
-
-
-LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         sysutil.lib
-LIBRARY         obexutils.lib
-LIBRARY         irobex.lib
-LIBRARY         efsrv.lib
-
-LANG            SC
-
-// End of File
--- a/tsrc/public/basic/obexservapitest/inc/ObexServAPItest.h	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*
-* Copyright (c) 2002 - 2007 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:  ?Description
-*
-*/
-
-
-
-#ifndef OBEXSERVAPITEST_H
-#define OBEXSERVAPITEST_H
-
-//  INCLUDES
-#include <StifLogger.h>
-#include <TestScripterInternal.h>
-#include <StifTestModule.h>
-#include <ObexUtilsMessageHandler.h>
-#include "testlogger.h"
-
-
-// FORWARD DECLARATIONS
-class CObexServAPItest;
-
-
-// CLASS DECLARATION
-
-/**
-*  CObexServAPItest test class for STIF Test Framework TestScripter.
-*/
-NONSHARABLE_CLASS(CObexServAPItest) : public CScriptBase
-    {
-    public:  // Constructors and destructor
-
-        /**
-        * Two-phased constructor.
-        */
-        static CObexServAPItest* NewL( CTestModuleIf& aTestModuleIf );
-
-        /**
-        * Destructor.
-        */
-        virtual ~CObexServAPItest();
-
-    public: // New functions
-
-       
-
-    public: // Functions from base classes
-
-        /**
-        * From CScriptBase Runs a script line.
-        * @since ?Series60_version
-        * @param aItem Script line containing method name and parameters
-        * @return Symbian OS error code
-        */
-        virtual TInt RunMethodL( CStifItemParser& aItem );
-
-    
-
-    private:
-
-        /**
-        * C++ default constructor.
-        */
-        CObexServAPItest( CTestModuleIf& aTestModuleIf );
-
-        /**
-        * By default Symbian 2nd phase constructor is private.
-        */
-        void ConstructL();
-
-        // Prohibit copy constructor if not deriving from CBase.
-        // ?classname( const ?classname& );
-        // Prohibit assigment operator if not deriving from CBase.
-        // ?classname& operator=( const ?classname& );
-
-        /**
-        * Frees all resources allocated from test methods.
-        * @since ?Series60_version
-        */
-        void Delete();
-        
-        void TestCompleted( TInt aErr, const TUint8* aFunc, const TDesC& aArg );
-
-        /**
-        * Test methods are listed below. 
-        */
-
-        /**
-        * Test code for getting file system status.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt GetFileSystemStatusL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for getting mmc file system status.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt GetMmcFileSystemStatusL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for getting message center drive. 
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt GetMessageCentreDriveL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for creating Default MTM services.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt CreateDefaultMtmServiceL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for Getting CenRep key.    .    
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt GetCenRepKeyIntValueL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for Getting PubSub key.    
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt GetPubSubKeyIntValueL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for Creating outbox entry.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt CreateOutBoxEntryL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for removing outbox entry.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt RemoveOutBoxEntryL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for save received file to inbox. 
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt SaveObjToInboxL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for creating entry to inbox.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt CreateEntryToInboxL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for creating entry to inbox.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt SaveRFileObjectToInboxL( CStifItemParser& aItem );
-        
-        /**
-        * Test code for removing entry to inbox.
-        * @since ?Series60_version
-        * @param aItem Script line containing parameters.
-        * @return Symbian OS error code.
-        */
-        virtual TInt RemoveObjectL( CStifItemParser& aItem );
-        
-     
-
-    private:    // Data
-        
-        
-        
-         TMsvId           iMessageServerIndex;
-         CObexBufObject*  iObexObject; 
-         RFile            iFile;
-         CBufFlat*        iBuf; 
-         CObexTestLogger* iTestLogger;
-
-    };
-
-#endif      // OBEXSERVAPITEST_H
-
-// End of File
--- a/tsrc/public/basic/obexservapitest/inc/testlogger.h	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2007 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:
-*
-*/
-
-
-#ifndef BTTESTLOGGER_H
-#define BTTESTLOGGER_H
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class CStifLogger;
-class CTestModuleIf;
-
-#define TLFUNCLOG (TUint8*) __FUNCTION__
-
-// CLASS DECLARATION
-
-NONSHARABLE_CLASS( CObexTestLogger ) : public CBase
-{
-	public:
-	
-		static CObexTestLogger* NewL(const CTestModuleIf* aTestModuleIf);
-		virtual ~CObexTestLogger();
-
-	public: // Data used by functions
-
-		enum TLogLevel {ETLError, ETLResult, ETLInfo, ETLDebug};
-
-	public: // New functions
-	
-		TBool GetEnabled() const;
-		CStifLogger* GetLogger() const;
-		const CTestModuleIf* GetTestModuleIf() const;
-		TInt Log(TLogLevel aLevel, TRefByValue<const TDesC8> aLogText, ...) const;
-		TInt Log(const TDesC& aCategory, TRefByValue<const TDesC8> aLogText, ...) const;
-		TInt Log(TLogLevel aLevel, TRefByValue<const TDesC16> aLogText, ...) const;
-		TInt Log(const TDesC& aCategory, TRefByValue<const TDesC16> aLogText, ...) const;
-		TInt LogResult( const TDesC8& aFunc, const TDesC& aArg, TInt aRes ) const;
-		TInt LogNewLine() const;
-		void SetEnabled(TBool aEnabled);
-		void SetLogger(CStifLogger* aLog);
-		void SetTestModuleIf(const CTestModuleIf* aTestModuleIf);
-
-	public: // Functions from base classes
-
-	private:  // New functions
-
-		TInt WriteLog(TLogLevel aLevel, TDes16& aLog) const;
-		TInt WriteLog(const TDesC16& aCategory, const TDesC16& aLog) const;
-		static TPtrC GetPrefix(TLogLevel aLevel);
-		TInt CheckLogFile();
-		void LogHeadSectionL();
-		void LogTimeStampL(TDes& aBuf, TBool aTime = ETrue) const;
-
-	private:  // Constructors
-	
-		CObexTestLogger(const CTestModuleIf* aTestModuleIf);
-		void ConstructL();
-
-	public:     // Data
-		static const TInt KPrefixLength;
-
-	private:    // Data
-
-		TBool iEnabled;
-		CStifLogger* iLog;
-		const CTestModuleIf* iTestModuleIf;
-	};
-
-#endif // BTTESTLOGGER_H
-
--- a/tsrc/public/basic/obexservapitest/rom/obexservapitest.iby	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2007-2007 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 bteng
-*
-*/
-
-#ifndef BTENGAPITEST_IBY
-#define BTENGAPITEST_IBY
-
-#include <data_caging_paths_for_iby.hrh>
-
-file=ABI_DIR\BUILD_DIR\ObexServAPItest.dll			SHARED_LIB_DIR\ObexServAPItest.dll
-
-#endif // BTENGAPITEST_IBY
--- a/tsrc/public/basic/obexservapitest/src/ObexServAPItest.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2002 - 2007 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:  ?Description
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <Stiftestinterface.h>
-#include "ObexServAPItest.h"
-
-// EXTERNAL DATA STRUCTURES
-//extern  ?external_data;
-
-// EXTERNAL FUNCTION PROTOTYPES  
-//extern ?external_function( ?arg_type,?arg_type );
-
-// CONSTANTS
-//const ?type ?constant_var = ?constant;
-
-// MACROS
-//#define ?macro ?macro_def
-
-// LOCAL CONSTANTS AND MACROS
-//const ?type ?constant_var = ?constant;
-//#define ?macro_name ?macro_def
-
-// MODULE DATA STRUCTURES
-//enum ?declaration
-//typedef ?declaration
-
-// LOCAL FUNCTION PROTOTYPES
-//?type ?function_name( ?arg_type, ?arg_type );
-
-// FORWARD DECLARATIONS
-//class ?FORWARD_CLASSNAME;
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// ?function_name ?description.
-// ?description
-// Returns: ?value_1: ?description
-//          ?value_n: ?description_line1
-//                    ?description_line2
-// -----------------------------------------------------------------------------
-//
-/*
-?type ?function_name(
-    ?arg_type arg,  // ?description
-    ?arg_type arg)  // ?description
-    {
-
-    ?code  // ?comment
-
-    // ?comment
-    ?code
-    }
-*/
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::CObexServAPItest
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CObexServAPItest::CObexServAPItest( 
-    CTestModuleIf& aTestModuleIf ):
-        CScriptBase( aTestModuleIf )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CObexServAPItest::ConstructL()
-    {
-    
-    iTestLogger = CObexTestLogger::NewL( &TestModuleIf() );         
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CObexServAPItest* CObexServAPItest::NewL( 
-    CTestModuleIf& aTestModuleIf )
-    {
-    CObexServAPItest* self = new (ELeave) CObexServAPItest( aTestModuleIf );
-
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-
-    return self;
-
-    }
-
-// Destructor
-CObexServAPItest::~CObexServAPItest()
-    { 
-
-    // Delete resources allocated from test methods
-    Delete();
-
-    // Delete logger
-    delete iTestLogger; 
-    iTestLogger = NULL;
-    }
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// -----------------------------------------------------------------------------
-// LibEntryL is a polymorphic Dll entry point.
-// Returns: CScriptBase: New CScriptBase derived object
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CScriptBase* LibEntryL( 
-    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
-    {
-
-    return ( CScriptBase* ) CObexServAPItest::NewL( aTestModuleIf );
-
-    }
-
-
-//  End of File
--- a/tsrc/public/basic/obexservapitest/src/ObexServAPItestBlocks.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,414 +0,0 @@
-/*
-* Copyright (c) 2002 - 2007 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:  ?Description
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <e32svr.h>
-#include <StifParser.h>
-#include <Stiftestinterface.h>
-#include <UiklafInternalCRKeys.h>
-#include <UikonInternalPSKeys.h>
-#include <obexutils.rsg>
-#include <obex.h>
-#include "testlogger.h"
-#include "ObexServAPItest.h"
-
-
-// Defined to coincide with the definition in btmsgtypeuid.h 
-const TUid KUidMsgTypeBt                 = {0x10009ED5};
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::Delete
-// Delete here all resources allocated and opened from test methods. 
-// Called from destructor. 
-// -----------------------------------------------------------------------------
-//
-void CObexServAPItest::Delete() 
-    {
-    delete iObexObject;
-    iObexObject = NULL;
-    delete iBuf;
-    iBuf = NULL;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::RunMethodL
-// Run specified method. Contains also table of test mothods and their names.
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::RunMethodL( 
-    CStifItemParser& aItem ) 
-    {
-
-    static TStifFunctionInfo const KFunctions[] =
-        {  
-        // Copy this line for every implemented function.
-        // First string is the function name used in TestScripter script file.
-        // Second is the actual implementation member function. 
-        ENTRY( "GetFileSystemStatus", CObexServAPItest::GetFileSystemStatusL ),
-        ENTRY( "GetMmcFileSystemStatus", CObexServAPItest::GetMmcFileSystemStatusL ),
-        ENTRY( "GetMessageCentreDriveL", CObexServAPItest::GetMessageCentreDriveL ),
-        ENTRY( "CreateDefaultMtmServiceL", CObexServAPItest::CreateDefaultMtmServiceL ),
-        ENTRY( "GetCenRepKeyIntValueL", CObexServAPItest::GetCenRepKeyIntValueL ),
-        ENTRY( "GetPubSubKeyIntValue", CObexServAPItest::GetPubSubKeyIntValueL ),
-        ENTRY( "CreateOutBoxEntry", CObexServAPItest::CreateOutBoxEntryL ),
-        ENTRY( "RemoveOutBoxEntry", CObexServAPItest::RemoveOutBoxEntryL ),
-        ENTRY( "SaveObjToInbox", CObexServAPItest::SaveObjToInboxL ),
-        ENTRY( "CreateEntryToInbox", CObexServAPItest::CreateEntryToInboxL ),
-        ENTRY( "SaveRFileObjectToInbox", CObexServAPItest::SaveRFileObjectToInboxL ),
-        ENTRY( "RemoveObjectFromInbox", CObexServAPItest::RemoveObjectL ),
-        };
-
-    const TInt count = sizeof( KFunctions ) / 
-                        sizeof( TStifFunctionInfo );
-
-    return RunInternalL( KFunctions, count, aItem );
-
-    }
-    
- // -----------------------------------------------------------------------------
-// CBtApiTest::TestCompleted
-// -----------------------------------------------------------------------------
-//  
-void CObexServAPItest::TestCompleted( TInt aErr, const TUint8* aFunc, const TDesC& aArg )
-    {
-    iTestLogger->LogResult( (TPtrC8( aFunc )), aArg, aErr );
-    Signal( aErr );
-    }
-       
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::GetFileSystemStatusL
-// Test code for getting file system status.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::GetFileSystemStatusL( CStifItemParser& /*aItem*/ )
-    {
-    // Print to log file
-    TInt retVal=TObexUtilsMessageHandler::GetFileSystemStatus();
-    if (retVal == 0 || retVal == KErrDiskFull)
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("GetFileSystemStatusL"));
-        }
-    else
-        {
-        TestCompleted( retVal, TLFUNCLOG, _L("Error getting files ystem status"));    
-        }    
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::GetMmcFileSystemStatusL
-// Test code for getting mmc file system status.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::GetMmcFileSystemStatusL( CStifItemParser& /*aItem*/ )
-    {
-    TInt retVal=TObexUtilsMessageHandler::GetMmcFileSystemStatus();
-    if (retVal == 0 || retVal == KErrDiskFull)
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("GetFileSystemStatusL"));
-        }
-    else
-        {
-        TestCompleted( retVal, TLFUNCLOG, _L("Error getting files ystem status"));    
-        }    
-
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::GetMessageCentreDriveL
-// Test code for getting message center drive. 
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::GetMessageCentreDriveL( CStifItemParser& /*aItem*/ )
-    {
-    
-    TInt retVal = TObexUtilsMessageHandler::GetMessageCentreDriveL();
-    if (retVal >= 0 )
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("GetMessageCentreDrive"));
-        }
-    else
-        {
-        TestCompleted( retVal, TLFUNCLOG, _L("GetMessageCentreDrive failed"));    
-        }    
-
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::CreateDefaultMtmServiceL
-// Test code for creating Default MTM services.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::CreateDefaultMtmServiceL( CStifItemParser& /*aItem*/ )
-    {
-
-    TRAPD(error, TObexUtilsMessageHandler::CreateDefaultMtmServiceL(KUidMsgTypeBt) );
-    if (error == KErrNone)
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("CreateDefaultMtmServiceL"));        
-        }
-    else
-        {
-        TestCompleted( error, TLFUNCLOG, _L("CreateDefaultMtmServiceL"));                       
-        }
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::GetCenRepKeyIntValueL
-// Test code for Getting CenRep key.    
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::GetCenRepKeyIntValueL( CStifItemParser&  /*aItem*/ )
-    {
-    TInt limit=0;    
-    TInt error=0;
-    TRAPD(leaveVal, error = TObexUtilsMessageHandler::GetCenRepKeyIntValueL(KCRUidUiklaf,
-                                                                KUikOODDiskCriticalThreshold,
-                                                                limit));
-    if( leaveVal != KErrNone ) 
-        {
-        TestCompleted( leaveVal, TLFUNCLOG, _L("GetCenRepKeyIntValueL leaves"));                       
-        }    
-    else if (error == KErrNone)
-        {
-        TestCompleted( leaveVal, TLFUNCLOG, _L("GetCenRepKeyIntValue return error"));                       
-        }   
-    else
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("GetCenRepKeyIntValueL"));                           
-        }    
-    
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::GetPubSubKeyIntValueL
-// Test code for Getting PubSub key.    
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::GetPubSubKeyIntValueL( CStifItemParser& /*aItem*/ )
-    {
-    TInt status = KErrNone;
-    TInt retVal = KErrNone;
-    
-    TRAPD(leaveVal, retVal = TObexUtilsMessageHandler::GetPubSubKeyIntValue(KPSUidUikon, KUikFFSFreeLevel, status));
-    
-    if( leaveVal != KErrNone ) 
-        {
-        TestCompleted( leaveVal, TLFUNCLOG, _L("GetPubSubKeyIntValueL leaves"));                       
-        }    
-    else if (retVal == KErrNone)
-        {
-        TestCompleted( retVal, TLFUNCLOG, _L("GetPubSubKeyIntValueL return error"));                       
-        }   
-    else
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("GetPubSubKeyIntValue"));                           
-        }  
-
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::OutBoxEntryL
-// Test code for Creating outbox entry.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::CreateOutBoxEntryL( CStifItemParser& /*aItem*/ )
-    {    
-    TRAPD(error, iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ));  
-    if( error != KErrNone)
-        {
-        TestCompleted( error, TLFUNCLOG, _L("CreateOutBoxEntryL leaves")); 
-        }
-    else     
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("CreateOutBoxEntryL"));     
-        }
-
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::OutBoxEntryL
-// Test code for removing outbox entry.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::RemoveOutBoxEntryL( CStifItemParser& /*aItem*/ )
-    {   
-    
-    TRAPD(error, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ));
-    if( error != KErrNone)
-        {
-        TestCompleted( error, TLFUNCLOG, _L("RemoveOutBoxEntryL leaves")); 
-        }
-    else     
-        {
-        TestCompleted( KErrNone, TLFUNCLOG, _L("RemoveOutBoxEntryL"));     
-        }
-    return KErrNone;
-
-    }
-    
-// -----------------------------------------------------------------------------
-// CObexServAPItest::SaveObjToInboxL
-// Test code for save received file to inbox. 
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::SaveObjToInboxL( CStifItemParser& /*aItem*/ )
-    {   
-    
-    CObexBufObject* obexobject = CObexBufObject::NewL( NULL );
-    CleanupStack::PushL(obexobject);    
-    
-    TRAP_IGNORE(TObexUtilsMessageHandler::SaveObjToInboxL(obexobject ,
-                                              KNullDesC, 
-                                              KUidMsgTypeBt ));
-    TestCompleted( KErrNone, TLFUNCLOG, _L("SaveObjToInboxL leaves")); 
-    
-    CleanupStack::PopAndDestroy(obexobject);
-    return KErrNone;
-
-    }
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::CreateAndSaveObjectL
-// Test code for creating entry to inbox.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::CreateEntryToInboxL( CStifItemParser& /*aItem*/ )
-    {
-    iFile = RFile();
-    
-    if ( iObexObject)
-        {
-        delete iObexObject;
-        iObexObject = NULL;
-        }
-        
-    iObexObject = CObexBufObject::NewL( NULL );
-    
-    TRAPD( error, TObexUtilsMessageHandler::CreateInboxAttachmentL( iObexObject,
-                                                      KUidMsgTypeBt,
-                                                      iMessageServerIndex,
-                                                      iFile));
-                                                      
-                                                      
-    iBuf = CBufFlat::NewL(1024);
-    iBuf->ResizeL(1024);
-    
-    TObexRFileBackedBuffer bufferdetails(*iBuf,iFile,CObexBufObject::EDoubleBuffering);    
-    
-    TRAP_IGNORE( iObexObject->SetDataBufL( bufferdetails) );
-    
-                                                      
-                                                      
-    iFile.Write(_L8("test"));    
-    iObexObject->SetNameL(_L("test.txt"));        
-    
-    if( error != KErrNone)
-        {
-        TestCompleted( error, TLFUNCLOG, _L("CreateEntryToInboxL leaves")); 
-        }    
-    else     
-        {
-        TestCompleted( error, TLFUNCLOG, _L("CreateEntryToInboxL"));     
-        }         
-    return KErrNone;
-    }
-
-
-// -----------------------------------------------------------------------------
-// CObexServAPItest::CreateAndSaveObjectL
-// Test code for creating entry to inbox.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::SaveRFileObjectToInboxL( CStifItemParser& /*aItem*/ )
-    {
-    TRAPD( error, TObexUtilsMessageHandler::SaveObjToInboxL(
-            iObexObject,
-            iFile,
-            iMessageServerIndex));
-    
-    delete iBuf;
-    iBuf = NULL;
-    if( error != KErrNone)
-        {
-        TestCompleted( error, TLFUNCLOG, _L("SaveObjToInboxL leaves")); 
-        }
-    else     
-        {
-        TestCompleted( error, TLFUNCLOG, _L("SaveObjToInboxL"));     
-        }                                          
-    
-    return KErrNone;
-    }
-    
-// -----------------------------------------------------------------------------
-// CObexServAPItest::RemoveObjectL
-// Test code for removing entry to inbox.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt CObexServAPItest::RemoveObjectL( CStifItemParser& /*aItem*/ )
-    {
-    TRAPD(error,TObexUtilsMessageHandler::RemoveInboxEntriesL(iObexObject, iMessageServerIndex));    
-    delete iBuf;
-    iBuf = NULL;
-    if( error != KErrNone)
-        {
-        TestCompleted( error, TLFUNCLOG, _L("SaveObjToInboxL leaves")); 
-        }
-    else     
-        {
-        TestCompleted( error, TLFUNCLOG, _L("SaveObjToInboxL"));     
-        }                                              
-    return KErrNone;
-    }
-
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-// None
-
-//  End of File
--- a/tsrc/public/basic/obexservapitest/src/testlogger.cpp	Mon Mar 15 12:41:15 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,530 +0,0 @@
-/*
-* Copyright (c) 2007 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:
-*
-*/
-
-// INCLUDES
-
-#include "testlogger.h"
-
-#include <StifTestModule.h>
-#include <StifLogger.h>
-
-#include <e32std.h>
-#include <f32file.h>
-#include <sysutil.h>
-
-// RDebug
-#include <e32debug.h>
-
-const TInt CObexTestLogger::KPrefixLength = 8;
-// Timestamp string length
-const TInt KTimeStampStrLen = 21;
-// Extended Timestamp string length
-const TInt KExtTimeStampStrLen = 40;
-// Extended time stamp
-typedef TBuf<KExtTimeStampStrLen> TExtTimeStamp;
-// Logging path
-_LIT( KObexServAPITestSystemLogPath, "e:\\logs\\ObexServAPItest\\" );
-// Log file
-_LIT( KObexServAPITestSystemLogFile, "ObexServAPItest.html" );
-// Log file
-_LIT( KObexServAPITestSystemLogFullName, "\\logs\\ObexServAPItest\\ObexServAPItest%x.html" );
-// Time stamp format string
-_LIT( KFormatTimeStamp, "<br/>[%H:%T:%S.%*C4] " );
-// Date format string
-_LIT( KFormatDate, "%F%D %N %Y" );
-// HTML header section
-_LIT( KHtmlHeadSection, "<html>\n<head>\n<title>Obex Message Handler Test System results</title>\n<style type=\"text/css\">\n.res, .case { display: inline; }\n</style>\n</head>\n\n<body onLoad=\"FormatResults();\">\n\n" );
-// HTML code which will display the statistics
-_LIT( KHtmlStatSection, "<p>Logfile created on %S at %S<br />\nS60 version %S</p>\n\n<div id=\"stats\"></div>\n<br />\n\n" );
-// HTML identifier for test case start
-_LIT( KHtmlTestCaseStart, "<div class=\"case\">" );
-// Test case result logging
-_LIT( KTestCaseResult, "Test completed; function %S, parameter %S, result <div class=\"res\">%d</div></div>" );
-// JavaScript function for calculating test result
-#define KJSSECTION _L( "<script type=\"text/javascript\">\nfunction FormatResults() { \
-\n\tvar tl = document.getElementsByTagName( \"div\" );\n\tvar passed = 0, failed = 0, testcases = 0; \
-\n\tfor( var i = 0; i < tl.length; i++ ) {\n\t\tif( tl[i].className == \"case\" ) {\n\t\t\ttestcases++;\n\t\t\t} \
-\n\t\tif( tl[i].className == \"res\" ) {\n\t\t\tif( tl[i].innerHTML == 0 ) {\n\t\t\t\tpassed++;\n\t\t\t\t} \
-\n\t\t\telse {\n\t\t\t\tfailed++;\n\t\t\t\ttl[i].parentNode.style.color = \"red\";\n\t\t\t\t} } } \
-\n\tvar stat = document.getElementById( \"stats\" );\n\tvar passrate = Math.round( ( passed / testcases ) * 10000 ) / 100; \
-\n\tstat.innerHTML = \"Test cases run: \" + testcases + \"<br />Passed: \" + passed \
-+\"<br />Failed: \" + failed + \"<br /><b>Passrate: \" + passrate + \"%%</b>\";\n\t}\n</script>" )
-
-// Construction and destruction.
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::NewL
-// Static constructor to constructor builder objects.
-// -----------------------------------------------------------------------------
-//
-CObexTestLogger* CObexTestLogger::NewL(const CTestModuleIf* aTestModuleIf)
-	{
-	CObexTestLogger* self = new (ELeave) CObexTestLogger(aTestModuleIf);
-
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop(self);
-
-	return self;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::CObexTestLogger
-// Constructor.
-// -----------------------------------------------------------------------------
-//
-CObexTestLogger::CObexTestLogger(const CTestModuleIf* aTestModuleIf)
-	: CBase(),
-	  iEnabled(ETrue),
-	  iTestModuleIf(aTestModuleIf)
-	{
-	}
-
-// -----------------------------------------------------------------------------
-// CTestLogger::ConstructL
-// 2nd phase constructor.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::ConstructL()
-    {
-    TInt err = CheckLogFile();
-    iLog = CStifLogger::NewL( KObexServAPITestSystemLogPath, KObexServAPITestSystemLogFile,
-                              CStifLogger::ETxt, CStifLogger::EFile, EFalse, EFalse );
-    if( err == KErrNotFound )
-        {   // Add info & HTML markup to the beginning of the log file.
-        LogHeadSectionL();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::~CObexTestLogger
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CObexTestLogger::~CObexTestLogger()
-	{
-	delete iLog;
-	}
-
-// Member functions.
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::GetLogger
-// Returns a pointer to current STIF logger.
-// -----------------------------------------------------------------------------
-//
-CStifLogger* CObexTestLogger::GetLogger() const
-	{
-	return iLog;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::GetTestModuleIf
-// Returns a pointer to current STIF test module interface.
-// -----------------------------------------------------------------------------
-//
-const CTestModuleIf* CObexTestLogger::GetTestModuleIf() const
-	{
-	return iTestModuleIf;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::Log
-// Logs 8 bit data to screen and file.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::Log(TLogLevel aLevel, TRefByValue<const TDesC8> aLogText, ...) const
-    {
-    if (!iEnabled)
-        {
-        return KErrNone;
-        }
-
-    const TDesC8& actualData = aLogText;
-
-    // Check that user does not try to output too much data.
-    if (actualData.Length() > KMaxLogData - KPrefixLength)
-        {
-        return KErrTooBig;
-        }
-
-    // Buffer to convert 8 bit data to to 16 bit.
-    TLogInfo8 converter;
-
-    // Create variable argument list.
-    VA_LIST args;
-    VA_START(args, aLogText);
-
-    // Format the argument list to the output buffer.
-    converter.FormatList( aLogText, args );
-
-    // Free the variable argument list
-    VA_END(args);
-
-    TLogInfo buffer;
-    buffer.Copy( converter );
-
-    // Append log prefix to the output buffer.
-    buffer.Insert( 0, GetPrefix( aLevel ) );
-
-    // Log a timestamp
-    TStifLoggerTimeStamp8 time;
-    TRAP_IGNORE( LogTimeStampL( time ) );
-    buffer.Insert( 0, time );
-
-    // Write log.
-    return WriteLog(aLevel, buffer);
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::Log
-// Logs 8 bit data to screen and file.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::Log(const TDesC& aCategory, TRefByValue<const TDesC8> aLogText, ...) const
-    {
-    if (!iEnabled)
-	    {
-        return KErrNone;
-        }
-
-    const TDesC8& actualData = aLogText;
-
-    // Check that user does not try to output too much data.
-    if (actualData.Length() > KMaxLogData - KPrefixLength)
-        {
-        return KErrTooBig;
-        }
-
-    // Buffer to convert 8 bit data to to 16 bit.
-    TLogInfo8 converter;
-
-    // Create variable argument list.
-    VA_LIST args;
-    VA_START(args, aLogText);
-
-    // Format the argument list to the output buffer.
-    converter.FormatList(aLogText, args);
-
-    // Free the variable argument list
-    VA_END(args);
-
-    TLogInfo buffer;
-    buffer.Copy( converter );
-
-    // Log a timestamp
-    TStifLoggerTimeStamp8 time;
-    TRAP_IGNORE( LogTimeStampL( time ) );
-    buffer.Insert( 0, time );
-
-    // Write log.
-    return WriteLog(aCategory, buffer);
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::Log
-// Logs 16 bit data to screen and file.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::Log(TLogLevel aLevel, TRefByValue<const TDesC16> aLogText, ...) const
-	{
-	if (!iEnabled)
-		{
-		return KErrNone;
-		}
-
-	const TDesC16& actualData = aLogText;
-	// Check that user does not try to output too much data.
-	if (actualData.Length() + KPrefixLength > KMaxLogData)
-		{
-		return KErrTooBig;
-		}
-
-	TLogInfo buffer;
-
-	// Log a timestamp
-	TRAP_IGNORE( LogTimeStampL( buffer ) );
-
-	// Create variable argument list.
-	VA_LIST args;
-	VA_START(args, aLogText);
-
-	// Format the argument list to the output buffer.
-	buffer.AppendFormatList(aLogText, args);
-
-	// Free the variable argument list
-	VA_END(args);
-
-	// Write log.
-	return WriteLog(aLevel, buffer);
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::Log
-// Logs 16 bit data to screen and file.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::Log(const TDesC& aCategory, TRefByValue<const TDesC16> aLogText, ...) const
-	{
-	if (!iEnabled)
-		{
-		return KErrNone;
-		}
-
-	const TDesC16& actualData = aLogText;
-	// Check that user does not try to output too much data.
-	if (actualData.Length() + KPrefixLength > KMaxLogData)
-		{
-		return KErrTooBig;
-		}
-
-	TLogInfo buffer;
-
-	// Log a timestamp
-	TRAP_IGNORE( LogTimeStampL( buffer ) );
-
-	// Create variable argument list.
-	VA_LIST args;
-	VA_START(args, aLogText);
-
-	// Format the argument list to the output buffer.
-	buffer.AppendFormatList(aLogText, args);
-
-	// Free the variable argument list
-	VA_END(args);
-
-	// Write log.
-	return WriteLog(aCategory, buffer);
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::LogNewLine
-// Logs an HTML  newline and timestamp.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::LogResult( const TDesC8& aFunc, const TDesC& aArg, TInt aRes ) const
-    {
-    TExtTimeStamp func;
-    func.Copy( aFunc ); // Copy 8-bit string to 16-bit buffer
-
-    Log( CObexTestLogger::ETLResult, KTestCaseResult, &func, &aArg, aRes );
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::LogNewLine
-// Logs an HTML  newline and timestamp.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::LogNewLine() const
-    {
-    if (!iEnabled)
-        {
-        return KErrNone;
-        }
-    TExtTimeStamp time;
-    TRAPD( err, LogTimeStampL( time ) );
-    if( !err )
-        {
-        time.Insert( 0, KHtmlTestCaseStart );
-        err = iLog->Log( time );
-        }
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::SetEnabled
-// Returns a pointer to current STIF logger.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::SetEnabled(TBool aEnabled)
-	{
-	iEnabled = aEnabled;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::SetLogger
-// Sets a pointer to current STIF logger.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::SetLogger(CStifLogger* aLog)
-	{
-	iLog = aLog;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::SetTestModuleIf
-// Sets a pointer to current STIF test module.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::SetTestModuleIf(const CTestModuleIf* aTestModuleIf)
-	{
-	iTestModuleIf = aTestModuleIf;
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::WriteLog
-// Writes log.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::WriteLog(TLogLevel aLevel, TDes16& aLog) const
-    {
-    // Write log to file if file logger is available.
-    if (iLog != 0)
-        {
-        iLog->Log(aLog);
-        }
-    // Remove the timestamp from the logging data.
-    TPtrC16 log( aLog.Mid( KTimeStampStrLen ) );
-
-    // Write log with RDebug.
-    RDebug::Print(log);
-
-    // Write log to screen if test module interface is available.
-	if (iTestModuleIf != 0)
-        {
-        CTestModuleIf* nonStaticLogger = const_cast<CTestModuleIf*>(iTestModuleIf);
-        nonStaticLogger->Printf(aLevel, _L(""), log);
-        }
-
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::WriteLog
-// Writes log.
-// -----------------------------------------------------------------------------
-//
-TInt  CObexTestLogger::WriteLog(const TDesC16& aCategory, const TDesC16& aLog) const
-    {
-    // Write log to file if file logger is available.
-    if (iLog != 0)
-        {
-        iLog->Log(aLog);
-        }
-    // Remove the timestamp from the logging data.
-    TPtrC16 log( aLog.Mid( KTimeStampStrLen ) );
-
-    // Write log with RDebug.
-    RDebug::Print(log);
-
-    // Write log to screen if test module interface is available.
-    if (iTestModuleIf != 0)
-        {
-        CTestModuleIf* nonStaticLogger = const_cast<CTestModuleIf*>(iTestModuleIf);
-        nonStaticLogger->Printf(0, aCategory, log);
-        }
-
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::GetPrefix
-// Returns the prefix for a given logging level.
-// -----------------------------------------------------------------------------
-//
-TPtrC CObexTestLogger::GetPrefix(TLogLevel aLevel)
-	{
-	// Select a prefix for a log level and return a pointer to it.
-	switch(aLevel)
-		{
-		case ETLError:
-			{
-			TPtrC logPrefix = _L("ERROR : ");
-			return logPrefix;
-			}
-		case ETLInfo:
-		case ETLResult: 
-			{
-			TPtrC logPrefix = _L("INFO  : ");
-			return logPrefix;
-			}
-		case ETLDebug:
-			{
-			TPtrC logPrefix = _L("DEBUG : ");
-			return logPrefix;
-			}
-		default:
-			{
-			// Return a null pointer.
-			return TPtrC();
-			}
-
-		}
-	}
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::CheckLogFile
-// Check if a log file is already existing, otherwise HTML formatting 
-// should be added.
-// -----------------------------------------------------------------------------
-//
-TInt CObexTestLogger::CheckLogFile()
-    {
-    RThread thread;
-    TInt id = thread.Id();
-    TBuf<KMaxFileName > file;
-    file.Format( KObexServAPITestSystemLogFullName, id );
-    RFs fs;
-    TInt err = fs.Connect();
-    TBool open = EFalse;
-    if( !err )
-        {
-        err = fs.IsFileOpen( file, open );
-        }
-    fs.Close();
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::LogTimeStamp
-// Log HTML head section and general information in a newly created logfile.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::LogHeadSectionL()
-    {
-    iLog->Log( KHtmlHeadSection );
-    iLog->Log( KJSSECTION );
-    TBuf<KSysUtilVersionTextLength> version( _L( "Version unknown!" ) );
-    (void) SysUtil::GetSWVersion( version );
-    TStifLoggerTimeStamp8 date;
-    LogTimeStampL( date, EFalse );
-    TStifLoggerTimeStamp8 time;
-    LogTimeStampL( time );
-    TPtrC timePtr( time.Mid( 6, 13 ) );
-    iLog->Log( KHtmlStatSection, &date, &timePtr, &version );
-    }
-
-// -----------------------------------------------------------------------------
-// CObexTestLogger::LogTimeStamp
-// Format a timestamp for logging.
-// If aTime is set to false, the (formatted) date is returned.
-// -----------------------------------------------------------------------------
-//
-void CObexTestLogger::LogTimeStampL(TDes& aBuf, TBool aTime) const
-    {
-    TTime time;
-    time.HomeTime();    // Get time and format it
-    if( aTime )
-        {
-        time.FormatL( aBuf, KFormatTimeStamp );
-        }
-    else
-        {
-        time.FormatL( aBuf, KFormatDate );
-        }
-    }