--- a/localconnectivityservice/group/bld.inf Mon Mar 15 12:43:27 2010 +0200
+++ b/localconnectivityservice/group/bld.inf Wed Mar 31 23:02:31 2010 +0300
@@ -24,10 +24,7 @@
#include "../obexsendservices/group/bld.inf"
#include "../obexreceiveservices/group/bld.inf"
#include "../dun/group/bld.inf"
-#include "../lccustomplugin/group/bld.inf"
#include "../lcstylustap/group/bld.inf"
-#include "../legacymodemplugin/group/bld.inf"
-#include "../modematplugin/group/bld.inf"
#include "../generichid/group/bld.inf"
#include "../headset/group/bld.inf"
--- a/localconnectivityservice/lccustomplugin/group/bld.inf Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/group/lccustomplugin.mmp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/inc/debug.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/inc/debugconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/inc/lccustomplugin.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,476 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/localconnectivityservice/lccustomplugin/inc/lclistallcmd.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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
--- a/localconnectivityservice/lccustomplugin/inc/prjconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/rom/lccustomplugin.iby Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/lccustomplugin/src/20021360.rss Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* 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 = "";
- }
- };
- }
- };
- }
--- a/localconnectivityservice/lccustomplugin/src/lccustomplugin.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,476 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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;
- }
--- a/localconnectivityservice/lccustomplugin/src/lclistallcmd.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 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;
- }
--- a/localconnectivityservice/lccustomplugin/src/proxy.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/legacymodemplugin/group/bld.inf Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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 LegacyModemPlugin
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-../rom/legacymodemplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(legacymodemplugin.iby)
-
-PRJ_MMPFILES
-legacymodemplugin.mmp
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/legacymodemplugin/group/legacymodemplugin.mmp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* 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 LegacyModemPlugin
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET legacymodemplugin.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0x2002B340
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE proxy.cpp
-SOURCE legacymodemplugin.cpp
-SOURCE monitorspeakerparser.cpp
-
-START RESOURCE ../src/2002B340.rss
-TARGET legacymodemplugin.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
--- a/localconnectivityservice/legacymodemplugin/inc/debug.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/legacymodemplugin/inc/debugconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/legacymodemplugin/inc/legacymodemplugin.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,421 +0,0 @@
-/*
-* 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_LEGACYMODEMPLUGIN_H
-#define C_LEGACYMODEMPLUGIN_H
-
-#include <atextpluginbase.h>
-
-class CLegacyModemPlugin;
-
-/** 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=?"
- };
-
-/**
- * Class for common AT command handler interface
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CLegacyModemPluginBase )
- {
-
-public:
-
- virtual ~CLegacyModemPluginBase() {};
-
- /**
- * 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( MLegacyModemPlugin )
- {
-
-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 S60 5.0
- * @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;
-
- };
-
-/**
- * Class for selecting handlers for different AT commands
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CLegacyModemPlugin ) : public CATExtPluginBase,
- public MLegacyModemPlugin
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @return Instance of self
- */
- static CLegacyModemPlugin* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CLegacyModemPlugin();
-
-private:
-
- CLegacyModemPlugin();
-
- 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 );
-
- /**
- * Appends one parameter to array for GetParameterArray()
- *
- * @since S60 5.0
- * @param aParams Array of supported commands
- * @param aStartIndex Start index for the parameter to be added
- * @param aEndIndex End index for the parameter to be added
- * @return None
- */
- void AppendOneParameterLC( RPointerArray<HBufC8>& aParams,
- TInt& aStartIndex,
- TInt aEndIndex );
-
-// from base class MLegacyModemPlugin
-
- /**
- * From MLegacyModemPlugin.
- * 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 MLegacyModemPlugin.
- * 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 MLegacyModemPlugin.
- * 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 );
-
-private: // data
-
- /**
- * AT commands handler array. Used for mapping HandleCommand() to
- * IsCommandSupported() and to limit the number of string comparisons.
- */
- RPointerArray<CLegacyModemPluginBase> iHandlers;
-
- /**
- * Current AT command handler in iHandlers.
- * Used when IsCommandSupported() detects a matching handler class.
- */
- CLegacyModemPluginBase* 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_LEGACYMODEMPLUGIN_H
--- a/localconnectivityservice/legacymodemplugin/inc/monitorspeakerparser.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
-* 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 commands "ATL", "ATL0", "ATL1", "ATL2", "ATL3", "ATM",
-* "ATM0", "ATM1" and "ATM2"
-*
-*/
-
-#ifndef C_MONITORSPEAKERPARSER_H
-#define C_MONITORSPEAKERPARSER_H
-
-#include "legacymodemplugin.h"
-
-/** Detected commands */
-enum TDetectedCmd
- {
- EDetectedCmdUndefined,
- EDetectedCmdATL, // For command "ATL"
- EDetectedCmdATL0, // For command "ATL0"
- EDetectedCmdATL1, // For command "ATL1"
- EDetectedCmdATL2, // For command "ATL2"
- EDetectedCmdATL3, // For command "ATL3"
- EDetectedCmdATM, // For command "ATM"
- EDetectedCmdATM0, // For command "ATM0"
- EDetectedCmdATM1, // For command "ATM1"
- EDetectedCmdATM2 // For command "ATM2"
- };
-
-/**
- * Main class for handling commands "ATL", "ATL0", "ATL1", "ATL2", "ATL3",
- * "ATM", "ATM0", "ATM1" and "ATM2"
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CMonitorSpeakerParser ) : public CLegacyModemPluginBase
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aCallback Callback
- * @return Instance of self
- */
- static CMonitorSpeakerParser* NewL( MLegacyModemPlugin* aCallback );
-
- /**
- * Destructor.
- */
- virtual ~CMonitorSpeakerParser();
-
-private:
-
- CMonitorSpeakerParser( MLegacyModemPlugin* aCallback );
-
- void ConstructL();
-
- /**
- * Checks if the command is speaker loudness command
- *
- * @param aCmd Command to check
- * @return ETrue if command understood, EFalse otherwise
- */
- TBool CheckSpeakerLoudnessCommand( const TDesC8& aCmd );
-
- /**
- * Checks if the command is speaker mode command
- *
- * @param aCmd Command to check
- * @return ETrue if command understood, EFalse otherwise
- */
- TBool CheckSpeakerModeCommand( const TDesC8& aCmd );
-
- /**
- * Main command handler (leaving version)
- *
- * @return ETrue if command understood, EFalse otherwise
- */
- TBool HandleCommandL();
-
-// from base class CLcCustomPluginBase
-
- /**
- * From 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.
- */
- TBool IsCommandSupported( const TDesC8& aCmd );
-
- /**
- * From CLcCustomPluginBase.
- * 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 );
-
- /**
- * From CLcCustomPluginBase.
- * Cancels a pending HandleCommand request.
- *
- * @since S60 5.0
- * @return None
- */
- void HandleCommandCancel();
-
-private: // data
-
- /**
- * Callback to call when accessing plugin information
- */
- MLegacyModemPlugin* iCallback;
-
- /**
- * Handler type for the three types
- */
- TCmdHandlerType iCmdHandlerType;
-
- /**
- * Detected command
- */
- TDetectedCmd iDetectedCmd;
-
- };
-
-#endif // C_MONITORSPEAKERPARSER_H
--- a/localconnectivityservice/legacymodemplugin/inc/prjconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/legacymodemplugin/rom/legacymodemplugin.iby Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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 LegacyModemPlugin
-*
-*/
-
-#ifndef __LEGACYMODEMPLUGIN_IBY__
-#define __LEGACYMODEMPLUGIN_IBY__
-
-ECOM_PLUGIN( legacymodemplugin.dll, legacymodemplugin.rsc )
-
-#endif
--- a/localconnectivityservice/legacymodemplugin/src/2002B340.rss Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* 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 LegacyModemPlugin
-*
-*/
-
-#include <registryinfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
- {
- // UID for the DLL
- dll_uid = 0x2002B340;
- // Declare array of interface info
- interfaces =
- {
- INTERFACE_INFO
- {
- // UID of interface that is implemented
- interface_uid = 0x2001CBEE; // ATEXT_INTERFACE_DUN_UID
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0x2002B341;
- version_no = 1;
- display_name = "LegacyModemPlugin";
- default_data = "MATL|MATL0|MATL1|MATL2|MATL3|MATM|MATM0|MATM1|MATM2";
- opaque_data = "";
- }
- };
- }
- };
- }
--- a/localconnectivityservice/legacymodemplugin/src/legacymodemplugin.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,408 +0,0 @@
-/*
-* 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 "legacymodemplugin.h"
-#include "monitorspeakerparser.h"
-#include "debug.h"
-
-const TInt KErrorReplyLength = 9; // CR+LF+"ERROR"+CR+LF
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CLegacyModemPlugin* CLegacyModemPlugin::NewL()
- {
- CLegacyModemPlugin* self = new (ELeave) CLegacyModemPlugin();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CLegacyModemPlugin::~CLegacyModemPlugin()
- {
- iHandlers.ResetAndDestroy();
- iHandlers.Close();
- iReplyBuffer.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CLegacyModemPlugin::CLegacyModemPlugin
-// ---------------------------------------------------------------------------
-//
-CLegacyModemPlugin::CLegacyModemPlugin() : CATExtPluginBase()
- {
- iHandler = NULL;
- iHcCmd = NULL;
- iHcReply = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CLegacyModemPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CLegacyModemPlugin::ConstructL()
- {
- CLegacyModemPluginBase* handler = NULL;
- handler = CMonitorSpeakerParser::NewL( this );
- CleanupStack::PushL( handler );
- iHandlers.AppendL( handler );
- CleanupStack::Pop( handler );
- }
-
-// ---------------------------------------------------------------------------
-// Reports connection identifier name to the extension plugin.
-// ---------------------------------------------------------------------------
-//
-void CLegacyModemPlugin::ReportConnectionName( const TDesC8& /*aName*/ )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Reports the support status of an AT command. This is a synchronous API.
-// ---------------------------------------------------------------------------
-//
-TBool CLegacyModemPlugin::IsCommandSupported( const TDesC8& aCmd )
- {
- TRACE_FUNC_ENTRY
- iHcCmd = NULL;
- iHcReply = NULL;
- TInt i;
- TInt count = iHandlers.Count();
- for ( i=0; i<count; i++ )
- {
- CLegacyModemPluginBase* 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 CLegacyModemPlugin::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 CLegacyModemPlugin::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 CLegacyModemPlugin::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 CLegacyModemPlugin::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 CLegacyModemPlugin::ReceiveUnsolicitedResult()
- {
- TRACE_FUNC_ENTRY
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// Cancels a pending ReceiveUnsolicitedResult request.
-// ---------------------------------------------------------------------------
-//
-void CLegacyModemPlugin::ReceiveUnsolicitedResultCancel()
- {
- TRACE_FUNC_ENTRY
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// Reports NVRAM status change to the plugins.
-// ---------------------------------------------------------------------------
-//
-void CLegacyModemPlugin::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 CLegacyModemPlugin::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 CLegacyModemPlugin::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 CLegacyModemPlugin::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 || !iVerboseMode )
- {
- 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 CLegacyModemPlugin::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 MHfpExtPlugin.
-// Checks if the command is a base, set, read or test type of command
-// ---------------------------------------------------------------------------
-//
-TCmdHandlerType CLegacyModemPlugin::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;
- }
--- a/localconnectivityservice/legacymodemplugin/src/monitorspeakerparser.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +0,0 @@
-/*
-* 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 commands "ATL", "ATL0", "ATL1", "ATL2", "ATL3", "ATM",
-* "ATM0", "ATM1" and "ATM2"
-*
-*/
-
-#include "monitorspeakerparser.h"
-#include "debug.h"
-
-_LIT8( KAtlCmd, "ATL" );
-_LIT8( KAtl0Cmd, "ATL0" );
-_LIT8( KAtl1Cmd, "ATL1" );
-_LIT8( KAtl2Cmd, "ATL2" );
-_LIT8( KAtl3Cmd, "ATL3" );
-_LIT8( KAtmCmd, "ATM" );
-_LIT8( KAtm0Cmd, "ATM0" );
-_LIT8( KAtm1Cmd, "ATM1" );
-_LIT8( KAtm2Cmd, "ATM2" );
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CMonitorSpeakerParser* CMonitorSpeakerParser::NewL(
- MLegacyModemPlugin* aCallback )
- {
- CMonitorSpeakerParser* self = new (ELeave) CMonitorSpeakerParser( aCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CMonitorSpeakerParser::~CMonitorSpeakerParser()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CHfpExtParserMisc::CHfpExtParserMisc
-// ---------------------------------------------------------------------------
-//
-CMonitorSpeakerParser::CMonitorSpeakerParser( MLegacyModemPlugin* aCallback ) :
- iCallback( aCallback )
- {
- iCmdHandlerType = ECmdHandlerTypeUndefined;
- iDetectedCmd = EDetectedCmdUndefined;
- }
-
-// ---------------------------------------------------------------------------
-// CHfpExtParserMisc::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMonitorSpeakerParser::ConstructL()
- {
- if ( !iCallback )
- {
- User::Leave( KErrGeneral );
- }
- }
-
-// ---------------------------------------------------------------------------
-// Checks if the command is speaker loudness command
-// ---------------------------------------------------------------------------
-//
-TBool CMonitorSpeakerParser::CheckSpeakerLoudnessCommand( const TDesC8& aCmd )
- {
- TRACE_FUNC_ENTRY
- // The ATL command only supports one type: base
- // The ATL0 command only supports one type: base
- // The ATL1 command only supports one type: base
- // The ATL2 command only supports one type: base
- // The ATL3 command only supports one type: base
- iCmdHandlerType = iCallback->CheckCommandType( KAtlCmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATL;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtl0Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATL0;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtl1Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATL1;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtl2Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATL2;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtl3Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATL3;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- TRACE_FUNC_EXIT
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Checks if the command is speaker mode command
-// ---------------------------------------------------------------------------
-//
-TBool CMonitorSpeakerParser::CheckSpeakerModeCommand( const TDesC8& aCmd )
- {
- TRACE_FUNC_ENTRY
- // The ATM command only supports one type: base
- // The ATM0 command only supports one type: base
- // The ATM1 command only supports one type: base
- // The ATM2 command only supports one type: base
- iCmdHandlerType = iCallback->CheckCommandType( KAtmCmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATM;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtm0Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATM0;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtm1Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATM1;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = iCallback->CheckCommandType( KAtm2Cmd, aCmd );
- if ( iCmdHandlerType == ECmdHandlerTypeBase )
- {
- iDetectedCmd = EDetectedCmdATM2;
- TRACE_FUNC_EXIT
- return ETrue;
- }
- TRACE_FUNC_EXIT
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Main command handler (leaving version)
-// ---------------------------------------------------------------------------
-//
-TBool CMonitorSpeakerParser::HandleCommandL()
- {
- TRACE_FUNC_ENTRY
- TBool cmdUnderstood = EFalse;
- // Just return "OK" for all detected commands
- if ( iDetectedCmd != EDetectedCmdUndefined )
- {
- iCallback->CreateReplyAndComplete( EReplyTypeOk );
- cmdUnderstood = ETrue;
- }
- TRACE_FUNC_EXIT
- return cmdUnderstood;
- }
-
-// ---------------------------------------------------------------------------
-// From CLegacyModemPluginBase.
-// Reports the support status of an AT command. This is a synchronous API.
-// ---------------------------------------------------------------------------
-//
-TBool CMonitorSpeakerParser::IsCommandSupported( const TDesC8& aCmd )
- {
- TRACE_FUNC_ENTRY
- TBool cmdUnderstood = EFalse;
- // Set all to undefined if either the command or its type is unknown
- // HandleCommand() should be round only when both are set
- cmdUnderstood = CheckSpeakerLoudnessCommand( aCmd );
- if ( cmdUnderstood )
- {
- TRACE_FUNC_EXIT
- return ETrue;
- }
- cmdUnderstood = CheckSpeakerModeCommand( aCmd );
- if ( cmdUnderstood )
- {
- TRACE_FUNC_EXIT
- return ETrue;
- }
- iCmdHandlerType = ECmdHandlerTypeUndefined;
- iDetectedCmd = EDetectedCmdUndefined;
- TRACE_FUNC_EXIT
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// From CLegacyModemPluginBase.
-// Handles an AT command. Cancelling of the pending request is done by
-// HandleCommandCancel(). The implementation in the extension plugin should
-// be asynchronous.
-// ---------------------------------------------------------------------------
-//
-void CMonitorSpeakerParser::HandleCommand( const TDesC8& /*aCmd*/,
- RBuf8& /*aReply*/,
- TBool aReplyNeeded )
- {
- TRACE_FUNC_ENTRY
- if ( !aReplyNeeded )
- {
- TRACE_FUNC_EXIT
- return;
- }
- // Checking the iDetectedCmd here means that the failure is the
- // failing cmd type (set/read/test) for the command, not the command
- // itself (when cmdUnderstood is EFalse)
- TBool cmdUnderstood = EFalse;
- TRAPD( retTrap, cmdUnderstood=HandleCommandL() )
- if ( !cmdUnderstood || retTrap!=KErrNone )
- {
- iCallback->CreateReplyAndComplete( EReplyTypeError );
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// From CLegacyModemPluginBase.
-// Cancels a pending HandleCommand request.
-// ---------------------------------------------------------------------------
-//
-void CMonitorSpeakerParser::HandleCommandCancel()
- {
- TRACE_FUNC_ENTRY
- TRACE_FUNC_EXIT
- }
--- a/localconnectivityservice/legacymodemplugin/src/proxy.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* 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
-*
-*/
-
-#include <e32base.h>
-#include <ecom/implementationproxy.h>
-#include "legacymodemplugin.h"
-
-// ---------------------------------------------------------------------------
-// An array of TImplementationProxy objects which onnect each
-// implemeation with its instantiation function
-// ---------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY(0x2002B341, CLegacyModemPlugin::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;
- }
--- a/localconnectivityservice/modematplugin/group/bld.inf Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/group/modematplugin.mmp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/atcopscmd.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/cmdpluginobserver.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/debug.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/debugconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/modematplugin.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/inc/prjconfig.h Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/rom/modematplugin.iby Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* 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
--- a/localconnectivityservice/modematplugin/src/20029fbf.rss Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* 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 = "";
- }
- };
- }
- };
- }
--- a/localconnectivityservice/modematplugin/src/atcopscmd.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1118 +0,0 @@
-/*
-* 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();
- }
- // 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
- }
--- a/localconnectivityservice/modematplugin/src/modematplugin.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +0,0 @@
-/*
-* 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;
- }
--- a/localconnectivityservice/modematplugin/src/proxy.cpp Mon Mar 15 12:43:27 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* 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/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Mon Mar 15 12:43:27 2010 +0200
+++ b/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Wed Mar 31 23:02:31 2010 +0300
@@ -86,91 +86,102 @@
CMsvAttachment* attachInfo = store->AttachmentManagerL().GetAttachmentInfoL(0);
CleanupStack::PushL(attachInfo); // 3rd push
-
+
TDataType dataType = attachInfo->MimeType();
-
- TInt error = KErrNone;
- TBool isCompleteSelf = EFalse;
+ TFileName filePath;
+ filePath = attachInfo->FilePath();
- RFile attachFile;
- TRAP( error, attachFile = store->AttachmentManagerL().GetAttachmentFileL(0));
- TFileName fullName;
- attachFile.FullName(fullName);
- attachFile.Close();
+ TInt error = KErrNone;
+ TBool isCompleteSelf = EFalse;
+ CEikonEnv* eikEnv = CEikonEnv::Static();
+
+ if ( attachInfo->Type() == CMsvAttachment::EMsvFile )
+ {
+ RFile attachFile;
+ TRAP( error, attachFile = store->AttachmentManagerL().GetAttachmentFileL(0));
+ if ( error == KErrNone )
+ {
+ CleanupClosePushL(attachFile); // 4th push
+ CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 5th push
+ TAiwGenericParam paramSave(EGenericParamAllowSave, ETrue);
+ paramList->AppendL( paramSave );
+
+ if ( eikEnv )
+ {
+ iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() );
+ iDocumentHandler->SetExitObserver( this );
+ TRAP( error, iDocumentHandler->OpenFileEmbeddedL(attachFile, dataType, *paramList));
+ }// eikEnv
+ CleanupStack::PopAndDestroy(2); // paramList, attachFile
+ }
+ }// EMsvFile
- if ( KErrNone == error )
+ if ( attachInfo->Type() == CMsvAttachment::EMsvLinkedFile )
{
- CleanupClosePushL(attachFile); // 4th push
- CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 5th push
+ CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 4th push
TAiwGenericParam paramSave(EGenericParamFileSaved, ETrue);
paramList->AppendL( paramSave );
-
- if ( CEikonEnv::Static() )
+
+ if ( eikEnv )
{
- // Launches an application in embedded mode
- iDocumentHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() );
+
+ iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() );
iDocumentHandler->SetExitObserver( this );
RFile64 shareableFile;
- TRAP( error, iDocumentHandler->OpenTempFileL(fullName,shareableFile));
+ TRAP( error, iDocumentHandler->OpenTempFileL(filePath,shareableFile));
if ( error == KErrNone)
{
- TRAP( error, iDocumentHandler->OpenFileEmbeddedL( shareableFile, dataType, *paramList ));
+ TRAP( error, iDocumentHandler->OpenFileEmbeddedL( shareableFile, dataType, *paramList));
}
shareableFile.Close();
- }
-
-
- if ( error == KErrNotSupported )
- // If file is not supported, we open the file manager at file location.
- {
- // Launchs file manager at default folder
- delete iDocumentHandler;
- iDocumentHandler = NULL;
-
- TInt sortMethod = 2; // 0 = 'By name', 1 = 'By type',
- // 2 = 'Most recent first' and 3 = 'Largest first'
- TRAP (error, TObexUtilsUiLayer::LaunchFileManagerL( fullName,
- sortMethod,
- ETrue )); // ETrue -> launch file manager in embedded mode.
- isCompleteSelf = ETrue;
- } // KErrNotSupported
-
- // Set message to READ
- //
- TMsvEntry entry = aMessage->Entry();
- entry.SetUnread( EFalse );
- aMessage->ChangeL( entry );
- CleanupStack::PopAndDestroy(2); // paramList, attachFile
-
- } // KErrNone
+ if ( error == KErrNotFound )
+ {
+ error = KErrNone;
+ TFileName fileName;
+ if (LocateFileL(fileName, filePath))
+ {
+ // Update the entry
+ TRAP(error, TObexUtilsMessageHandler::UpdateEntryAttachmentL(fileName,aMessage));
+ if ( error == KErrNone )
+ {
+ // Show a confirmation note
+ CAknGlobalNote* note = CAknGlobalNote::NewLC();
+ HBufC* stringholder = StringLoader::LoadLC( R_BT_SAVED_LINK_UPDATED );
+ note->ShowNoteL(EAknGlobalConfirmationNote, *stringholder);
+ CleanupStack::PopAndDestroy(2); //note and stringholder
+ }
+ }
+ isCompleteSelf = ETrue;
+ } // KErrNotFound
+ } // eikEnv
+
+ else if ( error == KErrNotSupported )
+ {
+ delete iDocumentHandler;
+ iDocumentHandler = NULL;
+
+ const TInt sortMethod = 2; // 0 = 'By name', 1 = 'By type',
+ // 2 = 'Most recent first' and 3 = 'Largest first'
+ TRAP (error, TObexUtilsUiLayer::LaunchFileManagerL( filePath,
+ sortMethod,
+ ETrue )); // ETrue -> launch file manager in embedded mode.
+ isCompleteSelf = ETrue;
+ } // KErrNotSupported
+
+ CleanupStack::PopAndDestroy(); // paramList
+ } // EMsvLinkedFile
- else // Error != KErrNone, broken link found.
- // Lets fix it by selecting the right file.
- {
- error = KErrNone;
- TFileName fileName;
- TFileName oldFileName = attachInfo->FilePath();
- // select file
- //
- if (LocateFileL(fileName, oldFileName))
- {
- // Update the entry
- TRAP(error, TObexUtilsMessageHandler::UpdateEntryAttachmentL(fileName,aMessage));
- if ( error == KErrNone )
- {
- // Show a confirmation note
- CAknGlobalNote* note = CAknGlobalNote::NewLC();
- HBufC* stringholder = StringLoader::LoadLC( R_BT_SAVED_LINK_UPDATED );
- note->ShowNoteL(EAknGlobalConfirmationNote, *stringholder);
- CleanupStack::PopAndDestroy(2); //note and stringholder
- }
- }
- isCompleteSelf = ETrue;
- } // !KErrNone
-
+
+ // Set message to READ
+ TMsvEntry entry = aMessage->Entry();
+ entry.SetUnread( EFalse );
+ aMessage->ChangeL( entry );
+
User::LeaveIfError ( error );
CleanupStack::PopAndDestroy(3); // attachInfo, store, attachEntry
+
+
iObserverRequestStatus = KRequestPending; // CMsvOperation (observer)
iStatus = KRequestPending; // CMsvOperation
SetActive();
@@ -180,6 +191,7 @@
HandleServerAppExit( error );
}
}
+
// -----------------------------------------------------------------------------
// Destructor
// -----------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/Bmarm/ObexServAPItestu.def Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/Bwins/ObexServAPItestu.def Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/conf/obexservapitest.cfg Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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:
+*
+*/
+
+[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]
+[Test]
+title Get CenRep key string value
+create obexservapitest Message_Handler_Tester
+Message_Handler_Tester GetCenRepKeyStringValueL
+delete Message_Handler_Tester
+[Endtest]
+[Test]
+title Create and delete receive buffer and RFile
+create obexservapitest Message_Handler_Tester
+Message_Handler_Tester GetCenRepKeyStringValueL
+Message_Handler_Tester CreateReceiveBufferAndRFileL
+Message_Handler_Tester RemoveTemporaryRFileL
+delete Message_Handler_Tester
+[Endtest]
+[Test]
+title Save receive buffer and RFile to inbox
+create obexservapitest Message_Handler_Tester
+Message_Handler_Tester GetCenRepKeyStringValueL
+Message_Handler_Tester CreateReceiveBufferAndRFileL
+Message_Handler_Tester SaveFileToFileSystemL
+Message_Handler_Tester AddEntryToInboxL
+delete Message_Handler_Tester
+[Endtest]
+[Test]
+title Update the previous Inbox entry
+create obexservapitest Message_Handler_Tester
+Message_Handler_Tester GetCenRepKeyStringValueL
+Message_Handler_Tester CreateReceiveBufferAndRFileL
+Message_Handler_Tester SaveFileToFileSystemL
+Message_Handler_Tester AddEntryToInboxL
+Message_Handler_Tester UpdateEntryAttachmentL
+delete Message_Handler_Tester
+[Endtest]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/group/bld.inf Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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'
+obexservapitest.mmp
+
+PRJ_MMPFILES
+
+// End of File
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/group/obexservapitest.mmp Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,63 @@
+/*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 OSEXT_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
+
+#if defined(__S60_)
+ // OSEXT_LAYER_SYSTEMINCLUDE
+ MW_LAYER_SYSTEMINCLUDE
+#else
+ //SYSTEMINCLUDE /epoc32/include
+ //SYSTEMINCLUDE /epoc32/include/internal
+#endif
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY sysutil.lib
+LIBRARY obexutils.lib
+LIBRARY irobex.lib
+LIBRARY efsrv.lib
+LIBRARY msgs.lib
+
+LANG SC
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/group/obexservapitest.pkg Wed Mar 31 23:02:31 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:
+;
+;
+; Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"obexservapitest"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 5.1
+[0x10283160], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"\epoc32\release\armv5\udeb\obexservapitest.dll"-"c:\Sys\Bin\obexservapitest.dll"
+
+"..\conf\obexservapitest.cfg"-"e:\testing\conf\obexservapitest.cfg"
+"..\init\obexservapitest.ini"-"e:\testing\init\obexservapitest.ini"
+
+; Embedded SIS
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/inc/ObexServAPItest.h Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,230 @@
+/*
+* 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 );
+
+ TInt CObexServAPItest::GetCenRepKeyStringValueL( CStifItemParser& aItem );
+ TInt CObexServAPItest::CreateReceiveBufferAndRFileL( CStifItemParser& aItem );
+ TInt CObexServAPItest::SaveFileToFileSystemL( CStifItemParser& aItem );
+ TInt CObexServAPItest::AddEntryToInboxL( CStifItemParser& aItem );
+ TInt CObexServAPItest::UpdateEntryAttachmentL( CStifItemParser& aItem );
+ TInt CObexServAPItest::RemoveTemporaryRFileL( CStifItemParser& aItem );
+
+ private: // Data
+
+ /**
+ * A dummy class for opening CMsvSession.
+ */
+ class CDummySessionObserver : public CBase , public MMsvSessionObserver
+ {
+ public:
+ void HandleSessionEventL( TMsvSessionEvent/*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ ) {};
+ };
+
+
+
+ TMsvId iMessageServerIndex;
+ CObexBufObject* iObexObject;
+ RFs iRFs;
+ RFile iFile;
+ CBufFlat* iBuf;
+ CObexTestLogger* iTestLogger;
+ TFileName iCenRepFolder;
+ TFileName iTempFullPathFilename;
+ };
+
+#endif // OBEXSERVAPITEST_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/inc/testlogger.h Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/init/obexservapitest.ini Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,233 @@
+#
+# 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 is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+# - Set Test Reporting mode. TestReportMode's possible values are:
+# + 'Summary': Summary of the tested test cases.
+# + 'Environment': Hardware and software info.
+# + 'TestCases': Test case report.
+# + 'FullReport': Set of all above ones.
+# + Example 'TestReportMode= Summary TestCases'
+#
+# - CreateTestReport setting controls report creation mode
+# + YES, Test report will created.
+# + NO, No Test report.
+#
+# - File path indicates the base path of the test report.
+# - File name indicates the name of the test report.
+#
+# - File format indicates the type of the test report.
+# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
+# + HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# - File output indicates output source of the test report.
+# + FILE, Test report logging to file.
+# + RDEBUG, Test report logging to using rdebug.
+#
+# - File Creation Mode indicates test report overwriting if file exist.
+# + OVERWRITE, Overwrites if the Test report file exist.
+# + APPEND, Continue logging after the old Test report information if
+# report exist.
+# - Sets a device reset module's dll name(Reboot).
+# + If Nokia specific reset module is not available or it is not correct one
+# StifHWResetStub module may use as a template for user specific reset
+# module.
+# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ # 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= e:\testing\logs\
+TestReportFileName= obexServApiTest_TestReport
+
+TestReportFormat= TXT # Possible values: TXT, HTML or XML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0 # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= e:\testing\conf\obexservapitest.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# Hardware and emulator environment logging path and styles can
+# be configured from here to overwrite the Logger's implemented values.
+#
+# Settings description:
+# - Indicates option for creation log directory/directories. If log directory/directories
+# is/are not created by user they will make by software.
+# + YES, Create log directory/directories if not allready exist.
+# + NO, Log directory/directories not created. Only created one is used.
+#
+# - Overwrite emulator path setting.
+# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
+# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+# will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+# - Overwrite emulator's logging format.
+# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+# - Overwrited emulator logging output source.
+# + FILE, Logging to file(s).
+# + RDEBUG, Logging to using rdebug(s).
+#
+# - Overwrite hardware path setting (Same description as above in emulator path).
+# - Overwrite hardware's logging format(Same description as above in emulator format).
+# - Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+# - File Creation Mode indicates file overwriting if file exist.
+# + OVERWRITE, Overwrites if file(s) exist.
+# + APPEND, Continue logging after the old logging information if file(s) exist.
+#
+# - Will thread id include to the log filename.
+# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+# + NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+# - Will time stamps include the to log file.
+# + YES, Time stamp added to each line in log file(s). Time stamp is
+# for example'12.Nov.2003 115958 LOGGING INFO'
+# + NO, No time stamp(s).
+#
+# - Will line breaks include to the log file.
+# + YES, Each logging event includes line break and next log event is in own line.
+# + NO, No line break(s).
+#
+# - Will event ranking include to the log file.
+# + YES, Event ranking number added to each line in log file(s). Ranking number
+# depends on environment's tics, for example(includes time stamp also)
+# '012 12.Nov.2003 115958 LOGGING INFO'
+# + NO, No event ranking.
+#
+# - Will write log file in unicode format.
+# + YES, Log file will be written in unicode format
+# + NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+#AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# If you want to use filter with ConsoleUI, simply remove comments
+# from section below and provide valid filter entries.
+# Each filter line has to start with "filter= " keyword.
+# Filter can contain special wildcard characters:
+# * which stands for none or any literal;
+# ? which stands for single character.
+# Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/rom/obexservapitest.iby Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/src/ObexServAPItest.cpp Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,630 @@
+/*
+* 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"
+
+#include <btengdomaincrkeys.h>
+
+// CONSTANTS
+const TInt KBufferSize = 0x4000; // 16kB
+
+// 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;
+ iRFs.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// 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 ),
+ ENTRY( "GetCenRepKeyStringValueL", CObexServAPItest::GetCenRepKeyStringValueL), // JHä
+ ENTRY( "CreateReceiveBufferAndRFileL", CObexServAPItest::CreateReceiveBufferAndRFileL), // JHä
+ ENTRY( "RemoveTemporaryRFileL", CObexServAPItest::RemoveTemporaryRFileL), // JHä
+ ENTRY( "SaveFileToFileSystemL", CObexServAPItest::SaveFileToFileSystemL), // JHä
+ ENTRY( "AddEntryToInboxL", CObexServAPItest::AddEntryToInboxL), // JHä
+ ENTRY( "UpdateEntryAttachmentL", CObexServAPItest::UpdateEntryAttachmentL), // JHä
+ };
+
+ 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*/ ) // JHä note: Is return code handling done right?
+ {
+ 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;
+ }
+
+// Find out the path of the receive folder.
+TInt CObexServAPItest::GetCenRepKeyStringValueL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ TInt error = KErrNone;
+ TRAPD(leaveVal, error = TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine,
+ KLCReceiveFolder,
+ iCenRepFolder));
+ if( leaveVal != KErrNone )
+ {
+ TestCompleted( leaveVal, TLFUNCLOG, _L("GetCenRepKeyStringValueL leaves"));
+ }
+ else if (error != KErrNone)
+ {
+ TestCompleted( leaveVal, TLFUNCLOG, _L("GetCenRepKeyStringValueL return error"));
+ }
+ else
+ {
+ TestCompleted( KErrNone, TLFUNCLOG, _L("GetCenRepKeyStringValueL"));
+ }
+
+ return KErrNone;
+ }
+
+// Create the receive buffer and temporary receive file.
+TInt CObexServAPItest::CreateReceiveBufferAndRFileL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ TFileName defaultFolder;
+ defaultFolder.Zero();
+
+ User::LeaveIfError(iRFs.Connect());
+
+ iFile = RFile(); // Creating an empty file.
+
+ // Ensure that the object and buffer don't exist.
+ // This also deletes the previous iFile object, if any existed,
+ // because its handle is held by iObexObject.
+ if(iObexObject)
+ {
+ delete iObexObject;
+ iObexObject = NULL;
+ }
+ if( iBuf )
+ {
+ delete iBuf;
+ iBuf=NULL;
+ }
+
+ // Then create a new obex object for holding the buffer and the temp file.
+ iObexObject = CObexBufObject::NewL( NULL );
+
+ defaultFolder.Append(_L("C:\\data\\"));
+ defaultFolder.Append(iCenRepFolder); // Got this from central repository in GetCenRepKeyStringValueL
+
+ TRAPD(error,TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL( iFile, // Out: But iFile is returned as closed.
+ defaultFolder, // Where to create the temp file.
+ iTempFullPathFilename, // Out: Can be used to open the file later.
+ iBuf, // Out: This contains the message buffer.
+ KBufferSize));
+
+ // Open the file again.
+ User::LeaveIfError(iFile.Open(iRFs, iTempFullPathFilename, EFileWrite));
+
+ TObexRFileBackedBuffer bufferdetails(*iBuf,iFile,CObexBufObject::EDoubleBuffering);
+
+ // Do we really need to trap leaves here? Maybe because of Stif?
+ TRAP(error, iObexObject->SetDataBufL( bufferdetails) );
+ if (error != KErrNone)
+ {
+ error = KErrGeneral;
+ }
+
+ iFile.Write(_L8("test")); // Put some test data into the file, although it is not mandatory.
+ iFile.Flush();
+
+ iObexObject->SetNameL(_L("test.txt"));
+
+ // At this point we have an object in file system (iFile refers to it)
+ // and an entry in Inbox which we can later refer to with iMessageServerIndex.
+
+ if( error != KErrNone)
+ {
+ TestCompleted( error, TLFUNCLOG, _L("CreateReceiveBufferAndRFileL leaves"));
+ }
+ else
+ {
+ TestCompleted( error, TLFUNCLOG, _L("CreateReceiveBufferAndRFileL"));
+ }
+
+ // iFile is left open
+ return KErrNone;
+ }
+
+// Copy the temporary receive file to the correct place in the file system after receiving is complete.
+TInt CObexServAPItest::SaveFileToFileSystemL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ // Create bogus device name.
+ TBTDeviceName remoteDeviceName;
+ remoteDeviceName.Zero();
+ remoteDeviceName.Append(_L("APITestDevice"));
+
+// The iFile must be still open after calling CreateReceiveBufferAndRFileL method
+
+ TRAPD(error,TObexUtilsMessageHandler::SaveFileToFileSystemL( iObexObject,
+ KUidMsgTypeBt,
+ iMessageServerIndex, // This is gotten
+ iTempFullPathFilename, // Contains the final path of the file
+ iFile, // Handle to the temp file.
+ remoteDeviceName));
+
+ if( error != KErrNone)
+ {
+ TestCompleted( error, TLFUNCLOG, _L("SaveFileToFileSystemL leaves"));
+ }
+ else
+ {
+ TestCompleted( error, TLFUNCLOG, _L("SaveFileToFileSystemL"));
+ }
+ return KErrNone;
+ }
+
+// Create an entry in the Inbox and attach the file there.
+TInt CObexServAPItest::AddEntryToInboxL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ RArray<TMsvId> tmpMsvIdArray; // Not really needed, but must be passed to the method.
+
+ TRAPD(error,TObexUtilsMessageHandler::AddEntryToInboxL( iMessageServerIndex,
+ iTempFullPathFilename,
+ &tmpMsvIdArray));
+
+ if( error != KErrNone)
+ {
+ TestCompleted( error, TLFUNCLOG, _L("AddEntryToInboxL leaves"));
+ }
+ else
+ {
+ TestCompleted( error, TLFUNCLOG, _L("AddEntryToInboxL"));
+ }
+ return KErrNone;
+ }
+
+// Replacing a broken link in Inbox with a proper link to a file.
+TInt CObexServAPItest::UpdateEntryAttachmentL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ // Create a new file to be the replacement:
+ TFileName tempFilename;
+ TFileName defaultFolder;
+ RFs rfs;
+ RFile newFile;
+
+ User::LeaveIfError(rfs.Connect());
+ CleanupClosePushL(rfs);
+
+ defaultFolder.Zero();
+ defaultFolder.Append(_L("C:\\data\\"));
+ defaultFolder.Append(iCenRepFolder); // Got this from central repository in GetCenRepKeyStringValueL
+ User::LeaveIfError( newFile.Temp( rfs, defaultFolder, tempFilename, EFileWrite) );
+ newFile.Write(_L8("testing replacing"));
+ newFile.Flush();
+ newFile.Close();
+
+ CleanupStack::PopAndDestroy(); // rfs
+
+ // Then replace the attachment:
+ CDummySessionObserver* sessionObs = new( ELeave )CDummySessionObserver;;
+ CleanupStack::PushL( sessionObs );
+ CMsvSession* msvSession = CMsvSession::OpenSyncL( *sessionObs );
+ CleanupStack::PushL(msvSession);
+ CMsvEntry* entry = msvSession->GetEntryL(iMessageServerIndex);
+ CleanupStack::PushL(entry);
+ TRAPD(error,TObexUtilsMessageHandler::UpdateEntryAttachmentL(tempFilename, entry));
+
+ // Cleanup:
+ CleanupStack::PopAndDestroy(3); // entry, msvSession, sessionObs,
+
+ // Save the path to the new file so it can be referred to later.
+ iTempFullPathFilename = tempFilename;
+
+ if( error != KErrNone)
+ {
+ TestCompleted( error, TLFUNCLOG, _L("UpdateEntryAttachmentL leaves"));
+ }
+ else
+ {
+ TestCompleted( error, TLFUNCLOG, _L("UpdateEntryAttachmentL"));
+ }
+ return KErrNone;
+ }
+
+// Delete the temporary file. Called normally when the link is broken and the user searches for the file.
+// In test code this should be called after creating the temporary RFile and before
+// creating the Inbox entry.
+TInt CObexServAPItest::RemoveTemporaryRFileL( CStifItemParser& /*aItem*/ ) // JHä - Done
+ {
+ TRAPD(error,TObexUtilsMessageHandler::RemoveTemporaryRFileL(iTempFullPathFilename));
+ if( error != KErrNone)
+ {
+ TestCompleted( error, TLFUNCLOG, _L("RemoveTemporaryRFileL leaves"));
+ }
+ else
+ {
+ TestCompleted( error, TLFUNCLOG, _L("RemoveTemporaryRFileL"));
+ }
+ return KErrNone;
+ }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/shortlinkconn_plat/obex_service_utils_api/tsrc/src/testlogger.cpp Wed Mar 31 23:02:31 2010 +0300
@@ -0,0 +1,530 @@
+/*
+* 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 );
+ }
+ }