# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271253155 -10800 # Node ID 031b9cffe6e47974fc4cb72ed57c183a10bee37a # Parent 87d139e87731c205e4727c4cd35c1885987f1b7a Revision: 201013 Kit: 201015 diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/atext/group/dunatext.mmp --- a/localconnectivityservice/dun/atext/group/dunatext.mmp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/dun/atext/group/dunatext.mmp Wed Apr 14 16:52:35 2010 +0300 @@ -33,6 +33,7 @@ SOURCE DunAtModeListen.cpp SOURCE DunAtEcomListen.cpp SOURCE DunAtNvramListen.cpp +SOURCE DunAtSpecialCmdHandler.cpp USERINCLUDE ../inc ../../utils/inc @@ -48,4 +49,5 @@ LIBRARY atextclient.lib LIBRARY atextcommon.lib LIBRARY euser.lib +LIBRARY bafl.lib DEBUGLIBRARY flogger.lib diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h --- a/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Wed Apr 14 16:52:35 2010 +0300 @@ -26,6 +26,7 @@ #include "DunAtEcomListen.h" #include "DunAtModeListen.h" #include "DunAtNvramListen.h" +#include "DunAtSpecialCmdHandler.h" const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now const TInt KDunOkBufLength = 1+1+2+1+1; // ++"OK"++ @@ -839,6 +840,10 @@ */ RATExtCommon iAtCmdExtCommon; + /** + * Special AT command handler for handling commands like AT&FE0Q0V1&C1&D2+IFC=3,1. + */ + CDunAtSpecialCmdHandler* iAtSpecialCmdHandler; }; #endif // C_CDUNATCMDHANDLER_H diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h Wed Apr 14 16:52:35 2010 +0300 @@ -0,0 +1,76 @@ +/* +* 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: Special AT command handler +* +*/ + +#ifndef C_CDUNATSPECIALCMDHANDLER_H +#define C_CDUNATSPECIALCMDHANDLER_H + +#include +#include + +const TInt KInputBufLength = (512 + 1); // 512 chars for command + + +/** + * Class for special AT command handler + * + * @lib dunatext.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CDunAtSpecialCmdHandler ) : public CBase + { + +public: + + /** + * Two-phased constructor. + * @param None + * @return Instance of self + */ + static CDunAtSpecialCmdHandler* NewL(); + + /** + * Destructor. + */ + ~CDunAtSpecialCmdHandler(); + +public: + + TBool IsCompleteSubCommand(TChar aCharacter); + TBool IsCompleteSubCommand(TDesC8& aDes, TInt aStartIndex, TInt& aEndIndex); + +private: + + CDunAtSpecialCmdHandler(); + + void ConstructL(); + + TBool IsDataReadyForComparison(TInt aLength); + TInt MinimumLength(); + + +private: // data + /** + * Buffer for temporary AT command input + */ + TBuf8 iBuffer; + + /** + * Special commands for parsing + */ + CDesC8Array *iSpecialCmds; + }; + +#endif // C_CDUNATSPECIALCMDHANDLER_H diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp --- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -85,6 +85,8 @@ iModeListen = NULL; delete iEcomListen; iEcomListen = NULL; + delete iAtSpecialCmdHandler; + iAtSpecialCmdHandler = NULL; if ( iAtCmdExtCommon.Handle() ) { iAtCmdExtCommon.SynchronousClose(); @@ -331,6 +333,8 @@ iEcomListen = ecomListen; iModeListen = modeListen; iNvramListen = nvramListen; + + iAtSpecialCmdHandler = CDunAtSpecialCmdHandler::NewL(); FTRACE(FPrint( _L("CDunAtCmdHandler::ConstructL() complete") )); } @@ -860,7 +864,10 @@ TInt endIndex = KErrNotFound; if ( extendedCmd ) { - extendedEnd = CheckExtendedCommand( startIndex, endIndex ); + if( iAtSpecialCmdHandler->IsCompleteSubCommand(iInputBuffer, startIndex, endIndex) == EFalse ) + { + extendedEnd = CheckExtendedCommand( startIndex, endIndex ); + } } else { @@ -1007,7 +1014,7 @@ FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter()") )); if ( aCharacter.IsSpace() || aCharacter==';' || aCharacter==0x00 ) { - FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter() complete") )); + FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() complete") )); return ETrue; } FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() (not delimiter) complete") )); @@ -1071,6 +1078,16 @@ endFound = ETrue; break; } + if( IsExtendedCharacter(character) && (aEndIndex != aStartIndex) && iDecodeInfo.iPrevExists ) + { + if( iDecodeInfo.iPrevChar.IsAlphaDigit() ) + { + aEndIndex--; + // End found but return EFalse in order to calling function can proceed correct way, + // no extended end. + return EFalse; + } + } iDecodeInfo.iPrevExists = ETrue; iDecodeInfo.iPrevChar = character; } diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/atext/src/DunAtSpecialCmdHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/localconnectivityservice/dun/atext/src/DunAtSpecialCmdHandler.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -0,0 +1,181 @@ +/* +* 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: Special AT command handler +* +*/ + +#include "DunAtSpecialCmdHandler.h" +#include "DunDebug.h" + +// AT command(s) below is part of the AT&FE0Q0V1&C1&D2+IFC=3,1. command which +// is sent by MAC +_LIT8(KSpecialATCmd1, "AT&F"); +// Number of special commands +const TInt KDefaultGranularity = 1; + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CDunAtSpecialCmdHandler* CDunAtSpecialCmdHandler::NewL() + { + CDunAtSpecialCmdHandler* self = new (ELeave) CDunAtSpecialCmdHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CDunAtSpecialCmdHandler::CDunAtSpecialCmdHandler +// --------------------------------------------------------------------------- +// +CDunAtSpecialCmdHandler::CDunAtSpecialCmdHandler() + { + } + +// --------------------------------------------------------------------------- +// CDunAtSpecialCmdHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CDunAtSpecialCmdHandler::ConstructL() + { + iSpecialCmds = new (ELeave) CDesC8ArrayFlat(KDefaultGranularity); + // Add here all special commands which need to be handled + iSpecialCmds->AppendL(KSpecialATCmd1); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler() + { + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler()") )); + delete iSpecialCmds; + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler() complete") )); + } + +// --------------------------------------------------------------------------- +// Checks if the command has to be treated special way +// For example in case of MAC, it sends command AT&FE0Q0V1&C1&D2+IFC=3,1. +// meaning there is no delimiters in the command. +// In case of MAC we try to search AT&F (sub command) string from the beginning +// of the command. +// Search is done character by character basis. +// --------------------------------------------------------------------------- +// +TBool CDunAtSpecialCmdHandler::IsCompleteSubCommand (TChar aCharacter) + { + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand()") )); + iBuffer.Append(aCharacter); + TBool completeSubCmd = EFalse; + + if( !IsDataReadyForComparison( iBuffer.Length()) ) + { + // No need to do comparison because we don't have correct amount of data + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), no need to compare") )); + return completeSubCmd; + } + + TInt count = iSpecialCmds->Count(); + for( TInt i = 0 ; i < count ; i++ ) + { + if( iSpecialCmds->MdcaPoint(i).Compare(iBuffer) == 0 ) + { + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), match found, cmd index %d"), i )); + // Reset internal buffer for next comparison. + iBuffer.FillZ(); + iBuffer.Zero(); + completeSubCmd = ETrue; + break; + } + } + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand() complete") )); + return completeSubCmd; + } + +// --------------------------------------------------------------------------- +// Checks if the command has to be treated special way +// For example in case of MAC, it sends command AT&FE0Q0V1&C1&D2+IFC=3,1. +// meaning there is no delimiters in the command. +// In case of MAC we try to search AT&F (sub command) string from the beginning +// of the command. +// Search is done string basis. +// --------------------------------------------------------------------------- +// +TBool CDunAtSpecialCmdHandler::IsCompleteSubCommand(TDesC8& aDes, TInt aStartIndex, TInt& aEndIndex) + { + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand()") )); + TBool completeSubCmd = EFalse; + if( aDes.Length() < MinimumLength() || aStartIndex != 0 ) + { + // No need to do comparison because we don't have correct amount of data or + // we are not at the beginning of the input buffer (non decoded buffer) + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), no need to compare") )); + return completeSubCmd; + } + + TInt count = iSpecialCmds->Count(); + for( TInt i = 0 ; i < count ; i++ ) + { + TInt length = iSpecialCmds->MdcaPoint(i).Length(); + TPtrC8 cmd = aDes.Mid(0, length); + if( iSpecialCmds->MdcaPoint(i).Compare(cmd) == 0 ) + { + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), match found, cmd index %d"), i )); + aEndIndex = length - 1; + completeSubCmd = ETrue; + break; + } + } + FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand() complete") )); + return completeSubCmd; + } + +// --------------------------------------------------------------------------- +// Defines when comparison is excecuted, checks if the data lengths are equal. +// --------------------------------------------------------------------------- +// +TBool CDunAtSpecialCmdHandler::IsDataReadyForComparison(TInt aLength) + { + TInt count = iSpecialCmds->Count(); + for( TInt i = 0 ; i < count ; i++ ) + { + if( iSpecialCmds->MdcaPoint(i).Length() == aLength ) + { + return ETrue; + } + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// Defines minimum length of the special commands. +// --------------------------------------------------------------------------- +// +TInt CDunAtSpecialCmdHandler::MinimumLength() + { + TInt length = iSpecialCmds->MdcaPoint(0).Length(); + TInt count = iSpecialCmds->Count(); + for( TInt i = 1 ; i < count ; i++ ) + { + if( iSpecialCmds->MdcaPoint(i).Length() < length ) + { + length = iSpecialCmds->MdcaPoint(i).Length(); + break; + } + } + return length; + } diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp --- a/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -28,6 +28,9 @@ const TInt KListenQueSize = 1; const TInt KDunFixedChannel = 22; // Hack/kludge for Apple Bug ID 6527598 +//Service Class Bits supported by DUN +static const TUint16 KCoDDunServiceClass = EMajorServiceTelephony | EMajorServiceNetworking; + // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -340,6 +343,11 @@ return KErrInUse; } aChannelNum = aListenSocket.LocalPort(); + + // We try to set the Telephony and Networking bits in our service class. If this fails we + // ignore it, as it's better to carry on without it than to fail to start listening. + (void)aListenSocket.SetOpt(KBTRegisterCodService, KSolBtRFCOMM, KCoDDunServiceClass); + retTemp = aListenSocket.Listen( KListenQueSize ); if ( retTemp != KErrNone ) { diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp --- a/localconnectivityservice/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -31,6 +31,8 @@ #include +const TInt KBtMtmUiNfcContext = 2; + // ================= MEMBER FUNCTIONS ======================= // Two-phased constructor. @@ -129,7 +131,16 @@ const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& aContext, TInt /*aStateFlags*/) const { - TInt icon = TObexUtilsUiLayer::ContextIcon( aContext, EBluetooth ); + // Check if NFC context + TInt icon = 0; + if ( aContext.MtmData1() == KBtMtmUiNfcContext ) + { + icon = TObexUtilsUiLayer::ContextIcon( aContext, ENfc ); + } + else + { + icon = TObexUtilsUiLayer::ContextIcon( aContext, EBluetooth ); + } return *iIconArrays->At( icon/2 ); } diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/obexserviceman/utils/inc/obexutilsuilayer.h --- a/localconnectivityservice/obexserviceman/utils/inc/obexutilsuilayer.h Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/obexserviceman/utils/inc/obexutilsuilayer.h Wed Apr 14 16:52:35 2010 +0300 @@ -52,7 +52,8 @@ enum TContextMedia { EBluetooth, - EInfrared + EInfrared, + ENfc }; /** diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp --- a/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -90,7 +90,7 @@ TDataType dataType = attachInfo->MimeType(); TFileName filePath; filePath = attachInfo->FilePath(); - + TInt error = KErrNone; TBool isCompleteSelf = EFalse; CEikonEnv* eikEnv = CEikonEnv::Static(); @@ -123,18 +123,35 @@ paramList->AppendL( paramSave ); if ( eikEnv ) - { - + { iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() ); iDocumentHandler->SetExitObserver( this ); - RFile64 shareableFile; - TRAP( error, iDocumentHandler->OpenTempFileL(filePath,shareableFile)); - if ( error == KErrNone) + RFs rfs; + User::LeaveIfError( rfs.Connect() ); + if ( BaflUtils::FileExists( rfs, filePath ) ) { - TRAP( error, iDocumentHandler->OpenFileEmbeddedL( shareableFile, dataType, *paramList)); - } - shareableFile.Close(); - if ( error == KErrNotFound ) + RFile64 shareableFile; + TRAP( error, iDocumentHandler->OpenTempFileL(filePath,shareableFile)); + if ( error == KErrNone) + { + TRAP( error, iDocumentHandler->OpenFileEmbeddedL( shareableFile, dataType, *paramList)); + } + shareableFile.Close(); + + 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 + } + else { error = KErrNone; TFileName fileName; @@ -152,25 +169,14 @@ } } isCompleteSelf = ETrue; - } // KErrNotFound + } + + rfs.Close(); } // 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 - + // Set message to READ TMsvEntry entry = aMessage->Entry(); @@ -178,9 +184,7 @@ aMessage->ChangeL( entry ); User::LeaveIfError ( error ); - CleanupStack::PopAndDestroy(3); // attachInfo, store, attachEntry - - + CleanupStack::PopAndDestroy(3); // attachInfo, store, attachEntry iObserverRequestStatus = KRequestPending; // CMsvOperation (observer) iStatus = KRequestPending; // CMsvOperation diff -r 87d139e87731 -r 031b9cffe6e4 localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp --- a/localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp Wed Mar 31 23:02:31 2010 +0300 +++ b/localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp Wed Apr 14 16:52:35 2010 +0300 @@ -46,6 +46,9 @@ const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 const TInt KUiNumberOfZoomStates = 2; // second for the mask const TInt KSortNumMax = 2; +const TInt KNfcUnreadIconIndex = 10; +const TInt KNfcReadIconIndex = 8; + // ============================ MEMBER FUNCTIONS =============================== @@ -376,6 +379,17 @@ icon = EMbmMuiuQgn_prop_mce_ir_read - EMbmMuiuQgn_prop_mce_ir_unread; } } + else if( aMedia == ENfc ) + { + if( aContext.Unread() ) + { + icon = KNfcUnreadIconIndex; + } + else + { + icon = KNfcReadIconIndex; + } + } FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon() completed")); @@ -492,6 +506,14 @@ KAknsIIDQgnPropMceBtRead, EMbmMuiuQgn_prop_mce_bt_read, aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceNfcRead, + 0, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceNfcUnread, + 0, + aIconArrays); } else //Infrared {