# HG changeset patch # User hgs # Date 1275055386 -10800 # Node ID 19bd632b51007547369782ceff4a4be8ae2a1e82 # Parent a0ea99b6fa53f7645811722ccef2befc54a9700e 201021 diff -r a0ea99b6fa53 -r 19bd632b5100 atcommands/lccustomplugin/src/lccustomplugin.cpp --- a/atcommands/lccustomplugin/src/lccustomplugin.cpp Mon May 17 11:06:23 2010 +0300 +++ b/atcommands/lccustomplugin/src/lccustomplugin.cpp Fri May 28 17:03:06 2010 +0300 @@ -278,14 +278,7 @@ switch ( aReplyType ) { case EReplyTypeOther: - if ( iQuietMode ) - { - iReplyBuffer.Create( KNullDesC8 ); - } - else - { - iReplyBuffer.Create( aSrcBuffer ); - } + iReplyBuffer.Create( aSrcBuffer ); break; case EReplyTypeOk: CreateOkOrErrorReply( iReplyBuffer, ETrue ); diff -r a0ea99b6fa53 -r 19bd632b5100 atcommands/lccustomplugin/src/lclistallcmd.cpp --- a/atcommands/lccustomplugin/src/lclistallcmd.cpp Mon May 17 11:06:23 2010 +0300 +++ b/atcommands/lccustomplugin/src/lclistallcmd.cpp Fri May 28 17:03:06 2010 +0300 @@ -142,13 +142,6 @@ return; } RBuf8 reply; - if ( quietMode ) - { - iCallback->CreateReplyAndComplete( EReplyTypeOther, reply ); - reply.Close(); - TRACE_FUNC_EXIT - return; - } TBool error = CreateSupportedList( reply ); if ( error ) { diff -r a0ea99b6fa53 -r 19bd632b5100 atcommands/modematplugin/src/modematplugin.cpp --- a/atcommands/modematplugin/src/modematplugin.cpp Mon May 17 11:06:23 2010 +0300 +++ b/atcommands/modematplugin/src/modematplugin.cpp Fri May 28 17:03:06 2010 +0300 @@ -283,14 +283,7 @@ switch ( aReplyType ) { case EReplyTypeOther: - if ( iQuietMode ) // In quite mode there should be no response at all. - { - iReplyBuffer.Create( KNullDesC8 ); - } - else - { - iReplyBuffer.Create( aSrcBuffer ); - } + iReplyBuffer.Create( aSrcBuffer ); break; case EReplyTypeOk: CreateOkOrErrorReply( iReplyBuffer, ETrue ); diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/bteng/src/btengsrvsession.cpp --- a/bluetoothengine/bteng/src/btengsrvsession.cpp Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvsession.cpp Fri May 28 17:03:06 2010 +0300 @@ -188,6 +188,8 @@ { case EBTEngSetPowerState: { + // Store auto off information + iAutoSwitchOff = (TBool) aMessage.Int1(); Server()->SetPowerStateL( aMessage ); } break; diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/bthid/bthidkbdsettings/data/BthidResource.rss --- a/bluetoothengine/bthid/bthidkbdsettings/data/BthidResource.rss Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/bthid/bthidkbdsettings/data/BthidResource.rss Fri May 28 17:03:06 2010 +0300 @@ -98,11 +98,13 @@ command=EBTKeyCmdAppChange; txt = qtn_hid_change; }, +#ifdef __SERIES60_HELP MENU_ITEM { - command=EBTKeyCmdAppHelp; - txt = qtn_hid_help; + command = EBTKeyCmdAppHelp; + txt = qtn_options_help; }, +#endif MENU_ITEM { command=EEikCmdExit; diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/group/BTMAC.mmp --- a/bluetoothengine/btmac/group/BTMAC.mmp Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/btmac/group/BTMAC.mmp Fri May 28 17:03:06 2010 +0300 @@ -51,6 +51,7 @@ SOURCE btmstempd.cpp SOURCE btmsreconnect.cpp SOURCE btmsdisconnect.cpp +SOURCE btmpagescanparametersmanager.cpp USERINCLUDE ../inc/btmac ../common SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/ecom diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/inc/btmac/btmman.h --- a/bluetoothengine/btmac/inc/btmac/btmman.h Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/btmac/inc/btmac/btmman.h Fri May 28 17:03:06 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: the entry of this plugin. -* Version : %version: 12.1.7 % +* Version : %version: 12.1.7.1.1 % * */ @@ -38,6 +38,7 @@ class CBtmState; class CBtmActive; class CBtmcHandlerApi; +class CBtmPageScanParametersManager; /** * the main class of BTMAC. @@ -167,7 +168,11 @@ * @param aAddr the address of the remote device. */ void SetCmdHandlerRvcSupport( const TBTDevAddr& aAddr ); - + + void StartedListenning(); + + void StoppedListenning(); + private: // From base class CBTAccPlugin @@ -328,6 +333,8 @@ TBool iEdr; CBTEngDiscovery* iBteng; + + CBtmPageScanParametersManager* iPageScanParametersManager; }; #endif // C_BTMMAN_H diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/inc/btmac/btmpagescanparametersmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btmac/inc/btmac/btmpagescanparametersmanager.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,56 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef BTMPAGESCANPARAMETERSMANAGER_H +#define BTMPAGESCANPARAMETERSMANAGER_H + +#include +#include +#include "btmactive.h" + +class CBtmPageScanParametersManager : public CBase, public MBtmActiveObserver + { +public: + static CBtmPageScanParametersManager* NewL(); + ~CBtmPageScanParametersManager(); + + void Activate(); + void Deactivate(); + +private: // From MBtmActiveObserver + void RequestCompletedL(CBtmActive& aActive); + void CancelRequest(CBtmActive& aActive); + +private: + void StartTimer(TInt aService, TInt aTimeout); + void StopTimer(); + + void DisableFastConnection(); + +protected: + CBtmPageScanParametersManager(); + void ConstructL(); + +protected: + RProperty iCallStateKey; + CBtmActive* iCallStateListener; + RProperty iPageScanParametersKey; + CBtmActive* iPageScanParametersListener; + RTimer iTimer; + CBtmActive* iTimerActive; + TBool iIsBeingDeactivated; + }; + +#endif // C_BTMSDISCONNECT_H diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/src/btmac/btmman.cpp --- a/bluetoothengine/btmac/src/btmac/btmman.cpp Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/btmac/src/btmac/btmman.cpp Fri May 28 17:03:06 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: CBtmMan definition -* Version : %version: 15.1.8 % +* Version : %version: 15.1.8.1.1 % * */ @@ -27,6 +27,7 @@ #include "btmactive.h" #include "btmstate.h" #include "btmslisten.h" +#include "btmpagescanparametersmanager.h" #include "debug.h" @@ -71,6 +72,7 @@ DeleteAllRegisteredServices(); delete iBteng; iServices.Close(); + delete iPageScanParametersManager; TRACE_FUNC_EXIT } @@ -452,10 +454,30 @@ iEdr = (edr == EBTEScoSupported) ? ETrue : EFalse; TRACE_INFO((_L("EDR feature %d"), iEdr)) iBteng = CBTEngDiscovery::NewL(); + TRAP_IGNORE(iPageScanParametersManager = CBtmPageScanParametersManager::NewL()); CBtmState* state = CBtmsListen::NewL(*this); CleanupStack::PushL(state); ChangeStateL(state); CleanupStack::Pop(state); TRACE_FUNC_EXIT } - + +void CBtmMan::StartedListenning() + { + TRACE_FUNC_ENTRY + if (iPageScanParametersManager) + { + iPageScanParametersManager->Activate(); + } + TRACE_FUNC_EXIT + } + +void CBtmMan::StoppedListenning() + { + TRACE_FUNC_ENTRY + if (iPageScanParametersManager) + { + iPageScanParametersManager->Deactivate(); + } + TRACE_FUNC_EXIT + } diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btmac/src/btmac/btmpagescanparametersmanager.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,295 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "btmpagescanparametersmanager.h" +#include +#include +#include +#include +#include "debug.h" + +// in the current configuration an incoming call ringing limit is 30 seconds +// if for some reason we don't receive the call state change +// we disable fast connection page scan settings in 35 seconds +const TInt KFastConnectionTime = 35000000; +// a timeout for resetting page scan settings +// if we don't receive a confirmation we try to reset again +const TInt KRestoreStandardParametersTime = 1000000; + +const TInt KCallStateListenerService = 8; +const TInt KPageScanParametersListenerService = 9; +const TInt KFastConnectionService = 10; +const TInt KRestoreStandardParametersService = 11; + +CBtmPageScanParametersManager::CBtmPageScanParametersManager() + : iIsBeingDeactivated(EFalse) + { + } + +CBtmPageScanParametersManager::~CBtmPageScanParametersManager() + { + TRACE_FUNC_ENTRY + delete iTimerActive; + iTimer.Close(); + if (iCallStateKey.Handle()) + { + iCallStateKey.Cancel(); + } + delete iPageScanParametersListener; + iCallStateKey.Close(); + if (iPageScanParametersKey.Handle()) + { + iPageScanParametersKey.Cancel(); + } + delete iCallStateListener; + iPageScanParametersKey.Close(); + TRACE_FUNC_EXIT + } + +void CBtmPageScanParametersManager::ConstructL() + { + TRACE_FUNC_ENTRY + LEAVE_IF_ERROR(iCallStateKey.Attach(KPSUidCtsyCallInformation, KCTsyCallState)); + iCallStateListener = CBtmActive::NewL(*this, CActive::EPriorityStandard, + KCallStateListenerService); + + LEAVE_IF_ERROR(iPageScanParametersKey.Attach(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetPageScanParameters)); + iPageScanParametersListener = CBtmActive::NewL(*this, CActive::EPriorityStandard, + KPageScanParametersListenerService); + + iTimerActive = CBtmActive::NewL(*this, CActive::EPriorityStandard, KFastConnectionService); + TRACE_FUNC_EXIT + } + +CBtmPageScanParametersManager* CBtmPageScanParametersManager::NewL() + { + TRACE_STATIC_FUNC_ENTRY + CBtmPageScanParametersManager* self = new( ELeave ) CBtmPageScanParametersManager(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CBtmPageScanParametersManager::StartTimer(TInt aService, TInt aTimeout) + { + if (!iTimerActive->IsActive()) + { + TRACE_FUNC_ENTRY + iTimer.CreateLocal(); + iTimer.After(iTimerActive->iStatus, aTimeout); + iTimerActive->SetRequestId(aService); + iTimerActive->GoActive(); + TRACE_FUNC_EXIT + } + else + { + TRACE_WARNING(_L("WARNING, page scan manager timer is already active")) + } + } + +void CBtmPageScanParametersManager::StopTimer() + { + if (iTimerActive->IsActive()) + { + TRACE_FUNC_ENTRY + iTimerActive->Cancel(); + iTimer.Close(); + TRACE_FUNC_EXIT + } + } + +void CBtmPageScanParametersManager::RequestCompletedL(CBtmActive& aActive) + { + TRACE_FUNC_ENTRY + TRACE_INFO((_L("request id %d status %d"), aActive.RequestId(), aActive.iStatus.Int())) + if (aActive.iStatus.Int() == KErrNone) + { + switch (aActive.RequestId()) + { + case KCallStateListenerService: + { + iCallStateKey.Subscribe(aActive.iStatus); + aActive.GoActive(); + + TInt callState; + TInt ret = iCallStateKey.Get(callState); + if (ret == KErrNone) + { + TRACE_INFO((_L("call state received %d"), callState)) + if (callState == EPSCTsyCallStateRinging) + { + // an incoming call ringing => switch to fast page scanning + TRACE_INFO((_L("switching to fast page scanning"))) + (void) RProperty::Set(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothSetPageScanParameters, + EFastConnectionPageScanParameters); + + // we will disable fast page scanning when the timer gets expired + StartTimer(KFastConnectionService, KFastConnectionTime); + } + else if (iTimerActive->IsActive() && iTimerActive->RequestId() == KFastConnectionService) + { + // the incoming call is not ringing anymore => switch to standard page scanning + TRACE_INFO((_L("switching to standard page scanning"))) + DisableFastConnection(); + } + } + break; + } + + case KPageScanParametersListenerService: + { + iPageScanParametersKey.Subscribe(aActive.iStatus); + aActive.GoActive(); + + TInt pageScanParameters; + TInt ret = iPageScanParametersKey.Get(pageScanParameters); + if (ret == KErrNone) + { + TRACE_INFO((_L("page scan parameters received %d"), pageScanParameters)) + if (iTimerActive->IsActive() && iTimerActive->RequestId() == KRestoreStandardParametersService + && pageScanParameters == EStandardPageScanParameters) + { + TRACE_INFO((_L("standard page scan parameters enabled"))) + StopTimer(); + if (iIsBeingDeactivated) + { + TRACE_INFO((_L("page scan parameters service is stopped"))) + iPageScanParametersKey.Cancel(); + } + } + } + break; + } + + case KFastConnectionService: + case KRestoreStandardParametersService: + { + // try to reset the page scan setting because it hasn't been confirmed yet + TRACE_INFO((_L("timer expired, switching to standard page scanning"))) + DisableFastConnection(); + break; + } + + default: + { + TRACE_WARNING(_L("WARNING, unknown service")) + break; + } + } + } + TRACE_FUNC_EXIT + } + +void CBtmPageScanParametersManager::CancelRequest(CBtmActive& aActive) + { + TRACE_FUNC_ENTRY + switch (aActive.RequestId()) + { + case KFastConnectionService: + case KRestoreStandardParametersService: + { + iTimer.Cancel(); + break; + } + default: + break; + } + TRACE_FUNC_EXIT + } + +void CBtmPageScanParametersManager::DisableFastConnection() + { + TRACE_FUNC_ENTRY + StopTimer(); + + // switch to standard page scanning + (void) RProperty::Set(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothSetPageScanParameters, + EStandardPageScanParameters); + + // we will disable fast page scanning when the timer gets expired + StartTimer(KRestoreStandardParametersService, KRestoreStandardParametersTime); + TRACE_FUNC_EXIT + } + +void CBtmPageScanParametersManager::Activate() + { + TRACE_FUNC_ENTRY + iIsBeingDeactivated = EFalse; + + if (!iCallStateListener->IsActive()) + { + iCallStateKey.Subscribe(iCallStateListener->iStatus); + iCallStateListener->GoActive(); + } + else + { + TRACE_WARNING(_L("WARNING, call state is already being listened")) + } + + if (!iPageScanParametersListener->IsActive()) + { + iPageScanParametersKey.Subscribe(iPageScanParametersListener->iStatus); + iPageScanParametersListener->GoActive(); + } + else + { + TRACE_WARNING(_L("WARNING, call state is already being listened")) + } + + TInt callState; + TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); + if(err == KErrNone && callState == EPSCTsyCallStateRinging) + { + // an incoming call already ringing => switch to fast page scanning + TRACE_INFO((_L("call is already ringing, switching to fast page scanning"))) + (void) RProperty::Set(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothSetPageScanParameters, + EFastConnectionPageScanParameters); + + // we will disable fast page scanning when the timer gets expired + StartTimer(KFastConnectionService, KFastConnectionTime); + } + TRACE_FUNC_EXIT + } + +void CBtmPageScanParametersManager::Deactivate() + { + TRACE_FUNC_ENTRY + iIsBeingDeactivated = ETrue; + + // stop call state listening + iCallStateKey.Cancel(); + + if (iTimerActive->IsActive()) + { + // if fast page scanning is active, disable it + // if we're already switching to standard page scanning, do nothing + if (iTimerActive->RequestId() == KFastConnectionService) + { + TRACE_INFO((_L("deactivation started, switching to standard page scanning"))) + DisableFastConnection(); + } + } + else + { + // if no timer is active we just stop page scan parameters listening + iPageScanParametersKey.Cancel(); + } + TRACE_FUNC_EXIT + } diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btmac/src/btmac/btmslisten.cpp --- a/bluetoothengine/btmac/src/btmac/btmslisten.cpp Mon May 17 11:06:23 2010 +0300 +++ b/bluetoothengine/btmac/src/btmac/btmslisten.cpp Fri May 28 17:03:06 2010 +0300 @@ -43,6 +43,7 @@ { delete iHfpSock; delete iHspSock; + Parent().StoppedListenning(); } void CBtmsListen::EnterL() @@ -83,6 +84,7 @@ TRACE_STATE((_L("[BTMAC State] Start EBTProfileHSP, last used port %d"), lastUsedPort)) Parent().RegisterServiceL(ag, iHspSock->ListenL(ag, sec,lastUsedPort)); iHspSock->SetService(EBTProfileHSP); + Parent().StartedListenning(); } void CBtmsListen::OpenAudioLinkL(const TBTDevAddr& aAddr, TRequestStatus& aStatus) diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btnotif/rom/Btnotif.iby --- a/bluetoothengine/btnotif/rom/Btnotif.iby Mon May 17 11:06:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2003-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: Image description file for project btnotif -* -*/ - - -#ifndef BTNOTIF_IBY -#define BTNOTIF_IBY - -#include - -#ifdef __BT - -file=ABI_DIR/BUILD_DIR/btnotifsrv.exe SHARED_LIB_DIR/btnotifsrv.exe -ECOM_PLUGIN( btnotifwrapper.dll, btnotifwrapper.rsc ) - -#endif // __BT - -#endif // BTNOTIF_IBY diff -r a0ea99b6fa53 -r 19bd632b5100 bluetoothengine/btnotif/rom/btnotif.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/rom/btnotif.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2003-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: Image description file for project btnotif +* +*/ + + +#ifndef BTNOTIF_IBY +#define BTNOTIF_IBY + +#include + +#ifdef __BT + +file=ABI_DIR/BUILD_DIR/btnotifsrv.exe SHARED_LIB_DIR/btnotifsrv.exe +ECOM_PLUGIN( btnotifwrapper.dll, btnotifwrapper.rsc ) + +#endif // __BT + +#endif // BTNOTIF_IBY diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for collection btobexprofiles +* +*/ + + +PRJ_PLATFORMS +DEFAULT +#include "../obexreceiveservices/group/bld.inf" +#include "../obexsendservices/group/bld.inf" +#include "../obexserviceman/group/bld.inf" + +PRJ_EXPORTS + + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/data/101F8671.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/data/101F8671.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005 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: PC Connectivity Plug-in resource file +* +*/ + + +#include + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101F8671; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101F7C8C; + implementations = + { + // Info for CSConPCConnplugin + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F8671; + version_no = 1; + display_name = "Obex Services"; + default_data = "OBEX/BT"; + + // + // opaque_data contains parameters used by following API calls in SRCS: + // 1. Setup USB interface string descriptor in Unicode; + // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo); + // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService, + // TInt aProtocol, + // TInt aChannel, + // TBool aAuthenticate, + // TBool aAuthorise, + // TBool aEncrypt ); + // opaque_data = "@0||@1||@2||@3||@4||@5||@6" + // @0 aStrDesc e.g. "PC Connectivity" + // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09" + // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106 + // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013 + // @4 aAuthenticate e.g. EFalse, 0 + // @5 aAuthorise e.g. EFalse, 0 + // @6 aEncrypt e.g. EFalse, 0 + // + opaque_data = "OBEX|"\ + "|\xE3\x3D\x95\x45\x83\x74\x4A\xD7\x9E\xC5\xC1\x6B\xE3\x1E\xDE\x8E|"\ + "|0x111b|"\ + "|0x1013|"\ + "|0|"\ + "|1|"\ + "|0|"\ + "|0xfffE|"\ + "|0xfffE"; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/eabi/MtmUiServerBipu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/eabi/MtmUiServerBipu.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z18NewMessageHandlerLv @ 1 NONAME + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2002 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 a MtmUiServerBip. +* +*/ + + + +PRJ_PLATFORMS + + +PRJ_EXPORTS + +PRJ_MMPFILES +../group/obexservicebip.mmp + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2002 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 project specification file for the obexserviceopp. +* +* +*/ + +#include + +TARGET obexservicebip.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101F8671 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE obexservicebip.cpp +SOURCE BIPController.cpp +SOURCE BIPCapabilityHandler.cpp +SOURCE BIPXMLWriter.cpp +SOURCE BIPImageHandler.cpp + + + +START RESOURCE ../data/101F8671.rss + TARGET obexservicebip.rsc +END + + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../inc ../../../../inc +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib // Base library +LIBRARY irobex.lib // For Object exchange +LIBRARY efsrv.lib +LIBRARY imageconversion.lib +LIBRARY bafl.lib +LIBRARY obexutils.lib +LIBRARY ecom.lib +LIBRARY aknnotify.lib +LIBRARY avkon.lib +LIBRARY sysutil.lib +LIBRARY platformenv.lib +LIBRARY esock.lib +LIBRARY bluetooth.lib // Bluetooth libraries +LIBRARY btdevice.lib // Bluetooth library +LIBRARY btmanclient.lib + +//Bteng APIs +LIBRARY btengdevman.lib //btengdevman.dll +LIBRARY btengsettings.lib //btengsettings.dll +LIBRARY btengconnman.lib //btengconnman.dll + + +DEBUGLIBRARY flogger.lib // For logging + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/BIPCapabilityHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPCapabilityHandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 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: Capability object handler class declaration +* +*/ + + +#ifndef _BIPCAPABILITYHANDLER_H +#define _BIPCAPABILITYHANDLER_H + +//INCLUDES +#include +#include +#include "debug.h" + +// FORWARD DECLARATIONS +class CBIPXmlWriter; +class CImageTypeDescription; + +// CLASS DECLARATION + +/** +* Creates an xml capability object +*/ +NONSHARABLE_CLASS (CBIPCapabilityHandler) : public CBase + { + public: //Constructors and destructors + /** + * Two-phased constructor. + */ + static CBIPCapabilityHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CBIPCapabilityHandler(); + + public: //New Functions + + /** + * Creates an array of supported image types. + * @param aFileName On return contains the name + * of the file that was created + * @return None. + */ + void CreateCapabilityObjectL( TFileName& aFileName ); + + /** + * Creates an array of supported image types. + * @param None. + * @return None. + */ + void SupportedImageTypesL( ); + + private: + + /** + * C++ default constructor. + */ + CBIPCapabilityHandler(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + CBIPXmlWriter* iBIPXmlWriter; + CDesC8ArrayFlat* iImageTypeArray; + }; + +#endif //_BIPCAPABILITYHANDLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/BIPController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2004 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: Bip controller class declaration. +* +*/ + + +#ifndef _BIPCONTROLLER_H +#define _BIPCONTROLLER_H + +//INCLUDES + +#include +#include +#include +#include +#include +#include "obexutilspropertynotifier.h" +#include "debug.h" +#include +#include +#include +#include +#include "btengdevman.h" +#include + +// FORWARD DECLARATIONS + +class CBIPCapabilityHandler; +class CBIPImageHandler; + + +// CLASS DECLARATION + +/** +* The main controller for Basic Imaging Profile. +*/ +NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify, + public MObexUtilsPropertyNotifyHandler, + public MGlobalProgressCallback, public MGlobalNoteCallback, + public MBTEngDevManObserver + { +public: + static CBIPController* NewL(); + ~CBIPController(); + +private: // from CSrcsInterface + TBool IsOBEXActive(); + void SetMediaType(TSrcsMediaType aMediaType); + TInt SetObexServer(CObexServer* aServer); + +private: // from MObexServerNotify + void ErrorIndication(TInt aError); + void TransportUpIndication(); + void TransportDownIndication(); + TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo); + void ObexDisconnectIndication(const TDesC8& aInfo); + CObexBufObject* PutRequestIndication(); + TInt PutPacketIndication(); + TInt PutCompleteIndication(); + CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject); + TInt GetPacketIndication(); + TInt GetCompleteIndication(); + TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo); + void AbortIndication(); + +private: // from MObexUtilsPropertyNotifyHandler + void HandleNotifyL(TMemoryPropertyCheckType aCheckType); + +private: // from MGlobalProgressCallback + void HandleGlobalProgressDialogL(TInt aSoftkey); + +private: // from MGlobalNoteCallback + void HandleGlobalNoteDialogL(TInt aSoftkey); + +private: // from MBTEngDevManObserver + void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); + +private: + CBIPController(); + void ConstructL(); + + void CancelTransfer(); + + void HandleError(TBool aAbort); + void HandleGetCapabilityRequestL(); + void HandlePutImageRequestL(); + TInt HandlePutCompleteIndication(); + TInt RemoveCapabilityObject(); + + TBool CheckCapacityL(); + void LaunchReceivingIndicatorL(); + inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); } + void UpdateReceivingIndicator(); + void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); + TInt GetDriveWithMaximumFreeSpaceL(); + +private: + enum TBipTransferState + { + ETransferIdle, + ETransferPut, + ETransferGet, + ETransferPutDiskError, + ETransferPutInitError, + ETransferPutCancel, + }; + +private: // Data + CBIPCapabilityHandler* iBIPCapabilityHandler; + CObexBufObject* iBTObject; + CObexServer* iBTObexServer; + TBipTransferState iBTTransferState; + TInt iDrive; + CBIPImageHandler* iBIPImageHandler; + CObexBufObject* iGetObject; + CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive; + CObexUtilsPropertyNotifier* iLowMemoryActiveMMC; + TMsvId iMsvIdParent; + TMsvId iMsvIdAttach; + RFile iFile; + RFs iFs; + TFileName iFullPathFilename; + TFileName iCapabilityFileName; + TFileName iDefaultFolder; + TFileName iPreviousDefaultFolder; + CBufFlat *iBuf; + TBool iLengthHeaderReceived; + TInt iTotalSizeByte; + CGlobalProgressDialog* iProgressDialog; + CGlobalDialog* iWaitDialog; + TBool iNoteDisplayed; + CBTEngDevMan* iDevMan; + CBTDeviceArray* iResultArray; + TBTDeviceName iRemoteDeviceName; + TFileName iReceivingFileName; + TFileName iCenRepFolder; + }; + +_LIT(KBipPanicCategory, "BIP"); +enum TBipPanicCode + { + EBipPanicNotBluetoothMediaType = 0, + }; + +#endif //_BIPCONTROLLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/BIPImageHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPImageHandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002 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: Bip image handler class declaration. +* +*/ + + +#ifndef _BIPIMAGEHANDLER_H +#define _BIPIMAGEHANDLER_H + +//INCLUDES +#include +#include +#include "debug.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Generates image handles and sets them to obex response packets. +*/ +NONSHARABLE_CLASS (CBIPImageHandler) : public CBase + { + public: //Constructors and destructors + + /** + * Two-phased constructor. + */ + static CBIPImageHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CBIPImageHandler(); + + public: //New Functions + + /** + * Adds Image handle to Obex response packet + * @param aObexServer Current obex server + * @return None. + */ + void AddImageHandleHeaderL( CObexServer* aObexServer ); + + private: + + /** + * C++ default constructor. + */ + CBIPImageHandler(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + TUint iImageHandleValue; + + }; + +#endif //_BIPIMAGEHANDLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2002 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: XML writer class declaration. +* +*/ + + +#ifndef _BIPXMLWRITER_H +#define _BIPXMLWRITER_H + +//INCLUDES +#include +#include +#include +#include "debug.h" + +// CONSTANTS +enum TElementType + { + EImageFormats, + EPreferredFormat, + EAttachmentFormats, + EFilteringParameters, + EDPOFOptions + }; + +enum TAttributeType + { + EEncoding, + EPixel, + ETransformation, + EMaxSize + }; + +// CLASS DECLARATION + +/** +* XML writer for BIP capability object +* +*/ +NONSHARABLE_CLASS (CBIPXmlWriter) : public CBase + { + public: //Constructors and destructors + + /** + * Two-phased constructor. + */ + static CBIPXmlWriter* NewL(); + + /** + * Destructor. + */ + virtual ~CBIPXmlWriter(); + + public: //New Functions + + /** + * Open temporary file + * @param TFileName Contains the new temp file name. + * @return None. + */ + void OpenXmlDocumentL( TFileName& aFileName); + + /** + * Close temporary file. So that it can be used by clients + * @param None. + * @return None. + */ + void CloseXmlDocumentL(); + + /** + * Opens xml element for writing + * @param TElementType Element to be written to file + * @return None. + */ + void OpenXmlElementL( TElementType aElement ); + + /** + * Close xml element + * @param None + * @return None. + */ + void CloseXmlElementL( ); + + /** + * Add xml attribute to the open element + * @param TAttributeType Type of the attribute + * @param TDesC8 Attribute + * @return None. + */ + void AddXmlAttributeL( TAttributeType aAttributeType, TDesC8& aAttr ); + + private: + + /** + * C++ default constructor. + */ + CBIPXmlWriter(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + RFile ifile; + RFs iFileSession; + TFileName iFileName; + }; + +#endif //_BIPXMLWRITER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logging definition +* +*/ + + +#ifndef PRJ_LOGGING_H +#define PRJ_LOGGING_H + +#include "debugconfig.h" + +#ifdef PRJ_ENABLE_TRACE + +#ifdef PRJ_FILE_TRACE +#include +#else +#include +#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; + +NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow + { +public: + void Overflow(TDes16& /*aDes*/) {} + }; + +NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow + { +public: + void Overflow(TDes8& /*aDes*/) {} + }; + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TBuf16 theFinalString; + theFinalString.Append(KTracePrefix16); + TOverflowTruncate16 overflow; + theFinalString.AppendFormatList(aFmt,list,&overflow); + RDebug::Print(theFinalString); +#endif + } + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list, aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TOverflowTruncate8 overflow; + TBuf8 buf8; + buf8.Append(KTracePrefix8); + buf8.AppendFormatList(aFmt, list, &overflow); + TBuf16 buf16(buf8.Length()); + buf16.Copy(buf8); + TRefByValue 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 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 buf; + buf.Append(KLeavePrefix8); + buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName); + Trace(buf); + User::LeaveIfError(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(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} + +#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} + +#define TRACE_FUNC_ENTRY_THIS {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_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}} + +#define TRACE_FUNC_THIS {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;}} + +#define TRACE_ONLY(p) p + +#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(User::LeaveIfError(REASON));} + +#define LEAVE(REASON) {static_cast(User::Leave(REASON));} + +#define TRACE_FUNC_ENTRY + +#define TRACE_FUNC_ENTRY_THIS + +#define TRACE_FUNC_EXIT + +#define TRACE_FUNC + +#define TRACE_FUNC_THIS + +#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;} + +#define TRACE_ONLY(p) + +#endif // PRJ_ENABLE_TRACE + +#endif // PRJ_LOGGING_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/debugconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/debugconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_DEBUGCONFIG_H +#define OBEXSM_DEBUGCONFIG_H + +#include "prjconfig.h" + + +/** + * Custom logging variations. + */ +#ifdef PRJ_FILE_TRACE +_LIT(KLogFile,"bipreceiveservice.txt"); +_LIT(KLogDir,"locod"); +#endif + +#ifdef PRJ_ENABLE_TRACE +_LIT(KTracePrefix16, "[BIP] "); +_LIT8(KTracePrefix8, "[BIP] "); +_LIT8(KFuncFormat8, "><%S"); +_LIT8(KFuncThisFormat8, "><%S, [0x%08X]"); +_LIT8(KFuncEntryFormat8, ">%S"); +_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]"); +_LIT8(KFuncExitFormat8, "<%S"); + +_LIT(KPanicCategory, "BIP"); +_LIT8(KPanicPrefix8, "PANIC code "); +_LIT8(KLeavePrefix8, "LEAVE code "); +#endif + +#endif // OBEXSM_DEBUGCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/inc/prjconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/inc/prjconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_PRJCONFIG_H +#define OBEXSM_PRJCONFIG_H + +/** + * Traces are enabled via RDebug::Print() in UDEB build, by default. + */ +#ifdef _DEBUG +#define PRJ_ENABLE_TRACE +#endif + +/** + * Traces will be written 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 // OBEXSM_PRJCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/src/BIPCapabilityHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPCapabilityHandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2002 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: Implementation of CBIPCapabilityHandler +* +*/ + + +// INCLUDE FILES +#include "BIPCapabilityHandler.h" +#include "BIPXMLWriter.h" +#include + +// CONSTANTS +_LIT8( KBIPXmlImagePixel, "\" pixel=\"0*0-65535*65535\""); +_LIT8( KBIPXmlImageMaxSize, " maxsize=\"50000000\""); + +const TInt KBIPMaxTypeLenght = 256; +const TInt KBIPMaxAttrLength = 32; + +// MODULE DATA STRUCTURES + +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBIPCapabilityHandler* CBIPCapabilityHandler::NewL() + { + TRACE_FUNC_ENTRY + CBIPCapabilityHandler* self = new ( ELeave ) CBIPCapabilityHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return( self ); + } + +// --------------------------------------------------------- +// CBIPCapabilityHandler() +// --------------------------------------------------------- +// +CBIPCapabilityHandler::CBIPCapabilityHandler() + { + TRACE_FUNC_ENTRY + } + +// --------------------------------------------------------- +// CreateCapabilityObjectL() +// --------------------------------------------------------- +// +void CBIPCapabilityHandler::CreateCapabilityObjectL( TFileName& aFileName ) + { + TRACE_FUNC_ENTRY + iBIPXmlWriter = CBIPXmlWriter::NewL(); + iBIPXmlWriter->OpenXmlDocumentL( aFileName ); + SupportedImageTypesL(); + TBufC8 pixelRange( KBIPXmlImagePixel ); + TBufC8 maxSize( KBIPXmlImageMaxSize ); + TBufC8 encoding; + for( TInt index = 0; index < iImageTypeArray->Count(); index++ ) + { + encoding = iImageTypeArray->MdcaPoint( index ); + iBIPXmlWriter->OpenXmlElementL( EImageFormats ); + iBIPXmlWriter->AddXmlAttributeL( EEncoding, encoding ); + iBIPXmlWriter->AddXmlAttributeL( EPixel, pixelRange ); + iBIPXmlWriter->AddXmlAttributeL( EMaxSize, maxSize ); + iBIPXmlWriter->CloseXmlElementL(); + } + iBIPXmlWriter->CloseXmlDocumentL(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// SupportedImageTypesL() +// --------------------------------------------------------- +// +void CBIPCapabilityHandler::SupportedImageTypesL( ) + { + TRACE_FUNC_ENTRY + TInt retVal = KErrNone; + RFileExtensionMIMETypeArray theFileExtensionArray; + iImageTypeArray->Reset(); + + TRAP( retVal, CImageDecoder::GetFileTypesL( theFileExtensionArray ) ); + if( retVal != KErrNone ) + { + theFileExtensionArray.ResetAndDestroy(); + User::Leave( retVal ); + } + + HBufC8* name = HBufC8::NewLC( KBIPMaxTypeLenght ); + for( TInt index = 0; index < theFileExtensionArray.Count(); index++ ) + { + CFileExtensionMIMEType& fileExtAndMIMEType = *theFileExtensionArray[index]; + name->Des().Copy( fileExtAndMIMEType.DisplayName() ); + + TInt dummy; + retVal = iImageTypeArray->Find( name->Des(), dummy ); + if( retVal != KErrNone ) + { + iImageTypeArray->AppendL( name->Des() ); + } + name->Des().Zero(); + } + CleanupStack::PopAndDestroy(name); + + theFileExtensionArray.ResetAndDestroy(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------- +// +void CBIPCapabilityHandler::ConstructL() + { + TRACE_FUNC_ENTRY + iImageTypeArray = new (ELeave) CDesC8ArrayFlat(1); + } + +// --------------------------------------------------------- +// ~CBIPCapabilityHandler() +// --------------------------------------------------------- +// +CBIPCapabilityHandler::~CBIPCapabilityHandler() + { + TRACE_FUNC + delete iBIPXmlWriter; + delete iImageTypeArray; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,895 @@ +/* +* 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: Obex Server image receiver module implementation +* +*/ + + +// INCLUDE FILES +#include // AVKON components +#include "BIPController.h" +#include "BIPCapabilityHandler.h" +#include "BIPImageHandler.h" + + +#include +#include // Series 60 localisation stringloader +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "debug.h" + +// CONSTANTS +_LIT8(KBipCapabilityType, "x-bt/img-capabilities\0"); + + +const TInt KBufferSize = 0x10000; // 64 kB + +// ================= MEMBER FUNCTIONS ======================= + +CBIPController* CBIPController::NewL() + { + CBIPController* self = new ( ELeave ) CBIPController(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CBIPController() +// --------------------------------------------------------- +// +CBIPController::CBIPController() + { + } + +// --------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------- +// +void CBIPController::ConstructL() + { + TRACE_FUNC_ENTRY + iBIPImageHandler = CBIPImageHandler::NewL(); + iLowMemoryActiveCDrive = CObexUtilsPropertyNotifier::NewL(this, ECheckPhoneMemory); + iLowMemoryActiveMMC = CObexUtilsPropertyNotifier::NewL(this, ECheckMMCMemory); + iDevMan = CBTEngDevMan::NewL(this); + iResultArray = new(ELeave) CBTDeviceArray(1); + // Get default folder from CenRep + TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder, iCenRepFolder); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// ~CBIPController() +// --------------------------------------------------------- +// +CBIPController::~CBIPController() + { + TRACE_FUNC_ENTRY + delete iGetObject; + delete iBIPCapabilityHandler; + delete iBIPImageHandler; + delete iLowMemoryActiveCDrive; + delete iLowMemoryActiveMMC; + delete iBuf; + delete iProgressDialog; + delete iWaitDialog; + delete iBTObject; + delete iDevMan; + if (iResultArray) + { + iResultArray->ResetAndDestroy(); + delete iResultArray; + } + iFs.Close(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// ErrorIndication() +// --------------------------------------------------------- +// +void CBIPController::ErrorIndication(TInt TRACE_ONLY(aError)) + { + TRACE_FUNC_ENTRY + TRACE_ERROR((_L("[obexreceiveservicebip] CBIPController: ErrorIndication error:\t %d"), aError)); + HandleError(EFalse); // false because this is not an explicit abort + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// AbortIndication() +// --------------------------------------------------------- +// +void CBIPController::AbortIndication() + { + TRACE_FUNC_ENTRY + HandleError(ETrue); // true because this is an explicit abort + TRACE_FUNC_EXIT + } + +void CBIPController::HandleError(TBool aAbort) + { + TRACE_FUNC_ENTRY + + if( iBTTransferState == ETransferPut || (!aAbort && iBTTransferState == ETransferPutDiskError) ) + { + if(iBTObject) + { + iBTObject->Reset(); + } + CancelTransfer(); + TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( R_BT_FAILED_TO_RECEIVE)); + } + delete iBuf; + iBuf = NULL; + + iBTTransferState = ETransferIdle; + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject,iMsvIdParent)); + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL(iFullPathFilename)); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CancelTransfer() +// --------------------------------------------------------- +// +void CBIPController::CancelTransfer() + { + TRACE_FUNC_ENTRY + CloseReceivingIndicator(); + if(iBTTransferState == ETransferPut) + { + iBTTransferState = ETransferPutCancel; + } + else // go to idle for all other states + { + iBTTransferState = ETransferIdle; + } + } +// --------------------------------------------------------- +// TransportUpIndication() +// --------------------------------------------------------- +// +void CBIPController::TransportUpIndication() + { + TRACE_FUNC + if (!iFs.Handle()) + { + TRACE_INFO( (_L( "[bipreceiveservice] TransportUpIndication iFs.Connect()" )) ); + if (iFs.Connect()) // error value not checked, iFs.Handle() checked one more time before first useage + { + TRACE_INFO( (_L( "[bipreceiveservice] TransportUpIndication iFs.Connect() failed" )) ); + } + } + + iFile = RFile(); + iFullPathFilename.Zero(); + iCapabilityFileName.Zero(); + } + +// --------------------------------------------------------- +// ObexConnectIndication() +// --------------------------------------------------------- +// +TInt CBIPController::ObexConnectIndication( const TObexConnectInfo& /*aRemoteInfo*/, const TDesC8& /*aInfo*/ ) + { + TRACE_FUNC + + // Get remote device socket address and bluetooth name + // Remote bluetooth name will be displayed in the new message in inbox. + // + TSockAddr addr; + iBTObexServer->RemoteAddr(addr); + TBTDevAddr tBTDevAddr = static_cast(addr).BTAddr(); + + TBTRegistrySearch nameSearch; + nameSearch.FindAddress(tBTDevAddr); + + iResultArray->Reset(); + // Ignore any errors here, if we don't get the name, we don't get the name. + // It is also possible that the name is received too late.... + static_cast(iDevMan->GetDevices(nameSearch, iResultArray)); + + return KErrNone; + } + +// --------------------------------------------------------- +// ObexDisconnectIndication() +// --------------------------------------------------------- +// +void CBIPController::ObexDisconnectIndication(const TDesC8& /*aInfo*/) + { + TRACE_FUNC + } + +// --------------------------------------------------------- +// TransportDownIndication() +// --------------------------------------------------------- +// +void CBIPController::TransportDownIndication() + { + TRACE_FUNC + // Remove receiving buffer and files used during file receiving. + // + delete iBTObject; + iBTObject = NULL; + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); + iFs.Close(); + } + +// --------------------------------------------------------- +// PutRequestIndication() +// --------------------------------------------------------- +// +CObexBufObject* CBIPController::PutRequestIndication() + { + TRACE_FUNC_ENTRY + iLengthHeaderReceived = EFalse; // New put request so clear header based state + iBTTransferState = ETransferPut; + + // Checking if backup is running now - if backup process is active, then we + // need to cancel transfer - otherwise phone will freeze during receiving + // data + if ( TObexUtilsUiLayer::IsBackupRunning() ) + { + TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer.")); + iBTTransferState = ETransferPutInitError; + return NULL; + } + + TRAPD(err, HandlePutImageRequestL()); + if (err == KErrNone) + { + return iBTObject; + } + if (iBTTransferState != ETransferPutInitError) + { + iBTTransferState = ETransferPutDiskError; + } + TRACE_FUNC_EXIT + return NULL; + } + +// --------------------------------------------------------- +// PutPacketIndication() +// --------------------------------------------------------- +// +TInt CBIPController::PutPacketIndication() + { + TRACE_FUNC_ENTRY + if(iBTTransferState == ETransferPutCancel) + { + // User cancelled the put request, so error the next packet to terminate the put request. + // BIP considers the Unauthorized error response suitable for this... + HandleError(ETrue); // reset state and clear up + return KErrIrObexRespUnauthorized; + } + + if (iBTObject) + { + iTotalSizeByte = iBTObject->Length(); // get size of receiving file + iReceivingFileName = iBTObject->Name(); // get name of receiving file + + // Check that capacity is suitable as soon as possible + if(!iLengthHeaderReceived && iTotalSizeByte > 0) + { + iLengthHeaderReceived = ETrue; // total size value is from length header + TBool capacity = ETrue; + TRAPD(retTrap, capacity = CheckCapacityL()); + if(retTrap != KErrNone) + { + return KErrGeneral; + } + if(!capacity) + { + TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + return KErrDiskFull; + } + } + if(iBTObject->Name().Length() > KMaxFileName) + { + return KErrAccessDenied; + } + if(iBTTransferState == ETransferPutDiskError) + { + return KErrDiskFull; + } + // successfully received put packet if we reached here + iBTTransferState = ETransferPut; + + // Now we need to either create (in the first instance) or update the dialog on the UI. + if(ReceivingIndicatorActive()) + { + UpdateReceivingIndicator(); + } + else if(!iNoteDisplayed) + { + // No note launched yet, so try to launch + TRAPD(err, LaunchReceivingIndicatorL()); + iNoteDisplayed = (err == KErrNone); + } + } + + TRACE_FUNC_EXIT + return KErrNone; + } + +// --------------------------------------------------------- +// PutCompleteIndication() +// --------------------------------------------------------- +// +TInt CBIPController::PutCompleteIndication() // Once receive has completed. + { + TRACE_FUNC_ENTRY + TInt retVal = KErrNone; + if(iBTTransferState == ETransferPutCancel) + { + retVal = KErrIrObexRespUnauthorized; + HandleError(ETrue); + } + else + { + retVal = HandlePutCompleteIndication(); + iBTTransferState = ETransferIdle; + CloseReceivingIndicator(); + } + TRACE_FUNC_EXIT + return retVal; + } + +// --------------------------------------------------------- +// GetRequestIndication() +// --------------------------------------------------------- +// +CObexBufObject* CBIPController::GetRequestIndication( CObexBaseObject* aRequiredObject ) + { + TRACE_FUNC_ENTRY + iBTTransferState = ETransferGet; + TInt err = RemoveCapabilityObject(); + if (err == KErrNone) + { + if( aRequiredObject->Type() == KBipCapabilityType ) + { + TRAP( err, HandleGetCapabilityRequestL( ) ); + if( err == KErrNone ) + { + return iGetObject; + } + } + } + TRACE_FUNC_EXIT + return NULL; + } + +// --------------------------------------------------------- +// GetPacketIndication() +// --------------------------------------------------------- +// +TInt CBIPController::GetPacketIndication() + { + TRACE_FUNC_ENTRY + return KErrNone; + } + +// --------------------------------------------------------- +// GetCompleteIndication() +// --------------------------------------------------------- +// +TInt CBIPController::GetCompleteIndication() + { + TRACE_FUNC_ENTRY + delete iGetObject; + iGetObject=NULL; + TInt err = RemoveCapabilityObject(); + if (err != KErrNone) + { + err = KErrGeneral; + } + iBTTransferState = ETransferIdle; + TRACE_FUNC_EXIT + return err; + } + +// --------------------------------------------------------- +// SetPathIndication() +// --------------------------------------------------------- +// +TInt CBIPController::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, + const TDesC8& /*aInfo*/) + { + TRACE_FUNC + // SetPath is not implemented in BIP - so following IrOBEX guidance, return + // the Forbidden response code. + return KErrIrObexRespForbidden; + } + +/** +* This function is implementation for mixin-class for Obexutils. +* It is called every time another instance modifies disk status, +* for example when it cross warning/critical level. +* Parameters: +* @param aCheckType Disktype changes. +*/ +void CBIPController::HandleNotifyL(TMemoryPropertyCheckType aCheckType) + { + TRACE_FUNC_ENTRY + // Only interested on this notification if we are receiving something + if ( iBTTransferState == ETransferPut ) + { + // Check the keys, what has been changed. + if ( aCheckType == ECheckPhoneMemory ) + { + if ( SysUtil::FFSSpaceBelowCriticalLevelL( NULL, 0 ) ) + { + TRACE_INFO( _L( "[obexreceiveservicebip] CBIPController: Obex Server error diskfull:\t" ) ); + iBTTransferState = ETransferPutDiskError; + } + } + else if ( aCheckType == ECheckMMCMemory ) + { + if ( SysUtil::MMCSpaceBelowCriticalLevelL( NULL, 0 ) ) + { + TRACE_INFO( _L( "[obexreceiveservicebip] CBIPController: Obex Server error diskfull:\t" ) ); + iBTTransferState = ETransferPutDiskError; + } + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// HandleGetCapabilityRequestL() +// --------------------------------------------------------- +// +void CBIPController::HandleGetCapabilityRequestL() + { + TRACE_FUNC_ENTRY + CBIPCapabilityHandler* capHandler = CBIPCapabilityHandler::NewL(); + CleanupStack::PushL(capHandler); + capHandler->CreateCapabilityObjectL(iCapabilityFileName); + delete iGetObject; + iGetObject = NULL; + iGetObject = CObexBufObject::NewL(NULL); + iGetObject->SetDataBufL(iCapabilityFileName); + CleanupStack::PopAndDestroy(capHandler); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// HandlePutImageRequest() +// --------------------------------------------------------- +// +void CBIPController::HandlePutImageRequestL() + { + TRACE_FUNC_ENTRY + + delete iBTObject; + iBTObject = NULL; + + if (!iFs.Handle()) + { + User::Leave(KErrGeneral); + } + + // Assign an initial value to iDrive + iDrive = GetDriveWithMaximumFreeSpaceL(); + + // If iDrive is at critical space level, we immediately show out_of_memory. + // + if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, iDrive)) + { + TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + User::Leave(KErrGeneral); + } + + iBTObject = CObexBufObject::NewL(NULL); + + delete iBuf; + iBuf = NULL; + + TChar driveLetter; + iDefaultFolder.Zero(); + iFs.DriveToChar(iDrive, driveLetter); + iDefaultFolder.Append(driveLetter); + if ( iDrive == EDriveC ) + { + iDefaultFolder.Append(_L(":\\data\\")); + } + else + { + iDefaultFolder.Append(_L(":\\")); + } + + iDefaultFolder.Append(iCenRepFolder); + + iFile = RFile(); + iFullPathFilename.Zero(); + TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(iFile, iDefaultFolder, iFullPathFilename, iBuf, KBufferSize); + User::LeaveIfError(iFile.Open(iFs, iFullPathFilename, EFileWrite)); + TObexRFileBackedBuffer bufferdetails(*iBuf, iFile, CObexBufObject::EDoubleBuffering); + TRAPD(err, iBTObject->SetDataBufL(bufferdetails)); + if (err != KErrNone) + { + iBTTransferState = ETransferPutInitError; + User::Leave(KErrGeneral); + } + + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------- +// HandlePutCompleteIndication() +// --------------------------------------------------------- +// +TInt CBIPController::HandlePutCompleteIndication() + { + TRACE_FUNC_ENTRY + TInt retVal = KErrNone; + + iDefaultFolder.Zero(); + TChar driveLetter; + if ( iDrive == EDriveC ) + { + iFs.DriveToChar(iDrive, driveLetter); + iDefaultFolder.Append(driveLetter); + iDefaultFolder.Append(_L(":\\data\\")); + iDefaultFolder.Append(iCenRepFolder); + } + else + { + iFs.DriveToChar(iDrive, driveLetter); + iDefaultFolder.Append(driveLetter); + iDefaultFolder.Append(_L(":\\")); + iDefaultFolder.Append(iCenRepFolder); + } + + iFullPathFilename.Zero(); + iFullPathFilename.Append(iDefaultFolder); + TRAP ( retVal, TObexUtilsMessageHandler::SaveFileToFileSystemL(iBTObject, + KUidMsgTypeBt, + iMsvIdParent, + iFullPathFilename, + iFile, + iRemoteDeviceName)); + if ( retVal == KErrNone) + { + TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename)); + } + + + if( retVal != KErrNone ) + { + TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); + TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent)); + retVal = KErrDiskFull; + } + // Even if the object saving fails we must return image handle with error code + TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) ); + TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) ); + delete iBTObject; + iBTObject = NULL; + delete iBuf; + iBuf = NULL; + iPreviousDefaultFolder = iDefaultFolder; // save the last file path where file is successfully saved to file system. + iMsvIdParent = KMsvNullIndexEntryId; + TRACE_FUNC_EXIT + return retVal; + } +// --------------------------------------------------------- +// RemoveCapabilityObject() +// --------------------------------------------------------- +// +TInt CBIPController::RemoveCapabilityObject() + { + TRACE_FUNC_ENTRY + if ( (iCapabilityFileName.Compare(KNullDesC)) == 0 ) + { + return KErrNone; + } + if ( !iFs.Handle() ) + { + TRACE_INFO( (_L( "[bipreceiveservice] RemoveCapabilityObject return" )) ); + return KErrGeneral; + } + iFs.Delete(iCapabilityFileName); + iCapabilityFileName=KNullDesC; + TRACE_FUNC_EXIT + return KErrNone; + } + +// --------------------------------------------------------- +// CheckCapacity() +// --------------------------------------------------------- +// +TBool CBIPController::CheckCapacityL() + { + TRACE_FUNC_ENTRY + + iDrive = EDriveZ; // Intialize iDrive to Z + TInt filesize = iBTObject->Length(); + + TInt mmcDrive = KDefaultDrive; // External memory card + TInt imsDrive = KDefaultDrive; // Internal mass storage + + User::LeaveIfError(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, imsDrive)); + User::LeaveIfError(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, mmcDrive)); + + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL imsDrive=%d; mmcDrive=%d\t" ),imsDrive, mmcDrive ) ); + + TVolumeInfo volumeInfo; + TInt err = iFs.Volume(volumeInfo, imsDrive); + + // If err != KErrNone, Drive is not available. + // + if ( !err ) + { + // Check capacity on Internal mass storage + TRACE_INFO( (_L( "[obexreceiveservicebip] CheckCapacityL Internal mass storage \t" )) ); + if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, filesize, imsDrive ) ) + { + iDrive = imsDrive; + } + } + if ( iDrive == EDriveZ ) + { + err = iFs.Volume(volumeInfo, mmcDrive); + if ( !err ) + { + // Check capacity on memory card + TRACE_INFO( (_L( "[obexreceiveservicebip] CheckCapacityL Checking memory card\t" )) ); + if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, filesize, mmcDrive ) ) + { + iDrive = mmcDrive; + } + } + } + if ( iDrive == EDriveZ ) + { + TRACE_INFO( (_L( "[obexreceiveservicebip] CheckCapacityL Checking phone memory\t" )) ); + // Phone memory + if( !SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, filesize, EDriveC )) + { + iDrive = EDriveC; + } + } + + TRACE_INFO( (_L( "[obexreceiveservicebip] CheckCapacityL iDrive = %d\t" ),iDrive ) ); + TRACE_FUNC_EXIT + + if (iDrive == EDriveZ) + { + // If there is no free space for receiving file, we need to set iPreviousDefaultFolder back to iDefaultFolder. + // In order to show the file receveing dialog correctly. + iDefaultFolder = iPreviousDefaultFolder; + return EFalse; + } + return ETrue; + } + + +// --------------------------------------------------------- +// IsOBEXActive() +// --------------------------------------------------------- +// +TBool CBIPController::IsOBEXActive() + { + TRACE_FUNC + return ETrue; + } + +// --------------------------------------------------------- +// SetMediaType() +// --------------------------------------------------------- +// +void CBIPController::SetMediaType( TSrcsMediaType __DEBUG_ONLY(aMediaType) ) + { + TRACE_FUNC + // BIP is only for Bluetooth, so that is all we expect + __ASSERT_DEBUG(aMediaType == ESrcsMediaBT, User::Panic(KBipPanicCategory, EBipPanicNotBluetoothMediaType)); + } + +// --------------------------------------------------------- +// SetObexServer() +// --------------------------------------------------------- +// +TInt CBIPController::SetObexServer( CObexServer* aServer) + { + TInt retVal=KErrNone; + if (aServer) + { + iBTObexServer=aServer; + retVal=aServer->Start(this); + } + return retVal; + } + +void CBIPController::LaunchReceivingIndicatorL() + { + if(ReceivingIndicatorActive()) + { + return; + } + + if(iTotalSizeByte > 0) + { + iProgressDialog = CGlobalProgressDialog::NewL(this); + if(iReceivingFileName.Length() > 0) + { + iProgressDialog->ShowProgressDialogNameSizeL(iReceivingFileName, iTotalSizeByte); + } + else + { + iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); + } + } + else + { + iWaitDialog = CGlobalDialog::NewL(this); + iWaitDialog->ShowNoteDialogL(R_BT_RECEIVING_DATA, ETrue); + } + } + +void CBIPController::UpdateReceivingIndicator() + { + if(iProgressDialog) + { + iProgressDialog->UpdateProgressDialog(iBTObject->BytesReceived(), iTotalSizeByte); + } + // else we are using a wait note, so no "need" to update + } + +void CBIPController::HandleGlobalProgressDialogL( TInt aSoftkey ) + { + TRACE_FUNC + + if(aSoftkey == EAknSoftkeyCancel) + { + CancelTransfer(); + } + else if(aSoftkey == EAknSoftkeyHide) + { + CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + } + } + +void CBIPController::HandleGlobalNoteDialogL( TInt aSoftkey ) + { + TRACE_FUNC + + if( aSoftkey == EAknSoftkeyCancel ) + { + CancelTransfer(); + } + else if( aSoftkey == EAknSoftkeyHide) + { + CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + } + } + +void CBIPController::CloseReceivingIndicator(TBool aResetDisplayedState) + { + TRACE_FUNC + if(aResetDisplayedState) + { + iNoteDisplayed = EFalse; + } + if(iProgressDialog) + { + iProgressDialog->ProcessFinished(); + delete iProgressDialog; + iProgressDialog = NULL; + } + if(iWaitDialog) + { + iWaitDialog->ProcessFinished(); + delete iWaitDialog; + iWaitDialog = NULL; + } + } + + // --------------------------------------------------------- + // GetDriveWithMaximumFreeSpace() + // --------------------------------------------------------- + // + TInt CBIPController::GetDriveWithMaximumFreeSpaceL() + { + // Get drive with maximum freespace among phone memory, MMC, internal mass storage. + // + TRACE_FUNC + + TVolumeInfo volumeInfoC; + TVolumeInfo volumeInfoE; + TVolumeInfo volumeInfoF; + TInt64 max = 0; + TInt drive = 0; + + TInt err = iFs.Volume(volumeInfoC, EDriveC); + + if ( !err ) + { + // set initial values to max and drive. + max = volumeInfoC.iFree; + drive = EDriveC; + } + + err = iFs.Volume(volumeInfoE, EDriveE); + if ( !err ) + { + if (volumeInfoE.iFree >= max) + { + max = volumeInfoE.iFree; + drive = EDriveE; + } + + } + + err = iFs.Volume(volumeInfoF, EDriveF); + if ( !err ) + { + if (volumeInfoF.iFree >= max) + { + max = volumeInfoF.iFree; + drive = EDriveF; + } + } + max = 0; + return drive; + } + + // ---------------------------------------------------------- + // COPPController::HandleDevManComplete + // Callback from devman + // ---------------------------------------------------------- + // + // + void CBIPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/) + { + if ( aErr == KErrNone ) + { + if ( iResultArray->Count()) + { + iRemoteDeviceName.Zero(); + if ( iResultArray->At(0)->FriendlyName().Length() > 0 ) + { + TRACE_INFO( _L( "[CBIPController] HandleGetDevicesComplete: got friendly name \t" ) ); + iRemoteDeviceName.Copy(iResultArray->At(0)->FriendlyName()); + } + else + { + TRACE_INFO( _L( "[CBIPController] HandleGetDevicesComplete: got devciename name \t" ) ); + TRAP_IGNORE(iRemoteDeviceName.Copy(BTDeviceNameConverter::ToUnicodeL(iResultArray->At(0)->DeviceName()))); + } + } + } + } + +//////////////////////////// Global part //////////////////////////// + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/src/BIPImageHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPImageHandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2004 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: Implementation of CBIPImageHandler class +* +*/ + + +#define __OBEX_USER_DEFINED_HEADERS__ + +// INCLUDE FILES +#include "BIPImageHandler.h" +#include + +const TInt KImageHandleWidth=7; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// AddImageHandleHeaderL() +// --------------------------------------------------------- +// +void CBIPImageHandler::AddImageHandleHeaderL( CObexServer* aObexServer ) + { + TRACE_FUNC_ENTRY + + CObexHeaderSet* currentHeaders = CObexHeaderSet::NewL(); + CleanupStack::PushL( currentHeaders ); // 1. push + + CObexHeader* header = CObexHeader::NewL(); + CleanupStack::PushL( header ); //2. push + + TBuf16 imageHandle; + iImageHandleValue++; + imageHandle.AppendNumFixedWidth( iImageHandleValue, EDecimal, KImageHandleWidth ); + header->SetUnicodeL( 0x30, imageHandle ); + + User::LeaveIfError( currentHeaders->AddHeader( header ) ); + + CleanupStack::Pop( header); + if( aObexServer ) + { + TRACE_INFO( _L( "[MtmUiServerBip] CBIPImageHandler: SetPutFinalResponseHeaders \t" ) ); + User::LeaveIfError( aObexServer->SetPutFinalResponseHeaders( currentHeaders ) ); + CleanupStack::Pop( currentHeaders); + } + else + { + CleanupStack::PopAndDestroy(currentHeaders); + } + + TRACE_FUNC_ENTRY + } + +// --------------------------------------------------------- +// CBIPImageHandler() +// --------------------------------------------------------- +// +CBIPImageHandler::CBIPImageHandler() + { + } + +// --------------------------------------------------------- +// ~CBIPImageHandler() +// --------------------------------------------------------- +// +CBIPImageHandler::~CBIPImageHandler() + { + TRACE_FUNC_ENTRY + } +// --------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------- +// +void CBIPImageHandler::ConstructL() + { + TRACE_FUNC + iImageHandleValue = 0; + } + +// ----------------------------------------------------------------------------- +// NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBIPImageHandler* CBIPImageHandler::NewL() + { + TRACE_FUNC_ENTRY + CBIPImageHandler* self = new ( ELeave ) CBIPImageHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return( self ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/src/BIPXMLWriter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPXMLWriter.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2002 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: Implementation of CBIPXMLWriter class +* +*/ + + +// INCLUDE FILES +#include "BIPXMLWriter.h" +#include + + +// CONSTANTS +_LIT8( KBIPXmlDocBegin," " ); +_LIT8( KBIPXmlDocEnd, "" ); +_LIT8( KBIPXmlImageFormatsBegin, ""); +_LIT8( KBIPImageTypes, "JPEGBMPGIFWBMPPNGJPEG2000" ); +_LIT8( KBIPUserSeries60, "USR-SERIES60-" ); + +const TInt KBIPImageTypesLength = 30; +// ================= MEMBER FUNCTIONS ======================= + +// ----------------------------------------------------------------------------- +// NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBIPXmlWriter* CBIPXmlWriter::NewL() + { + TRACE_FUNC + CBIPXmlWriter* self = new ( ELeave ) CBIPXmlWriter(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return( self ); + } + +// --------------------------------------------------------- +// CBIPXmlWriter() +// --------------------------------------------------------- +// +CBIPXmlWriter::CBIPXmlWriter() + { + } + +// --------------------------------------------------------- +// OpenXmlDocumentL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::OpenXmlDocumentL( TFileName& aFileName ) + { + TRACE_FUNC + User::LeaveIfError( iFileSession.Connect() ); + TPath tempPath; + TInt drive = TObexUtilsMessageHandler::GetMessageCentreDriveL(); + TDriveUnit driveString (drive); + User::LeaveIfError(iFileSession.CreatePrivatePath( drive )); + User::LeaveIfError(iFileSession.PrivatePath(tempPath)); + User::LeaveIfError(ifile.Temp( iFileSession, tempPath, aFileName, EFileWrite )); + User::LeaveIfError( ifile.Write( KBIPXmlDocBegin ) ); + } + +// --------------------------------------------------------- +// CloseXmlDocumentL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::CloseXmlDocumentL() + { + TRACE_FUNC + User::LeaveIfError( ifile.Write( KBIPXmlDocEnd ) ); + User::LeaveIfError( ifile.Flush() ); + ifile.Close(); + iFileSession.Close(); + } + +// --------------------------------------------------------- +// OpenXmlElementL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::OpenXmlElementL( TElementType aElement ) + { + switch( aElement ) + { + case EImageFormats: + { + User::LeaveIfError( ifile.Write( KBIPXmlImageFormatsBegin ) ); + break; + } + case EPreferredFormat: + { + break; + } + case EAttachmentFormats: + { + break; + } + case EFilteringParameters: + { + break; + } + case EDPOFOptions: + { + break; + } + default: + { + } + } + TRACE_FUNC + } + +// --------------------------------------------------------- +// AddXmlAttributeL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::AddXmlAttributeL( TAttributeType aAttributeType, TDesC8& aAttr ) + { + TRACE_FUNC_ENTRY + TBuf8 attribute = KBIPImageTypes(); + switch( aAttributeType ) + { + case EEncoding: + { + if( attribute.Find( aAttr ) == KErrNotFound ) + { + User::LeaveIfError( ifile.Write( KBIPUserSeries60 ) ); + User::LeaveIfError( ifile.Write( aAttr ) ); + + } + else + { + User::LeaveIfError( ifile.Write( aAttr ) ); + } + break; + } + case EPixel: + { + User::LeaveIfError( ifile.Write( aAttr ) ); + break; + } + case EMaxSize: + { + User::LeaveIfError( ifile.Write( aAttr ) ); + break; + } + case ETransformation: + { + break; + } + default: + { + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CloseXmlElementL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::CloseXmlElementL() + { + TRACE_FUNC + User::LeaveIfError( ifile.Write( KBIPXmlImageFormatsEnd ) ); + } + +// --------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------- +// +void CBIPXmlWriter::ConstructL() + { + TRACE_FUNC + } + +// --------------------------------------------------------- +// ~CBIPXmlWriter() +// --------------------------------------------------------- +// +CBIPXmlWriter::~CBIPXmlWriter() + { + TRACE_FUNC + ifile.Close(); + iFileSession.Close(); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/bip/src/obexservicebip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/bip/src/obexservicebip.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Export ECom interface implementations +* +*/ + + +#include +#include "BIPController.h" + +// --------------------------------------------------------------------------- +// An array of TImplementationProxy objects which onnect each +// implemeation with its instantiation function +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F8671, CBIPController::NewL) + }; + +// --------------------------------------------------------------------------- +// 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; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2002 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 a obexreceiveservices. +* +*/ + + +#include + +PRJ_EXPORTS + +../rom/mtmuibluetooth.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtmuibluetooth.iby) +../rom/mtmuiinfrared.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtmuiinfrared.iby) +../rom/obexservicebip.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicebip.iby) +../rom/obexserviceopp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexserviceopp.iby) +../rom/mtmuibluetoothresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(mtmuibluetoothresources.iby) +../rom/mtmuiinfraredResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(mtmuiinfraredResources.iby) + +#include "../mtmuibluetooth/group/bld.inf" +#include "../mtmuiinfrared/group/bld.inf" +#include "../opp/group/bld.inf" +#include "../bip/group/bld.inf" + + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/bmarm/BTMTMUIU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/bmarm/BTMTMUIU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,4 @@ +EXPORTS + NewBtMtmUiDataLayerL__FR17CRegisteredMtmDll @ 1 NONAME R3UNUSED ; NewBtMtmUiDataLayerL(CRegisteredMtmDll &) + NewBtMtmUiL__FR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME R3UNUSED ; NewBtMtmUiL(CBaseMtm &, CRegisteredMtmDll &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/bwins/BTMTMUIU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/bwins/BTMTMUIU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,4 @@ +EXPORTS + ?NewBtMtmUiDataLayerL@@YAPAVCBaseMtmUiData@@AAVCRegisteredMtmDll@@@Z @ 1 NONAME ; class CBaseMtmUiData * __cdecl NewBtMtmUiDataLayerL(class CRegisteredMtmDll &) + ?NewBtMtmUiL@@YAPAVCBaseMtmUi@@AAVCBaseMtm@@AAVCRegisteredMtmDll@@@Z @ 2 NONAME ; class CBaseMtmUi * __cdecl NewBtMtmUiL(class CBaseMtm &,class CRegisteredMtmDll &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002 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 contains btmtmui resource. Entry points to Mtm. +* +* +*/ + + +// INCLUDES +#include +#include + +// RESOURCE DEFINITIONS +// --------------------------------------------------------- +// +// +// MTM info resource for Bt +// +// --------------------------------------------------------- +// + + + +#include + +RESOURCE MTM_INFO_FILE + { + mtm_type_uid = 0x10009ED5; + technology_type_uid = 0x10009ED6; + components = + { + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_bt; + component_uid = KUidMtmServerComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "BtsMtm.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_bt; + component_uid = KUidMtmClientComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "BtcMtm.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_bt; + component_uid = KUidMtmUiComponentVal; + entry_point = 2; + version = VERSION_V2 {}; + filename = "BtMtmUi.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_bt; + component_uid = KUidMtmUiDataComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "BtMtmUi.dll"; + } + }; + } + + +RESOURCE MTM_CAPABILITIES + { + send_capability = 1; + body_capability = 1; + } + +RESOURCE MTM_SECURITY_CAPABILITY_SET + { + capabilities = { ECapabilityLocalServices }; + } + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/eabi/btmtmuiU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/eabi/btmtmuiU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,8 @@ +EXPORTS + _Z20NewBtMtmUiDataLayerLR17CRegisteredMtmDll @ 1 NONAME + _Z11NewBtMtmUiLR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME + _ZTI12CBtMtmUiData @ 3 NONAME ; ## + _ZTI8CBtMtmUi @ 4 NONAME ; ## + _ZTV12CBtMtmUiData @ 5 NONAME ; ## + _ZTV8CBtMtmUi @ 6 NONAME ; ## + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/group/BtRegistry.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/BtRegistry.mk Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,74 @@ +# +# 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: +# +# Build resource files +# + +SOURCEDIR=..\group +LANGUAGE=sc + +# +# Target directory +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +TARGETDIR=$(EPOCROOT)Epoc32\Release\$(PLATFORM)\$(CFG)\Z\System\Mtm +else +TARGETDIR=$(EPOCROOT)Epoc32\Data\Z\System\Mtm +endif + +$(TARGETDIR) : + @perl $(EPOCROOT)epoc32\tools\emkdir.pl $(TARGETDIR) + +# +# Build the mtm resource files +# + +PROJECT=BTMTMU +SOURCERESOURCE=$(SOURCEDIR)\$(PROJECT)Registry.rss +TARGETRESOURCE=$(TARGETDIR)\$(PROJECT).r$(LANGUAGE) +$(TARGETRESOURCE) : $(TARGETDIR) $(SOURCERESOURCE) + @copy $(SOURCERESOURCE) $(TARGETDIR)\$(PROJECT).rss + @epocrc.bat -u -I. -I%EPOCROOT%s60\btmtmui\group -I%EPOCROOT%epoc32\include $(TARGETDIR)\$(PROJECT).rss -o$(TARGETRESOURCE) + @del $(TARGETDIR)\$(PROJECT).rss + +do_nothing: + rem do nothing + +# +# The targets invoked by abld +# + +MAKMAKE : do_nothing + +RESOURCE : $(TARGETRESOURCE) + +SAVESPACE : BLD + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : do_nothing + +CLEAN : + @erase $(TARGETRESOURCE) + +RELEASABLES : + @echo $(TARGETRESOURCE) diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002 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 a BTMTMUI. +* +*/ + + +PRJ_PLATFORMS + + +PRJ_EXPORTS + +PRJ_MMPFILES +../group/btmtmui.mmp + + + + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002 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 project specification file for the BtMtmUi. +* +* +*/ + + +#include +#include + +TARGET btmtmui.dll +TARGETTYPE dll +TARGETPATH SHARED_LIB_DIR +UID 0x10004845 0x101F8634 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../data +START RESOURCE btmtmui.rss +TARGETPATH MTM_INFO_FILE_DIR +HEADER +LANGUAGE_IDS +END + +SOURCEPATH ../src +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../inc ../../../../inc +#ifdef NO101APPDEPFIXES +APP_LAYER_SYSTEMINCLUDE +#else //NO101APPDEPFIXES +MW_LAYER_SYSTEMINCLUDE +#endif //NO101APPDEPFIXES + +SOURCE btmtmuidll.cpp +SOURCE btmtmuidata.cpp +SOURCE btmtmui.cpp + +LIBRARY obexutils.lib +LIBRARY euser.lib +LIBRARY msgs.lib +LIBRARY mtur.lib +#ifdef NO101APPDEPFIXES +LIBRARY muiu.lib +#endif //NO101APPDEPFIXES +LIBRARY bluetooth.lib +LIBRARY btdevice.lib +LIBRARY btengdiscovery.lib +DEBUGLIBRARY flogger.lib + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,448 @@ +/* +* Copyright (c) 2002 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: +* Contains Bluetooth MTM Ui part. +* +* +*/ + + +#ifndef CBTMTMUI_H +#define CBTMTMUI_H + +// INCLUDES +#include +#include +#include + +#include + +const TUint KBTSdpObjectPush = 0x1105; + +// FORWARD DECLARATIONS +class CClientMtmRegistry; + +/** +* CBtMtmUi +* Bluetooth messaging UI Module. +*/ +class CBtMtmUi : public CBaseMtmUi, public MBTEngSdpResultReceiver + { + public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CBtMtmUi* NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); + + /** + * Destructor. + */ + virtual ~CBtMtmUi(); + + + public: // Functions from base classes + + /** + * From CBaseMtmUi Entry Creation. + * @param aEntry reference to entry + * @param aParent parent entry + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CreateL( + const TMsvEntry& aEntry, + CMsvEntry& aParent, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Open entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* OpenL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Close entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CloseL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Launches editor/settings dialog as appropriate. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* EditL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Launches viewer/settings dialog as appropriate + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ViewL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Deletes selection from current context + * Deletes entries from the current context, + * which must be a folder or service of the relevant MTM + * @param aSelection reference to entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* DeleteFromL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Deletes service, which need not + * be the current context. + * @param aService reference to entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* DeleteServiceL( + const TMsvEntry& aService, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Remove remaining message of deleted service. + * @param aChildren reference to entry selection. + * @return None. + */ + void DeleteRecursivelyL( CMsvEntrySelection& aChildren ); + + // + // --- Message responding --- + // --- Default implementation calls CBaseMtm::ReplyL() or ForwardL(), + // followed by EditL() --- + // --- Takes ownership of the passed entry + // (which the context is switched to) --- + + /** + * From CBaseMtmUi Reply entry + * @param aDestination id for msv. + * @param aPartlist partlist id. + * @param aCompletionStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ReplyL( + TMsvId aDestination, + TMsvPartList aPartlist, + TRequestStatus& aCompletionStatus ); + + + /** + * From CBaseMtmUi forward entry + * @param aDestination id for msv. + * @param aPartlist partlist id. + * @param aCompletionStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ForwardL( + TMsvId aDestination, + TMsvPartList aPartList, + TRequestStatus& aCompletionStatus ); + + // + // Actions upon message selections --- + // Selections must be in same folder and all of the correct MTM type + // Context may change after calling these functions + + /** + * From CBaseMtmUi Open entry + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* OpenL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Close entry + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CloseL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Handles sending. + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* EditL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Launches viewer/settings dialog as appropriate + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ViewL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + // + // Copy and move functions: + // Context should be set to folder or entry of this MTM + // Default implementations imply call the relevant CMsvEntry functions + + /** + * From CBaseMtmUi Context should be MTM folder/service to copy to + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CopyToL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to Move to + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* MoveToL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to copy from + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CopyFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to move from + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* MoveFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + // Interpret transfer progress + + /** + * From CBaseMtmUi Display progress summary. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + TInt DisplayProgressSummary( const TDesC8& aProgress ) const; + + /** + * From CBaseMtmUi return progress status. + * @param aProgress reference to progress packet. + * @param aReturnString returned progress text. + * @param aTotalEntryCount entry count. + * @param aEntriesDone completed entries. + * @param aCurrentEntrySize size of the entry. + * @param aCurrentBytesTrans transferred bytes. + * @return TInt error code. + */ + virtual TInt GetProgress( + const TDesC8& aProgress, + TBuf& aReturnString, + TInt& aTotalEntryCount, + TInt& aEntriesDone, + TInt& aCurrentEntrySize, + TInt& aCurrentBytesTrans ) const; + + // + // --- RTTI functions --- + + /** + * From CBaseMtmUi Return capability. + * @param aCapability UID for capability. + * @return TInt error code. + */ + virtual TInt QueryCapability( TUid aCapability, TInt& aResponse ); + + /** + * From CBaseMtmUi Synchronous MTM function operation. + * @param aFunctionId Function ID. + * @param CMsvEntrySelection entry reference. + * @param aParam parameter for function. + * @return None. + */ + virtual void InvokeSyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter ); + + /** + * From CBaseMtmUi Cancel sending. + * @param aStatus Async status for operation. + * @param CMsvEntrySelection entry reference. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CancelL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + + /** + * Provides notification of the result of a service search that matches + * the requested UUID (through CBTEngDiscovery::RemoteSdpQuery). + * This method indicates that the search has completed, and returns + * all the results to the caller at once. + * + * @since S60 v3.2 + * @param aResult Array of record handles that match the requested UUID. + * Note: the array will not be available anymore after + * this method returns. + * @param aTotalRecordsCount The total number of records returned. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful, KErrEof if no record matched the requested UUID, + * KErrCouldNotConnect and KErrCouldDisconnected in case of + * Bluetooth connection errors; otherwise one of the + * system-wide error codes. + */ + void ServiceSearchComplete( const RSdpRecHandleArray& aResult, + TUint aTotalRecordsCount, TInt aErr ); + + /** + * Provides notification of the result of an attribute search that matches + * the requested attribute (through CBTEngDiscovery::RemoteSdpQuery). + * This method indicates that the search has completed, and returns + * all the results to the caller at once. + * + * @since S60 v3.2 + * @param aHandle Record handle of the service record containing the result. + * @param aAttr Array containing the attribute that matches the + * requested attribute. + * Note: the array will not be available anymore after + * this method returns. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful, KErrEof if the requested attribute was not + * contained in the specified service record, + * KErrCouldNotConnect and KErrCouldDisconnected in case of + * Bluetooth connection errors; otherwise one of the + * system-wide error codes. + */ + void AttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr, + TInt aErr ); + + /** + * Provides notification of the result of an combination of a service + * and attribute search (through CBTEngDiscovery::RemoteSdpQuery). + * This method is called for each service and attribute combination for + * which a match was found. The last result (which could be empty if no + * match was found) contain error code KErrEof to indicate that the + * search has completed. + * + * @since S60 v3.2 + * @param aHandle Record handle of the service record containing the result. + * @param aAttr Array containing the attribute that matches the + * requested attribute. + * Note: the array will not be available anymore after + * this method returns. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful and more results follow, KErrEof indicates that + * this is the last result (which could be empty if no match + * was found), KErrCouldNotConnect and KErrCouldDisconnected + * in case of Bluetooth connection errors; otherwise one of + * the system-wide error codes. + */ + void ServiceAttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr, + TInt aErr ); + + /** + * Provides notification of the result of the discovery of nearby + * Bluetooth devices. + * + * @since S60 v3.2 + * @param aDevice The data structure encapsulates all information + * about the selected device. Ownership of the data + * structure has not been transfered and is still with + * the API client. + * @param aErr Error code of the device search operation; KErrNone if + * sucessful, KErrCancel if the user cancelled the + * dialog, KErrAbort if CBTEngDiscovery::CancelSearchRemoteDevice + * was called; otherwise one of the system-wide error codes. + */ + void DeviceSearchComplete( CBTDevice* aDevice, TInt aErr ); + + protected: + + /** + * C++ default constructor. + */ + CBtMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + protected: // Functions from base classes + + /** + * From CBaseMtmUi return resource filename. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + void GetResourceFileName( TFileName& aFileName ) const; + + /** + * From CBaseMtmUi Launch viewer for received message. + * @param aStatus Async status for operation. + * @param aSession session reference. + * @return CMsvOperation pointer to Msg operation. + */ + CMsvOperation* LaunchEditorApplicationL( + TRequestStatus& aStatus, + CMsvSession& aSession ); + + protected: // New functions + + /** + * Register MTM. + * @param aMtmType MTM UID. + * @return CBaseMtm pointer. + */ + CBaseMtm* GetClientMtmLC( TUid aMtmType ); + + /** + * Display progress summary. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + TInt DisplayProgressSummaryL( const TDesC8& aProgress ) const; + + protected: // data + + CClientMtmRegistry* iClientRegistry; // pointer to registration. + + private: + TBTDeviceName iBTDeviceName; // Bluetooth device name. + CBTDevice* iDevice; + CBTEngDiscovery* iDiscovery; + CActiveSchedulerWait iWaiter; + TInt iClientChannel; + TInt iState; + + }; + +#endif // CBTMTMUI_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2002 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: +* Bluetooth Mtm Ui data part. +* +* +*/ + + +#ifndef CBTMTMUIDATA_H +#define CBTMTMUIDATA_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** +* CBtMtmUiData - +* contains Bluetooth specific MTM UI data. +*/ +class CBtMtmUiData : public CBaseMtmUiData + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBtMtmUiData* NewL(CRegisteredMtmDll& aRegisteredDll); + + /** + * Destructor. + */ + virtual ~CBtMtmUiData(); + + /** + * Constructor + */ + void ConstructL(); + + public: // Functions from base classes + + /** + * From CBaseMtmUiData function query. + * @param aOperationId Id for function. + * @param aContext messaging store entry. + * @return TInt error code. + */ + virtual TInt OperationSupportedL( + TInt aOperationId, + const TMsvEntry& aContext) const; + + /** + * From CBaseMtmUiData MTM capability check. + * @param aCapability Uid for message type. + * @param aResponse response for capability check. + * @return TInt error code. + */ + virtual TInt QueryCapability( + TUid aCapability, + TInt& aResponse) const; + + /** + * From CBaseMtmUiData MTM related context icons. + * @param aContext Messaging entry refence. + * @param aStateFlags Flags for icon. + * @return TInt error code. + */ + virtual const CBitmapArray& ContextIcon( + const TMsvEntry& aContext, + TInt aStateFlags) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aParent Messaging entry refence. + * @param aNewEntry Messaging entry refence(created entry). + * @param aReasonResourceId ResourceID. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCreateEntryL( + const TMsvEntry& aParent, + TMsvEntry& aNewEntry, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanReplyToEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanForwardEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanEditEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanViewEntryL(const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanOpenEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCloseEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanDeleteFromEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanDeleteServiceL( + const TMsvEntry& aService, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCopyMoveToEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCopyMoveFromEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCancelL(const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @return HBufC* Statustext for sending. + */ + virtual HBufC* StatusTextL(const TMsvEntry& aContext) const; + + protected: // Functions from base classes + + /** + * From CBaseMtmUiData Populate icon array + */ + virtual void PopulateArraysL(); + + /** + * From CBaseMtmUiData gets resource filename. + */ + virtual void GetResourceFileName(TFileName& aFileName) const; + + protected: + + /** + * C++ default constructor. + */ + CBtMtmUiData(CRegisteredMtmDll& aRegisteredDll); + + protected: // New functions + + /** + * Checks is the entry valid. + * @param aContext reference to the entry. + * @return TBool + */ + TBool CheckEntry(const TMsvEntry& aContext) const; + + }; + + +#endif // CBTMTMUIDATA_H +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidebug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002 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 defines logging macros for BTMTMUI +* +*/ + + +#ifndef BTMTMUI_DEBUG_H +#define BTMTMUI_DEBUG_H + + +#ifdef _DEBUG + +#include +#include +#include +#include + +_LIT(KLogFile,"btmtmui.txt"); +_LIT(KLogDirFullName,"c:\\logs\\mtm\\"); +_LIT(KLogDir,"mtm"); + +// Declare the FPrint function +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + } + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // BTMTMUI_DEBUG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,808 @@ +/* +* Copyright (c) 2002 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: +* CBtMtmUi class +* +*/ + + +// INCLUDE FILES +#include "btmtmui.h" +#include "btmtmuidebug.h" + +//#include +#ifdef NO101APPDEPFIXES +#include +#endif //NO101APPDEPFIXES + +#ifdef NO101APPDEPFIXES_NEW +#include +#endif //NO101APPDEPFIXES_NEW + +#include +#include +#include +#include +#include +#include +#include + + +// CONSTANTS +#ifdef NO101APPDEPFIXES +const TInt KBtMtmUiToFromFieldBuffer = 80; +const TInt KBtMtmUiConnectionTimeout = 20000000; +const TInt KBtMtmUiConnectionPutTimeout = 0; +const TInt KBtMtmUiObexPort = 1; +const TInt KBtMtmUiAddressMaxLength = 3; +#endif //NO101APPDEPFIXES + +// ENUMS +enum TBtMtmAsyncCmds + { + EBtMtmCmdSend + }; + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBtMtmUi::CBtMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) + : CBaseMtmUi( aBaseMtm, aRegisteredMtmDll ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: CBtMtmUi\t" ) ); + } + +// Two-phased constructor. +CBtMtmUi* CBtMtmUi::NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: NewL\t" ) ); + CBtMtmUi* self = new( ELeave ) CBtMtmUi( aBaseMtm, aRegisteredMtmDll ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Destructor +CBtMtmUi::~CBtMtmUi() + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: ~CBtMtmUi\t" ) ); + delete iClientRegistry; + } + +// Symbian OS default constructor can leave. +void CBtMtmUi::ConstructL() + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) ); + CBaseMtmUi::ConstructL(); + } + +// --------------------------------------------------------- +// GetResourceFileName(...) +// return progress status. +// --------------------------------------------------------- +// +void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) ); + aFileName = KObexUtilsFileDrive; + aFileName += KDC_RESOURCE_FILES_DIR; + aFileName += KObexUtilsResourceFileName; + } + +// --------------------------------------------------------- +// QueryCapability(TUid aCapability, TInt& aResponse) +// return capability of mtm. +// --------------------------------------------------------- +// +TInt CBtMtmUi::QueryCapability(TUid aCapability, TInt& aResponse) + { + // Querying of menu availablility is done in syni. + FLOG( _L( "[CBtMtmUi] CBtMtmUi: QueryCapability\t" ) ); + if( aCapability.iUid == KUidMsvMtmUiQueryCanPrintMsgValue ) + { + aResponse = ETrue; + return KErrNone; + } + return CBaseMtmUi::QueryCapability( aCapability, aResponse ); + } + +// --------------------------------------------------------- +// InvokeSyncFunctionL(...) +// Invoke sync -function from BaseMTM. +// --------------------------------------------------------- +// +void CBtMtmUi::InvokeSyncFunctionL( TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: InvokeSyncFunctionL\t" ) ); + CBaseMtmUi::InvokeSyncFunctionL( aFunctionId, aSelection, aParameter ); + } + + +// --------------------------------------------------------- +// CreateL(...) +// Entry creation forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CreateL( const TMsvEntry& /*aEntry*/, + CMsvEntry& /*aParent*/, + TRequestStatus& /*aStatus*/ ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: CreateL\t" ) ); + // Entries created through utility functions. + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// OpenL(TRequestStatus& aStatus) +// handles opening entry. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::OpenL( TRequestStatus& aStatus ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: OpenL\t" ) ); + const TMsvEntry& context = iBaseMtm.Entry().Entry(); + const TUid type( context.iType ); + if( ( type == KUidMsvMessageEntry ) && + ( ( context.Parent() == KMsvSentEntryIdValue ) + ||( context.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) ) ) + { + // Message is in the sent folder, so can't be edited + return ViewL( aStatus ); + } + return EditL( aStatus ); + } + +// --------------------------------------------------------- +// OpenL(...) +// handles opening entry using selection. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::OpenL( TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ) + { + iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); + return OpenL( aStatus ); + } + +// --------------------------------------------------------- +// CloseL(TRequestStatus& aStatus) +// Closes entry. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CloseL( TRequestStatus& aStatus ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: CloseL\t" ) ); + CMsvCompletedOperation* op = CMsvCompletedOperation::NewL( Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus); + return op; + } + +// --------------------------------------------------------- +// CloseL(TRequestStatus& aStatus) +// Closes entry using selection. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CloseL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection) + { + iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); + return CloseL( aStatus ); + } + +// --------------------------------------------------------- +// EditL(...) +// Handles message sending using selection. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::EditL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ) + { + FLOG( _L( "[BtMtmUi] CBtMtmUi: EditL 1 \t" ) ); + iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); + return EditL( aStatus ); + } + +// --------------------------------------------------------- +// EditL(TRequestStatus& aStatus) +// Handles message sending over Bluetooth. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::EditL( TRequestStatus& aStatus ) + { + FLOG( _L( "[BtMtmUi] CBtMtmUi: EditL 2 \t" ) ); + switch( iBaseMtm.Entry().Entry().iType.iUid ) + { + case KUidMsvMessageEntryValue: + { + if( iBaseMtm.Entry().Entry().Parent() != KMsvDraftEntryId && + iBaseMtm.Entry().Entry().Parent() != KMsvGlobalOutBoxIndexEntryId ) + { + // Edit/"use" entries in the Inbox + return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); + } +#ifdef NO101APPDEPFIXES + else + { + TInt resourceId; + HBufC* password = HBufC::NewL(1); + CleanupStack::PushL( password ); // 1st push + BaseMtm().LoadMessageL(); + + TBTDevAddr address; + + CBtClientMtm::SBtcCmdSendParams sendparams; + sendparams.iTimeouts.iConnectTimeout = KBtMtmUiConnectionTimeout; + sendparams.iTimeouts.iPutTimeout = KBtMtmUiConnectionPutTimeout; + sendparams.iRemoteObexPort = KBtMtmUiObexPort; + sendparams.iConnectPassword = password; + + iDiscovery = CBTEngDiscovery::NewL(this); + CBTDevice* iDevice = CBTDevice::NewL( ); + + + if ( iDiscovery->SearchRemoteDevice( iDevice ) == KErrNone ) + { + TInt retVal=0; + iWaiter.Start(); + + if ( iState ==KErrNone) + { + address = iDevice->BDAddr(); + FLOG( _L( "[BtMtmUi] CBtMtmUi:SearchRemoteChannelL \t" ) ); + retVal = iDiscovery->RemoteProtocolChannelQuery(address, TUUID(KBTSdpObjectPush)); + if(retVal == KErrNone) + { + iWaiter.Start(); + } + } + if ( retVal != KErrNone ||iState != KErrNone ) + { + resourceId = R_BT_DEV_NOT_AVAIL; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + CleanupStack::PopAndDestroy(3); // BtDevice, BtConnection, password + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus ); + } + sendparams.iRemoteObexPort = iClientChannel; + + TPtrC8 ptr8 = address.Des(); + TBuf16 convertedaddress16;//48 bits + // Bt address conversion + TInt i; + for( i=0; i<3; i++ ) + { + TUint16 word = ptr8[( i*2 )+1]; + word = ( TUint16 )( word << 8 ); + word = ( TUint16 )( word + ptr8[i*2] ); + convertedaddress16.Append( &word, 1 ); + } + + BaseMtm().AddAddresseeL( convertedaddress16 ); + } + else + { + CleanupStack::PopAndDestroy(3); // BtDevice, BTConnection, password + FLOG( _L( "[BTMTMUI] CBtMtmUi:CMsvCompletedOperation NewL\t" ) ); + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus ); + } + + CMsvEntrySelection* sel = new( ELeave ) CMsvEntrySelection(); + CleanupStack::PushL( sel ); // 4th push + sel->AppendL( BaseMtm().Entry().EntryId() ); + + CMsvOperationWait* waiter = CMsvOperationWait::NewLC(); // 5th push + + TBuf toFrom; + resourceId = R_BT_SEND_OUTBOX_SENDING; + TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); + + BaseMtm().SaveMessageL(); + + TMsvEntry newTEntry( iBaseMtm.Entry().Entry() ); + newTEntry.iDetails.Set( toFrom ); + newTEntry.SetVisible( ETrue ); + newTEntry.SetInPreparation( ETrue ); + + iBaseMtm.Entry().ChangeL( newTEntry ); + + CMsvEntry* entry = + BaseMtm().Session().GetEntryL( KMsvDraftEntryId ); + + CleanupStack::PushL( entry ); // 6th push + + CMsvOperation* moveOp = entry->MoveL( + *sel, + KMsvGlobalOutBoxIndexEntryId, + waiter->iStatus ); + + CleanupStack::PopAndDestroy( entry ); + + waiter->Start(); + CActiveScheduler::Start(); + delete moveOp; + + CMsvProgressReporterOperation* reporter + = CMsvProgressReporterOperation::NewL( Session(), aStatus ); + CleanupStack::PushL( reporter ); // 6th push + + TPckgBuf paramBuf( sendparams ); + + CMsvOperation* op = BaseMtm().InvokeAsyncFunctionL( + EBtMtmCmdSend, + *sel, + paramBuf, + reporter->RequestStatus() ); + + // ownership of op transfered to reporter + reporter->SetOperationL( op ); + + aStatus = KRequestPending; + + CleanupStack::Pop( reporter ); + CleanupStack::PopAndDestroy(3); // waiter, sel, password + return reporter; + } +#endif //NO101APPDEPFIXES + } + case KUidMsvServiceEntryValue: + case KUidMsvAttachmentEntryValue: + case KUidMsvFolderEntryValue: + { + User::Leave( KErrNotSupported ); + } + default: + { + break; + } + } + + CMsvCompletedOperation* op = CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus ); + aStatus = KRequestPending; + return op; + } + +// --------------------------------------------------------- +// ViewL(TRequestStatus& aStatus) +// Handles viewing of received object. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::ViewL( TRequestStatus& aStatus ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: ViewL\t" ) ); + return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); + } + +// --------------------------------------------------------- +// ViewL(...) +// Handles viewing of received object using selection. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::ViewL( TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: ViewL 1\t" ) ); + iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); + return ViewL( aStatus ); + } + +// --------------------------------------------------------- +// CopyFromL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CopyFromL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// MoveFromL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::MoveFromL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// MoveToL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::MoveToL( const CMsvEntrySelection& /*aSelection*/, + TRequestStatus& /*aStatus*/) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// CopyToL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CopyToL( const CMsvEntrySelection& /*aSelection*/, + TRequestStatus& /*aStatus*/) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// DisplayProgressSummary(const TDesC8& aProgress) const +// calls leaving DisplayProgressSummaryL -function and +// traps the error. +// --------------------------------------------------------- +// +TInt CBtMtmUi::DisplayProgressSummary( const TDesC8& aProgress ) const + { + TInt retVal = KErrNone; + TRAP( retVal, retVal = DisplayProgressSummaryL( aProgress ) ); + return retVal; + } + +// --------------------------------------------------------- +// DisplayProgressSummary(const TDesC8& aProgress) const +// calls leaving DisplayProgressSummaryL -function and +// traps the error. +// --------------------------------------------------------- +// +TInt CBtMtmUi::DisplayProgressSummaryL( const TDesC8& aProgress ) const + { + #ifndef NO101APPDEPFIXES_NEW + (void) aProgress; + #endif //NO101APPDEPFIXES_NEW + + #ifdef NO101APPDEPFIXES_NEW + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL\t" ) ); + TInt resourceId; + if( ( !aProgress.Length() ) || ( aProgress.Size() == sizeof( TMsvLocalOperationProgress ) ) ) + { + // Probably a CMsvCompletedOperation + return KErrCancel; + } + TPckgBuf paramPack; + paramPack.Copy( aProgress ); + TObexMtmProgress& progress = paramPack(); + + const TObexMtmProgress::TSendState progressType = progress.iSendState; + const TInt error = progress.iError; + if ( error == KErrInUse ) + { + resourceId = R_BT_DEV_NOT_AVAIL; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + return KErrNone; + } + + switch( progressType ) + { + case TObexMtmProgress::EDisconnected: + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EDisconnected\t" ) ); + // Allowed to send again. + resourceId = R_BT_DATA_SENT; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + break; + } + case TObexMtmProgress::ESendError: + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) ); + if( error == KErrIrObexClientNoDevicesFound ) + { + resourceId = R_BT_DEV_NOT_AVAIL; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + } + else + { + resourceId = R_BT_FAILED_TO_SEND; + TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); + } + break; + } + case TObexMtmProgress::ESendComplete: + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendComplete\t" ) ); + break; + } + case TObexMtmProgress::EInitialise: + case TObexMtmProgress::EConnect: + case TObexMtmProgress::EConnectAttemptComplete: + case TObexMtmProgress::ESendObject: + case TObexMtmProgress::ESendNextObject: + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendObject\t" ) ); + return KErrCancel; + } + case TObexMtmProgress::EUserCancelled: + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EUserCancelled\t" ) ); + return KErrCancel; + } + default: + { + FTRACE( FPrint(_L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: Default\t %d" ), progressType ) ); + return KErrCancel; + } + } + #endif //NO101APPDEPFIXES_NEW + return KErrNone; + } + + +// --------------------------------------------------------- +// GetProgress(...) +// return progress status. +// --------------------------------------------------------- +// +TInt CBtMtmUi::GetProgress( const TDesC8& aProgress, + TBuf& aReturnString, + TInt& aTotalEntryCount, + TInt& aEntriesDone, + TInt& aCurrentEntrySize, + TInt& aCurrentBytesTrans ) const + { + #ifndef NO101APPDEPFIXES_NEW + (void) aProgress; + (void) aReturnString; + (void) aTotalEntryCount; + (void) aEntriesDone; + (void) aCurrentEntrySize; + (void) aCurrentBytesTrans; + #endif //NO101APPDEPFIXES_NEW + + #ifdef NO101APPDEPFIXES_NEW + TInt resourceId; + + FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetProgress\t" ) ); + TPckgBuf paramPack; + paramPack.Copy( aProgress ); + TObexMtmProgress& progress = paramPack(); + const TObexMtmProgress::TSendState progressType = progress.iSendState; + aTotalEntryCount = progress.iTotalEntryCount; + aEntriesDone = progress.iEntriesDone; + aCurrentEntrySize = progress.iCurrentEntrySize; + aCurrentBytesTrans = progress.iCurrentBytesTrans; + + if( aTotalEntryCount > 1 ) // This is for progress bar multisending + { + aCurrentEntrySize = 0; + } + + switch( progressType ) + { + case TObexMtmProgress::ENullOp: + case TObexMtmProgress::ESendError: + { + aReturnString = KNullDesC; + break; + } + case TObexMtmProgress::EInitialise: + case TObexMtmProgress::EConnect: + case TObexMtmProgress::EConnectAttemptComplete: + { + resourceId = R_BT_CONNECTING; + TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aReturnString, resourceId ) ); + retVal=retVal; //avoid warning + // Leave causes progress note to be empty. Not fatal + break; + } + case TObexMtmProgress::ESendObject: + case TObexMtmProgress::ESendNextObject: + case TObexMtmProgress::ESendComplete: + { + resourceId = R_BT_SENDING_DATA; + TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aReturnString, resourceId ) ); + // Leave causes progress note to be empty. Not fatal + retVal=retVal; //avoid warning + break; + } + case TObexMtmProgress::EDisconnected: + { + break; + } + default: + { + return KErrCancel; + } + } + FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetProgress Done\t" ) ); + #endif //NO101APPDEPFIXES_NEW + return KErrNone; + } + +// --------------------------------------------------------- +// LaunchEditorApplicationL(...) +// Launch viewer for selected object. The first is object's +// recognition(document handler). +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, + CMsvSession& aSession) + { + FLOG( _L( "[CommonMtmUi] CBtMtmUi: LaunchEditorApplicationL\t" ) ); + CMsvEntry* message; + message = &iBaseMtm.Entry(); + return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); + } + +// --------------------------------------------------------- +// GetClientMtmLC(TUid aMtmType) +// Handles MTM registration. +// --------------------------------------------------------- +// +CBaseMtm* CBtMtmUi::GetClientMtmLC( TUid aMtmType ) + { + FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetClientMtmLC\t" ) ); + if( !iClientRegistry ) + { + iClientRegistry = CClientMtmRegistry::NewL( Session() ); + } + CBaseMtm* mtm = iClientRegistry->NewMtmL( aMtmType ); + CleanupStack::PushL( mtm ); + return mtm; + } + +// --------------------------------------------------------- +// DeleteFromL(TUid aMtmType) +// passes entry selection to Base for deletion. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::DeleteFromL( const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ) + { + return CBaseMtmUi::DeleteFromL( aSelection, aStatus ); + } + +// --------------------------------------------------------- +// DeleteServiceL(...) +// has no service, just complete it. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::DeleteServiceL( const TMsvEntry& /*aService*/, + TRequestStatus& aStatus) + { + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus); + } + +// --------------------------------------------------------- +// ReplyL(...) +// Reply is forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::ReplyL( TMsvId /*aDestination*/, + TMsvPartList /*aPartlist*/, + TRequestStatus& /*aCompletionStatus*/ ) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// ForwardL(...) +// Forward is forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::ForwardL( TMsvId /*aDestination*/, + TMsvPartList /*aPartList*/, + TRequestStatus& /*aCompletionStatus*/ ) + { + User::Leave( KErrNotSupported ); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// CancelL(...) +// No MS way of sending a message from the outbox, so no need to cancel. +// Just complete it. +// --------------------------------------------------------- +// +CMsvOperation* CBtMtmUi::CancelL( TRequestStatus& aStatus, + const CMsvEntrySelection& /*aSelection*/) + { + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus, + KErrNone); + } + +// ----------------------------------------------------------------------------- +// CBtMtmUi::ServiceSearchComplete +// ----------------------------------------------------------------------------- +// +void CBtMtmUi::ServiceSearchComplete( const RSdpRecHandleArray& /*aResult*/, + TUint /*aTotalRecordsCount*/, TInt /*aErr */) + { + } + +// ----------------------------------------------------------------------------- +// CBtMtmUi::AttributeSearchComplete( +// ----------------------------------------------------------------------------- +// +void CBtMtmUi::AttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, + const RSdpResultArray& aAttr, + TInt aErr ) + { + iState=aErr; + if (aErr==KErrNone) + { + RSdpResultArray results=aAttr; + iDiscovery->ParseRfcommChannel(results,iClientChannel); + } + iWaiter.AsyncStop(); + } +// ----------------------------------------------------------------------------- +// CBtMtmUi::ServiceAttributeSearchComplete +// ----------------------------------------------------------------------------- +// +void CBtMtmUi::ServiceAttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, + const RSdpResultArray& /*aAttr*/, + TInt /*aErr*/ ) + { + } +// ----------------------------------------------------------------------------- +// CBtMtmUi::DeviceSearchComplete +// ----------------------------------------------------------------------------- +// +void CBtMtmUi::DeviceSearchComplete( CBTDevice* /*aDevice*/, TInt aErr ) + { + iState=aErr; + iWaiter.AsyncStop(); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,389 @@ +/* +* Copyright (c) 2002 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: +* Class CBtMtmUiData +* +*/ + + +// INCLUDE FILES +#include "btmtmuidata.h" +#include "btmtmuidebug.h" +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include //kuidmtmquerymaxbodysizevalue etc +#else +#include //kuidmtmquerymaxbodysizevalue etc +#include //kuidmtmquerymaxbodysizevalue etc +#endif +#include +#include +#include + + +const TInt KBtMtmUiNfcContext = 2; + +// ================= MEMBER FUNCTIONS ======================= + +// Two-phased constructor. +CBtMtmUiData* CBtMtmUiData::NewL( CRegisteredMtmDll& aRegisteredDll ) + { + FLOG( _L( " CBtMtmUiData: CBtMtmUiData\t" ) ); + CBtMtmUiData* self = new(ELeave) CBtMtmUiData( aRegisteredDll ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// Symbian OS default constructor can leave. +void CBtMtmUiData::ConstructL() + { + FLOG( _L( " CBtMtmUiData: ConstructL\t" ) ); + CBaseMtmUiData::ConstructL(); + TObexUtilsMessageHandler::CreateDefaultMtmServiceL(KUidMsgTypeBt); + FLOG( _L( " CBtMtmUiData: ConstructL done\t" ) ); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CBtMtmUiData::CBtMtmUiData(CRegisteredMtmDll& aRegisteredDll) + : CBaseMtmUiData(aRegisteredDll) + { + FLOG( _L( " CBtMtmUiData: CBtMtmUiData\t" ) ); + } + +// Destructor +CBtMtmUiData::~CBtMtmUiData() + { + FLOG( _L( " CBtMtmUiData: ~CBtMtmUiData\t" ) ); + } + +// --------------------------------------------------------- +// OperationSupportedL(...) +// +// --------------------------------------------------------- +// +TInt CBtMtmUiData::OperationSupportedL( TInt /*aOperationId*/, + const TMsvEntry& /*aContext*/) const + { + FLOG( _L( " CBtMtmUiData: OperationSupportedL\t" ) ); + return TObexUtilsUiLayer::OperationNotSupported(); + } + +// --------------------------------------------------------- +// QueryCapability(...) +// MTM query capability +// --------------------------------------------------------- +// +TInt CBtMtmUiData::QueryCapability( TUid aCapability, + TInt& aResponse ) const + { + FLOG( _L( " CBtMtmUiData: QueryCapability\t" ) ); + switch( aCapability.iUid ) + { + // --- Supported valued capabilities --- + case KUidMtmQueryMaxBodySizeValue: + { + aResponse = KMaxTInt; + break; + } + case KUidMtmQueryMaxTotalMsgSizeValue: + { + aResponse = KMaxTInt; + break; + } + case KUidMsvMtmQueryEditorUidValue: + { + aResponse = 0; + break; + } + case KUidMtmQuerySupportAttachmentsValue: + case KUidMtmQueryCanSendMsgValue: + { + break; + } + case KUidMtmQuerySupportedBodyValue: + default: + { + return KErrNotSupported; + } + } + return KErrNone; + } + +// --------------------------------------------------------- +// CBitmapArray& CBtMtmUiData::ContextIcon(...) +// Handles received msg icon. +// --------------------------------------------------------- +// +const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& aContext, + TInt /*aStateFlags*/) const + { + // 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 ); + } + +// --------------------------------------------------------- +// PopulateArraysL() +// Populates bitmap array +// --------------------------------------------------------- +// +void CBtMtmUiData::PopulateArraysL() + { + FLOG( _L( " CBtMtmUiData: PopulateArraysL\t" ) ); + TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeBt, iIconArrays ); + } + +// --------------------------------------------------------- +// GetResourceFileName(TFileName& aFileName) const +// Gives resource filename. +// --------------------------------------------------------- +// +void CBtMtmUiData::GetResourceFileName( TFileName& aFileName ) const + { + FLOG( _L( " CBtMtmUiData: GetResourceFileName\t" ) ); + aFileName = KObexUtilsFileDrive; + aFileName += KDC_RESOURCE_FILES_DIR; + aFileName += KObexUtilsResourceFileName; + } + +// --------------------------------------------------------- +// CanCreateEntryL(...) +// Checks if it is possible to create entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanCreateEntryL( const TMsvEntry& aParent, + TMsvEntry& aNewEntry, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanCreateEntryL\t" ) ); + aReasonResourceId = 0; + if( CheckEntry( aNewEntry ) ) + { + // --- Can create messages in local folders --- + return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue ); + } + // --- Can't create other types --- + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanOpenEntryL(...) +// Checks if it is possible to open entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanOpenEntryL( const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanOpenEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvMessageEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCloseEntryL(...) +// Checks if it is possible to close entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanCloseEntryL( const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanCloseEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvServiceEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanViewEntryL(...) +// Checks if it is possible to view entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanViewEntryL( const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanViewEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvMessageEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanEditEntryL(...) +// Checks if it is possible to edit entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanEditEntryL( const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanEditEntryL\t" ) ); + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + if( CheckEntry( aContext ) ) + { + if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || + ( aContext.iType.iUid == KUidMsvFolderEntryValue ) ) + { + aReasonResourceId=0; + return ETrue; + } + } + return EFalse; + } + +// --------------------------------------------------------- +// CanDeleteServiceL(...) +// Checks if it is possible to delete service. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanDeleteServiceL( const TMsvEntry& /*aService*/, + TInt& aReasonResourceId ) const + { + FLOG( _L( " CBtMtmUiData: CanDeleteServiceL\t" ) ); + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanDeleteFromEntryL(...) +// Checks if it is possible to delete from entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanDeleteFromEntryL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCopyMoveToEntryL(...) +// Checks if it is possible to move to entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanCopyMoveToEntryL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCopyMoveFromEntryL(...) +// Checks if it is possible to move from entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanCopyMoveFromEntryL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanReplyToEntryL(...) +// Checks if it is possible to reply to entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanReplyToEntryL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; // Not Ok to do + } + +// --------------------------------------------------------- +// CanForwardEntryL(...) +// Checks if it is possible to forward entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanForwardEntryL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; // Not Ok to do + } + +// --------------------------------------------------------- +// CheckEntry(...) +// Checks is the entry valid. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CheckEntry( const TMsvEntry& /*aContext*/ ) const + { + FLOG( _L( " CBtMtmUiData: CheckEntry\t" ) ); + return EFalse; + } + +// --------------------------------------------------------- +// CanCancelL(...) +// Checks if it is possible to cancel entry. +// --------------------------------------------------------- +// +TBool CBtMtmUiData::CanCancelL( const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + // No way of sending a message from the outbox, so no need to cancel. + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// StatusTextL(...) +// Returns status text when sending message(outbox). +// --------------------------------------------------------- +// +HBufC* CBtMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const + { + FLOG( _L( " CBtMtmUiData: StatusTextL\t" ) ); + TBuf<80> buffer; + TInt resourceId = R_BT_SEND_PROGRESS_SENDING; + TObexUtilsUiLayer::ReadResourceL( buffer, resourceId ); + return buffer.AllocL(); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidll.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidll.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2002 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: +* DLL interface +* +*/ + + +// INCLUDE FILES + +#include "btmtmuidata.h" +#include "btmtmui.h" +#include "btmtmuidebug.h" + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// --------------------------------------------------------- +// NewBtMtmUiL Creates new MTM UI (BT) +// Returns: CBaseMtmUi pointer to created mtm +// --------------------------------------------------------- +// +EXPORT_C CBaseMtmUi* NewBtMtmUiL( CBaseMtm& aMtm, CRegisteredMtmDll& aRegisteredDll ) + { + FLOG( _L( "CBtMtmUi: NewBtMtmUiL\t" ) ); + return CBtMtmUi::NewL( aMtm, aRegisteredDll ); + } + +// --------------------------------------------------------- +// NewBtMtmUiDataLayerL Creates new MTM UI data layer (BT) +// Returns: CBaseMtmUiData pointer to created mtm +// --------------------------------------------------------- +// +EXPORT_C CBaseMtmUiData* NewBtMtmUiDataLayerL( CRegisteredMtmDll& aRegisteredDll ) + { + FLOG( _L( "CBtMtmUi: NewBtMtmUiDataLayerL\t" ) ); + return CBtMtmUiData::NewL( aRegisteredDll ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/bmarm/IRMTMUIU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/bmarm/IRMTMUIU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,4 @@ +EXPORTS + NewMtmUiDataLayerL__FR17CRegisteredMtmDll @ 1 NONAME R3UNUSED ; NewMtmUiDataLayerL(CRegisteredMtmDll &) + NewMtmUiL__FR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME R3UNUSED ; NewMtmUiL(CBaseMtm &, CRegisteredMtmDll &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/bwins/IRMTMUIU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/bwins/IRMTMUIU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,4 @@ +EXPORTS + ?NewMtmUiDataLayerL@@YAPAVCBaseMtmUiData@@AAVCRegisteredMtmDll@@@Z @ 1 NONAME ; class CBaseMtmUiData * __cdecl NewMtmUiDataLayerL(class CRegisteredMtmDll &) + ?NewMtmUiL@@YAPAVCBaseMtmUi@@AAVCBaseMtm@@AAVCRegisteredMtmDll@@@Z @ 2 NONAME ; class CBaseMtmUi * __cdecl NewMtmUiL(class CBaseMtm &,class CRegisteredMtmDll &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 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 contains infrared MTM info resource. Entry points to Mtm Ui. +* +* +*/ + + +// INCLUDES +#include +#include + + + +#include + +RESOURCE MTM_INFO_FILE + { + mtm_type_uid = 0x100053A4; + technology_type_uid = 0x1000539F; + components = + { + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_ir; + component_uid = KUidMtmServerComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "irs.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_ir; + component_uid = KUidMtmClientComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "irc.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_ir; + component_uid = KUidMtmUiComponentVal; + entry_point = 2; + version = VERSION_V2 {}; + filename = "irmtmui.dll"; + }, + MTM_COMPONENT_V2 + { + human_readable_name = qtn_query_send_via_ir; + component_uid = KUidMtmUiDataComponentVal; + entry_point = 1; + version = VERSION_V2 {}; + filename = "irmtmui.dll"; + } + }; + } + + +RESOURCE MTM_CAPABILITIES + { +// send_capability = 1; + send_capability = 0; + body_capability = 1; + } + +RESOURCE MTM_SECURITY_CAPABILITY_SET + { + capabilities = { ECapabilityLocalServices }; + } + + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/eabi/irmtmuiU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/eabi/irmtmuiU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,8 @@ +EXPORTS + _Z18NewMtmUiDataLayerLR17CRegisteredMtmDll @ 1 NONAME + _Z9NewMtmUiLR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME + _ZTI12CIrMtmUiData @ 3 NONAME ; ## + _ZTI8CIrMtmUi @ 4 NONAME ; ## + _ZTV12CIrMtmUiData @ 5 NONAME ; ## + _ZTV8CIrMtmUi @ 6 NONAME ; ## + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/group/IRmtmuiRegistry.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/IRmtmuiRegistry.mk Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,74 @@ +# +# 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: +# +# Build resource files +# + +SOURCEDIR=..\group +LANGUAGE=sc + +# +# Target directory +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +TARGETDIR=$(EPOCROOT)Epoc32\Release\$(PLATFORM)\$(CFG)\Z\System\Mtm +else +TARGETDIR=$(EPOCROOT)Epoc32\Data\Z\System\Mtm +endif + +$(TARGETDIR) : + @perl $(EPOCROOT)epoc32\tools\emkdir.pl $(TARGETDIR) + +# +# Build the mtm resource files +# + +PROJECT=IRMTMU +SOURCERESOURCE=$(SOURCEDIR)\$(PROJECT)Registry.rss +TARGETRESOURCE=$(TARGETDIR)\$(PROJECT).r$(LANGUAGE) +$(TARGETRESOURCE) : $(TARGETDIR) $(SOURCERESOURCE) + @copy $(SOURCERESOURCE) $(TARGETDIR)\$(PROJECT).rss + @epocrc.bat -u -I. -I%EPOCROOT%s60\irmtmui\group -I%EPOCROOT%epoc32\include $(TARGETDIR)\$(PROJECT).rss -o$(TARGETRESOURCE) + @del $(TARGETDIR)\$(PROJECT).rss + +do_nothing: + rem do nothing + +# +# The targets invoked by abld +# + +MAKMAKE : do_nothing + +RESOURCE : $(TARGETRESOURCE) + +SAVESPACE : BLD + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : do_nothing + +CLEAN : + @erase $(TARGETRESOURCE) + +RELEASABLES : + @echo $(TARGETRESOURCE) diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 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 a MtmUiInfrared. +* +*/ + + +PRJ_PLATFORMS + + +PRJ_EXPORTS + +PRJ_MMPFILES +../group/irmtmui.mmp + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/group/irmtmui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/irmtmui.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002 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 project specification file for the IrMtmUi. +* +* +*/ + + +#include +#include + +TARGET irmtmui.dll +TARGETTYPE dll +TARGETPATH SHARED_LIB_DIR +UID 0x10004845 0x101F8635 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../data +START RESOURCE irmtmui.rss +TARGETPATH MTM_INFO_FILE_DIR +HEADER +LANGUAGE_IDS +END + +SOURCEPATH ../src +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../inc ../../../../inc +MW_LAYER_SYSTEMINCLUDE + +SOURCE irmtmui.cpp +SOURCE irmtmuidata.cpp +SOURCE irmtmuidll.cpp + +LIBRARY obexutils.lib +LIBRARY euser.lib +LIBRARY msgs.lib +LIBRARY mtur.lib +// LIBRARY muiu.lib // Used for forwarding messages over Infrared +LIBRARY featmgr.lib +DEBUGLIBRARY flogger.lib + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002 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 defines logging macros for IrMTMUI +* +*/ + + +#ifndef IRMTMUI_DEBUG_H +#define IRMTMUI_DEBUG_H + + +#ifdef _DEBUG + +#include +#include +#include +#include + +_LIT(KLogFile,"irmtmui.txt"); +_LIT(KLogDirFullName,"c:\\logs\\mtm\\"); +_LIT(KLogDir,"mtm"); + +// Declare the FPrint function +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + } + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // IRMTMUI_DEBUG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2002 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: +* Infrared Mtm Ui part. +* +* +*/ + + +#ifndef CIRMTMUI_H +#define CIRMTMUI_H + +// INCLUDES +#include +#include +// CLASS DECLARATION + +// FORWARD DECLARATIONS +class CClientMtmRegistry; +class CMtmUiLayer; + + + +/** +* CCommonMtmUi +*/ +class CIrMtmUi : public CBaseMtmUi + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CIrMtmUi* NewL( + CBaseMtm& aBaseMtm, + CRegisteredMtmDll& aRegisteredMtmDll ); + + /** + * Destructor. + */ + virtual ~CIrMtmUi(); + + public: // Functions from base classes + + /** + * From CBaseMtmUi Entry Creation. + * @param aEntry reference to entry + * @param aParent parent entry + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CreateL( + const TMsvEntry& aEntry, + CMsvEntry& aParent, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Open entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* OpenL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Close entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CloseL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Launches editor/settings dialog as appropriate. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* EditL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Launches viewer/settings dialog as appropriate + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ViewL( TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Deletes selection from current context + * Deletes entries from the current context, + * which must be a folder or service of the relevant MTM + * @param aSelection reference to entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* DeleteFromL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Deletes service, which need not + * be the current context. + * @param aService reference to entry. + * @param aStatus Status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* DeleteServiceL( + const TMsvEntry& aService, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Remove remaining message of deleted service. + * @param aChildren reference to entry selection. + * @return None. + */ + void DeleteRecursivelyL( CMsvEntrySelection& aChildren ); + + + /** + * From CBaseMtmUi Reply entry + * @param aDestination id for msv. + * @param aPartlist partlist id. + * @param aCompletionStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ReplyL( + TMsvId aDestination, + TMsvPartList aPartlist, + TRequestStatus& aCompletionStatus ); + + + /** + * From CBaseMtmUi forward entry + * @param aDestination id for msv. + * @param aPartlist partlist id. + * @param aCompletionStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ForwardL( + TMsvId aDestination, + TMsvPartList aPartList, + TRequestStatus& aCompletionStatus ); + + + /** + * From CBaseMtmUi Open entry + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* OpenL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Close entry + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CloseL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Handles sending. + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* EditL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + /** + * From CBaseMtmUi Launches viewer/settings dialog as appropriate + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* ViewL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + + /** + * From CBaseMtmUi Context should be MTM folder/service to copy to + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CopyToL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to Move to + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* MoveToL( + const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to copy from + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CopyFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + /** + * From CBaseMtmUi Context should be MTM folder/service to move from + * @param aStatus status for operation. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* MoveFromL( + const CMsvEntrySelection& aSelection, + TMsvId aTargetId, + TRequestStatus& aStatus ); + + + + /** + * From CBaseMtmUi Display progress summary. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + TInt DisplayProgressSummary( const TDesC8& aProgress ) const; + + /** + * From CBaseMtmUi return progress status. + * @param aProgress reference to progress packet. + * @param aReturnString returned progress text. + * @param aTotalEntryCount entry count. + * @param aEntriesDone completed entries. + * @param aCurrentEntrySize size of the entry. + * @param aCurrentBytesTrans transferred bytes. + * @return TInt error code. + */ + virtual TInt GetProgress( + const TDesC8& aProgress, + TBuf& aReturnString, + TInt& aTotalEntryCount, + TInt& aEntriesDone, + TInt& aCurrentEntrySize, + TInt& aCurrentBytesTrans ) const; + + + /** + * From CBaseMtmUi Return capability. + * @param aCapability UID for capability. + * @return TInt error code. + */ + virtual TInt QueryCapability( TUid aCapability, TInt& aResponse ); + + /** + * From CBaseMtmUi Synchronous MTM function operation. + * @param aFunctionId Function ID. + * @param CMsvEntrySelection entry reference. + * @param aParam parameter for function. + * @return None. + */ + virtual void InvokeSyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter ); + + /** + * From CBaseMtmUi Cancel sending. + * @param aStatus Async status for operation. + * @param CMsvEntrySelection entry reference. + * @return CMsvOperation pointer to Msg operation. + */ + virtual CMsvOperation* CancelL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ); + + protected: + + /** + * C++ default constructor. + */ + CIrMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ); + + /** + * By default Symbian OS constructor is private. + */ + virtual void ConstructL(); + + protected: // Functions from base classes + + /** + * From CBaseMtmUi return resource filename. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + virtual void GetResourceFileName( TFileName& aFileName ) const; + + /** + * From CBaseMtmUi Launch viewer for received message. + * @param aStatus Async status for operation. + * @param aSession session reference. + * @return CMsvOperation pointer to Msg operation. + */ + CMsvOperation* LaunchEditorApplicationL( + TRequestStatus& aStatus, + CMsvSession& aSession ); + + protected: // New functions + + /** + * Register MTM. + * @param aMtmType MTM UID. + * @return CBaseMtm pointer. + */ + CBaseMtm* GetClientMtmLC( TUid aMtmType ); + + /** + * Display progress summary. + * @param aProgress reference to summary text. + * @return TInt error code. + */ + TInt DisplayProgressSummaryL( const TDesC8& aProgress ) const; + + protected: // data + TBuf iConnectingText; + TBuf iSendingText; + CClientMtmRegistry* iClientRegistry; // pointer to registration. + TBool iCurrentlySending; // Sending state + }; + +#endif // CIRMTMUI_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2002 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: +* Message type module UI data part. +* +* +*/ + + +#ifndef CIRMTMUIDATA_H +#define CIRMTMUIDATA_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION +/** +* CIrMtmUiData +* +*/ +class CIrMtmUiData : public CBaseMtmUiData + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CIrMtmUiData* NewL(CRegisteredMtmDll& aRegisteredDll); + + /** + * Destructor. + */ + virtual ~CIrMtmUiData(); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + public: // Functions from base classes + + /** + * From CBaseMtmUiData function query. + * @param aOperationId Id for function. + * @param aContext messaging store entry. + * @return TInt error code. + */ + virtual TInt OperationSupportedL( + TInt aOperationId, + const TMsvEntry& aContext) const; + + /** + * From CBaseMtmUiData MTM capability check. + * @param aCapability Uid for message type. + * @param aResponse response for capability check. + * @return TInt error code. + */ + virtual TInt QueryCapability( + TUid aCapability, + TInt& aResponse) const; + + /** + * From CBaseMtmUiData MTM related context icons. + * @param aContext Messaging entry refence. + * @param aStateFlags Flags for icon. + * @return TInt error code. + */ + virtual const CBitmapArray& ContextIcon( + const TMsvEntry& aContext, + TInt aStateFlags) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aParent Messaging entry refence. + * @param aNewEntry Messaging entry refence(created entry). + * @param aReasonResourceId ResourceID. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCreateEntryL( + const TMsvEntry& aParent, + TMsvEntry& aNewEntry, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanReplyToEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanForwardEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanEditEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanViewEntryL(const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanOpenEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCloseEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanDeleteFromEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanDeleteServiceL( + const TMsvEntry& aService, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCopyMoveToEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCopyMoveFromEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @param aReasonResourceId Resource id. + * @return TBool inform that mtm can provice function or not. + */ + virtual TBool CanCancelL(const TMsvEntry& aContext, + TInt& aReasonResourceId) const; + + /** + * From CBaseMtmUiData Provide context-specific function information. + * @param aContext Messaging entry refence. + * @return HBufC* Statustext for sending. + */ + virtual HBufC* StatusTextL(const TMsvEntry& aContext) const; + + protected: // Functions from base classes + + /** + * From CBaseMtmUiData Populate icon array + */ + virtual void PopulateArraysL(); + + /** + * From CBaseMtmUiData gets resource filename. + */ + virtual void GetResourceFileName(TFileName& aFileName) const; + + protected: + + /** + * C++ default constructor. + */ + CIrMtmUiData(CRegisteredMtmDll& aRegisteredDll); + + protected: // New functions + + /** + * Checks is the entry valid. + * @param aContext reference to the entry. + * @return TBool + */ + TBool CheckEntry(const TMsvEntry& aContext) const; + + }; + +#endif // CIRMTMUIDATA_H +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,705 @@ +/* +* Copyright (c) 2002 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: +* CIrMtmui class +* +* +*/ + + +// INCLUDE FILES +#include "irmtmui.h" +#include "debug.h" + +#ifdef NO101APPDEPFIXES_NEW +#include +#endif //NO101APPDEPFIXES_NEW + +#include +#include +#include +#include +#include +#include +#include +#include // Notifier UID's +#include //For notifier +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CIrMtmUi::CIrMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll) + : CBaseMtmUi(aBaseMtm, aRegisteredMtmDll) + { + } + +// Two-phased constructor. +CIrMtmUi* CIrMtmUi::NewL( + CBaseMtm& aBaseMtm, + CRegisteredMtmDll& aRegisteredMtmDll) + { + CIrMtmUi* self=new(ELeave) CIrMtmUi(aBaseMtm, aRegisteredMtmDll); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CIrMtmUi::~CIrMtmUi() + { + delete iClientRegistry; + } + + +// Symbian OS default constructor can leave. +void CIrMtmUi::ConstructL() + { + // --- Make sure base class correctly constructed --- + CBaseMtmUi::ConstructL(); + TObexUtilsUiLayer::ReadResourceL( iConnectingText, R_IR_CONNECTING ); + TObexUtilsUiLayer::ReadResourceL( iSendingText, R_IR_SENDING_DATA ); + iCurrentlySending = EFalse; + } + +// --------------------------------------------------------- +// GetResourceFileName(...) +// return progress status. +// --------------------------------------------------------- +// +void CIrMtmUi::GetResourceFileName( TFileName& aFileName ) const + { + FLOG( _L( "[CIrMtmUi] CIrMtmUi: GetResourceFileName\t" ) ); + aFileName = KObexUtilsFileDrive; + aFileName += KDC_RESOURCE_FILES_DIR; + aFileName += KObexUtilsResourceFileName; + } + +// --------------------------------------------------------- +// QueryCapability(TUid aCapability, TInt& aResponse) +// return capability of mtm. +// --------------------------------------------------------- +// +TInt CIrMtmUi::QueryCapability(TUid aCapability, TInt& aResponse) + { // Querying of menu availablility is done in syni. + FLOG( _L( "[IRU] CIrMtmUi: QueryCapability\t" ) ); + if (aCapability.iUid == KUidMsvMtmUiQueryCanPrintMsgValue) + { + aResponse=ETrue; + return KErrNone; + } + return CBaseMtmUi::QueryCapability(aCapability, aResponse); + } + +// --------------------------------------------------------- +// InvokeSyncFunctionL(...) +// Invoke sync -function from BaseMTM. +// --------------------------------------------------------- +// +void CIrMtmUi::InvokeSyncFunctionL( + TInt aFunctionId, + const CMsvEntrySelection& aSelection, + TDes8& aParameter) + { + FLOG( _L( "[IRU] CIrMtmUi: InvokeSyncFunctionL\t" ) ); + CBaseMtmUi::InvokeSyncFunctionL(aFunctionId, aSelection, aParameter); + } + + +// --------------------------------------------------------- +// CreateL(...) +// Entry creation forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CreateL( + const TMsvEntry& /*aEntry*/, + CMsvEntry& /*aParent*/, + TRequestStatus& /*aStatus*/) + { + // Entries created through utility functions. + User::Leave(KErrNotSupported); + return NULL; + } + + +// --------------------------------------------------------- +// OpenL(TRequestStatus& aStatus) +// handles opening entry. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::OpenL(TRequestStatus& aStatus) + { + FLOG( _L( "[IRU] CIrMtmUi: OpenL\t" ) ); + const TMsvEntry& context=iBaseMtm.Entry().Entry(); + const TUid type(context.iType); + + if ( (type==KUidMsvMessageEntry) && + ((context.Parent()==KMsvSentEntryIdValue) + ||(context.Parent()==KMsvGlobalInBoxIndexEntryIdValue)) + ) + { + // Message is in the sent folder, so can't be edited + return ViewL(aStatus); + } + + return EditL(aStatus); + } + +// --------------------------------------------------------- +// OpenL(...) +// handles opening entry using selection. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::OpenL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection) + { + iBaseMtm.Entry().SetEntryL(aSelection.At(0)); + return OpenL(aStatus); + } + +// --------------------------------------------------------- +// CloseL(TRequestStatus& aStatus) +// Closes entry. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CloseL(TRequestStatus& aStatus) + { + FLOG( _L( "[IRU] CIrMtmUi: CloseL\t" ) ); + CMsvCompletedOperation* op=CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus); + return op; + } + +// --------------------------------------------------------- +// CloseL(TRequestStatus& aStatus) +// Closes entry using selection. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CloseL( + TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection) + { + iBaseMtm.Entry().SetEntryL(aSelection.At(0)); + return CloseL(aStatus); + } + +// --------------------------------------------------------- +// EditL(TRequestStatus& aStatus) +// Handles message sending. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::EditL(TRequestStatus& aStatus) + { + FLOG( _L( "[IRU] CIrMtmUi: EditL\t" ) ); + switch( iBaseMtm.Entry().Entry().iType.iUid ) + { + case KUidMsvMessageEntryValue: + { + return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); + /* Infrared is not supported anymore. Implementation for sending over Infrared is left for reference: + ( add #include to the included files ) + ( add constants: + const TInt KIrMtmUiConnectionTimeout = 20000000; + const TInt KIrMtmUiReceiveTimeout = 0; ) + code starts here: + + if( iBaseMtm.Entry().Entry().Parent() != KMsvDraftEntryId && + iBaseMtm.Entry().Entry().Parent() != KMsvGlobalOutBoxIndexEntryId ) + { + // Edit/"use" entries in the Inbox + return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); + } + else + { + FeatureManager::InitializeLibL(); + if(!FeatureManager::FeatureSupported(KFeatureIdIrda)) + { + FLOG(_L("[IRSS]\t FeatMgr doesn't find IrDA, show not_supported ")); + RNotifier notifier; + User::LeaveIfError( notifier.Connect() ); + TBTGenericInfoNotiferParamsPckg paramsPckg; + paramsPckg().iMessageType=EIRNotSupported; + TInt status = notifier.StartNotifier(KBTGenericInfoNotifierUid, paramsPckg); + if ( status != KErrNone ) + { + FTRACE(FPrint(_L("[IRSS]\t void CIrMtmUi::EditL() ERROR: StartNotifier() failed. Code: %d "), status)); + } + notifier.Close(); + User::Leave(KErrNone); + } + FeatureManager::UnInitializeLib(); + CIrClientMtm::STimeouts timeouts; + timeouts.iConnectTimeout = KIrMtmUiConnectionTimeout; + timeouts.iPutTimeout = KIrMtmUiReceiveTimeout; + + TPckgBuf timeoutBuf( timeouts ); + + CMsvEntrySelection* sel = new( ELeave ) CMsvEntrySelection(); + CleanupStack::PushL( sel ); + + sel->AppendL( BaseMtm().Entry().EntryId() ); + + CMsvOperationWait* waiter = CMsvOperationWait::NewLC(); + + TBuf toFrom; + TInt resourceId = R_IR_SEND_OUTBOX_SENDING; + TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); + + TMsvEntry newTEntry( iBaseMtm.Entry().Entry() ); + newTEntry.iDetails.Set( toFrom ); + newTEntry.SetVisible( ETrue ); + newTEntry.SetInPreparation( ETrue ); + + iBaseMtm.Entry().ChangeL( newTEntry ); + + CMsvEntry* entry = + BaseMtm().Session().GetEntryL( KMsvDraftEntryId ); + + CleanupStack::PushL( entry ); + + CMsvOperation* moveOp = entry->MoveL( + *sel, + KMsvGlobalOutBoxIndexEntryId, + waiter->iStatus ); + + CleanupStack::PopAndDestroy(entry); + + waiter->Start(); + CActiveScheduler::Start(); + delete moveOp; + + CleanupStack::PopAndDestroy(waiter); + + TInt dialogIndex =((R_IR_SENDING_DATA & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; + CMsvProgressReporterOperation* reporter = + CMsvProgressReporterOperation::NewL( Session(), aStatus, dialogIndex, KObexUtilsCategory); + CleanupStack::PushL( reporter ); + + CMsvOperation* op = BaseMtm().InvokeAsyncFunctionL( + CIrClientMtm::EIrcCmdSend, + *sel, + timeoutBuf, + reporter->RequestStatus() ); + + // ownership of op transfered to reporter + reporter->SetOperationL( op ); + reporter->SetTitleL(iConnectingText); + aStatus = KRequestPending; + + CleanupStack::Pop(reporter); + CleanupStack::PopAndDestroy(sel); + // ownership of reporter transfered to caller + return reporter; + } + + End of reference implementation for sending over Infrared: + */ + } + case KUidMsvServiceEntryValue: + case KUidMsvAttachmentEntryValue: + case KUidMsvFolderEntryValue: + { + User::Leave( KErrNotSupported ); + break; + } + default: + { + break; + } + } + + CMsvCompletedOperation* op = CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus ); + FLOG( _L( "[IrMtmUi] CIrMtmUi: EditL Done\t" ) ); + + aStatus = KRequestPending; + return op; + } + +// --------------------------------------------------------- +// EditL(...) +// Handles message sending using selection. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::EditL( TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection) + { + iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); + return EditL( aStatus ); + } + +// --------------------------------------------------------- +// ViewL(TRequestStatus& aStatus) +// Handles viewing of received object. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::ViewL( TRequestStatus& aStatus ) + { + FLOG( _L( "[IRU] CIrMtmUi: ViewL\t" ) ); + return LaunchEditorApplicationL(aStatus, iBaseMtm.Entry().Session()); + } + +// --------------------------------------------------------- +// ViewL(...) +// Handles viewing of received object using selection. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::ViewL( TRequestStatus& aStatus, + const CMsvEntrySelection& aSelection ) + { + iBaseMtm.Entry().SetEntryL(aSelection.At(0)); + return ViewL(aStatus); + } + +// --------------------------------------------------------- +// CopyFromL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CopyFromL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/) + { + User::Leave(KErrNotSupported); + return NULL; + } + +// --------------------------------------------------------- +// MoveFromL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::MoveFromL( const CMsvEntrySelection& /*aSelection*/, + TMsvId /*aTargetId*/, + TRequestStatus& /*aStatus*/) + { + User::Leave(KErrNotSupported); + return NULL; + } + +// --------------------------------------------------------- +// MoveToL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::MoveToL( const CMsvEntrySelection& /*aSelection*/, + TRequestStatus& /*aStatus*/) + { + User::Leave(KErrNotSupported); + return NULL; + } + +// --------------------------------------------------------- +// CopyToL(...) +// Not supported. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CopyToL( const CMsvEntrySelection& /*aSelection*/, + TRequestStatus& /*aStatus*/ ) + { + User::Leave(KErrNotSupported); + return NULL; + } + +// --------------------------------------------------------- +// DisplayProgressSummary(const TDesC8& aProgress) const +// calls leaving DisplayProgressSummaryL -function and +// traps the error. +// --------------------------------------------------------- +// +TInt CIrMtmUi::DisplayProgressSummary( const TDesC8& aProgress ) const + { + FLOG( _L( "[IRU] CIrMtmUi: DisplayProgressSummary\t" ) ); + TInt retVal = KErrNone; + TRAP( retVal, retVal = DisplayProgressSummaryL( aProgress ) ); + return retVal; + } + +// --------------------------------------------------------- +// TInt CIrMtmUi::DisplayProgressSummaryL(const TDesC8& aProgress) const +// Shows connection summary. +// --------------------------------------------------------- +// +TInt CIrMtmUi::DisplayProgressSummaryL( const TDesC8& aProgress ) const + { + #ifndef NO101APPDEPFIXES_NEW + (void) aProgress; + #endif //NO101APPDEPFIXES_NEW + + #ifdef NO101APPDEPFIXES_NEW + FLOG( _L( "[IRU] CIrMtmUi: DisplayProgressSummaryL\t" ) ); + TInt resourceId; + if( ( !aProgress.Length() ) || + ( aProgress.Size() == sizeof( TMsvLocalOperationProgress ) ) ) + { + // Probably a CMsvCompletedOperation + return KErrCancel; + } + TPckgBuf paramPack; + paramPack.Copy( aProgress ); + TObexMtmProgress& progress = paramPack(); + + const TObexMtmProgress::TSendState progressType = progress.iSendState; + const TInt error = progress.iError; + + if( error == KErrInUse ) + { + resourceId = R_IR_CANNOT_ESTABLISH; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + return KErrNone; + } + + switch( progressType ) + { + case TObexMtmProgress::EDisconnected: + { + // Allowed to send again. + CONST_CAST( CIrMtmUi*, this )->iCurrentlySending = EFalse; + resourceId = R_IR_DATA_SENT; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + break; + } + case TObexMtmProgress::ESendError: + { + if( error == KErrIrObexClientNoDevicesFound ) + { + resourceId = R_IR_CANNOT_ESTABLISH; + TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); + } + else + { + resourceId = R_IR_SENDING_FAILED; + TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); + } + break; + } + case TObexMtmProgress::ESendComplete: + { + break; + } + case TObexMtmProgress::EInitialise: + case TObexMtmProgress::EConnect: + case TObexMtmProgress::EConnectAttemptComplete: + case TObexMtmProgress::ESendObject: + case TObexMtmProgress::ESendNextObject: + { + return KErrCancel; + } + case TObexMtmProgress::EUserCancelled: + { + return KErrCancel; + } + default: + { + return KErrCancel; + } + } + FLOG( _L( "[IRU] CIrMtmUi: DisplayProgressSummaryL Done\t" ) ); + #endif //NO101APPDEPFIXES_NEW + return KErrNone; + } + +// --------------------------------------------------------- +// GetProgress(...) +// return progress status. +// --------------------------------------------------------- +// +TInt CIrMtmUi::GetProgress( const TDesC8& aProgress, + TBuf& aReturnString, + TInt& aTotalEntryCount, + TInt& aEntriesDone, + TInt& aCurrentEntrySize, + TInt& aCurrentBytesTrans ) const + { + #ifndef NO101APPDEPFIXES_NEW + (void) aProgress; + (void) aReturnString; + (void) aTotalEntryCount; + (void) aEntriesDone; + (void) aCurrentEntrySize; + (void) aCurrentBytesTrans; + #endif //NO101APPDEPFIXES_NEW + + #ifdef NO101APPDEPFIXES_NEW + FLOG( _L( "[CIrMtmUi] CIrMtmUi: GetProgress\t" ) ); + TPckgBuf paramPack; + paramPack.Copy( aProgress ); + TObexMtmProgress& progress = paramPack(); + const TObexMtmProgress::TSendState progressType = progress.iSendState; + aTotalEntryCount = progress.iTotalEntryCount; + aEntriesDone = progress.iEntriesDone; + aCurrentEntrySize = progress.iCurrentEntrySize; + aCurrentBytesTrans = progress.iCurrentBytesTrans; + + if( aTotalEntryCount > 1 ) // This is for progress bar multisending + { + aCurrentEntrySize = 0; + } + switch( progressType ) + { + case TObexMtmProgress::ENullOp: + case TObexMtmProgress::ESendError: + { + aReturnString = KNullDesC; + break; + } + case TObexMtmProgress::EInitialise: + case TObexMtmProgress::EConnect: + case TObexMtmProgress::EConnectAttemptComplete: + { + aReturnString = iConnectingText; + break; + } + case TObexMtmProgress::ESendObject: + case TObexMtmProgress::ESendNextObject: + case TObexMtmProgress::ESendComplete: + { + aReturnString = iSendingText; + break; + } + case TObexMtmProgress::EDisconnected: + { + break; + } + default: + { + return KErrCancel; + } + } + FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetProgress Done\t" ) ); + #endif //NO101APPDEPFIXES_NEW + return KErrNone; + } + +// --------------------------------------------------------- +// LaunchEditorApplicationL(...) +// Launch viewer for selected object. The first is object's +// recognition(document handler). +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, + CMsvSession& aSession) + { + FLOG( _L( "[CIrMtmUi] CIrMtmUi: LaunchEditorApplicationL\t" ) ); + CMsvEntry* message; + message = &iBaseMtm.Entry(); + return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); + } + + +// --------------------------------------------------------- +// GetClientMtmLC(TUid aMtmType) +// Handles MTM registration. +// --------------------------------------------------------- +// +CBaseMtm* CIrMtmUi::GetClientMtmLC( TUid aMtmType ) + { + if (!iClientRegistry) + { + iClientRegistry = CClientMtmRegistry::NewL( Session() ); + } + CBaseMtm* mtm=iClientRegistry->NewMtmL( aMtmType ); + CleanupStack::PushL( mtm ); + return mtm; + } + +// --------------------------------------------------------- +// DeleteFromL(TUid aMtmType) +// passes entry selection to Base for deletion. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::DeleteFromL( const CMsvEntrySelection& aSelection, + TRequestStatus& aStatus) + + { + return CBaseMtmUi::DeleteFromL(aSelection, aStatus); + } + +// --------------------------------------------------------- +// DeleteServiceL(...) +// IR has no service, just complete it. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::DeleteServiceL( const TMsvEntry& /*aService*/, + TRequestStatus& aStatus) + + { + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus); + } + +// --------------------------------------------------------- +// ReplyL(...) +// Reply is forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::ReplyL( TMsvId /*aDestination*/, + TMsvPartList /*aPartlist*/, + TRequestStatus& /*aCompletionStatus*/) + { + User::Leave(KErrNotSupported); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// ForwardL(...) +// Forward is forbidden. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::ForwardL( TMsvId /*aDestination*/, + TMsvPartList /*aPartList*/, + TRequestStatus& /*aCompletionStatus*/ ) + { + User::Leave(KErrNotSupported); + // Return value is needed for removing compilation errors + return NULL; + } + +// --------------------------------------------------------- +// CancelL(...) +// No MS way of sending a message from the outbox, so no need to cancel. +// Just complete it. +// --------------------------------------------------------- +// +CMsvOperation* CIrMtmUi::CancelL( TRequestStatus& aStatus, + const CMsvEntrySelection& /*aSelection*/ ) + { + return CMsvCompletedOperation::NewL( + Session(), + Type(), + KNullDesC8, + KMsvLocalServiceIndexEntryId, + aStatus, + KErrNone); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,414 @@ +/* +* Copyright (c) 2002 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: +* Class CIrMtmUiData +* +*/ + + +// INCLUDE FILES +#include "irmtmuidata.h" +#include "irmtmui.h" +#include +#include +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include //kuidmtmquerymaxbodysizevalue etc +#else +#include //kuidmtmquerymaxbodysizevalue etc +#include //kuidmtmquerymaxbodysizevalue etc +#endif +#include +#include +#include "debug.h" + +//CONSTANTS +const TInt KIrMtmUiDataMsgEditorAppValue = 0x00000000; + +// ================= MEMBER FUNCTIONS ======================= + +// Two-phased constructor. +CIrMtmUiData* CIrMtmUiData::NewL(CRegisteredMtmDll& aRegisteredDll) + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CIrMtmUiData\t" ) ); + CIrMtmUiData* self=new(ELeave) CIrMtmUiData(aRegisteredDll); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Symbian OS default constructor can leave. +void CIrMtmUiData::ConstructL() + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL\t" ) ); + CBaseMtmUiData::ConstructL(); + TObexUtilsMessageHandler::CreateDefaultMtmServiceL(KUidMsgTypeIrUID); + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL done\t" ) ); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CIrMtmUiData::CIrMtmUiData(CRegisteredMtmDll& aRegisteredDll) + : CBaseMtmUiData(aRegisteredDll) + { + } + + +// Destructor +CIrMtmUiData::~CIrMtmUiData() + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ~CIrMtmUiData\t" ) ); + } + + +// --------------------------------------------------------- +// OperationSupportedL(...) +// No Ir-specific operations added to MS menu. +// --------------------------------------------------------- +// +TInt CIrMtmUiData::OperationSupportedL( + TInt /*aOperationId*/, + const TMsvEntry& /*aContext*/) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) ); + return TObexUtilsUiLayer::OperationNotSupported(); + } + +// --------------------------------------------------------- +// QueryCapability(...) +// MTM query capability +// --------------------------------------------------------- +// +TInt CIrMtmUiData::QueryCapability( + TUid aCapability, + TInt& aResponse ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: QueryCapability\t" ) ); + switch( aCapability.iUid ) + { + // --- Supported valued capabilities --- + case KUidMtmQueryMaxBodySizeValue: + { + aResponse = KMaxTInt; + break; + } + case KUidMtmQueryMaxTotalMsgSizeValue: + { + aResponse = KMaxTInt; + break; + } + case KUidMsvMtmQueryEditorUidValue: + { + aResponse = KIrMtmUiDataMsgEditorAppValue; + break; + } + /* Infrared is not supported anymore. Implementation for sending over Infrared is left for reference: + ( add #include to the included files ) + code starts here: + + case KUidMsvMtmQuerySupportLinks: + { + aResponse = ETrue; + break; + } + + End of reference implementation for sending over Infrared: + */ + case KUidMtmQuerySupportAttachmentsValue: + case KUidMtmQueryCanSendMsgValue: + { + break; + } + case KUidMtmQuerySupportedBodyValue: + default: + { + return KErrNotSupported; + } + } + return KErrNone; + } + +// --------------------------------------------------------- +// CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(...) +// Handles received msg icon. +// --------------------------------------------------------- +// +const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon( + const TMsvEntry& aContext, + TInt /*aStateFlags*/) const + + { + TInt icon = TObexUtilsUiLayer::ContextIcon( aContext, EInfrared ); + return *iIconArrays->At( icon/2 ); + } + +// --------------------------------------------------------- +// PopulateArraysL() +// Populates bitmap array +// --------------------------------------------------------- +// +void CIrMtmUiData::PopulateArraysL() + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) ); + + TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeIrUID, iIconArrays ); + } + +// --------------------------------------------------------- +// GetResourceFileName(TFileName& aFileName) const +// Gives resource filename. +// --------------------------------------------------------- +// +void CIrMtmUiData::GetResourceFileName(TFileName& aFileName) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) ); + aFileName = KObexUtilsFileDrive; + aFileName += KDC_RESOURCE_FILES_DIR; + aFileName += KObexUtilsResourceFileName; + } + +// --------------------------------------------------------- +// CanCreateEntryL(...) +// Checks if it is possible to create entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanCreateEntryL( + const TMsvEntry& aParent, + TMsvEntry& aNewEntry, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCreateEntryL\t" ) ); + aReasonResourceId = 0; + if( CheckEntry( aNewEntry ) ) + { + // --- Can create messages in local folders --- + return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue ); + } + // --- Can't create other types --- + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanOpenEntryL(...) +// Checks if it is possible to open entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanOpenEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanOpenEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvMessageEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCloseEntryL(...) +// Checks if it is possible to close entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanCloseEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCloseEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvServiceEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanViewEntryL(...) +// Checks if it is possible to view entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanViewEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanViewEntryL\t" ) ); + if( CheckEntry( aContext ) ) + { + if( aContext.iType.iUid == KUidMsvMessageEntryValue ) + { + aReasonResourceId = 0; + return ETrue; + } + } + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanEditEntryL(...) +// Checks if it is possible to edit entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanEditEntryL( + const TMsvEntry& aContext, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) ); + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + if( CheckEntry( aContext ) ) + { + if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || + ( aContext.iType.iUid == KUidMsvFolderEntryValue ) ) + { + aReasonResourceId=0; + return ETrue; + } + } + return EFalse; + } + +// --------------------------------------------------------- +// CanDeleteServiceL(...) +// Checks if it is possible to delete service. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanDeleteServiceL( + const TMsvEntry& /*aService*/, + TInt& aReasonResourceId ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) ); + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanDeleteFromEntryL(...) +// Checks if it is possible to delete from entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanDeleteFromEntryL( + const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCopyMoveToEntryL(...) +// Checks if it is possible to move to entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanCopyMoveToEntryL( + const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanCopyMoveFromEntryL(...) +// Checks if it is possible to move from entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanCopyMoveFromEntryL( + const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// CanReplyToEntryL(...) +// Checks if it is possible to reply to entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanReplyToEntryL( + const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; // Not Ok to do + } + +// --------------------------------------------------------- +// CanForwardEntryL(...) +// Checks if it is possible to forward entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanForwardEntryL( + const TMsvEntry& /*aContext*/, + TInt& aReasonResourceId ) const + { + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; // Not Ok to do + } + +// --------------------------------------------------------- +// CheckEntry(...) +// Checks is the entry valid. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CheckEntry(const TMsvEntry& aContext) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CheckEntry\t" ) ); + return( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) && + ( aContext.iMtm == KUidMsgTypeIrUID ) ); + } + +// --------------------------------------------------------- +// CanCancelL(...) +// Checks if it is possible to cancel entry. +// --------------------------------------------------------- +// +TBool CIrMtmUiData::CanCancelL( + const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const + { + // No way of sending a message from the outbox, so no need to cancel. + aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); + return EFalse; + } + +// --------------------------------------------------------- +// StatusTextL(...) +// Returns status text when sending message(outbox). +// --------------------------------------------------------- +// +HBufC* CIrMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const + { + FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) ); + TBuf<80> buffer; + TInt resourceId = R_IR_SEND_PROGRESS_SENDING; + TObexUtilsUiLayer::ReadResourceL( buffer, resourceId ); + HBufC* ptr; + ptr = buffer.AllocL(); + return ptr; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidll.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidll.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2002 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: +* DLL interface +* +*/ + + +// INCLUDE FILES + +#include "irmtmuidata.h" +#include "irmtmui.h" +#include "debug.h" + +// ================= OTHER EXPORTED FUNCTIONS ============== + +// +// --------------------------------------------------------- +// NewMtmUiL Creates new MTM UI +// Returns: CBaseMtmUi pointer to created mtm +// +EXPORT_C CBaseMtmUi* NewMtmUiL( CBaseMtm& aMtm, CRegisteredMtmDll& aRegisteredDll ) + { + FLOG( _L( "CBaseMtmUi* NewMtmUiL\t" )); + return CIrMtmUi::NewL( aMtm, aRegisteredDll ); + } + +// +// --------------------------------------------------------- +// NewMtmUiL Creates new MTM UI Data layer +// Returns: CBaseMtmUiData pointer to created mtm +// +EXPORT_C CBaseMtmUiData* NewMtmUiDataLayerL( CRegisteredMtmDll& aRegisteredDll ) + { + FLOG( _L( "CBaseMtmUiData* NewMtmUiDataLayerL\t" )); + return CIrMtmUiData::NewL( aRegisteredDll ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/data/101F8636.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/data/101F8636.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005 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: PC Connectivity Plug-in resource file +* +*/ + + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101F8636; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101F7C8C; + implementations = + { + // Info for CSConPCConnplugin + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F8636; + version_no = 1; + display_name = "Obex Services"; + default_data = "OBEX/BT||OBEX/IrDA"; + + // + // opaque_data contains parameters used by following API calls in SRCS: + // 1. Setup USB interface string descriptor in Unicode; + // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo); + // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService, + // TInt aProtocol, + // TInt aChannel, + // TBool aAuthenticate, + // TBool aAuthorise, + // TBool aEncrypt ); + // opaque_data = "@0||@1||@2||@3||@4||@5||@6" + // @0 aStrDesc e.g. "PC Connectivity" + // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09" + // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106 + // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013 + // @4 aAuthenticate e.g. EFalse, 0 + // @5 aAuthorise e.g. EFalse, 0 + // @6 aEncrypt e.g. EFalse, 0 + // + opaque_data = "OBEX|"\ + "||"\ + "|0x1105|"\ + "|0x1013|"\ + "|0|"\ + "|1|"\ + "|0|"\ + "|0xfffe|"\ + "|0xfffe"; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2002 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 a MtmUiServerBluetooth. +* +*/ + + +PRJ_PLATFORMS + + +PRJ_MMPFILES +obexserviceopp.mmp + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002 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 project specification file for the mtmuiserverbluetooth. +* +* +*/ + +#include + + +TARGET obexserviceopp.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101F8636 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE obexserviceopp.cpp +SOURCE oppcontroller.cpp + +START RESOURCE ../data/101F8636.rss + TARGET obexserviceopp.rsc +END + + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + +LIBRARY obexutils.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY servicehandler.lib +LIBRARY avkon.lib +LIBRARY irobex.lib // For Object exchange +LIBRARY imageconversion.lib +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY sysutil.lib +LIBRARY esock.lib +LIBRARY charconv.lib aknnotify.lib eiksrv.lib +LIBRARY platformenv.lib +LIBRARY bluetooth.lib // Bluetooth libraries +LIBRARY btdevice.lib // Bluetooth library +LIBRARY btmanclient.lib + +//Bteng APIs +LIBRARY btengdevman.lib //btengdevman.dll +LIBRARY btengsettings.lib //btengsettings.dll +LIBRARY btengconnman.lib //btengconnman.dll + +DEBUGLIBRARY flogger.lib diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/inc/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logging definition +* +*/ + + +#ifndef PRJ_LOGGING_H +#define PRJ_LOGGING_H + +#include "debugconfig.h" + +#ifdef PRJ_ENABLE_TRACE + +#ifdef PRJ_FILE_TRACE +#include +#else +#include +#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; + +NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow + { +public: + void Overflow(TDes16& /*aDes*/) {} + }; + +NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow + { +public: + void Overflow(TDes8& /*aDes*/) {} + }; + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TBuf16 theFinalString; + theFinalString.Append(KTracePrefix16); + TOverflowTruncate16 overflow; + theFinalString.AppendFormatList(aFmt,list,&overflow); + RDebug::Print(theFinalString); +#endif + } + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list, aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TOverflowTruncate8 overflow; + TBuf8 buf8; + buf8.Append(KTracePrefix8); + buf8.AppendFormatList(aFmt, list, &overflow); + TBuf16 buf16(buf8.Length()); + buf16.Copy(buf8); + TRefByValue 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 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 buf; + buf.Append(KLeavePrefix8); + buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName); + Trace(buf); + User::LeaveIfError(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(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} + +#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} + +#define TRACE_FUNC_ENTRY_THIS {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_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}} + +#define TRACE_FUNC_THIS {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;}} + +#define TRACE_ONLY(p) p + +#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(User::LeaveIfError(REASON));} + +#define LEAVE(REASON) {static_cast(User::Leave(REASON));} + +#define TRACE_FUNC_ENTRY + +#define TRACE_FUNC_ENTRY_THIS + +#define TRACE_FUNC_EXIT + +#define TRACE_FUNC + +#define TRACE_FUNC_THIS + +#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;} + +#define TRACE_ONLY(p) + +#endif // PRJ_ENABLE_TRACE + +#endif // PRJ_LOGGING_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/inc/debugconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/inc/debugconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_DEBUGCONFIG_H +#define OBEXSM_DEBUGCONFIG_H + +#include "prjconfig.h" + + +/** + * Custom logging variations. + */ +#ifdef PRJ_FILE_TRACE +_LIT(KLogFile,"oppreceiveservice.txt"); +_LIT(KLogDir,"locod"); +#endif + +#ifdef PRJ_ENABLE_TRACE +_LIT(KTracePrefix16, "[OPP] "); +_LIT8(KTracePrefix8, "[OPP] "); +_LIT8(KFuncFormat8, "><%S"); +_LIT8(KFuncThisFormat8, "><%S, [0x%08X]"); +_LIT8(KFuncEntryFormat8, ">%S"); +_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]"); +_LIT8(KFuncExitFormat8, "<%S"); + +_LIT(KPanicCategory, "OPP"); +_LIT8(KPanicPrefix8, "PANIC code "); +_LIT8(KLeavePrefix8, "LEAVE code "); +#endif + +#endif // OBEXSM_DEBUGCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2004 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: +* Class handles Bluetooth OPP reception. +* +* +*/ + + +#ifndef OPPCONTROLLER_H +#define OPPCONTROLLER_H + +// INCLUDES + + +#include +#include +#include +#include "obexutilspropertynotifier.h" +#include +#include "btengdevman.h" + +#include +#include + +#include // The AIW service handler + +_LIT( KUniqueTransportName, "RFCOMM" ); +const TInt KBtStartReserveChannel = 9; +const TInt KBtEndReserveChannel = 30; + +/** +* CBtListenActive +* Class to implement IrObex permanent listen +*/ +class COPPController : public CSrcsInterface, public MObexServerNotify, + public MObexUtilsPropertyNotifyHandler, + public MGlobalProgressCallback, public MGlobalNoteCallback, + public MBTEngDevManObserver + { +public: + static COPPController* NewL(); + ~COPPController(); + +private: // from CSrcsInterface + TBool IsOBEXActive(); + void SetMediaType(TSrcsMediaType aMediaType); + TInt SetObexServer(CObexServer* aServer); + +private: // from MObexServerNotify + void ErrorIndication(TInt aError); + void TransportUpIndication(); + void TransportDownIndication(); + TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo); + void ObexDisconnectIndication(const TDesC8& aInfo); + CObexBufObject* PutRequestIndication(); + TInt PutPacketIndication(); + TInt PutCompleteIndication(); + CObexBufObject* GetRequestIndication(CObexBaseObject* aRequiredObject); + TInt GetPacketIndication(); + TInt GetCompleteIndication(); + TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo); + void AbortIndication(); + +private: // from MObexUtilsPropertyNotifyHandler + void HandleNotifyL(TMemoryPropertyCheckType aCheckType); + +private: // from MGlobalProgressCallback + void HandleGlobalProgressDialogL(TInt aSoftkey); + +private: // from MGlobalNoteCallback + void HandleGlobalNoteDialogL(TInt aSoftkey); + +private: // from MBTEngDevManObserver + void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); + +private: + COPPController(); + void ConstructL(); + + void CancelTransfer(); + void HandlePutRequestL(); + TInt HandlePutCompleteIndication(); + void HandleError(TBool aAbort); + + TBool CheckCapacityL(); + void LaunchReceivingIndicatorL(); + inline TBool ReceivingIndicatorActive() const { return (iProgressDialog || iWaitDialog); } + void UpdateReceivingIndicator(); + void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); + TInt GetDriveWithMaximumFreeSpaceL(); + +private: + enum TObexTransferState + { + ETransferIdle, + ETransferPut, + ETransferPutDiskError, + ETransferPutInitError, + ETransferPutCancel, + }; + +private: + CObexServer* iObexServer; + TObexTransferState iObexTransferState; + CObexBufObject* iObexObject; + TInt iDrive; + TBool iListening; + CObexUtilsPropertyNotifier* iLowMemoryActiveCDrive; + CObexUtilsPropertyNotifier* iLowMemoryActiveMMC; + TMsvId iMsvIdParent; + TMsvId iMsvIdAttach; + TFileName iFullPathFilename; + TFileName iDefaultFolder; + TFileName iPreviousDefaultFolder; + TFileName iCenRepFolder; + RFs iFs; + RFile iFile; + CBufFlat* iBuf; + TBool iLengthHeaderReceived; + TSrcsMediaType iMediaType; + TInt iTotalSizeByte; + TFileName iReceivingFileName; + CGlobalProgressDialog* iProgressDialog; + CGlobalDialog* iWaitDialog; + TBool iNoteDisplayed; + CBTEngDevMan* iDevMan; + CBTDeviceArray* iResultArray; + TBTDeviceName iRemoteDeviceName; + }; + +#endif // OPPCONTROLLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/inc/prjconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/inc/prjconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_PRJCONFIG_H +#define OBEXSM_PRJCONFIG_H + +/** + * Traces are enabled via RDebug::Print() in UDEB build, by default. + */ +#ifdef _DEBUG +#define PRJ_ENABLE_TRACE +#endif + +/** + * Traces will be written 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 // OBEXSM_PRJCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/src/obexserviceopp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/src/obexserviceopp.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Export ECom interface implementations +* +*/ + + +#include //ECom header file +#include "oppcontroller.h" + +// --------------------------------------------------------------------------- +// An array of TImplementationProxy objects which onnect each +// implemeation with its instantiation function +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F8636 , COPPController::NewL ) + }; + +// --------------------------------------------------------------------------- +// 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; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,857 @@ +/* +* Copyright (c) 2004 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: Implementation of CBtListenActive +* +*/ + + +// INCLUDE FILES +#include // AVKON components +#include "oppcontroller.h" +#include "btengdevman.h" +#include +#include "debug.h" +#include +#include +#include +#include +#include +#include // The AIW service handler +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +const TInt KBufferSize = 0x10000; // 64 kB + +// ================= MEMBER FUNCTIONS ======================= + + +COPPController* COPPController::NewL() + { + COPPController* self = new ( ELeave ) COPPController(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +COPPController::COPPController() + { + TRACE_FUNC + } + +void COPPController::ConstructL() + { + TRACE_FUNC + iObexTransferState = ETransferIdle; + iLowMemoryActiveCDrive = CObexUtilsPropertyNotifier::NewL(this, ECheckPhoneMemory); + iLowMemoryActiveMMC = CObexUtilsPropertyNotifier::NewL(this, ECheckMMCMemory); + iDevMan=CBTEngDevMan::NewL(this); + iResultArray = new (ELeave) CBTDeviceArray(1); + // Get default folder from CenRep + TObexUtilsMessageHandler::GetCenRepKeyStringValueL(KCRUidBluetoothEngine, + KLCReceiveFolder, + iCenRepFolder); + } + +COPPController::~COPPController() + { + TRACE_FUNC + delete iObexObject; + delete iBuf; + delete iLowMemoryActiveCDrive; + delete iLowMemoryActiveMMC; + delete iProgressDialog; + delete iWaitDialog; + delete iDevMan; + if (iResultArray) + { + iResultArray->ResetAndDestroy(); + delete iResultArray; + } + iFs.Close(); + } + +// --------------------------------------------------------- +// ErrorIndication() +// --------------------------------------------------------- +// +void COPPController::ErrorIndication( TInt TRACE_ONLY(aError) ) + { + TRACE_FUNC + TRACE_ERROR((_L( "[oppreceiveservice] COPPController: ErrorIndication error:\t %d" ),aError)); + HandleError(EFalse); // false because not explicit abort + } + +// --------------------------------------------------------- +// AbortIndication() +// --------------------------------------------------------- +// +void COPPController::AbortIndication() + { + TRACE_FUNC + HandleError(ETrue); // true because explicit abort + } + +void COPPController::HandleError(TBool aAbort) + { + TRACE_ERROR((_L( "[oppreceiveservice] COPPController:HandleError" ))); + if( iObexTransferState == ETransferPut || iObexTransferState == ETransferPutDiskError ) + { + if(iObexObject) + { + iObexObject->Reset(); + } + CancelTransfer(); + if(!aAbort) + { + if(iMediaType == ESrcsMediaBT) + { + TRAP_IGNORE( TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( R_BT_FAILED_TO_RECEIVE ) ); + } + TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported) + } + } + delete iBuf; + iBuf = NULL; + iObexTransferState = ETransferIdle; + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iObexObject, iMsvIdParent)); + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); + } + +// --------------------------------------------------------- +// TransportUpIndication() +// --------------------------------------------------------- +// +void COPPController::TransportUpIndication() + { + TRACE_FUNC + iObexTransferState = ETransferIdle; + + if ( !iFs.Handle() ) + { + TRACE_INFO( (_L( "[oppreceiveservice] TransportUpIndication iFs.Connect()" )) ); + if ( iFs.Connect() ) // error value not preserved, iFs.Handle() checked one more time before first useage + { + TRACE_INFO( (_L( "[oppreceiveservice] TransportUpIndication iFs.Connect() failed" )) ); + } + } + + iFile = RFile(); + iFullPathFilename.Zero(); + } + +// --------------------------------------------------------- +// ObexConnectIndication() +// --------------------------------------------------------- +// +TInt COPPController::ObexConnectIndication( const TObexConnectInfo& /*aRemoteInfo*/, + const TDesC8& /*aInfo*/) + { + TRACE_FUNC + if ( iMediaType == ESrcsMediaBT ) + { + TRACE_INFO( _L( "[oppreceiveservice] ObexConnectIndication: BT media \t" ) ); + + // Get remote device socket address and bluetooth name + // Remote bluetooth name will be displayed in the new message in inbox. + // + TSockAddr addr; + iObexServer->RemoteAddr(addr); + TBTDevAddr tBTDevAddr = static_cast(addr).BTAddr(); + + TBTRegistrySearch nameSearch; + nameSearch.FindAddress(tBTDevAddr); + + iResultArray->Reset(); + // ignore any errors here, if we don't get the name, we don't get the name + static_cast(iDevMan->GetDevices(nameSearch, iResultArray)); + } + + return KErrNone; + } + +// --------------------------------------------------------- +// ObexDisconnectIndication( +// --------------------------------------------------------- +// +void COPPController::ObexDisconnectIndication(const TDesC8& /*aInfo*/) + { + TRACE_FUNC + + } + +// --------------------------------------------------------- +// TransportDownIndication() +// --------------------------------------------------------- +// +void COPPController::TransportDownIndication() + { + TRACE_FUNC + // Remove receiving buffer and files used during file receiving. + // + delete iObexObject; + iObexObject = NULL; + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); + iFs.Close(); + } + +// --------------------------------------------------------- +// PutRequestIndication() +// --------------------------------------------------------- +// +CObexBufObject* COPPController::PutRequestIndication() + { + TRACE_FUNC + iLengthHeaderReceived = EFalse; // New put request so clear header based state + iObexTransferState = ETransferPut; + + // Checking if backup is running now - if backup process is active, then we + // need to cancel transfer - otherwise phone will freeze during receiving + // data + if ( TObexUtilsUiLayer::IsBackupRunning() ) + { + TRACE_INFO ( _L ("Backup in progress! Canceling incoming transfer.")); + iObexTransferState = ETransferPutInitError; + return NULL; + } + + TRAPD(err, HandlePutRequestL()); + if(err == KErrNone) + { + return iObexObject; + } + TRACE_INFO( _L( "[oppreceiveservice] COPPController: PutRequestIndication end\t" ) ); + if (iObexTransferState != ETransferPutInitError) + { + iObexTransferState = ETransferPutDiskError; + } + return NULL; + } + +// --------------------------------------------------------- +// PutPacketIndication() +// --------------------------------------------------------- +// +TInt COPPController::PutPacketIndication() + { + TRACE_FUNC + if(iObexTransferState == ETransferPutCancel) + { + // User cancelled the put request, so error the next packet to terminate the put request. + // BIP considers the Unauthorized error response suitable for this... + HandleError(ETrue); // reset state and clear up + return KErrIrObexRespUnauthorized; + } + + iTotalSizeByte = iObexObject->Length(); // get size of receiving file + iReceivingFileName = iObexObject->Name(); // get name of receiving file + + // Check that capacity is suitable as soon as possible + if(!iLengthHeaderReceived && iTotalSizeByte > 0) + { + iLengthHeaderReceived = ETrue; // total size value is from length header + TBool capacity = ETrue; + TRAPD(retTrap, capacity = CheckCapacityL()); + if(retTrap != KErrNone) + { + return KErrGeneral; + } + if(!capacity) + { + TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + return KErrDiskFull; + } + } + if(iObexObject->Name().Length() > KMaxFileName) + { + return KErrAccessDenied; + } + if(iObexTransferState == ETransferPutDiskError) + { + return KErrDiskFull; + } + // successfully received put packet if we reached here + iObexTransferState = ETransferPut; + + // Now we need to either create (in the first instance) or update the dialog on the UI. + if(ReceivingIndicatorActive()) + { + UpdateReceivingIndicator(); + } + else if(!iNoteDisplayed) + { + // No note launched yet, so try to launch + TRAPD(err, LaunchReceivingIndicatorL()); + iNoteDisplayed = (err == KErrNone); + } + + return KErrNone; + } + +// --------------------------------------------------------- +// PutCompleteIndication() +// --------------------------------------------------------- +// +TInt COPPController::PutCompleteIndication() + { + TRACE_FUNC + TInt retVal = KErrNone; + if(iObexTransferState == ETransferPutCancel) + { + retVal = KErrIrObexRespUnauthorized; + HandleError(ETrue); + } + else + { + retVal = HandlePutCompleteIndication(); + iObexTransferState = ETransferIdle; + CloseReceivingIndicator(); + } + TRACE_FUNC_EXIT + return retVal; + } + +// --------------------------------------------------------- +// GetRequestIndication() +// --------------------------------------------------------- +// +CObexBufObject* COPPController::GetRequestIndication( CObexBaseObject* /*aRequiredObject*/) + { + TRACE_FUNC + return NULL; + } + +// --------------------------------------------------------- +// GetPacketIndication() +// --------------------------------------------------------- +// +TInt COPPController::GetPacketIndication() + { + TRACE_FUNC + return KErrNone; + } + +// --------------------------------------------------------- +// GetCompleteIndication() +// --------------------------------------------------------- +// +TInt COPPController::GetCompleteIndication() + { + TRACE_FUNC + return KErrNone; + } + +// --------------------------------------------------------- +// SetPathIndication() +// --------------------------------------------------------- +// +TInt COPPController::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, + const TDesC8& /*aInfo*/) + { + TRACE_FUNC + // SetPath is not implemented in OPP - so following IrOBEX guidance, return + // the Forbidden response code. + return KErrIrObexRespForbidden; + } + + + +// --------------------------------------------------------- +// HandleNotifyL() +// --------------------------------------------------------- +// +void COPPController::HandleNotifyL( TMemoryPropertyCheckType aCheckType ) + { + TRACE_FUNC + + // Only interested on this notification if we are receiving something + if ( iObexTransferState == ETransferPut ) + { + // Check the keys, what has been changed. + TRACE_INFO( _L( "[oppreceiveservice] COPPController::HandleNotifyL\t" ) ); + if ( aCheckType == ECheckPhoneMemory ) + { + if ( SysUtil::FFSSpaceBelowCriticalLevelL( NULL, 0 ) ) + { + TRACE_INFO( _L( "[oppreceiveservice] COPPController: Obex Server error diskfull\t" ) ); + iObexTransferState = ETransferPutDiskError; + } + } + else if ( aCheckType == ECheckMMCMemory ) + { + if ( SysUtil::MMCSpaceBelowCriticalLevelL( NULL, 0 ) ) + { + TRACE_INFO( _L( "[oppreceiveservice] COPPController: Obex Server error diskfull\t" ) ); + iObexTransferState = ETransferPutDiskError; + } + } + } + } +// --------------------------------------------------------- +// HandlePutRequestL() +// --------------------------------------------------------- +// +void COPPController::HandlePutRequestL() + { + TRACE_FUNC + + delete iObexObject; + iObexObject = NULL; + + iFile = RFile(); + + if ( !iFs.Handle() ) + { + User::Leave(KErrGeneral); + } + + // Assign an initial value to iDrive + iDrive = GetDriveWithMaximumFreeSpaceL(); + + // If iDrive is at critical space level, we immediately show out_of_memory. + // + if (SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, 0, iDrive )) + { + TRAP_IGNORE(TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(R_OUT_OF_MEMORY)); + User::Leave(KErrGeneral); + } + + TRACE_INFO( (_L( "[oppreceiveservice] HandlePutRequestL %d\t" ),iDrive ) ); + + iObexObject = CObexBufObject::NewL( NULL ); + + delete iBuf; + iBuf = NULL; + + TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); + if ( iMediaType == ESrcsMediaBT ) + { + TChar driveLetter; + iDefaultFolder.Zero(); + iFs.DriveToChar(iDrive, driveLetter); + iDefaultFolder.Append(driveLetter); + if ( iDrive == EDriveC ) + { + iDefaultFolder.Append(_L(":\\data\\")); + } + else + { + iDefaultFolder.Append(_L(":\\")); + } + iDefaultFolder.Append(iCenRepFolder); + + iFile = RFile(); + iFullPathFilename.Zero(); + TRAPD(err, TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(iFile, + iDefaultFolder, + iFullPathFilename, + iBuf, + KBufferSize)); + if(err != KErrNone) + { + iObexTransferState = ETransferPutInitError; + User::Leave(KErrGeneral); + } + } + else + { + iObexTransferState = ETransferPutInitError; + User::Leave(KErrGeneral); + } + + User::LeaveIfError(iFile.Open(iFs,iFullPathFilename,EFileWrite)); + TObexRFileBackedBuffer bufferdetails(*iBuf,iFile,CObexBufObject::EDoubleBuffering); + + TRAPD(err, iObexObject->SetDataBufL( bufferdetails) ); + if (err != KErrNone) + { + iObexTransferState = ETransferPutInitError; + User::Leave(KErrGeneral); // set to != KErrNone + } + + TRACE_INFO( _L( "[oppreceiveservice] COPPController: HandlePutRequestL completed\t" ) ); + } + + +// --------------------------------------------------------- +// HandlePutCompleteIndication() +// --------------------------------------------------------- +// +TInt COPPController::HandlePutCompleteIndication() + { + TRACE_FUNC + TInt retVal = KErrNone; + + TChar driveLetter; + iDefaultFolder.Zero(); + iFs.DriveToChar(iDrive, driveLetter); + iDefaultFolder.Append(driveLetter); + if ( iDrive == EDriveC ) + { + iDefaultFolder.Append(_L(":\\data\\")); + } + else + { + iDefaultFolder.Append(_L(":\\")); + } + iDefaultFolder.Append(iCenRepFolder); + iFullPathFilename.Zero(); + iFullPathFilename.Append(iDefaultFolder); + + + TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication %d\t" ),iDrive ) ); + + if (iMediaType==ESrcsMediaBT) + { + TRAP ( retVal, TObexUtilsMessageHandler::SaveFileToFileSystemL(iObexObject, + KUidMsgTypeBt, + iMsvIdParent, + iFullPathFilename, + iFile, + iRemoteDeviceName)); + } + TRACE_ASSERT( iMediaType!=ESrcsMediaIrDA, KErrNotSupported); + if ( retVal == KErrNone) + { + TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename)); + + if( retVal != KErrNone ) + { + TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication AddEntryToInboxL() failed %d \t" ),retVal ) ); + TRAP_IGNORE(TObexUtilsMessageHandler::RemoveInboxEntriesL(iObexObject, iMsvIdParent)); + } + } + else + { + TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication failed %d \t" ),retVal ) ); + } + + + delete iObexObject; + iObexObject = NULL; + + delete iBuf; + iBuf = NULL; + + iPreviousDefaultFolder = iDefaultFolder; // save the last file path where file is successfully saved to file system. + iMsvIdParent = KMsvNullIndexEntryId; + TRACE_INFO( _L( "[oppreceiveservice] HandlePutCompleteIndication Done\t" ) ); + return retVal; + } + + +// --------------------------------------------------------- +// CheckCapacity() +// --------------------------------------------------------- +// +TBool COPPController::CheckCapacityL() + { + TRACE_FUNC_ENTRY + + iDrive = EDriveZ; // Intialize iDrive to Z + TInt filesize = iObexObject->Length(); + + RFs rfs ; + User::LeaveIfError(rfs.Connect()); + + TInt mmcDrive = KDefaultDrive; // External memroy card + TInt imsDrive = KDefaultDrive; // Internal mass storage + + User::LeaveIfError(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, imsDrive)); + User::LeaveIfError(DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, mmcDrive)); + + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL imsDrive=%d; mmcDrive=%d\t" ),imsDrive, mmcDrive ) ); + + TVolumeInfo volumeInfo; + TInt err = rfs.Volume(volumeInfo, imsDrive); + + // If err != KErrNone, Drive is not available. + // + if ( !err ) + { + // Check capacity on Internal mass storage + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL Internal mass storage\t" )) ); + if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &rfs, filesize, imsDrive ) ) + { + iDrive = imsDrive; + } + } + + if ( iDrive == EDriveZ) + { + err = rfs.Volume(volumeInfo, mmcDrive); + if ( !err ) + { + // Check capacity on Internal mass storage + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL Checking memory card\t" )) ); + if ( !SysUtil::DiskSpaceBelowCriticalLevelL( &rfs, filesize, mmcDrive ) ) + { + iDrive = mmcDrive; + } + } + } + if ( iDrive == EDriveZ ) + { + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL Checking phone memory\t" )) ); + // Phone memory + if( !SysUtil::DiskSpaceBelowCriticalLevelL( &rfs, filesize, EDriveC )) + { + iDrive = EDriveC; + } + } + rfs.Close(); + TRACE_INFO( (_L( "[oppreceiveservice] CheckCapacityL iDrive = %d\t" ),iDrive ) ); + TRACE_FUNC_EXIT + if (iDrive == EDriveZ) + { + // If there is no free space for receiving file, we need to set iPreviousDefaultFolder back to iDefaultFolder. + // In order to show the file receveing dialog correctly. + iDefaultFolder = iPreviousDefaultFolder; + return EFalse; + } + return ETrue; + } + +// --------------------------------------------------------- +// IsOBEXActive() +// --------------------------------------------------------- +// +TBool COPPController::IsOBEXActive() + { + TRACE_FUNC + return ETrue; + } + +// --------------------------------------------------------- +// SetMediaType() +// --------------------------------------------------------- +// +void COPPController::SetMediaType( TSrcsMediaType aMediaType ) + { + TRACE_FUNC + iMediaType=aMediaType; + } + +// --------------------------------------------------------- +// SetObexServer() +// --------------------------------------------------------- +// +TInt COPPController::SetObexServer( CObexServer* aServer) + { + TInt retVal=KErrNone; + + if (aServer) + { + iObexServer = aServer; + retVal=aServer->Start(this); + } + return retVal; + } + +// --------------------------------------------------------- +// CancelTransfer() +// --------------------------------------------------------- +// +void COPPController::CancelTransfer() + { + TRACE_FUNC + CloseReceivingIndicator(); + if(iObexTransferState == ETransferPut) + { + iObexTransferState = ETransferPutCancel; + } + else // go to idle for all other states + { + iObexTransferState = ETransferIdle; + } + } + +void COPPController::LaunchReceivingIndicatorL() + { + if(ReceivingIndicatorActive()) + { + return; + } + + if(iTotalSizeByte > 0) + { + iProgressDialog = CGlobalProgressDialog::NewL(this); + if(iReceivingFileName.Length() > 0) + { + iProgressDialog->ShowProgressDialogNameSizeL(iReceivingFileName, iTotalSizeByte); + } + else + { + if(iMediaType == ESrcsMediaBT) + { + iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); + } + TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); + } + } + else + { + iWaitDialog = CGlobalDialog::NewL(this); + if(iMediaType == ESrcsMediaBT) + { + iWaitDialog->ShowNoteDialogL(R_BT_RECEIVING_DATA, ETrue); + } + TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); + } + } + +void COPPController::UpdateReceivingIndicator() + { + if(iProgressDialog) + { + iProgressDialog->UpdateProgressDialog(iObexObject->BytesReceived(), iTotalSizeByte); + } + // else we are using a wait note, so no "need" to update + } + +void COPPController::HandleGlobalProgressDialogL( TInt aSoftkey ) + { + TRACE_FUNC + + if(aSoftkey == EAknSoftkeyCancel) + { + CancelTransfer(); + } + else if(aSoftkey == EAknSoftkeyHide) + { + CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + } + } + +void COPPController::HandleGlobalNoteDialogL( TInt aSoftkey ) + { + TRACE_FUNC + + if(aSoftkey == EAknSoftkeyCancel) + { + CancelTransfer(); + } + else if(aSoftkey == EAknSoftkeyHide) + { + CloseReceivingIndicator(EFalse); // Don't reset state as only hiding + } + } + +void COPPController::CloseReceivingIndicator(TBool aResetDisplayedState) + { + TRACE_FUNC + if(aResetDisplayedState) + { + iNoteDisplayed = EFalse; + } + if(iProgressDialog) + { + iProgressDialog->ProcessFinished(); + delete iProgressDialog; + iProgressDialog = NULL; + } + if(iWaitDialog) + { + iWaitDialog->ProcessFinished(); + delete iWaitDialog; + iWaitDialog = NULL; + } + } + + // --------------------------------------------------------- + // GetDriveWithMaximumFreeSpace() + // --------------------------------------------------------- + // + TInt COPPController::GetDriveWithMaximumFreeSpaceL() + { + // Get drive with maximum freespace among phone memory, MMC, internal mass storage. + // + TRACE_FUNC + TVolumeInfo volumeInfoC; + TVolumeInfo volumeInfoE; + TVolumeInfo volumeInfoF; + TInt64 max = 0; + TInt drive = 0; + + TInt err = iFs.Volume(volumeInfoC, EDriveC); + + if ( !err ) + { + // set initial values to max and drive. + max = volumeInfoC.iFree; + drive = EDriveC; + } + + err = iFs.Volume(volumeInfoE, EDriveE); + if ( !err ) + { + if (volumeInfoE.iFree >= max) + { + max = volumeInfoE.iFree; + drive = EDriveE; + } + + } + + err = iFs.Volume(volumeInfoF, EDriveF); + if ( !err ) + { + if (volumeInfoF.iFree >= max) + { + max = volumeInfoF.iFree; + drive = EDriveF; + } + } + + max = 0; + return drive; + } + + + // ---------------------------------------------------------- + // COPPController::HandleGetDevicesComplete + // Callback from devman + // ---------------------------------------------------------- + // + void COPPController::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/) + { + TRACE_INFO( _L( "[oppreceiveservice] HandleGetDevicesComplete: enter \t" ) ); + if ( aErr == KErrNone ) + { + if ( iResultArray->Count()) + { + iRemoteDeviceName.Zero(); + if ( iResultArray->At(0)->FriendlyName().Length() > 0 ) + { + TRACE_INFO( _L( "[oppreceiveservice] HandleGetDevicesComplete: got friendly name \t" ) ); + iRemoteDeviceName.Copy(iResultArray->At(0)->FriendlyName()); + } + else + { + TRACE_INFO( _L( "[oppreceiveservice] HandleGetDevicesComplete: got devciename name \t" )); + TRAP_IGNORE(iRemoteDeviceName.Copy( BTDeviceNameConverter::ToUnicodeL(iResultArray->At(0)->DeviceName()))); + } + } + } + } + +//////////////////////////// Global part //////////////////////////// + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/mtmuibluetooth.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/mtmuibluetooth.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: +* +*/ + +#ifndef __MTMUIBLUETOOTH_IBY__ +#define __MTMUIBLUETOOTH_IBY__ + +#ifdef __BT +file=ABI_DIR\BUILD_DIR\btmtmui.dll SHARED_LIB_DIR\btmtmui.dll +#endif + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/mtmuibluetoothresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/mtmuibluetoothresources.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: +* +*/ + +#ifndef __MTMUIBLUETOOTHRESOURCES_IBY__ +#define __MTMUIBLUETOOTHRESOURCES_IBY__ + +#ifdef __BT +data=DATAZ_\resource\messaging\mtm\btmtmui.rsc resource\messaging\mtm\btmtmui.rsc +#endif + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/mtmuiinfrared.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/mtmuiinfrared.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ + +#ifndef __MTMUIINFRARED_IBY__ +#define __MTMUIINFRARED_IBY__ + +file=ABI_DIR\BUILD_DIR\irmtmui.dll SHARED_LIB_DIR\irmtmui.dll + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/mtmuiinfraredResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/mtmuiinfraredResources.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ + +#ifndef __MTMUIINFRAREDRESOURCES_IBY__ +#define __MTMUIINFRAREDRESOURCES_IBY__ + +data=DATAZ_\resource\messaging\mtm\irmtmui.rsc resource\messaging\mtm\irmtmui.rsc + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/obexservicebip.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/obexservicebip.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + +#ifndef __OBEXSERVICEBIP_IBY__ +#define __OBEXSERVICEBIP_IBY__ + +#ifdef __BT +#ifdef __BT_IMAGING_PROFILE +ECOM_PLUGIN(obexservicebip.dll,101F8671.rsc) +#endif +#endif + + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexreceiveservices/rom/obexserviceopp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexreceiveservices/rom/obexserviceopp.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,26 @@ +/* +* 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: +* +*/ + +#ifndef __OBEXSERVICEOPP_IBY__ +#define __OBEXSERVICEOPP_IBY__ + +#ifdef __BT +ECOM_PLUGIN(obexserviceopp.dll,101F8636.rsc) +#endif + + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/BWINS/obexservicesendutilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/BWINS/obexservicesendutilsU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,12 @@ +EXPORTS + ?AddImageL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 1 NONAME ; void CBTServiceParameterList::AddImageL(class TDesC16 const &) + ?AddImageL@CBTServiceParameterList@@QAEXVRFile@@@Z @ 2 NONAME ; void CBTServiceParameterList::AddImageL(class RFile) + ?AddObjectL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 3 NONAME ; void CBTServiceParameterList::AddObjectL(class TDesC16 const &) + ?AddObjectL@CBTServiceParameterList@@QAEXVRFile@@@Z @ 4 NONAME ; void CBTServiceParameterList::AddObjectL(class RFile) + ?AddXhtmlL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 5 NONAME ; void CBTServiceParameterList::AddXhtmlL(class TDesC16 const &) + ?NewL@CBTServiceAPI@@SAPAV1@XZ @ 6 NONAME ; class CBTServiceAPI * CBTServiceAPI::NewL(void) + ?NewL@CBTServiceParameterList@@SAPAV1@XZ @ 7 NONAME ; class CBTServiceParameterList * CBTServiceParameterList::NewL(void) + ?NewLC@CBTServiceParameterList@@SAPAV1@XZ @ 8 NONAME ; class CBTServiceParameterList * CBTServiceParameterList::NewLC(void) + ?StartServiceL@CBTServiceAPI@@QAEXW4TBTServiceType@@PAVCBTServiceParameterList@@@Z @ 9 NONAME ; void CBTServiceAPI::StartServiceL(enum TBTServiceType, class CBTServiceParameterList *) + ?StartSynchronousServiceL@CBTServiceAPI@@QAEXW4TBTServiceType@@PAVCBTServiceParameterList@@@Z @ 10 NONAME ; void CBTServiceAPI::StartSynchronousServiceL(enum TBTServiceType, class CBTServiceParameterList *) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/eabi/obexservicesendutilsu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/eabi/obexservicesendutilsu.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + _ZN13CBTServiceAPI13StartServiceLE14TBTServiceTypeP23CBTServiceParameterList @ 1 NONAME + _ZN13CBTServiceAPI24StartSynchronousServiceLE14TBTServiceTypeP23CBTServiceParameterList @ 2 NONAME + _ZN13CBTServiceAPI4NewLEv @ 3 NONAME + _ZN23CBTServiceParameterList10AddObjectLE5RFile @ 4 NONAME + _ZN23CBTServiceParameterList10AddObjectLERK7TDesC16 @ 5 NONAME + _ZN23CBTServiceParameterList4NewLEv @ 6 NONAME + _ZN23CBTServiceParameterList5NewLCEv @ 7 NONAME + _ZN23CBTServiceParameterList9AddImageLE5RFile @ 8 NONAME + _ZN23CBTServiceParameterList9AddImageLERK7TDesC16 @ 9 NONAME + _ZN23CBTServiceParameterList9AddXhtmlLERK7TDesC16 @ 10 NONAME + _ZTI13CBTServiceAPI @ 11 NONAME ; ## + _ZTI23CBTServiceParameterList @ 12 NONAME ; ## + _ZTV13CBTServiceAPI @ 13 NONAME ; ## + _ZTV23CBTServiceParameterList @ 14 NONAME ; ## + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2002 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 ObexSendService +* +*/ + + +#include + +PRJ_PLATFORMS + + +PRJ_EXPORTS +../obexservicesendutils/inc/BTServiceAPI.h |../../inc/btserviceapi.h +../obexservicesendutils/inc/BTServiceParameterList.h |../../inc/BTServiceParameterList.h +../rom/obexservicesendutils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicesendutils.iby) + +PRJ_MMPFILES +../group/sendutils.mmp + +PRJ_TESTMMPFILES + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/group/sendutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/group/sendutils.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 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 project specification file for the BtServiceUtils +* +*/ + +#include + + +TARGET obexservicesendutils.dll +TARGETTYPE dll +UID 0x1000008D 0x101F86B6 +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../obexservicesendutils/src +SOURCE BTServiceAPI.cpp +SOURCE BTServiceClient.cpp +SOURCE BTServiceUtils.cpp +SOURCE BTServiceStarter.cpp +SOURCE BTServiceParameterList.cpp + +SOURCE BTSOPPController.cpp +SOURCE BTSBIPController.cpp +SOURCE BTSBPPController.cpp +SOURCE BTSBPPObjectRequest.cpp +SOURCE BTSBPPObjectServer.cpp +SOURCE BTSBPPServerWait.cpp + +SOURCE BTSUCapabilityResolver.cpp +SOURCE BTSUDataConverter.cpp +SOURCE BTSUImageConverter.cpp +SOURCE BTSUPassKeyRequest.cpp +SOURCE BTSURefObjectResolver.cpp +SOURCE BTSUXmlParser.cpp +SOURCE BTConnectionTimer.cpp +SOURCE BTSController.cpp +SOURCE BTSProgresstimer.cpp + +USERINCLUDE ../obexservicesendutils/inc +SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/libc +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY apgrfx.lib // App Arch Session +LIBRARY apmime.lib // App Arch Mime Recognizers +LIBRARY bafl.lib // Basic Application Framework Library +LIBRARY bitmaptransforms.lib // Bitmap transfomration library +LIBRARY bluetooth.lib // Bluetooth Sockets +LIBRARY btdevice.lib // Bluetooth Device +LIBRARY btengdiscovery.lib // Bluetooth Discovery +LIBRARY btengsettings.lib // Bluetooth Settings +LIBRARY charconv.lib // Character conversion +LIBRARY efsrv.lib // File Server +LIBRARY esock.lib // Socket Connections +LIBRARY estor.lib // Write and Read streams +LIBRARY euser.lib // Base library +LIBRARY fbscli.lib // Bitmap utils +LIBRARY imageconversion.lib // Image conversion library +LIBRARY irobex.lib // Object Exchange +LIBRARY obexutils.lib // Object Exchange UI services +//LIBRARY xmlinterface.lib // XML parser interface +LIBRARY caf.lib // DRM common +LIBRARY xmlframework.lib // XML Framework +LIBRARY featmgr.lib // Inquire supported static feature +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib +DEBUGLIBRARY flogger.lib // File logging services + + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/inc/btsendingservicedebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/inc/btsendingservicedebug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 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 defines logging macros for BTSS. +* +*/ + + +#ifndef BTSENDINGSERVICEDEBUG_H +#define BTSENDINGSERVICEDEBUG_H + + +#ifdef _DEBUG +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#include +#include +#include + +_LIT(KLogFile,"btss.log"); +_LIT(KLogDirFullName,"c:\\logs\\"); +_LIT(KLogDir,"btss"); + +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } + +// Declare the FPrint function +// +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + } + +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#include + +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } + +// Declare the FPrint function +// +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); + } + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // BTSENDINGSERVICEDEBUG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceinterface.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: ?Description +* +*/ + + +#ifndef BTSENDSERVICEINTERFACE_H +#define BTSENDSERVICEINTERFACE_H + +#include + +class BtSendManager; + +class BTSendServiceInterface : public XQServiceProvider +{ + Q_OBJECT + +public: + BTSendServiceInterface( QObject *parent = 0); + inline ~BTSendServiceInterface(); + +public slots: + void send(QVariant data); + + +}; + +inline BTSendServiceInterface::~BTSendServiceInterface() + { + } + +#endif // BTSENDSERVICEINTERFACE_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceprovider.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,54 @@ +/* + * 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: + * class to manage differnt messaging views. + * + */ + +#ifndef BTSENDSERVICEPROVIDER_H +#define BTSENDSERVICEPROVIDER_H + +#include +#include +#include + +class CBTServiceAPI; +class CBTSSSendListHandler; + + +class CBtSendServiceProvider: public CBase + { +public: + /** + * constructor + */ + static CBtSendServiceProvider* NewL(); + + /** + * Destructor. + */ + ~CBtSendServiceProvider(); + + + int send(const QList &arguments); +private: + CBtSendServiceProvider(); + void ConstructL(); + +public: + CBTSSSendListHandler* iConverter; + CBTServiceAPI* iBTSendingService; + }; + +#endif /* BTSENDSERVICEPROVIDER_H */ diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/inc/btsssendlisthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/inc/btsssendlisthandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,142 @@ +/* +* 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: Converter class for converting AIW paramerer list to +* bt send parameter list +* +*/ + + +#ifndef BTSSSENDLISTHANDLER_H +#define BTSSSENDLISTHANDLER_H + +#include +#include +#include +#include "btsendingservicedebug.h" + +class CBTServiceParameterList; + +/** + * BTSSend list handler + * Converts AIW list to bt sending object list + * + * @since S60 v3.2 + */ +class CBTSSSendListHandler : public CActive + { + +public: + + static CBTSSSendListHandler* NewL(); + static CBTSSSendListHandler* NewLC(); + + /** + * Destructor. + */ + virtual ~CBTSSSendListHandler(); + + /** + * ConvertList + * + * @since S60 v3.2 + * @param aOutParamList AIW parameter list + * @param aList bt sending parameter list + * @return error code + */ + TInt ConvertList(const QList *arguments,CBTServiceParameterList* aList ); + + + +// from base class CActive + + /** + * From CActive. + * RunL + * + * @since S60 v3.2 + */ + void RunL(); + + /** + * From CActive. + * DoCancel + * + * @since S60 v3.2 + */ + inline void DoCancel(); + + +private: + CBTSSSendListHandler(); + + void ConstructL(); + + /** + * Add object + * + * @since S60 v3.2 + */ + void AddObject(); + + /** + * Add object + * + * @since S60 v3.2 + */ + void DoAddObjectL(); + +private: // data + + /** + * BT sending parameter list + * Not own. + */ + CBTServiceParameterList* iList; + + /** + * AIW parameter list + * Not own. + */ +// const CAiwGenericParamList* iOutParamList; + + const QList *mArguments; + + /** + * List index + */ + TInt iListIndex; + + /** + * Sync waiter object + */ + CActiveSchedulerWait iSyncWaiter; + }; + + +// --------------------------------------------------------------------------- +// From class CActive. +// DoCancel() +// --------------------------------------------------------------------------- +// +inline void CBTSSSendListHandler::DoCancel() + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoCancel()")); + if ( iSyncWaiter.IsStarted() ) + { + iSyncWaiter.AsyncStop(); + } + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoCancel() done")); + } + +#endif // BTSSSENDLISTHANDLER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/obexhighway.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/obexhighway.pro Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,55 @@ +# +# 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: +# +TEMPLATE = app +TARGET = obexhighway +CONFIG += hb \ + service + +MOC_DIR = moc +OBJECTS_DIR = obj + +HEADERS += inc/btsendserviceinterface.h \ + inc/btsssendlisthandler.h \ + inc/btsendingservicedebug.h \ + inc/btsendserviceprovider.h + +SOURCES += src/main.cpp \ + src/btsendserviceinterface.cpp \ + src/btsssendlisthandler.cpp \ + src/btsendserviceprovider.cpp + + +INCLUDEPATH += . ../../inc + +SERVICE.FILE = xml/obexhighway_conf.xml +SERVICE.OPTIONS = embeddable \ + hidden + +LIBS += -lhbcore \ + -lxqservice \ + -lxqserviceutil \ + -lobexservicesendutils \ + -lbtfeatures \ + -lflogger \ + -lxqutils + +symbian { + TARGET.UID3 = 0x2002EA5A + TARGET.CAPABILITY = All -TCB + } +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "./rom/obexhighway.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexhighway.iby)" diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/rom/obexhighway.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/rom/obexhighway.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ +#ifndef __OBEXHIGHWAY_IBY__ +#define __OBEXHIGHWAY_IBY__ + +file=ABI_DIR\UREL\obexhighway.exe SHARED_LIB_DIR\obexhighway.exe +data=DATAZ_\resource\apps\obexhighway.rsc resource\apps\obexhighway.rsc +data=DATAZ_\private\10003a3f\import\apps\obexhighway_reg.rsc private\10003a3f\import\apps\obexhighway_reg.rsc +#endif \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/src/btsendserviceinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/src/btsendserviceinterface.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: ?Description +* +*/ + + +#include "btsendserviceinterface.h" +#include "btsendserviceprovider.h" + +BTSendServiceInterface::BTSendServiceInterface(QObject* parent) +: XQServiceProvider("obexhighway.com.nokia.symbian.IFileShare",parent) + { + publishAll(); + } + + +void BTSendServiceInterface::send(QVariant data) + { + QList arguments; + + if(data.type()==QVariant::String) + { + arguments.append(data); + } + else + { + arguments.append(data.toList()); + } + CBtSendServiceProvider *btSendServiceProvider = NULL; + TRAPD(err,btSendServiceProvider = CBtSendServiceProvider::NewL()); + //todo need to decide what needs to be return to the service client if error occurs also how to do it + if(err) + return; + btSendServiceProvider->send(arguments); + delete btSendServiceProvider; + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/src/btsendserviceprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/src/btsendserviceprovider.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,93 @@ +/* + * 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: + * + */ + + +#include "btsendserviceprovider.h" +#include +#include "btsssendlisthandler.h" +#include // For Enterprise security settings +#include // For Enterprise security notifier + + + + +CBtSendServiceProvider* CBtSendServiceProvider::NewL() + { + CBtSendServiceProvider* self = new( ELeave ) CBtSendServiceProvider(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CBtSendServiceProvider::ConstructL() + { + // Check features setting - if not completely enabled with enterprise settings then we are not allowed to send anything. + // Fail here at the first fence, otherwise there are a number of other areas that need to be considered. + if(BluetoothFeatures::EnterpriseEnablementL() != BluetoothFeatures::EEnabled) + { + RNotifier notifier; + User::LeaveIfError(notifier.Connect()); + CleanupClosePushL(notifier); + User::LeaveIfError(notifier.StartNotifier(KBTEnterpriseItSecurityInfoNotifierUid, KNullDesC8)); + CleanupStack::PopAndDestroy(¬ifier); + + //@TODO in old code we don't continue further what needs to be done here + } + iBTSendingService = CBTServiceAPI::NewL(); + iConverter = CBTSSSendListHandler::NewL(); + } + +CBtSendServiceProvider::CBtSendServiceProvider() + { + + } + + +CBtSendServiceProvider::~CBtSendServiceProvider() + { + if(iConverter) + { + delete iConverter; + iConverter= NULL; + } + if(iBTSendingService) + { + delete iBTSendingService; + iBTSendingService = NULL; + } + } + + +int CBtSendServiceProvider::send(const QList &arguments) + { + TInt error = KErrNone; + + CBTServiceParameterList* parameterList = NULL; + TRAP(error,parameterList= CBTServiceParameterList::NewL()); + if (error) + return error; + iConverter->ConvertList( &arguments, parameterList); + + delete iConverter; + iConverter = NULL; + + TRAP(error,iBTSendingService->StartSynchronousServiceL( EBTSendingService, parameterList )); + if(error) + return error; + return error; + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/src/btsssendlisthandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/src/btsssendlisthandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* 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: Converter class implementation for converting AIW paramerer +* list to bt send parameter list +* +*/ + + + +#include "btsssendlisthandler.h" +#include "BTServiceParameterList.h" + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBTSSSendListHandler() +// --------------------------------------------------------------------------- +// +CBTSSSendListHandler::CBTSSSendListHandler(): CActive( EPriorityNormal ) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CBTSSSendListHandler::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CBTSSSendListHandler* CBTSSSendListHandler::NewL() + { + CBTSSSendListHandler* self = CBTSSSendListHandler::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CBTSSSendListHandler* CBTSSSendListHandler::NewLC() + { + CBTSSSendListHandler* self = new( ELeave ) CBTSSSendListHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CBTSSSendListHandler +// --------------------------------------------------------------------------- +// +CBTSSSendListHandler::~CBTSSSendListHandler() + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::Destructor")); + Cancel(); + } + +// --------------------------------------------------------------------------- +// ConvertList() +// --------------------------------------------------------------------------- +// +TInt CBTSSSendListHandler::ConvertList( const QList *arguments, + CBTServiceParameterList* aList) + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::ConvertList")); + iListIndex = 0; + mArguments = arguments; + iList = aList; + iStatus = KRequestPending; + AddObject(); + SetActive(); + + iSyncWaiter.Start(); + FLOG(_L("[BTSS]\t CBTSSSendListHandler::ConvertList done")); + return iStatus.Int(); + } + +// --------------------------------------------------------------------------- +// AddObject() +// --------------------------------------------------------------------------- +// +void CBTSSSendListHandler::AddObject() + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::AddObjectL()")); + TRAPD(error, DoAddObjectL()); + if (error != KErrNone ) + { + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, error); + } + FLOG(_L("[BTSS]\t CBTSSSendListHandler::AddObjectL() Done")); + } + +// --------------------------------------------------------------------------- +// From class CActive. +// RunL() +// --------------------------------------------------------------------------- +// +void CBTSSSendListHandler::DoAddObjectL() + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL()")); + + // const TAiwGenericParam* param=&(*iOutParamList)[iListIndex]; + + QString string = mArguments->at(iListIndex).toString(); + + /* if ( param->SemanticId() != EGenericParamFile ) + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL() wrong semantic Id: Leave")); + } + // Try to add file as an image + // + if( param->Value().TypeId()== EVariantTypeFileHandle) + { + TRAPD( retVal, iList->AddImageL( param->Value().AsFileHandle() )); + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL AddImage")); + if( retVal != KErrNone ) + { + // File was not an image. We can not use BIP + // so add rest of the files as objects + // + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL AddImage filed try object")); + iList->AddObjectL( param->Value().AsFileHandle() ); + } + } + else */ + // { + // TRAPD( retVal, iList->AddImageL( param->Value().AsDes() ) ); + HBufC* path = XQConversions::qStringToS60Desc(string); + TRAPD( retVal, iList->AddImageL(*path)); + if( retVal != KErrNone ) + { + // File was not an image. We can not use BIP + // so add rest of the files as objects + // + iList->AddObjectL( *path ); + } + // } + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL() completed")); + } +// --------------------------------------------------------------------------- +// From class CActive. +// RunL() +// --------------------------------------------------------------------------- +// +void CBTSSSendListHandler::RunL() + { + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL()")); + iListIndex++; + if ( mArguments->count() > iListIndex && iStatus.Int() == KErrNone ) + { + iStatus = KRequestPending; + AddObject(); + SetActive(); + } + else + { + if ( iSyncWaiter.IsStarted() ) + { + iSyncWaiter.AsyncStop(); + } + } + FLOG(_L("[BTSS]\t CBTSSSendListHandler::DoAddObjectL() Done")); + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/src/main.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,28 @@ +/* +* 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: ?Description +* +*/ + + +#include +#include "btsendserviceinterface.h" + +int main(int argc, char **argv) + { + QCoreApplication app(argc, argv); + BTSendServiceInterface btSendSI; + return app.exec(); + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexhighway/xml/obexhighway_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexhighway/xml/obexhighway_conf.xml Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,14 @@ + + + obexhighway + No path + BT Send Service + + com.nokia.symbian.IFileShare + 1.0 + Send interface + Via Bluetooth + bluetooth + txt_send_via_bluetooth + + \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/bmarm/BTSERVICEUTILSU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/bmarm/BTSERVICEUTILSU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,10 @@ +EXPORTS + StartSynchronousServiceL__13CBTServiceAPI14TBTServiceTypeP23CBTServiceParameterList @ 1 NONAME R3UNUSED ; CBTServiceAPI::StartSynchronousServiceL(TBTServiceType, CBTServiceParameterList *) + AddObjectL__23CBTServiceParameterListRC7TDesC16 @ 2 NONAME R3UNUSED ; CBTServiceParameterList::AddObjectL(TDesC16 const &) + AddXhtmlL__23CBTServiceParameterListRC7TDesC16 @ 3 NONAME R3UNUSED ; CBTServiceParameterList::AddXhtmlL(TDesC16 const &) + NewLC__23CBTServiceParameterList @ 4 NONAME R3UNUSED ; CBTServiceParameterList::NewLC(void) + NewL__13CBTServiceAPI @ 5 NONAME R3UNUSED ; CBTServiceAPI::NewL(void) + NewL__23CBTServiceParameterList @ 6 NONAME R3UNUSED ; CBTServiceParameterList::NewL(void) + StartServiceL__13CBTServiceAPI14TBTServiceTypeP23CBTServiceParameterList @ 7 NONAME R3UNUSED ; CBTServiceAPI::StartServiceL(TBTServiceType, CBTServiceParameterList *) + AddImageL__23CBTServiceParameterListRC7TDesC16 @ 8 NONAME R3UNUSED ; CBTServiceParameterList::AddImageL(TDesC16 const &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/bwins/BTSERVICEUTILSU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/bwins/BTSERVICEUTILSU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,12 @@ +EXPORTS + ?AddImageL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 1 NONAME ; void CBTServiceParameterList::AddImageL(class TDesC16 const &) + ?AddImageL@CBTServiceParameterList@@QAEXVRFile@@@Z @ 2 NONAME ; void CBTServiceParameterList::AddImageL(class RFile) + ?AddObjectL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 3 NONAME ; void CBTServiceParameterList::AddObjectL(class TDesC16 const &) + ?AddObjectL@CBTServiceParameterList@@QAEXVRFile@@@Z @ 4 NONAME ; void CBTServiceParameterList::AddObjectL(class RFile) + ?AddXhtmlL@CBTServiceParameterList@@QAEXABVTDesC16@@@Z @ 5 NONAME ; void CBTServiceParameterList::AddXhtmlL(class TDesC16 const &) + ?NewL@CBTServiceAPI@@SAPAV1@XZ @ 6 NONAME ; class CBTServiceAPI * CBTServiceAPI::NewL(void) + ?NewL@CBTServiceParameterList@@SAPAV1@XZ @ 7 NONAME ; class CBTServiceParameterList * CBTServiceParameterList::NewL(void) + ?NewLC@CBTServiceParameterList@@SAPAV1@XZ @ 8 NONAME ; class CBTServiceParameterList * CBTServiceParameterList::NewLC(void) + ?StartServiceL@CBTServiceAPI@@QAEXW4TBTServiceType@@PAVCBTServiceParameterList@@@Z @ 9 NONAME ; void CBTServiceAPI::StartServiceL(enum TBTServiceType, class CBTServiceParameterList *) + ?StartSynchronousServiceL@CBTServiceAPI@@QAEXW4TBTServiceType@@PAVCBTServiceParameterList@@@Z @ 10 NONAME ; void CBTServiceAPI::StartSynchronousServiceL(enum TBTServiceType, class CBTServiceParameterList *) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/eabi/BtServiceUtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/eabi/BtServiceUtilsU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + _ZN13CBTServiceAPI13StartServiceLE14TBTServiceTypeP23CBTServiceParameterList @ 1 NONAME + _ZN13CBTServiceAPI24StartSynchronousServiceLE14TBTServiceTypeP23CBTServiceParameterList @ 2 NONAME + _ZN13CBTServiceAPI4NewLEv @ 3 NONAME + _ZN23CBTServiceParameterList10AddObjectLE5RFile @ 4 NONAME + _ZN23CBTServiceParameterList10AddObjectLERK7TDesC16 @ 5 NONAME + _ZN23CBTServiceParameterList4NewLEv @ 6 NONAME + _ZN23CBTServiceParameterList5NewLCEv @ 7 NONAME + _ZN23CBTServiceParameterList9AddImageLE5RFile @ 8 NONAME + _ZN23CBTServiceParameterList9AddImageLERK7TDesC16 @ 9 NONAME + _ZN23CBTServiceParameterList9AddXhtmlLERK7TDesC16 @ 10 NONAME + _ZTI13CBTServiceAPI @ 11 NONAME ; ## + _ZTI23CBTServiceParameterList @ 12 NONAME ; ## + _ZTV13CBTServiceAPI @ 13 NONAME ; ## + _ZTV23CBTServiceParameterList @ 14 NONAME ; ## + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTConnectionTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTConnectionTimer.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Waiter class +* +*/ + + + +#ifndef BTCONNECTION_TIMER_H +#define BTCONNECTION_TIMER_H + +// INCLUDES +#include // CTimer +#include "BTServiceClient.h" + +// CLASS DECLARATION + + + +// CLASS DECLARATION + +/** +* A timer object for waiting server connections. +*/ +NONSHARABLE_CLASS (CBTConnectionTimer) : public CTimer + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTConnectionTimer* NewL( MBTConTimeObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CBTConnectionTimer(); + + private: // Functions from base classes + + /** + * From CActive Get's called when the timer expires. + * @param None. + * @return None. + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CBTConnectionTimer( MBTConTimeObserver* aObserver ); + + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + public: + /** + * Set timeout value + * @aTimeOutValue timeout value + * @return None. + */ + void SetTimeOut(TTimeIntervalMicroSeconds32 aTimeOutValue); + + /** + * Start + * @aTimeOutValue timeout value + * @return None. + */ + void Start(); + + private: // Data + + // Not owned + // + MBTConTimeObserver* iObserver; + TTimeIntervalMicroSeconds32 iTimeOutValue; + }; + +#endif // BTCONNECTION_TIMER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2002 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 push controller +* +*/ + + + +#ifndef BT_BIP_CONTROLLER_H +#define BT_BIP_CONTROLLER_H + +// INCLUDES +#include "BTServiceClient.h" +#include "BTServiceStarter.h" +#include "BTSController.h" + +// CLASS DECLARATION + +/** +* Control class for the Image sending +*/ +NONSHARABLE_CLASS (CBTSBIPController) : public CBTSController, + public MBTServiceClientObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSBIPController* NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDevice, + CBTServiceParameterList* aList ); + + /** + * Destructor. + */ + virtual ~CBTSBIPController(); + + private: // Functions from base classes + + /** + * From MBTServiceClientObserver A Connect operation has been completed. + * @param aStatus The status of the operation. + * @return None. + */ + void ConnectCompleted( TInt aStatus ); + + /** + * From MBTServiceClientObserver The client connection has been closed. + * @param None. + * @return None. + */ + void ClientConnectionClosed(); + + /** + * From MBTServiceClientObserver A Put operation has been completed. + * @param aStatus The status of the operation. + * @param aPutResponse Response packet from remote device. + * @return None. + */ + void PutCompleted( TInt aStatus, const CObexHeaderSet* aPutResponse ); + + /** + * From MBTServiceClientObserver A Get operation has been completed. + * @param aStatus The status of the operation. + * @param aGetResponse Response packet from remote device. + * @return None. + */ + void GetCompleted( TInt aStatus, CObexBufObject* aGetResponse ); + + /** + * From MBTServiceClientObserver A Connect operation is timed out. + * @return None. + */ + void ConnectTimedOut(); + + + private: + + /** + * C++ default constructor. + */ + CBTSBIPController( MBTServiceObserver* aObserver, + CBTServiceParameterList* aList ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( const TUint aRemotePort, + const TBTDevAddr& aRemoteDeviceAddr ); + + private: + + /** + * Send image + * @param None. + * @return None. + */ + void SendL(); + + /** + * Send thumbnail image + * @param aPutResponse Response packet containing the image handle + * @return None. + */ + void SendThumbnailL( const CObexHeaderSet* aPutResponse ); + + /** + * Get capabilities object from remote device + * @param None. + * @return None. + */ + void GetL(); + + /** + * Create temp file + * @param aFileName Name of the file that was created + * @return None. + */ + void CreateTempFileL( TFileName& aFileName ); + + /** + * Generate a temp file name + * @param aFileName File name that was created. + * @return None. + */ + void GenerateTempFileNameL( TFileName& aFileName ); + + /** + * Delete a temp file + * @param aFileName Name of the file. + * @return None. + */ + void DeleteTempFile( TFileName& aFileName ); + + /** + * Create image descriptor + * @param None. + * @return HBufC8*. + */ + HBufC8* CreateImageDescriptorL(); + + /** + * Handle GetCompleteIndication + * @param aGetResponse Get response packet from remote device + * @return None. + */ + void HandleGetCompleteIndicationL( CObexBufObject* aGetResponse ); + + private: // Data + + TInt iFileIndex; + TFileName iThumbnailFileName; + TFileName iTempFileName; + + + // Not owned + // + CBTServiceParameterList* iListPtr; + MBTServiceObserver* iObserverPtr; + + }; + +#endif // BT_BIP_CONTROLLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2002 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: Basic printing controller +* +*/ + + + +#ifndef BT_SERVICE_BPP_CONTROLLER_H +#define BT_SERVICE_BPP_CONTROLLER_H + +// INCLUDES +#include +#include "BTServiceStarter.h" +#include "BTServiceParameterList.h" +#include "BTServiceClient.h" +#include "BTSBPPObjectServer.h" +#include "BTSBPPServerWait.h" +#include "BTSController.h" + + + + +// CLASS DECLARATION + +/** +* A class controlling printing service using Basic Printing Profile. +*/ +NONSHARABLE_CLASS (CBTSBPPController) : public CBTSController, + public MBTServiceClientObserver, + public MBTSBPPObjectServerObserver, + public MBTSBPPServerWaitObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSBPPController* NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDevice, + const CBTServiceParameterList* aList, + CBTEngDiscovery* aBTEngDiscoveryPtr ); + + /** + * Destructor. + */ + virtual ~CBTSBPPController(); + + + private: // Functions from base classes + + /** + * From MBTServiceClientObserver A Connect operation has been completed. + * @param aStatus The status of the operation. + * @return None. + */ + void ConnectCompleted( TInt aStatus ); + + /** + * From MBTServiceClientObserver A Put operation has been completed. + * @param aStatus The status of the operation. + * @param aPutResponse The response object. + * @return None. + */ + void PutCompleted( TInt aStatus,const CObexHeaderSet* aPutResponse ); + + /** + * From MBTServiceClientObserver A Get operation has been completed. + * @param aStatus The status of the operation. + * @param aGetResponse The response object. + * @return None. + */ + void GetCompleted( TInt aStatus, CObexBufObject* aGetResponse ); + + /** + * From MBTServiceClientObserver The client connection has been closed. + * @return None. + */ + void ClientConnectionClosed(); + + /** + * From MBTServiceClientObserver A filehandle can be reseted. + * @return None. + */ + void ResetFileHandleL(); + /** + * From MBTPSServerObserver An error in server has occurred. + * @param aError The error. + * @return None. + */ + void ServerError( TInt aError ); + + /** + * From MBTPSServerObserver The server connection has been established. + * @param None. + * @return None. + */ + void ServerConnectionEstablished(); + + /** + * From MBTPSServerObserver The server connection has been closed. + * @param None. + * @return None. + */ + void ServerConnectionClosed(); + + /** + * From MBTPSServerWaitObserver The server wait has completed. + * @param None. + * @return None. + */ + void WaitComplete(); + + /** + * From MBTServiceClientObserver A Connect operation is timed out. + * @return None. + */ + void ConnectTimedOut(); + + private: + + /** + * C++ default constructor. + */ + CBTSBPPController( MBTServiceObserver* aObserver, + const CBTServiceParameterList* aList ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + CBTEngDiscovery* aBTEngDiscoveryPtr ); + + /** + * Selects the next document to send and issues a send request + * to Obex client. + * @return None. + */ + void SelectAndSendL(); + + private: // Data definitions + + enum TBTSBPPObjectServerState + { + EBTSBPPSrvIdle, + EBTSBPPSrvServing, + EBTSBPPSrvDone + }; + + private: // Data + + // Owned + // + CBTSBPPObjectServer* iServer; + CBTSBPPServerWait* iServerWait; + + TInt iSendIndex; + TUint iClientChannel; + TBTSBPPObjectServerState iServerState; + TBool iClientDone; + + // Not owned + // + MBTServiceObserver* iObserverPtr; + const CBTServiceParameterList* iListPtr; + + }; + +#endif // BT_SERVICE_BPP_CONTROLLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectRequest.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2002 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: GetReferencedObjects -operation controller +* +*/ + + + +#ifndef BTSBPP_OBJECT_REQUEST_H +#define BTSBPP_OBJECT_REQUEST_H + +// INCLUDES +#include // Obex +#include // CDesCArray + +// CLASS DECLARATION +/** +* A class handling GetReferencedObjects -operation. +*/ +NONSHARABLE_CLASS (CBTSBPPObjectRequest) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSBPPObjectRequest* NewL( CObexBaseObject* aGetOperation, + const CDesCArray* aRefObjectList ); + + /** + * Destructor. + */ + virtual ~CBTSBPPObjectRequest(); + + public: // Functions from base classes + + /** + * Returns the requested Object. + * @param None. + * @return A pointer to the requested object. NULL if the request + * cannot be fullfilled. + */ + CObexBufObject* GetResponse(); + + private: + + /** + * C++ default constructor. + */ + CBTSBPPObjectRequest( CObexBaseObject* aGetOperation, + const CDesCArray* aRefObjectList ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // CHECK REQUEST ------------------------------------------------------ + + /** + * Checks the validity of the Get-operation and it's parameters. + * @return None. + */ + void CheckGetRequestL(); + + /** + * Checks the existence, validity and contents of Type header. + * @return None. + */ + void CheckTypeHeaderL(); + + /** + * Checks the existence, validity and contents of Name header. + * @return None. + */ + void CheckNameHeaderL(); + + /** + * Checks the existence, validity and contents of + * Application Parameters header. + * @return None. + */ + void CheckAppParamsHeaderL(); + + + // EXECUTE REQUEST ---------------------------------------------------- + + /** + * Executes any tasks needed and creates the requested object. + * @return None. + */ + void ExecuteGetRequestL(); + + /** + * Resolves the actual part of data that is requested. + * @return None. + */ + void ResolveGetRequestL(); + + /** + * Reads the requested part of a file into a buffer. + * @return None. + */ + void ReadFileToBufferL(); + + /** + * Creates the response object with correct data and headers. + * @return None. + */ + void CreateResponseObjectL(); + + private: // Data definitions + + struct TBTSBPPObjectParams + { + const TDesC* iName; // The name of the object. + TInt iFileSize; // The total size of the object. + TInt iOffset; // The offset to the the object (starting point). + TInt iCount; // The number of bytes to be sent. + }; + + private: // Data + + RFs iFileSession; + TBTSBPPObjectParams iRequestParams; + CObexBufObject* iResponse; + CBufFlat* iResponseBuffer; + + // Not owned + // + CObexBaseObject* iRequest; + const CDesCArray* iObjectList; + }; + +#endif // BTSBPP_OBJECT_REQUEST_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectServer.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2002 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: Server part of basic printing profile +* +*/ + + + +#ifndef BTSBPP_OBJECT_SERVER_H +#define BTSBPP_OBJECT_SERVER_H + +// INCLUDES +//#include "BTSBPPPasskeyRequest.h" + +#include // Obex +#include // CDesCArray +#include +#include "BTServiceStarter.h" + +// FORWARD DECLARATIONS +class CBTSBPPObjectRequest; + +// CLASS DECLARATION + +/** +* An interface used to inform about CBTSBPPObjectServer events. +*/ +class MBTSBPPObjectServerObserver + { + public: + + /** + * Informs the observer that an error has been occurred. + * @param aError The error. + * @return None. + */ + virtual void ServerError( TInt aError ) = 0; + + /** + * Informs the observer that the server connection has been established. + * @param None. + * @return None. + */ + virtual void ServerConnectionEstablished() = 0; + + /** + * Informs the observer that the server connection has been closed. + * @param None. + * @return None. + */ + virtual void ServerConnectionClosed() = 0; + }; + +// CLASS DECLARATION + +/** +* A class managing the Obex Server. +*/ +NONSHARABLE_CLASS (CBTSBPPObjectServer) : public CBase, + public MObexServerNotify, + public MObexAuthChallengeHandler + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSBPPObjectServer* NewL( MBTSBPPObjectServerObserver* aObserver, + CBTEngDiscovery* aBTEngDiscoveryPtr, + const TBTDevAddr& aExpectedClient ); + + /** + * Destructor. + */ + virtual ~CBTSBPPObjectServer(); + + public: // New functions + + /** + * Gives the server a list of referenced objects that can be requested. + * by the printer. This method should be called always before sending + * any documents. + * @param aRefObjectList A pointer to the list. + * @return None. + */ + void SetReferencedObjectList( const CDesCArray* aRefObjectList ); + + /** + * Tells whether the current referenced object list has any items. + * @param aRefObjectList A pointer to the list. + * @return None. + */ + TBool HasReferencedObjects(); + + private: // Functions from base classes + + /** + * From MObexAuthChallengeHandler Get's called when Obex Password is + * requested. + * @param aRealm The realm/challenge specified by the unit forcing + * the authentication. + * @return None. + */ + void GetUserPasswordL( const TDesC& aRealm ); + + private: // Functions from MObexServerNotify + + /** + * Informs about an error in Obex connection. + * @param aError The occurred error. + * @return None. + */ + void ErrorIndication( TInt aError ); + + /** + * Informs that Obex transport layer is up. + * @return None. + */ + void TransportUpIndication(); + + /** + * Informs that Obex transport layer is down. + * @return None. + */ + void TransportDownIndication(); + + /** + * Informs about Obex connect request. + * @param aRemoteInfo Information about the remote party. + * @param aInfo Information about the connection request. + * @return Symbian OS error code. + */ + TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo, + const TDesC8& aInfo ); + + /** + * Informs about Obex disconnect request. + * @param aInfo Information about the disconnect request. + * @return None. + */ + void ObexDisconnectIndication( const TDesC8& aInfo ); + + /** + * Informs about Obex put request. + * @return The requested object or NULL; + */ + CObexBufObject* PutRequestIndication(); + + /** + * Informs that part of the put object is sent. + * @return Symbian OS error code. + */ + TInt PutPacketIndication(); + + /** + * Informs that the put request is completed. + * @return Symbian OS error code. + */ + TInt PutCompleteIndication(); + + /** + * Informs about Obex put request. + * @param aRequiredObject The Get request object. + * @return The response object or NULL; + */ + CObexBufObject* GetRequestIndication( + CObexBaseObject* aRequiredObject ); + + /** + * Informs that part of the get response object is sent. + * @return Symbian OS error code. + */ + TInt GetPacketIndication(); + + /** + * Informs that the get request is completed. + * @return Symbian OS error code. + */ + TInt GetCompleteIndication(); + + /** + * Informs about Obex Set Path request. + * @param aPathInfo Information about the path. + * @param aInfo Information about the Set Path request. + * @return Symbian OS error code. + */ + TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo, + const TDesC8& aInfo ); + + /** + * Informs about Obex Abort operation. + * @return None. + */ + void AbortIndication(); + + private: + + /** + * C++ default constructor. + */ + CBTSBPPObjectServer( MBTSBPPObjectServerObserver* aObserver, + CBTEngDiscovery* aBTEngDiscoveryPtr, + const TBTDevAddr& aExpectedClient ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + TInt iObjectChannel; + TSdpServRecordHandle iSDPHandle; + + CObexServer* iServer; + CBTSBPPObjectRequest* iObjectRequest; + //CBTSBPPPasskeyRequest* iPasskeyRequest; + + // Not owned + // + const CDesCArray* iObjectListPtr; + const TBTDevAddr* iExpectedClientPtr; + CBTEngDiscovery* iBTEngDiscoveryPtr; + MBTSBPPObjectServerObserver* iObserverPtr; + }; + +#endif // BTSBPP_OBJECT_SERVER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPServerWait.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPServerWait.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002 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: Waiter class +* +*/ + + + +#ifndef BTSBPP_SERVER_WAIT_H +#define BTSBPP_SERVER_WAIT_H + +// INCLUDES +#include // CTimer + +// CLASS DECLARATION + +/** +* An interface used to inform about CBTSBPPServerWait completion. +*/ +class MBTSBPPServerWaitObserver + { + public: + + /** + * Informs the observer that the waiting has been completed. + * @param None. + * @return None. + */ + virtual void WaitComplete() = 0; + }; + +// CLASS DECLARATION + +/** +* A timer object for waiting server connections. +*/ +NONSHARABLE_CLASS (CBTSBPPServerWait) : public CTimer + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSBPPServerWait* NewL( MBTSBPPServerWaitObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CBTSBPPServerWait(); + + private: // Functions from base classes + + /** + * From CActive Get's called when the timer expires. + * @param None. + * @return None. + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CBTSBPPServerWait( MBTSBPPServerWaitObserver* aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + // Not owned + // + MBTSBPPServerWaitObserver* iObserver; + }; + +#endif // BTSBPP_SERVER_WAIT_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,83 @@ +/* +* 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: Profile controller interface +* +*/ + + + +#ifndef C_BTPROFILECONTROLLER_H +#define C_BTPROFILECONTROLLER_H + + +#include + +#include "BTServiceClient.h" + + +class CBTServiceClient; + +/** + * ProfileControllerIntreface definition + * + * @endcode + * + * @lib ?library + * @since S60 v.3.2 + */ +NONSHARABLE_CLASS (CBTSController) : public CBase + { + +public: + + CBTSController(); + /** + * Destructor. + */ + virtual ~CBTSController(); + + /** + * Abort command to client + * + * @since S60 v.3.2 + * @return None + */ + void Abort( ); + +protected: + + /** + * Create client + * + * @since S60 v.3.2 + * @return None + */ + void CreateClientL(MBTServiceClientObserver* aObserver, + const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ); + + +protected: // data + + /** + * Service client + * Not own. + */ + CBTServiceClient* iClient; + + }; + + +#endif // C_BTPROFILECONTROLLER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSOPPController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSOPPController.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2002 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: Object push controller +* +*/ + + + +#ifndef BT_OPP_CONTROLLER_H +#define BT_OPP_CONTROLLER_H + +// INCLUDES +#include "BTServiceClient.h" +#include "BTServiceStarter.h" +#include "BTSController.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Control class for the Object sending +*/ +NONSHARABLE_CLASS (CBTSOPPController) : public CBTSController, + public MBTServiceClientObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSOPPController* NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDevice, + CBTServiceParameterList* aList ); + + /** + * Destructor. + */ + virtual ~CBTSOPPController(); + + private: // Functions from base classes + + /** + * From MBTServiceClientObserver A Connect operation has been completed. + * @param aStatus The status of the operation. + * @return None. + */ + void ConnectCompleted( TInt aStatus ); + + /** + * From MBTServiceClientObserver The client connection has been closed. + * @param None. + * @return None. + */ + void ClientConnectionClosed(); + + /** + * From MBTServiceClientObserver A Put operation has been completed. + * @param aStatus The status of the operation. + * @param aPutResponse Response packet from remote device. + * @return None. + */ + void PutCompleted( TInt aStatus, const CObexHeaderSet* aPutResponse ); + + /** + * From MBTServiceClientObserver A Get operation has been completed. + * @param aStatus The status of the operation. + * @param aGetResponse Response packet from remote device. + * @return None. + */ + void GetCompleted( TInt aStatus, CObexBufObject* aGetResponse ); + + /** + * From MBTServiceClientObserver A Connect operation is timed out. + * @return None. + */ + void ConnectTimedOut(); + + + private: + + /** + * C++ default constructor. + */ + CBTSOPPController( MBTServiceObserver* aObserver, + CBTServiceParameterList* aList ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( const TUint aRemotePort, + const TBTDevAddr& aRemoteDeviceAddr ); + + private: + + /** + * Send file + * @param None. + * @return None. + */ + void Send(); + + /** + * Handle Connection indication + * @param None. + * @return None. + */ + void HandleConnectCompleteIndicationL(); + + void UpdateProgressNoteL(); + + private: // Data + + TInt iFileIndex; + // Not owned + // + CBTServiceParameterList* iListPtr; + MBTServiceObserver* iObserverPtr; + }; + +#endif // BT_OPP_CONTROLLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSProgresstimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSProgresstimer.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2002 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 BTSPROGRESSTIMER_H +#define BTSPROGRESSTIMER_H + + +#include + +class MBTServiceObserver; + +// CLASS DECLARATION +/** +* A timer class for updating progress dialog. +*/ +NONSHARABLE_CLASS( CBTSProgressTimer ) : public CTimer + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSProgressTimer* NewL( MBTServiceObserver* aProgressObserverPtr ); + + /** + * Destructor. + */ + virtual ~CBTSProgressTimer(); + + public: // New functions + + /** + * Sets the timeout of the timer. + * @param aTimeout The timeout in microseconds. + * @return None. + */ + void SetTimeout( TTimeIntervalMicroSeconds32 aTimeout ); + + /** + * Restarts the timer. + * @return None. + */ + void Tickle(); + + private: // Functions from base classes + + /** + * From CTimer Get's called when the timer expires. + * @return None. + */ + void RunL(); + + TInt RunError( TInt aError ); + + private: + + /** + * C++ default constructor. + */ + CBTSProgressTimer( MBTServiceObserver* aProgressObserverPtr ); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + private: // Data + TTimeIntervalMicroSeconds32 iTimeout; + MBTServiceObserver* iProgressObserverPtr; + }; + +#endif // BTSPROGRESSTIMER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUCapabilityResolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUCapabilityResolver.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2002 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: Capability resolver +* +*/ + + +#ifndef BTSU_CAPABILITY_RESOLVER_H +#define BTSU_CAPABILITY_RESOLVER_H + +// INCLUDES +//#include +// new headers +#include +#include + + +#include + +// CLASS DECLARATION + +/** +* A content handler class implementing MXMLContentHandler interface. +* Listens notifications and appends found capabilities to a given list. +*/ +NONSHARABLE_CLASS (CBTSUCapabilityResolver) :public CBase, + public Xml::MContentHandler + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSUCapabilityResolver* NewL( CDesCArrayFlat* aCapabilityList ); + + + static CBTSUCapabilityResolver* NewL( RArray* aCapabilityList ); + + /** + * Destructor. + */ + virtual ~CBTSUCapabilityResolver(); + + /** + * Return capability object resolving status + * @return A boolean according to status. + */ + TBool IsCompleted(); + + private: + + /** + * From MContentHandler A notification telling about the beginning + * of a document. + * @param aDocParam Specifies the various parameters of the document. + * @param aErrorCode is the error code. + */ + void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); + + /** + * From MContentHandler A notification telling about the end + * of a document. + * @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndDocumentL(TInt aErrorCode); + + /** + * From MContentHandler A notification telling about the beginning + * of an element. + * @param aElement is a handle to the element's details. + * @param aAttributes contains the attributes for the element. + * @param aErrorCode is the error code. + * @return A boolean according to success. + */ + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, + TInt aErrorCode); + + /** + This method is a callback to indicate the end of the element has been reached. + @param aElement is a handle to the element's details. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + + /** + This method is a callback that sends the content of the element. + Not all the content may be returned in one go. The data may be sent in chunks. + When an OnEndElementL is received this means there is no more content to be sent. + @param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + /** + This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. + This method is always called before the corresponding OnStartElementL method. + @param aPrefix is the Namespace prefix being declared. + @param aUri is the Namespace URI the prefix is mapped to. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode); + + /** + This method is a notification of the end of the scope of a prefix-URI mapping. + This method is called after the corresponding DoEndElementL method. + @param aPrefix is the Namespace prefix that was mapped. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + + + /** + This method is a notification of ignorable whitespace in element content. + @param aBytes are the ignored bytes from the document being parsed. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + + + /** + This method is a notification of a skipped entity. If the parser encounters an + external entity it does not need to expand it - it can return the entity as aName + for the client to deal with. + @param aName is the name of the skipped entity. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + + + /** + This method is a receive notification of a processing instruction. + @param aTarget is the processing instruction target. + @param aData is the processing instruction data. If empty none was supplied. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, + TInt aErrorCode); + + + /** + This method indicates an error has occurred. + @param aError is the error code + */ + void OnError(TInt aErrorCode); + + + /** + This method obtains the interface matching the specified uid. + @return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. + @param aUid the uid identifying the required interface. + */ + TAny* GetExtendedInterface(const TInt32 aUid); + + /** + * C++ default constructor. + */ + CBTSUCapabilityResolver( CDesCArrayFlat* aCapabilityList ); + + /** + * C++ default constructor. + */ + CBTSUCapabilityResolver( RArray* aCapabilityList ); + + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + private: // Data + + // Not owned. + // + RArray* iCapabilityList; + TBool iCompleted; + }; + +#endif // BTSU_CAPABILITY_RESOLVER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDataConverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDataConverter.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002 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: A data conversion class. +* +*/ + + +#ifndef BTSU_DATA_CONVERTER_H +#define BTSU_DATA_CONVERTER_H + +// INCLUDES +#include + +// CONSTANTS + +// DATA TYPES + +// CLASS DECLARATION + +/** +* A class for executing data conversion +*/ +class TBTSUDataConverter + { + public: + + /** + * Converts the given data as integer. + * @param aData The data to be converted. + * @return The data converted as TUint8 + */ + static TUint8 ConvertByteL( const TPtrC8& aData ); + + /** + * Converts the given data as signed integer. + * @param aData The data to be converted. + * @return The data converted as TInt32. + */ + static TInt32 ConvertDataSignedL( const TPtrC8& aData ); + + /** + * Converts the given data as unsigned integer. + * @param aData The data to be converted. + * @return The data converted as TUint32. + */ + static TUint32 ConvertDataUnsignedL( const TPtrC8& aData ); + }; + +#endif // BTSU_DATA_CONVERTER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDebug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 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 defines logging macros for BTSU. +* +*/ + + +#ifndef BT_SERVICE_UTILS_DEBUG_H +#define BT_SERVICE_UTILS_DEBUG_H + + +#ifdef _DEBUG +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#include +#include +#include + +_LIT(KLogFile,"btsuLog.txt"); +_LIT(KLogDirFullName,"c:\\logs\\btsu\\"); +_LIT(KLogDir,"btsu"); + +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } + +// Declare the FPrint function +// +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + } + +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#include + +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } + +// Declare the FPrint function +// +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); + } + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // BT_SERVICE_UTILS_DEBUG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUImageConverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUImageConverter.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2002 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 conversion class +* +*/ + + +#ifndef BTSU_IMAGE_CONVERTER_H +#define BTSU_IMAGE_CONVERTER_H + +// INCLUDES +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CImageDecoder; +class CImageEncoder; +class CFrameImageData; +class CBitmapScaler; +class CFbsBitmap; + +// CLASS DECLARATION + +/** +* A class for executing simple image conversion tasks. +*/ +NONSHARABLE_CLASS (CBTSUImageConverter) : public CActive + { + + public: // Constructor and destructor + + /** + * Two-phased constructor. + * @param None. + */ + static CBTSUImageConverter* NewL(); + + /** + * Destructor. + */ + ~CBTSUImageConverter(); + + public: // New functions + + /** + * Returns the pixel size of the given image. + * @param aImageFile A file handle of image file. + * @return The pixel size. + */ + TSize GetImageSizeL( RFile& aImageFile ); + + /** + * Create a thumbnail version of the source image. + * @param aSourceFile A filehandle of sourcefile. + * @param aDestFile Full path for the destination file. + * @return None. + */ + void CreateThumbnailL( RFile& aSourceFile, + const TDesC& aDestFile ); + + /** + * Finds a display name for the given mime type. + * @param aMimeType Mime type + * @return A pointer to the name. + */ + static HBufC* GetDisplayNameL( const TDesC8& aMimeType ); + + private: // Functions from base classes + + /** + * From CActive Get's called when a request is cancelled. + * @return None. + */ + void DoCancel(); + + /** + * From CActive Get's called when a request is completed. + * @return None. + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CBTSUImageConverter(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Decode image. + * @param aSourceFile A filehandle of source file. + * @return None + */ + void DecodeImageL( RFile& aSourceFile ); + + /** + * Encode image. + * @param aDestFile Full path for the destination file. + * @param aThumbnail ETrue enables thumbnail creation + * @return None + */ + void EncodeImageL( const TDesC& aDestFile, + const TBool& aThumbnail = EFalse ); + + /** + * Scale image. + * @return None + */ + void ScaleImageL(); + + /** + * Reset internal state. + * @return None. + */ + void Reset(); + + private: // Data + + CImageDecoder* iDecoder; + CImageEncoder* iEncoder; + CBitmapScaler* iScaler; + + CFrameImageData* iFrameImageData; + CFbsBitmap* iFrameBitmap; + CFbsBitmap* iScaledBitmap; + RFs iFileSession; + + CActiveSchedulerWait iWait; + }; + + +#endif // BTSU_IMAGE_CONVERTER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUPassKeyRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUPassKeyRequest.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002 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: CBTSUPasskeyRequest Header definitions +* +*/ + + +#ifndef BTSU_PASSKEY_REQUEST_H +#define BTSU_PASSKEY_REQUEST_H + +// INCLUDES +#include +#include +#include + +// CLASS DECLARATION + +/** +* Class to handle BT Obex Passkey events +*/ +NONSHARABLE_CLASS (CBTSUPasskeyRequest) : public CActive + { + + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBTSUPasskeyRequest(); + + /** + * Destructor. + * Closes RNotifier + */ + ~CBTSUPasskeyRequest(); + + public: // New functions + /** + * Starts BT ObexPasskey notifier + * @param aObexServer OBEX server + */ + void StartPassKeyRequestL( CObexClient* aObexclient ); + + private: // Functions from base classes + /** + * From CActive Get's called when a request is cancelled. + * @param None. + * @return None. + */ + void DoCancel(); + + /** + * From CActive Get's called when a request is completed. + * @param None. + * @return None. + */ + void RunL(); + + /** + * From CActive A leave occurred in RunL. + * @param aError The leave error. + * @return Symbian OS error code. + */ + TInt RunError(); + + private: // Data + + RNotifier iNotif; // For Obex passkey notifier + TObexPasskeyBuf iObexPasskey; // Obex passkey + CObexClient* iObexClient; // Obex client + }; + +#endif + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSURefObjectResolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSURefObjectResolver.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2002 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: Reference object resolver +* +*/ + + +#ifndef BTSU_REF_OBJECT_RESOLVER_H +#define BTSU_REF_OBJECT_RESOLVER_H + +// INCLUDES +// new headers +#include +#include + + +#include + +// CLASS DECLARATION + +class Xml::RTagInfo; +/** +* A content handler class implementing MContentHandler interface. +* Listens notifications and appends found objects to a given list. +*/ +NONSHARABLE_CLASS (CBTSURefObjectResolver) : public Xml::MContentHandler + { + public: // Constructors and destructor + + + /** + * Two-phased constructor. + */ + static CBTSURefObjectResolver* NewL( CDesCArrayFlat* aCapabilityList ); + + /** + * Destructor. + */ + virtual ~CBTSURefObjectResolver(); + + private: + + /** + * From MContentHandler A notification telling about the beginning + * of a document. + * @param aDocParam Specifies the various parameters of the document. + * @param aErrorCode is the error code. + */ + void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); + + /** + * From MContentHandler A notification telling about the end + * of a document. + * @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndDocumentL(TInt aErrorCode); + + /** + * From MContentHandler A notification telling about the beginning + * of an element. + * @param aElement is a handle to the element's details. + * @param aAttributes contains the attributes for the element. + * @param aErrorCode is the error code. + * @return A boolean according to success. + */ + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, + TInt aErrorCode); + + /** + This method is a callback to indicate the end of the element has been reached. + @param aElement is a handle to the element's details. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + + /** + This method is a callback that sends the content of the element. + Not all the content may be returned in one go. The data may be sent in chunks. + When an OnEndElementL is received this means there is no more content to be sent. + @param aBytes is the raw content data for the element. + The client is responsible for converting the data to the + required character set if necessary. + In some instances the content may be binary and must not be converted. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + /** + This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. + This method is always called before the corresponding OnStartElementL method. + @param aPrefix is the Namespace prefix being declared. + @param aUri is the Namespace URI the prefix is mapped to. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, + TInt aErrorCode); + + /** + This method is a notification of the end of the scope of a prefix-URI mapping. + This method is called after the corresponding DoEndElementL method. + @param aPrefix is the Namespace prefix that was mapped. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + + + /** + This method is a notification of ignorable whitespace in element content. + @param aBytes are the ignored bytes from the document being parsed. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + + + /** + This method is a notification of a skipped entity. If the parser encounters an + external entity it does not need to expand it - it can return the entity as aName + for the client to deal with. + @param aName is the name of the skipped entity. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + + + /** + This method is a receive notification of a processing instruction. + @param aTarget is the processing instruction target. + @param aData is the processing instruction data. If empty none was supplied. + @param aErrorCode is the error code. + If this is not KErrNone then special action may be required. + */ + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, + TInt aErrorCode); + + + /** + This method indicates an error has occurred. + @param aError is the error code + */ + void OnError(TInt aErrorCode); + + + /** + This method obtains the interface matching the specified uid. + @return 0 if no interface matching the uid is found. + Otherwise, the this pointer cast to that interface. + @param aUid the uid identifying the required interface. + */ + TAny* GetExtendedInterface(const TInt32 aUid); + + + /** + * C++ default constructor. + */ + CBTSURefObjectResolver( CDesCArrayFlat* aCapabilityList ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + private: // Data + + // Not owned. + // + CDesCArrayFlat* iObjectList; + }; + +#endif // BTSU_REF_OBJECT_RESOLVER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUXmlParser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUXmlParser.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002 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: XML parser +* +*/ + + +#ifndef BTSU_XML_PARSER_H +#define BTSU_XML_PARSER_H + +// INCLUDES +#include +#include +#include +//#include +#include +#include + +#include "BTServiceUtils.h" + +// CLASS DECLARATION + +/** +* A class for executing simple predetermined xml parsing tasks. +*/ +NONSHARABLE_CLASS (CBTSUXmlParser) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSUXmlParser* NewL(); + + /** + * Destructor. + */ + virtual ~CBTSUXmlParser(); + + public: // New functions + + /** + * Finds and collects image capabilites from the file. + * @param aFileName The name of the file to be parsed. + * @return A pointer to the list. + */ + CDesCArrayFlat* GetCapabilityListL( const TDesC& aFileName ); + + + /** + * Finds and collects image capabilites from the file. + * @param aFileName The name of the file to be parsed. + * @return A pointer to the list. + */ + RArray* GetImgCapabilityListL( const TDesC& aFileName ); + + /** + * Finds and collects paths to objects referenced in the file. + * @param aFileName The name of the file to be parsed. + * @return A pointer to the list. + */ + CDesCArrayFlat* GetRefObjectListL( const TDesC& aFileName ); + + private: + + /** + * C++ default constructor. + */ + CBTSUXmlParser(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + RFs iFileSession; + }; + +#endif // BTSU_XML_PARSER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceAPI.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceAPI.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2002 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: API for sending services +* +*/ + + + +#ifndef BT_SERVICE_API_H +#define BT_SERVICE_API_H + +// INCLUDES +#include "BTServiceParameterList.h" + +// CONSTANTS + +// DATA TYPES + +enum TBTServiceType + { + EBTSendingService, + EBTPrintingService, + EBTObjectPushService // use this if support for only OPP is wanted + }; + +// FORWARD DECLARATIONS +class CBTServiceStarter; + +// CLASS DECLARATION + +/** +* An API for starting Bluetooth services. +* +* @lib BtServiceUtils.lib +* @since Series 60 2.6 +*/ +class CBTServiceAPI : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CBTServiceAPI* NewL(); + + /** + * Destructor. + */ + virtual ~CBTServiceAPI(); + + public: // New functions + + /** + * Starts the given service. + * Returns when service is started. + * @since Series 60 2.6 + * @param aService The service to be started. + * @param aList Parameters for the service. + * @return None. + */ + IMPORT_C void StartServiceL( TBTServiceType aService, + CBTServiceParameterList* aList ); + + /** + * Starts the given service. + * Returns when service is completed. + * @since Series 60 2.6 + * @param aService The service to be started. + * @param aList Parameters for the service. + * @return None. + */ + IMPORT_C void StartSynchronousServiceL( TBTServiceType aService, + CBTServiceParameterList* aList ); + private: + + /** + * C++ default constructor. + */ + CBTServiceAPI(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + CBTServiceStarter* iStarter; + CActiveSchedulerWait iSyncWaiter; + }; + +#endif // BT_SERVICE_API_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceClient.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2002 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: Obex client +* +*/ + + + +#ifndef BT_SERVICE_CLIENT_H +#define BT_SERVICE_CLIENT_H + +// INCLUDES +#include "BTSUPassKeyRequest.h" + +#include +#include + + +// FORWARD DECLARATION +class CBTSUPasskeyRequest; +class CBTConnectionTimer; + +// CLASS DECLARATION + +/** +* An interface used to inform about BT service client events. +*/ +class MBTServiceClientObserver + { + public: + + /** + * Informs the observer that a Connect operation has been completed. + * @param aStatus The status of the operation. + * @return None. + */ + virtual void ConnectCompleted( TInt aStatus ) = 0; + + /** + * Informs the observer that a Put operation has been completed. + * @param aStatus The status of the operation. + * @param aPutResponse The response object. + * @return None. + */ + virtual void PutCompleted( TInt aStatus,const CObexHeaderSet* aPutResponse ) = 0; + + /** + * Informs the observer that a Get operation has been completed. + * @param aStatus The status of the operation. + * @param aGetResponse The response object. + * @return None. + */ + virtual void GetCompleted( TInt aStatus, CObexBufObject* aGetResponse ) = 0; + + /** + * Informs the observer that the client connection has been closed. + * @return None. + */ + virtual void ClientConnectionClosed() = 0; + + /** + * Informs the observer that the client connect is timed out. + * @return None. + */ + virtual void ConnectTimedOut() = 0; + + + }; + +/** +* An interface used to inform about BT Connection timeout +*/ +class MBTConTimeObserver + { + public: + /** + * Informs the observer that the client connec is timeouted + * @return None. + */ + virtual void ConnectionTimedOut()=0; + }; + + +// CLASS DECLARATION + +/** +* An interface used to ask client's progress status. +*/ +class MBTServiceProgressGetter + { + public: + + /** + * Returns the progess status of the service client. + * @return The number of bytes sent. + */ + virtual TInt GetProgressStatus() = 0; + }; + +// CLASS DECLARATION + +/** +* An active object managing the Obex client. +*/ +NONSHARABLE_CLASS (CBTServiceClient) : public CActive, + public MBTServiceProgressGetter, + public MObexAuthChallengeHandler, + public MBTConTimeObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aObserver A pointer to the client observer. + * @param aRemoteDevice The address of the remote device. + * @param aRemotePort The port of the remote device. + * @param aHeaderList The headers to be associated with connect object. + * @return None. + */ + static CBTServiceClient* NewL( MBTServiceClientObserver* aObserver, + const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ); + + /** + * Destructor. + */ + virtual ~CBTServiceClient(); + + public: // New functions + + /** + * Issues an Obex Get-request. + * @param aHeaderList The headers to be associated with the object. + * @param aFileName A filename of the Get Object. + * @return None. + */ + void GetObjectL( RArray& aHeaderList, + const TDesC& aFileName = KNullDesC ); + + /** + * Issues an Obex Put-request. + * @param aHeaderList The headers to be associated with the object. + * @param aFileName A filename of the Put Object. + * @return None. + */ + void PutObjectL( RArray& aHeaderList, + const TDesC& aFileName ); + + /** + * Issues an Obex Put-request. + * @param aHeaderList The headers to be associated with the object. + * @param aFile A filehandle of the Put Object. + * @return None. + */ + void PutObjectL( RArray& aHeaderList, + RFile& ); + + /** + * Closes Obex Client connection. + * @param None. + * @return None. + */ + void CloseClientConnection(); + + /** + * Send abort command to remote device + * @param None. + * @return None. + */ + void Abort(); + + private: // Functions from base classes + + /** + * From MBTServiceProgressGetter Returns the progess status. + * @return The number of bytes sent. + */ + TInt GetProgressStatus(); + + + private: // Functions from base classes + + /** + * From MObexAuthChallengeHandler The Obex Passkey is requested. + * @param aRealm The realm/challenge specified by the unit forcing + * the authentication. + * @return None. + */ + void GetUserPasswordL( const TDesC& aRealm ); + + /** + * From CActive Get's called when a request is cancelled. + * @param None. + * @return None. + */ + void DoCancel(); + + /** + * From CActive Get's called when a request is completed. + * @param None. + * @return None. + */ + void RunL(); + + /** + * From MBTConTimeObserver Get's called if bt connection is timed out. + * @param None. + * @return None. + */ + void ConnectionTimedOut(); + + private: // Data definitions + + enum TBTServiceClientState + { + EBTSCliIdle, + EBTSCliConnecting, + EBTSCliPutting, + EBTSCliGetting, + EBTSCliDisconnecting + }; + + private: + + /** + * C++ default constructor. + */ + CBTServiceClient( MBTServiceClientObserver* aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ); + + private: // Data + + TBTServiceClientState iClientState; + + CObexClient* iClient; + CBufFlat* iObjectBuffer; + CObexBufObject* iGetObject; + CObexFileObject* iPutObject; + CObexNullObject* iConnectObject; + TInt iTotalBytesSent; + CBTSUPasskeyRequest* iPasskeyRequest; + CBufFlat *iBuffer; + CObexBufObject* iPutBufObject; + CBTConnectionTimer* iConnectionTimer; + // Not owned + // + MBTServiceClientObserver* iObserver; + }; + +#endif // BT_SERVICE_CLIENT_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceParameterList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceParameterList.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2002 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: Parameter list +* +*/ + + +#ifndef BT_SERVICE_PARAMETER_LIST_H +#define BT_SERVICE_PARAMETER_LIST_H + +// INCLUDES +#include +#include // CDesCArray +#include + +// CONSTANTS + +// DATA TYPES + +struct TBTSUXhtmlParam + { + TDesC* iFileName; + CDesCArray* iRefObjectList; + }; + +struct TBTSUImageParam + { + RFile iFile; + TDesC* iDisplayName; + TDesC8* iMimeType; + TSize iPixelSize; + TInt iFileSize; + TBool iSend; + + }; + + +// CLASS DECLARATION + +/** +* A class holding paths to different types of files. +* +* In case of an XHTML file the list collects paths +* to objects referenced in the file. +* +* In case of an image the list resolves the MIME types and +* displayable names of the images. +* +* @lib BtServiceUtils.lib +* @since Series 60 2.6 +*/ +class CBTServiceParameterList : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CBTServiceParameterList* NewL(); + IMPORT_C static CBTServiceParameterList* NewLC(); + + /** + * Destructor. + */ + virtual ~CBTServiceParameterList(); + + public: // New functions + + /** + * Adds an xhtml file path to the list. + * @since Series 60 2.6 + * @param aFilePath A full path and file name. + * @return None. + */ + IMPORT_C void AddXhtmlL( const TDesC& aFilePath ); + + /** + * Adds an image file path to the list. + * @since Series 60 2.6 + * @param aFilePath A full path and file name. + * @return None. + */ + IMPORT_C void AddImageL( const TDesC& aFilePath ); + + /** + * Adds an image file path to the list. + * @since Series 60 2.6 + * @param aFile file handle to be send. + * @return None. + */ + IMPORT_C void AddImageL( RFile aFile ); + + /** + * Adds an object file path to the list. + * @since Series 60 2.6 + * @param aFilePath A full path and file name. + * @return None. + */ + IMPORT_C void AddObjectL( const TDesC& aFilePath ); + + /** + * Adds an object file path to the list. + * @since Series 60 2.6 + * @param aFile file handle to be send . + * @return None. + */ + IMPORT_C void AddObjectL( RFile aFile ); + + public: // New functions (not exported) + + /** + * Return the number of xhtml file paths in the list. + * @return The count. + */ + TInt XhtmlCount() const; + + /** + * Return the number of image file paths in the list. + * @return The count. + */ + TInt ImageCount() const; + + /** + * Return the number of object file paths in the list. + * @return The count. + */ + TInt ObjectCount() const; + + /** + * Returns a copy of an element of the list from the given index. + * @param aIndex The index. + * @return The element. + */ + TBTSUXhtmlParam XhtmlAt( TInt aIndex ) const; + + /** + * Returns a copy of an element of the list from the given index. + * @param aIndex The index. + * @return The element. + */ + TBTSUImageParam ImageAtL( TInt aIndex ) const; + + /** + * Returns a copy of an element of the list from the given index. + * @param aIndex The index. + * @return The element. + */ + RFile& ObjectAtL( TInt aIndex ); + + /** + * Checks whether the list has any xhtml-files with referenced objects. + * @return A boolean according to result. + */ + TBool HasAnyReferencedObjects() const; + + /** + * Return the size of objects in the list. + * @return The count. + */ + TInt ObjectListSizeL() const; + + /** + * Return the size of images in the list. + * @return The count. + */ + + TInt ImageListSize() const; + + /** + * Remove image from list. + * @param aIndex The index. + * @return None. + */ + void RemoveImageL(TInt aIndex); + + /** + * Return count of removed image + * @return The count of removed images. + */ + TInt RemovedImageCount(); + + /** + * Reset image filehandle + * @param aIndex The index. + * @return None. + */ + void ResetImageHandleL(TInt aIndex); + + /** + * Reset object filehandle + * @param aIndex The index. + * @return None. + */ + void ResetObjectHandleL(TInt aIndex); + + + /** + * Reset image filehandle + * @param aIndex The index. + * @return None. + */ + void MarkAsSendL(TInt aIndex); + + + private: + + /** + * C++ default constructor. + */ + CBTServiceParameterList(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + RArray iXhtmlList; + RArray iImageList; + RArray iObjectList; + RFs iFileSession; + TInt iRemovedImageCount; + }; + +#endif // BT_SERVICE_PARAMETER_LIST_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,506 @@ +/* +* Copyright (c) 2002-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: Service starter +* +*/ + + + +#ifndef BT_SERVICE_STARTER_H +#define BT_SERVICE_STARTER_H + +// INCLUDES +#include "BTServiceAPI.h" +#include "BTServiceUtils.h" +#include "BTServiceParameterList.h" + +#include +#include +#include +#include +#include +#include +#include + +// DATA TYPES + +enum TBTServiceProfile + { + EBTSNone, + EBTSBPP, + EBTSOPP, + EBTSBIP + }; + +enum TBTActiveNotifier + { + ENoneQuery = 0, + EOfflineQuery, + ENameQuery + }; + +// FORWARD DECLARATIONS +class CObexUtilsUiLayer; +class MBTServiceProgressGetter; +class CBTSController; +class CBTSProgressTimer; + + +const TUint KBTSdpObjectPush = 0x1105; +const TUint KBTSdpBasicImaging = 0x111b; +const TUint KBTSdpBasicPrinting = 0x1120; + + +// CLASS DECLARATION + +/** +* An observer interface for service controllers. +*/ +class MBTServiceObserver + { + public: // New functions + + /** + * Informs the observer that the handler has completed its tasks. + * @param aStatus The the completion status of the handler. + * @return None. + */ + virtual void ControllerComplete( TInt aStatus ) = 0; + + /** + * Informs the observer that a progress note should be shown. + * @param aGetter A pointer to a progess status getter object. + * @return None. + */ + virtual void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aTotalSize, TInt aFileCount ) = 0; + + + /** + * Informs the observer that a progress note should be shown. + * @param aGetter A pointer to a progess status getter object. + * @return None. + */ + virtual void UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) = 0; + + + /** + * Informs the observer that a progress note should be shown. + * @param aGetter A pointer to a progess status getter object. + * @return None. + */ + virtual void UpdateProgressInfoL() = 0; + + + /** + * Informs the observer that a confirmation query for sending + * should be shouwn for BIP sendign + * @return + */ + virtual TInt LaunchConfirmationQuery(TInt aResouceId)=0; + + /** + * Informs the observer that a connect is timedout + * @return + */ + virtual void ConnectTimedOut()=0; + + }; + + +/** +* A starter class for Bluetooth services. +*/ +NONSHARABLE_CLASS (CBTServiceStarter) : public CActive, + public MBTServiceObserver, + public MObexUtilsDialogObserver, + public MObexUtilsProgressObserver, + public MBTEngSdpResultReceiver, + public MBTEngSettingsObserver, + public MHbDeviceProgressDialogObserver, + public MHbDeviceDialogObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTServiceStarter* NewL(); + + /** + * Destructor. + */ + virtual ~CBTServiceStarter(); + + public: // New functions + + /** + * Starts the given service. + * @param aService The service to be started. + * @param aList Parameters for the service. + * @param aWaiter A pointer to a waiter object. + * @return None. + */ + void StartServiceL( TBTServiceType aService, + CBTServiceParameterList* aList, + CActiveSchedulerWait* aWaiter = NULL ); + + private: // Functions from base classes + + + + /** + * From MBTServiceObserver A controller has completed. + * @param aStatus The completion status of the controller. + * @return None. + */ + void ControllerComplete( TInt aStatus ); + + /** + * From MBTServiceObserver A progress note should be shown. + * @param aGetter A pointer to a progess status getter object. + * @param aTotalSize Max size of the progress bar. + * @return None. + */ + void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, TInt aTotalSize, TInt aFileCount ); + + + /** + * From MBTServiceObserver Updating progress note when multiple files are sent. + * @param aFileSize Size of the file to be send. + * @param aFileIndex index of the file to be send. + * @param aFileName name of the file to be send. + * @return None. + */ + void UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ); + + /** + * From MBTServiceObserver Updating progress note info about the progress percentage + * @return None. + */ + void UpdateProgressInfoL(); + + /** + * From MObexUtilsWaitDialogObserver The wait note has been dismissed. + * @param aButtonId The button id that was used to dismiss the dialog. + * @return None. + */ + void DialogDismissed( TInt aButtonId ); + + /** + * From MHbDeviceProgressDialogObserver + * + */ + void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian * aDialog); + + /** + * From MHbDeviceProgressDialogObserver + * + */ + void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian * aDialog ) ; + + /** + * From MObexUtilsProgressObserver request for number of bytes sent + * @Param None. + * @return Number of bytes sent. + */ + TInt GetProgressStatus(); + + /** + * From MBTServiceObserver A confirmation query for BIP + * profile should be shown. + * @return key + */ + TInt LaunchConfirmationQuery(TInt aResourceId); + + /** + * From MBTServiceObserver a connect request is timedout + * @return + */ + void ConnectTimedOut(); + + + /** + * Provides notification of the result of a service search that matches + * the requested UUID (through CBTEngDiscovery::RemoteSdpQuery). + * This method indicates that the search has completed, and returns + * all the results to the caller at once. + * + * @since S60 v3.2 + * @param aResult Array of record handles that match the requested UUID. + * Note: the array will not be available anymore after + * this method returns. + * @param aTotalRecordsCount The total number of records returned. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful, KErrEof if no record matched the requested UUID, + * KErrCouldNotConnect and KErrCouldDisconnected in case of + * Bluetooth connection errors; otherwise one of the + * system-wide error codes. + */ + void ServiceSearchComplete( const RSdpRecHandleArray& aResult, + TUint aTotalRecordsCount, TInt aErr ); + + /** + * Provides notification of the result of an attribute search that matches + * the requested attribute (through CBTEngDiscovery::RemoteSdpQuery). + * This method indicates that the search has completed, and returns + * all the results to the caller at once. + * + * @since S60 v3.2 + * @param aHandle Record handle of the service record containing the result. + * @param aAttr Array containing the attribute that matches the + * requested attribute. + * Note: the array will not be available anymore after + * this method returns. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful, KErrEof if the requested attribute was not + * contained in the specified service record, + * KErrCouldNotConnect and KErrCouldDisconnected in case of + * Bluetooth connection errors; otherwise one of the + * system-wide error codes. + */ + void AttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr, + TInt aErr ); + + /** + * Provides notification of the result of an combination of a service + * and attribute search (through CBTEngDiscovery::RemoteSdpQuery). + * This method is called for each service and attribute combination for + * which a match was found. The last result (which could be empty if no + * match was found) contain error code KErrEof to indicate that the + * search has completed. + * + * @since S60 v3.2 + * @param aHandle Record handle of the service record containing the result. + * @param aAttr Array containing the attribute that matches the + * requested attribute. + * Note: the array will not be available anymore after + * this method returns. + * @param aErr Error code of the service search operation; KErrNone if + * sucessful and more results follow, KErrEof indicates that + * this is the last result (which could be empty if no match + * was found), KErrCouldNotConnect and KErrCouldDisconnected + * in case of Bluetooth connection errors; otherwise one of + * the system-wide error codes. + */ + void ServiceAttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr, + TInt aErr ); + + /** + * Provides notification of the result of the discovery of nearby + * Bluetooth devices. + * + * @since S60 v3.2 + * @param aDevice The data structure encapsulates all information + * about the selected device. Ownership of the data + * structure has not been transfered and is still with + * the API client. + * @param aErr Error code of the device search operation; KErrNone if + * sucessful, KErrCancel if the user cancelled the + * dialog, KErrCancel if CBTEngDiscovery::CancelSearchRemoteDevice + * was called; otherwise one of the system-wide error codes. + */ + void DeviceSearchComplete( CBTDevice* aDevice, TInt aErr ); + + /** + * From MBTEngSettingsObserver. + * Provides notification of changes in the power state + * of the Bluetooth hardware. + * + * @since S60 v3.2 + * @param aState EBTPowerOff if the BT hardware has been turned off, + * EBTPowerOn if it has been turned off. + */ + void PowerStateChanged( TBTPowerStateValue aState ); + + /** + * From MBTEngSettingsObserver. + * Provides notification of changes in the discoverability + * mode of the Bluetooth hardware. + * + * @since S60 v3.2 + * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode, + * EBTDiscModeGeneral if it is in visible mode. + */ + void VisibilityModeChanged( TBTVisibilityMode aState ); + + /** + * From CActive. + * Called by the active scheduler when the request has been cancelled. + * + * @since S60 v3.2 + */ + void DoCancel(); + + /** + * From CActive. + * Called by the active scheduler when the request has been completed. + * + * @since S60 v3.2 + */ + void RunL(); + + /** + * From CActive. + * Called by the active scheduler when an error in RunL has occurred. + * + * @since S60 v3.2 + */ + TInt RunError( TInt aError ); + + private: + + /** + * C++ default constructor. + */ + CBTServiceStarter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Check that the parameters are valid for a given service. + * @param aService The requested service. + * @param aList Parameters for the service. + * @return None. + */ + TBool ValidParameters( TBTServiceType aService, + const CBTServiceParameterList* aList) const; + + /** + * Starts finding a Bluetooth profile suitable for requested service. + * @param aService The requested service. + * @return None. + */ + void StartProfileSelectL( TBTServiceType aService ); + + /** + * Start a controller for the given Bluetooth profile. + * @param aProfile The profile to be started. + * @return None. + */ + void StartProfileL( TBTServiceProfile aProfile ); + + /** + * Launches a connecting wait note + * @param None. + * @return None. + */ + void LaunchWaitNoteL(); + + /** + * Cancel connecting wait note + * @param None. + * @return None. + */ + void CancelWaitNote(); + + /** + * Show a note with given error value + * @param aReason Error value + * @return None. + */ + void ShowNote( TInt aReason ) const; + + /** + * Cancel progress note + * @param None. + * @return None. + */ + void CancelProgressNote(); + + /** + * StopTransfer and show information note + * @param aError Error code if error exist. + * @return None. + */ + void StopTransfer( TInt aError ); + + /** + * Check if phone is in offline mode, and ask the user if it is.. + * @return ETrue if the phone is in offline mode, otherwise EFalse. + */ + TBool CheckOfflineModeL(); + + /** + * Start BT device discovery. + * @return None. + */ + void StartDiscoveryL(); + + /** + * Turn BT power on. + * @param aState The current BT power state. + * @return None. + */ + void TurnBTPowerOnL( const TBTPowerStateValue aState ); + + void DataReceived(CHbSymbianVariantMap& aData); + + void DeviceDialogClosed(TInt aCompletionCode); + private: // Data definitions + + enum TBTServiceStarterState + { + EBTSStarterIdle, + EBTSStarterFindingBPP, + EBTSStarterFindingOPP, + EBTSStarterFindingBIP, + EBTSStarterStoppingService + }; + + private: // Data + + CBTDevice* iDevice; + CBTEngDiscovery* iBTEngDiscovery; + CBTServiceParameterList* iList; + // CObexUtilsDialog* iDialog; + CBTSController* iController; + + TBTServiceType iService; + TInt iClientChannel; + TBTServiceStarterState iState; + TBool iServiceStarted; + TMsvId iMessageServerIndex; + + MBTServiceProgressGetter* iProgressGetter; + CActiveSchedulerWait* iWaiter; + TBool iAllSend; + TInt iBytesSendWithBIP; + TBool iProgressDialogActive; + TBool iUserCancel; + CBTEngSettings* iBTEngSettings; + TBool iWaitingForBTPower; + RNotifier iNotifier; // Handle to the generic notifier. + TPckgBuf iOffline; + TPckgBuf iName; + TBool iSendToBIPOnlyDevice; + TBTActiveNotifier iActiveNotifier; + TBool iFeatureManagerInitialized; + TBool iTriedBIP; + TBool iTriedOPP; + CHbDeviceDialogSymbian *iDeviceDialog; + CHbDeviceProgressDialogSymbian *iProgressDialog; + TInt iFileCount; + TInt iFileIndex; + CBTSProgressTimer *iProgressTimer; + }; + +#endif // BT_SERVICE_CONTROLLER_H + +// End of File + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2002 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: Contains BTSU wide definitions. +* +*/ + + +#ifndef BT_SERVICE_UTILS_H +#define BT_SERVICE_UTILS_H + +// INCLUDES +#include + +// CONSTANTS + +// Name of this component +// +_LIT( KBTSUModuleName, "Bluetooth Service Utils" ); + +const TInt KBTSUArrayGranularity = 1; +const TInt KBTSUMaxStringLength = 255; +const TInt KBTSUTextBufferMaxSize = 512; +const TInt KBTSUDataBufferMaxSize = 102400; // 100K +const TInt KBTSUDataBufferExpandSize = 4; +const TInt KBTSUEqualStrings = 0; // The ok-result of TDesC::Compare + +_LIT( KBTSProtocol, "RFCOMM" ); // The Bluetooth transport layer + +// Obex header HI values +// +const TUint8 KBTSUNameHeader = 0x01; +const TUint8 KBTSUImageHandleHeader = 0x30; +const TUint8 KBTSUTypeHeader = 0x42; +const TUint8 KBTSULengthHeader = 0xC3; +const TUint8 KBTSUTargetHeader = 0x46; +const TUint8 KBTSUAppParamsHeader = 0x4C; +const TUint8 KBTSUImgDescriptorHeader = 0x71; + + +// DATA TYPES + +enum TBTSUPanicCode + { + EBTSUPanicNullPointer = 45000, + EBTSUPanicExistingObject, + EBTSUPanicObjectActive, + EBTSUPanicUnhandledCase, + EBTSUPanicInternalError, + EBTSUPanicOutOfRange, + EBTSUPanicResponseAlreadyPresent, + EBTSUPanicNoBufferEvenThoughCountNotZero + }; + +enum TBTServiceStatus + { + EBTSNoError = 100, + EBTSNoFiles, + EBTSAbort, + EBTSConnectingFailed, + EBTSGettingFailed, + EBTSPuttingFailed, + EBTSNoSuitableProfiles, + EBTSUserCancel, + EBTSBIPOneNotSend, + EBTSBIPSomeSend, + EBTSBIPNoneSend + }; + + struct TBTSUImageCap + { + TDesC* iEncoding; + TSize iMinPixelSize; + TSize iMaxPixelSize; + TInt iMaxByteSize; + }; + + +// FUNCTION PROTOTYPES + +/** +* Calls the Symbian OS Panic function specifying this component's name as the +* panic category and aPanic as the panic code. +* @param aPanic The panic code. +* @return None. +*/ +void BTSUPanic( TBTSUPanicCode aPanic ); + + +// CLASS DECLARATION + +/** +* A cleanup template class for objects that need ResetAndDestroy call. +*/ +template class CleanupResetAndDestroy + { + public: + inline static void PushL( T& aRef ); + private: + static void ResetAndDestroy( TAny *aPtr ); + }; + +template inline void CleanupResetAndDestroyPushL( T& aRef ); + +#include "BTServiceUtils.inl" + +#endif // BT_SERVICE_UTILS_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.inl Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2002 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: Inline methods for BTSU. +* +*/ + + + +// INCLUDE FILES +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CleanupResetAndDestroy::PushL +// ----------------------------------------------------------------------------- +// +template inline void CleanupResetAndDestroy::PushL( T& aRef ) + { + CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); + } + +// ----------------------------------------------------------------------------- +// CleanupResetAndDestroy::ResetAndDestroy +// ----------------------------------------------------------------------------- +// +template void CleanupResetAndDestroy::ResetAndDestroy( TAny *aPtr ) + { + ( STATIC_CAST( T*, aPtr) )->ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CleanupResetAndDestroyPushL +// ----------------------------------------------------------------------------- +// +template inline void CleanupResetAndDestroyPushL( T& aRef ) + { + CleanupResetAndDestroy::PushL( aRef ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/Bmarm/ObexServiceSendUtilsApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/Bmarm/ObexServiceSendUtilsApiTestU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/Bwins/ObexServiceSendUtilsApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/Bwins/ObexServiceSendUtilsApiTestU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/EABI/ObexServiceSendUtilsApiTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/EABI/ObexServiceSendUtilsApiTestU.def Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/conf/ui_ObexServiceSendUtilsApiTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/conf/ui_ObexServiceSendUtilsApiTest.cfg Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,8 @@ +[Test] +title StartService +create ObexServiceSendUtilsApiTest test +test StartService +delete test +[Endtest] + + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/data/SmallPic.jpg Binary file btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/data/SmallPic.jpg has changed diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#if defined(__S60_) + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET ObexServiceSendUtilsApiTest.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 ObexServiceSendUtilsApiTest.def + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../../../../inc +USERINCLUDE ../inc +SOURCEPATH ../src +SOURCE ObexServiceSendUtilsApiTest.cpp +SOURCE ObexServiceSendUtilsApiTestBlocks.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY obexservicesendutils.lib + +LANG SC + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest.pkg Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,66 @@ +; +; 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 the License "Symbian Foundation License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 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\urel\ObexServiceSendUtilsApiTest.dll" - "!:\Sys\Bin\ObexServiceSendUtilsApiTest.dll" +;"\epoc32\release\armv5\urel\ObexServiceSendUtilsApiTest.exe" - "!:\Sys\Bin\ObexServiceSendUtilsApiTest.exe" +"..\data\SmallPic.jpg"-"e:\testdata\SmallPic.jpg" +"..\init\ObexServiceSendUtilsApiTest.ini" - "c:\testframework\testframework.ini" +"..\conf\ui_ObexServiceSendUtilsApiTest.cfg" - "c:\testframework\ui_ObexServiceSendUtilsApiTest.cfg" + + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/ObexServiceSendUtilsApiTest_nrm.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#if defined(__S60_) + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET ObexServiceSendUtilsApiTest.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 ObexServiceSendUtilsApiTest.def + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../../../../inc +USERINCLUDE ../inc +SOURCEPATH ../src +SOURCE ObexServiceSendUtilsApiTest.cpp +SOURCE ObexServiceSendUtilsApiTestBlocks.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY obexservicesendutils.lib + +LANG SC + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,38 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +PRJ_PLATFORMS + +DEFAULT + +PRJ_TESTEXPORTS + + +PRJ_EXPORTS + + +PRJ_TESTMMPFILES +ObexServiceSendUtilsApiTest.mmp + +PRJ_MMPFILES +ObexServiceSendUtilsApiTest_nrm.mmp + + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/make_and_sign_sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/group/make_and_sign_sis.bat Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of the License "Symbian Foundation License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +makesis -v ObexServiceSendUtilsApiTest.pkg +signsis.exe ObexServiceSendUtilsApiTest.sis ObexServiceSendUtilsApiTest.sisx rd.cer rd-key.pem diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/inc/ObexServiceSendUtilsApiTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/inc/ObexServiceSendUtilsApiTest.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,186 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef OBEXSERVICESENDUTILSAPITEST_H +#define OBEXSERVICESENDUTILSAPITEST_H + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KObexServiceSendUtilsApiTestLogPath, "\\logs\\testframework\\Obex\\" ); +// Log file +_LIT( KObexServiceSendUtilsApiTestLogFile, "ObexServiceSendUtilsApiTest.txt" ); +_LIT( KObexServiceSendUtilsApiTestLogFileWithTitle, "ObexServiceSendUtilsApiTest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CObexServiceSendUtilsApiTest; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CObexServiceSendUtilsApiTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CObexServiceSendUtilsApiTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CObexServiceSendUtilsApiTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CObexServiceSendUtilsApiTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + 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 ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CObexServiceSendUtilsApiTest( 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(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt StartServiceL( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // OBEXSERVICESENDUTILSAPITEST_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/init/ObexServiceSendUtilsApiTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/init/ObexServiceSendUtilsApiTest.ini Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,53 @@ + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +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 + +[End_Defaults] + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_ObexServiceSendUtilsApiTest.cfg +[End_Module] + + + + +[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\ + +#HardwareBasePath= D:\LOGS\TestFramework\ + + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/src/ObexServiceSendUtilsApiTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/src/ObexServiceSendUtilsApiTest.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,201 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +// INCLUDE FILES +#include +#include "ObexServiceSendUtilsApiTest.h" +#include + +// 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 =============================== + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::CObexServiceSendUtilsApiTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CObexServiceSendUtilsApiTest::CObexServiceSendUtilsApiTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CObexServiceSendUtilsApiTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KObexServiceSendUtilsApiTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KObexServiceSendUtilsApiTestLogFile); + } + + iLog = CStifLogger::NewL( KObexServiceSendUtilsApiTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CObexServiceSendUtilsApiTest* CObexServiceSendUtilsApiTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CObexServiceSendUtilsApiTest* self = new (ELeave) CObexServiceSendUtilsApiTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CObexServiceSendUtilsApiTest::~CObexServiceSendUtilsApiTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CObexServiceSendUtilsApiTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ObexServiceSendUtilsApiTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== 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* ) CObexServiceSendUtilsApiTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/src/ObexServiceSendUtilsApiTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/internal/tsrc/ObexServiceSendUtilsApiTest/src/ObexServiceSendUtilsApiTestBlocks.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,157 @@ +/* +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "ObexServiceSendUtilsApiTest.h" +#include "BTServiceAPI.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 =============================== + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CObexServiceSendUtilsApiTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CObexServiceSendUtilsApiTest::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( "StartService", CObexServiceSendUtilsApiTest::StartServiceL ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +TInt CObexServiceSendUtilsApiTest::StartServiceL( CStifItemParser& aItem ) + { + + CBTServiceAPI* service = CBTServiceAPI::NewL(); + CleanupStack::PushL(service ); + STIF_ASSERT_NOT_NULL(service) + + CBTServiceParameterList* list = CBTServiceParameterList::NewL(); + iLog->Log(_L("CBTServiceParameterList::NewL")); + CleanupStack::PushL(list); + STIF_ASSERT_NOT_NULL(list) + + list->AddImageL(_L("e:\\testdata\\SmallPic.jpg")); + iLog->Log(_L("list->AddImageL ")); + CleanupStack::Pop(list); + + TRAPD( err, service->StartSynchronousServiceL( EBTSendingService, list)); + iLog->Log(_L("service->StartServiceL result: %d"), err); + CleanupStack::PopAndDestroy(1); + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// CObexServiceSendUtilsApiTest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt CObexServiceSendUtilsApiTest::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTConnectionTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTConnectionTimer.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2002 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: Waiter class implementation +* +*/ + + + +// INCLUDE FILES +#include "BTConnectionTimer.h" +#include "BTServiceUtils.h" +#include "BTSUDebug.h" + +// CONSTANTS + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBPPServerWait::CBTSBPPServerWait +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTConnectionTimer::CBTConnectionTimer( MBTConTimeObserver* aObserver ) : + CTimer( EPriorityStandard ), iObserver( aObserver ) + + { + + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBTConnectionTimer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTConnectionTimer::ConstructL() + { + FLOG(_L("[BTSU]\t CBTConnectionTimer::ConstructL()")); + + CTimer::ConstructL(); + + + FLOG(_L("[BTSU]\t CBTConnectionTimer::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTConnectionTimer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTConnectionTimer* CBTConnectionTimer::NewL( MBTConTimeObserver* aObserver ) + { + CBTConnectionTimer* self = new( ELeave ) CBTConnectionTimer( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// Destructor +CBTConnectionTimer::~CBTConnectionTimer() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CBTConnectionTimer::SetTimeOut +// ----------------------------------------------------------------------------- +// +void CBTConnectionTimer::SetTimeOut(TTimeIntervalMicroSeconds32 aTimeOutValue) + { + iTimeOutValue = aTimeOutValue; + } +// ----------------------------------------------------------------------------- +// CBTConnectionTimer::Start +// ----------------------------------------------------------------------------- +// +void CBTConnectionTimer::Start() + { + After( iTimeOutValue ); + } + +// ----------------------------------------------------------------------------- +// CBTConnectionTimer::RunL +// ----------------------------------------------------------------------------- +// +void CBTConnectionTimer::RunL() + { + FTRACE(FPrint(_L("[BTSU]\t CBTConnectionTimer::RunL() status %d"), iStatus.Int() ) ); + + if ( iObserver ) + { + iObserver->ConnectionTimedOut(); + } + + FLOG(_L("[BTSU]\t CBTConnectionTimer::RunL() completed")); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,691 @@ +/* +* Copyright (c) 2002 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 push implementation +* +*/ + + + +// INCLUDE FILES +#include "BTSBIPController.h" +#include "BTSUDebug.h" +#include "BTSUImageConverter.h" +#include "BTSUXmlParser.h" +#include + + + +// CONSTANTS +// image push target header +_LIT8( KBIPImagePushID, "\xE3\x3D\x95\x45\x83\x74\x4A\xD7\x9E\xC5\xC1\x6B\xE3\x1E\xDE\x8E" ); + +// type headers +_LIT8( KBTSBIPCapabilities, "x-bt/img-capabilities\0"); +_LIT8( KBTSBIPImageType, "x-bt/img-img\0"); +_LIT8( KBTSBIPThmType, "x-bt/img-thm\0"); + +// imageBTS descriptor +_LIT8( KBTSBIPDescriptorStart, "\r" ); +_LIT8( KBTSBIPDescriptorEncoding, "\r" ); + +// temp file path for capabilities object + +//temp file path drive letter +_LIT(KBTSBIPTempPathDrive,"c:"); +const TInt KBTSUMaxPathLenght=256; +const TInt KBTSUMaxPrivatePathLenght=20; + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBIPController::CBTSBIPController +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSBIPController::CBTSBIPController( MBTServiceObserver* aObserver, + CBTServiceParameterList* aList ) : + iListPtr( aList ), + iObserverPtr( aObserver ) + + { + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::ConstructL( const TUint aRemotePort, + const TBTDevAddr& aRemoteDeviceAddr ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::ConstructL()")); + + // Add image push target header + // + CObexHeader* header = CObexHeader::NewL(); + CleanupStack::PushL( header ); + header->SetByteSeqL( KBTSUTargetHeader, KBIPImagePushID ); + + RArray headerList; + CleanupClosePushL( headerList ); + headerList.Append( header ); + + CreateClientL ( this, aRemoteDeviceAddr, aRemotePort, headerList ); + + CleanupStack::Pop( 2 ); //header, headerlist + headerList.Close(); + + FLOG(_L("[BTSU]\t CBTSBIPController::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSBIPController* CBTSBIPController::NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDeviceAddr, + CBTServiceParameterList* aList ) + { + CBTSBIPController* self = + new( ELeave ) CBTSBIPController( aObserver, aList ); + CleanupStack::PushL( self ); + self->ConstructL( aRemotePort, aRemoteDeviceAddr ); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CBTSBIPController::~CBTSBIPController() + { + DeleteTempFile( iThumbnailFileName ); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::ConnectCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::ConnectCompleted( TInt aStatus ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::ConnectCompleted()")); + + if ( aStatus == KErrNone ) + { + iFileIndex = 0; + // get remote device capabilities + // + TRAPD( error, GetL() ); + if ( error != KErrNone ) + { + iObserverPtr->ControllerComplete( EBTSGettingFailed ); + } + } + else + { + //Error on Obex level + // + iObserverPtr->ControllerComplete( EBTSConnectingFailed ); + } + + FLOG(_L("[BTSU]\t CBTSBIPController::ConnectCompleted() completed")); + } +// ----------------------------------------------------------------------------- +// CBTSBIPController::ClientConnectionClosed +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::ClientConnectionClosed() + { + FLOG(_L("[BTSU]\t CBTSBIPController::ClientConnectionClosed()")); + + // Everything ready, stop service + // + iObserverPtr->ControllerComplete( EBTSNoError ); + FLOG(_L("[BTSU]\t CBTSBIPController::ClientConnectionClosed() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::PutCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::PutCompleted( TInt aStatus, + const CObexHeaderSet* aPutResponse ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::PutCompleted()")); + + // Remove temporary thumbnail file + // + DeleteTempFile( iThumbnailFileName ); + if ( aStatus == KErrNone ) + { + iFileIndex++; + // Send was ok. Start sending next image + // + TRAPD( error, SendL() ); + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::Send leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed); + } + } + else if ( aStatus == KErrIrObexRespPartialContent ) + { + // Remote device has requested a thumbnail image + // + TRAPD( error, SendThumbnailL(aPutResponse ) ); + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::Send thumbnail leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + } + else + { + // Some error on Obex level + // + iObserverPtr->ControllerComplete( EBTSPuttingFailed); + } + + FLOG(_L("[BTSU]\t CBTSBIPController::PutCompleted() done")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::GetCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::GetCompleted( TInt aStatus, + CObexBufObject* aGetResponse ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::GetCompleted()")); + + if ( aStatus == KErrAbort ) + { + // Connection is cancelled + // + iObserverPtr->ControllerComplete( EBTSGettingFailed ); + } + + else if ( aStatus == KErrNone ) + { + TRAPD( error, HandleGetCompleteIndicationL( aGetResponse ) ); + if ( error != KErrNone ) + { + DeleteTempFile( iTempFileName ); + // Error on capability handling + // + iObserverPtr->ControllerComplete( EBTSGettingFailed ); + } + } + else if( aStatus != KErrAbort && aGetResponse->BytesReceived()==0 ) + { + TRAPD( error,iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ) ); + error=KErrNone; + TRAP(error, SendL() ); + if ( error != KErrNone ) + { + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + } + else if ( aStatus != KErrNone && aGetResponse->BytesReceived()>0 ) + { + // Error on Obex level + // + iObserverPtr->ControllerComplete( EBTSGettingFailed ); + } + + + FLOG(_L("[BTSU]\t CBTSBIPController::GetCompleted() done")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::SendL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::SendL() + { + FLOG(_L("[BTSU]\t CBTSBIPController::SendL()")); + + + if ( iListPtr->ImageCount() > 0 && iFileIndex < iListPtr->ImageCount()) + { + + RArray headerList; + CleanupClosePushL( headerList ); + + // Add Type header + // + CObexHeader* typeHeader = CObexHeader::NewL(); + CleanupStack::PushL( typeHeader ); + typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPImageType ); + headerList.Append( typeHeader ); + + // Add image descriptor + // + HBufC8* imagedescriptor = CreateImageDescriptorL( ); + CleanupStack::PushL( imagedescriptor ); + + CObexHeader* imageDescriptorHeader = CObexHeader::NewL(); + CleanupStack::PushL( imageDescriptorHeader ); + imageDescriptorHeader->SetByteSeqL( KBTSUImgDescriptorHeader, imagedescriptor->Des() ); + headerList.Append( imageDescriptorHeader ); + + // Send image + // + + TBTSUImageParam imageparam = iListPtr->ImageAtL( iFileIndex ); + RBuf filename; + filename.CreateL(256); + CleanupClosePushL(filename); + imageparam.iFile.Name(filename); + + iObserverPtr->UpdateProgressNoteL(imageparam.iFileSize,iFileIndex,filename); + CleanupStack::PopAndDestroy(&filename); + + iListPtr->MarkAsSendL(iFileIndex); + + + iClient->PutObjectL( headerList, imageparam.iFile ); + + + CleanupStack::Pop(4); // headerList, imageDescriptorHeader, typeHeader, imagedescriptor + delete imagedescriptor; + headerList.Close(); + } + else + { + FLOG(_L("[BTSU]\t CBTSBIPController::SendL() all images sent, closing connection")); + + // All images sent, close client connection. + // + iClient->CloseClientConnection(); + } + + FLOG(_L("[BTSU]\t CBTSBIPController::SendL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::GetL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::GetL() + { + FLOG(_L("[BTSU]\t CBTSBIPController::GetL()")); + + RArray headerList; + CleanupClosePushL(headerList); + + // Add capabilities type header + // + CObexHeader* typeHeader = CObexHeader::NewL(); + CleanupStack::PushL( typeHeader ); + typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPCapabilities ); + headerList.Append( typeHeader ); + + // Get capabilities object from remote device + // + iClient->GetObjectL( headerList ); + + CleanupStack::Pop(2); // headerList, typeHeader + headerList.Close(); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::SendThumbnailL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::SendThumbnailL( const CObexHeaderSet *aPutResponse ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::SendThumbnail()")); + + // Create thumbnail for sending + // Delete the created thumbnail on PutComplete + // + + // Fill header array + // + + RArray headerList; + CleanupClosePushL(headerList); + + // Add ImageHandle header + // + CObexHeader* imageHandleHeader = CObexHeader::NewL(); + CleanupStack::PushL( imageHandleHeader ); + + aPutResponse->First(); + User::LeaveIfError(aPutResponse->Find(KBTSUImageHandleHeader, + *imageHandleHeader ) ); + headerList.Append( imageHandleHeader ); + + // Add Type header + // + CObexHeader* typeHeader = CObexHeader::NewL(); + CleanupStack::PushL( typeHeader ); + typeHeader->SetByteSeqL( KBTSUTypeHeader, KBTSBIPThmType ); + headerList.Append( typeHeader ); + + + CreateTempFileL( iThumbnailFileName ); + CBTSUImageConverter* imageConverter = CBTSUImageConverter::NewL(); + CleanupStack::PushL( imageConverter ); + + TBTSUImageParam imgparam = iListPtr->ImageAtL( iFileIndex ); + imageConverter->CreateThumbnailL(imgparam.iFile, iThumbnailFileName ); + + CleanupStack::PopAndDestroy(imageConverter); + + // Add Name header + // + TParse parse; + User::LeaveIfError( parse.Set( iThumbnailFileName, NULL, NULL ) ); + CObexHeader* nameHeader = CObexHeader::NewL(); + CleanupStack::PushL( nameHeader ); + nameHeader->SetUnicodeL( KBTSUNameHeader, parse.NameAndExt() ); + headerList.Append( nameHeader ); + + // send thumbnail + // + iClient->PutObjectL( headerList, iThumbnailFileName ); + + // Cleanup + // + CleanupStack::Pop(4); // headerList, imageHandleHeader, typeHeader, nameHeader + headerList.Close(); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::CreateTempFileL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::CreateTempFileL( TFileName& aFileName ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::CreateTempFileL()")); + + RFs fileSession; + RFile file; + + TBuf privatepath; + TBuf tempPath; + + User::LeaveIfError( fileSession.Connect() ); + CleanupClosePushL( fileSession ); + + User::LeaveIfError(fileSession.CreatePrivatePath(EDriveC)); + User::LeaveIfError(fileSession.PrivatePath(privatepath)); + tempPath.Append(KBTSBIPTempPathDrive()); + tempPath.Append(privatepath); + User::LeaveIfError( file.Temp( fileSession, privatepath, + aFileName, EFileWrite ) ); + + file.Flush(); + file.Close(); + CleanupStack::Pop(); // Close fileSession + fileSession.Close(); + } + + +// ----------------------------------------------------------------------------- +// CBTSBIPController::GenerateTempFileNameL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::GenerateTempFileNameL( TFileName& aFileName ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::GenerateTempFileNameL()")); + + RFs fileSession; + RFile file; + + TBuf privatepath; + TBuf tempPath; + + User::LeaveIfError( fileSession.Connect() ); + CleanupClosePushL( fileSession ); + + User::LeaveIfError(fileSession.CreatePrivatePath(EDriveC)); + User::LeaveIfError(fileSession.PrivatePath(privatepath )); + tempPath.Append(KBTSBIPTempPathDrive()); + tempPath.Append(privatepath); + User::LeaveIfError(file.Temp( fileSession, tempPath, + aFileName, EFileWrite ) ); + + file.Flush(); + file.Close(); + // Delete the file so that only a unique name is created + fileSession.Delete( aFileName ); + CleanupStack::Pop(); // Close fileSession + fileSession.Close(); + } + + +// ----------------------------------------------------------------------------- +// CBTSBIPController::DeleteTempFileL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::DeleteTempFile( TFileName& aFileName ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::DeleteTempFile()")); + + if ( &aFileName != NULL ) + { + if ( aFileName.Length() > 0 ) + { + RFs fileSession; + TInt retVal = fileSession.Connect(); + if (retVal == KErrNone) + { + fileSession.Delete( aFileName ); + } + fileSession.Close(); + } + } + + FLOG(_L("[BTSU]\t CBTSBIPController::DeleteTempFile() complete")); + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::CreateImageDescriptorL +// ----------------------------------------------------------------------------- +// +HBufC8* CBTSBIPController::CreateImageDescriptorL() + { + FLOG(_L("[BTSU]\t CBTSBIPController::CreateImageDescriptorL()")); + + // Example image descriptor of an small jpeg picture + // with size 160*120 pixels and a size of 5000 bytes. + // + // + // + // + TBTSUImageParam param = iListPtr->ImageAtL( iFileIndex ); + + // Add start of image description + // + TBuf8 string( KBTSBIPDescriptorStart ); + + // Add image encoding + // + string.Append( KBTSBIPDescriptorEncoding ); + string.Append( *param.iDisplayName ); + + // Add image pixel size + // + string.Append( KBTSBIPDescriptorPixel ); + string.AppendNum( param.iPixelSize.iWidth ); + string.Append( '*' ); + string.AppendNum( param.iPixelSize.iHeight ); + + // Add image size + // + string.Append( KBTSBIPDescriptorSize ); + string.AppendNum( param.iFileSize ); + + // Add end of image description + // + string.Append( KBTSBIPDescriptorEnd ); + + FLOG(_L("[BTSU]\t CBTSBIPController::CreateImageDescriptorL() completed")); + + return string.AllocL(); + } + + +// ----------------------------------------------------------------------------- +// CBTSBIPController::HandleGetCompleteIndicationL +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::HandleGetCompleteIndicationL( CObexBufObject* aGetResponse ) + { + FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL()")); + + TBool found; + TBool allSupported; + TInt picindex,capindex; + TInt confirm=0; + CBTSUXmlParser* xmlParser = CBTSUXmlParser::NewL(); + CleanupStack::PushL( xmlParser ); + GenerateTempFileNameL( iTempFileName ); + aGetResponse->WriteToFile( iTempFileName ); + aGetResponse->Reset(); + + // Parse capability object and create a list of supported image encodings + // + RArray* remoteCapabilityList = + xmlParser->GetImgCapabilityListL( iTempFileName ); + + // Delete the temp file since we dont need it anymore + // + DeleteTempFile( iTempFileName ); + + // Go through all the images on our sending list and check + // if remote device is capable of receiving those. + // + allSupported= ETrue; + for (picindex=0; picindex< iListPtr->ImageCount(); picindex++ ) + { + found=EFalse; + for (capindex=0; capindex < remoteCapabilityList->Count(); capindex++) + { + //Find first is encoding suported + if((iListPtr->ImageAtL( picindex ).iDisplayName->Compare(*(*remoteCapabilityList)[capindex].iEncoding))==0) + { + found=ETrue; + //Check pixel size + if((*remoteCapabilityList)[capindex].iMinPixelSize.iHeight>=0) + { + if(((*remoteCapabilityList)[capindex].iMaxPixelSize.iWidth < iListPtr->ImageAtL( picindex ).iPixelSize.iWidth) || + ((*remoteCapabilityList)[capindex].iMaxPixelSize.iHeight < iListPtr->ImageAtL( picindex ).iPixelSize.iHeight)|| + ((*remoteCapabilityList)[capindex].iMinPixelSize.iHeight > iListPtr->ImageAtL( picindex ).iPixelSize.iHeight)|| + ((*remoteCapabilityList)[capindex].iMinPixelSize.iWidth > iListPtr->ImageAtL( picindex ).iPixelSize.iWidth) + ) + { + found=EFalse; + } + } + + //Check byte size + if((*remoteCapabilityList)[capindex].iMaxByteSize>=0) + { + if((*remoteCapabilityList)[capindex].iMaxByteSizeImageAtL( picindex ).iFileSize) + { + found=EFalse; + } + } + // If file is supported, stop the loop. + // + if ( found ) + break; + } + } + allSupported = found & allSupported; + } + + for (TInt index=0; index < remoteCapabilityList->Count(); index++) + { + if((*remoteCapabilityList)[index].iEncoding) + { + delete ((*remoteCapabilityList)[index].iEncoding); + } + + } + + remoteCapabilityList->Close(); + delete remoteCapabilityList; + CleanupStack::PopAndDestroy( xmlParser ); + + if(!allSupported && iListPtr->ImageCount() > 1) + { + + confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_MIXED); + + if(confirm==EAknSoftkeyYes) + { + // Everything went ok. Start sending images + // + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ); + + // Start sending images + // + SendL(); + } + + + } + else if ( !allSupported && iListPtr->ImageCount() == 1) + { + // We allow user to choose wheather to send the image file which is not supported on target device + // Original codeline: iObserverPtr->ControllerComplete( EBTSBIPOneNotSend ); + confirm=iObserverPtr->LaunchConfirmationQuery(R_BT_NOT_SEND_ALL_QUERY_SINGLE); + + if(confirm==EAknSoftkeyYes) + { + // Everything went ok. Start sending the images + // + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize(),iListPtr->ImageCount() ); + + // Start sending images + // + SendL(); + } + } + else if( allSupported ) + { + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageListSize() + iListPtr->ObjectListSizeL(),iListPtr->ImageCount() + iListPtr->ObjectCount()); + + // Start sending images + // + SendL(); + } + + + FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL() #3")); + } + + +//----------------------------------------------------------------------------- +// void CBTSBIPController::ConnectTimedOut() +// ----------------------------------------------------------------------------- +// +void CBTSBIPController::ConnectTimedOut() + { + iObserverPtr->ConnectTimedOut(); + } + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,422 @@ +/* +* Copyright (c) 2002 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: Basic printing profile implementation +* +*/ + + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSBPPController.h" +#include "BTSUDebug.h" + +#include +#include +#include + +// CONSTANTS +_LIT8( KBTSDirectPrintingUUID, "\x00\x00\x11\x18\x00\x00\x10\x00\x80\x00\x00\x80\x5F\x9B\x34\xFB" ); +_LIT8( KBTSXHTMLPrintType, "application/vnd.pwg-xhtml-print+xml\0" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBPPController::CBTSBPPController +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSBPPController::CBTSBPPController( MBTServiceObserver* aObserver, + const CBTServiceParameterList* aList ) : + iServerState( EBTSBPPSrvIdle ), + iClientDone( EFalse ), + iObserverPtr( aObserver ), + iListPtr( aList ) + { + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ConstructL( const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + CBTEngDiscovery* aBTConnectionPtr ) + { + FLOG(_L("[BTSU]\t CBTSBPPController::ConstructL()")); + + // Create an array of obex headers + // + RArray headers; + CleanupClosePushL( headers ); + + CObexHeader* targetHdr = CObexHeader::NewL(); + CleanupStack::PushL( targetHdr ); + targetHdr->SetByteSeqL( KBTSUTargetHeader, KBTSDirectPrintingUUID ); + headers.Append( targetHdr ); + + // Create obex client + // + CreateClientL ( this, aRemoteDevice, aRemotePort, headers ); + + CleanupStack::Pop( 2 ); // targetHdr, headers + headers.Close(); + + // Start the object server if there were referenced objects + // + if ( iListPtr->HasAnyReferencedObjects() ) + { + iServer = CBTSBPPObjectServer::NewL( this, + aBTConnectionPtr, + aRemoteDevice ); + } + + FLOG(_L("[BTSU]\t CBTSBPPController::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSBPPController* CBTSBPPController::NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDevice, + const CBTServiceParameterList* aList, + CBTEngDiscovery* aBTConnectionPtr ) + { + CBTSBPPController* self = new( ELeave ) CBTSBPPController( aObserver, aList ); + CleanupStack::PushL( self ); + self->ConstructL( aRemoteDevice, aRemotePort, aBTConnectionPtr ); + CleanupStack::Pop(self); + return self; + } + + +// Destructor +CBTSBPPController::~CBTSBPPController() + { + if ( iServer ) + { + delete iServer; + iServer = NULL; + } + if ( iServerWait ) + { + delete iServerWait; + iServerWait = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ConnectCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ConnectCompleted( TInt aStatus ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::ConnectCompleted() %d"), aStatus )); + + if ( aStatus ) + { + // The connect operation failed. + // + iObserverPtr->ControllerComplete( EBTSConnectingFailed ); + } + else + { + TRAPD( error, SelectAndSendL() ); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + } + + FLOG(_L("[BTSU]\t CBTSBPPController::ConnectCompleted() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::PutCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::PutCompleted( TInt aStatus, const CObexHeaderSet* /*aPutResponse*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPController::PutCompleted()")); + + if ( aStatus ) + { + // The put operation failed. + // + iObserverPtr->ControllerComplete( aStatus ); + } + else + { + iClientDone = ETrue; + + if ( iServer == NULL || // Server was not needed at all or + !iServer->HasReferencedObjects() || // no referenced objects in current file or + iServerState == EBTSBPPSrvDone ) // server is done. + { + // Object sent and server done, check if there are + // more files to send. + // + TRAPD( error, SelectAndSendL() ); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + } + else if ( iServerState == EBTSBPPSrvIdle ) + { + __ASSERT_DEBUG( iServerWait == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + + // Object sent but server isn't serving yet. + // Wait for a connection attempt. + // + + TRAPD(error, iServerWait = CBTSBPPServerWait::NewL( this )); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPServerWait::NewL() leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + + } + } + + FLOG(_L("[BTSU]\t CBTSBPPController::PutCompleted() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::GetCompleted +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::GetCompleted( TInt /*aStatus*/, CObexBufObject* /*aGetResponse*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPController::GetCompleted() ERROR: unsolicited callback")); + __ASSERT_DEBUG( EFalse, BTSUPanic( EBTSUPanicInternalError ) ); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ClientConnectionClosed +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ClientConnectionClosed() + { + FLOG(_L("[BTSU]\t CBTSBPPController::ClientConnectionClosed()")); + + // Everything is now ready. + // + iObserverPtr->ControllerComplete( EBTSNoError ); + + FLOG(_L("[BTSU]\t CBTSBPPController::ClientConnectionClosed() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ServerError +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ServerError( TInt aError ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::ServerError() %d"), aError ) ); + + // Mark server as ready and if client is ready, complete the controller. + // + iServerState = EBTSBPPSrvDone; + + if ( iClientDone ) + { + iObserverPtr->ControllerComplete( aError ); + } + else + { + // Server ready, no need to wait anymore + // + if ( iServerWait ) + { + delete iServerWait; + iServerWait = NULL; + } + } + + FLOG(_L("[BTSU]\t CBTSBPPController::ServerError() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ServerConnectionEstablished +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ServerConnectionEstablished() + { + FLOG(_L("[BTSU]\t CBTSBPPController::ServerConnectionEstablished()")); + + iServerState = EBTSBPPSrvServing; + + if ( iServerWait ) + { + // The wait for server connection can now be stopped. + // + delete iServerWait; + iServerWait = NULL; + } + + FLOG(_L("[BTSU]\t CBTSBPPController::ServerConnectionEstablished() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::ServerConnectionClosed +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ServerConnectionClosed() + { + FLOG(_L("[BTSU]\t CBTSBPPController::ServerConnectionClosed()")); + + iServerState = EBTSBPPSrvDone; + + if ( iClientDone ) + { + // The client was waiting for server, but now another object + // can be sent. + // + TRAPD( error, SelectAndSendL() ); + + if ( error ) + { + iObserverPtr->ControllerComplete( error ); + } + } + + FLOG(_L("[BTSU]\t CBTSBPPController::ServerConnectionClosed() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::WaitComplete +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::WaitComplete() + { + FLOG(_L("[BTSU]\t CBTSBPPController::WaitComplete()")); + + // For some reason the printer didn't establish server connection although + // there were referenced objects + // + if ( iServerWait ) + { + delete iServerWait; + iServerWait = NULL; + } + + // The client was waiting for server, but now another object + // can be sent. + // + TRAPD( error, SelectAndSendL() ); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + + FLOG(_L("[BTSU]\t CBTSBPPController::WaitComplete() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPController::SelectAndSendL +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::SelectAndSendL() + { + FLOG(_L("[BTSU]\t CBTSBPPController::SelectAndSendL()")); + + TBTSUXhtmlParam param; + param.iFileName = NULL; + param.iRefObjectList = NULL; + + if ( iListPtr->XhtmlCount() > 0 && iSendIndex < iListPtr->XhtmlCount() ) + { + // Get next xhtml parameter + // + param = iListPtr->XhtmlAt( iSendIndex ); + iSendIndex++; + } + + if ( param.iFileName != NULL ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() fileName='%S'"), param.iFileName )); + + if ( iServer ) + { + // Pass the list of referenced objects in the file to object server. + // + iServer->SetReferencedObjectList( param.iRefObjectList ); + } + + // Create an array of obex headers + // + RArray headers; + CleanupClosePushL( headers ); + + CObexHeader* typeHdr = CObexHeader::NewL(); + CleanupStack::PushL( typeHdr ); + typeHdr->SetByteSeqL( KBTSUTypeHeader, KBTSXHTMLPrintType ); + headers.Append( typeHdr ); + + // Send object. + // + iClient->PutObjectL( headers, *param.iFileName ); + + CleanupStack::Pop( 2 ); // typeHdr, headers + headers.Close(); + + // A new object is being sent. Reset states. + // + iClientDone = EFalse; + iServerState = EBTSBPPSrvIdle; + } + else + { + FLOG(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() all objects sent, closing connection")); + + // All objects sent, close client connection. + // + iClient->CloseClientConnection(); + } + + FLOG(_L("[BTSU]\t CBTSBPPController::SelectAndSendL() completed")); + } + +//----------------------------------------------------------------------------- +// void CBTSBPPController::ResetFileHandleL +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ResetFileHandleL() + { + } + +//----------------------------------------------------------------------------- +// void CBTSBPPController::ConnectTimedOut() +// ----------------------------------------------------------------------------- +// +void CBTSBPPController::ConnectTimedOut() + { + iObserverPtr->ConnectTimedOut(); + } +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectRequest.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,481 @@ +/* +* Copyright (c) 2002 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: GetReferencedObjects -operation implementation +* +*/ + + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSBPPObjectRequest.h" +#include "BTSUDataConverter.h" +#include "BTSUImageConverter.h" +#include "BTSUDebug.h" + +#include // RFile +#include // RBufWriteStream +#include // RFileReadStream + +// CONSTANTS +const TInt KBTSBPPFileSizeNotSet = 0; +const TInt KBTSBPPFileSizeRequested = 1; +const TInt KBTSBPPFileSizeUnknown = -1; +const TInt KBTSBPPRestOfTheFileRequested = -1; + +// The field lengths of Application Parameters -header in bytes +// +const TInt KBTSBPPFieldTag = 1; +const TInt KBTSBPPFieldLength = 1; +const TInt KBTSBPPValue = 4; +const TInt KBTSBPPAppParamLength = KBTSBPPFieldTag + KBTSBPPFieldLength + KBTSBPPValue; + +_LIT8(KBTSBPPRefObjectOper, "x-obex/referencedobject\0"); + +static const TUint8 KBTSBPPFileSizeTag = 0x04; +static const TUint8 KBTSBPPFileSizeLength = 0x04; + +// MODULE DATA STRUCTURES +enum KBTSBPPAppParamTags + { + KBTSBPPTagOffset = 1, + KBTSBPPTagCount, + KBTSBPPTagJobId, // used only in JobBased-printing + KBTSBPPTagFileSize + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CBTSBPPObjectRequest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSBPPObjectRequest::CBTSBPPObjectRequest( CObexBaseObject* aGetOperation, + const CDesCArray* aRefObjectList ) : iRequest( aGetOperation ), + iObjectList( aRefObjectList ) + { + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::ConstructL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ConstructL()")); + + User::LeaveIfError( iFileSession.Connect() ); + + // Check the validity of the operation and it's paramters. + // + CheckGetRequestL(); + + // Execute any tasks needed and create the requested object. + // + ExecuteGetRequestL(); + + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSBPPObjectRequest* CBTSBPPObjectRequest::NewL( CObexBaseObject* aGetOperation, + const CDesCArray* aRefObjectList ) + { + CBTSBPPObjectRequest* self = new( ELeave ) CBTSBPPObjectRequest( aGetOperation, + aRefObjectList ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// Destructor +CBTSBPPObjectRequest::~CBTSBPPObjectRequest() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::~CBTSBPPObjectRequest()")); + iFileSession.Close(); + + delete iResponse; + delete iResponseBuffer; + + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::~CBTSBPPObjectRequest() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::GetResponse +// ----------------------------------------------------------------------------- +// +CObexBufObject* CBTSBPPObjectRequest::GetResponse() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::GetResponse()")); + return iResponse; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CheckGetRequestL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::CheckGetRequestL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckGetRequestL()")); + + CheckTypeHeaderL(); + CheckNameHeaderL(); + CheckAppParamsHeaderL(); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CheckTypeHeaderL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::CheckTypeHeaderL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL()")); + + __ASSERT_DEBUG( iRequest, BTSUPanic( EBTSUPanicNullPointer ) ); + + const TDesC8& typeHeader = iRequest->Type(); + + if ( typeHeader.Length() == 0 ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL() ERROR, no type header")); + User::Leave( KErrNotFound ); + } + else if ( typeHeader.Length() > KBTSUMaxStringLength ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL() ERROR, type header too long")); + User::Leave( KErrTooBig ); + } + else + { + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL() type header '%S'"), &typeHeader )); + // The only supported operation is GetReferencedObjects + // + if ( typeHeader != KBTSBPPRefObjectOper() ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL() ERROR, unsupported operation")); + User::Leave( KErrNotSupported ); + } + } + + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckTypeHeaderL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CheckNameHeaderL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::CheckNameHeaderL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckNameHeaderL()")); + + __ASSERT_DEBUG( iRequest, BTSUPanic( EBTSUPanicNullPointer ) ); + + const TDesC& nameHeader = iRequest->Name(); + + if ( nameHeader.Length() == 0 ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckNameHeaderL() ERROR, no name header")); + User::Leave( KErrNotFound ); + } + else + { + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckNameHeaderL() filename '%S'"), &nameHeader )); + + // Check are we allowed to send this file + // + TInt dummy; + if ( iObjectList->Find( nameHeader, dummy ) != KBTSUEqualStrings ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckNameHeaderL() ERROR, the asked object is not referenced in the document")); + User::Leave( KErrPermissionDenied ); + } + + iRequestParams.iName = &nameHeader; + } + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CheckAppParamsHeaderL +// +// This method expects a Tag-Length-Value format. The method is as defensive +// as possible, for example unknown or illegal values are discarded. +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::CheckAppParamsHeaderL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL()")); + + __ASSERT_DEBUG( iRequest, BTSUPanic( EBTSUPanicNullPointer ) ); + + TPtrC8 header( iRequest->AppParam() ); + + if ( header.Length() == 0 ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() ERROR, no AppParam header")); + User::Leave( KErrNotFound ); + } + else if ( header.Length() < KBTSBPPAppParamLength * 2) + { + // There has to be at least offset and count -parameters. + // + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() ERROR, incomplete AppParam header")); + User::Leave( KErrArgument ); + } + else + { + // Parse the header + // + while( header.Length() >= KBTSBPPAppParamLength ) + { + // Extract tag number and remove it from the header + // + TInt tagNumber = TBTSUDataConverter::ConvertByteL( + header.Left( KBTSBPPFieldTag ) ); + header.Set( header.Mid( KBTSBPPFieldTag ) ); + + // Extract value length and remove it from the header + // + TInt valueLength = TBTSUDataConverter::ConvertByteL( + header.Left( KBTSBPPFieldLength ) ); + header.Set( header.Mid( KBTSBPPFieldLength ) ); + + if ( valueLength != KBTSBPPValue ) + { + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() WARNING, illegal length %d"), valueLength )); + valueLength = KBTSBPPValue; + // This is an interesting choice of what to do, I would argue that for future compatibility you'll probably want to accept the length + // provided as it might be for a new tag that is not yet published. (Checking of the size for known tags is handled by the conversion + // functions anyway). + // So, in summary I wouldn't change valueLength from what it is in the payload. But I've left it in for now in case it was added for + // interoperability reasons with some existing device. + } + + // Extract value... + // + switch ( tagNumber ) + { + case KBTSBPPTagOffset: + { + iRequestParams.iOffset = + TBTSUDataConverter::ConvertDataUnsignedL( + header.Left( valueLength ) ); + + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() offset '%d'"), iRequestParams.iOffset )); + break; + } + case KBTSBPPTagCount: + { + iRequestParams.iCount = + TBTSUDataConverter::ConvertDataSignedL( + header.Left( valueLength ) ); + + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() count '%d'"), iRequestParams.iCount )); + break; + } + case KBTSBPPTagFileSize: + { + // The value is not interesting, we just need to know whether + // the parameter was received (and thus requested) + // + iRequestParams.iOffset = KBTSBPPFileSizeRequested; + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ParseHeadersL() fileSize parameter received")); + break; + } + + case KBTSBPPTagJobId: + default: + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() WARNING, illegal tag")); + break; + } + } + + // ...and remove it from the header + // + header.Set( header.Mid( valueLength ) ); + } + } + + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CheckAppParamsHeaderL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::ExecuteGetRequestL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::ExecuteGetRequestL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ExecuteGetRequestL()")); + + // If iCount is 0, an empty body will be sent + // + if ( iRequestParams.iCount != 0 ) + { + ResolveGetRequestL(); + ReadFileToBufferL(); + } + + CreateResponseObjectL(); + + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ExecuteGetRequestL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::ResolveGetRequestL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::ResolveGetRequestL() + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::ResolveGetRequestL()")); + + // Get the file size + // + RFile file; + TInt size = 0; + User::LeaveIfError( file.Open( iFileSession, *iRequestParams.iName, + EFileShareReadersOnly | EFileStream ) ); + + TInt error = file.Size( size ); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::ResolveGetRequestL() error %d in getting the size"), error ) ); + size = KBTSBPPFileSizeUnknown; + } + + file.Close(); + + // Store the file size if it was requested + // + if ( iRequestParams.iFileSize == KBTSBPPFileSizeRequested ) + { + iRequestParams.iFileSize = size; + } + + // Resolve the actual amount of data that needs to be read. + // + TInt dataLeft = size - iRequestParams.iOffset; + + if ( iRequestParams.iCount == KBTSBPPRestOfTheFileRequested ) + { + if ( size == KBTSBPPFileSizeUnknown ) + { + // The size of the file is unknown, so read as much + // as would fit into the buffer + // + iRequestParams.iCount = KBTSUDataBufferMaxSize; + } + else + { + // The rest of the file is requested, so correct the count + // + iRequestParams.iCount = dataLeft; + } + } + else if ( iRequestParams.iCount > dataLeft ) + { + // There is less data left that was requested, so correct the count + // + iRequestParams.iCount = dataLeft; + } + + if ( iRequestParams.iCount > KBTSUDataBufferMaxSize ) + { + // The requested count is too big + // + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::ResolveGetRequestL() iCount too big %d"), iRequestParams.iCount ) ); + User::Leave( KErrTooBig ); + } + + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::ResolveGetRequestL() completed, requested %d bytes"), iRequestParams.iCount ) ); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::ReadFileToBufferL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::ReadFileToBufferL() + { + __ASSERT_DEBUG( !iResponseBuffer, BTSUPanic( EBTSUPanicExistingObject ) ); + + // Create a buffer for the object and reserve space according to the request + // + iResponseBuffer = CBufFlat::NewL( KBTSUDataBufferExpandSize ); + iResponseBuffer->SetReserveL( iRequestParams.iCount ); + iResponseBuffer->ResizeL( iRequestParams.iCount ); + + // Open the file + // + RFile file; + User::LeaveIfError( file.Open( iFileSession, *iRequestParams.iName, + EFileShareReadersOnly | EFileStream ) ); + CleanupClosePushL( file ); + + // Create a stream for reading from the file + // + RFileReadStream readStream( file, iRequestParams.iOffset ); + + // Create a stream for writing into the buffer + // + RBufWriteStream writeStream( *iResponseBuffer ); + + // Read the data from file to the buffer + // + readStream.ReadL( writeStream, iRequestParams.iCount ); + + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::ReadFileToBufferL() space reserved '%d'"), iRequestParams.iCount )); + FTRACE(FPrint(_L("[BTSBPP]\t CBTSBPPObjectRequest::ReadFileToBufferL() data read '%d'"), iResponseBuffer->Size() )); + + CleanupStack::PopAndDestroy(&file); + } + + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectRequest::CreateResponseObjectL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectRequest::CreateResponseObjectL() + { + __ASSERT_DEBUG( iResponseBuffer || (iRequestParams.iCount == 0), BTSUPanic( EBTSUPanicNoBufferEvenThoughCountNotZero ) ); + __ASSERT_DEBUG( !iResponse, BTSUPanic( EBTSUPanicResponseAlreadyPresent ) ); + + // Create the OBEX response object using the buffer already created (or no buffer if appropriate) + // + iResponse = CObexBufObject::NewL( iResponseBuffer ); + + // Generate FileSize parameter if requested + // + if ( iRequestParams.iFileSize != KBTSBPPFileSizeNotSet ) + { + FLOG(_L("[BTSBPP]\t CBTSBPPObjectRequest::CreateResponseObjectL() generate file size param")); + TBuf8 params; + params.SetMax(); + TUint8* ptr = const_cast(params.Ptr()); + *ptr++ = KBTSBPPFileSizeTag; + *ptr++ = KBTSBPPFileSizeLength; + BigEndian::Put32(ptr, *reinterpret_cast(&iRequestParams.iFileSize)); // reinterpret cast to retain signed nature... + iResponse->SetAppParamL( params ); + } + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectServer.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,372 @@ +/* +* Copyright (c) 2002 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: Server part of basic printing profile +* +*/ + + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSBPPObjectServer.h" +#include "BTSBPPObjectRequest.h" +#include "BTSUDebug.h" + +// CONSTANTS +const TInt KBTSBPPObjectChannelStart = 15; // Start looking for free RFCOMM channel +const TInt KBTSBPPObjectChannelStop = 30; // Last free RFCOMM channel + +_LIT8( KBTSBPPReferencedObjectsUUID, "\x00\x00\x11\x20\x00\x00\x10\x00\x80\x00\x00\x80\x5F\x9B\x34\xFB" ); + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::CBTSBPPObjectServer +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSBPPObjectServer::CBTSBPPObjectServer( + MBTSBPPObjectServerObserver* aObserver, CBTEngDiscovery* aBTEngDiscoveryPtr, + const TBTDevAddr& aExpectedClient ) : iExpectedClientPtr( &aExpectedClient ), + iBTEngDiscoveryPtr( aBTEngDiscoveryPtr ), + iObserverPtr( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::ConstructL() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ConstructL()")); + + __ASSERT_DEBUG( iObserverPtr != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + __ASSERT_DEBUG( iBTEngDiscoveryPtr != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + __ASSERT_DEBUG( iExpectedClientPtr != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + + TObexBluetoothProtocolInfo info; + info.iTransport = KBTSProtocol; + + iObjectChannel = KBTSBPPObjectChannelStart; + for ( ; iObjectChannel < KBTSBPPObjectChannelStop; iObjectChannel++ ) + { + // Register security settings + // + TBTServiceSecurity sec; + sec.SetAuthentication( EFalse ); + sec.SetAuthorisation( EFalse ); + sec.SetEncryption( EFalse ); + + info.iAddr.SetSecurity( sec ); + info.iAddr.SetPort( iObjectChannel ); + + // Try to start Obex Server on selected channel + // + TRAPD( error, iServer = CObexServer::NewL ( info ) ); + + if ( !error ) + { + error = iServer->Start( this ); + + if ( !error ) + { + // Initialize server + // + iServer->SetCallBack( *this ); + User::LeaveIfError ( iServer->SetLocalWho( KBTSBPPReferencedObjectsUUID ) ); + + // Register SDP settings + // + User::LeaveIfError ( iBTEngDiscoveryPtr->RegisterSdpRecord( + TUUID(KBTSdpBasicPrinting), iObjectChannel, iSDPHandle )); + + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPObjectServer::ConstructL() services running on channel %d"), iObjectChannel )); + break; + } + else + { + // Failed to start Obex server. Delete server and try again + // + delete iServer; + iServer = NULL; + } + } + } + + if ( !iServer ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ConstructL() ERROR, server did not start.")); + User::Leave( KErrGeneral ); + } + + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSBPPObjectServer* CBTSBPPObjectServer::NewL( + MBTSBPPObjectServerObserver* aObserver, CBTEngDiscovery* aBTEngDiscoveryPtr, + const TBTDevAddr& aExpectedClient ) + { + CBTSBPPObjectServer* self = new( ELeave ) + CBTSBPPObjectServer( aObserver, aBTEngDiscoveryPtr, aExpectedClient ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// Destructor +CBTSBPPObjectServer::~CBTSBPPObjectServer() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::~CBTSBPPObjectServer()")); + + if ( iServer ) + { + iServer->Stop(); + delete iServer; + iServer = NULL; + } + + delete iObjectRequest; + //delete iPasskeyRequest; + + if ( iBTEngDiscoveryPtr ) + { + iBTEngDiscoveryPtr->DeleteSdpRecord( iSDPHandle ); + } + + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::~CBTSBPPObjectServer() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::SetReferencedObjectList +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::SetReferencedObjectList( const CDesCArray* aRefObjectList ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::SetReferencedObjectList()")); + + __ASSERT_DEBUG( aRefObjectList != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + + iObjectListPtr = aRefObjectList; + + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::SetReferencedObjectList() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::HasReferencedObjects +// ----------------------------------------------------------------------------- +// +TBool CBTSBPPObjectServer::HasReferencedObjects() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::HasReferencedObjects()")); + __ASSERT_DEBUG( iObjectListPtr != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + + return iObjectListPtr->MdcaCount() > 0; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::GetUserPasswordL +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::GetUserPasswordL( const TDesC& /*aRealm*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::GetUserPasswordL() NOT NEEDED")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::ErrorIndication +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::ErrorIndication( TInt aError ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPObjectServer::ErrorIndication() error %d"), aError )); + + iObserverPtr->ServerError( aError ); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::TransportUpIndication +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::TransportUpIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::TransportUpIndication()")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::TransportDownIndication +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::TransportDownIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::TransportDownIndication()")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::ObexConnectIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::ObexConnectIndication( + const TObexConnectInfo& /*aRemoteInfo*/, const TDesC8& /*aInfo*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ObexConnectIndication()")); + + TInt error = KErrAccessDenied; + + // Check that remote device is the expected one. + // + TBTSockAddr remoteAddr; + iServer->RemoteAddr( remoteAddr ); + if ( remoteAddr.BTAddr() == *iExpectedClientPtr ) + { + error = KErrNone; + iObserverPtr->ServerConnectionEstablished(); + } + + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPObjectServer::ObexConnectIndication() completed with %d"), error )); + return error; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::ObexDisconnectIndication +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::ObexDisconnectIndication( const TDesC8& /*aInfo*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ObexDisconnectIndication()")); + + iObserverPtr->ServerConnectionClosed(); + + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::ObexDisconnectIndication() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::PutRequestIndication +// ----------------------------------------------------------------------------- +// +CObexBufObject* CBTSBPPObjectServer::PutRequestIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::PutRequestIndication()")); + + return NULL; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::PutPacketIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::PutPacketIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::PutPacketIndication()")); + + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::PutCompleteIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::PutCompleteIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::PutCompleteIndication()")); + + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::GetRequestIndication +// ----------------------------------------------------------------------------- +// +CObexBufObject* CBTSBPPObjectServer::GetRequestIndication( + CObexBaseObject* aRequiredObject ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::GetRequestIndication()")); + __ASSERT_DEBUG( iObjectRequest == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + + TInt error = KErrNone; + CObexBufObject* object = NULL; + + TRAP( error, iObjectRequest = CBTSBPPObjectRequest::NewL( aRequiredObject, iObjectListPtr ) ); + + if ( !error ) + { + object = iObjectRequest->GetResponse(); + } + + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPObjectServer::GetRequestIndication() completed with %d"), error ) ); + + return object; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::GetPacketIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::GetPacketIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::GetPacketIndication()")); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::GetCompleteIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::GetCompleteIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::GetCompleteIndication()")); + + delete iObjectRequest; + iObjectRequest = NULL; + + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::GetCompleteIndication() completed")); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::SetPathIndication +// ----------------------------------------------------------------------------- +// +TInt CBTSBPPObjectServer::SetPathIndication( const CObex::TSetPathInfo& /*aPathInfo*/, + const TDesC8& /*aInfo*/ ) + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::SetPathIndication()")); + + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CBTSBPPObjectServer::AbortIndication +// ----------------------------------------------------------------------------- +// +void CBTSBPPObjectServer::AbortIndication() + { + FLOG(_L("[BTSU]\t CBTSBPPObjectServer::AbortIndication()")); + + iObserverPtr->ServerError( KErrCancel ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPServerWait.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPServerWait.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002 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: Waiter class implementation +* +*/ + + + +// INCLUDE FILES +#include "BTSBPPServerWait.h" +#include "BTServiceUtils.h" +#include "BTSUDebug.h" + +// CONSTANTS +const TInt KBTSBPPWaitTime = 120000000; // 2 minutes + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBPPServerWait::CBTSBPPServerWait +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSBPPServerWait::CBTSBPPServerWait( MBTSBPPServerWaitObserver* aObserver ) : + CTimer( EPriorityStandard ), iObserver( aObserver ) + + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPServerWait::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSBPPServerWait::ConstructL() + { + FLOG(_L("[BTSU]\t CBTSBPPServerWait::ConstructL()")); + + CTimer::ConstructL(); + After( TTimeIntervalMicroSeconds32( KBTSBPPWaitTime ) ); + + FLOG(_L("[BTSU]\t CBTSBPPServerWait::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPServerWait::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSBPPServerWait* CBTSBPPServerWait::NewL( MBTSBPPServerWaitObserver* aObserver ) + { + CBTSBPPServerWait* self = new( ELeave ) CBTSBPPServerWait( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// Destructor +CBTSBPPServerWait::~CBTSBPPServerWait() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CBTSBPPServerWait::RunL +// ----------------------------------------------------------------------------- +// +void CBTSBPPServerWait::RunL() + { + FTRACE(FPrint(_L("[BTSU]\t CBTSBPPServerWait::RunL() status %d"), iStatus.Int() ) ); + __ASSERT_DEBUG( iObserver != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + + iObserver->WaitComplete(); + + FLOG(_L("[BTSU]\t CBTSBPPServerWait::RunL() completed")); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,74 @@ +/* +* 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: ?Description +* +*/ + + + + +#include "BTSBIPController.h" +#include "BTServiceClient.h" +#include "BTSUDebug.h" + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CBTSController::CBTSController() + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTSController::~CBTSController() + { + FLOG(_L("[BTSU]\t CBTSController::Destructor()")); + delete iClient; + } + +// --------------------------------------------------------------------------- +// CBTSController::Abort +// --------------------------------------------------------------------------- +// +void CBTSController::Abort() + { + FLOG(_L("[BTSU]\t CBTSController::Abort")); + if ( iClient ) + { + iClient->Abort(); + } + FLOG(_L("[BTSU]\t CBTSController::Abort")); + } + +// --------------------------------------------------------------------------- +// CBTSController::Abort +// --------------------------------------------------------------------------- +// +void CBTSController::CreateClientL(MBTServiceClientObserver* aObserver, + const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ) + { + FLOG(_L("[BTSU]\t CBTSController::CreateClient")); + iClient = CBTServiceClient::NewL( aObserver, aRemoteDevice, aRemotePort, aHeaderList ); + FLOG(_L("[BTSU]\t CBTSController::Abort")); + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2002 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: Object push controller implementation +* +*/ + + + +// INCLUDE FILES +#include "BTSOPPController.h" +#include "BTSUDebug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSOPPController::CBTSOPPController +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSOPPController::CBTSOPPController( MBTServiceObserver* aObserver, + CBTServiceParameterList* aList ) : + iListPtr( aList ), + iObserverPtr( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::ConstructL( const TUint aRemotePort, const TBTDevAddr& aRemoteDeviceAddr ) + { + FLOG(_L("[BTSS]\t CBTSOPPController::ConstructL()")); + + RArray headerList; + CleanupClosePushL( headerList ); + CreateClientL ( this, aRemoteDeviceAddr, aRemotePort, headerList ); + CleanupStack::Pop(); + headerList.Close(); + + FLOG(_L("[BTSS]\t CBTSOPPController::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSOPPController* CBTSOPPController::NewL( MBTServiceObserver* aObserver, + const TUint aRemotePort, + const TBTDevAddr& aRemoteDeviceAddr, + CBTServiceParameterList* aList ) + { + CBTSOPPController* self = new( ELeave ) CBTSOPPController( aObserver, aList ); + CleanupStack::PushL( self ); + self->ConstructL( aRemotePort, aRemoteDeviceAddr ); + CleanupStack::Pop(); + return self; + } + +// Destructor +CBTSOPPController::~CBTSOPPController() + { + FLOG(_L("[BTSU]\t CBTSOPPController::Destructor()")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::ConnectCompleted +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::ConnectCompleted( TInt aStatus ) + { + FLOG(_L("[BTSS]\t CBTSOPPController::ConnectCompleted()")); + + if ( aStatus == KErrNone ) + { + TRAPD( error, HandleConnectCompleteIndicationL() ); + if ( error != KErrNone ) + { + // Sending initialisation has failed + // + iObserverPtr->ControllerComplete( EBTSConnectingFailed ); + } + } + else + { + //Error on Obex level + // + iObserverPtr->ControllerComplete( EBTSConnectingFailed ); + } + + FLOG(_L("[BTSS]\t CBTSOPPController::ConnectCompleted() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::ClientConnectionClosed +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::ClientConnectionClosed() + { + FLOG(_L("[BTSS]\t CBTSOPPController::ClientConnectionClosed()")); + + // Everything ready, stop service + // + iObserverPtr->ControllerComplete( EBTSNoError ); + + FLOG(_L("[BTSS]\t CBTSOPPController::ClientConnectionClosed() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::PutCompleted +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::PutCompleted( TInt aStatus, const CObexHeaderSet* aPutResponse ) + { + FLOG(_L("[BTSS]\t CBTSOPPController::PutCompleted()")); + aPutResponse=aPutResponse; + + + if ( aStatus == KErrNone ) + { + iFileIndex++; + Send(); + } + else + { + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + + FLOG(_L("[BTSS]\t CBTSOPPController::PutCompleted() done")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::GetCompleted +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::GetCompleted( TInt /*aStatus*/, CObexBufObject* /*aGetResponse*/ ) + { + FLOG(_L("[BTSS]\t CBTSOPPController::GetCompleted() Not used with OPP")); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::Send +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::Send() + { + FLOG(_L("[BTSS]\t CBTSOPPController::Send()")); + + TInt error(KErrNone); + + if ( iListPtr->ObjectCount() > 0 && iFileIndex < iListPtr->ObjectCount() ) + { + RArray headerList; // the array does not need to be closed + + TRAP( error, { + UpdateProgressNoteL(); + iClient->PutObjectL( headerList, iListPtr->ObjectAtL( iFileIndex )); }); + + if ( error ) + { + FTRACE(FPrint(_L("[BTSU]\t CBTSOPPController::Send() putting leaved with %d"), error )); + iObserverPtr->ControllerComplete( EBTSPuttingFailed ); + } + } + else + { + FLOG(_L("[BTSU]\t CBTSOPPController::Send() all objects sent, closing connection")); + + // All objects sent, close client connection. + // + iClient->CloseClientConnection(); + } + + FLOG(_L("[BTSS]\t CBTSOPPController::Send() Done")); + } + +//----------------------------------------------------------------------------- +// void CBTSOPPController::ConnectTimedOut() +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::ConnectTimedOut() + { + iObserverPtr->ConnectTimedOut(); + } + +// ----------------------------------------------------------------------------- +// CBTSOPPController::HandleConnectCompleteIndicationL +// ----------------------------------------------------------------------------- +// +void CBTSOPPController::HandleConnectCompleteIndicationL() + { + FLOG(_L("[BTSS]\t CBTSOPPController::HandleConnectCompleteIndicationL()")); + TBTSUImageParam imgparam; + if ( iListPtr->ImageCount() > 0 ) + { + for( TInt index = 0; index < iListPtr->ImageCount(); index++ ) + { + // Copy files from Image list to Object list + // from now on we use only object list. + imgparam = iListPtr->ImageAtL( index ); + if(!imgparam.iSend) + { + iListPtr->AddObjectL( imgparam.iFile); + } + } + } + iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ObjectListSizeL(),iListPtr->ObjectCount() ); + iFileIndex = 0; + UpdateProgressNoteL(); + Send(); + } + + +void CBTSOPPController::UpdateProgressNoteL() + { + TInt size; + RBuf filename; + iListPtr->ObjectAtL( iFileIndex ).Size(size); + filename.CreateL(255); + iListPtr->ObjectAtL( iFileIndex ).Name(filename); + iObserverPtr->UpdateProgressNoteL(size,iFileIndex,filename); + filename.Close(); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSProgresstimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSProgresstimer.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "BTSProgresstimer.h" +#include "BTServiceStarter.h" +#include "BTSUDebug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSProgressTimer::CBTSProgressTimer( MBTServiceObserver* aProgressObserverPtr) + : CTimer( EPriorityLow ), + iProgressObserverPtr( aProgressObserverPtr ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::ConstructL +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSProgressTimer::ConstructL() + { + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::ConstructL()")); + + CTimer::ConstructL(); + + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::NewL +// ----------------------------------------------------------------------------- + CBTSProgressTimer* CBTSProgressTimer::NewL( MBTServiceObserver* aProgressObserverPtr) + { + CBTSProgressTimer* self = + new( ELeave ) CBTSProgressTimer( aProgressObserverPtr ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CBTSProgressTimer::~CBTSProgressTimer() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::Tickle +// ----------------------------------------------------------------------------- +// + void CBTSProgressTimer::Tickle() + { + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::Tickle()")); + + Cancel(); + After( iTimeout ); + + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::Tickle() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::RunL +// ----------------------------------------------------------------------------- +// +void CBTSProgressTimer::RunL() + { + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunL()")); + if (iProgressObserverPtr) + { + iProgressObserverPtr->UpdateProgressInfoL(); + } + + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunL() completed")); + } + +TInt CBTSProgressTimer::RunError( TInt aError ) + { + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunError()")); + (void) aError; + FLOG(_L("[OBEXUTILS]\t CBTSProgressTimer::RunError() - completed")); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::SetTimeout +// ----------------------------------------------------------------------------- +// + void CBTSProgressTimer::SetTimeout( TTimeIntervalMicroSeconds32 aTimeout ) + { + iTimeout = aTimeout; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUCapabilityResolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUCapabilityResolver.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,377 @@ +/* +* Copyright (c) 2002 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: Capability resolver implementation +* +*/ + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSUCapabilityResolver.h" +#include "BTSUDebug.h" +#include + + +// CONSTANTS + +_LIT8( KBTSUImageTag, "image-formats" ); +_LIT8( KBTSUAttributeEncoding, "encoding" ); +_LIT8( KBTSUAttributePixel, "pixel" ); +_LIT8( KBTSUAttributeMaxSize,"maxsize"); +_LIT(minus,"-"); +_LIT(star,"*"); + + + + +#define INVALIDVALUE -1 +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSBIPController::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSUCapabilityResolver* CBTSUCapabilityResolver::NewL(CDesCArrayFlat* aCapabilityList) + { + CBTSUCapabilityResolver* self = new( ELeave ) CBTSUCapabilityResolver( aCapabilityList ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSUCapabilityResolver* CBTSUCapabilityResolver::NewL(RArray* aCapabilityList) + { + CBTSUCapabilityResolver* self = new( ELeave ) CBTSUCapabilityResolver( aCapabilityList ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(self); + return self; + } +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::CBTSUCapabilityResolver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSUCapabilityResolver::CBTSUCapabilityResolver( CDesCArrayFlat* aCapabilityList ) + { + aCapabilityList=aCapabilityList; + } +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::CBTSUCapabilityResolver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSUCapabilityResolver::CBTSUCapabilityResolver( + RArray* aCapabilityList ) : iCapabilityList( aCapabilityList ) + { + } + +// ----------------------------------------------------------------------------- +// CBTSBIPController::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::ConstructL () + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CBTSUCapabilityResolver::~CBTSUCapabilityResolver() + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::StartDocument +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnStartDocumentL(const Xml::RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + FLOG(_L("[BTSU]\t CBTSUCapabilityResolver::OnStartDocumentL()")); + if(aErrorCode!=KErrNone) + { + FLOG(_L("[BTSU]\t Error OnStartDocument")); + } + iCompleted=EFalse; + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::EndDocument +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnEndDocumentL(TInt aErrorCode) + { + FLOG(_L("[BTSU]\t CBTSUCapabilityResolver::OnEndDocumentL()")); + if(aErrorCode!=KErrNone) + { + FLOG(_L("[BTSU]\t Error EndDocument")); + } + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::StartElement +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, + TInt /*aErrorCode*/) + { + + TBool status = EFalse; + TBTSUImageCap param; + TLex lex; + TPtrC sizemaxwidth; + TPtrC sizemaxheight; + TPtrC sizeminwidth; + TPtrC sizeminheight; + TPtrC sizemin; + TPtrC sizemax; + TInt index; + HBufC* enc; + param.iMaxByteSize=0; + + TBuf conversionBuf; + + if( aElement.LocalName().DesC() != KBTSUImageTag ) + { + return; + } + + + if(aAttributes.Count()>0) + { + + param.iEncoding=NULL; + param.iMaxByteSize=-1; + param.iMinPixelSize.iHeight=INVALIDVALUE; + param.iMinPixelSize.iWidth=INVALIDVALUE; + param.iMaxPixelSize.iWidth=INVALIDVALUE; + param.iMaxPixelSize.iHeight=INVALIDVALUE; + + //Check and add to attribute list if there is encoding + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributeEncoding ) + { + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC())); + + if (conversionBuf.Length()>0) + { + enc=conversionBuf.Alloc(); + TPtr rwdata(enc->Des()); + rwdata.Copy(conversionBuf); + param.iEncoding=enc; + if (param.iEncoding!=NULL) + { + status=ETrue; + } + } + } + } + conversionBuf = KNullDesC; + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributePixel ) + { ; + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC())); + } + } + + if(conversionBuf.Length()>1) + { + index=conversionBuf.Find(minus); + if(index!=KErrNotFound) //max size is given + { + sizemin.Set(conversionBuf.Left(index)); + sizemax.Set(conversionBuf.Right(conversionBuf.Length()-index-1)); + //solve min size + index=sizemin.Find(star); + if(index!=KErrNotFound) + { + sizeminwidth.Set(sizemin.Left(index)); + sizeminheight.Set(sizemin.Right(sizemin.Length()-index-1)); + + lex.Assign(sizeminwidth); + lex.Val(param.iMinPixelSize.iHeight); + + lex.Assign(sizeminheight); + lex.Val(param.iMinPixelSize.iWidth); + } + //solve max size + index=sizemax.Find(star); + if(index!=KErrNotFound) + { + sizemaxwidth.Set(sizemax.Left(index)); + sizemaxheight.Set(sizemax.Right(sizemax.Length()-index-1)); + + lex.Assign(sizemaxwidth); + lex.Val(param.iMaxPixelSize.iWidth); + + lex.Assign(sizemaxheight); + lex.Val(param.iMaxPixelSize.iHeight); + status=ETrue; + } + } + else //if max size not given + { + index=conversionBuf.Find(star); + if(index!=KErrNotFound) + { + //solve min size + TPtrC sizeminwidth=conversionBuf.Left( index ); + TPtrC sizeminheight=conversionBuf.Right( conversionBuf.Length() - index-1); + + lex.Assign(sizeminwidth); + lex.Val(param.iMinPixelSize.iWidth); + + lex.Assign(sizeminheight); + lex.Val(param.iMinPixelSize.iHeight); + //set max size + param.iMaxPixelSize.iWidth=param.iMinPixelSize.iWidth; + param.iMaxPixelSize.iHeight=param.iMinPixelSize.iHeight; + status=ETrue; + } + } + } + + + //Check and add to attribute list if there is maxsize + TPtrC maxsizevalue; + conversionBuf = KNullDesC; + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributeMaxSize ) + { + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC())); + } + } + + + if (conversionBuf.Length()>0) + { + lex.Assign(conversionBuf); + lex.Val(param.iMaxByteSize); + } + + if(status) + { + iCapabilityList->Append(param); //add to list + } + + } + + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnEndElementL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnEndElementL(const Xml::RTagInfo& /*aElement*/, TInt aErrorCode) + { + FLOG(_L("[BTSU]\t CBTSUCapabilityResolver::EndElement()")); + if(aErrorCode==KErrNone) + { + iCompleted=ETrue; + } + FLOG(_L("[BTSU]\t CBTSUCapabilityResolver::EndElement()")); + + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnContentL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnContentL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnStartPrefixMappingL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, + TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnEndPrefixMappingL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnIgnorableWhiteSpaceL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnSkippedEntityL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnProcessingInstructionL +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, + TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::OnError +// ----------------------------------------------------------------------------- +// +void CBTSUCapabilityResolver::OnError(TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::GetExtendedInterface +// ----------------------------------------------------------------------------- +// +TAny* CBTSUCapabilityResolver::GetExtendedInterface(const TInt32 /*aUid*/) + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// CBTSUCapabilityResolver::IsCompleted +// ----------------------------------------------------------------------------- + +TBool CBTSUCapabilityResolver::IsCompleted() + { + return iCompleted; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUDataConverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUDataConverter.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2002 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: Data converter implementation +* +*/ + + +// INCLUDE FILES +#include "BTSUDataConverter.h" +#include // for BigEndian functions +#include "BTSUDebug.h" + +// CONSTANTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TBTSUDataConverter::ConvertByteL +// ----------------------------------------------------------------------------- +// +TUint8 TBTSUDataConverter::ConvertByteL( const TPtrC8& aData ) + { + if ( aData.Length() != sizeof(TUint8) ) + { + User::Leave( KErrArgument ); + } + return *aData.Ptr(); + } + +// ----------------------------------------------------------------------------- +// TBTSUDataConverter::ConvertDataSignedL +// ----------------------------------------------------------------------------- +// +TInt32 TBTSUDataConverter::ConvertDataSignedL( const TPtrC8& aData ) + { + if ( aData.Length() != sizeof(TInt32) ) + { + User::Leave( KErrArgument ); + } + TUint32 rawVal = BigEndian::Get32(aData.Ptr()); + return *reinterpret_cast(&rawVal); // reinterpret cast to extract signed nature "unscathed" + } + +// ----------------------------------------------------------------------------- +// TBTSUDataConverter::ConvertDataUnsignedL +// ----------------------------------------------------------------------------- +// +TUint32 TBTSUDataConverter::ConvertDataUnsignedL( const TPtrC8& aData ) + { + if ( aData.Size() != sizeof(TUint32) ) + { + User::Leave( KErrArgument ); + } + return BigEndian::Get32(aData.Ptr()); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUImageConverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUImageConverter.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,349 @@ +/* +* Copyright (c) 2002 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: Tools for image conversion. +* +*/ + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSUImageConverter.h" +#include "BTSUDebug.h" + +#include +#include + +//CONSTANTS +_LIT8( KBTSUImageTypeJpeg, "image/jpeg" ); +const TInt KBTSUJpegQualityFactor = 90; +const TInt KBTSUImageThumbWidth = 160; +const TInt KBTSUImageThumbHeight = 120; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::CBTSUImageConverter +// Constructor. +// ----------------------------------------------------------------------------- +// +CBTSUImageConverter::CBTSUImageConverter(): CActive( EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CBTSUImageConverter::~CBTSUImageConverter() + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::~CBTSUImageConverter()")); + + Cancel(); + Reset(); + iFileSession.Close(); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::~CBTSUImageConverter() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSUImageConverter* CBTSUImageConverter::NewL() + { + CBTSUImageConverter* self = new (ELeave) CBTSUImageConverter; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::ConstructL +// Symbian 2nd phase constructor. +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::ConstructL() + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::ConstructL()")); + + User::LeaveIfError( iFileSession.Connect() ); + iFileSession.ShareProtected(); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::GetImageSizeL +// ----------------------------------------------------------------------------- +// +TSize CBTSUImageConverter::GetImageSizeL( RFile& aImageFile ) + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::GetImageSizeL()")); + + CImageDecoder* decoder = CImageDecoder::FileNewL(aImageFile,ContentAccess::EPeek ); + TSize size = decoder->FrameInfo().iOverallSizeInPixels; + delete decoder; + + FTRACE(FPrint(_L("[BTSU]\t CBTSUImageConverter::GetImageSizeL() completed w=%d h=%d"), size.iWidth, size.iHeight )); + + return size; + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::CreateThumbnailL +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::CreateThumbnailL( RFile& aSourceFile, + const TDesC& aDestFile ) + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::CreateThumbnailL()")); + + + Reset(); + DecodeImageL( aSourceFile ); + ScaleImageL(); + EncodeImageL( aDestFile, ETrue ); + Reset(); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::CreateThumbnailL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::GetDisplayNameL +// ----------------------------------------------------------------------------- +// +HBufC* CBTSUImageConverter::GetDisplayNameL( const TDesC8& aMimeType ) + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::GetDisplayNameL()")); + + if ( &aMimeType == NULL || + aMimeType.Length() == 0 || + aMimeType.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + + HBufC* name = NULL; + + // Get file types from decoder + // + RFileExtensionMIMETypeArray fileTypes; + CleanupResetAndDestroyPushL( fileTypes ); + CImageDecoder::GetFileTypesL( fileTypes ); + + // Find the display name for the mime type + // + for( TInt index = 0; index < fileTypes.Count(); index++ ) + { + if ( fileTypes[index]->MIMEType() == aMimeType ) + { + name = fileTypes[index]->DisplayName().AllocL(); + break; + } + } + + CleanupStack::PopAndDestroy(); // fileTypes + + if ( name == NULL ) + { + // No display name found, so the image type is not supported. + // + User::Leave( KErrNotSupported ); + } + + FLOG(_L("[BTSU]\t CBTSUImageConverter::GetDisplayNameL() completed")); + + return name; + } + + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::DoCancel +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::DoCancel() + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::DoCancel()")); + + if ( iDecoder ) + { + iDecoder->Cancel(); + } + if ( iScaler ) + { + iScaler->Cancel(); + } + if ( iEncoder ) + { + iEncoder->Cancel(); + } + + FLOG(_L("[BTSU]\t CBTSUImageConverter::DoCancel() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::RunL +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::RunL() + { + FTRACE(FPrint(_L("[BTSU]\t CBTSUImageConverter::RunL() %d"), iStatus.Int() )); + + iWait.AsyncStop(); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::RunL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::DecodeImageL +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::DecodeImageL( RFile& aSourceFile ) + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::DecodeImageL( )")); + + __ASSERT_DEBUG( iDecoder == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + __ASSERT_DEBUG( iFrameBitmap == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + + // Create decoder + // + iDecoder = CImageDecoder::FileNewL(aSourceFile, ContentAccess::EPeek ); + + // Create a bitmap + // + iFrameBitmap = new ( ELeave ) CFbsBitmap; + User::LeaveIfError( iFrameBitmap->Create( + iDecoder->FrameInfo().iOverallSizeInPixels, + iDecoder->FrameInfo().iFrameDisplayMode ) ); + + // Start decoding + // + iDecoder->Convert( &iStatus, *iFrameBitmap ); + SetActive(); + + iWait.Start(); // Wait here until decoding is completed + User::LeaveIfError( iStatus.Int() ); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::DecodeImageL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::EncodeImageL +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::EncodeImageL( const TDesC& aDestFile, + const TBool& aThumbnail ) + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::EncodeImageL()")); + + __ASSERT_DEBUG( iDecoder != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + __ASSERT_DEBUG( iEncoder == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + __ASSERT_DEBUG( iFrameImageData == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + + // Create encoder + // + iEncoder = CImageEncoder::FileNewL( iFileSession, aDestFile, KBTSUImageTypeJpeg() ); + + // Create frame image data + // + iFrameImageData = CFrameImageData::NewL(); + TJpegImageData* jpegFormat = new ( ELeave ) TJpegImageData; + CleanupStack::PushL( jpegFormat ); + + jpegFormat->iSampleScheme = TJpegImageData::EColor422; + jpegFormat->iQualityFactor = KBTSUJpegQualityFactor; + User::LeaveIfError( iFrameImageData->AppendImageData( jpegFormat ) ); + CleanupStack::Pop( jpegFormat ); + + // Start encoding + // + if ( aThumbnail ) + { + __ASSERT_DEBUG( iScaledBitmap != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + iEncoder->Convert( &iStatus, *iScaledBitmap, iFrameImageData ); + } + else + { + __ASSERT_DEBUG( iFrameBitmap != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + iEncoder->Convert( &iStatus, *iFrameBitmap, iFrameImageData ); + } + + SetActive(); + iWait.Start(); // Wait here until encoding is completed + User::LeaveIfError( iStatus.Int() ); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::EncodeImageL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::ScaleImageL +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::ScaleImageL() + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::ScaleImageL( )")); + + __ASSERT_DEBUG( iDecoder != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + __ASSERT_DEBUG( iFrameBitmap != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + __ASSERT_DEBUG( iScaler == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + __ASSERT_DEBUG( iScaledBitmap == NULL, BTSUPanic( EBTSUPanicExistingObject ) ); + + // Create scaler + // + iScaler = CBitmapScaler::NewL(); + + // Create a bitmap + // + iScaledBitmap = new ( ELeave ) CFbsBitmap; + TSize size; + size.iWidth = KBTSUImageThumbWidth; + size.iHeight = KBTSUImageThumbHeight; + User::LeaveIfError( iScaledBitmap->Create( size, + iDecoder->FrameInfo().iFrameDisplayMode ) ); + + // Start scaling + // + iScaler->Scale( &iStatus, *iFrameBitmap, *iScaledBitmap, EFalse ); + SetActive(); + + iWait.Start(); // Wait here until scaling is completed + User::LeaveIfError( iStatus.Int() ); + + FLOG(_L("[BTSU]\t CBTSUImageConverter::ScaleImageL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUImageConverter::Reset +// ----------------------------------------------------------------------------- +// +void CBTSUImageConverter::Reset() + { + FLOG(_L("[BTSU]\t CBTSUImageConverter::Reset()")); + + delete iDecoder; iDecoder = NULL; + delete iEncoder; iEncoder = NULL; + delete iScaler; iScaler = NULL; + + delete iFrameImageData; iFrameImageData = NULL; + delete iFrameBitmap; iFrameBitmap = NULL; + delete iScaledBitmap; iScaledBitmap = NULL; + + FLOG(_L("[BTSU]\t CBTSUImageConverter::Reset() completed")); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUPassKeyRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUPassKeyRequest.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2002 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: CBTSUPasskeyRequest implementation +* +*/ + + +// INCLUDE FILES +#include "BTSUPassKeyRequest.h" +#include "BTSUDebug.h" +#include "BTServiceUtils.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSUPasskeyRequest::CBTSUPasskeyRequest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSUPasskeyRequest::CBTSUPasskeyRequest() : CActive(EPriorityNormal) + { + CActiveScheduler::Add( this ); + } + +// Destructor +CBTSUPasskeyRequest::~CBTSUPasskeyRequest() + { + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::~CBTSUPasskeyRequest")); + + Cancel(); // Make sure we're cancelled + iNotif.Close(); + + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest:~CBTSUPasskeyRequest completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUPasskeyRequest::DoCancel() +// ----------------------------------------------------------------------------- +// +void CBTSUPasskeyRequest::DoCancel() + { + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::DoCancel")); + + iNotif.CancelNotifier( KBTObexPasskeyQueryNotifierUid ); + iNotif.Close(); + + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::DoCancel completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUPasskeyRequest::RunL() +// ----------------------------------------------------------------------------- +// +void CBTSUPasskeyRequest::RunL() + { + FTRACE(FPrint(_L( "[BTSU]\t CBTSUPasskeyRequest::RunL status %d"), iStatus.Int() )); + + if ( iStatus.Int() == KErrNone ) + { + TBuf tempResultBuffer; + CnvUtfConverter::ConvertToUnicodeFromUtf8( tempResultBuffer, iObexPasskey() ); + iObexClient->UserPasswordL( tempResultBuffer ); + + FTRACE(FPrint(_L("[BTSU]\t CBTSUPasskeyRequest::RunL user entered '%S'"), &tempResultBuffer )); + } + else + { + iObexClient->Error( KErrCancel ); + } + + iNotif.CancelNotifier( KBTObexPasskeyQueryNotifierUid ); + iNotif.Close(); + + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::RunL completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUPasskeyRequest::RunError() +// ----------------------------------------------------------------------------- +// +TInt CBTSUPasskeyRequest::RunError() + { + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::RunError")); + + iNotif.CancelNotifier( KBTObexPasskeyQueryNotifierUid ); + iNotif.Close(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBTSUPasskeyRequest::StartPassKeyRequestL() +// ----------------------------------------------------------------------------- +// +void CBTSUPasskeyRequest::StartPassKeyRequestL( CObexClient* aObexClient ) + { + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::StartPassKeyRequestL")); + __ASSERT_DEBUG( aObexClient != NULL, BTSUPanic( EBTSUPanicNullPointer ) ); + + User::LeaveIfError( iNotif.Connect() ); + TPtrC8 dummy( KNullDesC8 ); + + // Starts notifier and gets the passkey for Obex + iNotif.StartNotifierAndGetResponse( iStatus, KBTObexPasskeyQueryNotifierUid, dummy, iObexPasskey ); + iObexClient = aObexClient; + SetActive(); + + FLOG(_L("[BTSU]\t CBTSUPasskeyRequest::StartPassKeyRequestL completed")); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSURefObjectResolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSURefObjectResolver.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2002 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: Reference object resolver +* +*/ + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTSURefObjectResolver.h" +#include "BTSUDebug.h" +#include + +// CONSTANTS +_LIT8( KBTSUElementImage, "img" ); +_LIT8( KBTSUElementLink, "link" ); +_LIT8( KBTSUElementObject, "object" ); + +_LIT8( KBTSUAttributeSrc, "src" ); +_LIT8( KBTSUAttributeData, "data" ); +_LIT8( KBTSUAttributeHref, "href" ); + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSURefObjectResolver* CBTSURefObjectResolver::NewL(CDesCArrayFlat* aCapabilityList) + { + CBTSURefObjectResolver* self = new( ELeave ) CBTSURefObjectResolver( aCapabilityList ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::CBTSURefObjectResolver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSURefObjectResolver::CBTSURefObjectResolver( + CDesCArrayFlat* aObjectList ) : iObjectList( aObjectList ) + { + } + + // ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::ConstructL () + { + } + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CBTSURefObjectResolver::~CBTSURefObjectResolver() + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnStartDocumentL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnStartDocumentL(const Xml::RDocumentParameters& /*aDocParam*/, TInt aErrorCode) + { + FLOG(_L("[BTSU]\t CBTSURefObjectResolver::OnStartDocumentL()")); + if(aErrorCode!=KErrNone) + { + FLOG(_L("[BTSU]\t Error OnStartDocument")); + } + + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnEndDocumentL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnEndDocumentL(TInt aErrorCode) + { + FLOG(_L("[BTSU]\t CBTSURefObjectResolver::EndDocument()")); + if(aErrorCode!=KErrNone) + { + FLOG(_L("[BTSU]\t Error EndDocument")); + } + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::StartElement +// If a certain element has a certain attribute, append the attribute's +// value into the object list. +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, + TInt aErrorCode) + { + + if(aErrorCode!=KErrNone) + { + FLOG(_L("[BTSU]\t Error OnStartElementL")); + } + + RString aLocalName = aElement.LocalName(); + + TBuf conversionBuf; + // Images + // + if ( aLocalName.DesC() == KBTSUElementImage /*|| aName == KBTSUElementImage()*/ ) + + { + // Check the attributes + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributeSrc ) + { + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC() )); + if(conversionBuf.Length()) + iObjectList->AppendL(conversionBuf ); + } + } + + } + else if ( aLocalName.DesC() == KBTSUElementObject() /*|| aName == KBTSUElementObject() */) + { + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributeData ) + { + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC() )); + if(conversionBuf.Length()) + iObjectList->AppendL(conversionBuf ); + } + } + } + + // Other objects + // + else if ( aLocalName.DesC() == KBTSUElementLink() /*|| aName == KBTSUElementLink() */) + { + for ( TInt iCounter = 0 ; iCounter < aAttributes.Count() ; iCounter++ ) + { + if ( aAttributes[iCounter].Attribute().LocalName().DesC() == KBTSUAttributeHref ) + { + User::LeaveIfError( CnvUtfConverter::ConvertToUnicodeFromUtf8( conversionBuf, aAttributes[iCounter].Value().DesC() )); + if(conversionBuf.Length()) + iObjectList->AppendL(conversionBuf ); + + } + } + } + + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnEndElementL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnEndElementL(const Xml::RTagInfo& /*aElement*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnContentL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnContentL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnStartPrefixMappingL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, + TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnEndPrefixMappingL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnIgnorableWhiteSpaceL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnSkippedEntityL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnProcessingInstructionL +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, + TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::OnError +// ----------------------------------------------------------------------------- +// +void CBTSURefObjectResolver::OnError(TInt /*aErrorCode*/) + { + } + +// ----------------------------------------------------------------------------- +// CBTSURefObjectResolver::GetExtendedInterface +// ----------------------------------------------------------------------------- +// +TAny* CBTSURefObjectResolver::GetExtendedInterface(const TInt32 /*aUid*/) + { + + return NULL; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUXmlParser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUXmlParser.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2002 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: XML parser implementation +* +*/ + + +// INCLUDE FILES +#include +#include "BTSUXmlParser.h" +#include "BTServiceUtils.h" +#include "BTSUCapabilityResolver.h" +#include "BTSURefObjectResolver.h" +#include "BTSUDebug.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::CBTSUXmlParser +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTSUXmlParser::CBTSUXmlParser() + { + } + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTSUXmlParser::ConstructL() + { + FLOG(_L("[BTSU]\t CBTSUXmlParser::ConstructL()")); + + User::LeaveIfError( iFileSession.Connect() ); + + FLOG(_L("[BTSU]\t CBTSUXmlParser::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTSUXmlParser* CBTSUXmlParser::NewL() + { + CBTSUXmlParser* self = new( ELeave ) CBTSUXmlParser; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CBTSUXmlParser::~CBTSUXmlParser() + { + FLOG(_L("[BTSU]\t CBTSUXmlParser::~CBTSUXmlParser()")); + + iFileSession.Close(); + + FLOG(_L("[BTSU]\t CBTSUXmlParser::~CBTSUXmlParser() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::GetCapabilityListL +// ----------------------------------------------------------------------------- +// +CDesCArrayFlat* CBTSUXmlParser::GetCapabilityListL( const TDesC& /*aFileName */) + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::GetCapabilityListL +// ----------------------------------------------------------------------------- +// +RArray* CBTSUXmlParser::GetImgCapabilityListL( const TDesC& aFileName ) + { + FLOG(_L("[BTSU]\t CBTSUXmlParser::GetCapabilityListL()")); + + if ( &aFileName == NULL || + aFileName.Length() == 0 || + aFileName.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + + // Create result array + // + RArray* array = new (ELeave) RArray(); + CleanupStack::PushL( array ); + + // Set content handler + // + CBTSUCapabilityResolver *resolver = CBTSUCapabilityResolver::NewL( array ); + CleanupStack::PushL(resolver); + // Create parser + // + Xml::CParser *parser=Xml::CParser::NewL( _L8( "text/xml" ), *resolver ); + CleanupStack::PushL(parser); + // Parse + // + Xml::ParseL(*parser, iFileSession, aFileName); + + if(!resolver->IsCompleted()) + { + User::Leave(KErrCompletion); + } + + + CleanupStack::PopAndDestroy(2); //parser & resolver + CleanupStack::Pop( array ); + + + FLOG(_L("[BTSU]\t CBTSUXmlParser::GetCapabilityListL() completed")); + + return array; + } + +// ----------------------------------------------------------------------------- +// CBTSUXmlParser::GetRefObjectListL +// ----------------------------------------------------------------------------- +// +CDesCArrayFlat* CBTSUXmlParser::GetRefObjectListL( const TDesC& aFileName ) + { + FLOG(_L("[BTSU]\t CBTSUXmlParser::GetRefObjectListL()")); + + if ( &aFileName == NULL || + aFileName.Length() == 0 || + aFileName.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + + // Create result array + // + CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat( KBTSUArrayGranularity ); + CleanupStack::PushL( array ); + + // Set content handler + // + CBTSURefObjectResolver *resolver = CBTSURefObjectResolver::NewL( array ); + CleanupStack::PushL(resolver); + // Create parser + // + Xml::CParser *parser = Xml::CParser::NewL( _L8( "text/xml" ), *resolver ); + CleanupStack::PushL( parser ); + // Parse + // + Xml::ParseL(*parser, iFileSession, aFileName); + + CleanupStack::PopAndDestroy(2); // parser & resolver + CleanupStack::Pop( array ); + + FLOG(_L("[BTSU]\t CBTSUXmlParser::GetRefObjectListL() completed")); + + return array; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceAPI.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceAPI.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2002 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: Btserviceutils API implementation +* +*/ + + + +// INCLUDE FILES +#include "BTServiceAPI.h" +#include "BTServiceStarter.h" +#include "BTSUDebug.h" + +// CONSTANTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTServiceAPI::CBTServiceAPI +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTServiceAPI::CBTServiceAPI() + { + } + +// ----------------------------------------------------------------------------- +// CBTServiceAPI::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTServiceAPI::ConstructL() + { + FLOG(_L("[BTSU]\t CBTServiceAPI::ConstructL()")); + iStarter = CBTServiceStarter::NewL(); + } + +// ----------------------------------------------------------------------------- +// CBTServiceAPI::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBTServiceAPI* CBTServiceAPI::NewL() + { + CBTServiceAPI* self = new( ELeave ) CBTServiceAPI(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +CBTServiceAPI::~CBTServiceAPI() + { + FLOG(_L("[BTSU]\t CBTServiceAPI::Destructor()")); + if ( iStarter ) + { + delete iStarter; + } + FLOG(_L("[BTSU]\t CBTServiceAPI::Destructor() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceAPI::StartServiceL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceAPI::StartServiceL( TBTServiceType aService, + CBTServiceParameterList* aList ) + { + FLOG(_L("[BTSU]\t CBTServiceAPI::StartServiceL()")); + + iStarter->StartServiceL( aService, aList ); + + FLOG(_L("[BTSU]\t CBTServiceAPI::StartServiceL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceAPI::StartSynchronousServiceL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceAPI::StartSynchronousServiceL( TBTServiceType aService, + CBTServiceParameterList* aList ) + { + FLOG(_L("[BTSU]\t CBTServiceAPI::StartSynchronousServiceL()")); + + iStarter->StartServiceL( aService, aList, &iSyncWaiter); + + + FLOG(_L("[BTSU]\t CBTServiceAPI::StartSynchronousServiceL() Wait for completion")) + iSyncWaiter.Start(); + + FLOG(_L("[BTSU]\t CBTServiceAPI::StartSynchronousServiceL() completed")); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,600 @@ +/* +* 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: Obex client implementation +* +*/ + + + +// INCLUDE FILES +#include // RApaLSession + +#include "BTServiceClient.h" +#include "BTServiceUtils.h" +#include "BTConnectionTimer.h" +#include "BTSUDebug.h" + +const TUint16 KMtuSizeReceiv = 0xFFFF; // 64kB +const TUint16 KMtuSizeTrans = 0x3000; // 12kB +const TInt KBufferSize = 0x4000; // 16kB + +const TInt KBTConnectionTimeout = 20000000; // 20 seconds +const TInt KBTAbortTimeout = 2000000; // 20 seconds + +// CONSTANTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTServiceClient::CBTServiceClient +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTServiceClient::CBTServiceClient( MBTServiceClientObserver* aObserver ) + : CActive( EPriorityStandard ), + iClientState( EBTSCliIdle ), + iObserver( aObserver ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::ConstructL( const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ) + { + FLOG(_L("[BTSU]\t CBTServiceClient::ConstructL()")); + + iTotalBytesSent = 0; + // Create Obex Client + // + TObexBluetoothProtocolInfo info; + info.iTransport = KBTSProtocol; + info.iAddr.SetBTAddr( aRemoteDevice ); + info.iAddr.SetPort( aRemotePort ); + + TObexProtocolPolicy obexProtocolPolicy; + obexProtocolPolicy.SetReceiveMtu( KMtuSizeReceiv ); + obexProtocolPolicy.SetTransmitMtu( KMtuSizeTrans ); + + iClient = CObexClient::NewL( info, obexProtocolPolicy ); + iClient->SetCallBack( *this ); + iPasskeyRequest = new (ELeave) CBTSUPasskeyRequest(); + + // Create Connect-object + // + iConnectObject = CObexNullObject::NewL(); + + if ( aHeaderList.Count() > 0 ) + { + for ( TInt index = 0; index < aHeaderList.Count(); index++ ) + { + iConnectObject->AddHeaderL( *aHeaderList[index] ); + } + } + + // Establish client connection + // + iClient->Connect( *iConnectObject, iStatus ); + SetActive(); + iClientState = EBTSCliConnecting; + iConnectionTimer = CBTConnectionTimer::NewL(this); + iConnectionTimer -> SetTimeOut ( TTimeIntervalMicroSeconds32( KBTConnectionTimeout ) ); + iConnectionTimer -> Start(); + + FLOG(_L("[BTSU]\t CBTServiceClient::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTServiceClient* CBTServiceClient::NewL( MBTServiceClientObserver* aObserver, + const TBTDevAddr& aRemoteDevice, + const TUint aRemotePort, + RArray aHeaderList ) + { + CBTServiceClient* self = new( ELeave ) CBTServiceClient( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL( aRemoteDevice, aRemotePort, aHeaderList ); + CleanupStack::Pop(); + return self; + } + + +// Destructor +CBTServiceClient::~CBTServiceClient() + { + FLOG(_L("[BTSU]\t CBTServiceClient::~CBTServiceClient()")); + + if(iConnectionTimer) + { + iConnectionTimer->Cancel(); + delete iConnectionTimer; + iConnectionTimer=NULL; + } + Cancel(); + if(iClient) + { + delete iClient; + iClient = NULL; + } + delete iPasskeyRequest; + iPasskeyRequest = NULL; + + if ( iConnectObject ) + { + iConnectObject->Reset(); + delete iConnectObject; + iConnectObject = NULL; + } + if ( iObjectBuffer ) + { + iObjectBuffer->Reset(); + delete iObjectBuffer; + iObjectBuffer = NULL; + } + if ( iGetObject ) + { + delete iGetObject; + iGetObject = NULL; + } + if ( iPutObject ) + { + iPutObject->Reset(); + delete iPutObject; + iPutObject = NULL; + } + if ( iPutBufObject ) + { + iPutBufObject->Reset(); + delete iPutBufObject; + iPutBufObject = NULL; + } + + if(iBuffer) + { + delete iBuffer; + iBuffer = NULL; + } + + FLOG(_L("[BTSU]\t CBTServiceClient::~CBTServiceClient() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::GetObjectL +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::GetObjectL( RArray& aHeaderList, + const TDesC& aFileName ) + { + FLOG(_L("[BTSU]\t CBTServiceClient::GetObjectL()")); + + if ( iGetObject ) + { + iGetObject->Reset(); + delete iGetObject; + iGetObject = NULL; + } + + // Create object + // + if ( aFileName == KNullDesC ) + { + iObjectBuffer = CBufFlat::NewL( KBTSUDataBufferExpandSize ); + iGetObject = CObexBufObject::NewL( iObjectBuffer ); + } + else + { + iGetObject = CObexBufObject::NewL( NULL ); + iGetObject->SetDataBufL( aFileName ); + } + + // Set headers + // + if ( aHeaderList.Count() > 0 ) + { + for ( TInt index = 0; index < aHeaderList.Count(); index++ ) + { + iGetObject->AddHeaderL( *aHeaderList[index] ); + } + } + + // Send get request + // + iClient->Get( *iGetObject, iStatus ); + SetActive(); + iClientState = EBTSCliGetting; + + FLOG(_L("[BTSU]\t CBTServiceClient::GetObjectL() completed")); + } + + +// ----------------------------------------------------------------------------- +// CBTServiceClient::PutObjectL +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::PutObjectL( RArray& aHeaderList, + const TDesC& aFileName ) + { + FLOG(_L("[BTSU]\t CBTServiceClient::PutObjectL()")); + + if ( iPutObject ) + { + iPutObject->Reset(); + delete iPutObject; + iPutObject = NULL; + } + + // Create object + // + iPutObject = CObexFileObject::NewL(); + + // Set body + // + + if ( aFileName != KNullDesC ) + { + iPutObject->InitFromFileL ( aFileName ); + } + + // Set headers + // + if ( aHeaderList.Count() > 0 ) + { + for ( TInt index = 0; index < aHeaderList.Count(); index++ ) + { + iPutObject->AddHeaderL( *aHeaderList[index] ); + } + } + + // Send object + // + iClient->Put( *iPutObject, iStatus ); + SetActive(); + iClientState = EBTSCliPutting; + + FLOG(_L("[BTSU]\t CBTServiceClient::PutObjectL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::PutObjectL +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::PutObjectL( RArray& aHeaderList, + RFile& aFile ) + { + FLOG(_L("[BTSU]\t CBTServiceClient::PutObjectL()")); + + if ( iPutObject ) + { + iPutObject->Reset(); + delete iPutObject; + iPutObject = NULL; + } + + if ( iPutBufObject ) + { + iPutBufObject->Reset(); + delete iPutBufObject; + iPutBufObject = NULL; + } + // Create object + // + iPutBufObject = CObexBufObject::NewL(NULL); + + // Resolve MIME type + // + + RApaLsSession session; + HBufC8* mimeType = NULL; + TDataType type; + + TUid uid; + // Set headers + // + if ( aHeaderList.Count() > 0 ) + { + for ( TInt index = 0; index < aHeaderList.Count(); index++ ) + { + iPutBufObject->AddHeaderL( *aHeaderList[index] ); + } + } + + TDesC8 typeheader=iPutBufObject->Type(); + if ( typeheader == KNullDesC8 ) + { + User::LeaveIfError( session.Connect() ); + CleanupClosePushL( session ); + TInt error = session.AppForDocument( aFile, uid, type ); + if ( error == KErrNone ) + { + mimeType = type.Des8().AllocLC(); + iPutBufObject->SetTypeL(*mimeType); + CleanupStack::PopAndDestroy(); + } + CleanupStack::Pop(); // session + session.Close(); + } + + //Set object information + // + TFileName filename; + aFile.Name(filename); + + TInt size; + aFile.Size(size); + iPutBufObject->SetLengthL(size); + iPutBufObject->SetNameL(filename); + + TTime time; + if ( aFile.Modified(time) == KErrNone ) + { + iPutBufObject->SetTimeL(time); + } + + RFile file; + file.Duplicate(aFile); + + iBuffer = CBufFlat::NewL(KBufferSize); + iBuffer ->ResizeL(KBufferSize); + + TObexRFileBackedBuffer bufferdetails(*iBuffer,file,CObexBufObject::ESingleBuffering); + iPutBufObject->SetDataBufL(bufferdetails); + + // Send object + // + iClient->Put( *iPutBufObject, iStatus ); + SetActive(); + iClientState = EBTSCliPutting; + + FLOG(_L("[BTSU]\t CBTServiceClient::PutObjectL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::CloseClientConnection +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::CloseClientConnection() + { + FLOG(_L("[BTSU]\t CBTServiceClient::CloseClientConnection()")); + + iClient->Disconnect( iStatus ); + SetActive(); + iClientState = EBTSCliDisconnecting; + + FLOG(_L("[BTSU]\t CBTServiceClient::CloseClientConnection() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::GetProgressStatus +// ----------------------------------------------------------------------------- +// +TInt CBTServiceClient::GetProgressStatus() + { + FLOG(_L("[BTSU]\t CBTServiceClient::GetProgressStatus()")); + + TInt bytesSent = 0; + if ( iPutBufObject ) + { + bytesSent = iPutBufObject->BytesSent(); + } + if ( iPutObject ) + { + bytesSent = iPutObject->BytesSent(); + } + + FTRACE(FPrint(_L("[BTSU]\t CBTServiceClient::GetProgressStatus() completed, bytes sent %d"), iTotalBytesSent + bytesSent ) ); + + // return iTotalBytesSent + bytesSent; + return bytesSent; + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::GetUserPasswordL +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::GetUserPasswordL( const TDesC& /*aRealm*/ ) + { + FLOG(_L("[BTSU]\t CBTServiceClient::GetUserPasswordL()")); + + iPasskeyRequest->StartPassKeyRequestL( iClient ); + + FLOG(_L("[BTSU]\t CBTServiceClient::GetUserPasswordL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::DoCancel +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::DoCancel() + { + FLOG(_L("[BTSU]\t CBTServiceClient::DoCancel()")); + + if ( iConnectionTimer ) + { + iConnectionTimer->Cancel(); + delete iConnectionTimer; + iConnectionTimer=NULL; + } + // Deleting obexclient is the only way to cancel active requests + // + if ( iClient ) + { + delete iClient; + iClient = NULL; + } + + FLOG(_L("[BTSU]\t CBTServiceClient::DoCancel() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::RunL +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::RunL() + { + FTRACE(FPrint(_L("[BTSU]\t CBTServiceClient::RunL() status %d"), iStatus.Int() ) ); + if ( !iObserver ) + { + return; + } + switch ( iClientState ) + { + case EBTSCliConnecting: + { + FLOG(_L("[BTSU]\t CBTServiceClient::RunL() EBTSCliConnecting")); + iConnectObject->Reset(); + if(iConnectionTimer) + { + iConnectionTimer->Cancel(); + delete iConnectionTimer; + iConnectionTimer=NULL; + } + iObserver->ConnectCompleted( iStatus.Int() ); + break; + } + + case EBTSCliPutting: + { + FLOG(_L("[BTSU]\t CBTServiceClient::RunL() EBTSCliPutting")); + if(iPutBufObject) + { + iTotalBytesSent += iPutBufObject->BytesSent(); + } + else + { + iTotalBytesSent += iPutObject->BytesSent(); + } + + const CObexHeaderSet& response=iClient->GetPutFinalResponseHeaders(); + if ( iPutBufObject ) + { + iPutBufObject->Reset(); + delete iPutBufObject; + iPutBufObject = NULL; + } + + if ( iPutObject ) + { + iPutObject->Reset(); + delete iPutObject; + iPutObject = NULL; + } + if(iBuffer) + { + delete iBuffer; + iBuffer = NULL; + } + //put there call getEnv + iObserver->PutCompleted( iStatus.Int(), &response); + FLOG(_L("[BTSU]\t CBTServiceClient::RunL() EBTSCliPutting done")); + break; + } + + case EBTSCliGetting: + { + iObserver->GetCompleted( iStatus.Int(), iGetObject ); + break; + } + + case EBTSCliDisconnecting: + { + // Any errors are ignored + // + iObserver->ClientConnectionClosed(); + break; + } + + case EBTSCliIdle: + default: + { + FLOG(_L("[BTSU]\t CBTServiceClient::RunL() ERROR, unhandled case")); + break; + } + } + + FLOG(_L("[BTSU]\t CBTServiceClient::RunL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceClient::ConnectionTimedOut +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::ConnectionTimedOut() + { + FLOG(_L("[BTSU]\t CBTServiceClient::ConnectionTimedOut")); + switch ( iClientState ) + { + case EBTSCliConnecting: + { + iObserver->ConnectTimedOut(); + break; + } + case EBTSCliGetting: + { + iObserver->GetCompleted( KErrAbort, iGetObject ); + break; + } + case EBTSCliPutting: + { + const CObexHeaderSet& response=iClient->GetPutFinalResponseHeaders(); + iObserver->PutCompleted( KErrAbort, &response ); + break; + } + default: + FLOG(_L("[BTSU]\t CBTServiceClient::ConnectionTimedOut unhandled client state ")); + } + + FLOG(_L("[BTSU]\t CBTServiceClient::ConnectionTimedOut")); + } +// ----------------------------------------------------------------------------- +// CBTServiceClient::Abort +// ----------------------------------------------------------------------------- +// +void CBTServiceClient::Abort() + { + FLOG(_L("[BTSU]\t CBTServiceClient::Abort")); + if ( iClient && ( iClientState == EBTSCliPutting || iClientState == EBTSCliGetting ) ) + { + if ( iConnectionTimer ) + { + delete iConnectionTimer; + iConnectionTimer = NULL; + } + TRAPD(trapErr, iConnectionTimer = CBTConnectionTimer::NewL(this) ); + if ( trapErr != KErrNone) + { + iObserver->ConnectCompleted( KErrAbort ); + return; + } + iConnectionTimer -> SetTimeOut ( TTimeIntervalMicroSeconds32( KBTAbortTimeout ) ); + iConnectionTimer -> Start(); + iClient->Abort(); + } + else if ( iClient && iClientState == EBTSCliConnecting) + { + iObserver->ConnectCompleted( KErrAbort ); + } + FLOG(_L("[BTSU]\t CBTServiceClient::Abort")); + + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceParameterList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceParameterList.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,571 @@ +/* +* Copyright (c) 2002 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: parameter list implementation +* +*/ + + +// INCLUDE FILES +#include "BTServiceUtils.h" +#include "BTServiceParameterList.h" +#include "BTSUImageConverter.h" +#include "BTSUXmlParser.h" +#include "BTSUDebug.h" + +#include // RApaLSession +#include // TDataType +#include //´Type solving +#include + +// CONSTANTS + +_LIT( KBIPImageTypes, "JPEGBMPGIFWBMPPNGJPEG2000" ); + + +const TInt KBIPImageTypesLength = 30; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::CBTServiceParameterList +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTServiceParameterList::CBTServiceParameterList() + { + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTServiceParameterList::ConstructL() + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::ConstructL()")); + iRemovedImageCount=0; + User::LeaveIfError( iFileSession.Connect() ); + iFileSession.ShareProtected(); + + FLOG(_L("[BTSU]\t CBTServiceParameterList::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBTServiceParameterList* CBTServiceParameterList::NewL() + { + CBTServiceParameterList* self = new( ELeave ) CBTServiceParameterList; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CBTServiceParameterList* CBTServiceParameterList::NewLC() + { + CBTServiceParameterList* self = new( ELeave ) CBTServiceParameterList; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// Destructor +CBTServiceParameterList::~CBTServiceParameterList() + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::~CBTServiceParameterList()")); + + TInt index = 0; + + for ( ; index < iXhtmlList.Count(); index++ ) + { + delete iXhtmlList[index].iFileName; + delete iXhtmlList[index].iRefObjectList; + } + + for ( index = 0; index < iImageList.Count(); index++ ) + { + + delete iImageList[index].iMimeType; + delete iImageList[index].iDisplayName; + if(iImageList[index].iFile.SubSessionHandle()) + { + iImageList[index].iFile.Close(); + } + + } + + for ( index = 0; index < iObjectList.Count(); index++ ) + { + if(iObjectList[index].SubSessionHandle()) + { + iObjectList[index].Close(); + } + } + + iXhtmlList.Close(); + iImageList.Close(); + iObjectList.Close(); + iFileSession.Close(); + + FLOG(_L("[BTSU]\t CBTServiceParameterList::~CBTServiceParameterList() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::AddXhtmlL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceParameterList::AddXhtmlL( const TDesC& aFilePath ) + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddXhtmlL()")); + + if ( &aFilePath == NULL || + aFilePath.Length() == 0 || + aFilePath.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + + // Allocate memory for filename + // + HBufC* file = aFilePath.AllocL(); + CleanupStack::PushL( file ); + + // Resolve referenced objects + // + CBTSUXmlParser* parser = CBTSUXmlParser::NewL(); + CleanupStack::PushL( parser ); + + CDesCArrayFlat* list = parser->GetRefObjectListL( aFilePath ); + CleanupStack::PushL( list ); + + // Store parameter into list + // + TBTSUXhtmlParam param; + param.iFileName = file; + param.iRefObjectList = list; + User::LeaveIfError( iXhtmlList.Append( param ) ); + + CleanupStack::Pop( 3 ); // list, parser, file + delete parser; + + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddXhtmlL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::AddImageL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceParameterList::AddImageL( const TDesC& aFilePath ) + { + if ( &aFilePath == NULL || + aFilePath.Length() == 0 || + aFilePath.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + RFile file; + User::LeaveIfError( file.Open( iFileSession, aFilePath, EFileShareReadersOnly) ); + AddImageL(file); + file.Close(); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::AddImageL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceParameterList::AddImageL( RFile aFile ) + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddImageL()")); + TBool found; + TInt retVal; + TBool isprotected = EFalse; + + //chekc that file handle is correct + if(!aFile.SubSessionHandle()) + { + User::Leave( KErrArgument ); + } + + //check if files are drm protected + + ContentAccess::CContent* drm = ContentAccess::CContent::NewL(aFile); + drm->GetAttribute(ContentAccess::EIsProtected, isprotected); + delete drm; + + + if(isprotected) + { + User::Leave( KErrNotSupported ); + } + + + CBTSUImageConverter * imageConverter = CBTSUImageConverter::NewL(); + CleanupStack::PushL( imageConverter ); + + // Allocate memory for filename + // + + + // Resolve MIME type + // + RApaLsSession session; + HBufC8* mimeType = NULL; + TDataType type; + + TUid uid; + + User::LeaveIfError( session.Connect() ); + CleanupClosePushL( session ); + + User::LeaveIfError( session.AppForDocument( aFile, uid, type ) ); + mimeType = type.Des8().AllocL(); + + CleanupStack::Pop(); // session + session.Close(); + + CleanupStack::PushL( mimeType ); + + // Resolve Display name + // + HBufC* displayName = imageConverter->GetDisplayNameL( *mimeType ); + CleanupStack::PushL( displayName ); + + RFileExtensionMIMETypeArray fileExtensions; + + //Resolve what format are suported + TRAP( retVal, CImageDecoder::GetFileTypesL( fileExtensions ) ); + if( retVal != KErrNone ) + { + fileExtensions.ResetAndDestroy(); + User::Leave( retVal ); + } + + found=EFalse; + TBuf types = KBIPImageTypes(); + + for( TInt index = 0; index < fileExtensions.Count(); index++ ) + { + retVal=displayName->Compare((*fileExtensions[index]).DisplayName()); + if(retVal==0 && types.Find((*fileExtensions[index]).DisplayName())!=KErrNotFound ) + { + found=ETrue; + } + } + fileExtensions.ResetAndDestroy(); + if(found==EFalse) + { + User::Leave(KErrNotSupported); + } + + + // Resolve file size + // + TInt fileSize = 0; + User::LeaveIfError( aFile.Size( fileSize ) ); + + + // Resolve width and height + // + TSize decodeSize = imageConverter->GetImageSizeL( aFile ); + + + // Store parameter into list + // + TBTSUImageParam param; + + param.iFile.Duplicate(aFile); + param.iMimeType = mimeType; + param.iDisplayName = displayName; + param.iFileSize = fileSize; + param.iPixelSize = decodeSize; + param.iSend=EFalse; + + + User::LeaveIfError( iImageList.Append( param ) ); + + CleanupStack::Pop( 3 ); // displayName, mimeType, imageConverter + delete imageConverter; + + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddImageL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::AddObjectL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CBTServiceParameterList::AddObjectL( const TDesC& aFilePath ) + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddObjectL()")); + + if ( &aFilePath == NULL || + aFilePath.Length() == 0 || + aFilePath.Length() > KMaxFileName ) + { + User::Leave( KErrArgument ); + } + + RFile file; + User::LeaveIfError( file.Open( iFileSession, aFilePath, EFileShareReadersOnly) ); + AddObjectL(file); + file.Close(); + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddObjectL() completed")); + } + + // ----------------------------------------------------------------------------- +// CBTServiceParameterList::AddObjectL +// ----------------------------------------------------------------------------- +// + EXPORT_C void CBTServiceParameterList::AddObjectL( RFile aFile ) + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddObjectL()")); + + //chekc that file handle is correct + if(!aFile.SubSessionHandle()) + { + User::Leave( KErrArgument ); + } + RFile file; + + file.Duplicate(aFile); + + iObjectList.AppendL( file ); + + FLOG(_L("[BTSU]\t CBTServiceParameterList::AddObjectL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::XhtmlCount +// ----------------------------------------------------------------------------- +// +TInt CBTServiceParameterList::XhtmlCount() const + { + return iXhtmlList.Count(); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ImageCount +// ----------------------------------------------------------------------------- +// +TInt CBTServiceParameterList::ImageCount() const + { + return iImageList.Count(); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ObjectCount +// ----------------------------------------------------------------------------- +// +TInt CBTServiceParameterList::ObjectCount() const + { + return iObjectList.Count(); + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::XhtmlAt +// ----------------------------------------------------------------------------- +// +TBTSUXhtmlParam CBTServiceParameterList::XhtmlAt( TInt aIndex ) const + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::XhtmlAt()")); + __ASSERT_DEBUG( aIndex >= 0 && aIndex < XhtmlCount(), BTSUPanic( EBTSUPanicOutOfRange ) ); + + TBTSUXhtmlParam param; + param.iFileName = iXhtmlList[ aIndex].iFileName; + param.iRefObjectList = iXhtmlList[ aIndex].iRefObjectList; + + FLOG(_L("[BTSU]\t CBTServiceParameterList::XhtmlAt() completed")); + + return param; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ImageAt +// ----------------------------------------------------------------------------- +// +TBTSUImageParam CBTServiceParameterList::ImageAtL( TInt aIndex ) const + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::ImageAt()")); + + TBTSUImageParam param; + + if(aIndex<0 || aIndex> ImageCount() ) + { + User::Leave(KErrGeneral); + } + + param.iFile = iImageList[aIndex].iFile; + param.iMimeType = iImageList[aIndex].iMimeType; + param.iDisplayName = iImageList[aIndex].iDisplayName; + param.iPixelSize = iImageList[aIndex].iPixelSize; + param.iFileSize = iImageList[aIndex].iFileSize; + param.iSend = iImageList[aIndex].iSend; + + + FLOG(_L("[BTSU]\t CBTServiceParameterList::ImageAt() completed")); + + return param; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ObjectAt +// ----------------------------------------------------------------------------- +// +RFile& CBTServiceParameterList::ObjectAtL( TInt aIndex ) + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::ObjectAt()")); + + if(aIndex<0 || aIndex> iObjectList.Count() ) + { + User::Leave(KErrGeneral); + } + return iObjectList[aIndex]; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::HasAnyReferencedObjects +// ----------------------------------------------------------------------------- +// +TBool CBTServiceParameterList::HasAnyReferencedObjects() const + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::HasAnyReferencedObjects()")); + + TBool result = EFalse; + + for ( TInt index = 0; index < iXhtmlList.Count(); index++ ) + { + if ( iXhtmlList[index].iRefObjectList->Count() > 0 ) + { + result = ETrue; + break; + } + } + + FTRACE(FPrint(_L("[BTSU]\t CBTServiceParameterList::HasAnyReferencedObjects() completed with %d"), result )); + + return result; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ObjectListSizeL +// ----------------------------------------------------------------------------- +// +TInt CBTServiceParameterList::ObjectListSizeL() const + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::ObjectListSizeL()")); + + TInt totalFileSize = 0; + + for ( TInt index = 0; index < iObjectList.Count(); index++ ) + { + TInt fileSize = 0; + iObjectList[index].Size( fileSize ); + totalFileSize += fileSize; + } + return totalFileSize; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ImageListSize +// ----------------------------------------------------------------------------- +// +TInt CBTServiceParameterList::ImageListSize() const + { + FLOG(_L("[BTSU]\t CBTServiceParameterList::ImageListSize()")); + + TInt totalFileSize = 0; + for ( TInt index = 0; index < iImageList.Count(); index++ ) + { + totalFileSize += iImageList[index].iFileSize; + } + + FTRACE(FPrint(_L("[BTSU]\t CBTServiceParameterList::ImageListSize %d"), totalFileSize )); + return totalFileSize; + } +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::RemoveImageL +// ----------------------------------------------------------------------------- +// + + void CBTServiceParameterList::RemoveImageL(TInt aIndex) + { + if(aIndex<0 || aIndex> iImageList.Count() ) + { + User::Leave(KErrGeneral); + } + + delete iImageList[aIndex].iMimeType; + delete iImageList[aIndex].iDisplayName; + iImageList.Remove(aIndex); + iRemovedImageCount++; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::RemovedImageCount +// ----------------------------------------------------------------------------- +// + TInt CBTServiceParameterList::RemovedImageCount() + { + return iRemovedImageCount; + } + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ResetImageHandleL +// ----------------------------------------------------------------------------- +// +void CBTServiceParameterList::ResetImageHandleL(TInt aIndex) + { + if(aIndex<0 || aIndex> iImageList.Count() ) + { + User::Leave(KErrGeneral); + } + iImageList[aIndex].iFile=RFile(); + } +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ResetObjectHandleL +// ----------------------------------------------------------------------------- +// +void CBTServiceParameterList::ResetObjectHandleL(TInt aIndex) + { + if(aIndex<0 || aIndex> iObjectList.Count() ) + { + User::Leave(KErrGeneral); + } + iObjectList[aIndex]=RFile(); + } + + +// ----------------------------------------------------------------------------- +// CBTServiceParameterList::ResetObjectHandleL +// ----------------------------------------------------------------------------- +// +void CBTServiceParameterList::MarkAsSendL(TInt aIndex) + { + if(aIndex<0 || aIndex> iImageList.Count() ) + { + User::Leave(KErrGeneral); + } + iImageList[aIndex].iSend=ETrue; + } + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,1280 @@ +/* +* 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: Service starter implementation +* +*/ + + + +// INCLUDE FILES +#include "BTServiceStarter.h" +#include "BTSUDebug.h" +#include "BTSOPPController.h" +#include "BTSBIPController.h" +#include "BTSBPPController.h" + +#include +#include +#include +#include +#include +#include "BTSProgresstimer.h" +#include +#include + +// CONSTANTS + +// From BT SIG - Assigned numbers +const TUint KBTServiceOPPSending = 0x1105; +const TUint KBTServiceDirectPrinting = 0x1118; +const TUint KBTServiceImagingResponder = 0x111B; + +const TUint KBTProgressInterval = 1000000; + + +_LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0"); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::CBTServiceStarter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBTServiceStarter::CBTServiceStarter() + : CActive( CActive::EPriorityStandard ), + iBTEngDiscovery(NULL), + iService( EBTSendingService ), + iServiceStarted( EFalse ), + iMessageServerIndex(0), + iBytesSendWithBIP(0), + iProgressDialogActive(EFalse), + iUserCancel(EFalse), + iFeatureManagerInitialized(EFalse), + iTriedBIP(EFalse), + iTriedOPP(EFalse) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ConstructL() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL()")); + iDevice = CBTDevice::NewL(); +// iDialog = CObexUtilsDialog::NewL( this ); + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + iProgressDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this); + + FeatureManager::InitializeLibL(); + iFeatureManagerInitialized = ETrue; + FLOG(_L("[BTSU]\t CBTServiceStarter::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBTServiceStarter* CBTServiceStarter::NewL() + { + CBTServiceStarter* self = new( ELeave ) CBTServiceStarter(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CBTServiceStarter::~CBTServiceStarter() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::Destructor()")); + if ( iMessageServerIndex != 0 ) + { + TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) ); + notUsedRetVal=notUsedRetVal; + FTRACE(FPrint(_L("[BTSU]\t ~CBTServiceStarter() delete ob entry %d"), notUsedRetVal ) ); + } + StopTransfer(KErrCancel); // Cancels active object + + delete iList; + delete iDevice; + + delete iController; + delete iBTEngDiscovery; + // delete iDialog; + delete iDeviceDialog; + delete iProgressDialog; + if(iProgressTimer) + { + delete iProgressTimer; + } + + if(iWaiter && iWaiter->IsStarted() ) + { + iWaiter->AsyncStop(); + } + delete iBTEngSettings; + + if ( iFeatureManagerInitialized ) + { + FeatureManager::UnInitializeLib(); + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::Destructor() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::StartServiceL +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::StartServiceL( TBTServiceType aService, + CBTServiceParameterList* aList, + CActiveSchedulerWait* aWaiter ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartServiceL()")); + + // Delete old list and take ownership of the new one + // + + delete iList; + iList = aList; + + if ( iServiceStarted ) + { + User::Leave( KErrInUse ); + } + if ( !ValidParameters( aService, aList ) ) + { + User::Leave( KErrArgument ); + } + + // Store the waiter pointer, a NULL value is also accepted + // + iWaiter = aWaiter; + + // Store the requested service + // + iService = aService; + + if( !iBTEngSettings ) + { + iBTEngSettings = CBTEngSettings::NewL( this ); + } + TBTPowerStateValue power = EBTPowerOff; + User::LeaveIfError( iBTEngSettings->GetPowerState( power ) ); + TBool offline = EFalse; + if( !power ) + { + //offline = CheckOfflineModeL(); + offline = EFalse; + } + if( !offline ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartServiceL() Phone is online, request temporary power on.")); + TurnBTPowerOnL( power ); + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::StartServiceL() completed")); + } + + + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ControllerComplete +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ControllerComplete( TInt aStatus ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ControllerComplete()")); + TInt error; + if ( iAllSend ) //stop transfer if everything is send + { + StopTransfer( aStatus ); + return; + } + if(( aStatus==KErrNone || aStatus==EBTSNoError ) && + iState == EBTSStarterFindingBIP ) + { + iBytesSendWithBIP=0; + if( iProgressGetter ) + { + iBytesSendWithBIP=iProgressGetter->GetProgressStatus(); + iProgressGetter=NULL; + delete iController; + iController = NULL; + } + if ( !iBTEngDiscovery ) + { + TRAPD(err, iBTEngDiscovery = CBTEngDiscovery::NewL(this) ); + if (err != KErrNone ) + { + StopTransfer(EBTSPuttingFailed); + return; + } + } + error=iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceOPPSending)); + if( error == KErrNone ) + { + iState = EBTSStarterFindingOPP; + } + else + { + StopTransfer(EBTSPuttingFailed); + } + } + else + { + StopTransfer( aStatus ); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::ControllerComplete() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::GetProgressStatus +// ----------------------------------------------------------------------------- +// +TInt CBTServiceStarter::GetProgressStatus() + { + if ( iProgressGetter ) + { + return iProgressGetter->GetProgressStatus()+iBytesSendWithBIP; + } + else + { + return iBytesSendWithBIP; + } + } + +void CBTServiceStarter::UpdateProgressInfoL() + { + HBufC* key = HBufC::NewL(50); + CleanupStack::PushL(key); + + HBufC* value = HBufC::NewL(50); + CleanupStack::PushL(value); + + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); + + TInt progress = GetProgressStatus(); + + key->Des().Copy(_L("progressValue")); + CHbSymbianVariant* progressvalue = CHbSymbianVariant::NewL(&progress, CHbSymbianVariant::EInt); + map->Add(*key,progressvalue); + + key->Des().Copy(_L("currentFileIdx")); + value->Des().AppendNum(iFileIndex); + CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,currentFileIdx); + + + TInt ret = iDeviceDialog->Update(*map); + + CleanupStack::PopAndDestroy(map); + CleanupStack::PopAndDestroy(value); + CleanupStack::PopAndDestroy(key); + + + if ( iProgressTimer ) + { + iProgressTimer->Tickle(); + } + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ValidParameters +// ----------------------------------------------------------------------------- +// +TBool CBTServiceStarter::ValidParameters( + TBTServiceType aService, const CBTServiceParameterList* aList) const + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ValidParameters()")); + + TBool result = EFalse; + + if ( aList != NULL ) + { + switch ( aService ) + { + case EBTSendingService: + { + // Sending service must have object or image parameters + // + if ( aList->ObjectCount() > 0 || aList->ImageCount() > 0 ) + { + result = ETrue; + } + break; + } + case EBTPrintingService: + { + // Printing service must have xhtml parameters + // + if ( aList->XhtmlCount() > 0 ) + { + result = ETrue; + } + break; + } + case EBTObjectPushService: + { + // Sending service must have object or image parameters + // + if ( aList->ObjectCount() > 0 || aList->ImageCount() > 0 ) + { + result = ETrue; + } + break; + } + default: + { + result = EFalse; + break; + } + } + } + FTRACE(FPrint(_L("[BTSU]\t CBTServiceStarter::ValidParameters() completed with %d"), result ) ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::StartProfileSelectL +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::StartProfileSelectL( TBTServiceType aService ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL()")); + LaunchWaitNoteL(); + iAllSend=EFalse; + iSendToBIPOnlyDevice = EFalse; + + if ( !iBTEngDiscovery ) + { + iBTEngDiscovery = CBTEngDiscovery::NewL(this); + } + + if ( !FeatureManager::FeatureSupported( KFeatureIdBtImagingProfile ) && (aService != EBTPrintingService) ) + { + // If BTimagingProfile is disabled, use OPP instead. + User::LeaveIfError( iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceOPPSending))); + iState = EBTSStarterFindingOPP; + return; + } + + switch ( aService ) + { + case EBTSendingService: // Find OPP + { + if ( iList->ObjectCount() > 0 ) // We try to send files with OPP profile as long as it contains non-bip objects + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() OPP")); + User::LeaveIfError( iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceOPPSending))); + iState = EBTSStarterFindingOPP; + } + else if(iList->ObjectCount() == 0 && iList->ImageCount() > 0) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() BIP")); + User::LeaveIfError( iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceImagingResponder))); + iState = EBTSStarterFindingBIP; + } + break; + } + case EBTPrintingService: // Find BPP + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() BPP")); + User::LeaveIfError( iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceDirectPrinting))); + iState = EBTSStarterFindingBPP; + break; + } + case EBTObjectPushService: // Find BIP + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() BIP")); + User::LeaveIfError( iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(), + TUUID(KBTServiceOPPSending))); + iState = EBTSStarterFindingOPP; + break; + } + default: + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() ERROR, unhandled case")); + break; + } + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileSelectL() completed")); + } + + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::StartProfileL +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::StartProfileL( TBTServiceProfile aProfile ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileL()")); + + switch ( aProfile ) + { + case EBTSBPP: + { + iController = CBTSBPPController::NewL( this, iClientChannel, + iDevice->BDAddr(), iList, + iBTEngDiscovery ); + break; + } + case EBTSOPP: + { + iController = CBTSOPPController::NewL( this, iClientChannel, + iDevice->BDAddr(), iList ); + break; + } + case EBTSBIP: + { + iController = CBTSBIPController::NewL( this, iClientChannel, + iDevice->BDAddr(), iList ); + break; + } + case EBTSNone: + default: + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileL() ERROR, unhandled case")); + break; + } + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::StartProfileL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::LaunchWaitNoteL +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::LaunchWaitNoteL() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL()")); + if ( iService == EBTPrintingService ) + { + // iDialog->LaunchWaitDialogL( R_BT_PRINTING_WAIT_NOTE ); + } + else + { + // iDialog->LaunchWaitDialogL( R_BT_CONNECTING_WAIT_NOTE ); + _LIT(KConnectText, "Connecting..."); + iProgressDialog->SetTextL(KConnectText); + iProgressDialog->ShowL(); + + } + FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::CancelWaitNote +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::CancelWaitNote() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()")); + + // if ( iDialog ) + // { + // TRAP_IGNORE( iDialog->CancelWaitDialogL() ); + if(iProgressDialog) + { + //This has to be tested + iProgressDialog->Close(); + } + // } + + FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed")); + } + + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::LaunchProgressNoteL +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, + TInt aTotalSize, TInt aFileCount) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); + (void) aTotalSize; + + if ( iService != EBTPrintingService ) + { + iProgressGetter = aGetter; + CancelWaitNote(); + + if ( !iProgressDialogActive ) + { + iFileCount = aFileCount; + iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( + KUidMsgTypeBt, R_BT_SEND_OUTBOX_SENDING ); + // iDialog->LaunchProgressDialogL( this, aTotalSize, + // R_BT_SENDING_DATA, KBTProgressInterval ); + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); + if ( iProgressTimer ) + { + iProgressTimer->Cancel(); + delete iProgressTimer; + iProgressTimer = NULL; + } + + iProgressTimer = CBTSProgressTimer::NewL( this ); + iProgressTimer->SetTimeout( KBTProgressInterval ); + + iProgressTimer->Tickle(); + + CHbSymbianVariant* value = NULL; + TBuf<6> key; + TInt data = TBluetoothDialogParams::ESend; + key.Num(TBluetoothDialogParams::EDialogType); + value = CHbSymbianVariant::NewL( (TAny*) &data, CHbSymbianVariant::EInt ); + User::LeaveIfError(map->Add( key, value )); // Takes ownership of value + iDeviceDialog->Show(KSendingDialog(),*map,this); + CleanupStack::PopAndDestroy(map); + } + iProgressDialogActive=ETrue; + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); + } + +void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) + { + HBufC* key = HBufC::NewL(50); + CleanupStack::PushL(key); + + HBufC* value = HBufC::NewL(50); + CleanupStack::PushL(value); + + CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(map); + + iFileIndex = aFileIndex+1; + key->Des().Copy(_L("currentFileIdx")); + value->Des().AppendNum(aFileIndex+1); + CHbSymbianVariant* currentFileIdx = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,currentFileIdx); + + key->Des().Copy(_L("totalFilesCnt")); + value->Des().Zero(); + value->Des().AppendNum(iFileCount); + CHbSymbianVariant* totalFilesCnt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,totalFilesCnt); + + + key->Des().Copy(_L("destinationName")); + if ( iDevice->IsValidFriendlyName() ) + { + value->Des().Copy( iDevice->FriendlyName() ); + } + else + { + value->Des().Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())); + } + + CHbSymbianVariant* destinationName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,destinationName); + + key->Des().Copy(_L("fileName")); + value->Des().Copy(aFileName); + CHbSymbianVariant* fileName = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,fileName); + + key->Des().Copy(_L("fileSzTxt")); + value->Des().Zero(); + if(aFileSize < 1024) + { + value->Des().AppendNum(aFileSize); + value->Des().Append(_L(" Bytes")); + } + else + { + TInt filesize = aFileSize/1024; + value->Des().AppendNum(filesize); + value->Des().Append(_L(" KB")); + } + + CHbSymbianVariant* fileSzTxt = CHbSymbianVariant::NewL(value, CHbSymbianVariant::EDes); + map->Add(*key,fileSzTxt); + + + key->Des().Copy(_L("fileSz")); + CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL(&aFileSize, CHbSymbianVariant::EInt); + map->Add(*key,fileSz); + + + + TInt ret = iDeviceDialog->Update(*map); + CleanupStack::PopAndDestroy(map); + CleanupStack::PopAndDestroy(value); + CleanupStack::PopAndDestroy(key); + } +// ----------------------------------------------------------------------------- +// CBTServiceStarter::CancelProgressNote +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::CancelProgressNote() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()")); + + // if ( iDialog ) + { + // TRAP_IGNORE( iDialog->CancelProgressDialogL() ); + if ( iProgressTimer ) + { + iProgressTimer->Cancel(); + delete iProgressTimer; + iProgressTimer = NULL; + } + } + if(iDeviceDialog) + { + iDeviceDialog->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::DialogDismissed +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::DialogDismissed( TInt aButtonId ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()")); + if( aButtonId == EAknSoftkeyCancel ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user")); + iUserCancel=ETrue; + if ( iController ) + { + iController->Abort(); + } + else + { + StopTransfer(KErrCancel); + } + } + else if ( aButtonId == EAknSoftkeyNo ) + { + // user abortion + // + iUserCancel = ETrue; + StopTransfer( KErrCancel ); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ShowNote +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ShowNote( TInt aReason ) const + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote()")); + +// TInt resource = 0; + TBuf<255> buf; + + switch ( aReason ) + { + case EBTSNoError: + { + /* if ( iService == EBTPrintingService ) + { + // resource = R_BT_DATA_SENT2; + + _LIT(KText, "Data Sent"); + buf.Copy(KText); + } + else + { + //resource = R_BT_DATA_SENT;*/ + _LIT(KText, "All files Sent to "); + buf.Copy(KText); + if ( iDevice->IsValidFriendlyName() ) + { + buf.Append( iDevice->FriendlyName() ); + } + else + { + TRAP_IGNORE( buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); + } + + +// } + break; + } + case EBTSConnectingFailed: + { + //resource = R_BT_DEV_NOT_AVAIL; + _LIT(KText, "Cannot establish Bluetooth connection"); + buf.Copy(KText); + break; + } + case EBTSGettingFailed: + case EBTSPuttingFailed: + { + if ( iService == EBTPrintingService ) + { + _LIT(KText, "Sending failed"); + //resource = R_BT_FAILED_TO_SEND2; + buf.Copy(KText); + } + else + { + _LIT(KText, "Failed to send Data"); + //resource = R_BT_FAILED_TO_SEND; + buf.Copy(KText); + } + break; + } + case EBTSNoSuitableProfiles: + { + if ( iService == EBTPrintingService ) + { + _LIT(KText, "Printer not supported"); + buf.Copy(KText); + // resource = R_BT_PRINTING_NOT_SUPPORTED; + } + else + { + _LIT(KText, "Failed to send Data"); + buf.Copy(KText); + // resource = R_BT_FAILED_TO_SEND; + } + break; + } + case EBTSBIPSomeSend: + { + _LIT(KText, "Failed to send Data"); + buf.Copy(KText); + //resource = R_BT_FAILED_TO_SEND; + break; + } + case EBTSBIPOneNotSend: + { + _LIT(KText, "Receiving device does not support this image format."); + buf.Copy(KText); + //resource = R_BT_NOT_RECEIVE_ONE; + break; + } + case EBTSBIPNoneSend: + { + _LIT(KText, "Receiving device does not support the needed image formats."); + buf.Copy(KText); + //resource = R_BT_NOT_RECEIVE_ANY; + break; + } + default: + { + // resource = R_BT_DEV_NOT_AVAIL; + _LIT(KText, "Cannot establish Bluetooth connection"); + buf.Copy(KText); + break; + } + } + +// TRAP_IGNORE(TObexUtilsUiLayer::ShowInformationNoteL( resource ) ); +// CHbDeviceMessageBoxSymbian::InformationL(buf); + TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC)); + FLOG(_L("[BTSU]\t CBTServiceStarter::ShowNote() completed")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::LaunchConfirmationQuery +// ----------------------------------------------------------------------------- +// +TInt CBTServiceStarter::LaunchConfirmationQuery(TInt /*aResourceId*/) + { + TInt keypress=0; +// TRAP_IGNORE( keypress = iDialog->LaunchQueryDialogL( aResourceId )); + if ( !keypress ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchConfirmationQuery(), cancelled by user")); + DialogDismissed(EAknSoftkeyNo); + CancelWaitNote(); + } + return keypress; + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::StopTransfer +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::StopTransfer(TInt aError) + { + + FLOG(_L("[BTSU]\t CBTServiceStarter::StopTransfer()")); + Cancel(); + if( !iUserCancel ) + { + CancelWaitNote(); + CancelProgressNote(); + + if ( aError != KErrCancel ) + { + ShowNote( aError ); + } + } + if ( iMessageServerIndex != 0 ) + { + TRAPD( notUsedRetVal, TObexUtilsMessageHandler::DeleteOutboxEntryL( iMessageServerIndex ) ); + notUsedRetVal=notUsedRetVal; + iMessageServerIndex=0; + FTRACE(FPrint(_L("[BTSU]\t CBTServiceStarter::StopTransfer() delete ob entry %d"), notUsedRetVal ) ); + } + // Release resources + // + if ( iList ) + { + delete iList; + iList = NULL; + } + + if ( iController ) + { + delete iController; + iController = NULL; + } + + if ( iNotifier.Handle() ) + { + iNotifier.Close(); + } + + // Reset states + // + iServiceStarted = EFalse; + if ( iWaiter && iWaiter->IsStarted() ) + { + iWaiter->AsyncStop(); + } + + iState = EBTSStarterStoppingService; + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ConnectTimedOut() +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ConnectTimedOut() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ConnectTimedOut()")); + StopTransfer(EBTSConnectingFailed); + FLOG(_L("[BTSU]\t CBTServiceStarter::ConnectTimedOut() completed")); + } +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ServiceSearchComplete() +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ServiceSearchComplete( const RSdpRecHandleArray& /*aResult*/, + TUint /*aTotalRecordsCount*/, TInt /*aErr */) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceSearchComplete()")); + } + +// ----------------------------------------------------------------------------- +// CBTServiceStarter::AttributeSearchComplete() +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::AttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, + const RSdpResultArray& /*aAttr*/, + TInt /*aErr*/ ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::AttributeSearchComplete()")); + } +// ----------------------------------------------------------------------------- +// CBTServiceStarter::ServiceAttributeSearchComplete() +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::ServiceAttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, + const RSdpResultArray& aAttr, + TInt aErr ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete()")); + TInt err = KErrNone; + if (aErr==KErrEof && aAttr.Count()>0 ) + { + RSdpResultArray results=aAttr; + iBTEngDiscovery->ParseRfcommChannel(results,iClientChannel); + + iBTEngDiscovery->CancelRemoteSdpQuery(); + + switch (iState) + { + case EBTSStarterFindingBIP: + { + TRAP(err, StartProfileL( EBTSBIP )); + iTriedBIP = ETrue; + if (err != KErrNone) + { + StopTransfer(EBTSConnectingFailed); + } + if ( iSendToBIPOnlyDevice ) + { + iAllSend = ETrue; + } + else + { + if(iList->ObjectCount() == 0) + { + iAllSend=ETrue; + } + } + break; + } + case EBTSStarterFindingOPP: + { + TRAP(err, StartProfileL( EBTSOPP ) ); + iTriedOPP = ETrue; + if (err != KErrNone) + { + StopTransfer(EBTSConnectingFailed); + } + iAllSend=ETrue; + break; + } + case EBTSStarterFindingBPP: + { + TRAP(err, StartProfileL( EBTSBPP )); + if (err != KErrNone) + { + StopTransfer(EBTSConnectingFailed); + } + break; + } + } + } + else if ( aErr==KErrEof && aAttr.Count()==0 && + iState == EBTSStarterFindingBIP && !iTriedBIP ) + { + iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(),TUUID(KBTServiceOPPSending)); + iState = EBTSStarterFindingOPP; + iTriedBIP = ETrue; + } + else if ( aErr==KErrEof && aAttr.Count()==0 && + iState == EBTSStarterFindingOPP && !iTriedOPP && + iList->ImageCount() > 0 && + FeatureManager::FeatureSupported( KFeatureIdBtImagingProfile ) ) + { + iSendToBIPOnlyDevice = ETrue; + iBTEngDiscovery->RemoteProtocolChannelQuery(iDevice->BDAddr(),TUUID(KBTServiceImagingResponder)); + iState = EBTSStarterFindingBIP; + iTriedOPP = ETrue; + } + else + { + delete iBTEngDiscovery; + iBTEngDiscovery = NULL; + StopTransfer(EBTSConnectingFailed); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::ServiceAttributeSearchComplete() done")); + } +// ----------------------------------------------------------------------------- +// CBTServiceStarter::DeviceSearchComplete() +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::DeviceSearchComplete( CBTDevice* /*aDevice*/, TInt aErr ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::DeviceSearchComplete()")); + FTRACE(FPrint(_L("[BTSU]\t CBTServiceStarter DeviceSearchComplete()aErr = %d"), aErr) ); + if ( aErr == KErrNone ) + { + TRAPD(err, StartProfileSelectL( iService )); + if (err != KErrNone ) + { + StopTransfer(err); + } + + iServiceStarted = ETrue; + } + else + { + if ( aErr == KErrCancel ) + { + iUserCancel=ETrue; + } + StopTransfer(aErr); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::DeviceSearchComplete() done")); + } + +// ----------------------------------------------------------------------------- +// From class MBTEngSettingsObserver. +// Power has changed, start searching for BT devices. +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::PowerStateChanged( TBTPowerStateValue aState ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::PowerStateChanged()")); + if( aState == EBTPowerOn && iWaitingForBTPower ) + { + iWaitingForBTPower = EFalse; + TRAP_IGNORE( StartDiscoveryL() ); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::PowerStateChanged() - completed")); + } + + +// ----------------------------------------------------------------------------- +// From class MBTEngSettingsObserver. +// Visibility has changed, ignore event. +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::VisibilityModeChanged( TBTVisibilityMode aState ) + { + (void) aState; + } + +// ----------------------------------------------------------------------------- +// Check if the phone is in offline mode, and ask the user if it is. +// ----------------------------------------------------------------------------- +// +TBool CBTServiceStarter::CheckOfflineModeL() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::CheckOfflineModeL()")); + TCoreAppUIsNetworkConnectionAllowed offline = ECoreAppUIsNetworkConnectionNotAllowed; + TBTEnabledInOfflineMode offlineAllowed = EBTDisabledInOfflineMode; + User::LeaveIfError( iBTEngSettings->GetOfflineModeSettings( offline, offlineAllowed ) ); + if( offline == ECoreAppUIsNetworkConnectionNotAllowed && + offlineAllowed == EBTEnabledInOfflineMode ) + { + User::LeaveIfError( iNotifier.Connect() ); + TBTGenericQueryNotiferParamsPckg pckg; + pckg().iMessageType = EBTActivateOffLineQuery; + pckg().iNameExists = EFalse; + iActiveNotifier = EOfflineQuery; + iNotifier.StartNotifierAndGetResponse( iStatus, KBTGenericQueryNotifierUid, + pckg, iOffline ); + SetActive(); + } + else if( offline == ECoreAppUIsNetworkConnectionNotAllowed && + offlineAllowed == EBTDisabledInOfflineMode ) + { + StopTransfer( KErrNotSupported ); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::CheckOfflineModeL() - completed")); + return ( offline == ECoreAppUIsNetworkConnectionNotAllowed ); + } + + +// ----------------------------------------------------------------------------- +// Start BT device discovery. +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::StartDiscoveryL() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::StartDiscoveryL()")); + if( !iBTEngDiscovery ) + { + iBTEngDiscovery = CBTEngDiscovery::NewL(this); + } + TInt err = iBTEngDiscovery->SearchRemoteDevice(iDevice ); + if( err ) + { + StopTransfer( err ); + } + FLOG(_L("[BTSU]\t CBTServiceStarter::StartDiscoveryL() - completed")); + } + + +// ----------------------------------------------------------------------------- +// Turn BT on and start BT device discovery if possible. +// ----------------------------------------------------------------------------- +// +void CBTServiceStarter::TurnBTPowerOnL( const TBTPowerStateValue aState ) + { + FLOG( _L("[BTSU]\t CBTServiceStarter::TurnBTPowerOnL()") ); +// if (iName() != EFalse) + { + if( !iBTEngSettings ) + { + iBTEngSettings = CBTEngSettings::NewL( this ); + } + TInt err = iBTEngSettings->ChangePowerStateTemporarily(); + iWaitingForBTPower = ETrue; + if( err ) + { + iWaitingForBTPower = EFalse; + StopTransfer( err ); + } + else if( aState == EBTPowerOn ) + { + // Power is already on, we just registered for turning it off if needed. + // Since there is no callback at this point (power is already on), start + // searching straight away. + iWaitingForBTPower = EFalse; + StartDiscoveryL(); + } + } + /* else + { + if ( !iNotifier.Handle() ) + { + User::LeaveIfError( iNotifier.Connect() ); + } + TBTGenericQueryNotiferParamsPckg pckg; + pckg().iMessageType = EBTNameQuery; + pckg().iNameExists = EFalse; + iActiveNotifier = ENameQuery; + iNotifier.StartNotifierAndGetResponse( iStatus, KBTGenericQueryNotifierUid, + pckg, iName ); + SetActive(); + }*/ + FLOG(_L("[BTSU]\t CBTServiceStarter::TurnBTPowerOnL() - completed")); + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been cancelled. +// --------------------------------------------------------------------------- +// +void CBTServiceStarter::DoCancel() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::DoCancel()")); + iNotifier.CancelNotifier( KBTGenericQueryNotifierUid ); + iNotifier.Close(); + FLOG(_L("[BTSU]\t CBTServiceStarter::DoCancel() - completed")); + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been completed. +// --------------------------------------------------------------------------- +// +void CBTServiceStarter::RunL() + { + FLOG(_L("[BTSU]\t CBTServiceStarter::RunL()")); + TInt err = iStatus.Int(); + if( !err ) + { + if ( (iActiveNotifier == ENameQuery && iName() != EFalse ) || ( iActiveNotifier == EOfflineQuery && iOffline() != EFalse ) ) + { + TBTPowerStateValue power = EBTPowerOff; + if ( iNotifier.Handle() ) + { + iNotifier.Close(); + } + User::LeaveIfError( iBTEngSettings->GetPowerState( power ) ); + TurnBTPowerOnL( power ); + } + else + { + err = KErrCancel; + } + } + + if( err ) + { + + err = ( err == KErrNotSupported ? KErrCancel : err ); + if ( iWaiter && err != KErrInUse && err != KErrCancel ) + { + err = EBTSPuttingFailed; + } + StopTransfer( err ); + } + + FLOG(_L("[BTSU]\t CBTServiceStarter::RunL() - completed")); + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when an error in RunL has occurred. +// --------------------------------------------------------------------------- +// +TInt CBTServiceStarter::RunError( TInt aError ) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::RunError()")); + StopTransfer( aError ); + FLOG(_L("[BTSU]\t CBTServiceStarter::RunError() - completed")); + return KErrNone; + } + + + + +void CBTServiceStarter::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian*/* aDialog*/) + { + FLOG(_L("[BTSU]\t CBTServiceStarter::ProgressDialogCancelled(), cancelled by user")); + iUserCancel=ETrue; + if ( iController ) + { + iController->Abort(); + } + else + { + StopTransfer(KErrCancel); + } + } + + +void CBTServiceStarter::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* /* aDialog*/) + { + } + + +void CBTServiceStarter::DataReceived(CHbSymbianVariantMap& /*aData*/) + { + + } + + +void CBTServiceStarter::DeviceDialogClosed(TInt /* aCompletionCode*/) + { + TBuf<255> buf; + _LIT(KText, "Sending Cancelled to "); + buf.Copy(KText); + if ( iDevice->IsValidFriendlyName() ) + { + buf.Append( iDevice->FriendlyName() ); + } + else + { + TRAP_IGNORE(buf.Append( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); + } + + iUserCancel=ETrue; + if ( iController ) + { + iController->Abort(); + } + else + { + StopTransfer(KErrCancel); + } + + if ( iProgressTimer ) + { + iProgressTimer->Cancel(); + delete iProgressTimer; + iProgressTimer = NULL; + } + TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, buf, KNullDesC)); + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceUtils.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002 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: Contains BTSU wide definitions. +* +*/ + + +// INCLUDE FILES +#include "BTServiceUtils.h" + +// CONSTANTS + +// ============================= LOCAL FUNCTIONS =============================== +// + +// ----------------------------------------------------------------------------- +// BTSUPanic +// Issues a Panic using the panic codes and name defined by this subsystem. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void BTSUPanic( TBTSUPanicCode aPanic ) + { + User::Panic( KBTSUModuleName, aPanic ); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexsendservices/rom/obexservicesendutils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexsendservices/rom/obexservicesendutils.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2004 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: IBY file for BtServiceUtils +* +*/ + + +#ifndef BTSERVICEUTILS_IBY +#define BTSERVICEUTILS_IBY + +#ifdef __BT +file=ABI_DIR\BUILD_DIR\obexservicesendutils.dll SHARED_LIB_DIR\obexservicesendutils.dll +#endif +#endif // BTSERVICEUTILS_IBY + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/BWINS/obexusbapiU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/BWINS/obexusbapiU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + ?CancelManageUSBServices@CObexUSB@@QAEXXZ @ 1 NONAME ; void CObexUSB::CancelManageUSBServices(void) + ?ManageUSBServices@CObexUSB@@QAEXHAAVTRequestStatus@@@Z @ 2 NONAME ; void CObexUSB::ManageUSBServices(int, class TRequestStatus &) + ?NewL@CObexUSB@@SAPAV1@XZ @ 3 NONAME ; class CObexUSB * CObexUSB::NewL(void) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/cenrep/keys_obexserviceman.xls Binary file btobexprofiles/obexserviceman/cenrep/keys_obexserviceman.xls has changed diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/conf/obexserviceman.confml Binary file btobexprofiles/obexserviceman/conf/obexserviceman.confml has changed diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/conf/obexserviceman_20016BC5.crml Binary file btobexprofiles/obexserviceman/conf/obexserviceman_20016BC5.crml has changed diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/eabi/obexusbapiu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/eabi/obexusbapiu.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,7 @@ +EXPORTS + _ZN8CObexUSB17ManageUSBServicesEiR14TRequestStatus @ 1 NONAME + _ZN8CObexUSB23CancelManageUSBServicesEv @ 2 NONAME + _ZN8CObexUSB4NewLEv @ 3 NONAME + _ZTI8CObexUSB @ 4 NONAME ; ## + _ZTV8CObexUSB @ 5 NONAME ; ## + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/group/backup_registration.xml Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002 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 a ?module_name. +* +*/ + +#include + +PRJ_PLATFORMS + + +PRJ_MMPFILES + +../group/obexserviceman.mmp +../group/obexservicemanclient.mmp +../group/obexusbapi.mmp + +PRJ_EXPORTS + +../conf/obexserviceman.confml MW_LAYER_CONFML(obexserviceman.confml) +../conf/obexserviceman_20016BC5.crml MW_LAYER_CRML(obexserviceman_20016BC5.crml) + +../obexservicemanserver/inc/obexservicemanprop.h MW_LAYER_PLATFORM_EXPORT_PATH(obexservicemanprop.h) + +// Backup registration file +backup_registration.xml /epoc32/data/z/private/101f7c87/backup_registration.xml +backup_registration.xml /epoc32/release/winscw/udeb/z/private/101f7c87/backup_registration.xml +backup_registration.xml /epoc32/release/winscw/urel/z/private/101f7c87/backup_registration.xml + + +../rom/obex.iby /epoc32/rom/include/obex.iby +../rom/obex.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obex.iby) +../rom/obexserviceman.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexserviceman.iby) +../rom/obexservicemanbt.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicemanbt.iby) +../rom/obexservicemanirda.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicemanirda.iby) +../rom/obexservicemanusb.iby CORE_MW_LAYER_IBY_EXPORT_PATH(obexservicemanusb.iby) +../rom/ObexUtils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ObexUtils.iby) +../rom/ObexUtilsResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ObexUtilsResources.iby) + + +#include "../utils/group/bld.inf" + +#include "../plugins/group/bld.inf" + + + + + + + + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/group/obexserviceman.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/group/obexserviceman.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002 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 project specification file for the SRCS. +* +*/ + +#include + +TARGET obexserviceman.exe +TARGETTYPE EXE + + + + +UID 0x1000008d 0x101F7C87 +CAPABILITY CAP_SERVER CommDD NetworkControl LocalServices +VENDORID VID_DEFAULT + +EPOCHEAPSIZE 0x500 0x800000 + +EPOCSTACKSIZE 0x4000 + +SOURCEPATH ../obexservicemanserver/src +SOURCE obexsmmain.cpp +SOURCE obexsm.cpp +SOURCE SrcsSession.cpp +SOURCE SrcsServiceManager.cpp +SOURCE SrcsMessage.cpp + + + + +USERINCLUDE ../obexservicemanserver/inc +SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // Kernel API +LIBRARY ecom.lib +LIBRARY obex.lib +LIBRARY obexutils.lib +LIBRARY btfeatures.lib +DEBUGLIBRARY flogger.lib // File logging diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/group/obexservicemanclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/group/obexservicemanclient.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2002 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: +* SRCS client side API project file. +* +* +*/ + +#include + + +TARGET obexserviceman.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x20002776 +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +START RESOURCE ../obexservicemanclient/data/0x101F7C88.rss + TARGET obexserviceman.rsc +END // RESOURCE + +SOURCEPATH ../obexservicemanclient/src + +SOURCE ObexSMClient.cpp +SOURCE ObexSMPlugin.cpp +SOURCE ObexSMProxy.cpp +SOURCE ObexSMRequester.cpp + +USERINCLUDE ../obexservicemanclient/inc +SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // Kernel API +LIBRARY ecom.lib +DEBUGLIBRARY flogger.lib // File logging + + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/group/obexusbapi.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/group/obexusbapi.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* +* +*/ + +#include + + +TARGET obexusbapi.dll +TARGETTYPE DLL + +UID 0x1000008D 0x1020896D +CAPABILITY CAP_GENERAL_DLL CommDD NetworkControl LocalServices +VENDORID VID_DEFAULT + + +SOURCEPATH ../obexservicemanclient/src + +SOURCE ObexSMClient.cpp +SOURCE usbobex.cpp +SOURCE usbclientwrapper.cpp + +USERINCLUDE ../obexservicemanclient/inc +SYSTEMINCLUDE ../../inc ../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // Kernel API +DEBUGLIBRARY flogger.lib // File logging \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/inc/obexservicemanprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/inc/obexservicemanprivatecrkeys.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Obex Service Manager private central repository key definitions. +* +*/ + + +#ifndef OBEXSERVICEMAN_PRIVATE_CR_KEYS_H +#define OBEXSERVICEMAN_PRIVATE_CR_KEYS_H + + +/** Obex Service Manager configuration CenRep UID */ +const TUid KCRUidObexServiceMan = { 0x20016BC5 }; + + +/** + * CenRep key for storing Obex USB DMA usage settings. + * + * Possible integer values: + * 0 USB DMA is not in use + * 1 USB DMA is in use + * + * Default value: 1 + * + */ +const TUint32 KObexUsbDmaUsage = 0x00000001; + +/** Enumeration for obex usb dma usage*/ +enum TObexUsbDmaUsage + { + EObexUsbDmaNotInUse = 0, + EObexUsbDmaInUse = 1 + }; + +#endif // OBEXSERVICEMAN_PRIVATE_CR_KEYS_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/data/0x101F7C88.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/data/0x101F7C88.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project ?myapp +* +*/ + + +#include "registryinfov2.rh" +#include "locodplugin.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + // resource_format_version must always be set as follows + resource_format_version = RESOURCE_FORMAT_VERSION_2; + + // UID for the DLL + dll_uid = 0x20002776; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KLOCODSERVICEINTERFACEUID; + implementations = + { + // Info for CDunPlugin + IMPLEMENTATION_INFO + { + implementation_uid = KFeatureIdSrcs ; + version_no = 1; + display_name = "ObexService Plugin"; + default_data = ""; + opaque_data = ""; + + // This implementation CANNOT be overridden by a RAM-based plug-in + rom_only = 1; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMPlugin.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the ObexServiceManager ecom plugin class declaration. +* +*/ + + +#ifndef OBEXSERVICEMANPLUGIN_H +#define OBEXSERVICEMANPLUGIN_H + +#include + +#include +#include +#include + + +#include "obexsmclient.h" + + +class CObexSMRequester; +class RObexSMServer; + +class MObexSMRequestObserver + { +public: + /** + * Tell service plugin that request has been completed. + * + * @since S60 v3.2 + * @param aBearer a Request to be completed + * @param aError Error code + */ + virtual void RequestComplete(CObexSMRequester* aRequest, TInt err) = 0; + + /** + * Get Obexservicemanager server interface + * + * @since S60 v3.2 + * @return Client handle. + */ + virtual RObexSMServer& GetServer()=0; + + }; + + + +/** + * ObexServiceManPlugin class + * + * This is the ObexServiceMan ecom plugin class + * @lib ?library + * @since S60 v3.2 + */ +class CObexSMPlugin : public CLocodServicePlugin, public MObexSMRequestObserver + { +public: + + /** + * Two-phased constructor. + * @param aParams the LocodServicePluginParams + */ + static CObexSMPlugin* NewL(TLocodServicePluginParams& aParams); + + /** + * Destructor. + */ + ~CObexSMPlugin(); + + /** + * Tell service plugin which service should be enabled or disabled according to + * specified bearer and its status. + * @since S60 v3.2 + * @param aBearer the bearer identification + * @param aStatus the status of this bearer, ETrue if it is available; + * EFalse otherwise. + */ + void ManageService(TLocodBearer aBearer, TBool aStatus); + + /** + * Tell service plugin that request has been completed. + * @since S60 v3.2 + * @param aRequest the Request to be completed. + * @param aError Error code + */ + void RequestComplete(CObexSMRequester* aRequest, TInt aError); + + /** + * Get Obexservicemanager server interface + * @since S60 v3.2 + * @return Client handle. + */ + RObexSMServer& GetServer(); + +private: + + CObexSMPlugin(TLocodServicePluginParams& aParams); + void ConstructL(); + +private: // data + RObexSMServer iObexSMServer; + RPointerArray iRequests; + }; + + + +#endif // OBEXSERVICEMANPLUGIN_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMRequester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMRequester.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006-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: obexservicemanager client request class +* +*/ + + +#ifndef OBEXSMREQUESTER_H +#define OBEXSMREQUESTER_H + +#include + +#include +#include "ObexSMPlugin.h" + +class MObexSMRequestObserver; + + +/** + * Active object request class + * + * Its instance will be used to control Asynchronous request + * from ECom plugin to obex service manager server + * + * @lib obexserviceman.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS(CObexSMRequester) : public CActive + { + +public: + + /** + * Two-phased constructor. + * + * @param aObserver the request completing observer + * @param aBearer the bearer identification + * @param aBearStatus the status of this bearer, ETrue + if it is available EFalse otherwise. + */ + static CObexSMRequester* NewL(MObexSMRequestObserver* aObserver, + TLocodBearer aBearer, TBool aBearStatus); + + /** + * Two-phased constructor. + * + * @param aObserver the request completing observer + * @param aBearer the bearer identification + * @param aBearStatus the status of this bearer, ETrue + if it is available EFalse otherwise. + */ + static CObexSMRequester* NewLC(MObexSMRequestObserver* aObserver, + TLocodBearer aBearer, TBool aBearStatus); + /** + * Destructor. + */ + virtual ~CObexSMRequester(); + + /** + * Request function + * + * @since S60 3.2 + */ + void ActivateRequest(); + /** + * Get Request Status + * + * @since S60 3.2 + * @return the requested status + */ + TBool GetStatus(); + + /** + * Get the requested bearer + * + * @since S60 3.2 + * @return the requested bearer + */ + TLocodBearer GetBearer(); + +protected: + + // from base class CActive + /** + * From CActive. + * Cancel current activity. + * + * @since S60 3.2 + */ + void DoCancel(); + + /** + * From CActive. + * Called when read or write operation is ready. + * + * @since S60 3.2 + */ + void RunL(); + + /** + * From CActive. + * Called if RunL() leaves. Retry listening after error. + * + * @since S60 3.x + * @param aError the error code + */ + TInt RunError( TInt aError ); + +private: + + + CObexSMRequester(MObexSMRequestObserver* aObserver, TLocodBearer aBearer, TBool aBearStatus); + + void ConstructL(); + +private: // data + + MObexSMRequestObserver* iObserver; + TLocodBearer iBearer; + TBool iBearStatus; + }; + + +#endif // OBEXSMREQUESTER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logging definition +* +*/ + + +#ifndef PRJ_LOGGING_H +#define PRJ_LOGGING_H + +#include "debugconfig.h" + +#ifdef PRJ_ENABLE_TRACE + +#ifdef PRJ_FILE_TRACE +#include +#else +#include +#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; + +NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow + { +public: + void Overflow(TDes16& /*aDes*/) {} + }; + +NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow + { +public: + void Overflow(TDes8& /*aDes*/) {} + }; + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TBuf16 theFinalString; + theFinalString.Append(KTracePrefix16); + TOverflowTruncate16 overflow; + theFinalString.AppendFormatList(aFmt,list,&overflow); + RDebug::Print(theFinalString); +#endif + } + +inline void Trace(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list, aFmt); +#ifdef PRJ_FILE_TRACE + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#else + TOverflowTruncate8 overflow; + TBuf8 buf8; + buf8.Append(KTracePrefix8); + buf8.AppendFormatList(aFmt, list, &overflow); + TBuf16 buf16(buf8.Length()); + buf16.Copy(buf8); + TRefByValue 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 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 buf; + buf.Append(KLeavePrefix8); + buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName); + Trace(buf); + User::LeaveIfError(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(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} + +#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} + +#define TRACE_FUNC_ENTRY_THIS {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_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}} + +#define TRACE_FUNC_THIS {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(User::LeaveIfError(REASON));} + +#define LEAVE(REASON) {static_cast(User::Leave(REASON));} + +#define TRACE_FUNC_ENTRY + +#define TRACE_FUNC_ENTRY_THIS + +#define TRACE_FUNC_EXIT + +#define TRACE_FUNC + +#define TRACE_FUNC_THIS + +#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;} +#endif // PRJ_ENABLE_TRACE + +#endif // PRJ_LOGGING_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/debugconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/debugconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_DEBUGCONFIG_H +#define OBEXSM_DEBUGCONFIG_H + +#include "prjconfig.h" + + +/** + * Custom logging variations. + */ +#ifdef PRJ_FILE_TRACE +_LIT(KLogFile,"obexservicemanclient.txt"); +_LIT(KLogDir,"locod"); +#endif + +#ifdef PRJ_ENABLE_TRACE +_LIT(KTracePrefix16, "[ObexSM] "); +_LIT8(KTracePrefix8, "[ObexSM] "); +_LIT8(KFuncFormat8, "><%S"); +_LIT8(KFuncThisFormat8, "><%S, [0x%08X]"); +_LIT8(KFuncEntryFormat8, ">%S"); +_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]"); +_LIT8(KFuncExitFormat8, "<%S"); + +_LIT(KPanicCategory, "ObexSM"); +_LIT8(KPanicPrefix8, "PANIC code "); +_LIT8(KLeavePrefix8, "LEAVE code "); +#endif + +#endif // OBEXSM_DEBUGCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/obexsmclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/obexsmclient.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2006-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: obexservicemanager client class definition +* +*/ + + +#ifndef OBEXSMCLIENT_H +#define OBEXSMCLIENT_H + +// INCLUDES +#include +#include +#include "usbobex.h" + +/// server name +_LIT(KSrcsName,"obexserviceman"); + +// Server path + +_LIT(KSrcsImg,"z:\\sys\\bin\\obexserviceman.exe"); + +// A version must be specifyed when creating a session with the server +const TUint KSrcsMajorVersionNumber=1; +const TUint KSrcsMinorVersionNumber=0; +const TUint KSrcsBuildVersionNumber=1; + +// SRCS Server Uid +const TUid KSrcsUid={0x101F7C87}; + +// Opcodes used in message passing between client and server +enum TSrcsServRequest +{ + ESrcsBTServicesON, + ESrcsBTServicesOFF, + ESrcsStartUSB, + ESrcsStopUSB, + ESrcsIrDAServicesON, + ESrcsIrDAServicesOFF, + ESrcsCancelRequest +}; + + + + +/** +* Client side thread starting function +* Start the server when client tries to contact it if it is not allready running +*/ +TInt StartThread(); + +/** + * The client class. An RSessionBase sends messages to the server with the function + * RSessionBase::SendReceive(); specifying an opcode and and array of argument pointers. + * Functions in derived classes, such as RSrcs::InitialiseServices(), are wrappers for different calls to + * SendReceive(). + */ +NONSHARABLE_CLASS (RObexSMServer): public RSessionBase + { +public: // Constructor + + /** + * C++ default constructor. + */ + RObexSMServer(); + +public: + + /** + * Turns BT services ON/OFF depending on given parameter. + * + * @since S60 v3.2 + * @param TBool aState Boolean value to toggle services. + * @return TInt indicating the success of call. + */ + TInt ManageServices(TLocodBearer aBearer, TBool aBearStatus,TRequestStatus &aStatus ); + + +public: // Functions from base classes + + /** + * From RSessionBase informs current version + * + * @since S60 v3.2 + * @return Version information about the server + */ + TVersion Version() const; + + /** + * From RSessionBase connect to the server + * + * @since S60 v3.2 + */ + TInt Connect(); + + /** + * Cancel pending request + * + * @since S60 v3.2 + */ + void CancelRequest(); + + +private: // Data + + RProcess iProses; + }; + + +#endif // OBEXSMCLIENT_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/prjconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/prjconfig.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef OBEXSM_PRJCONFIG_H +#define OBEXSM_PRJCONFIG_H + +/** + * Traces are enabled via RDebug::Print() in UDEB build, by default. + */ +#ifdef _DEBUG +#define PRJ_ENABLE_TRACE +#endif + +/** + * Traces will be written 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 // OBEXSM_PRJCONFIG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/usbclientwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/usbclientwrapper.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,79 @@ +/* +* 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: Obexserviceman client handling for usbobex api +* +*/ + + + +#ifndef CUSBCLIENTWRAPPER_H +#define CUSBCLIENTWRAPPER_H + + +#include +#include "obexsmclient.h" + + +/** + * Obexserviceman client handling for usbobex api + * + * + * @since S60 S60 v3.2 + */ +NONSHARABLE_CLASS (CUSBClientWrapper) : public CBase + { + + +public: + + static CUSBClientWrapper* NewL(); + + /** + * Destructor. + */ + virtual ~CUSBClientWrapper(); + + /** + * Turn USB services on or off + * + * @since S60 v3.2 + * @param aUSBStatus the requested USB service status + * @param aStatus the Request status + * @return None + */ + void ManageUSBServices(TBool aUSBStatus, TRequestStatus &aStatus); + + /** + * Cancel managment request and turn services off + * @since S60 v3.2 + * + */ + void CancelManageUSBServices(); + +private: + + + CUSBClientWrapper(); + + void ConstructL(); + +private: // data + + /** + * ObexServer Manager client + */ + RObexSMServer iServer; + + }; +#endif // CUSBCLIENTWRAPPER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/inc/usbobex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/inc/usbobex.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006-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: USB obexservicemanager client definition +* +*/ + + +#ifndef USBOBEX_H +#define USBOBEX_H + +#include + + +class CUSBClientWrapper; + + +/** +* Transportation string definition +*/ +_LIT8(KSrcsTransportBT,"OBEX/BT"); +_LIT8(KSrcsTransportUSB,"OBEX/USB"); +_LIT8(KSrcsTransportIrDA,"OBEX/IrDA"); + + +/** + * obexservicemanager client for usb. + * @lib obexusbapi.lib + * @since S60 v3.2 + */ +class CObexUSB : public CBase + { +public: + + /** + * Two-phased constructor. + */ + IMPORT_C static CObexUSB* NewL(); + + /** + * Destructor. + */ + ~CObexUSB(); + + /** + * Turn USB services on or off + * + * @since S60 v3.2 + * @param aUSBStatus the requested USB service status + * @param aStatus the Request status + * @return None + */ + IMPORT_C void ManageUSBServices( TBool aUSBStatus, TRequestStatus &aStatus ); + + /** + * Cancel managment request and turn services off + * @since S60 v3.2 + * + */ + IMPORT_C void CancelManageUSBServices(); + +private: + + CObexUSB(); + void ConstructL(); + +private: //data + + /** + * Obexserviceman client wrapper + */ + CUSBClientWrapper* iUSBWrapper; + }; +#endif // USBOBEX_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMClient.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2006-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: obexservicemanager client class implementation +* +*/ + + +// INCLUDE FILES +#include "obexsmclient.h" +#include +#include "debug.h" + + +// CONSTANTS +const TInt KServerConnectRetries = 2; // How many times client tries to make connection to server + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------- +// StartThread +// +// Create the server thread/process depending on the framework. +// This function is exported from the DLL and called from the client +// RObexSMServer::Connect() -method. +// Returns: TInt: Error Code +// +// --------------------------------------------------------- + +TInt StartThread() + { + TRACE_FUNC + + TInt retVal = KErrNone; + // create server - if one of this name does not already exist + TFindServer findSrcs(KSrcsName); + TFullName name; + + if ( findSrcs.Next( name ) != KErrNone ) // we don't exist already + { + TRequestStatus started; + //TSrcsStart start( started ); + const TUidType serverUid( KNullUid,KNullUid,KSrcsUid ); + + // Then we have to create the server + // This depends on if we are in WINS or target HW environment. + + TRACE_INFO(_L("[SRCS]\tclient\tSrcs StartThread(): create the server")); + // We are on target HW or EKA2 WINS. + // New process has to be created for the SRCS + RProcess server; + retVal=server.Create(KSrcsName, // Full path to SRCS + KNullDesC, // Descriptor of parameters + serverUid); // Triplet UID of executable + + // Check the return value of process creation + if ( retVal != KErrNone ) + { + // Loading failed. + TRACE_ERROR((_L("[SRCS]\tclient\tSrcs StartThread(): process creation failed %d"), retVal)); + return retVal; + } + + TRACE_INFO(_L("[SRCS]\tclient\tSrcs StartThread(): Process created successfully")); + + + // Process/Thread has been created + // Now logon to the server + TRequestStatus stat; + //server.Logon(died); + server.Rendezvous(stat); + + if (stat!=KRequestPending) + { + server.Kill(0); // abort startup + //FTRACE(FPrint(_L("c\tclient\tSrcs abort startup.\n"))); + } + else + { + server.Resume(); // logon OK - start the server + //FTRACE(FPrint(_L("c\tclient\tSrcs Resumed.\n"))); + } + + // Then wait the start or death of the server. + User::WaitForRequest(stat); + + // we can't use the 'exit reason' if the server panicked as this + // is the panic 'reason' and may be '0' which cannot be distinguished + // from KErrNone + TRACE_INFO((_L("[SRCS]\tclient\tSrcs Server started, code %d (0=>success)\n"), stat.Int())); + retVal=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + + server.Close(); + TRACE_INFO(_L("[SRCS]\tclient\tSrcs server handle closed.")); + } + + return retVal; + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +RObexSMServer::RObexSMServer() + { + } + + +// --------------------------------------------------------- +// Connect +// Handles connection to server( creates session ) +// --------------------------------------------------------- +// +TInt RObexSMServer::Connect() + { + TRACE_FUNC + + // IF there is allready a session handle, + // no other session is created. + if ( Handle() ) + { + return KErrAlreadyExists; + } + + // Else try to create a new session with server + TInt retry= KServerConnectRetries; + + FOREVER + { + // Try to make session with server + TInt retVal=CreateSession(KSrcsName,Version()); + TRACE_INFO((_L("[SRCS]\tclient\tRSrcs: create Session returned: %d"), retVal)); + if ( retVal != KErrNotFound && retVal != KErrServerTerminated ) + { + // Error which can't be handled happened. + return retVal; + } + // Decrease count + --retry; + if ( retry == 0 ) + { + return retVal; + } + + // Try to start the server + TRACE_INFO(_L("[SRCS]\tclient\tRSrcs::Connect(): try to start server")); + retVal=StartThread(); + TRACE_INFO((_L("[SRCS]\tclient\tRSrcs: StartThread returned: %d"), retVal)); + + if ( retVal != KErrNone && retVal != KErrAlreadyExists ) + { + // Error can't be handled. + return retVal; + } + } + + } + +// --------------------------------------------------------- +// Version +// Defines server version number +// --------------------------------------------------------- +// +TVersion RObexSMServer::Version() const + { + TRACE_FUNC + return( TVersion( KSrcsMajorVersionNumber, + KSrcsMinorVersionNumber, + KSrcsBuildVersionNumber )); + } + +// --------------------------------------------------------- +// ManageServices +// Sends Manage services command to SRCS. +// --------------------------------------------------------- +// +TInt RObexSMServer::ManageServices(TLocodBearer aBearer, TBool aBearStatus,TRequestStatus &aStatus ) + { + TRACE_FUNC + TInt retVal = KErrNone; + + TPckgBuf pckg; + TIpcArgs args( &pckg, NULL, NULL ); + TSrcsServRequest request; + + switch(aBearer) + { + case ELocodBearerBT: + { + if(aBearStatus) + { + request=ESrcsBTServicesON; + } + else + { + request=ESrcsBTServicesOFF; + } + } + break; + case ELocodBearerIR: + { + if(aBearStatus) + { + request=ESrcsIrDAServicesON; + } + else + { + request=ESrcsIrDAServicesOFF; + } + } + break; + case ELocodBearerUSB: + { + if(aBearStatus) + { + request=ESrcsStartUSB; + } + else + { + request=ESrcsStopUSB; + } + } + break; + default: + { + TRACE_ERROR(_L("[SRCS]\tclient\tRSrcs Manageservice: Bad bearer")); + return KErrArgument; + } + } + if ( Handle() ) + { + SendReceive( request, args, aStatus ); + } + else + { + TRACE_ERROR(_L("[SRCS]\tclient\tRSrcs ManageBTServices. No Handle")); + retVal = KErrBadHandle; + } + return retVal; + } + +// --------------------------------------------------------- +// CancelRequest +// --------------------------------------------------------- +// +void RObexSMServer::CancelRequest() + { + TPckgBuf pckg; + TIpcArgs args( &pckg, NULL, NULL ); + TSrcsServRequest request; + request=ESrcsCancelRequest; + if ( Handle() ) + { + SendReceive( request, args ); + } + + } +//end of file + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMPlugin.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the ObexServiceManager ecom plugin class implementation. +* +*/ + + +#include "ObexSMPlugin.h" +#include "ObexSMRequester.h" +#include "debug.h" + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +CObexSMPlugin* CObexSMPlugin::NewL(TLocodServicePluginParams& aParams) + { + TRACE_FUNC + CObexSMPlugin* self = new (ELeave) CObexSMPlugin(aParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CObexSMPlugin::~CObexSMPlugin() + { + TRACE_FUNC_ENTRY + iRequests.ResetAndDestroy(); + iRequests.Close(); + if(iObexSMServer.Handle()) + { + iObexSMServer.Close(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// ManageService +// --------------------------------------------------------------------------- +// +void CObexSMPlugin::ManageService(TLocodBearer aBearer, TBool aStatus) + { + TRACE_FUNC_ENTRY + TInt err = KErrNone; + CObexSMRequester* request=NULL; + + if(!iObexSMServer.Handle()) + { + err = iObexSMServer.Connect(); + } + if(err == KErrNone && aBearer != ELocodBearerUSB) + { + TRAP(err, request = CObexSMRequester::NewL(this, aBearer, aStatus)); + if(err==KErrNone) + { + err=iRequests.Append( request ); + if(err==KErrNone) + { + request->ActivateRequest(); + } + } + } + else if(err == KErrNone && aBearer == ELocodBearerUSB) + { + Observer().ManageServiceCompleted(aBearer,aStatus,ImplementationUid(), KErrNone); + } + + if(err!=KErrNone) + { + Observer().ManageServiceCompleted(aBearer,aStatus,ImplementationUid(), err); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// + +CObexSMPlugin::CObexSMPlugin(TLocodServicePluginParams& aParams) + : CLocodServicePlugin(aParams) + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CObexSMPlugin::ConstructL() + { + TRACE_FUNC + } + +// --------------------------------------------------------------------------- +// RequestComplete +// --------------------------------------------------------------------------- +// +void CObexSMPlugin::RequestComplete(CObexSMRequester* aRequest, TInt aError) + { + TRACE_FUNC_ENTRY + + TLocodBearer bearer= aRequest->GetBearer(); + TBool status = aRequest->GetStatus(); + for(TInt index=0; index //ECom header file +#include "ObexSMPlugin.h" + +// --------------------------------------------------------------------------- +// An array of TImplementationProxy objects which onnect each +// implemeation with its instantiation function +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KFeatureIdSrcs , CObexSMPlugin::NewL) + }; + +// --------------------------------------------------------------------------- +// 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; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMRequester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMRequester.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2006-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: obexservicemanager client request class implementation +* +*/ + + + +#include "ObexSMPlugin.h" +#include "ObexSMRequester.h" +#include "obexsmclient.h" +#include "debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CObexSMRequester* CObexSMRequester::NewL(MObexSMRequestObserver* aObserver, TLocodBearer aBearer, TBool aStatus) + { + TRACE_FUNC + CObexSMRequester* self = CObexSMRequester::NewLC(aObserver, aBearer,aStatus); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// NewLC +// --------------------------------------------------------------------------- +// +CObexSMRequester* CObexSMRequester::NewLC(MObexSMRequestObserver* aObserver, TLocodBearer aBearer, TBool aStatus) + { + TRACE_FUNC + CObexSMRequester* self = new( ELeave ) CObexSMRequester(aObserver,aBearer,aStatus); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CObexSMRequester::~CObexSMRequester() + { + TRACE_FUNC + Cancel(); + } + + +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void CObexSMRequester::DoCancel() + { + + } +// --------------------------------------------------------------------------- +// RunL +// --------------------------------------------------------------------------- +// +void CObexSMRequester::RunL() + { + TRACE_FUNC + iObserver->RequestComplete(this,iStatus.Int()); + } +// --------------------------------------------------------------------------- +// RunError +// --------------------------------------------------------------------------- +// +TInt CObexSMRequester::RunError( TInt aError ) + { + TRACE_FUNC + iObserver->RequestComplete(this,aError); + return KErrNone; + } +// --------------------------------------------------------------------------- +// ActivateRequest +// --------------------------------------------------------------------------- +// +void CObexSMRequester::ActivateRequest() + { + TRACE_FUNC_ENTRY + TInt err; + RObexSMServer smServer; + if(iObserver) + { + smServer=iObserver->GetServer(); + iStatus = KRequestPending; + err=smServer.ManageServices(iBearer, iBearStatus, iStatus ); + if(err==KErrNone) + { + SetActive(); + } + else + { + iObserver->RequestComplete(this,err); + } + } + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------------- +// CObexSMRequester +// --------------------------------------------------------------------------- +// +CObexSMRequester::CObexSMRequester(MObexSMRequestObserver* aObserver, + TLocodBearer aBearer, TBool aBearStatus) + : CActive(EPriorityStandard), + iObserver(aObserver), + iBearer(aBearer), + iBearStatus(aBearStatus) + { + TRACE_FUNC + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CObexSMRequester::ConstructL() + { + TRACE_FUNC + } + +// --------------------------------------------------------------------------- +// GetStatus +// --------------------------------------------------------------------------- +// +TBool CObexSMRequester::GetStatus() + { + return iBearStatus; + } + +// --------------------------------------------------------------------------- +// GetBearer +// --------------------------------------------------------------------------- +// +TLocodBearer CObexSMRequester::GetBearer() + { + return iBearer; + } +//End of file + + + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/src/usbclientwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/src/usbclientwrapper.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,112 @@ +/* +* 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: Wrapper class for usb client +* +*/ + + + +#include "usbclientwrapper.h" +#include "debug.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CUSBClientWrapper::CUSBClientWrapper() + { + TRACE_FUNC + } + + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CUSBClientWrapper::ConstructL() + { + TRACE_FUNC + } + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CUSBClientWrapper* CUSBClientWrapper::NewL() + { + CUSBClientWrapper* self = new (ELeave) CUSBClientWrapper(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CUSBClientWrapper::~CUSBClientWrapper() + { + TRACE_FUNC_ENTRY + if( iServer.Handle() ) + { + iServer.Close(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// ManageUSBServices +// --------------------------------------------------------------------------- +// +void CUSBClientWrapper::ManageUSBServices(TBool aUSBStatus, + TRequestStatus &aStatus) + { + TRACE_FUNC_ENTRY + TInt err = KErrNone; + TRequestStatus* status = &aStatus; + aStatus = KRequestPending; + if( !iServer.Handle() ) + { + err = iServer.Connect(); + } + if( err != KErrNone ) + { + User::RequestComplete( status, err ); + return; + } + err=iServer.ManageServices( ELocodBearerUSB, aUSBStatus, aStatus ); + if ( err != KErrNone ) + { + User::RequestComplete( status, err ); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// CancelManageUSBServices +// --------------------------------------------------------------------------- +// +void CUSBClientWrapper::CancelManageUSBServices() + { + if ( iServer.Handle() ) + { + iServer.CancelRequest(); + } + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanclient/src/usbobex.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanclient/src/usbobex.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: USB obexservicemanager client implementation +* +*/ + + +#include "usbobex.h" +#include "debug.h" +#include "obexsmclient.h" +#include "usbclientwrapper.h" + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +EXPORT_C CObexUSB* CObexUSB::NewL() + { + TRACE_FUNC + CObexUSB* self = new (ELeave) CObexUSB(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CObexUSB::~CObexUSB() + { + delete iUSBWrapper; + iUSBWrapper = NULL; + } + +// --------------------------------------------------------------------------- +// ManageUSBServices +// --------------------------------------------------------------------------- +// +EXPORT_C void CObexUSB::ManageUSBServices(TBool aUSBStatus, TRequestStatus &aStatus) + { + iUSBWrapper->ManageUSBServices( aUSBStatus, aStatus ); + } + +// --------------------------------------------------------------------------- +// CancelManageUSBServices +// --------------------------------------------------------------------------- +// +EXPORT_C void CObexUSB::CancelManageUSBServices() + { + iUSBWrapper->CancelManageUSBServices(); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CObexUSB::CObexUSB() + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CObexUSB::ConstructL() + { + TRACE_FUNC + iUSBWrapper = CUSBClientWrapper::NewL(); + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/bwins/SrcsClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/bwins/SrcsClientU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,13 @@ +EXPORTS + ??0RSrcs@@QAE@XZ @ 1 NONAME ; RSrcs::RSrcs(void) + ?Connect@RSrcs@@QAEHXZ @ 2 NONAME ; int RSrcs::Connect(void) + ?GetDescriptorInfo@RSrcs@@QBEHAAVTSrcsUsbDescriptorInfo@@@Z @ 3 NONAME ; int RSrcs::GetDescriptorInfo(class TSrcsUsbDescriptorInfo &) const + ?GetIrDAState@RSrcs@@QBEHAAH@Z @ 4 NONAME ; int RSrcs::GetIrDAState(int &) const + ?ManageBTServices@RSrcs@@QAEHH@Z @ 5 NONAME ; int RSrcs::ManageBTServices(int) + ?ManageIrDAServices@RSrcs@@QAEHH@Z @ 6 NONAME ; int RSrcs::ManageIrDAServices(int) + ?SignalL@TSrcsStart@@QAEXXZ @ 7 NONAME ; void TSrcsStart::SignalL(void) + ?StartThread@@YAHXZ @ 8 NONAME ; int StartThread(void) + ?StartUSB@RSrcs@@QAEHXZ @ 9 NONAME ; int RSrcs::StartUSB(void) + ?StopUSB@RSrcs@@QAEHXZ @ 10 NONAME ; int RSrcs::StopUSB(void) + ?Version@RSrcs@@QBE?AVTVersion@@XZ @ 11 NONAME ; class TVersion RSrcs::Version(void) const + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/eabi/SrcsClientu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/eabi/SrcsClientu.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,14 @@ +EXPORTS + _Z11StartThreadv @ 1 NONAME + _ZN10TSrcsStart7SignalLEv @ 2 NONAME + _ZN5RSrcs16ManageBTServicesEi @ 3 NONAME + _ZN5RSrcs18ManageIrDAServicesEi @ 4 NONAME + _ZN5RSrcs7ConnectEv @ 5 NONAME + _ZN5RSrcs7StopUSBEv @ 6 NONAME + _ZN5RSrcs8StartUSBEv @ 7 NONAME + _ZN5RSrcsC1Ev @ 8 NONAME + _ZN5RSrcsC2Ev @ 9 NONAME + _ZNK5RSrcs12GetIrDAStateERi @ 10 NONAME + _ZNK5RSrcs17GetDescriptorInfoER22TSrcsUsbDescriptorInfo @ 11 NONAME + _ZNK5RSrcs7VersionEv @ 12 NONAME + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsClSv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsClSv.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2006-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: ObexServicemanager opcodes, panic enumerations and other +* definitions. +* +*/ + + +#ifndef _SRCSCLSV_H +#define _SRCSCLSV_H + +// INCLUDES + +#include + +// CONSTANTS + +// Panic definitions +_LIT(KSrcsPanic,"Srcs panic"); + +// reasons for server panic +enum TSrcsPanic +{ + ESrcsBadRequest, + ESrcsBadDescriptor, + ESrcsBadHelper, + ESrcsBadMessage, + ESrcsNoLimitedMessage, + ESrcsClassMemberVariableIsNull, + ESrcsClassMemberVariableIsNotNull, + ESrcsMainSchedulerError, + ESrcsNotImplementedYet +}; + +/// server name +_LIT(KSrcsName,"obexserviceman"); + +// Server path + +_LIT(KSrcsImg,"z:\\sys\\bin\\obexserviceman.exe"); + +// SRCS Server Uid +const TUid KSrcsUid={0x101F7C87}; + +// SRCS Server thread memory allocation. +// These are only used in WINS when the server is not running +// before the client tries to connect to it. +#ifdef __WINS__ +const TInt KSrcsStackSize =0x2000; // 8KB +const TInt KSrcsMinHeapSize =0x1000; // 4KB +const TInt KSrcsMaxHeapSize =0x100000; // 1MB +#endif + +// A version must be specifyed when creating a session with the server +const TUint KSrcsMajorVersionNumber=1; +const TUint KSrcsMinorVersionNumber=0; +const TUint KSrcsBuildVersionNumber=1; + +// Opcodes used in message passing between client and server +enum TSrcsServRequest +{ + ESrcsBTServicesON, + ESrcsBTServicesOFF, + ESrcsStartUSB, + ESrcsStopUSB, + ESrcsIrDAServicesON, + ESrcsIrDAServicesOFF, + ESrcsCancelRequest +}; + +/** +* Define transports which are supported by SRCS +*/ +enum TSrcsTransport +{ + ESrcsTransportBT, + ESrcsTransportUSB, + ESrcsTransportIrDA +}; + +/** +* Transportation string definition +*/ +_LIT8(KSrcsTransportBT,"OBEX/BT"); +_LIT8(KSrcsTransportUSB,"OBEX/USB"); +_LIT8(KSrcsTransportIrDA,"OBEX/IrDA"); + + + +#endif // SRCSCLSV_H + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsMessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsMessage.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,92 @@ +/* +* 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: CSrcsMessage definition +* +*/ + + +#ifndef _SRCSMESSAGE_H +#define _SRCSMESSAGE_H + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * RMessage2 container class. + * Ties together client requests and helper objects dealing with them. + * Messages must be completed via this class. + */ +class CSrcsMessage : public CBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aMessage the message to handled + */ + static CSrcsMessage* NewL( const RMessage2& aMessage ); + + /** + * Destructor. + */ + virtual ~CSrcsMessage(); + +public: // New functions + + /** + * Completes a message with given reason to client. + * @param aReason Reason value for complete. + * @return none + */ + void Complete( TInt aReason ); + + /** + * Returns RMessage2 reference to message. + * @return Reference to message + */ + const RMessage2& MessagePtr(); + + /** + * Returns pointer which can be used to cancel request. + * @return Pointer to be used for cancellation + */ + const TAny* CancelPtr(); + + /** + * Overload of comparison between CSrcsMessages + * @param aMessage Reference to another CSrcsMessage + * @return Boolean True = Messages are same + * False = Messaged differ. + */ + TBool operator==( CSrcsMessage& aMessage ) const; + +private: + + /** + * C++ default constructor. + */ + CSrcsMessage( const RMessage2& aMessage ); + +private: // Data + RMessage2 iMessagePtr; // The message to be completed + const TAny* iCancelPtr; // Address of the TRequestStatus of the client-side active object - used for cancelling purposes + + }; + +#endif // SRCSMESSAGE_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSecurityPolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSecurityPolicy.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2004-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: Obexservicemanager security policy definition +* +*/ + + +#ifndef SRCS_SECURITYPOLICY_H +#define SRCS_SECURITYPOLICY_H + +// --------------------------------------------------------------------------- +// Srcs's policy +// --------------------------------------------------------------------------- +// + +// Count of ranges +const TUint KSrcsRangeCount = 2; + + +// Definition of the ranges of IPC numbers +const TInt KSrcsRanges[KSrcsRangeCount] = + { + 0, // ESrcsBTServicesON to ESrcsGetIrDAState + 7 // Out of IPC range + }; + +// Policy to implement for each of the above ranges +const TUint8 KSrcsElementsIndex[KSrcsRangeCount] = + { + 0, // applies to 0th range + CPolicyServer::ENotSupported // out of range Srcs's IPC + }; + +//Specific capability checks +const CPolicyServer::TPolicyElement KSrcsElements[] = + { + { + _INIT_SECURITY_POLICY_C1(ECapabilityLocalServices), CPolicyServer::EFailClient + } //policy 0. + }; + +// Policy structure for Srcs. This is passed to Srcs's constructor +const CPolicyServer::TPolicy KSrcsPolicy = + { + CPolicyServer::EAlwaysPass, // Indicates that Connect attempts should be processed without any further checks. + KSrcsRangeCount, // Range count + KSrcsRanges, // ranges array + KSrcsElementsIndex, // elements' index + KSrcsElements // array of elements + }; + +#endif // SRCS_SECURITYPOLICY_H + +// End of File \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2002-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: This class handles service management requests. +* +*/ + + +#ifndef _SRCSSERVICEMANAGER_H +#define _SRCSSERVICEMANAGER_H + +// INCLUDES +#include +#include "obexserviceman.h" +#include "SrcsTransport.h" +#include "SrcsInterface.h" + + + +// CONSTANTS + + +// FORWARD DECLARATIONS + +/** + * Callback interface for completing request + * + * @since S60 v3.2 + */ +class MObexSMRequestObserver + { + public: + /** + * Comleting request + * + * @since S60 v3.2 + * @param aMessage Reference to message to be completed + * @param aError Possible error code + */ + virtual void RequestCompleted(const RMessage2 &aMessage, TInt aError)=0; + }; +/** +* SRCS service manager class. +* It handles all service requests. +*/ + +class CSrcsServiceManager: public CActive + { +public: + + /** + * Two-phased constructor. + */ + static CSrcsServiceManager* NewL(); + + /** + * Destructor. + */ + virtual ~CSrcsServiceManager(); + +public: + + /** + * Manage services on or off + * + * @since S60 v3.2 + * @param aTransport Transporter name for request + * @param aState Request On or Off + * @param aObserver Callback interface for completing request + * @param aMessage Reference to message + * @return TInt Indicates if the service request has succeed. + */ + TInt ManageServices( TSrcsTransport aTransport, TBool aState, + MObexSMRequestObserver* aObserver, + const RMessage2& aMessage ); + /** + * Manage services on or off + * + * @since S60 v3.2 + * @param aTransport Transporter name for request + * @param aState Request On or Off + * @param aObserver Callback interface for completing request + * @param aMessage Reference to message + * @return None + */ + void DoManageServices( TSrcsTransport aTransport, TBool aState, MObexSMRequestObserver* aObserver, + const RMessage2& aMessage); + /** + * Manage services on or off + * + * @since S60 v3.2 + * @param aTransport Transporter name for request + * @param aState Request On or Off + * @return None + */ + void RealDoManageServiceL(TSrcsTransport aTransport, TBool aState); + +private: + /** + * Second phase constructor. + */ + void ConstructL(); + + /** + * From CActive + * + * @since S60 v3.2 + */ + void RunL(); + + + /** + * From CActive + * + * @since S60 v3.2 + */ + void RunError(); + + + /** + * From CActive + * + * @since S60 v3.2 + */ + void DoCancel(); + + /** + * Handling of Service array + * + */ + void ServiceArray(CArrayPtr &aTransport, TBool aState); + +private: + + /** + * C++ default constructor. + */ + CSrcsServiceManager(); + + /* + * Perform service controllers post-initialization + */ + void PostInitialize(CArrayPtr &aTransport); + + CArrayPtr* iBTConnectionArray; // array of BT Connections + CArrayPtr* iUSBConnectionArray; // array of USB Connections + CArrayPtr* iIrDAConnectionArray; // array of IrDA Connections + MObexSMRequestObserver* iRequestObserver; + MObexSMRequestObserver* iObserver; + RMessage2 iMessage; + TInt iErrorState; + TPtrC8 iTransportName; // Service name + TSrcsTransport iTransportType; // Service type + TBool iTransportState; // Service On/Off + }; +#endif // SRCSSERVICEMANAGER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSession.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,199 @@ +/* +* 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: SRCS session definition. +* +*/ + + + +#ifndef _SRCSSESSION_H +#define _SRCSSESSION_H + +// INCLUDES + +#include +#include "obexserviceman.h" +#include "SrcsServiceManager.h" + +// FORWARD DECLARATIONS +class CObexSM; +class CSrcsMessage; + +// CLASS DECLARATION + +/** + * CSrcsSession class represent session on server side + * + */ +class CSrcsSession : public CSession2, public MObexSMRequestObserver + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSrcsSession* NewL(CObexSM* aServer ); + + /** + * Destructor. + */ + virtual ~CSrcsSession(); + + /** + * 2nd phase construct for sessions + * @return None + */ + void CreateL( ); + +public: // Functions from base classes + + /** + * From CSession2 ServiceL + * Client-server framework calls this function + * to handle messages from client. + * @param aMessage received message class + * @return None + */ + virtual void ServiceL( const RMessage2 &aMessage ); + + /** + * From CSession2 DispatchMessageL + * Dispatchs and calls appropriate methods to + * handle messages. + * @param aMessage received message class + * @return None + */ + void DispatchMessageL( const RMessage2 &aMessage ); + + /** + * From CSession2 Server + * Returns reference to server. + * @param None + * @return Reference to server + */ + CObexSM& Server(); + +public: // New functions + + /** + * Complete Request + * @param aMessage Request message to be completed + * @param aError Error code + * @return None. + */ + void RequestCompleted(const RMessage2 &aMessage, TInt aError); + +private: // New functions + + /** + * OpCode function + * Turns Services ON/OFF according to aState + * @param aState boolean to indicate status of service. + * @return None. + */ + void ManageServices( TSrcsTransport aTransport, TBool aState, const RMessage2& aMessage ); + + /** + * Handles error situation. Panics client + * or completes message with error status. + * @param aError Error code + * @return None + */ + void HandleError( TInt aError, const RMessage2& aMessage ); + + /** + * Deletes message from message array + * @param aMessage Pointer to message to be deleted. + * @return None + */ + void DeleteMessage( CSrcsMessage* aMessage ); + + /** + * Finds a message from message array + * @param aMessage -reference to message. + * @return Pointer to CSrcsMessage -instance. + */ + CSrcsMessage* FindMessage( const RMessage2& aMessage ); + + /** + * Finds the first message with the function from message array + * @param aFunction -the request function. + * @return Pointer to CSrcsMessage -instance, NULL if not found. + */ + CSrcsMessage* FindMessage( TInt aFunction ); + + /** + * Completes a message to client + * @param aMessage -reference to message. + * @param aReason -code to be delivered to client. + */ + void CompleteMessage( const RMessage2& aMessage, TInt aReason ); + + /** + * Completes a message to client + * @param aMessage -reference to message. + * @param aReason -code to be delivered to client. + */ + void CompleteMessage( CSrcsMessage* aMessage, TInt aReason ); + + /** + * Completes any messages pending in the CBTManMessage array. + */ + void CompletePendingMessages(); + + /** + * Creates a new CSrcsMessage and puts it in + * message array. + * @param aMessage -reference to message. + * @return None + */ + void CreateSrcsMessageL( const RMessage2& aMessage ); + + /** + * Canceling previous request + * @param aMessage -reference to message. + */ + void CancelingRequest(const RMessage2& aMessage); + + /** + * Complete request when canceling + * @param aMessage Request message to be completed + * @param aError Error code + * @param aPostponeCompletion Not completed yet + * @return None. + */ + void CompleteCanceling(const RMessage2& aMessage, TInt aError, TBool& aPostponeCompletion); + +private: + + /** + * C++ default constructor. + */ + CSrcsSession( CObexSM* aServer ); + + /** + * Two-phase constructor. + */ + void ConstructL(); + + +private: // Data + CArrayPtr* iMessageArray; // array of outstanding messages + CObexSM *iServer; + TBool iCanceling; + }; + +#endif // SRCSSESSION_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Define SRCS's transport ECom interface. +* +*/ + + + +#ifndef _SRCSTRANSPORT_ +#define _SRCSTRANSPORT_ + +// INCLUDES +#include +#include +#include +#include +#include "SrcsClSv.h" + +// CONSTANTS +// UID of this interface +const TUid KCSrcsTransportUid = {0x101F7C9A}; + +// default OBEX receiving buffer size, +// used when service controller does not specify the receiving buffer size in its .rss +const TUint KSRCSDefaultReceiveMtu = 0x4000; + +// default OBEX sending buffer size, +// used when service controller does not specify the sending buffer size in its .rss +const TUint KSRCSDefaultTransmitMtu = 0x3000; + + + + +/** + * An abstract class being representative of the + * concrete class which the client wishes to use. + * It acts as a base, for a real class to provide all the + * functionality that a client requires. + * It supplies instantiation & destruction by using + * the ECom framework, and functional services + * by using the methods of the actual class. + */ +class CSrcsTransport : public CBase, public MObexAuthChallengeHandler + { +public: + + /** + * Two-phased constructor. + */ + static CSrcsTransport* NewL(TUid aImplUid, CImplementationInformation* aParams ); + + /** + * Destructor. + */ + virtual ~CSrcsTransport(); + + /** + * Request a list of all available implementations which satisfies this given interface. + * + * @param aImplInfoArray Implementation instance array. + * @return none. + */ + static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray); + + /** + * Request a list of matching implementations which satisfies this given interface. + * + * @param aMatchString String to be matched by the implemention. + * @param aImplInfoArray Implementation instance array. + * @return none. + */ + static void ListImplementationsL(const TDesC8& aMatchString, RImplInfoPtrArray& aImplInfoArray); + + /** + * Check if OBEX service is still active. + * + * @return true: OBEX service is still active. + * false: OBEX service is inactive. + */ + virtual TBool IsOBEXActive() = 0; + + /** + * Perform any outstanding initialization tasks. + * + * The transport may decide to implement two-phase initialization to improve performance where needed. + * For instance, USB Transport has to register all service controller's interfaces and complete the message from obex class controller + * as soon as possible to satisfy timing requirements and defer service controller plugin creation to later stage. + * + * @return none. + */ + virtual void PostInitializeL(); + + +protected: + /** + * C++ default Constructor + */ + inline CSrcsTransport(); + + /** + * MObexAuthChallengeHandler implementation + */ + + /** + * Password for authenticated connection + * + * @param aUserID user id. + */ + virtual void GetUserPasswordL( const TDesC& aUserID ) = 0; + + +private: + // Unique instance identifier key + TUid iDtor_ID_Key; + }; + +#include "SrcsTransport.inl" + +#endif + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Define SRCS's service controller ECom interface. +* +*/ + + +// ----------------------------------------------------------------------------- +// CSrcsTransport +// ----------------------------------------------------------------------------- +// +inline CSrcsTransport::CSrcsTransport() + { + } + +// ----------------------------------------------------------------------------- +// ~CSrcsTransport +// ----------------------------------------------------------------------------- +// +inline CSrcsTransport::~CSrcsTransport() + { + // Destroy any instance variables and then + // inform the framework that this specific + // instance of the interface has been destroyed. + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +inline CSrcsTransport* CSrcsTransport::NewL(TUid aImplUid, CImplementationInformation* aParams) + { + return REINTERPRET_CAST(CSrcsTransport*, + REComSession::CreateImplementationL(aImplUid, + _FOFF(CSrcsTransport,iDtor_ID_Key), + aParams)); + } + +// ----------------------------------------------------------------------------- +// ListAllImplementationsL +// ----------------------------------------------------------------------------- +// +inline void CSrcsTransport::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + REComSession::ListImplementationsL(KCSrcsTransportUid, aImplInfoArray); + } + +// ----------------------------------------------------------------------------- +// ListImplementationsL +// ----------------------------------------------------------------------------- +// +inline void CSrcsTransport::ListImplementationsL(const TDesC8& aMatchString, RImplInfoPtrArray& aImplInfoArray) + { + TEComResolverParams resolverParams; + resolverParams.SetDataType(aMatchString); + resolverParams.SetWildcardMatch(EFalse); + REComSession::ListImplementationsL(KCSrcsTransportUid, resolverParams, aImplInfoArray); + } + +inline void CSrcsTransport::PostInitializeL() + { + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2002 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: +* Central place for nice debug-type macros & functions +* +*/ + + +#ifndef _SRCS_DEBUG_H +#define _SRCS_DEBUG_H + +#ifdef _DEBUG + +// Enable this to enable memory tracing +// to SRCS +//#define MEMTRACE + +// Following define is to enable OOM +// situations in SRCS +// NOTE! SHOULD NEVER BE IN RELEASES +//#define TEST_OOM + +#ifdef __WINS__ + +// File logging for WIS +#define __FLOGGING__ + +#else + +// Logging with RDebug for target HW +#define __CLOGGING__ +//#define __FLOGGING__ + + +#endif //__WINS__ + +#endif + +#if defined ( __FLOGGING__ ) + +_LIT(KLogFile,"Srcslog.txt"); +_LIT(KLogDir,"SRCS"); + +#include +#include + +#define FLOG(a) {FPrint(a);} + +#define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} + +#define FTRACE(a) {a;} +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +} + +inline void FHex(const TUint8* aPtr, TInt aLen) +{ + RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); +} + +inline void FHex(const TDesC8& aDes) +{ + FHex(aDes.Ptr(), aDes.Length()); +} + +// RDebug logging +#elif defined(__CLOGGING__) + +#include + +#define FLOG(a) {RDebug::Print(a);} + +#define FLOGHEX(a) + +#define FTRACE(a) {a;} + +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); +} + + +#else // No loggings --> reduced code size +#define FLOG(a) +#define FLOGHEX(a) +#define FTRACE(a) + +#endif //_DEBUG + +#endif // SRCS_DEBUG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/obexserviceman.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexserviceman.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2006-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: ObexServicemanager opcodes, panic enumerations and other + definitions. +* +*/ + + +#ifndef OBEXSERVICEMAN_H +#define OBEXSERVICEMAN_H + +// INCLUDES + +#include +#include "SrcsClSv.h" + +/** +* Function to start server. +*/ +IMPORT_C void RunServerL(); + +/** +* Utility to panic the client. +*/ +void PanicClient(const RMessage2& aMessage, TInt aPanic); + +/** +* Utility to panic server. +*/ +void PanicServer(TInt aPanic); + +/** +* Provides server startup parameters. +*/ +class TSrcsStart +{ +public: + /** + * Constructor + */ + TSrcsStart(TRequestStatus& aStatus); + + /** + * Default constructor + * + * @since s60 3.2 + */ + inline TSrcsStart() {}; + + /** + * Provides startup parameters + * + * @since s60 3.2 + */ + TPtrC AsCommand() const; + + /** + * Signalling from Server start. + * + * @since s60 3.2 + */ + IMPORT_C void SignalL(); + + /** + * Initialize from memory + * + * @since s60 3.2 + */ + TInt Set(const TDesC& aData); + +public: // Data + TThreadId iId; + TRequestStatus* iStatus; +}; + +/** +* Number of interfaces and length of descriptors registered by SRCS +*/ +class TSrcsUsbDescriptorInfo + { +public: + TInt iNumInterfaces; + TInt iLength; + }; + +#endif // SRCSCLSV_H + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* + * 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: + * Obex Service Manager P&S keys definitions + * + */ + +#ifndef __OBEXSERVICEMANPROP_H__ +#define __OBEXSERVICEMANPROP_H__ + +#include + +const TUid KUidObexSMCategory = {0x101F7C87}; +const TUint KObexSMPostInitErrorProperty = 1; // Post Initialization Error Code + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/inc/obexsm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexsm.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006-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: CObexSM class definition + definitions. +* +*/ + + + +#ifndef OBEXSM_H +#define OBEXSM_H + +// INCLUDES + +#include +#include "obexserviceman.h" +#include "SrcsServiceManager.h" + +// FORWARD DECLARATIONS + + +/** + * CSrcs server core class + * + */ +class CObexSM : public CPolicyServer + { + +public: + + /** + * Two-phased constructor. + */ + static CObexSM* NewL(); + + /** + * Destructor. + */ + ~CObexSM(); + +public: // New functions + + /** + * Initializes all server database classes + * + * @since s60 3.2 + */ + void InitialiseServerL(); + + /** + * Manages Services that are handled by SRCS + * + * @since s60 3.2 + * @param aTransport the used transport media + * @param aState Boolean ON/OFF + * @param aObserver the request completing observer + * @param aMessage the message to be completed + * @return TInt indicating the success of call. + */ + TInt ManageServices(TSrcsTransport aTransport,TBool aState, MObexSMRequestObserver* aObserver, + const RMessage2& aMessage); + + + +public: // Functions from base classes + + + /** + * From CServer NewSessionL. + * + * @since s60 3.2 + * @param aVersion version number + * @param aMessage the connect message + * @return Pointer to session + */ + CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; + + /** + * Increase session count + * + * @since s60 3.2 + */ + void IncSessionCount(); + + /** + * Decrese session count and shutdown server when all session are closed. + * + * @since s60 3.2 + */ + void DecSessionCount(); + +private: + + /** + * Default constructor + */ + CObexSM( TInt aPriority ); + + /** + * Two-Phase constructor + */ + void ConstructL(); + +private: // Data + CSrcsServiceManager* iServiceHandler; // Service Handler + TInt iSessionCount; + }; + +#endif // OBEXSM_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsMessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsMessage.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,101 @@ +/* +* 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: obexserviceman message handling. +* +*/ + + +// INCLUDE FILES +#include "SrcsMessage.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CSrcsMessage::CSrcsMessage(const RMessage2& aMessage) + { + iMessagePtr = aMessage; + iCancelPtr = aMessage.Ptr2(); + } +// --------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------- +// +CSrcsMessage* CSrcsMessage::NewL(const RMessage2& aMessage) + { + return (new(ELeave) CSrcsMessage(aMessage)); + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CSrcsMessage::~CSrcsMessage() + { + } + +// --------------------------------------------------------- +// Complete +// Completes the RMessage2 and deletes any associated helper. +// --------------------------------------------------------- +// +void CSrcsMessage::Complete(TInt aReason) + { + //complete the message + iMessagePtr.Complete(aReason); + } + +// --------------------------------------------------------- +// MessagePtr +// Returns reference to RMessage2. +// --------------------------------------------------------- +// +const RMessage2& CSrcsMessage::MessagePtr() + { + return iMessagePtr; + } + +// --------------------------------------------------------- +// CancelPtr +// The CancelPtr is the address of the TRequestStatus of the +// client-side active object dealing with the request. +// When a request is cancelled, it is located server-side using +// this address. +// --------------------------------------------------------- +// +const TAny* CSrcsMessage::CancelPtr() + { + return iCancelPtr; + } + +// --------------------------------------------------------- +// operator== +// Compares Message pointers, if they are same, return value +// is ETrue, else EFalse. +// --------------------------------------------------------- +// +TBool CSrcsMessage::operator==(CSrcsMessage& aMessage) const + { + if (iMessagePtr == aMessage.MessagePtr()) + { + return ETrue; + } + return EFalse; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,372 @@ +/* +* Copyright (c) 2002-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: This class handles services management requests. +* +*/ + + + +// INCLUDE FILES +#include "SrcsServiceManager.h" +#include "debug.h" +#include +#include "obexservicemanprop.h" + + +// CONSTANTS + +// The granularity of the array used to hold BT, IrDA and USB connnection objects +static const TInt KConnectionArrayGranularity = 4; + +const TUint32 KObexSMSid = {0x101F7C87}; +static _LIT_SECURITY_POLICY_S0(KObexSMOnlyPolicy,KObexSMSid); +static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CSrcsServiceManager::CSrcsServiceManager():CActive(CActive::EPriorityStandard) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CSrcsServiceManager::~CSrcsServiceManager() + { + Cancel(); + RProperty::Delete(KUidObexSMCategory, KObexSMPostInitErrorProperty); + if ( iBTConnectionArray ) + { + // Cleanup the array + iBTConnectionArray->ResetAndDestroy(); + } + delete iBTConnectionArray; + + if ( iUSBConnectionArray ) + { + // Cleanup the array + iUSBConnectionArray->ResetAndDestroy(); + } + delete iUSBConnectionArray; + + + if ( iIrDAConnectionArray ) + { + // Cleanup the array + iIrDAConnectionArray->ResetAndDestroy(); + } + delete iIrDAConnectionArray; + + REComSession::FinalClose(); + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CSrcsServiceManager* CSrcsServiceManager::NewL() + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: NewL")); + CSrcsServiceManager* self = new (ELeave) CSrcsServiceManager(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// ConstructL +// --------------------------------------------------------- +// +void CSrcsServiceManager::ConstructL() + { + iBTConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); + iUSBConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); + iIrDAConnectionArray = new(ELeave) CArrayPtrFlat(KConnectionArrayGranularity); + + TInt err = RProperty::Define(KUidObexSMCategory, KObexSMPostInitErrorProperty, RProperty::EInt, KAllowAllPolicy, KObexSMOnlyPolicy); + if ( err != KErrNone && err != KErrAlreadyExists ) + { + User::LeaveIfError(err); + } + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,KErrNone); + } + +// --------------------------------------------------------- +// ManagerServicesL +// Method to manage service controllers on all supported transports. +// --------------------------------------------------------- +// +TInt CSrcsServiceManager::ManageServices( TSrcsTransport aTransport, TBool aState, + MObexSMRequestObserver* aObserver, + const RMessage2& aMessage) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServices")); + if ( !IsActive() ) + { + iStatus=KRequestPending; + DoManageServices( aTransport,aState, aObserver, aMessage ); + SetActive(); + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServices KErrNone")); + return KErrNone; + } + else + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServices KErrServerBusy")); + return KErrServerBusy; + } + } + +// --------------------------------------------------------- +// DoManageServices +// Method to manage service controllers on all supported transports. +// --------------------------------------------------------- +// +void CSrcsServiceManager::DoManageServices(TSrcsTransport aTransport, TBool aState, MObexSMRequestObserver* aObserver, + const RMessage2& aMessage) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: DoManageServices")); + iObserver=aObserver; + iMessage=aMessage; + iTransportType = aTransport; + iTransportState = aState; + TRAPD(error,RealDoManageServiceL(aTransport,aState)); + if (error != KErrNone) + { + iErrorState=error; + } + TRequestStatus* temp = &iStatus; + User::RequestComplete( temp, iErrorState ); + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: DoManageServices exit")); + } + +// --------------------------------------------------------- +// RunL +// Notifies request completion +// --------------------------------------------------------- +// +void CSrcsServiceManager::RunL() + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL")); + iObserver->RequestCompleted(iMessage,iStatus.Int()); + + // If the transport is being turned on, launch post-initialization routine + // for appropriate service controllers array + if (iTransportState) + { + switch(iTransportType) + { + case ESrcsTransportBT: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(Bluetooth)")); + PostInitialize(*iBTConnectionArray); + break; + case ESrcsTransportUSB: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(USB)")); + PostInitialize(*iUSBConnectionArray); + break; + case ESrcsTransportIrDA: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL(IrDA)")); + PostInitialize(*iIrDAConnectionArray); + break; + default: + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); + break; + } + } + else + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL() - transport is turned off")); + } + + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RunL exit")); + } +// --------------------------------------------------------- +// RunErrorL +// --------------------------------------------------------- +// +void CSrcsServiceManager::RunError() + { + } +// --------------------------------------------------------- +// DoCancel +// --------------------------------------------------------- +// +void CSrcsServiceManager::DoCancel() + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: DoCancel")); + } +// --------------------------------------------------------- +// RealDoManageServiceL +// Method to manage service controllers on all supported transports. +// --------------------------------------------------------- +// +void CSrcsServiceManager::RealDoManageServiceL(TSrcsTransport aTransport, TBool aState) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL")); + + switch(aTransport) + { + case ESrcsTransportBT: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Bluetooth)")); + iTransportName.Set(KSrcsTransportBT); + ServiceArray(*iBTConnectionArray, aState); + break; + case ESrcsTransportUSB: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(USB)")); + iTransportName.Set(KSrcsTransportUSB); + ServiceArray(*iUSBConnectionArray, aState); + break; + case ESrcsTransportIrDA: + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(IrDA)")); + iTransportName.Set(KSrcsTransportIrDA); + ServiceArray(*iIrDAConnectionArray, aState); + break; + default: + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); + User::Leave(KErrNotSupported); + } + + } + +// --------------------------------------------------------- +// CSrcsServiceManager +// Method to manage Service arrays +// --------------------------------------------------------- +// +void CSrcsServiceManager::ServiceArray(CArrayPtr &aTransport, TBool aState) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ServiceArray")); + + // We start and stop services by aState value + if ( aState ) // trun on service + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Turn ON)")); + // We do not re-start services if they have been started + if (!(aTransport.Count())) + { + //Declare array of service controllers + RImplInfoPtrArray infoArrayServiceController; + + //Declare array of SRCS transport plugins + RImplInfoPtrArray infoArrayTranport; + CleanupClosePushL(infoArrayTranport); + + CleanupClosePushL(infoArrayServiceController); + + //List all SRCS transport plugin implementations + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL about to list Transport Impl")); + CSrcsTransport::ListImplementationsL(iTransportName,infoArrayTranport); + + //Found SRCS transport plugin. Then start to enumerate service controller and make connections. + if(infoArrayTranport.Count()) + { + //There should be only one transport plugin of each type. Others are just ignored. + if(infoArrayTranport.Count() != 1) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Warning: Found %d transport implementations." ), infoArrayTranport.Count())); + } + + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Using Transport ImplementationUid %x"), infoArrayTranport[0]->ImplementationUid())); + + //enumerate service controllers + CSrcsInterface::ListImplementationsL(iTransportName,infoArrayServiceController); + + // Loop through each found service controller, + // create SRCS transport connection for each found service controller + // and instantiate the service controller. + CSrcsTransport *cm; + + for (TInt i=0; i< infoArrayServiceController.Count(); i++) + { + // TRAP is needed because of OOM situations. + // Otherwise whole server is leaving and panicing. + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Found Service Controller ImplementationUid %x"), infoArrayServiceController[i]->ImplementationUid())); + + TRAPD( error, cm = CSrcsTransport::NewL(infoArrayTranport[0]->ImplementationUid(), infoArrayServiceController[i] )); + if ( error != KErrNone ) + { + // Error when creating service controller (e.g. no memory). Cleanup and zero. + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Create implementation failed with error code %d"), error)); + } + else + { + // Add this connection to the list + aTransport.AppendL(cm); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL: Implementation created successfully."))); + } + } + } + else + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport implementation not found."))); + } + + // Clean up + infoArrayTranport.ResetAndDestroy(); + infoArrayServiceController.ResetAndDestroy(); + CleanupStack::PopAndDestroy(2); //infoArrayServiceController + + } + } + else // turn off service + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Turn OFF)")); + aTransport.ResetAndDestroy(); + // This is a special case for USB transport. Clear errors. + if (iTransportType == ESrcsTransportUSB) + { + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,KErrNone); + } + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL exit")); + } + +// ------------------------------------------------------------------------------------------ +// CSrcsServiceManager +// This function iterates through all detected service controllers for given transport +// and calls post-initialization routines. +// This solution is implemented mainly to satisfy tough timing requirements for USB transport +// ------------------------------------------------------------------------------------------ +// +void CSrcsServiceManager::PostInitialize(CArrayPtr &aTransport) + { + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize()")); + for (TInt i=0; i < aTransport.Count(); ++i) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitilize. Processing Service Controller[%d]"), i)); + TRAPD(err,aTransport[i]->PostInitializeL()); + + // This is a special case for USB transport to notify the USB OBEX class controller about any errors occured + // at Post-Initialization stage. + // Post-initialization is not implemented for Bluetooth and IrDA transports, so there is no need to notify. + if ((err != KErrNone) && (iTransportType == ESrcsTransportUSB)) + { + (void)RProperty::Set(KUidObexSMCategory,KObexSMPostInitErrorProperty,err); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize. Transport[%d]::PostInitializeL() returned %d, exiting..."), i, err)); + break; + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize() - DONE post initialization")); + } + FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: PostInitialize() exit")); + } + +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsSession.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,502 @@ +/* +* 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: SRCS session handler. Dispatchs requests from +* clients and serves them. +* +*/ + + + +// INCLUDE FILES + +#include "SrcsSession.h" +#include "obexsm.h" +#include "SrcsMessage.h" +#include "debug.h" +#include + + +// CONSTANTS + +// The granularity of the array used to hold CSrcsMessage objects +static const TInt KMessageArrayGranularity = 4; + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// constructor - must pass client to CSession2 +// --------------------------------------------------------- +// +CSrcsSession::CSrcsSession(CObexSM* aServer) : CSession2(), + iServer(aServer), + iCanceling(EFalse) + { + if(iServer) + { + iServer->IncSessionCount(); + } + } +// --------------------------------------------------------- +// destructor +// --------------------------------------------------------- +// +CSrcsSession::~CSrcsSession() + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession closed.")); + if ( iMessageArray ) + { + // Cleanup the array + iMessageArray->ResetAndDestroy(); + } + delete iMessageArray; + if(iServer) + { + iServer->DecSessionCount(); + } + } +// --------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------- +// +CSrcsSession* CSrcsSession::NewL(CObexSM* aServer) + { + return new(ELeave) CSrcsSession(aServer); + } + +// --------------------------------------------------------- +// Server +// Return a reference to CSrcs +// --------------------------------------------------------- +CObexSM& CSrcsSession::Server() + { + return *iServer; + } + +// --------------------------------------------------------- +// CreateL +// 2nd phase construct for sessions +// - called by the CServer framework +// --------------------------------------------------------- +void CSrcsSession::CreateL() + { + // Add session to server first. + // If anything leaves, it will be removed by the destructor + ConstructL(); + } + +// --------------------------------------------------------- +// ConstructL +// 2nd phase construct for sessions +// - called by the CServer framework +// +// --------------------------------------------------------- +void CSrcsSession::ConstructL() + { + iMessageArray = new(ELeave) CArrayPtrFlat(KMessageArrayGranularity); + } + +// --------------------------------------------------------- +// HandleError +// Handle an error from ServiceL() +// A bad descriptor error implies a badly programmed client, so panic it; +// otherwise report the error to the client +// +// --------------------------------------------------------- +void CSrcsSession::HandleError(TInt aError, const RMessage2& aMessage) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession::HandleError(): %d"), aError)); + if (aError==KErrBadDescriptor) + { + PanicClient( aMessage, ESrcsBadDescriptor); + } + else + { + CompleteMessage( aMessage, aError); + } + } + + +// --------------------------------------------------------- +// ServiceL +// Calls DispatchMessage under trap harness +// +// --------------------------------------------------------- +void CSrcsSession::ServiceL(const RMessage2& aMessage) + { + // First make our own message from RMessage2 + // TRAP because message needs to be completed + // in case of Leave. + TRAPD( err, CreateSrcsMessageL( aMessage )); + if ( err ) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: ServiceL. Error %d when creating message."), err)); + aMessage.Complete( err ); + } + else + { + err = KErrNone; + TRAP( err ,DispatchMessageL( aMessage )); + + // If we have an error, try to handle it with handle-error. + if ( err ) + { + HandleError( err, aMessage ); + } + } + } + +// --------------------------------------------------------- +// CreateSrcsMessageL +// Creates a CSrcsMessage and appends it to iMessageArray. +// --------------------------------------------------------- +// +void CSrcsSession::CreateSrcsMessageL(const RMessage2& aMessage) + { + __ASSERT_DEBUG(iMessageArray!=NULL, PanicServer(ESrcsClassMemberVariableIsNull)); + CSrcsMessage* message = CSrcsMessage::NewL(aMessage); + CleanupStack::PushL( message ); + iMessageArray->AppendL( message ); + CleanupStack::Pop(); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: MessageArray count: %d"), iMessageArray->Count())); + } + +// --------------------------------------------------------- +// CompleteMessage +// Finds a message based on aMessage and completes it. +// --------------------------------------------------------- +// +void CSrcsSession::CompleteMessage(const RMessage2& aMessage, TInt aReason) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteMessage.")); + CSrcsMessage* message = FindMessage(aMessage); + __ASSERT_DEBUG(message!=NULL, PanicServer(ESrcsBadMessage)); + message->Complete(aReason); + DeleteMessage( message ); + } + +// --------------------------------------------------------- +// CompleteMessage +// Completes given message. +// --------------------------------------------------------- +// +void CSrcsSession::CompleteMessage(CSrcsMessage* aMessage, TInt aReason) + { + __ASSERT_DEBUG(aMessage!=NULL, PanicServer(ESrcsBadMessage)); + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteMessage.")); + aMessage->Complete(aReason); + DeleteMessage(aMessage); + } + +// --------------------------------------------------------- +// CompletePendingMessages +// Completes any messages pending in the CBTManMessage array. +// --------------------------------------------------------- +void CSrcsSession::CompletePendingMessages() + { + __ASSERT_DEBUG(iMessageArray!=NULL, PanicServer(ESrcsClassMemberVariableIsNull)); + CSrcsMessage* messagePtr = NULL; + TInt count = iMessageArray->Count(); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession::CompletePendingMessages. Message count: %d"), count)); + + // Messages can be completed from array + // and deleted after that. + for ( TInt index = ( count-1 ) ; index >= 0 ; index-- ) + { + messagePtr = iMessageArray->At(index); + messagePtr->Complete(KErrDied); + iMessageArray->Delete(index); + delete messagePtr; + messagePtr = NULL; + } + } + +// --------------------------------------------------------- +// FindMessage +// Searches the array of CBTManMessages for the one dealing with aMessage. +// --------------------------------------------------------- +// +CSrcsMessage* CSrcsSession::FindMessage(const RMessage2& aMessage) + { + __ASSERT_DEBUG(iMessageArray!=NULL, PanicServer(ESrcsClassMemberVariableIsNull)); + FLOG(_L("[SRCS]\tserver\tCSrcsSession: FindMessage.")); + RMessagePtr2 messagePtr = aMessage; + CSrcsMessage* ptr = NULL; + + for ( TInt index = 0 ; index < iMessageArray->Count() ; index++ ) + { + ptr = iMessageArray->At( index ); + if( ptr->MessagePtr() == messagePtr ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: FindMessage. Message found")); + return ptr; + } + } + return NULL; + } + +// --------------------------------------------------------- +// FindMessage +// Searches the array for the 1st message with the function. +// --------------------------------------------------------- +// +CSrcsMessage* CSrcsSession::FindMessage(TInt aFunction) + { + __ASSERT_DEBUG(iMessageArray!=NULL, PanicServer(ESrcsClassMemberVariableIsNull)); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: FindMessage aFunction %d"), aFunction)); + CSrcsMessage* ptr = NULL; + for ( TInt index = 0 ; index < iMessageArray->Count() ; index++ ) + { + ptr = iMessageArray->At( index ); + if ( ptr->MessagePtr().Function() == aFunction ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: FindMessage. Message found")); + return ptr; + } + } + FLOG(_L("[SRCS]\tserver\tCSrcsSession: FindMessage. Message not found")); + return NULL; + } + +// --------------------------------------------------------- +// DeleteMessage +// Find the CSrcsMessage in the message array and delete it. +// --------------------------------------------------------- +// +void CSrcsSession::DeleteMessage(CSrcsMessage* aMessage) + { + __ASSERT_DEBUG(iMessageArray!=NULL, PanicServer(ESrcsClassMemberVariableIsNull)); + FLOG(_L("[SRCS]\tserver\tCSrcsSession: DeleteMessage. ")); + CSrcsMessage* ptr = NULL; + TInt count = iMessageArray->Count(); + for ( TInt index = ( count-1 ) ; index >= 0 ; index-- ) + { + ptr = iMessageArray->At( index ); + if( ptr == aMessage ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: Message deleting. ")); + //Delete the message first before removing from the array since a helper associated + //with the message will try to find the message by parsing the array as part of the + //destruction the message. + delete ptr; + iMessageArray->Delete( index ); + ptr = NULL; + break; + } + } + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: MessageArray count: %d"), iMessageArray->Count())); + //compress the array if the count is less than the length - granularity AND if the count != 0 + if ( iMessageArray->Count() ) + { + if (iMessageArray->Length() - iMessageArray->Count() >= KMessageArrayGranularity) + iMessageArray->Compress(); + } + } + + +// --------------------------------------------------------- +// DispatchMessageL +// service a client request; test the opcode and then do +// appropriate servicing +// --------------------------------------------------------- +// +void CSrcsSession::DispatchMessageL(const RMessage2 &aMessage) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: DispatchMessageL function %d"), aMessage.Function())); + iCanceling=EFalse; + switch (aMessage.Function()) + { + // Turn BT services ON (with service handler). + case ESrcsBTServicesON: + { + if ( BluetoothFeatures::EnterpriseEnablementL() != BluetoothFeatures::EEnabled ) + { + CompleteMessage(aMessage, KErrNotSupported); + } + else + { + ManageServices(ESrcsTransportBT, ETrue, aMessage); + } + break; + } + // Turn BT services OFF. + case ESrcsBTServicesOFF: + { + ManageServices(ESrcsTransportBT, EFalse, aMessage); + break; + } + + // Turn IrDA services ON (with service handler). + case ESrcsIrDAServicesON: + { + ManageServices(ESrcsTransportIrDA, ETrue, aMessage); + break; + } + // Turn IrDA services OFF. + case ESrcsIrDAServicesOFF: + { + ManageServices(ESrcsTransportIrDA, EFalse, aMessage); + break; + } + + case ESrcsStartUSB: + { + ManageServices(ESrcsTransportUSB, ETrue, aMessage); + break; + } + case ESrcsStopUSB: + { + ManageServices(ESrcsTransportUSB, EFalse, aMessage); + break; + } + case ESrcsCancelRequest: + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: DispatchMessageL: ESrcsCancelRequest")); + CancelingRequest(aMessage); + break; + } + default: + { + PanicClient( aMessage, ESrcsBadRequest); + break; + } + } + } + +// --------------------------------------------------------- +// ManageServicesL +// OpCode function; Manages Services. +// --------------------------------------------------------- +// +void CSrcsSession::ManageServices(TSrcsTransport aTransport, TBool aState, + const RMessage2& aMessage) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: ManageServicesL")); + TInt retVal = Server().ManageServices(aTransport, aState, this, aMessage); + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: ManageServicesL return %d"), retVal)); + } + +// --------------------------------------------------------- +// CancelingRequest +// Canceling the ongoing request. +// --------------------------------------------------------- +// +void CSrcsSession::CancelingRequest(const RMessage2& aMessage) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CancelingRequest")); + iCanceling=ETrue; + if (iMessageArray->Count() == 1) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CancelingRequest completing")); + CompleteMessage(aMessage, KErrGeneral); + } + else + { + //The cancel handling continues, when another request completes. + } + } + +// --------------------------------------------------------- +// RequestCompleted +// --------------------------------------------------------- +// +void CSrcsSession::RequestCompleted(const RMessage2 &aMessage, TInt aError) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: RequestCompleted")); + TBool postponeCompletion = EFalse; + if ( !iCanceling ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: RequestCompleted completing")); + CompleteMessage( aMessage, aError ); + } + else + { + CompleteCanceling(aMessage, aError, postponeCompletion); + } + if ( !postponeCompletion && iMessageArray->Count() > 0 ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: RequestCompleted dispatching")); + CSrcsMessage* messagePtr = NULL; + messagePtr=iMessageArray->At( 0 ); + RMessage2 message=messagePtr->MessagePtr(); + TRAP_IGNORE( DispatchMessageL( message ) ); + } + FLOG(_L("[SRCS]\tserver\tCSrcsSession: RequestCompleted exit")); + } + +// --------------------------------------------------------- +// CompleteCanceling +// Only USB service cancel is handled, since Locod Service +// Plugin API does not allow cancel for BT or IrDA. +// --------------------------------------------------------- +// +void CSrcsSession::CompleteCanceling(const RMessage2& aMessage, TInt aError, + TBool& aPostponeCompletion) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling")); + TBool cancelMsgFound = EFalse; + CSrcsMessage* messagePtr = NULL; + FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling function %d"), + aMessage.Function())); + switch ( aMessage.Function() ) + { + case ESrcsStartUSB: + messagePtr = FindMessage(ESrcsCancelRequest); + if ( messagePtr ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling ESrcsStartUSB found cancel req")); + RMessage2 message=messagePtr->MessagePtr(); + ManageServices(ESrcsTransportUSB, EFalse, message); + aPostponeCompletion = ETrue; + cancelMsgFound = ETrue; + } + break; + case ESrcsStopUSB: + messagePtr = FindMessage(ESrcsCancelRequest); + if ( messagePtr ) + { + CompleteMessage(aMessage, KErrCancel); + CompleteMessage(messagePtr, aError); + cancelMsgFound = ETrue; + } + break; + case ESrcsCancelRequest: + //either start or stop USB + messagePtr = FindMessage(ESrcsStartUSB); + if ( !messagePtr ) + { + messagePtr = FindMessage(ESrcsStopUSB); + } + if ( messagePtr ) + { + CompleteMessage(messagePtr, KErrCancel); + CompleteMessage(aMessage, aError); + cancelMsgFound = ETrue; + } + break; + default: + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling ESrcsCancelRequest unhandled msg")); + break; + } + if ( !cancelMsgFound ) + { + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling no message")); + CompleteMessage(aMessage, KErrGeneral); + } + FLOG(_L("[SRCS]\tserver\tCSrcsSession: CompleteCanceling exit")); + } +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/src/obexsm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/obexsm.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,165 @@ +/* +* 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: Implementation of obexservicemanager core. +* +*/ + + +// INCLUDE FILES + +#include "obexserviceman.h" +#include "obexsm.h" +#include "SrcsSession.h" +#include "SrcsServiceManager.h" +#include "debug.h" +#include "SrcsSecurityPolicy.h" +#include "obexutilsmessagehandler.h" + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CObexSM::CObexSM(TInt aPriority) + // aPriority: priority of AO + // KSrcsPolicy: TPolicy structure of Faxmodem + :CPolicyServer( aPriority, KSrcsPolicy ) + { + } +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CObexSM::~CObexSM() + { + FLOG(_L("[SRCS]\tserver\tCSrcs: Destructor") ); + + delete iServiceHandler; + + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CObexSM* CObexSM::NewL() + { + FLOG(_L("[SRCS]\tserver\tCSrcs: NewL") ); + CObexSM* self=new(ELeave) CObexSM( EPriorityBackground ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// ConstructL +// --------------------------------------------------------- +// +void CObexSM::ConstructL() + { + FLOG(_L("[SRCS]\tserver\tCSrcs: ConstrucL") ); + // and class for service handling + iServiceHandler = CSrcsServiceManager::NewL(); + // Then we are ready to start server + StartL(KSrcsName); + // Do server initialisation + InitialiseServerL(); + } + +// --------------------------------------------------------- +// NewSessionL +// Create session(s) to client(s) +// +// --------------------------------------------------------- +// +CSession2* CObexSM::NewSessionL( const TVersion& aVersion, const RMessage2& ) const + { + FLOG(_L("[SRCS]\tserver\tCSrcs NewSessionL")); + + // check we're the right version + TVersion srvVersion(KSrcsMajorVersionNumber, + KSrcsMinorVersionNumber, + KSrcsBuildVersionNumber); + + if (!User::QueryVersionSupported(srvVersion,aVersion)) + { + User::Leave(KErrNotSupported); + } + + // make new session + + return ( CSrcsSession::NewL(const_cast(this)) ); + } + +// --------------------------------------------------------- +// InitialiseServerL +// Start Media Watchers at this point. +// --------------------------------------------------------- +// +void CObexSM::InitialiseServerL() + { + FLOG(_L("[SRCS]\tserver\tSrcs Initialise Server")); + // If phone battery is removed during file receiving, + // There will be two temp file objects left in Received Folders. + // We clean those temp files here. + TFileName filename; + TObexUtilsMessageHandler::RemoveTemporaryRFileL (filename); + FLOG(_L("[SRCS]\tserver\tSrcs Initialize server complete.")); + } + +// --------------------------------------------------------- +// ManageServices +// Initialise services according to parameter value. +// --------------------------------------------------------- +// +TInt CObexSM::ManageServices(TSrcsTransport aTransport, TBool aState, + MObexSMRequestObserver* aObserver, const RMessage2& aMessage) + { + FLOG(_L("[SRCS]\tserver\tSrcs ManageServicesL")); + // Simply forward call + return iServiceHandler->ManageServices( aTransport, aState, aObserver, aMessage); + } +// --------------------------------------------------------- +// IncSessionCount +// Increase session count. +// --------------------------------------------------------- +// +void CObexSM::IncSessionCount() + { + FLOG(_L("[SRCS]\tserver\tSrcs IncSessionCount")); + iSessionCount++; + } +// --------------------------------------------------------- +// DecSessionCount +// Decrease session count +// --------------------------------------------------------- +// +void CObexSM::DecSessionCount() + { + FLOG(_L("[SRCS]\tserver\tSrcs DecSessionCount")); + if ( iSessionCount>0 ) + { + iSessionCount--; + if (iSessionCount == 0) + { + FLOG(_L("[SRCS]\tserver\tSrcs StoppingServer")); + CActiveScheduler::Stop(); + } + } + } +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/obexservicemanserver/src/obexsmmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/obexservicemanserver/src/obexsmmain.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,117 @@ +/* +* 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: Implementation of obexservicemanager core. +* +*/ + + + +// INCLUDE FILES + +#include +#include "obexserviceman.h" +#include "debug.h" +#include "obexsm.h" + + +// --------------------------------------------------------- +// PanicClient +// +// RMessage2::Panic() also completes the message. +// +// --------------------------------------------------------- +void PanicClient(const RMessage2& aMessage,TInt aPanic ) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tPanicClient: Reason = %d"), aPanic)); + aMessage.Panic(KSrcsPanic,aPanic); + } + +// --------------------------------------------------------- +// PanicServer +// +// Panic our own thread +// +// --------------------------------------------------------- +void PanicServer(TInt aPanic) + { + FTRACE(FPrint(_L("[SRCS]\tserver\tPanicServer: Reason = %d"), aPanic)); + User::Panic(KSrcsPanic, aPanic); + } + + + +// ================= OTHER EXPORTED FUNCTIONS ============== + + +// --------------------------------------------------------- +// RunServerL +// +// Perform all server initialisation, in particular creation +// of the scheduler and server and then run the scheduler. +// This is called from Srcs.exe (RunServer -method). +// +// --------------------------------------------------------- +EXPORT_C void RunServerL() + { + FLOG(_L("[SRCS]\tclient\tSrcs RunServerL")); + + // create and install the active scheduler we need + CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + + // create the server (leave it on the cleanup stack) + CleanupStack::PushL( CObexSM::NewL() ); + + + // naming the server thread after the server helps to debug panics + // ignore error - we tried the best we could + + User::RenameThread(KSrcsName); + + + RProcess::Rendezvous(KErrNone); + + + FLOG(_L("[SRCS]\tclient\tSrcs RunServerL: Starting active scheduler...")); + CActiveScheduler::Start(); + + FLOG(_L("[SRCS]\tclient\tSrcs RunServerL: Done")); + // + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2); + } + + + + + +TInt E32Main() //used in all case( WINS and TARGET) + { + __UHEAP_MARK; + + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt retVal = KErrNoMemory; + if ( cleanup ) + { + TRAP( retVal,RunServerL() ); + delete cleanup; + } + + __UHEAP_MARKEND; + return retVal; + } + + +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 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 a ?module_name. +* +*/ + + +PRJ_PLATFORMS + + +PRJ_MMPFILES + + +../group/obexservicemanbt.mmp +../group/obexservicemanir.mmp +../group/obexservicemanusb.mmp + + + + + + + + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/group/obexservicemanbt.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/group/obexservicemanbt.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2002 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 project specification file for the SRCS BT Plug-in. +* +*/ + +#include + +TARGET obexservicemanbt.dll + +TARGETTYPE PLUGIN + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101F7C9D + +SOURCEPATH ../src/bt +SOURCE obexsmbtconnection.cpp +SOURCE obexsmpasskey.cpp +SOURCE proxy.cpp + + +START RESOURCE 101f7c9d.rss + TARGET obexservicemanbt.rsc +END + +USERINCLUDE ../inc/bt ../../obexservicemanserver/inc ../../utils/inc +SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib // Base library +LIBRARY ecom.lib // ECom library +LIBRARY irobex.lib // For Object exchange +LIBRARY charconv.lib // For Unicode conversion +DEBUGLIBRARY flogger.lib // For logging +LIBRARY esock.lib // Socket functionality +LIBRARY bluetooth.lib // For Bluetooth connection +LIBRARY btengdiscovery.lib // For Bluetooth discovery +LIBRARY obexutils.lib // opaque_data parser diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/group/obexservicemanir.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/group/obexservicemanir.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2003 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 project specification file for the SRCS IrDA Plug-in. +* +*/ + +#include +TARGET obexservicemanir.dll + +TARGETTYPE PLUGIN + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101F9695 + + +SOURCEPATH ../src/ir +SOURCE obexsmirdaconnection.cpp +SOURCE proxy.cpp + + +START RESOURCE 101F9695.rss + TARGET obexservicemanir.rsc +END + +USERINCLUDE ../inc/ir ../../obexservicemanserver/inc ../../utils/inc +SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib // Base library +LIBRARY ecom.lib // ECom library +LIBRARY irda.lib // IrDA library +LIBRARY irobex.lib // For Object exchange +DEBUGLIBRARY flogger.lib // For logging +LIBRARY esock.lib // Socket functionality +LIBRARY obexutils.lib // opaque_data parser diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/group/obexservicemanusb.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/group/obexservicemanusb.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002 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 project specification file for the SRCS USB Plug-in. +* +*/ + +#include + +TARGET obexservicemanusb.dll + +TARGETTYPE PLUGIN + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101F9693 + + +SOURCEPATH ../src/usb +SOURCE obexsmusbconnection.cpp +SOURCE proxy.cpp + + +START RESOURCE 101F9693.rss + TARGET obexservicemanusb.rsc +END + +USERINCLUDE ../inc/usb ../../obexservicemanserver/inc ../../utils/inc ../../inc +SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib // Base library +LIBRARY ecom.lib // ECom library +LIBRARY irobex.lib // For Object exchange +DEBUGLIBRARY flogger.lib // For logging +LIBRARY obexutils.lib // opaque_data parser +LIBRARY centralrepository.lib diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/bt/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/bt/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2002 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: +* Central place for nice debug-type macros & functions +* +*/ + + +#ifndef SRCS_DEBUG_H +#define SRCS_DEBUG_H + +#ifdef _DEBUG + +// Enable this to enable memory tracing to SRCS +//#define MEMTRACE + +// Following define is to enable OOM situations in SRCS +// NOTE! SHOULD NEVER BE IN RELEASES +//#define TEST_OOM + +#ifdef __WINS__ + +// File logging for WIS +#define __FLOGGING__ + +#else + +// Logging with RDebug for target HW +#define __CLOGGING__ +//#define __FLOGGING__ + + +#endif //__WINS__ + +#endif + +#if defined ( __FLOGGING__ ) + +_LIT(KLogFile,"Srcslog.txt"); +_LIT(KLogDir,"SRCS"); + +#include +#include + +#define FLOG(a) {FPrint(a);} + +#define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} + +#define FTRACE(a) {a;} +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + + // If memory tracing is activated. +#ifdef MEMTRACE + TInt size; + User::Heap().AllocSize(size); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, _L("[SRCS]\tmemory\tMemory usage: %d high: %d"), size, User::Heap().Size()); +#endif +} + +inline void FHex(const TUint8* aPtr, TInt aLen) +{ + RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); +} + +inline void FHex(const TDesC8& aDes) +{ + FHex(aDes.Ptr(), aDes.Length()); +} + +// RDebug logging +#elif defined(__CLOGGING__) + +#include + +#define FLOG(a) {RDebug::Print(a);} + +#define FLOGHEX(a) + +#define FTRACE(a) {a;} + +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); +} + + +#else // No loggings --> reduced code size +#define FLOG(a) +#define FLOGHEX(a) +#define FTRACE(a) + +#endif //_DEBUG + +#endif // SRCS_DEBUG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/bt/obexsmbtconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/bt/obexsmbtconnection.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,111 @@ +/* +* 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: This class handles bt obex settings. +* +*/ + + +#ifndef _OBEXSMBTCONNECTION_H +#define _OBEXSMBTCONNECTION_H + +// INCLUDES +#include + +#include +#include "SrcsTransport.h" +#include "obexsmpasskey.h" +#include "SrcsInterface.h" +#include "btengdiscovery.h" +#include "obexutilsopaquedata.h" + +// CLASS DECLARATION +/** +* Class to handle Bluetooth connection +*/ +class CObexSMBtConnection: public CSrcsTransport + { +public: + + /** + * Two-phased constructor. + * + * @param aInitParams initial parameters + */ + static CObexSMBtConnection* NewL(TAny* aInitParams); + + /** + * Destructor. + * + */ + virtual ~CObexSMBtConnection(); + + /** + * Check if OBEX service is still active. + * + * @return ETrue: OBEX service is still active. + * EFalse: OBEX service is inactive. + */ + TBool IsOBEXActive(); + +private: + + /** + * C++ default constructor. + */ + CObexSMBtConnection(); + + /** + * Constructor. + * + * @param aInitParams initial parameters + */ + CObexSMBtConnection(TAny* aInitParams); + + /** + * Constructor + * registers to sdp and btmanager + * sets up the protocol stack + * creates new messagehandler + */ + void ConstructL(); + + /** + * MObexAuthChallengeHandler implementation + */ + + /** + * Password for authenticated connection + * + * @param aUserID User ID. + */ + void GetUserPasswordL( const TDesC& aUserID ); + +private: + CObexServer* iServer; // Obex Server + TSdpServRecordHandle iSDPHandle; // SDP handle for registrations + CObexSMPasskey* iPasskey; // Class to handle Obex passkey + + CSrcsInterface* iController; // Service Controller callback + CImplementationInformation* iImplementationInfo; // Implementation Info + + TUint iServiceUid; // short form service id, so we can unregister later + TUUID iServiceUUID; // 128-bit UUID for Nokia proprietory service + CBTEngDiscovery* iBtDiscovery; // Bteng discovery + }; + + + +#endif // SRCSBTCONNECTION_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/bt/obexsmpasskey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/bt/obexsmpasskey.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,54 @@ +/* +* 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: CObexSMPasskey definition +* +*/ + + +#ifndef _OBEXSMPASSKEY_H +#define _OBEXSMPASSKEY_H + +#include + +class CObexServer; + +/** + * Class to handle BT Obex Passkey events + */ +class CObexSMPasskey : public CActive + { +public: + static CObexSMPasskey* NewL(); + ~CObexSMPasskey(); + + void StartPassKeyRequestL(CObexServer* aObexServer); + +private: + CObexSMPasskey(); + void Cleanup(); + +private: // from CActive + void DoCancel(); + void RunL(); + TInt RunError(TInt aError); + +private: + RNotifier iNotif; // For Obex passkey notifier + TObexPasskeyBuf iObexPasskey; // Obex passkey + CObexServer* iObexServer; // Obex Server + }; + +#endif + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/ir/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/ir/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002 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: +* Central place for nice debug-type macros & functions +* +*/ + + +#ifndef SRCS_DEBUG_H +#define SRCS_DEBUG_H + +#ifdef _DEBUG + +// Enable this to enable memory tracing +// to SRCS +//#define MEMTRACE + +// Following define is to enable OOM +// situations in SRCS +// NOTE! SHOULD NEVER BE IN RELEASES +//#define TEST_OOM + +#ifdef __WINS__ + +// File logging for WIS +#define __FLOGGING__ + +#else + +// Logging with RDebug for target HW +#define __CLOGGING__ +//#define __FLOGGING__ + + +#endif //__WINS__ + +#endif + +#if defined ( __FLOGGING__ ) + +_LIT(KLogFile,"Srcslog.txt"); +_LIT(KLogDir,"SRCS"); + +#include +#include + +#define FLOG(a) {FPrint(a);} + +#define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} + +#define FTRACE(a) {a;} +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + + // If memory tracing is activated. +#ifdef MEMTRACE + TInt size; + User::Heap().AllocSize(size); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, _L("[SRCS]\tmemory\tMemory usage: %d high: %d"), size, User::Heap().Size()); +#endif +} + +inline void FHex(const TUint8* aPtr, TInt aLen) +{ + RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); +} + +inline void FHex(const TDesC8& aDes) +{ + FHex(aDes.Ptr(), aDes.Length()); +} + +// RDebug logging +#elif defined(__CLOGGING__) + +#include + +#define FLOG(a) {RDebug::Print(a);} + +#define FLOGHEX(a) + +#define FTRACE(a) {a;} + +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); +} + + +#else // No loggings --> reduced code size +#define FLOG(a) +#define FLOGHEX(a) +#define FTRACE(a) + +#endif //_DEBUG + +#endif // SRCS_DEBUG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/ir/obexsmirdaconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/ir/obexsmirdaconnection.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,100 @@ +/* +* 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: This class handles irda obex settings. +* +*/ + + + +#ifndef _SRCSIRDACONNECTION_H +#define _SRCSIRDACONNECTION_H + +// INCLUDES +#include + +#include +#include "SrcsTransport.h" +#include "SrcsInterface.h" + +// CLASS DECLARATION + +/** + * Class to handle IRDA connection + */ +class CObexSMIrDAConnection: public CSrcsTransport + { +public: + + /** + * Two-phased constructor. + * @param aInitParams initial parameters + */ + static CObexSMIrDAConnection* NewL(TAny* aInitParams); + + /** + * Destructor. + */ + virtual ~CObexSMIrDAConnection(); + + /** + * Check if OBEX service is still active. + * @return ETrue: OBEX service is still active. + * EFalse: OBEX service is inactive. + */ + TBool IsOBEXActive(); + +private: + + /** + * C++ default constructor. + */ + CObexSMIrDAConnection(); + + /** + * Constructor. + * + * @param aInitParams initial parameters + */ + CObexSMIrDAConnection(TAny* aInitParams); + + /** + * Constructor + * Open IRDA connection and creates OBEX server. + */ + void ConstructL(); + + /** + * MObexAuthChallengeHandler implementation + */ + + /** + * Password for authenticated connection + * + * @param aUserID User ID. + */ + void GetUserPasswordL( const TDesC& aUserID ); + + + +private: + CObexServer* iServer; // Obex Server + CSrcsInterface* iController; // Service Controller callback + CImplementationInformation* iImplementationInfo; // Implementation Info + }; + + + +#endif // _SRCSIRDACONNECTION_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/usb/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/usb/debug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2002 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: +* Central place for nice debug-type macros & functions +* +*/ + + +#ifndef SRCS_DEBUG_H +#define SRCS_DEBUG_H + +#ifdef _DEBUG + +// Enable this to enable memory tracing +// to SRCS +//#define MEMTRACE + +// Following define is to enable OOM +// situations in SRCS +// NOTE! SHOULD NEVER BE IN RELEASES +//#define TEST_OOM + +#ifdef __WINS__ + +// File logging for WIS +#define __FLOGGING__ + +#else + +// Logging with RDebug for target HW +#define __CLOGGING__ +//#define __FLOGGING__ + + +#endif //__WINS__ + +#endif + +#if defined ( __FLOGGING__ ) + +_LIT(KLogFile,"Srcslog.txt"); +_LIT(KLogDir,"SRCS"); + +#include +#include + +#define FLOG(a) {FPrint(a);} + +#define FLOGHEX(value, len) {RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, "", " ",value, len);} + +#define FTRACE(a) {a;} +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + + // If memory tracing is activated. +#ifdef MEMTRACE + TInt size; + User::Heap().AllocSize(size); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, _L("[SRCS]\tmemory\tMemory usage: %d high: %d"), size, User::Heap().Size()); +#endif +} + +inline void FHex(const TUint8* aPtr, TInt aLen) +{ + RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); +} + +inline void FHex(const TDesC8& aDes) +{ + FHex(aDes.Ptr(), aDes.Length()); +} + +// RDebug logging +#elif defined(__CLOGGING__) + +#include + +#define FLOG(a) {RDebug::Print(a);} + +#define FLOGHEX(a) + +#define FTRACE(a) {a;} + +// Declare the FPrint function + +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); +} + + +#else // No loggings --> reduced code size +#define FLOG(a) +#define FLOGHEX(a) +#define FTRACE(a) + +#endif //_DEBUG + +#endif // SRCS_DEBUG_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/inc/usb/obexsmusbconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/inc/usb/obexsmusbconnection.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2002-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: This class handles service connection settings. +* +*/ + + + +#ifndef OBEXSMUSBCONNECTION_H +#define OBEXSMUSBCONNECTION_H + +// INCLUDES +#include + + +#include +#include "SrcsTransport.h" +#include "SrcsInterface.h" + + +// CLASS DECLARATION + + +/** + * Class to handle USB connection + */ +class CObexSMUsbConnection: public CSrcsTransport + { +public: + /** + * Two-phased constructor. + * @param aInitParams initial parameters + */ + static CObexSMUsbConnection* NewL(TAny* aInitParams); + + /** + * Destructor. + */ + virtual ~CObexSMUsbConnection(); + + /** + * Check if OBEX service is still active. + * @return ETrue: OBEX service is still active. + * EFalse: OBEX service is inactive. + */ + TBool IsOBEXActive(); + + /** + * Perform any outstanding initialization tasks + * + * @return none. + */ + void PostInitializeL(); + +private: + + /** + * C++ default constructor. + */ + CObexSMUsbConnection(); + + /** + * Constructor. + * + * @param aInitParams initial parameters + */ + CObexSMUsbConnection(TAny* aInitParams); + + /** + * Constructor + * registers to sdp and btmanager + * sets up the protocol stack + * creates new messagehandler + */ + void ConstructL(); + + /** + * MObexAuthChallengeHandler implementation + */ + + /** + * Password for authenticated connection + * + * @param aUserID User ID. + */ + void GetUserPasswordL( const TDesC& aUserID ); + + + +private: + CObexServer* iServer; // Obex Server + CSrcsInterface* iController; // Service Controller callback + CImplementationInformation* iImplementationInfo; // Implementation Info + TUid iImplUid; + }; + +#endif // OBEXSMUSBCONNECTION_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/bt/101f7c9d.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/bt/101f7c9d.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 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 contains all the resources for the SRCS BT transport plug-in. +* +*/ + + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101F7C9D; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101F7C9A; + implementations = + { + // Info for CSrcsBTConnection + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F7C9C; + version_no = 1; + display_name = "Srcs Bluetooth Tranport"; + default_data = "OBEX/BT"; + opaque_data = ""; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/bt/obexsmbtconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/bt/obexsmbtconnection.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,295 @@ +/* +* 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: This class handles service connections. +* +*/ + + +// INCLUDE FILES +#include +#include "obexsmbtconnection.h" +#include "debug.h" + +_LIT( KBTProtocol, "RFCOMM" ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CObexSMBtConnection::CObexSMBtConnection() + { + } +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CObexSMBtConnection::CObexSMBtConnection(TAny* aInitParams) + :iImplementationInfo((CImplementationInformation *)aInitParams), + iBtDiscovery(NULL) + { + } +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CObexSMBtConnection::~CObexSMBtConnection() + { + // Cleanup + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection begin")); + + if(iPasskey) + { + iPasskey->Cancel(); + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection passkey query cancelled.")); + } + + if ( iBtDiscovery ) + { + iBtDiscovery->DeleteSdpRecord( iSDPHandle ); + delete iBtDiscovery; + } + + FTRACE( FPrint( _L( "[SRCS] CSrcsBtConnection::~CSrcsBtConnection: UnregisterSDPSettingsL" ) ) ); + + + if(iServer) + { + iServer->Stop(); + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection obex server stopped.")); + } + // Delete OBEX Server + if (iServer) + { + delete iServer; + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection obex server deleted.")); + iServer = NULL; + } + + // Delete passkey + delete iPasskey; + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection iPasskey deleted.")); + iPasskey = NULL; + + // Delete Service Controller callback + delete iController; + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection service controller deleted.")); + iController = NULL; + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CObexSMBtConnection* CObexSMBtConnection::NewL(TAny* aInitParams) + { + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection: NewL")); + CObexSMBtConnection* self = new (ELeave) CObexSMBtConnection(aInitParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------- +// ConstructL +// Method to create BT connections. +// --------------------------------------------------------- +// +void CObexSMBtConnection::ConstructL() + { + TLex8 lex; + // Create service controller implementation object + iController = CSrcsInterface::NewL(iImplementationInfo->ImplementationUid()); + + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: CSrcsInterface::NewL\t")); + iController->SetMediaType( ESrcsMediaBT ); + // parsing opaque_data in iImplementationInfo + TPtrC8 res_string = iImplementationInfo->OpaqueData(); + + CObexUtilsOpaqueData res_data(res_string); + + TBuf8 op_LocalWho; + TUint op_Protocol, op_Authenticate, op_Authorise, op_Encrypt; + TUint op_ReceiveMtu(KSRCSDefaultReceiveMtu), op_TransmitMtu(KSRCSDefaultTransmitMtu); + + // skip 1st entry: USB interface string descriptor + User::LeaveIfError ( res_data.GetString(op_LocalWho) ); + + // get 2nd entry: OBEX local who + User::LeaveIfError ( res_data.GetString(op_LocalWho) ); + + // get 3rd to 7th entry + + // All service ID should be strings ! + TBuf8 serviceUUID; + User::LeaveIfError ( res_data.GetString(serviceUUID) ); + + FTRACE(FPrint(_L("[SRCS] CObexSMBtConnection::ConstructL() serviceUUID Length %d"), serviceUUID.Length())); + + if (serviceUUID.Length() < 6) + { + User::Leave( KErrArgument ); + } + + lex.Assign(serviceUUID); + + User::LeaveIfError ( res_data.GetNumber(op_Protocol) ); + User::LeaveIfError ( res_data.GetNumber(op_Authenticate) ); + User::LeaveIfError ( res_data.GetNumber(op_Authorise) ); + User::LeaveIfError ( res_data.GetNumber(op_Encrypt) ); + + // Get OBEX packet size: + if( res_data.GetNumber(op_ReceiveMtu) != KErrNone ) + { + op_ReceiveMtu = KSRCSDefaultReceiveMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: op_ReceiveMtu not specified.\t")); + } + + if( res_data.GetNumber(op_TransmitMtu) != KErrNone ) + { + op_TransmitMtu = KSRCSDefaultTransmitMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: op_TransmitMtu not specified.\t")); + } + + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: Successfully get all data from opaque_data.\t")); + + // Create CBTEngDiscovery + + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: CBTConnection::NewL\t")); + + // For handling Obex Passkey note + iPasskey = CObexSMPasskey::NewL(); + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: CSrcsPasskey::NewL\t")); + + // For showing Error Notes + // iErrorUi = CErrorUI::NewL(); + + // set up the protocol stack... + TObexBluetoothProtocolInfo aObexBluetoothProtocolInfo; + aObexBluetoothProtocolInfo.iTransport = KBTProtocol ; + + // Configure security setting + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: Setting Security\t")); + TBTServiceSecurity sec; + sec.SetAuthentication(op_Authenticate); + sec.SetAuthorisation(op_Authorise); + sec.SetEncryption(op_Encrypt); + + TUint32 serviceUID; + lex.Inc(2); + lex.Val(serviceUID,EHex); + sec.SetUid(TUid::Uid(serviceUID)); + aObexBluetoothProtocolInfo.iAddr.SetSecurity(sec); + if (serviceUUID.Length() == 34) + { + TUint32 HH; TUint32 HL; TUint32 LH; TUint32 LL; + lex = serviceUUID.Mid(2, 8); + lex.Val(HH, EHex); + lex = serviceUUID.Mid(10, 8); + lex.Val(HL, EHex); + lex = serviceUUID.Mid(18, 8); + lex.Val(LH, EHex); + lex = serviceUUID.Mid(26, 8); + lex.Val(LL, EHex); + iServiceUUID = TUUID(HH, HL, LH, LL); + } + else + { + iServiceUUID = TUUID(serviceUID); + } + + // Configure Obex packet size + TObexProtocolPolicy aObexProtocolPolicy; + aObexProtocolPolicy.SetReceiveMtu( static_cast(op_ReceiveMtu) ); + aObexProtocolPolicy.SetTransmitMtu( static_cast(op_TransmitMtu) ); + FTRACE(FPrint(_L("[SRCS] CSrcsBtConnection: ConstructL: op_ReceiveMtu[%x] op_TransmitMtu[%x]"), + aObexProtocolPolicy.ReceiveMtu(), aObexProtocolPolicy.TransmitMtu() )); + + // try to find a available channel to start OBEX server. + TUint channel=KRfcommPassiveAutoBind; + + aObexBluetoothProtocolInfo.iAddr.SetPort( channel ); + TRAPD(err,iServer = CObexServer::NewL(aObexBluetoothProtocolInfo, aObexProtocolPolicy);) + // Try to start server on this channel + if ( err == KErrNone ) + { + err=iController->SetObexServer( iServer ); + if ( err == KErrNone ) + { + // Set authentication handler + iServer->SetCallBack( *this ); + //If there is "local who" field, set it to OBEX server. + if(op_LocalWho.Size()) + { + User::LeaveIfError ( iServer->SetLocalWho( op_LocalWho ) ); + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: SetLocalWho\t")); + } + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: SetObexServer\t")); + + // Register SDP settings + + TObexBtTransportInfo *info=(TObexBtTransportInfo*)iServer->TransportInfo(); + channel=info->iAddr.Port(); + FTRACE(FPrint(_L("[SRCS] CSrcsBtConnection: ConstructL: CObexServer started on channel %d"), channel)); + iBtDiscovery = CBTEngDiscovery::NewL(); + User::LeaveIfError ( iBtDiscovery->RegisterSdpRecord(iServiceUUID, channel, iSDPHandle )); + } + else + { + // Failed to start Obex server. Delete server and try again + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: Failed to start Obex server. Delete server and try again.\t")); + delete iServer; + iServer = NULL; + } + } + if ( !iServer ) + { + // Server did not start. + FLOG(_L("[SRCS] CSrcsBtConnection: ConstructL: Failed to start Obex server. Leave now! \t")); + User::Leave( KErrGeneral ); + } + + } + +// --------------------------------------------------------- +// GetUserPasswordL(const TDesC& ) +// Purpose: Get the Obex password from user with ObexPasskeyNotifier +// Parameters: +// Return value: +// --------------------------------------------------------- +// +void CObexSMBtConnection::GetUserPasswordL( const TDesC& ) + { + FLOG( _L( "[SRCS] CSrcsBtConnection: GetUserPassword\t" ) ); + iPasskey->StartPassKeyRequestL( iServer ); + } + +// --------------------------------------------------------- +// Check if OBEX service is still active. +// @return ETrue: OBEX service is still active. +// EFalse: OBEX service is inactive. +// --------------------------------------------------------- +// +TBool CObexSMBtConnection::IsOBEXActive() + { + FLOG( _L( "[SRCS] CSrcsBtConnection: IsOBEXActive\t" ) ); + return ETrue; + } + +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/bt/obexsmpasskey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/bt/obexsmpasskey.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,122 @@ +/* +* 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: Class to handle Obexpasskey queries +* +*/ + + + +// INCLUDE FILES +#include "obexsmpasskey.h" +#include +#include +#include "debug.h" + + +CObexSMPasskey::CObexSMPasskey() + : CActive(CActive::EPriorityStandard) + { + CActiveScheduler::Add(this); + } + +CObexSMPasskey* CObexSMPasskey::NewL() + { + CObexSMPasskey* self = new (ELeave) CObexSMPasskey; + return self; + } + +CObexSMPasskey::~CObexSMPasskey() + { + Cancel(); + iNotif.Close(); + FLOG( _L( "[SRCS] CObexSMPasskey: ~CObexSMPasskey" ) ); + } + +void CObexSMPasskey::Cleanup() + { + iNotif.CancelNotifier( KBTObexPasskeyQueryNotifierUid ); + iNotif.Close(); + } + +// --------------------------------------------------------- +// DoCancel() +// Purpose: Cancels ObexPasskey notifier +// Parameters: +// Return value: +// --------------------------------------------------------- +// +void CObexSMPasskey::DoCancel() + { + Cleanup(); + FLOG( _L( "[SRCS] CObexSMPasskey: DoCancel" ) ); + } + +// --------------------------------------------------------- +// RunL() +// Purpose: Handles ObexPasskey notifiers return value +// Parameters: +// Return value: +// --------------------------------------------------------- +// +void CObexSMPasskey::RunL() + { + if ( iStatus.Int() != KErrNone ) + { + FLOG( _L( "[SRCS] CObexSMPasskey: RunL::Cancel\t" ) ); + User::Leave(KErrCancel); + } + + TBuf tempResultBuffer; + CnvUtfConverter::ConvertToUnicodeFromUtf8( tempResultBuffer, iObexPasskey() ); + iObexServer->UserPasswordL( tempResultBuffer ); + FLOG( _L( "[SRCS] CObexSMPasskey: RunL ObexPasskey returned\t" ) ); + + Cleanup(); + } + +// --------------------------------------------------------- +// RunError( TInt aError ) +// Purpose: Handle error cases +// Parameters: TInt +// Return value: error value +// --------------------------------------------------------- +// +TInt CObexSMPasskey::RunError( TInt aError ) + { + FTRACE(FPrint(_L("[SRCS] CObexSMPasskey: RunError: aError = %d"), aError)); + Cleanup(); + iObexServer->Error(aError); // Ensure that OBEX is kept informed of the problem. + return KErrNone; + } + +// --------------------------------------------------------- +// StartPassKeyRequestL( CObexServer* aObexServer ) +// Purpose: Starts ObexPasskey notifier +// Parameters: CObexServer* +// Return value: +// --------------------------------------------------------- +// +void CObexSMPasskey::StartPassKeyRequestL( CObexServer* aObexServer ) + { + FLOG( _L( "[SRCS] CObexSMPasskey: StartPassKeyRequest" ) ); + User::LeaveIfError( iNotif.Connect() ); + TPtrC8 dummy( KNullDesC8 ); + // Starts notifier and gets the passkey for Obex + iNotif.StartNotifierAndGetResponse( iStatus, KBTObexPasskeyQueryNotifierUid, dummy, iObexPasskey ); + iObexServer = aObexServer; + SetActive(); + FLOG( _L( "[SRCS] CObexSMPasskey: SetActive" ) ); + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/bt/proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/bt/proxy.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,38 @@ +/* +* 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: This class export ECom interface implementations. +* +*/ + + +#include +#include + +#include "obexsmbtconnection.h" + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F7C9C, CObexSMBtConnection::NewL) + //{{0x101F7C9C}, CSrcsBtConnection::NewL}, + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/ir/101F9695.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/ir/101F9695.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 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 contains all the resources for the SRCS IrDA transport plug-in. +* +*/ + + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101F9695; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x101F7C9A; + implementations = + { + // Info for CSrcsBTConnection + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F9694; + version_no = 1; + display_name = "Srcs IrDA Tranport"; + default_data = "OBEX/IrDA"; + opaque_data = ""; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/ir/obexsmirdaconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/ir/obexsmirdaconnection.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,234 @@ +/* +* 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: This class handles service connections. +* +*/ + + + +// INCLUDE FILES + +#include "obexsmirdaconnection.h" +#include "debug.h" +#include "obexutilsopaquedata.h" + +const TUint16 KMaxMtuSize = 0x7FFF; // 32kB-1 + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CObexSMIrDAConnection::CObexSMIrDAConnection() + { + } +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CObexSMIrDAConnection::CObexSMIrDAConnection(TAny* aInitParams) + :iImplementationInfo((CImplementationInformation *)aInitParams) + { + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CObexSMIrDAConnection::~CObexSMIrDAConnection() + { + // Cleanup + FLOG(_L("[SRCS]\tserver\tCSrcsIrDAConnection::~CSrcsIrDAConnection")); + if(iServer) + { + iServer->Stop(); + FLOG(_L("[SRCS]\tserver\tCSrcsIrDAConnection::~CSrcsIrDAConnection: OBEX server stopped.")); + } + + // Delete OBEX Server + if (iServer) + { + delete iServer; + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection obex server deleted.")); + iServer = NULL; + } + + // Delete Service Controller callback + delete iController; + FLOG(_L("[SRCS]\tserver\tCSrcsIrDAConnection::~CSrcsIrDAConnection: service controller deleted.")); + iController = NULL; + + FLOG(_L("[SRCS]\tserver\tCSrcsIrDAConnection::~CSrcsIrDAConnection finished.")); + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CObexSMIrDAConnection* CObexSMIrDAConnection::NewL(TAny* aInitParams) + { + FLOG(_L("[SRCS]\tserver\tCSrcsIrDAConnection: NewL")); + CObexSMIrDAConnection* self = new (ELeave) CObexSMIrDAConnection(aInitParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------- +// ConstructL +// Method to create IrDA connections. +// --------------------------------------------------------- +// +void CObexSMIrDAConnection::ConstructL() + { + + // Create service controller implementation object + iController = CSrcsInterface::NewL(iImplementationInfo->ImplementationUid()); + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: CSrcsInterface::NewL\t")); + + iController->SetMediaType( ESrcsMediaIrDA ); + + //Start service controller state machine. + iController->IsOBEXActive(); + + // parsing opaque_data in iImplementationInfo + TPtrC8 res_string = iImplementationInfo->OpaqueData(); + + CObexUtilsOpaqueData res_data(res_string); + TBuf8 op_StringDesc, op_LocalWho, op_SkipStr; + TUint op_SkipInt; //used to skip certain fields + TUint op_ReceiveMtu(KSRCSDefaultReceiveMtu), op_TransmitMtu(KSRCSDefaultTransmitMtu); + + // get 1st entry: USB interface string descriptor + User::LeaveIfError ( res_data.GetString(op_StringDesc) ); + + // get 2nd entry: OBEX local who + User::LeaveIfError ( res_data.GetString(op_LocalWho) ); + + // skip 3rd to 7th entry + // All service ID should be strings ! + res_data.GetString(op_SkipStr); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + + // Get OBEX packet size: + if( res_data.GetNumber(op_ReceiveMtu) != KErrNone ) + { + op_ReceiveMtu = KSRCSDefaultReceiveMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: op_ReceiveMtu not specified.\t")); + } + + if( res_data.GetNumber(op_TransmitMtu) != KErrNone ) + { + op_TransmitMtu = KSRCSDefaultTransmitMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: op_TransmitMtu not specified.\t")); + } + //limit max mtu size to 32kB-1 + if (op_ReceiveMtu>KMaxMtuSize) + { + op_ReceiveMtu=KMaxMtuSize; + } + if (op_TransmitMtu>KMaxMtuSize) + { + op_TransmitMtu=KMaxMtuSize; + } + + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: Successfully get all data from opaque_data.\t")); + + // set up the protocol stack... + TObexIrProtocolInfo aInfo; + + aInfo.iTransport = KObexIrTTPProtocol; //"IrTinyTP" from obex.h + aInfo.iClassName.Copy(op_StringDesc); + aInfo.iAttributeName = _L8("IrDA:TinyTP:LsapSel");; + + // Configure Obex packet size + TObexProtocolPolicy aObexProtocolPolicy; + aObexProtocolPolicy.SetReceiveMtu( static_cast(op_ReceiveMtu) ); + aObexProtocolPolicy.SetTransmitMtu( static_cast(op_TransmitMtu) ); + FTRACE(FPrint(_L("[SRCS] CSrcsIrDAConnection: ConstructL: op_ReceiveMtu[%x] op_TransmitMtu[%x]"), + aObexProtocolPolicy.ReceiveMtu(), aObexProtocolPolicy.TransmitMtu() )); + + // try to find a available port to start OBEX server. + TUint port=KAutoBindLSAP; + // create obex server + + aInfo.iAddr.SetPort( port ); + TRAPD(err,iServer = CObexServer::NewL(aInfo, aObexProtocolPolicy);) + + // Try to start server on this port + if ( err == KErrNone ) + { + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: SetObexServer\t")); + err=iController->SetObexServer( iServer ); + FTRACE(FPrint(_L("[SRCS] CSrcsIrDAConnection: ConstructL: CObexServer started on port %d"), port)); + + if (err!=KErrNone) + { + // Failed to start Obex server. Delete server and try again + delete iServer; + iServer = NULL; + } + } + + + if ( !iServer ) + { + // Server did not start. + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: Failed to start Obex server\t")); + User::Leave( KErrGeneral ); + } + else + { + // if there is "local who" field + if(op_LocalWho.Size()) + { + User::LeaveIfError ( iServer->SetLocalWho( op_LocalWho ) ); + FLOG(_L("[SRCS] CSrcsIrDAConnection: ConstructL: SetLocalWho")); + } + } + } + +// --------------------------------------------------------- +// GetUserPasswordL(const TDesC& ) +// Purpose: Get the Obex password from user with ObexPasskeyNotifier +// Parameters: +// Return value: +// --------------------------------------------------------- +// +void CObexSMIrDAConnection::GetUserPasswordL( const TDesC& ) + { + FLOG( _L( "[SRCS] CSrcsIrDAConnection: GetUserPassword\t" ) ); + } + +// --------------------------------------------------------- +// Check if OBEX service is still active. +// @return ETrue: OBEX service is still active. +// EFalse: OBEX service is inactive. +// --------------------------------------------------------- +// + +TBool CObexSMIrDAConnection::IsOBEXActive() + { + FLOG( _L( "[SRCS] CSrcsIrDAConnection: IsOBEXActive\t" ) ); + return iController->IsOBEXActive(); + } + +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/ir/proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/ir/proxy.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,39 @@ +/* +* 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: This class export ECom interface implementations. +* +*/ + + + +#include +#include + +#include "obexsmirdaconnection.h" + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F9694, CObexSMIrDAConnection::NewL) + //{{0x101F9694}, CSrcsIrDAConnection::NewL}, + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/usb/101F9693.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/usb/101F9693.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2002 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 contains all the resources for the SRCS USB transport plug-in. +* +*/ + + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x101F9693; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of SRCS Transport interface + interface_uid = 0x101F7C9A; + implementations = + { + // Info for CSrcsUSBConnection + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F9692; + version_no = 1; + display_name = "Srcs USB Tranport"; + default_data = "OBEX/USB"; + opaque_data = ""; + } + }; + } + }; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2002-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: This class handles service connections. +* +*/ + + + +// INCLUDE FILES + +#include "obexsmusbconnection.h" +#include "debug.h" +#include +#include "obexutilsopaquedata.h" +#include +#include "obexservicemanprivatecrkeys.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CObexSMUsbConnection::CObexSMUsbConnection() + { + } +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CObexSMUsbConnection::CObexSMUsbConnection(TAny* aInitParams) + :iImplementationInfo((CImplementationInformation *)aInitParams) + { + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CObexSMUsbConnection::~CObexSMUsbConnection() + { + // Cleanup + FLOG(_L("[SRCS] CSrcsUsbConnection: StopObexServer")); + if(iServer) + { + iServer->Stop(); + } + + // Delete OBEX Server + if (iServer) + { + delete iServer; + FLOG(_L("[SRCS]\tserver\tCSrcsBtConnection::~CSrcsBtConnection obex server deleted.")); + iServer = NULL; + } + + // Delete Service Controller callback + delete iController; + iController = NULL; + + FLOG(_L("[SRCS] CSrcsUsbConnection: ~CSrcsUsbConnection: Completed\t")); + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CObexSMUsbConnection* CObexSMUsbConnection::NewL(TAny* aInitParams) + { + FLOG(_L("[SRCS]\tserver\tCSrcsUsbConnection: NewL")); + CObexSMUsbConnection* self = new (ELeave) CObexSMUsbConnection(aInitParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------- +// ConstructL +// Method to create BT connections. +// --------------------------------------------------------- +// +void CObexSMUsbConnection::ConstructL() + { + // Save service controller implementation UID for deferred initialization + iImplUid = iImplementationInfo->ImplementationUid(); + + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: CSrcsInterface::NewL\t")); + + // parsing opaque_data in iImplementationInfo + TPtrC8 res_string = iImplementationInfo->OpaqueData(); + + CObexUtilsOpaqueData res_data(res_string); + TBuf8 op_StringDesc, op_LocalWho, op_SkipStr; + TUint op_SkipInt; //used to skip certain fields + TUint op_ReceiveMtu(KSRCSDefaultReceiveMtu), op_TransmitMtu(KSRCSDefaultTransmitMtu); + // get 1st entry: USB interface string descriptor + User::LeaveIfError ( res_data.GetString(op_StringDesc) ); + // get 2nd entry: OBEX local who + User::LeaveIfError ( res_data.GetString(op_LocalWho) ); + // skip 3rd to 7th entry + // All service ID should be strings ! + res_data.GetString(op_SkipStr); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + res_data.GetNumber(op_SkipInt); + + // Get OBEX packet size: + if( res_data.GetNumber(op_ReceiveMtu) != KErrNone ) + { + op_ReceiveMtu = KSRCSDefaultReceiveMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: op_ReceiveMtu not specified.\t")); + } + + if( res_data.GetNumber(op_TransmitMtu) != KErrNone ) + { + op_TransmitMtu = KSRCSDefaultTransmitMtu; // restore default value in case it is modified; + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: op_TransmitMtu not specified.\t")); + } + + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: Successfully get all data from opaque_data.\t")); + + // Get OBEX usb dma usage + CRepository* cenrep = NULL; + TRAP_IGNORE(cenrep = CRepository::NewL(KCRUidObexServiceMan)); + TInt dmaUsage = EObexUsbDmaInUse; + if (cenrep) + { + cenrep->Get(KObexUsbDmaUsage, dmaUsage); + delete cenrep; + } + + // set up the protocol stack... + TObexUsbProtocolInfoV2 obexUsbProtocolInfo; + obexUsbProtocolInfo.iTransport = KObexUsbProtocolV2; + obexUsbProtocolInfo.iInterfaceStringDescriptor.Copy(op_StringDesc); + if(dmaUsage == EObexUsbDmaInUse) + { + obexUsbProtocolInfo.iDmaOnInEndpoint = ETrue; + obexUsbProtocolInfo.iDmaOnOutEndpoint = ETrue; + } + else + { + obexUsbProtocolInfo.iDmaOnInEndpoint = EFalse; + obexUsbProtocolInfo.iDmaOnOutEndpoint = EFalse; + } + obexUsbProtocolInfo.iBandwidthPriority = EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2; + + + + // Configure Obex packet size + TObexProtocolPolicy aObexProtocolPolicy; + aObexProtocolPolicy.SetReceiveMtu( static_cast(op_ReceiveMtu) ); + aObexProtocolPolicy.SetTransmitMtu( static_cast(op_TransmitMtu) ); + FTRACE(FPrint(_L("[SRCS] CSrcsUsbConnection: ConstructL: op_ReceiveMtu[%x] op_TransmitMtu[%x]"), + aObexProtocolPolicy.ReceiveMtu(), aObexProtocolPolicy.TransmitMtu() )); + + // Try to create OBEX server + iServer = CObexServer::NewL(obexUsbProtocolInfo, aObexProtocolPolicy); + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: CObexServer::NewL")); + // if there is "local who" field + if(op_LocalWho.Size()) + { + User::LeaveIfError ( iServer->SetLocalWho( op_LocalWho ) ); + FLOG(_L("[SRCS] CSrcsUsbConnection: ConstructL: SetLocalWho")); + } + + // The rest of initialization procedure is executed in PostInitialzeL() + } + +// --------------------------------------------------------- +// GetUserPasswordL(const TDesC& ) +// Purpose: Get the Obex password from user with ObexPasskeyNotifier +// Parameters: +// Return value: +// --------------------------------------------------------- +// +void CObexSMUsbConnection::GetUserPasswordL( const TDesC& ) + { + FLOG( _L( "[SRCS] CSrcsUsbConnection: GetUserPassword\t" ) ); + } + +// --------------------------------------------------------- +// Check if OBEX service is still active. +// @return ETrue: OBEX service is still active. +// EFalse: OBEX service is inactive. +// --------------------------------------------------------- +// + +TBool CObexSMUsbConnection::IsOBEXActive() + { + FLOG( _L( "[SRCS] CSrcsUsbConnection: IsOBEXActive\t" ) ); + return ETrue; + } + +void CObexSMUsbConnection::PostInitializeL() + { + FTRACE(FPrint(_L("[SRCS] CObexSMUsbConnection: PostInitializeL(%08X)"), iImplUid.iUid)); + + iController = CSrcsInterface::NewL(iImplUid); + iController->SetMediaType( ESrcsMediaUSB ); + + FLOG(_L("[SRCS] CObexSMUsbConnection::PostInitializeL(): SetObexServer\t")); + // Try to start server + User::LeaveIfError ( iController->SetObexServer( iServer )); + FLOG( _L( "[SRCS] CObexSMUsbConnection: PostInitializeL() exits\t" ) ); + } + +// End of file diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/plugins/src/usb/proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/plugins/src/usb/proxy.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,38 @@ +/* +* 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: This class export ECom interface implementations. +* +*/ + + +#include +#include + +#include "obexsmusbconnection.h" + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F9692, CObexSMUsbConnection::NewL) + //{{0x101F9692}, CSrcsUsbConnection::NewL}, + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/ObexUtils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/ObexUtils.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2002 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: IBY file for non localizable elements +* +*/ + + +#ifndef __OBEXUTILS_IBY__ +#define __OBEXUTILS_IBY__ + +file=ABI_DIR\BUILD_DIR\obexutils.dll SHARED_LIB_DIR\obexutils.dll + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/ObexUtilsResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/ObexUtilsResources.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2002 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: IBY file for localizable elements (resources of ObexUtils +* library +* +*/ + + +#ifndef OBEXUTILSRESOURCES_IBY +#define OBEXUTILSRESOURCES_IBY + +data=DATAZ_\RESOURCE_FILES_DIR\obexutils.rsc RESOURCE_FILES_DIR\obexutils.rsc + +#endif + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/obex.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/obex.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2001-2005 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 __OBEX_IBY__ +#define __OBEX_IBY__ + +#ifdef SYMBIAN_EXCLUDE_OBEX +REM Messaging OBEX MTM is not included in this ROM, because it depends on excluded OBEX +#else + +// generic OBEX Modules +file=ABI_DIR\BUILD_DIR\obexservermtm.dll System\libs\obexservermtm.dll +file=ABI_DIR\BUILD_DIR\obexclientmtm.dll System\libs\obexclientmtm.dll +file=ABI_DIR\BUILD_DIR\obexmtmutil.dll System\libs\obexmtmutil.dll + +// test harness support libraries +//file=ABI_DIR\BUILD_DIR\msvtestutils.dll System\libs\msvtestutils.dll +//file=ABI_DIR\BUILD_DIR\msgth.dll System\libs\msgth.dll + + +#ifdef SYMBIAN_EXCLUDE_INFRARED +REM Messaging infrared MTM is not included in this ROM, because it depends on excluded INFRARED +#else +//IR MTM Client +file=ABI_DIR\BUILD_DIR\irc.dll System\libs\irc.dll + +//IR MTM Server +file=ABI_DIR\BUILD_DIR\irs.dll System\libs\irs.dll + +//IR MTM Resources + +#endif // SYMBIAN_EXCLUDE_INFRARED + + +#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +REM Messaging Bluetooth MTM is not included in this ROM, because it depends on excluded BLUETOOTH +#else +//BT MTM Client +file=ABI_DIR\BUILD_DIR\btcmtm.dll System\libs\btcmtm.dll + +//BT MTM Server +file=ABI_DIR\BUILD_DIR\btsmtm.dll System\libs\btsmtm.dll + +//BT MTM Resources + +#endif // SYMBIAN_EXCLUDE_BLUETOOTH + + +//Test Harness Executable +//file=ABI_DIR\BUILD_DIR\T_ObexMTM.exe System\Samples\T_ObexMTM.exe + +#endif // SYMBIAN_EXCLUDE_OBEX + + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/obexserviceman.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/obexserviceman.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef OBEXSERVICEMANCLIENT_IBY +#define OBEXSERVICEMANCLIENT_IBY + + +ECOM_PLUGIN(obexserviceman.dll,obexserviceman.rsc) +file=ABI_DIR\BUILD_DIR\obexserviceman.exe PROGRAMS_DIR\obexserviceman.exe +file=ABI_DIR\BUILD_DIR\obexusbapi.dll PROGRAMS_DIR\obexusbapi.dll +data=ZPRIVATE\101F7C87\backup_registration.xml private\101F7C87\backup_registration.xml + +#endif // OBEXSERVICEMANCLIENT_IBY + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/obexservicemanbt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/obexservicemanbt.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* 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: +* +*/ +#ifndef __SRCSBT_IBY__ +#define __SRCSBT_IBY__ +//file content + +#ifdef __BT + +ECOM_PLUGIN(obexservicemanbt.dll,101F7C9D.rsc) + +#endif + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/obexservicemanirda.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/obexservicemanirda.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: +* +*/ + +#ifndef __SRCSIRDA_IBY__ +#define __SRCSIRDA_IBY__ + +#ifdef __IRDA +ECOM_PLUGIN(obexservicemanir.dll, 101F9695.rsc) +#endif + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/rom/obexservicemanusb.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/rom/obexservicemanusb.iby Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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: +* +*/ +#ifndef __SRCSUSB_IBY__ +#define __SRCSUSB_IBY__ +//file content + +#ifdef __USB +ECOM_PLUGIN(obexservicemanusb.dll,101F9693.rsc) +#endif + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/bmarm/OBEXUTILSU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/bmarm/OBEXUTILSU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,28 @@ +EXPORTS + UpdateProgressDialogL__16CObexUtilsDialogii @ 1 NONAME R3UNUSED ; CObexUtilsDialog::UpdateProgressDialogL(int, int) + CancelWaitDialogL__16CObexUtilsDialog @ 2 NONAME R3UNUSED ; CObexUtilsDialog::CancelWaitDialogL(void) + ContextIcon__17TObexUtilsUiLayerRC9TMsvEntry13TContextMedia @ 3 NONAME R3UNUSED ; TObexUtilsUiLayer::ContextIcon(TMsvEntry const &, TContextMedia) + CreateOutboxEntryL__24TObexUtilsMessageHandlerRC4TUidRCi @ 4 NONAME R3UNUSED ; TObexUtilsMessageHandler::CreateOutboxEntryL(TUid const &, int const &) + DeleteOutboxEntryL__24TObexUtilsMessageHandlerRCl @ 5 NONAME R3UNUSED ; TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) + GetFileSystemStatus__24TObexUtilsMessageHandler @ 6 NONAME R3UNUSED ; TObexUtilsMessageHandler::GetFileSystemStatus(void) + GetMmcFileSystemStatus__24TObexUtilsMessageHandler @ 7 NONAME R3UNUSED ; TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) + LaunchEditorApplicationL__17TObexUtilsUiLayerP9CMsvEntryR11CMsvSession @ 8 NONAME R3UNUSED ; TObexUtilsUiLayer::LaunchEditorApplicationL(CMsvEntry *, CMsvSession &) + LaunchProgressDialogL__16CObexUtilsDialogP26MObexUtilsProgressObserveriii @ 9 NONAME ; CObexUtilsDialog::LaunchProgressDialogL(MObexUtilsProgressObserver *, int, int, int) + LaunchWaitDialogL__16CObexUtilsDialogi @ 10 NONAME R3UNUSED ; CObexUtilsDialog::LaunchWaitDialogL(int) + NewLC__16CObexUtilsDialogP24MObexUtilsDialogObserver @ 11 NONAME R3UNUSED ; CObexUtilsDialog::NewLC(MObexUtilsDialogObserver *) + NewL__16CObexUtilsDialogP24MObexUtilsDialogObserver @ 12 NONAME R3UNUSED ; CObexUtilsDialog::NewL(MObexUtilsDialogObserver *) + OperationNotSupported__17TObexUtilsUiLayer @ 13 NONAME R3UNUSED ; TObexUtilsUiLayer::OperationNotSupported(void) + ReadResourceL__17TObexUtilsUiLayerR6TDes16RCi @ 14 NONAME R3UNUSED ; TObexUtilsUiLayer::ReadResourceL(TDes16 &, int const &) + SaveObjToInboxL__24TObexUtilsMessageHandlerP14CObexBufObjectRC7TDesC16G4TUid @ 15 NONAME R3UNUSED ; TObexUtilsMessageHandler::SaveObjToInboxL(CObexBufObject *, TDesC16 const &, TUid) + ShowErrorNoteL__17TObexUtilsUiLayerRCi @ 16 NONAME R3UNUSED ; TObexUtilsUiLayer::ShowErrorNoteL(int const &) + ShowInformationNoteL__17TObexUtilsUiLayerRCi @ 17 NONAME R3UNUSED ; TObexUtilsUiLayer::ShowInformationNoteL(int const &) + UpdateBitmaps__17TObexUtilsUiLayerG4TUidRiRt4TBuf1i256T2T2 @ 18 NONAME ; TObexUtilsUiLayer::UpdateBitmaps(TUid, int &, TBuf<256> &, int &, int &) + CancelProgressDialogL__16CObexUtilsDialog @ 19 NONAME R3UNUSED ; CObexUtilsDialog::CancelProgressDialogL(void) + CreateIconsL__17TObexUtilsUiLayerG4TUidPt9CArrayPtr1Zt9CArrayPtr1Z10CFbsBitmap @ 20 NONAME R3UNUSED ; TObexUtilsUiLayer::CreateIconsL(TUid, CArrayPtr > *) + NewL__26CObexUtilsPropertyNotifierP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 21 NONAME R3UNUSED ; CObexUtilsPropertyNotifier::NewL(MObexUtilsPropertyNotifyHandler *, TMemoryPropertyCheckType) + LaunchQueryDialogL__16CObexUtilsDialogRCi @ 22 NONAME R3UNUSED ; CObexUtilsDialog::LaunchQueryDialogL(int const &) + ShowNumberOfSendFileL__16CObexUtilsDialogii @ 23 NONAME R3UNUSED ; CObexUtilsDialog::ShowNumberOfSendFileL(int, int) + CreateInboxAttachmentL__24TObexUtilsMessageHandlerP14CObexBufObjectG4TUidRlR5RFile @ 24 NONAME ; TObexUtilsMessageHandler::CreateInboxAttachmentL(CObexBufObject *, TUid, long &, RFile &) + RemoveInboxEntriesL__24TObexUtilsMessageHandlerRP14CObexBufObjectl @ 25 NONAME R3UNUSED ; TObexUtilsMessageHandler::RemoveInboxEntriesL(CObexBufObject *&, long) + SaveObjToInboxL__24TObexUtilsMessageHandlerRP14CObexBufObjectR5RFilel @ 26 NONAME R3UNUSED ; TObexUtilsMessageHandler::SaveObjToInboxL(CObexBufObject *&, RFile &, long) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,62 @@ +EXPORTS + ?ReadResourceL@TObexUtilsUiLayer@@SAXAAVTDes16@@ABH@Z @ 1 NONAME ; void TObexUtilsUiLayer::ReadResourceL(class TDes16 &, int const &) + ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXPAVCObexBufObject@@ABVTDesC16@@VTUid@@@Z @ 2 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject *, class TDesC16 const &, class TUid) + ?RemoveInboxEntriesL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@J@Z @ 3 NONAME ; void TObexUtilsMessageHandler::RemoveInboxEntriesL(class CObexBufObject * &, long) + ?GetNumber@CObexUtilsOpaqueData@@QAEHAAI@Z @ 4 NONAME ; int CObexUtilsOpaqueData::GetNumber(unsigned int &) + ??0CObexUtilsOpaqueData@@QAE@ABVTDesC8@@@Z @ 5 NONAME ; CObexUtilsOpaqueData::CObexUtilsOpaqueData(class TDesC8 const &) + ?UpdateProgressDialog@CGlobalProgressDialog@@QAEXHH@Z @ 6 NONAME ; void CGlobalProgressDialog::UpdateProgressDialog(int, int) + ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@@Z @ 7 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &) + ?CancelWaitDialogL@CObexUtilsDialog@@QAEXXZ @ 8 NONAME ; void CObexUtilsDialog::CancelWaitDialogL(void) + ?LaunchFileManagerL@TObexUtilsUiLayer@@SAXAAVTDesC16@@HH@Z @ 9 NONAME ; void TObexUtilsUiLayer::LaunchFileManagerL(class TDesC16 &, int, int) + ?CreateDefaultMtmServiceL@TObexUtilsMessageHandler@@SAXVTUid@@@Z @ 10 NONAME ; void TObexUtilsMessageHandler::CreateDefaultMtmServiceL(class TUid) + ?UpdateProgressDialogL@CObexUtilsDialog@@QAEXHH@Z @ 11 NONAME ; void CObexUtilsDialog::UpdateProgressDialogL(int, int) + ?GetCenRepKeyStringValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAVTDes16@@@Z @ 12 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyStringValueL(class TUid, unsigned long, class TDes16 &) + ?GetMmcFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 13 NONAME ; int TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) + ?GetPubSubKeyIntValue@TObexUtilsMessageHandler@@SAHVTUid@@IAAH@Z @ 14 NONAME ; int TObexUtilsMessageHandler::GetPubSubKeyIntValue(class TUid, unsigned int, int &) + ?IsBackupRunning@TObexUtilsUiLayer@@SAHXZ @ 15 NONAME ; int TObexUtilsUiLayer::IsBackupRunning(void) + ?CancelProgressDialogL@CObexUtilsDialog@@QAEXXZ @ 16 NONAME ; void CObexUtilsDialog::CancelProgressDialogL(void) + ?ProcessFinished@CGlobalProgressDialog@@QAEXXZ @ 17 NONAME ; void CGlobalProgressDialog::ProcessFinished(void) + ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@PAV?$RArray@J@@@Z @ 18 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &, class RArray *) + ?CreateIconsL@TObexUtilsUiLayer@@SAXVTUid@@PAV?$CArrayPtr@V?$CArrayPtr@VCFbsBitmap@@@@@@@Z @ 19 NONAME ; void TObexUtilsUiLayer::CreateIconsL(class TUid, class CArrayPtr > *) + ?ShowProgressDialogNameSizeL@CGlobalProgressDialog@@QAEXAAVTDesC16@@_J@Z @ 20 NONAME ; void CGlobalProgressDialog::ShowProgressDialogNameSizeL(class TDesC16 &, long long) + ?GetFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 21 NONAME ; int TObexUtilsMessageHandler::GetFileSystemStatus(void) + ?NewL@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 22 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewL(class MObexUtilsDialogObserver *) + ?LaunchQueryDialogL@CObexUtilsDialog@@QAEHABH@Z @ 23 NONAME ; int CObexUtilsDialog::LaunchQueryDialogL(int const &) + ?CreateOutboxEntryL@TObexUtilsMessageHandler@@SAJABVTUid@@ABH@Z @ 24 NONAME ; long TObexUtilsMessageHandler::CreateOutboxEntryL(class TUid const &, int const &) + ?ShowGlobalConfirmationQueryL@TObexUtilsUiLayer@@SAXABH@Z @ 25 NONAME ; void TObexUtilsUiLayer::ShowGlobalConfirmationQueryL(int const &) + ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@@Z @ 26 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &) + ?GetMessageCentreDriveL@TObexUtilsMessageHandler@@SAHXZ @ 27 NONAME ; int TObexUtilsMessageHandler::GetMessageCentreDriveL(void) + ?LaunchEditorApplicationL@TObexUtilsUiLayer@@SAXAAJ@Z @ 28 NONAME ; void TObexUtilsUiLayer::LaunchEditorApplicationL(long &) + ?GetCenRepKeyIntValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAH@Z @ 29 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyIntValueL(class TUid, unsigned long, int &) + ?LaunchWaitDialogL@CObexUtilsDialog@@QAEXH@Z @ 30 NONAME ; void CObexUtilsDialog::LaunchWaitDialogL(int) + ?ShowNoteDialogL@CGlobalDialog@@QAEXHH@Z @ 31 NONAME ; void CGlobalDialog::ShowNoteDialogL(int, int) + ?ShowGlobalConfirmationQueryPlainL@TObexUtilsUiLayer@@SAHABH@Z @ 32 NONAME ; int TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(int const &) + ?NewLC@CGlobalProgressDialog@@SAPAV1@PAVMGlobalProgressCallback@@@Z @ 33 NONAME ; class CGlobalProgressDialog * CGlobalProgressDialog::NewLC(class MGlobalProgressCallback *) + ?IsString@CObexUtilsOpaqueData@@QAEHXZ @ 34 NONAME ; int CObexUtilsOpaqueData::IsString(void) + ?CreateReceiveBufferAndRFileL@TObexUtilsMessageHandler@@SAHAAVRFile@@ABVTDesC16@@AAV?$TBuf@$0BAA@@@AAPAVCBufFlat@@H@Z @ 35 NONAME ; int TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(class RFile &, class TDesC16 const &, class TBuf<256> &, class CBufFlat * &, int) + ?LaunchEditorApplicationOperationL@TObexUtilsUiLayer@@SAPAVCMsvOperation@@AAVCMsvSession@@PAVCMsvEntry@@AAVTRequestStatus@@@Z @ 36 NONAME ; class CMsvOperation * TObexUtilsUiLayer::LaunchEditorApplicationOperationL(class CMsvSession &, class CMsvEntry *, class TRequestStatus &) + ?OperationNotSupported@TObexUtilsUiLayer@@SAHXZ @ 37 NONAME ; int TObexUtilsUiLayer::OperationNotSupported(void) + ?ProcessFinished@CGlobalDialog@@QAEXXZ @ 38 NONAME ; void CGlobalDialog::ProcessFinished(void) + ?UpdateBitmaps@TObexUtilsUiLayer@@SAXVTUid@@AAHAAV?$TBuf@$0BAA@@@11@Z @ 39 NONAME ; void TObexUtilsUiLayer::UpdateBitmaps(class TUid, int &, class TBuf<256> &, int &, int &) + ?ShowErrorDialogL@CGlobalDialog@@QAEXH@Z @ 40 NONAME ; void CGlobalDialog::ShowErrorDialogL(int) + ?ShowProgressDialogL@CGlobalProgressDialog@@QAEXH@Z @ 41 NONAME ; void CGlobalProgressDialog::ShowProgressDialogL(int) + ?ShowNumberOfSendFileL@CObexUtilsDialog@@QAEXHH@Z @ 42 NONAME ; void CObexUtilsDialog::ShowNumberOfSendFileL(int, int) + ?ShowErrorNoteL@TObexUtilsUiLayer@@SAXABH@Z @ 43 NONAME ; void TObexUtilsUiLayer::ShowErrorNoteL(int const &) + ?NewL@CObexUtilsPropertyNotifier@@SAPAV1@PAVMObexUtilsPropertyNotifyHandler@@W4TMemoryPropertyCheckType@@@Z @ 44 NONAME ; class CObexUtilsPropertyNotifier * CObexUtilsPropertyNotifier::NewL(class MObexUtilsPropertyNotifyHandler *, enum TMemoryPropertyCheckType) + ?ShowGlobalFileOpenConfirmationQueryL@TObexUtilsUiLayer@@SAHABHABVTDesC16@@@Z @ 45 NONAME ; int TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL(int const &, class TDesC16 const &) + ?GetString@CObexUtilsOpaqueData@@QAEHAAV?$TBuf8@$0BAA@@@@Z @ 46 NONAME ; int CObexUtilsOpaqueData::GetString(class TBuf8<256> &) + ?UpdateEntryAttachmentL@TObexUtilsMessageHandler@@SAXAAV?$TBuf@$0BAA@@@PAVCMsvEntry@@@Z @ 47 NONAME ; void TObexUtilsMessageHandler::UpdateEntryAttachmentL(class TBuf<256> &, class CMsvEntry *) + ?NewL@CGlobalDialog@@SAPAV1@PAVMGlobalNoteCallback@@@Z @ 48 NONAME ; class CGlobalDialog * CGlobalDialog::NewL(class MGlobalNoteCallback *) + ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@ABVTDesC16@@@Z @ 49 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &, class TDesC16 const &) + ?NewL@CGlobalProgressDialog@@SAPAV1@PAVMGlobalProgressCallback@@@Z @ 50 NONAME ; class CGlobalProgressDialog * CGlobalProgressDialog::NewL(class MGlobalProgressCallback *) + ?RemoveTemporaryRFileL@TObexUtilsMessageHandler@@SAXABV?$TBuf@$0BAA@@@@Z @ 51 NONAME ; void TObexUtilsMessageHandler::RemoveTemporaryRFileL(class TBuf<256> const &) + ?LaunchProgressDialogL@CObexUtilsDialog@@QAEXPAVMObexUtilsProgressObserver@@HHH@Z @ 52 NONAME ; void CObexUtilsDialog::LaunchProgressDialogL(class MObexUtilsProgressObserver *, int, int, int) + ?DeleteOutboxEntryL@TObexUtilsMessageHandler@@SAXABJ@Z @ 53 NONAME ; void TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) + ?ContextIcon@TObexUtilsUiLayer@@SAHABVTMsvEntry@@W4TContextMedia@@@Z @ 54 NONAME ; int TObexUtilsUiLayer::ContextIcon(class TMsvEntry const &, enum TContextMedia) + ?SaveFileToFileSystemL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAV?$TBuf@$0BAA@@@AAVRFile@@ABVTDesC16@@@Z @ 55 NONAME ; void TObexUtilsMessageHandler::SaveFileToFileSystemL(class CObexBufObject * &, class TUid, long &, class TBuf<256> &, class RFile &, class TDesC16 const &) + ?ShowInformationNoteL@TObexUtilsUiLayer@@SAXABH@Z @ 56 NONAME ; void TObexUtilsUiLayer::ShowInformationNoteL(int const &) + ?NewLC@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 57 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewLC(class MObexUtilsDialogObserver *) + ?LaunchEditorApplicationL@TObexUtilsUiLayer@@SAHPAVCMsvEntry@@AAVCMsvSession@@@Z @ 58 NONAME ; int TObexUtilsUiLayer::LaunchEditorApplicationL(class CMsvEntry *, class CMsvSession &) + ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@AAVRFile@@J@Z @ 59 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject * &, class RFile &, long) + ?NewLC@CGlobalDialog@@SAPAV1@PAVMGlobalNoteCallback@@@Z @ 60 NONAME ; class CGlobalDialog * CGlobalDialog::NewLC(class MGlobalNoteCallback *) + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/data/Obexutils.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/data/Obexutils.hrh Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002, 2003 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: +* +*/ + + +enum +{ + ESendingProgressNote = 1, + EConnectingWaitNote, + EPrintingWaitNote +}; + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/data/Obexutils.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/data/Obexutils.rss Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,532 @@ +/* +* Copyright (c) 2002 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 contains all the resources for the obexutils. +* +* +*/ + + +// RESOURCE IDENTIFIER +NAME OBUT + +// INCLUDES +#include +#include "Obexutils.hrh" +#include +#include +#include +#include +#include + +RESOURCE RSS_SIGNATURE { } + +// RESOURCE DEFINITIONS + +// Popup texts (information notes and error notes) + +// --------------------------------------------------------- +// +// r_ir_connecting +// this is the first shown when the user tries connect to other +// remote device. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_connecting {buf= qtn_ir_connecting;} + +// --------------------------------------------------------- +// +// r_ir_cannot_establish +// This informs that the IR connection cannot made to other remote device +// for some reason. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_cannot_establish {buf= qtn_ir_cant_establish_conn;} + +// --------------------------------------------------------- +// +// r_ir_sending_data +// This is shown after the IR connection is made succesfully and we are +// sending message over IR. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_sending_data {buf= qtn_ir_sending_data;} + +// --------------------------------------------------------- +// +// r_ir_sending_failed +// This is shown when the IR connection is made and some thing goes wrong +// during connection. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_sending_failed {buf= qtn_ir_sending_failed;} + +// --------------------------------------------------------- +// +// r_ir_data_sent +// This is shown to the user when the message is sended succesfully. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_data_sent {buf= qtn_ir_data_sent;} + +// --------------------------------------------------------- +// +// r_bt_connecting +// Informs state of Bluetooth connection. +// this is the first shown when the user tries connect to other +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_connecting {buf= qtn_bt_connecting;} + +// --------------------------------------------------------- +// +// r_bt_sending_data +// This is shown after the Bluetooth connection is made succesfully +// and we are sending message over Bluetooth. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_sending_data {buf= qtn_bt_sending_data;} + +// --------------------------------------------------------- +// +// r_bt_dev_not_avail +// This informs that the Bluetooth connection cannot made to other +// remote device for some reason. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_dev_not_avail {buf= qtn_bt_dev_not_avail;} + +// --------------------------------------------------------- +// +// r_bt_failed_to_send +// This is shown when the BT connection is made and some thing goes wrong +// during connection. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_failed_to_send {buf= qtn_bt_failed_to_send;} + +// --------------------------------------------------------- +// +// r_bt_data_sent +// This is shown to the user when the message is sended succesfully via BT. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_data_sent {buf= qtn_bt_data_sent;} + +// --------------------------------------------------------- +// +// r_bt_not_receive_one +// This is shown when one image could not be sent +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_not_receive_one {buf= qtn_bt_bip_format_not_supported;} + +// --------------------------------------------------------- +// +// r_out_of_memory +// This is shown when not enough memory +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_out_of_memory {buf= qtn_memlo_not_enough_memory;} + +// --------------------------------------------------------- +// +// r_bt_not_receive_all +// This is shown when no images could be sent +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_sent_image_number {buf= qtn_bt_bip_some_files_sent;} +RESOURCE TBUF r_bt_not_receive_any {buf= qtn_bt_bip_no_formats_supported;} + +// Confirmation queries + +// --------------------------------------------------------- +// +// Confirmation query +// __RD_BT_MSG_RENOVATION not flagged +// This is shown when some images could not be sent +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_bt_not_send_all_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_bip_not_all_formats_supported; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +// --------------------------------------------------------- +// +// Confirmation query +// This is shown when some images are not supported +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_bt_not_all_supported_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_bip_not_all_formats_supported; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +// --------------------------------------------------------- +// +// Confirmation query for mixed list +// __RD_BT_MSG_RENOVATION flagged +// This is shown when some images could not be sent +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_bt_not_send_all_query_mixed + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_bip_mixed_list; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + + + +// Notes + +// ----------------------------------------------------------------------------- +// +// r_bt_connecting_wait_note +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_bt_connecting_wait_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EConnectingWaitNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_bt_connecting; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } +// ----------------------------------------------------------------------------- +// +// r_ir_connecting_wait_note +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_ir_connecting_wait_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EConnectingWaitNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_ir_connecting; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_bt_printing_wait_note +// +// +// ----------------------------------------------------------------------------- +// + +// NOTE! The strings in the following resources need to be added into +// localization file, once the UI specification is approved. +// + +RESOURCE DIALOG r_bt_printing_wait_note + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EPrintingWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = "Sending data..."; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +// Skeletons (resources with changing text) + +// ----------------------------------------------------------------------------- +// +// r_sending_progress_note +// +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_sending_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = ESendingProgressNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_bt_sending_data; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + +// --------------------------------------------------------- +// +// r_ir_failed_to_receive +// This is shown to the user when failing receive file via infrared. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_failed_to_receive {buf=qtn_ir_failed_to_receive;} + +// --------------------------------------------------------- +// +// qtn_ir_receiving_data +// This is shown to the user when receiving data via IR. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_receiving_data {buf=qtn_ir_receiving_data;} + +// --------------------------------------------------------- +// +// r_bt_receiving_data +// This is shown after the Bluetooth connection is made succesfully +// and we are receiving message over Bluetooth. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_receiving_data {buf= qtn_bt_receiving_data;} + +// --------------------------------------------------------- +// +// qtn_bt_failed_to_receive +// This is shown when the BT connection is made and some thing goes wrong +// when receiving data. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_failed_to_receive {buf= qtn_bt_failed_to_receive;} + +// Other resource texts + +// --------------------------------------------------------- +// +// r_ir_send_progress_sending +// descripes status of item that is currently sending state in the outbox. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_send_progress_sending {buf= qtn_mce_outbox_status_sending;} + +// --------------------------------------------------------- +// +// r_ir_send_progress_sending +// descripes status of item that is currently sending state in the outbox. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_send_progress_sending {buf= qtn_mce_outbox_status_sending;} + +// --------------------------------------------------------- +// +// r_ir_send_outbox_sending +// Displayed in the "To/From" section for Ir objects in message centre. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_send_outbox_sending {buf= qtn_mce_ir_message;} + +// --------------------------------------------------------- +// +// r_bt_send_outbox_sending +// Displayed in the "To/From" section for Ir objects in message centre. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_send_outbox_sending {buf= qtn_mce_bt_message;} + +// --------------------------------------------------------- +// +// r_message_not_opened +// This is shown, when the user tries open a message that is not +// supported type. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_message_not_opened {buf= qtn_mce_info_message_not_opened;} + +// --------------------------------------------------------- +// +// r_name_for_invalid_file +// Default invalid filename +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_name_for_invalid_file { buf=qtn_fldr_default_doc_name; } + +// --------------------------------------------------------- +// +// r_bt_to_from_in_inbox +// Displayed in the "To/From" section for Bluetooth objects. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_bt_to_from_in_inbox { buf=qtn_mce_bt_message; } + +// --------------------------------------------------------- +// +// r_ir_to_from_in_inbox +// Displayed in the "To/From" section for Ir objects. +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_ir_to_from_in_inbox { buf=qtn_mce_ir_message; } + +RESOURCE TBUF r_bt_data_sent2 { buf= "Data sent"; } +RESOURCE TBUF r_bt_failed_to_send2 { buf= "Sending failed"; } +RESOURCE TBUF r_bt_printing_not_supported { buf = "Printer not supported"; } +RESOURCE TBUF r_bt_sending_not_supported {buf = "Unsupported device";} + +RESOURCE TBUF r_bt_saved_single { buf = qtn_bt_saved_single; } +RESOURCE TBUF r_bt_saved_multiple { buf = qtn_bt_saved_multiple; } +RESOURCE TBUF r_bt_saved_search { buf = qtn_bt_saved_search; } +RESOURCE TBUF r_bt_saved_no_memory_card { buf = qtn_bt_saved_no_memory_card; } +RESOURCE TBUF r_bt_saved_link_updated { buf = qtn_bt_saved_link_updated; } +RESOURCE TBUF r_bt_saved_search_update { buf = qtn_bt_saved_search_update; } + +RESOURCE TBUF r_bt_ir_receiving_data_size_kb { buf = qtn_bt_ir_receiving_data_size_kb ; } +RESOURCE TBUF r_bt_ir_receiving_data_size_mb { buf = qtn_bt_ir_receiving_data_size_mb ; } + +RESOURCE TBUF r_bt_ir_receiving_data_no_size { buf = qtn_bt_ir_receiving_data_no_size ; } + +// --------------------------------------------------------- +// +// Confirmation query for mixed list +// __RD_BT_MSG_RENOVATION flagged +// This is shown when some images could not be sent +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_bt_not_send_all_query_single + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_bip_format_not_supported_send; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,63 @@ +EXPORTS + _ZN13CGlobalDialog15ProcessFinishedEv @ 1 NONAME + _ZN13CGlobalDialog15ShowNoteDialogLEii @ 2 NONAME + _ZN13CGlobalDialog16ShowErrorDialogLEi @ 3 NONAME + _ZN13CGlobalDialog4NewLEP19MGlobalNoteCallback @ 4 NONAME + _ZN13CGlobalDialog5NewLCEP19MGlobalNoteCallback @ 5 NONAME + _ZN16CObexUtilsDialog17CancelWaitDialogLEv @ 6 NONAME + _ZN16CObexUtilsDialog17LaunchWaitDialogLEi @ 7 NONAME + _ZN16CObexUtilsDialog18LaunchQueryDialogLERKi @ 8 NONAME + _ZN16CObexUtilsDialog21CancelProgressDialogLEv @ 9 NONAME + _ZN16CObexUtilsDialog21LaunchProgressDialogLEP26MObexUtilsProgressObserveriii @ 10 NONAME + _ZN16CObexUtilsDialog21ShowNumberOfSendFileLEii @ 11 NONAME + _ZN16CObexUtilsDialog21UpdateProgressDialogLEii @ 12 NONAME + _ZN16CObexUtilsDialog4NewLEP24MObexUtilsDialogObserver @ 13 NONAME + _ZN16CObexUtilsDialog5NewLCEP24MObexUtilsDialogObserver @ 14 NONAME + _ZN17TObexUtilsUiLayer11ContextIconERK9TMsvEntry13TContextMedia @ 15 NONAME + _ZN17TObexUtilsUiLayer12CreateIconsLE4TUidP9CArrayPtrIS1_I10CFbsBitmapEE @ 16 NONAME + _ZN17TObexUtilsUiLayer13ReadResourceLER6TDes16RKi @ 17 NONAME + _ZN17TObexUtilsUiLayer13UpdateBitmapsE4TUidRiR4TBufILi256EES1_S1_ @ 18 NONAME + _ZN17TObexUtilsUiLayer14ShowErrorNoteLERKi @ 19 NONAME + _ZN17TObexUtilsUiLayer15IsBackupRunningEv @ 20 NONAME + _ZN17TObexUtilsUiLayer18LaunchFileManagerLER7TDesC16ii @ 21 NONAME + _ZN17TObexUtilsUiLayer20ShowInformationNoteLERKi @ 22 NONAME + _ZN17TObexUtilsUiLayer21OperationNotSupportedEv @ 23 NONAME + _ZN17TObexUtilsUiLayer24LaunchEditorApplicationLEP9CMsvEntryR11CMsvSession @ 24 NONAME + _ZN17TObexUtilsUiLayer24LaunchEditorApplicationLERl @ 25 NONAME + _ZN17TObexUtilsUiLayer28ShowGlobalConfirmationQueryLERKi @ 26 NONAME + _ZN17TObexUtilsUiLayer33LaunchEditorApplicationOperationLER11CMsvSessionP9CMsvEntryR14TRequestStatus @ 27 NONAME + _ZN17TObexUtilsUiLayer33ShowGlobalConfirmationQueryPlainLERKi @ 28 NONAME + _ZN17TObexUtilsUiLayer36ShowGlobalFileOpenConfirmationQueryLERKiRK7TDesC16 @ 29 NONAME + _ZN20CObexUtilsOpaqueData8IsStringEv @ 30 NONAME + _ZN20CObexUtilsOpaqueData9GetNumberERj @ 31 NONAME + _ZN20CObexUtilsOpaqueData9GetStringER5TBuf8ILi256EE @ 32 NONAME + _ZN20CObexUtilsOpaqueDataC1ERK6TDesC8 @ 33 NONAME + _ZN20CObexUtilsOpaqueDataC2ERK6TDesC8 @ 34 NONAME + _ZN21CGlobalProgressDialog15ProcessFinishedEv @ 35 NONAME + _ZN21CGlobalProgressDialog19ShowProgressDialogLEi @ 36 NONAME + _ZN21CGlobalProgressDialog20UpdateProgressDialogEii @ 37 NONAME + _ZN21CGlobalProgressDialog27ShowProgressDialogNameSizeLER7TDesC16x @ 38 NONAME + _ZN21CGlobalProgressDialog4NewLEP23MGlobalProgressCallback @ 39 NONAME + _ZN21CGlobalProgressDialog5NewLCEP23MGlobalProgressCallback @ 40 NONAME + _ZN24TObexUtilsMessageHandler15SaveObjToInboxLEP14CObexBufObjectRK7TDesC164TUid @ 41 NONAME + _ZN24TObexUtilsMessageHandler15SaveObjToInboxLERP14CObexBufObjectR5RFilel @ 42 NONAME + _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EE @ 43 NONAME + _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EEP6RArrayIlE @ 44 NONAME + _ZN24TObexUtilsMessageHandler18CreateOutboxEntryLERK4TUidRKi @ 45 NONAME + _ZN24TObexUtilsMessageHandler18DeleteOutboxEntryLERKl @ 46 NONAME + _ZN24TObexUtilsMessageHandler19GetFileSystemStatusEv @ 47 NONAME + _ZN24TObexUtilsMessageHandler19RemoveInboxEntriesLERP14CObexBufObjectl @ 48 NONAME + _ZN24TObexUtilsMessageHandler20GetPubSubKeyIntValueE4TUidjRi @ 49 NONAME + _ZN24TObexUtilsMessageHandler21GetCenRepKeyIntValueLE4TUidmRi @ 50 NONAME + _ZN24TObexUtilsMessageHandler21RemoveTemporaryRFileLERK4TBufILi256EE @ 51 NONAME + _ZN24TObexUtilsMessageHandler21SaveFileToFileSystemLERP14CObexBufObject4TUidRlR4TBufILi256EER5RFileRK7TDesC16 @ 52 NONAME + _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFile @ 53 NONAME + _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFileRK7TDesC16 @ 54 NONAME + _ZN24TObexUtilsMessageHandler22GetMessageCentreDriveLEv @ 55 NONAME + _ZN24TObexUtilsMessageHandler22GetMmcFileSystemStatusEv @ 56 NONAME + _ZN24TObexUtilsMessageHandler22UpdateEntryAttachmentLER4TBufILi256EEP9CMsvEntry @ 57 NONAME + _ZN24TObexUtilsMessageHandler24CreateDefaultMtmServiceLE4TUid @ 58 NONAME + _ZN24TObexUtilsMessageHandler24GetCenRepKeyStringValueLE4TUidmR6TDes16 @ 59 NONAME + _ZN24TObexUtilsMessageHandler28CreateReceiveBufferAndRFileLER5RFileRK7TDesC16R4TBufILi256EERP8CBufFlati @ 60 NONAME + _ZN26CObexUtilsPropertyNotifier4NewLEP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 61 NONAME + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2002 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 a Obexutils. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/obexutilsuilayer.h |../../../inc/obexutilsuilayer.h +../inc/obexutilsdialog.h |../../../inc/obexutilsdialog.h +../inc/obexutilspropertynotifier.h |../../../inc/obexutilspropertynotifier.h +../inc/obexutilsglobalprogressdialog.h |../../../inc/obexutilsglobalprogressdialog.h + +../loc/Obexutils.loc MW_LAYER_LOC_EXPORT_PATH(obexutils.loc) + + +PRJ_MMPFILES +obexutils.mmp + + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/group/obexutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/group/obexutils.mmp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2002 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: +* Constructs obexutils.dll +* +* +*/ + + +#include +#include + +TARGET obexutils.dll +TARGETTYPE dll +UID 0x10004262 0x101F86AF +VENDORID VID_DEFAULT + +START RESOURCE ../data/Obexutils.rss +TARGETPATH RESOURCE_FILES_DIR +HEADER +LANGUAGE_IDS +END + +OS_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc +NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src +SOURCE obexutilsuilayer.cpp +SOURCE obexutilslaunchwaiter.cpp +SOURCE obexutilsdialogtimer.cpp +SOURCE obexutilsdialog.cpp +SOURCE obexutilsmessagehandler.cpp +SOURCE obexutilspropertynotifier.cpp +SOURCE obexutilsopaquedata.cpp +SOURCE obexutilsglobalprogressdialog.cpp +SOURCE obexutilsglobaldialog.cpp +SOURCE obexutilsentryhandler.cpp +SOURCE updatemusiccollection.cpp +#ifdef __BT_SAP + SOURCE vMessageHandler.cpp +#endif + +SYSTEMINCLUDE ../../../inc ../../../../inc +#ifdef NO101APPDEPFIXES +APP_LAYER_SYSTEMINCLUDE +#else //NO101APPDEPFIXES +MW_LAYER_SYSTEMINCLUDE +#endif //NO101APPDEPFIXES +// SMUT Unbranch +#ifdef __BT_SAP +SYSTEMINCLUDE /epoc32/include/ecom +#endif + +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bifu.lib +LIBRARY biodb.lib +LIBRARY charconv.lib +LIBRARY cone.lib +LIBRARY commonengine.lib +LIBRARY commonui.lib +LIBRARY efsrv.lib +LIBRARY eikctl.lib +LIBRARY etext.lib +LIBRARY euser.lib +LIBRARY irobex.lib +LIBRARY msgs.lib +LIBRARY aknskins.lib +LIBRARY centralrepository.lib +LIBRARY apparc.lib +LIBRARY servicehandler.lib +LIBRARY eikdlg.lib +LIBRARY featmgr.lib +LIBRARY aknnotify.lib +LIBRARY commondialogs.lib +LIBRARY platformenv.lib +LIBRARY mpxcollectionhelper.lib +LIBRARY mpxplaybackutility.lib + +#ifdef __BT_SAP + LIBRARY smcm.lib + LIBRARY gsmu.lib +// SMUT Unbranch + LIBRARY ecom.lib +#endif + +DEBUGLIBRARY flogger.lib + +CAPABILITY CAP_GENERAL_DLL diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsdebug.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002 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 defines logging macros for ObexUtils +* +*/ + + +#ifndef OBEXUTILS_DEBUG_H +#define OBEXUTILS_DEBUG_H + + +#ifdef _DEBUG + +#include +#include +#include +#include + +_LIT(KLogFile,"obexutils.txt"); +_LIT(KLogDirFullName,"c:\\logs\\"); +_LIT(KLogDir,"obexutils"); + +// Declare the FPrint function +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); + } + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // OBEXUTILS_DEBUG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2002 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 COBEXUTILSDIALOG_H +#define COBEXUTILSDIALOG_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CAknWaitDialog; +class CObexUtilsDialogTimer; + +// CLASS DECLARATION + +/** +* An observer interface for asking progress status of an operation using +* a progress dialog. +*/ +NONSHARABLE_CLASS( MObexUtilsProgressObserver ) + { + public: + + /** + * Returns the progress status of the operation. + * @since 2.6 + * @return A progress value relative to final value. + */ + virtual TInt GetProgressStatus() = 0; + }; + +// CLASS DECLARATION + +/** +* An observer interface for informing about dialog events. +*/ +NONSHARABLE_CLASS( MObexUtilsDialogObserver ) + { + public: + + /** + * Informs the observer that a dialog has been dismissed. + * @since 2.6 + * @param aButtonId The button that was used to dismiss the dialog. + * @return None. + */ + virtual void DialogDismissed( TInt aButtonId ) = 0; + }; + + +// CLASS DECLARATION + +/** +* A class for launching and managing dialogs. +*/ +NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, public MProgressDialogCallback + { + public:// Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CObexUtilsDialog* NewL( + MObexUtilsDialogObserver* aObserverPtr ); + + IMPORT_C static CObexUtilsDialog* NewLC( + MObexUtilsDialogObserver* aObserverPtr ); + + /** + * Destructor. + */ + virtual ~CObexUtilsDialog(); + + public: // New functions + + /** + * Launches a progress dialog. + * @since 2.6 + * @param aObserverPtr A pointer to progress observer. A NULL pointer if + the progress dialog is updated manually. + * @param aFinalValue The final value of the operation (progress=100%). + * @param aResId A resource id for the string to be shown in the dialog. + * @param aTimeoutValue A value telling how often should the dialog be + updated. Relevant only if observer given. + * @return None. + */ + IMPORT_C void LaunchProgressDialogL( + MObexUtilsProgressObserver* aObserverPtr, TInt aFinalValue, + TInt aResId, TInt aTimeoutValue ); + + /** + * Launches a wait dialog. + * @since 2.6 + * @param aResId A resource id for the string to be shown in the dialog. + * @return None. + */ + IMPORT_C void LaunchWaitDialogL( TInt aResId ); + + /** + * Cancels a wait dialog if one exists. + * @since 2.6 + * @return None. + */ + IMPORT_C void CancelWaitDialogL(); + + /** + * Cancels a wait progress dialog if one exists. + * @since 2.6 + * @return None. + */ + IMPORT_C void CancelProgressDialogL(); + + /** + * Updates a progress dialog. Should not be used if the + * MObexUtilsDialogObserver pointer was given. + * @since 2.6 + * @param aValue A progress value relative to final value. + * @param aResId A resource id for the string to be shown in the dialog. + * @return None + */ + IMPORT_C void UpdateProgressDialogL( TInt aValue, TInt aResId ); + + /** + * Show a query note + * @param aResourceID A resource id for the note. + * @return User's input - Yes/No + */ + IMPORT_C TInt LaunchQueryDialogL( const TInt& aResourceID ); + + /** + * Show how many files are sent in case not all images are supported + * @param aSentNum Number of sent files + * @param aTotlNum Number of total files + * return None. + */ + + IMPORT_C void ShowNumberOfSendFileL( TInt aSentNum, TInt aTotalNum ); + + /** + * Prepares dialog for execution + * @param aResourceID Resource ID of the dialog + * @param aDialog Dialog + */ + void PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ); + + /** + * Check if cover display is enabled + * return True if enabled + */ + TBool IsCoverDisplayL(); + + public: // New functions (not exported) + + /** + * Updates the progress dialog. + * @return None. + */ + void UpdateProgressDialog(); + + private: // Functions from base classes + + /** + * From MProgressDialogCallback A dialog has been dismissed. + * @param aButtonId The button that was used to dismiss the dialog. + * @return None. + */ + void DialogDismissedL( TInt aButtonId ); + + private: + TInt ExecuteDialogL( const TInt& aResourceID, CEikDialog* aDialog ); + + private: + + /** + * C++ default constructor. + */ + CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr ); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + private: // Data + + CAknProgressDialog* iProgressDialog; + CAknWaitDialog* iWaitDialog; + CObexUtilsDialogTimer* iObexDialogTimer; + TInt iResourceFileId; + TInt iProgressDialogResId; + TBool iCoverDisplayEnabled; + + // Not Owned + // + MObexUtilsProgressObserver* iProgressObserverPtr; + MObexUtilsDialogObserver* iDialogObserverPtr; + }; + +#endif // COBEXUTILSDIALOG_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsdialogtimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsdialogtimer.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 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 COBEXUTILSDIALOGTIMER_H +#define COBEXUTILSDIALOGTIMER_H + +// INCLUDES +#include "obexutilsdialog.h" + +// CLASS DECLARATION +/** +* A timer class for updating progress dialog. +*/ +NONSHARABLE_CLASS( CObexUtilsDialogTimer ) : public CTimer + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CObexUtilsDialogTimer* NewL( CObexUtilsDialog* aParent ); + + /** + * Destructor. + */ + virtual ~CObexUtilsDialogTimer(); + + public: // New functions + + /** + * Sets the timeout of the timer. + * @param aTimeout The timeout in microseconds. + * @return None. + */ + void SetTimeout( TTimeIntervalMicroSeconds32 aTimeout ); + + /** + * Restarts the timer. + * @return None. + */ + void Tickle(); + + private: // Functions from base classes + + /** + * From CTimer Get's called when the timer expires. + * @return None. + */ + void RunL(); + + private: + + /** + * C++ default constructor. + */ + CObexUtilsDialogTimer( CObexUtilsDialog* aParent ); + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + private: // Data + TTimeIntervalMicroSeconds32 iTimeout; + CObexUtilsDialog* iParent; + }; + +#endif // COBEXUTILSDIALOGTIMER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2002 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: Definition of the global progress dialog class +* +*/ + + + +#ifndef OBEXUTILSENTRYHANDLER_H_ +#define OBEXUTILSENTRYHANDLER_H_ + +#include +#include + +/** + * Obexutils link hander + * Maintain the links in inbox. + * + * @since S60 v5.0 + */ + +NONSHARABLE_CLASS( CObexutilsEntryhandler ) : public CActive +{ + +public: + + static CObexutilsEntryhandler* NewL(); + static CObexutilsEntryhandler* NewLC(); + + /** + * Destructor. + */ + virtual ~CObexutilsEntryhandler(); + + /** + * Add an linked attachment to entry + * + * @since S60 v5.0 + * @param aFilePath The absolute file path of the linked attachment file. + * @param anAttachInfo The attachment info associated with the file. + * @param aStore An interface over the message store that is associated with a message entry. + * @return error code + */ + TInt AddEntryAttachment(const TDesC &aFilePath, CMsvAttachment* anAttachInfo, CMsvStore* aStore ); + + /** + * Update an entry attachment + * @since S60 v5.0 + * @param aFilePath the absolute file path of the linked attachment file. + * @param anAttachInfo the attachment info associated with the file. + * @param aStore An interface ove the message store that is associated with a message entry. + * @return error code + */ + TInt UpdateEntryAttachment(TFileName& aFileName, + CMsvAttachment* anOldAttachInfo, + CMsvAttachment* aNewAttachInfo, + CMsvStore* aStore ); + + // from base class CActive + + /** + * From CActive. + * RunL + * + * @since S60 v5.0 + */ + void RunL(); + + /** + * From CActive. + * DoCancel + * + * @since S60 v5.0 + */ + void DoCancel(); + + +private: + /** + * Default C++ constructor. + */ + CObexutilsEntryhandler(); + + /** + * Symbian two-phase constructor. + */ + void ConstructL(); + + /** + * Add link attachment + * + * @since S60 v5.0 + */ + void DoAddEntryAttachmentL(const TDesC &aFilePath, CMsvAttachment* anAttachInfo, CMsvStore* aStore); + + + /** + * Update link attachment + * + * @since S60 v5.0 + */ + void DoUpdateEntryAttachmentL(TFileName& aFileName, + CMsvAttachment* anOldAttachInfo, + CMsvAttachment* aNewAttachInfo, + CMsvStore* aStore); + +private: // member data + + + /** + * Sync waiter object + */ + CActiveSchedulerWait iSyncWaiter; + + +}; + + +#endif /*OBEXUTILSENTRYHANDLER_H_*/ diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsglobalprogressdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsglobalprogressdialog.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2002 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: Definition of the global progress dialog class +* +*/ + + + + +#ifndef __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ +#define __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ + +// INCLUDES +#include +#include +#include +#include // R_QGN_GRAF_WAIT_BAR_ANIM +#include + +#include + +// FORWARD DECLARATIONS +class CAknGlobalProgressDialog; + + +// CLASS DECLARATION + +// Call back for progress bar +NONSHARABLE_CLASS( MGlobalProgressCallback ) + { + public: + virtual void HandleGlobalProgressDialogL( TInt aSoftkey ) = 0; + }; + + + + + +NONSHARABLE_CLASS( CGlobalProgressDialog ) : public CActive +{ + public: // Constructors and destructor + + + /** + * Two-phased constructor. + */ + IMPORT_C static CGlobalProgressDialog* NewLC(MGlobalProgressCallback* aObserver); + IMPORT_C static CGlobalProgressDialog* NewL(MGlobalProgressCallback* aObserver); + + + /** + * Destructor. + */ + virtual ~CGlobalProgressDialog(); + + public: // New functions + + /** + * Sets the icon for this dialog + * @param aIconText Text of the icon + * @param aIconFile File containing icon + * @param aIconId Icon ID + * @param aIconMaskId Icon mask ID + * @return void + */ + void SetIconL( const TDesC& aIconText, const TDesC& aIconFile, + TInt aIconId = 0, TInt aIconMaskId = -1 ); + /** + * Sets the image for the dialog + * @param aImageFile Image filename + * @param aImageId Image ID + * @param aImageMaskId Image mask ID + * @return void + */ + void SetImageL( const TDesC& aImageFile, TInt aImageId = 0, + TInt aImageMaskId = -1 ); + + /** + * Shows the progress dialog + * @return void + */ + IMPORT_C void ShowProgressDialogL(TInt aStringId); + IMPORT_C void ShowProgressDialogNameSizeL( TDesC& aFileName, + TInt64 aFileSize); + + + /** + * Updates the progress dialog + * @param aValue progress bar value + * @param aFinalValue progress bar final value + * @return void + */ + IMPORT_C void UpdateProgressDialog(TInt aValue, TInt aFinalValue); + + /** + * Called to complete the global progress dialog + * @return void + */ + IMPORT_C void ProcessFinished(); + + + protected: // Functions from base classes + + /** + * From CActive Active Object RunL() + */ + virtual void RunL(); + + /** + * From CActive Active Object DoCancel() + */ + virtual void DoCancel(); + + + private: + + /** + * By default constructor is private. + */ + void ConstructL(MGlobalProgressCallback* aObserver); + + /** + * C++ default constructor. + */ + CGlobalProgressDialog(); + + private: //data + CAknGlobalProgressDialog* iProgressDialog; + + MGlobalProgressCallback* iKeyCallback; + CStringResourceReader* iStringResourceReader; + +}; + + + +// Call back for note with animation and without animation +NONSHARABLE_CLASS( MGlobalNoteCallback ) + { + public: + virtual void HandleGlobalNoteDialogL( TInt aSoftkey ) = 0; + }; + + + +NONSHARABLE_CLASS( CGlobalDialog ) : public CActive +{ + public: // Constructors and destructor + + + /** + * Two-phased constructor. + */ + IMPORT_C static CGlobalDialog* NewLC(MGlobalNoteCallback* aObserver); + IMPORT_C static CGlobalDialog* NewL(MGlobalNoteCallback* aObserver); + + + /* + * public functions + */ + IMPORT_C void ShowNoteDialogL( TInt aResourceId, TBool anAnimation); + IMPORT_C void ShowErrorDialogL(TInt aResourceId); + IMPORT_C void ProcessFinished(); + + /** + * Destructor. + */ + virtual ~CGlobalDialog(); + + + protected: // Functions from base classes + + /** + * From CActive Active Object RunL() + */ + virtual void RunL(); + + /** + * From CActive Active Object DoCancel() + */ + virtual void DoCancel(); + + + private: + + /** + * By default constructor is private. + */ + void ConstructL(MGlobalNoteCallback* aObserver); + + /** + * C++ default constructor. + */ + CGlobalDialog(); + + private: //data + + MGlobalNoteCallback* iKeyCallback; + CStringResourceReader* iStringResourceReader; + CAknGlobalNote* iAknGlobalNote; + TInt iWaitNoteID; + +}; + + + + + + + + + + + +#endif // __OBEXUTILS_GLOBAL_PROGRESS_DIALOG__ diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilslaunchwaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilslaunchwaiter.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2002 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 COBEXUTILSLAUNCHWAITER_H +#define COBEXUTILSLAUNCHWAITER_H + +// INCLUDES +#include +#include + +#include +#include +#include + +class CDocumentHandler; + +// CLASS DECLARATION + +/** +* A class waiting for editing of an embedded document to complete. +*/ + +NONSHARABLE_CLASS( CObexUtilsLaunchWaiter ) : public CMsvOperation, public MAknServerAppExitObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CObexUtilsLaunchWaiter* NewLC( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ); + + /** + * Two-phased constructor. + */ + static CObexUtilsLaunchWaiter* NewL( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ); + + /** + * Destructor. + */ + ~CObexUtilsLaunchWaiter(); + + public: // Functions from base classes + + /** + * From MAknServerAppExitObserve Editing has completed. + * @param TInt The exit mode including document state. + * @return None. + */ + void HandleServerAppExit(TInt aReason); + + /** + * From CActive A request has been completed. + * @return None. + */ + void RunL(); + + /** + * From CActive A request has been cancelled. + * @return None. + */ + void DoCancel(); + + /** + * ProgressL + * @return TDesC8&, progress + */ + virtual const TDesC8& ProgressL(); + + private: + + /** + * C++ default constructor. + */ + CObexUtilsLaunchWaiter( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ); + + void ConstructL( CMsvEntry* aMessage ); + + /** + * Locate the file used to fix the broken link in Inbox + * @param aFileName the file including full path user selects ( on return ) + * @param anOldFileName old file name including full path saved in attachment. + * @return TBool + */ + TBool LocateFileL(TFileName& aFileName, const TFileName& anOldFileName); + + /** + * Launch Selection dialog for user to locate the file + * @param aFileName the file including full path user selects ( on return ) + * @param anOldFileName old file name excluding full path saved in attachment. + * @return TBool + */ + TBool LaunchFileSelectionDialogL(TFileName& aFileName, const TFileName& anOldFileName); + + /** + * Check the drive if available. + * @param aDriveNumber enum TDriveNumber defined in f32file.h + * @return Symbian error code + */ + TInt CheckDriveL(TDriveNumber aDriveNumber); + + /** + * Check if the file is saved in memory card. + * @param aFileName full path and name of the file + * @return TDriveNumber if saved in E or F drive; + * otherwise KErrNotFound. + */ + TInt CheckIfSaveInMMC(const TFileName& aFileName); + + private: + CDocumentHandler* iDocumentHandler; + }; + +#endif // COBEXUTILSLAUNCHWAITER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsopaquedata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsopaquedata.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002 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: +* Service controller resouce file's opaque_data parser. +* +*/ + + +#ifndef OBEXUTILSOPAQUEDATA_H +#define OBEXUTILSOPAQUEDATA_H + + +// INCLUDES +#include +#include + +const TUint KObexUtilsMaxOpaqueDataStringLen = 0x100; + +// CLASS DECLARATION + +/** +* Process opaque_data field in service controller ECom plug-in resource file. +* opaque_data field contains 2 types of data: string and number. +*/ +NONSHARABLE_CLASS( CObexUtilsOpaqueData ): public CBase + { +public: + + /** + * constructor. + * @param aDes buffer to hold the opaque_data + */ + IMPORT_C CObexUtilsOpaqueData(const TDesC8& aDes); + + /** + * Get string from current location. Return error code if invalid string format.. + * @param aString buffer to hold the parsed string. + * @return Error code. + */ + IMPORT_C TInt GetString(TBuf8 &aString); + + /** + * Get number from current location. Return error code if invalid string format.. + * @param aNumber the parsed number. + * @return Error code. + */ + IMPORT_C TInt GetNumber(TUint &aNumber); + + /* + * Peek if next entry is string by looking for a '\'. + * @return TRUE: is valid string. + * FALSE: is not string. + */ + IMPORT_C TBool IsString(); + +private: + TLex8 iData;// data buffer. + }; + +#endif diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilspropertynotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilspropertynotifier.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2004 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: Declares disk status watcher class for ObexUtils. +* +*/ + + + +#ifndef _OBEXUTILSPROPERTYNOTIFIER_H +#define _OBEXUTILSPROPERTYNOTIFIER_H + +// INCLUDES +#include +#include +#include + +// CLASS DECLARATION + + /** + Type of memory property check, + @param ECheckPhoneMemory, phone memory is checked, default value if not mentioned explicitly. + @param ECheckMMCMemory, MMC memory is checked. + */ + +enum TMemoryPropertyCheckType + { + ECheckPhoneMemory, + ECheckMMCMemory + }; + + /** + A callback interface for informing content change of disk status. Client must derive + from this class and implement HandleNotifyL() method. When disk space will cross warning + level or critical level this method will be call back. + */ + +NONSHARABLE_CLASS( MObexUtilsPropertyNotifyHandler ) + { + public: + /** + * Callback method for disk status change + * @param aUid UID identifying a shared data file where notify came from. + * @param aKey keyword of which value was changed + */ + virtual void HandleNotifyL( TMemoryPropertyCheckType aCheckType ) =0; + }; + +NONSHARABLE_CLASS( CObexUtilsPropertyNotifier ) : public CActive + { +public: // NewL, Constructors and destructor + + /* + * Two-phased constructor. + * @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class + * @param aCheckType -Constant defining type of memory checking to be done (phone/MMC) + * @return CObexUtilsPropertyNotifier* -Initialized object. + */ + + IMPORT_C static CObexUtilsPropertyNotifier* NewL( + MObexUtilsPropertyNotifyHandler* aHandler, + TMemoryPropertyCheckType aCheckType=ECheckPhoneMemory ); + + /** + * Destructor. + */ + + virtual ~CObexUtilsPropertyNotifier(); +private: // Functions from base classes + + /** + * Constructor. + * @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class + * @param aCheckType -Constant defining type of memory checking to be done (phone/MMC) + */ + + CObexUtilsPropertyNotifier( + MObexUtilsPropertyNotifyHandler* aHandler, + TMemoryPropertyCheckType aCheckType ); + + void ConstructL(); + + /** + Subscribes to a property and sets active + */ + void Subscribe(); + + /** + * From CActive Gets called when CActive::Cancel is called, + * cancels disk status watching. + * + * @param None. + * @return None. + */ + + void DoCancel(); + + /** + * From CActive Gets called when content of disk status is changed, + * calls MObexUtilsPropertyNotifyHandler::HandleNotify. + * + * @param None. + * @return None. + */ + + void RunL(); + +private: + // Reference to observer + MObexUtilsPropertyNotifyHandler* iHandler; + // Type of memory check (phone/MMC) + TMemoryPropertyCheckType iCheckType; + // Database handle + RProperty iProperty; + }; + +#endif // _OBEXUTILSPROPERTYNOTIFIER_H diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/obexutilsuilayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/obexutilsuilayer.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2002 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 COBEXUTILSUILAYER_H +#define COBEXUTILSUILAYER_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +const TUid KUidMsgTypeBt = {0x10009ED5}; +const TInt KObexUtilsMaxChar = 80; +const TInt KObexUtilsMaxCharToFromField = 256; + +// Literals for resource location (drive, directory, file) +_LIT( KObexUtilsFileDrive, "z:"); +_LIT( KObexUtilsResourceFileName, "obexutils.rsc" ); + +// Icon file +_LIT( KCommonUiBitmapFile, "MUIU.MBM" ); + +// Cover display +const TInt KEnumStart = 1; // start of enumerations; start after ECmdNone +const TInt KResourceNumberMask = 0x00000FFF; +const TInt KFirstResourceOffset = (R_IR_CONNECTING & KResourceNumberMask); + +class CMsvOperation; + +// DATA TYPES + +enum TContextMedia + { + EBluetooth, + EInfrared, + ENfc + }; + +/** +* Backup status. +* The value is controlled by FileManager +*/ +enum TFileManagerBkupStatusType + { + EFileManagerBkupStatusUnset = 0x00000000, + EFileManagerBkupStatusBackup = 0x00000001, + EFileManagerBkupStatusRestore = 0x00000002 + }; + +// CLASS DECLARATION + +/** +* Utility methods for UI related functionality. +* +*/ +NONSHARABLE_CLASS( TObexUtilsUiLayer ) + { + public: // New functions + + typedef CArrayPtr CBitmapArray; + + /** + * Launches an editor application for the given message. + * @param aMessage The message to be launched in an application. + * @param aSession A message server session. + * @param aObserverRequestStatus Request status of the observer. + * @return MSV operation + */ + IMPORT_C static CMsvOperation* LaunchEditorApplicationOperationL( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ); + + /** + * Launches an editor application for the given message. + * @param aMessage The message to be launched in an application. + * @param aSession A message server session. + * @return Symbian OS errorcode. + */ + IMPORT_C static TInt LaunchEditorApplicationL( CMsvEntry* aMessage, + CMsvSession& aSession ); + + /** + * LaunchFileManager by specific path and sort method + * @Since S60 v5.0 + * @param aPath The directory where file manager should open + * @param aSortMethod sort method to sort the files in aPath + * @param isEmbeddedMode indicates start mode for file manager or standalone mode + * @return None + */ + IMPORT_C static void LaunchFileManagerL( TDesC& aPath, TInt aSortMethod, TBool isEmbeddedMode); + + + /** + * Open the file by Launching the suitable S60 application + * @Since S60 v5.0 + * @return None + */ + IMPORT_C static void LaunchEditorApplicationL (TMsvId& aMsvIdParent); + + /** + * Shows an error note. + * @param aResourceID A resource id for the note. + * @return None. + */ + IMPORT_C static void ShowErrorNoteL( const TInt& aResourceID ); + + /** + * Shows an information note. + * @param aResourceID A resource id for the note. + * @return None. + */ + IMPORT_C static void ShowInformationNoteL( const TInt& aResourceID ); + + /** + * Reads contents of a resource into a buffer. + * @parma aBuf The buffer. + * @param aResourceID The id of the resource + * @return None. + */ + IMPORT_C static void ReadResourceL( TDes& aBuf, + const TInt& aResourceID ); + + /** + * Shows an global information note. + * @param aResourceID A resource id for the note. + * @return None. + */ + IMPORT_C static void ShowGlobalConfirmationQueryL( const TInt& aResourceID ); + + /** + * Show global conformation query without animations or tones. + * @Since S60 5.0 + * @aResourceID aREsourceID for loc string + * @return TBool + */ + IMPORT_C static TBool ShowGlobalConfirmationQueryPlainL( const TInt& aResourceID); + + /** + * Show global conformation query + * @Since S60 5.0 + * @aResourceID aREsourceID for loc string + * @aFilePath location for those files received. + * @return TBool + */ + IMPORT_C static TBool ShowGlobalFileOpenConfirmationQueryL( const TInt& aResourceID, const TDesC& aFilePath); + + + + /** + * Returns a resource id for a not supported operation. + * @return The resource id. + */ + IMPORT_C static TInt OperationNotSupported(); + + /** + * Returns an icon for the given context. + * @param aContext The context. + * @param aMedia The used media. + * @return The resource id of the icon. + */ + IMPORT_C static TInt ContextIcon( const TMsvEntry& aContext, + TContextMedia aMedia ); + + /** + * Updates bitmaps accoding to given media. + * @param aMedia The used media. + * @param aNumberOfZoomStates The media. + * @param aBitmapFile The bitmap file. + * @param aStartBitmap The resource id of the start bitmap. + * @param aEndBitmap The resource id of the start bitmap. + * @return None. + */ + IMPORT_C static void UpdateBitmaps( TUid aMedia, + TInt& aNumberOfZoomStates, + TFileName& aBitmapFile, + TInt& aStartBitmap, + TInt& aEndBitmap ); + + /** + * Create icons according to given media + * @param aMedia The used media. + * @param aIconArray The IconArray used by the caller + */ + IMPORT_C static void CreateIconsL( TUid aMedia, CArrayPtr* aIconArrays); + + /** + * Checks if backup process is running + */ + IMPORT_C TBool static IsBackupRunning(); + + /** + * Prepares dialog for execution + * @param aResourceID Resource ID of the dialog + * @param aDialog Dialog + */ + void static PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ); + + /** + * Check if cover display is enabled + * return True if enabled + */ + TBool static IsCoverDisplayL(); + + /** + * Check if process with given id is active now + * return True if is active + */ + TBool static ProcessExists( const TSecureId& aSecureId ); + + /** + * A dummy class for opening CMsvSession. + */ + class CDummySessionObserver : public CBase , public MMsvSessionObserver + { + public: + void HandleSessionEventL( TMsvSessionEvent/*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ ) {}; + }; + }; + +#endif // COBEXUTILSUILAYER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/updatemusiccollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/updatemusiccollection.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,80 @@ +/* +* 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: +* +*/ + + +#ifndef UPDATEMUSICCOLLECTION_H_ +#define UPDATEMUSICCOLLECTION_H_ + + +#include +#include +#include +#include +#include + +#include + + +class MMPXCollectionHelperObserver; +class MMPXPlaybackObserver; + +NONSHARABLE_CLASS( CUpdateMusicCollection ): public CBase , + public MMPXCollectionHelperObserver, + public MMPXPlaybackObserver + + { + + public: //cunstructor and distructors + + static CUpdateMusicCollection* NewL(); // Constructor (public) + + void ConstructL(); + + ~CUpdateMusicCollection(); + + public: //callback functions from the observers + + // from MMPXCollectionHelperObserver + // Called back after a call to + // CCollectionHelper::AddL() to provide + // status + void HandleAddFileCompleteL( TInt aErr ); + + // from MMPXPlaybackObserver + // If aErr is not KErrNone, plugin might + // still call back with more info in the aMsg. + void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); + + public: //own function + + //add the music to misic collection + void addToCollectionL(const TDesC& aFileName); + + //check if the type of the recieved file is supported by music player + TInt isSupported (const TDesC16& aPtr); + + protected: + + CUpdateMusicCollection(); + + private: + + MMPXCollectionHelper* iCollectionHelper; + MMPXPlaybackUtility* iPlaybackUtility; + }; + +#endif /*UPDATEMUSICCOLLECTION_H_*/ diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/inc/vMessageHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/inc/vMessageHandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2004 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 VMESSAGEHANDLER_H +#define VMESSAGEHANDLER_H + +// INCLUDES +#include +#include + +// MACROS +// None. + +// DATA TYPES +// None. + +// FUNCTION PROTOTYPES +// None. + +// FORWARD DECLARATIONS +// None. + +// CLASS DECLARATION +/** +* CSapVMessageParser +* +*/ +NONSHARABLE_CLASS(CSapVMessageParser) : public CBase +{ +public: + /** + * Recognises and parses SAP VMessage object + * @param aReceivedObject received OBEX object. + * @param aMtmID message type. + * @param aFile attachment file + * @param aMsvSession pointer msvsession. + * @param aTime current time. + * @return TBool is message recognised and parsed. + */ + static TBool HandleMessageL(CObexBufObject* aReceivedObject, const TUid aMtmID, + RFile& aFile, CMsvSession* aMsvSession, TTime aTime); +private: + +typedef enum { + ESapVMessageUnknown, + ESapVMessageDiscard, + ESapVMessageTextSMS, + ESapVMessageMMSNotificationInd +} TSapVMessageType; + +typedef enum { + ESapVMessageStatusUnknown, + ESapVMessageStatusUnread, + ESapVMessageStatusRead, + ESapVMessageStatusSent +} TSapVMessageStatus; + +private: + static CSapVMessageParser* NewLC(); + void ConstructL(); + /** + * Constructor. + * @param None + */ + CSapVMessageParser(); + + /** + * Recognises and parses SAP VMessage object + * @param aReceivedObject received OBEX object. + * @param aMtmID message type. + * @param aFile attachment file + * @param aTime current time. + * @return TBool is message recognised and parsed. + */ + TBool ParseMessageL(CObexBufObject* aReceivedObject, const TUid aMtmID, + RFile& aFile, TTime aTime); + + /** + * Saves parsed message. + * @param aMsvSession pointer msvsession. + * @return None. + */ + void SaveSapMessageL(CMsvSession* aMsvSession); + + /** + * Saves parsed message as SMS message. + * @param aMsvSession pointer msvsession. + * @return None. + */ + void SaveSapSmsL(CMsvSession* aMsvSession); + + /** + * Saves parsed message as MMS notification. + * @param aMsvSession pointer msvsession. + * @return None. + */ + void SaveSapMmsL(CMsvSession* aMsvSession) const; + + /** + * Recognises active SAP connection + * @param None. + * @return TBool is SAP connection active. + */ + static TBool IsSapConnectionActive(); + + /** + * Checks MIME type + * @param aType MIME type. + * @return TBool is MIME type for VMessage. + */ + static TBool CheckMime(const TDesC8& aType); + + /** + * Checks name + * @param aName file name. + * @return TBool is name for SAP VMessage. + */ + static TBool CheckName(const TDesC& aName); + + /** + * Returns Address field of the parsed message + * @param None. + * @return TDesC address field of the parsed message. + */ + const TDesC& Address() const; + + /** + * Returns Body text of the parsed message + * @param None. + * @return TDesC body text of the parsed message. + */ + const TDesC& Message() const; + + /** + * Destructor. + */ + ~CSapVMessageParser(); + + /** + * Parses SAP VMessage object + * @param aData VMessage data. + * @return None. + */ + void SimpleParseL(const TDesC8& aData); + + /** + * Saves parsed message to Inbox as SMS message. + * @param aMsvSession pointer msvsession. + * @return None. + */ + void SaveSmsToInboxL(CMsvSession* aMsvSession, CRichText* aMessage); + + /** + * Saves parsed message to Sent folder as SMS message. + * @param aMsvSession pointer msvsession. + * @return None. + */ + void SaveSmsToSentL(CMsvSession* aMsvSession, CRichText* aMessage); + +private: + TSapVMessageType iType; + TSapVMessageStatus iStatus; + TTime iTimeOriginal; + TTime iTimeReceived; + HBufC* iAddress; + HBufC* iMessage; +}; + +#endif //VMESSAGEHANDLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/loc/Obexutils.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/loc/Obexutils.loc Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2002 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 contains the localised strings for obexutils. +* +* +* +*/ + + +// LOCALISATION STRINGS + +// d: descripes status of item that is currently sending state in the outbox. +// l: list_double_graphic_pane_t2 +// +#define qtn_mce_outbox_status_sending "Sending" + +// d: Informs state of IR connection. +// d: this is the first shown when the user tries connect to other +// d: remote device. +// l: popup_note_wait_window +#define qtn_ir_connecting "Connecting via Infrared.." + +// d: This informs that the IR connection cannot made to other remote device +// d: for some reason. +// l: popup_note_window +#define qtn_ir_cant_establish_conn "Cannot establish Infrared connection." + +// d: This is shown after the IR connection is made succesfully and we are +// d: sending message over IR. +// l: popup_note_wait_window +#define qtn_ir_sending_data "Sending message via Infrared..." + +// d: This is shown when the IR connection is made and some thing goes wrong +// d: during connection. +// l: popup_note_window +#define qtn_ir_sending_failed "Failed to send message via Infrared." + +// d: This error note is shown when the Infrared receiving fails for some reason +// l: popup_note_window +#define qtn_ir_failed_to_receive "Receiving failed" + +// d: This is shown to the user when the message is sended succesfully. +// l: popup_note_window +#define qtn_ir_data_sent "Message sent via Infrared!" + +// d: Displayed in the "To/From" section for Ir objects in message centre. +// l: msg_header_pane_t2 +#define qtn_mce_ir_message "Infrared message" + +// d: This is shown, when the user tries open a message that is not +// d: supported type. +// l: popup_note_window +#define qtn_mce_info_message_not_opened "Invalid message, can't be opened" + +// d: Informs state of Bluetooth connection. +// d: this is the first shown when the user tries connect to other +// d: remote device. +// l: popup_note_wait_window +#define qtn_bt_connecting "Connecting..." + +// d: This is shown after the Bluetooth connection is made succesfully +// d: and we are sending message over Bluetooth. +// l: popup_note_wait_window +#define qtn_bt_sending_data "Sending message..." + +// d: This is shown after the Bluetooth connection is made succesfully +// d: and we are receiving message over Bluetooth. +// l: popup_note_wait_window +#define qtn_bt_receiving_data "Receiving message via Bluetooth" + +// d: This wait note is shown when the device is receiving something over the Infrared +// l: popup_note_wait_window +#define qtn_ir_receiving_data "Receiving message via Infrared" + +// d: This informs that the Bluetooth connection cannot made to other +// d: remote device for some reason. +// l: popup_note_window +#define qtn_bt_dev_not_avail "Cannot establish Bluetooth connection" + +// d: This is shown to the user when the message is sended succesfully via BT. +// l: popup_note_window +#define qtn_bt_data_sent "Message sent!" + +// d: This is shown when the BT connection is made and some thing goes wrong +// d: during connection. +// l: popup_note_window +#define qtn_bt_failed_to_send "Failed to send message" + +// d: This error note is shown when the BT receiving fails for some reason +// l: popup_note_window +#define qtn_bt_failed_to_receive "Receiving failed" + +// d: Displayed in the filename section for Ir objects in message centre in +// d: case of the name is corrupted. +// l: list_double_pane_t2_cp2 +// +#define qtn_fldr_default_doc_name "Document" + +// BIP usability improvement + +// d: This is shown when one could not be sent +// l: popup_note_window +#define qtn_bt_bip_format_not_supported "Receiving device does not support this image format." + +// d: This is shown when some images could not be sent +// l: popup_note_window +#define qtn_bt_bip_not_all_formats_supported "Receiving device does not support all needed image formats, Continue?" + +// d: This is shown when sending is finished in case some images are not supported. +// l: popup_note_window +#define qtn_bt_bip_some_files_sent "%0N of %1N images sent!" + +// d: This is shown when no images could be sent +// l: popup_note_window +#define qtn_bt_bip_no_formats_supported "Receiving device does not support the needed image formats." + +//d: This is shown when one could not be sent +//l: popup_note_window +//r: 3.1 +//w: +#define qtn_bt_bip_mixed_list "Receiving device does not support all needed image formats. Send anyway?" + + +// New loc strings for Req. saving file directly to file system. + +//d: This is shown after a single file received. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_single "File saved in %U. Open now?" + +//d: This is shown after a single file received. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_multiple "Files saved in %U. Open now?" + +//d: This is shown when user opens the broken link in inbox. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_search "File not found, would you like to locate it?" + +//d: This is shown when file is originally saved on MMC but mmc is not available. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_no_memory_card "File not found as memory card is not present. Locate file?" + +//d: This is shown when file link is updated. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_link_updated "File link updated" + +//d: This is shown when new selected filename does not match the orignal filename. +//l: popup_note_window +//r: 5.0 +#define qtn_bt_saved_search_update "File names don't match, update link anyway?" + + + +// -- New string added for CR 403-9991 show filename and size while receiving -- + + +//d: This is shown while receiving files via either bluetooth or infrared +//d: and the receiving file size is smaller than a defined limit +//l: popup_note_wait_window +//r: 5.0 +#define qtn_bt_ir_receiving_data_size_kb "Receiving \n%U\n%N kB" + +//d: This is shown while receiving files via either bluetooth or infrared +//d: and the receiving file size is larger than a defined limit +//l: popup_note_wait_window +//r: 5.0 +#define qtn_bt_ir_receiving_data_size_mb "Receiving \n%U\n%N MB" + + +//d: This is shown while receiving files via either bluetooth or infrared +//d: and the receiving file size is unknown +//l: popup_note_wait_window +//r: 5.0 +#define qtn_bt_ir_receiving_data_no_size "Receiving \n%U" + + +// -- New string added for CR 404-4716 Allow sending unsupported image over BT BIP -- + +// d: This is shown when one could not be sent +// l: popup_note_window +// r: 5.0 +#define qtn_bt_bip_format_not_supported_send "Receiving device does not support this image format. Send anyway?" + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,359 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "obexutilsdialog.h" +#include "obexutilsdialogtimer.h" +#include "obexutilsuilayer.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "obexutilsdebug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +CObexUtilsDialog::CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr ) : + iDialogObserverPtr( aObserverPtr ) + { + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::NewL +// ----------------------------------------------------------------------------- +EXPORT_C CObexUtilsDialog* CObexUtilsDialog::NewL( MObexUtilsDialogObserver* aObserverPtr ) + { + CObexUtilsDialog* self = new ( ELeave ) CObexUtilsDialog( aObserverPtr ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return( self ); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::NewLC +// ----------------------------------------------------------------------------- +EXPORT_C CObexUtilsDialog* CObexUtilsDialog::NewLC( MObexUtilsDialogObserver* aObserverPtr ) + { + CObexUtilsDialog* self = new ( ELeave ) CObexUtilsDialog( aObserverPtr ); + CleanupStack::PushL( self ); + self->ConstructL(); + return( self ); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::ConstructL +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +void CObexUtilsDialog::ConstructL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ConstructL()")); + + if (!iDialogObserverPtr) + { + // The observer pointer was not given as an argument. + // + User::Leave(KErrArgument); + } + + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), fileName ); + iResourceFileId = CCoeEnv::Static()->AddResourceFileL( fileName ); + + iCoverDisplayEnabled = IsCoverDisplayL(); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CObexUtilsDialog::~CObexUtilsDialog() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog()")); + + CCoeEnv::Static()->DeleteResourceFile( iResourceFileId ); + delete iObexDialogTimer; + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::LaunchProgressDialogL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::LaunchProgressDialogL( + MObexUtilsProgressObserver* aObserverPtr, TInt aFinalValue, + TInt aResId, TInt aTimeoutValue ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL()")); + + if ( aObserverPtr ) + { + // The observerPtr was given, so store it and start a timer + // + iProgressObserverPtr = aObserverPtr; + + if ( iObexDialogTimer ) + { + iObexDialogTimer->Cancel(); + delete iObexDialogTimer; + iObexDialogTimer = NULL; + } + + iObexDialogTimer = CObexUtilsDialogTimer::NewL( this ); + iObexDialogTimer->SetTimeout( aTimeoutValue ); + } + + iProgressDialogResId = aResId; + + iProgressDialog = new( ELeave ) CAknProgressDialog( + ( reinterpret_cast( &iProgressDialog ) ), ETrue ); + PrepareDialogExecuteL( aResId, iProgressDialog ); + iProgressDialog->ExecuteLD( R_SENDING_PROGRESS_NOTE ); + + HBufC* buf = StringLoader::LoadLC( aResId ); + iProgressDialog->SetTextL( buf->Des() ); + CleanupStack::PopAndDestroy( buf ); + + iProgressDialog->GetProgressInfoL()->SetFinalValue( aFinalValue ); + iProgressDialog->SetCallback( this ); + if ( iProgressObserverPtr ) + { + iObexDialogTimer->Tickle(); + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::LaunchWaitDialogL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::LaunchWaitDialogL( TInt aResId ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL()")); + + if ( iWaitDialog || iProgressDialog ) + { + // Allow only one dialog at a time + // + User::Leave( KErrInUse ); + } + + iWaitDialog = new( ELeave ) CAknWaitDialog( + ( reinterpret_cast( &iWaitDialog ) ), EFalse ); + + iWaitDialog->SetCallback( this ); + PrepareDialogExecuteL( aResId, iWaitDialog ); + iWaitDialog->ExecuteLD( aResId ); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::CancelWaitDialogL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::CancelWaitDialogL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelWaitDialogL()")); + + if( iWaitDialog ) + { + iWaitDialog->SetCallback(NULL); + iWaitDialog->ProcessFinishedL(); + iWaitDialog = NULL; + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelWaitDialogL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::CancelProgressDialogL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::CancelProgressDialogL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL()")); + + if( iProgressDialog ) + { + iProgressDialog->SetCallback(NULL); + iProgressDialog->ProcessFinishedL(); + iProgressDialog = NULL; + + if ( iObexDialogTimer ) + { + iObexDialogTimer->Cancel(); + delete iObexDialogTimer; + iObexDialogTimer = NULL; + } + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::UpdateProgressDialogL +// ----------------------------------------------------------------------------- +EXPORT_C void CObexUtilsDialog::UpdateProgressDialogL( TInt aValue, TInt aResId ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL()")); + + if ( iProgressDialog ) + { + iProgressDialog->GetProgressInfoL()->SetAndDraw( aValue ); + + HBufC* buf = StringLoader::LoadLC( aResId ); + iProgressDialog->SetTextL( buf->Des() ); + iProgressDialog->LayoutAndDraw(); + CleanupStack::PopAndDestroy( buf ); + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::DialogDismissedL +// ----------------------------------------------------------------------------- +void CObexUtilsDialog::DialogDismissedL( TInt aButtonId ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::DialogDismissedL()")); + + // The dialog has already been deleted by UI framework. + // + if( aButtonId == EAknSoftkeyCancel ) + { + if ( iDialogObserverPtr ) + { + iDialogObserverPtr->DialogDismissed( aButtonId ); + } + + if ( iObexDialogTimer ) + { + iObexDialogTimer->Cancel(); + delete iObexDialogTimer; + iObexDialogTimer = NULL; + } + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::DialogDismissedL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::UpdateProgressDialog +// ----------------------------------------------------------------------------- +void CObexUtilsDialog::UpdateProgressDialog() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialog()")); + + TRAPD( ignoredError, UpdateProgressDialogL( + iProgressObserverPtr->GetProgressStatus(), iProgressDialogResId ) ); + + if (ignoredError != KErrNone) + { + FLOG(_L("Ignore this error")); + } + + if ( iObexDialogTimer ) + { + iObexDialogTimer->Tickle(); + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialog() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::LaunchQueryDialogL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CObexUtilsDialog::LaunchQueryDialogL( const TInt& aResourceID ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchQueryDialogL()")); + + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + CleanupStack::PushL( dlg ); + PrepareDialogExecuteL( aResourceID, dlg ); + CleanupStack::Pop( dlg ); + TInt keypress = dlg->ExecuteLD( aResourceID ); + + return keypress; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::ShowNumberOfSendFileL +// ----------------------------------------------------------------------------- +// + +EXPORT_C void CObexUtilsDialog::ShowNumberOfSendFileL( TInt aSentNum, TInt aTotalNum ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ShowNumberOfSendFile()")); + + CAknInformationNote* myNote = new (ELeave) CAknInformationNote(); + + CArrayFix* nums = new( ELeave ) CArrayFixFlat(3); + CleanupStack::PushL(nums); + nums->AppendL(aSentNum); + nums->AppendL(aTotalNum); + CleanupStack::Pop(nums); + + HBufC* stringholder = StringLoader::LoadLC( R_BT_SENT_IMAGE_NUMBER, *nums); + PrepareDialogExecuteL( R_BT_SENT_IMAGE_NUMBER, myNote ); + myNote->ExecuteLD( *stringholder ); + CleanupStack::PopAndDestroy( stringholder ); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::PrepareDialogExecuteL +// ----------------------------------------------------------------------------- +// +void CObexUtilsDialog::PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ) + { + if (iCoverDisplayEnabled) + { + TInt dialogIndex = + ((aResourceID & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; + aDialog->PublishDialogL( dialogIndex, KObexUtilsCategory ); + } + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialog::IsCoverDisplayL() +// ----------------------------------------------------------------------------- +// +TBool CObexUtilsDialog::IsCoverDisplayL() + { + TBool coverDisplay = EFalse; + FeatureManager::InitializeLibL(); + if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) + { + coverDisplay = ETrue; + } + FeatureManager::UnInitializeLib(); + return coverDisplay; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsdialogtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsdialogtimer.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "obexutilsdialogtimer.h" +#include "obexutilsdebug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CObexUtilsDialogTimer::CObexUtilsDialogTimer( CObexUtilsDialog* aParent) + : CTimer( EPriorityLow ), + iParent( aParent ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::ConstructL +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- +// +void CObexUtilsDialogTimer::ConstructL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::ConstructL()")); + + CTimer::ConstructL(); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::ConstructL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::NewL +// ----------------------------------------------------------------------------- +CObexUtilsDialogTimer* CObexUtilsDialogTimer::NewL( CObexUtilsDialog* aParent) + { + CObexUtilsDialogTimer* self = + new( ELeave ) CObexUtilsDialogTimer( aParent ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CObexUtilsDialogTimer::~CObexUtilsDialogTimer() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::Tickle +// ----------------------------------------------------------------------------- +// +void CObexUtilsDialogTimer::Tickle() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::Tickle()")); + + Cancel(); + After( iTimeout ); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::Tickle() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::RunL +// ----------------------------------------------------------------------------- +// +void CObexUtilsDialogTimer::RunL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::RunL()")); + if (iParent) + { + iParent->UpdateProgressDialog(); + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsDialogTimer::RunL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsDialogTimer::SetTimeout +// ----------------------------------------------------------------------------- +// +void CObexUtilsDialogTimer::SetTimeout( TTimeIntervalMicroSeconds32 aTimeout ) + { + iTimeout = aTimeout; + } + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2002 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 global progress dialog +* +*/ + + + + +#include +#include + +#include "obexutilsentryhandler.h" +#include "obexutilsdebug.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CObexutilsEntryhandler() +// --------------------------------------------------------------------------- +// +CObexutilsEntryhandler::CObexutilsEntryhandler(): CActive ( EPriorityNormal ) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CObexutilsEntryhandler::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CObexutilsEntryhandler* CObexutilsEntryhandler::NewL() + { + CObexutilsEntryhandler* self = CObexutilsEntryhandler::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CObexutilsEntryhandler* CObexutilsEntryhandler::NewLC() + { + CObexutilsEntryhandler* self = new( ELeave ) CObexutilsEntryhandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// AddLinkAttachment() +// --------------------------------------------------------------------------- +// +TInt CObexutilsEntryhandler::AddEntryAttachment( + const TDesC &aFilePath, + CMsvAttachment* anAttachInfo, + CMsvStore* aStore) + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment()")); + + iStatus = KRequestPending; + + TRAPD(error, DoAddEntryAttachmentL(aFilePath, anAttachInfo, aStore)); + if (error != KErrNone ) + { + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, error); + } + + SetActive(); + iSyncWaiter.Start(); + + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment() Done")); + return iStatus.Int(); + } + + +// --------------------------------------------------------------------------- +// DoAddLinkAttachmentL() +// --------------------------------------------------------------------------- +// +void CObexutilsEntryhandler::DoAddEntryAttachmentL( + const TDesC &aFilePath, + CMsvAttachment* anAttachInfo, + CMsvStore* aStore) + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL()")); + + aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus); + + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL() completed")); + } + +// --------------------------------------------------------------------------- +// UpdateLinkAttachment() +// --------------------------------------------------------------------------- +// +TInt CObexutilsEntryhandler::UpdateEntryAttachment( + TFileName& aFileName, + CMsvAttachment* anOldAttachInfo, + CMsvAttachment* aNewAttachInfo, + CMsvStore* aStore) + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment()")); + + iStatus = KRequestPending; + + TRAPD(error, DoUpdateEntryAttachmentL(aFileName,anOldAttachInfo, aNewAttachInfo, aStore)); + if (error != KErrNone ) + { + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, error); + } + + SetActive(); + iSyncWaiter.Start(); + + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment() Done")); + return iStatus.Int(); + } + +// --------------------------------------------------------------------------- +// DoUpdateEntryAttachmentL() +// --------------------------------------------------------------------------- +// +void CObexutilsEntryhandler::DoUpdateEntryAttachmentL( + TFileName& aFileName, + CMsvAttachment* anOldAttachInfo, + CMsvAttachment* aNewAttachInfo, + CMsvStore* aStore) + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL()")); + aStore->AttachmentManagerL().RemoveAttachmentL(anOldAttachInfo->Id(), iStatus); + aStore->AttachmentManagerL().AddLinkedAttachmentL(aFileName,aNewAttachInfo, iStatus); + + //Complete request + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL() completed")); + } + +// --------------------------------------------------------------------------- +// From class CActive. +// RunL() +// --------------------------------------------------------------------------- +// +void CObexutilsEntryhandler::RunL() + { + if ( iSyncWaiter.IsStarted() ) + { + iSyncWaiter.AsyncStop(); + } + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::RunL() Done")); + } + +// --------------------------------------------------------------------------- +// ~CObexutilslinkhandler() +// --------------------------------------------------------------------------- +// +CObexutilsEntryhandler::~CObexutilsEntryhandler() + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::Destructor")); + Cancel(); + } + +// --------------------------------------------------------------------------- +// From class CActive. +// DoCancel() +// --------------------------------------------------------------------------- +// +void CObexutilsEntryhandler::DoCancel() + { + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoCancel()")); + if ( iSyncWaiter.IsStarted() ) + { + iSyncWaiter.AsyncStop(); + } + FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoCancel() done")); + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsglobaldialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsglobaldialog.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2002 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 global progress dialog for voice recognition +* +*/ + + + + + +// INCLUDE FILES + +#include "obexutilsglobalprogressdialog.h" +#include "obexutilsuilayer.h" +#include +#include +#include +#include +#include "obexutilsdebug.h" + + + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CGlobalDialog::CGlobalDialog() : CActive(EPriorityNormal) + { + CActiveScheduler::Add( this ); + } + +// Symbian default constructor can leave. +void CGlobalDialog::ConstructL(MGlobalNoteCallback* aObserver) + { + iKeyCallback = aObserver; + iAknGlobalNote = CAknGlobalNote::NewL(); + } + + +// Two-phased constructor. +EXPORT_C CGlobalDialog* CGlobalDialog::NewL(MGlobalNoteCallback* aObserver) + { + CGlobalDialog* self = NewLC(aObserver); + CleanupStack::Pop(); + return self; + } + +// Two-phased constructor.- stack version +EXPORT_C CGlobalDialog* CGlobalDialog::NewLC(MGlobalNoteCallback* aObserver) + { + CGlobalDialog* self=new (ELeave) CGlobalDialog(); + CleanupStack::PushL(self); + self->ConstructL(aObserver); + return self; + } + +EXPORT_C void CGlobalDialog::ShowErrorDialogL(TInt aResourceId) +{ + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + if(!iStringResourceReader) + { + iStringResourceReader= CStringResourceReader::NewL( fileName ); + } + TPtrC buf; + buf.Set(iStringResourceReader-> ReadResourceString(aResourceId)); + iAknGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_CLOSE); + iAknGlobalNote->ShowNoteL(iStatus,EAknGlobalInformationNote, buf); + FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: ShowNoteDialogL buf: \t %S" ), &buf) ); + SetActive(); + +} +EXPORT_C void CGlobalDialog::ShowNoteDialogL( TInt aResourceId, TBool anAnimation) +{ + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + if(!iStringResourceReader) + { + iStringResourceReader= CStringResourceReader::NewL( fileName ); + } + TPtrC buf; + buf.Set(iStringResourceReader-> ReadResourceString(aResourceId)); + iAknGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_CANCEL); + if(anAnimation) + { + iAknGlobalNote->SetAnimation(R_QGN_GRAF_WAIT_BAR_ANIM); + } + iAknGlobalNote->ShowNoteL(iStatus,EAknGlobalWaitNote, buf); + FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: ShowNoteDialogL buf: \t %S" ), &buf) ); + SetActive(); + +} + +// Destructor +CGlobalDialog::~CGlobalDialog() + { + Cancel(); + if(iAknGlobalNote) + { + delete iAknGlobalNote; + iAknGlobalNote = NULL; + } + + delete iStringResourceReader; + + } + + + +// --------------------------------------------------------- +// CGlobalDialog::DoCancel +// Active object cancel +// --------------------------------------------------------- +// +void CGlobalDialog::DoCancel() + { + ProcessFinished(); + if(iStringResourceReader) + { + delete iStringResourceReader; + iStringResourceReader = NULL; + } + } + +// --------------------------------------------------------- +// CGlobalDialog::RunL +// Active object RunL +// --------------------------------------------------------- +// +void CGlobalDialog::RunL() + { + + FTRACE( FPrint(_L( "[ObexUtils] CGlobalDialog: RunL iStatus.Int():\t %d" ), iStatus.Int() ) ); + if ( iKeyCallback != NULL ) + { + iKeyCallback->HandleGlobalNoteDialogL(iStatus.Int()); + } + } + +// --------------------------------------------------------- +// CGlobalDialog::ProcessFinished +// Stops the progress dialog +// --------------------------------------------------------- +// +EXPORT_C void CGlobalDialog::ProcessFinished() + { + FLOG( _L( "[ObexUtils] CGlobalDialog::ProcessFinished\t" ) ); + delete iAknGlobalNote; + iAknGlobalNote = NULL; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsglobalprogressdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsglobalprogressdialog.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2002 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 global progress dialog +* +*/ + + + + + +// INCLUDE FILES +#include +#include "obexutilsglobalprogressdialog.h" +#include "obexutilsuilayer.h" +#include +#include +#include +#include +#include +//#include // Compiled resource ids +#include + +#include // Localisation stringloader +#include + +#include "obexutilsdebug.h" + +const TInt KMaxDisplayFileName = 17; // used while showing receiving filename. + // If the filename is longer than 20 bytes, we make it show only 20 bytes. + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CGlobalProgressDialog::CGlobalProgressDialog() : CActive(EPriorityNormal) + { + CActiveScheduler::Add( this ); + } + + +// Symbian default constructor can leave. +void CGlobalProgressDialog::ConstructL(MGlobalProgressCallback* aObserver) + { + iProgressDialog = CAknGlobalProgressDialog::NewL(); + iKeyCallback = aObserver; + } + + +// Two-phased constructor. +EXPORT_C CGlobalProgressDialog* CGlobalProgressDialog::NewL(MGlobalProgressCallback* aObserver) + { + CGlobalProgressDialog* self = NewLC(aObserver); + CleanupStack::Pop(); + return self; + } + +// Two-phased constructor.- stack version +EXPORT_C CGlobalProgressDialog* CGlobalProgressDialog::NewLC(MGlobalProgressCallback* aObserver) + { + CGlobalProgressDialog* self=new (ELeave) CGlobalProgressDialog(); + CleanupStack::PushL(self); + self->ConstructL(aObserver); + return self; + } + + +// Destructor +CGlobalProgressDialog::~CGlobalProgressDialog() + { + Cancel(); + delete iProgressDialog; + delete iStringResourceReader; + } + + + +// --------------------------------------------------------- +// CGlobalProgressDialog::DoCancel +// Active object cancel +// --------------------------------------------------------- +// +void CGlobalProgressDialog::DoCancel() + { + if ( iProgressDialog ) + { + iProgressDialog->CancelProgressDialog(); + } + + if(iStringResourceReader) + { + delete iStringResourceReader; + iStringResourceReader = NULL; + } + } + +// --------------------------------------------------------- +// CGlobalProgressDialog::RunL +// Active object RunL +// --------------------------------------------------------- +// +void CGlobalProgressDialog::RunL() + { + if ( iKeyCallback != NULL ) + { + iKeyCallback->HandleGlobalProgressDialogL(iStatus.Int()); + } + } + +// --------------------------------------------------------- +// CGlobalProgressDialog::SetIconL +// Set icon on the dialog +// --------------------------------------------------------- +// +void CGlobalProgressDialog::SetIconL( const TDesC& aIconText, const TDesC& aIconFile, + TInt aIconId, TInt aIconMaskId ) + { + iProgressDialog->SetIconL(aIconText, aIconFile, aIconId, aIconMaskId ); + } + +// --------------------------------------------------------- +// CGlobalProgressDialog::SetImageL +// Set image on the dialog +// --------------------------------------------------------- +// +void CGlobalProgressDialog::SetImageL( const TDesC& aImageFile, TInt aImageId, + TInt aImageMaskId ) + { + iProgressDialog->SetImageL(aImageFile, aImageId, aImageMaskId); + } + + +// --------------------------------------------------------- +// CGlobalProgressDialog::ShowProgressDialogL +// Shows progress dialog and sets active object active +// --------------------------------------------------------- +// +EXPORT_C void CGlobalProgressDialog::ShowProgressDialogL(TInt aStringId) + { + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + if(!iStringResourceReader) + { + iStringResourceReader= CStringResourceReader::NewL( fileName ); + } + TPtrC buf; + //buf.Set(iStringResourceReader-> ReadResourceString(R_BT_RECEIVING_DATA)); + buf.Set(iStringResourceReader-> ReadResourceString(aStringId)); + iProgressDialog->ShowProgressDialogL( iStatus, buf, R_AVKON_SOFTKEYS_HIDE_CANCEL__HIDE ); + //iProgressDialog->ShowProgressDialogL( iStatus, buf, R_BTUI_SOFTKEYS_OPTIONS_EXIT__CHANGE ); //R_OBEXUTILS_SOFTKEYS_HIDE_CANCEL ); + SetActive(); + } + +// --------------------------------------------------------- +// CGlobalProgressDialog::ShowProgressDialogNameSizeL +// Shows progress dialog and sets active object active +// --------------------------------------------------------- +// +EXPORT_C void CGlobalProgressDialog::ShowProgressDialogNameSizeL( + TDesC& aFileName, + TInt64 aFileSize) + { + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + if(!iStringResourceReader) + { + iStringResourceReader= CStringResourceReader::NewL( fileName ); + } + TPtrC buf; + + + TBuf<20> sizeInString; + sizeInString.Zero(); + + if ( aFileSize >> 20 ) // size in MB + { + TReal sizeInMB = 0; + sizeInMB = ((TReal)aFileSize ) / (1024*1024); + _LIT16(KFormatTwoDecimal,"%4.2f"); // keep 2 decimals + sizeInString.Format(KFormatTwoDecimal,sizeInMB); + buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_SIZE_MB)); + } + else if( aFileSize >> 10 ) // size in KB + { + TInt64 sizeInKB = 0; + sizeInKB = aFileSize >> 10; + sizeInString.AppendNum(sizeInKB); + buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_SIZE_KB)); + } + else // size is unknown or less than 1K + { + buf.Set(iStringResourceReader-> ReadResourceString(R_BT_IR_RECEIVING_DATA_NO_SIZE)); + } + + + TBuf<100> tbuf; + tbuf.Zero(); + tbuf.Append(buf); + _LIT(KPrefix,"["); + _LIT(Ksuffix,"]"); + TInt prefixPos = tbuf.Find(KPrefix); + if (prefixPos!= KErrNotFound) + { + TInt keyLength = 0; + TInt suffixPos = tbuf.Find(Ksuffix); + keyLength =(tbuf.Mid(prefixPos)).Length()-(tbuf.Mid(suffixPos)).Length()+1; + tbuf.Delete(prefixPos, keyLength); + } + _LIT(KString,"%U"); + + + + if ( aFileName.Length() > KMaxDisplayFileName ) + { + // Filename is too long, + // We make it shorter. Hiding the chars in the middle part of filename. + // + TFileName shortname; + shortname = aFileName.Mid(0,KMaxDisplayFileName/2); + shortname.Append(_L("...")); + shortname.Append(aFileName.Mid(aFileName.Length() - KMaxDisplayFileName/2, KMaxDisplayFileName/2)); + tbuf.Replace(tbuf.Find(KString) , 2, shortname); + } + else + { + tbuf.Replace(tbuf.Find(KString) , 2, aFileName); + } + _LIT(KInt, "%N"); + if ( sizeInString.Length() > 0 ) + { + tbuf.Replace(tbuf.Find(KInt) , 2, sizeInString); + } + + iProgressDialog->ShowProgressDialogL( iStatus, tbuf, R_AVKON_SOFTKEYS_HIDE_CANCEL__HIDE ); + SetActive(); + } +// --------------------------------------------------------- +// CGlobalProgressDialog::UpdateProgressDialog +// Updates the progress dialog +// --------------------------------------------------------- +// +EXPORT_C void CGlobalProgressDialog::UpdateProgressDialog(TInt aValue, TInt aFinalValue) + { + iProgressDialog->UpdateProgressDialog(aValue, aFinalValue); + } + +// --------------------------------------------------------- +// CGlobalProgressDialog::ProcessFinished +// Stops the progress dialog +// --------------------------------------------------------- +// +EXPORT_C void CGlobalProgressDialog::ProcessFinished() + { + iProgressDialog->ProcessFinished(); + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilslaunchwaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilslaunchwaiter.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,414 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include // for memory and file selection dialogs +#include +#include // for getting drive root path +#include +#include +#include +#include +#include "obexutilslaunchwaiter.h" +#include "obexutilsdebug.h" +#include "obexutilsuilayer.h" // For launching file manager +#include "obexutilsmessagehandler.h" // For updating an entry + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::NewLC +// ----------------------------------------------------------------------------- +CObexUtilsLaunchWaiter* CObexUtilsLaunchWaiter::NewLC( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ) + { + CObexUtilsLaunchWaiter* self = new( ELeave )CObexUtilsLaunchWaiter( + aMsvSession, + aMessage, + aObserverRequestStatus ); + CleanupStack::PushL( self ); + self->ConstructL( aMessage ); + return self; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::NewL +// ----------------------------------------------------------------------------- +CObexUtilsLaunchWaiter* CObexUtilsLaunchWaiter::NewL( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ) + { + CObexUtilsLaunchWaiter* self = CObexUtilsLaunchWaiter::NewLC( + aMsvSession, + aMessage, + aObserverRequestStatus ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::ConstructL +// ----------------------------------------------------------------------------- +void CObexUtilsLaunchWaiter::ConstructL( CMsvEntry* aMessage ) + { + if (aMessage->Count() < 1) + { + User::Leave(KErrOverflow); + } + + CMsvEntry* attachEntry = iMsvSession.GetEntryL(((*aMessage)[0]).Id()); + CleanupStack::PushL(attachEntry); // 1st push + CMsvStore* store = attachEntry->ReadStoreL(); + CleanupStack::PushL(store); // 2nd push + + CMsvAttachment* attachInfo = store->AttachmentManagerL().GetAttachmentInfoL(0); + CleanupStack::PushL(attachInfo); // 3rd push + + TDataType dataType = attachInfo->MimeType(); + TFileName filePath; + filePath = attachInfo->FilePath(); + + 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 ( attachInfo->Type() == CMsvAttachment::EMsvLinkedFile ) + { + CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); // 4th push + TAiwGenericParam paramSave(EGenericParamFileSaved, ETrue); + paramList->AppendL( paramSave ); + + if ( eikEnv ) + { + iDocumentHandler = CDocumentHandler::NewL( eikEnv->Process() ); + iDocumentHandler->SetExitObserver( this ); + RFs rfs; + User::LeaveIfError( rfs.Connect() ); + if ( BaflUtils::FileExists( rfs, filePath ) ) + { + 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; + 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; + } + + rfs.Close(); + } // eikEnv + + CleanupStack::PopAndDestroy(); // paramList + } // EMsvLinkedFile + + + // 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(); + + if ( isCompleteSelf ) + { + HandleServerAppExit( error ); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CObexUtilsLaunchWaiter::~CObexUtilsLaunchWaiter() + { + Cancel(); + if (iDocumentHandler) + { + delete iDocumentHandler; + iDocumentHandler = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::RunL +// ----------------------------------------------------------------------------- +void CObexUtilsLaunchWaiter::RunL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::RunL()")); + + TRequestStatus* status = &iObserverRequestStatus; + User::RequestComplete( status, KErrNone ); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::RunL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::DoCancel +// ----------------------------------------------------------------------------- +void CObexUtilsLaunchWaiter::DoCancel() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::DoCancel()")); + + if ( iStatus == KRequestPending ) + { + TRequestStatus* pstat = &iStatus; + User::RequestComplete( pstat, KErrCancel ); + } + + if( iObserverRequestStatus == KRequestPending ) + { + TRequestStatus* observerStatus = &iObserverRequestStatus; + User::RequestComplete( observerStatus, KErrCancel ); + } + + + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::DoCancel() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter +// ----------------------------------------------------------------------------- +CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter( + CMsvSession& aMsvSession, + CMsvEntry* /*aMessage*/, + TRequestStatus& aObserverRequestStatus ) + : + CMsvOperation(aMsvSession, EPriorityStandard, aObserverRequestStatus), + iDocumentHandler(NULL) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter()")); + + CActiveScheduler::Add( this ); + + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::CObexUtilsLaunchWaiter() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::HandleServerAppExit +// ----------------------------------------------------------------------------- +void CObexUtilsLaunchWaiter::HandleServerAppExit(TInt aReason) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::HandleServerAppExit()")); + + if( iStatus == KRequestPending ) + { + // Complete self + // + TRequestStatus* status = &iStatus; + User::RequestComplete( status, aReason ); + } + + MAknServerAppExitObserver::HandleServerAppExit( aReason ); + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::HandleServerAppExit() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::ProgressL +// ----------------------------------------------------------------------------- +const TDesC8& CObexUtilsLaunchWaiter::ProgressL() + { + return KNullDesC8; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::LocateFile +// ----------------------------------------------------------------------------- +TBool CObexUtilsLaunchWaiter::LocateFileL(TFileName& aFileName, const TFileName& anOldFileName) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::LocateFile()")); + + TBuf<200> buf; + TRequestStatus status = KRequestPending; + + TParse fileParseOld; + fileParseOld.Set(anOldFileName, NULL, NULL); + TFileName oldName = fileParseOld.NameAndExt(); + + // check old link if the file saved in mmc. If so, check if mmc available. + // if unavailable, show "is File not found as memory card is not present" + // + TInt err = CheckIfSaveInMMC( anOldFileName ); + TBool showMMCOut = EFalse; + if( err == EDriveF) + { + if( CheckDriveL(EDriveF) ) + showMMCOut = ETrue; + } + else if( err == EDriveE ) + { + if( CheckDriveL(EDriveE) ) + showMMCOut = ETrue; + } + + TBool answer = EFalse; + if( showMMCOut ) + { + answer = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_NO_MEMORY_CARD); + } + else + { + answer = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_SEARCH); + } + + TBool updateLink = EFalse; + if ( answer ) + { + updateLink = LaunchFileSelectionDialogL(aFileName, oldName); + } + + FLOG(_L("[OBEXUTILS]\t CObexUtilsLaunchWaiter::LocateFile() completed")); + return updateLink; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::LaunchFileSelectionDialogL +// ----------------------------------------------------------------------------- +TBool CObexUtilsLaunchWaiter::LaunchFileSelectionDialogL( + TFileName& aFileName, + const TFileName& anOldName) + { + TBuf<200> buf; + TParse fileParseNew; + TFileName nameNew; + TBool updateLink = EFalse; + + while ( !updateLink ) + { + TBool isSelected = AknCommonDialogsDynMem::RunSelectDlgLD( AknCommonDialogsDynMem::EMemoryTypeMMCExternal| + AknCommonDialogsDynMem::EMemoryTypeMMC| + AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| + AknCommonDialogsDynMem::EMemoryTypePhone, + aFileName, + R_CFD_DEFAULT_SELECT_MEMORY_SELECTION, + R_CFD_DEFAULT_SELECT_FILE_SELECTION ); + + if ( isSelected ) + { + fileParseNew.Set(aFileName, NULL, NULL); + nameNew = fileParseNew.NameAndExt(); + + if ( nameNew.Compare(anOldName)) // names do not match + { + updateLink = TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL(R_BT_SAVED_SEARCH_UPDATE); + } + else + { + updateLink = ETrue; + } + } + else + { + break; // Exit from while loop. + } + } + + return updateLink; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::CheckDriveL +// ----------------------------------------------------------------------------- +TInt CObexUtilsLaunchWaiter::CheckDriveL(TDriveNumber aDriveNumber) + { + RFs rfs; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL( rfs ) ; + TVolumeInfo volumeInfo; + TInt err = rfs.Volume(volumeInfo, aDriveNumber); + CleanupStack::PopAndDestroy(); // rfs + + return err; + } +// ----------------------------------------------------------------------------- +// CObexUtilsLaunchWaiter::CheckIfSaveInMMC +// ----------------------------------------------------------------------------- +TInt CObexUtilsLaunchWaiter::CheckIfSaveInMMC(const TFileName& aFileName) + { + if(aFileName.Find(_L("F:")) != KErrNotFound) + return EDriveF; + if(aFileName.Find(_L("E:")) != KErrNotFound) + return EDriveE; + + return KErrNotFound; + } +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,1609 @@ +/* +* Copyright (c) 2002,2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "obexutilsmessagehandler.h" +#include "obexutilsuilayer.h" +#include "obexutilsdebug.h" +#include "obexutilsentryhandler.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include "updatemusiccollection.h" + +#include // provides interface for quering system paths + +#ifdef __BT_SAP + #include "vMessageHandler.h" +#endif // __BT_SAP + +// CONSTANT +const TInt KFFSBelowCritical = -2; +const TInt KRenameOffSet = 4 ; +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// RemoveObexBuffer Removes Obex buffer object. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::RemoveObexBuffer(CObexBufObject* &aBufObject) + { + if (aBufObject) + { + delete aBufObject; + aBufObject = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CreateMsvSessionLC Creates MSV session +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::CreateMsvSessionLC( + CDummySessionObserver* &aSessionObs, + CMsvSession* &aMsvSession) + { + aSessionObs = new( ELeave )CDummySessionObserver; + CleanupStack::PushL( aSessionObs ); //1st push + aMsvSession = CMsvSession::OpenSyncL( *aSessionObs ); + CleanupStack::PushL( aMsvSession ); //2nd push + } + +// ----------------------------------------------------------------------------- +// CreateMsvSessionLC Creates MSV session to selected destination +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::CreateMsvSessionLC( + CDummySessionObserver* &aSessionObs, + CMsvSession* &aMsvSession, + CMsvEntry* &aDestination, + TMsvId aMsvId) + { + CreateMsvSessionLC(aSessionObs, aMsvSession); + aDestination = aMsvSession->GetEntryL( aMsvId ); + CleanupStack::PushL( aDestination ); //3rd push + } + +// ----------------------------------------------------------------------------- +// GetCenRepKeyIntValueL Gets integer repository value +// Returns: Error +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetCenRepKeyIntValueL( + TUid aRepositoryUid, // aRepositoryUid Central repository's UID value + TUint32 aId, // Central repository's ID value + TInt& aVal) // Returned integer value + { + CRepository* storage = CRepository::NewLC( aRepositoryUid ); + TInt retval = storage->Get( aId, aVal ); + if (retval != KErrNone) + { + FLOG(_L("[OBEXUTILS]\t GetCenRepKeyIntValueL() Get failed")); + } + CleanupStack::PopAndDestroy( storage ); + return retval; + } + +// ----------------------------------------------------------------------------- +// GetCurrentTime Gets current time +// Returns: Current time +// ----------------------------------------------------------------------------- +// +TTime TObexUtilsMessageHandler::GetCurrentTime() + { + TTime time; + time.UniversalTime(); + return time; + } + +// ----------------------------------------------------------------------------- +// StoreAsRichTextL Change message content to Richtext +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::StoreAsRichTextL( + CMsvEntry* aParentEntry, // A pointer to new message server entry. + RFile& aFile) // New file to store + { + FLOG(_L("[OBEXUTILS]\t StoreAsRichTextL()")); + + TInt fileLength = 0; + User::LeaveIfError( aFile.Size( fileLength ) ); + + // Calculate the number of blocks to read + const TInt blockSize = 128 * 1024; + TInt fullBlockCnt = fileLength / blockSize; + if (fileLength % blockSize > 0) + { + fullBlockCnt++; + } + + CRichText* richText = ConstructRichTextLC(); // 1st, 2nd, 3rd push + + RBuf8 buffer8; + CleanupClosePushL(buffer8); // 4th push + buffer8.CreateL( blockSize ); + RBuf buffer16; + CleanupClosePushL(buffer16); // 5th push + buffer16.CreateL(blockSize); + + // Read the file into buffer in small chunks + TInt readBytes = 0; + for (TInt i = 0; i < fullBlockCnt; ++i) + { + User::LeaveIfError( aFile.Read( buffer8 ) ); + + // In order for Bio to understand 8-bit binary data, + // it needs to be stored in wide rich text object + // in the low byte of each word with the upper byte as 0. + // Do not use UTF8, just convert 8-bit to 16-bit. + buffer16.Copy( buffer8 ); + + richText->InsertL(readBytes, buffer16); + readBytes += buffer8.Length(); + } + CleanupStack::PopAndDestroy(2, &buffer8); + // -2 pop: free unused memory before StoreBodyTextL() + + CMsvStore* parentStore = aParentEntry->EditStoreL(); + CleanupStack::PushL(parentStore); // 4th push + parentStore->StoreBodyTextL(*richText); + parentStore->CommitL(); + + CleanupStack::PopAndDestroy(4); // parentStore, richText, richParaFormatLayer, + // richCharFormatLayer + + FLOG(_L("[OBEXUTILS]\t StoreAsRichTextL() completed")); + } + +// ----------------------------------------------------------------------------- +// UpdateAttachmentInformationL Add the obex object as a file attachment. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::UpdateAttachmentInformationL( + TReceivedData& aRecData, // The obex received data + CMsvEntry* aAttachEntry, // Attachment entry + CMsvAttachment* aAttachInfo, // Attachment information + CMsvStore* aStore) // Message store (attachment) + { + FLOG(_L("[OBEXUTILS]\t UpdateAttachmentInformationL()")); + + TMsvEntry attachTEntry = aAttachEntry->Entry(); + + SetDetailsLC(attachTEntry.iDescription, aAttachInfo->MimeType()); + attachTEntry.iSize = aRecData.bytesReceived; + attachTEntry.iDate = aRecData.recTime; + aAttachEntry->ChangeL(attachTEntry); // Save properties. + CleanupStack::PopAndDestroy(); // unicode in SetDetailsLC + + aAttachInfo->SetSize(aRecData.bytesReceived); + aAttachInfo->SetAttachmentNameL(aRecData.msgName); + aAttachInfo->SetComplete(ETrue); + + aStore->AttachmentManagerExtensionsL().ModifyAttachmentInfoL(aAttachInfo); + + FLOG(_L("[OBEXUTILS]\t UpdateAttachmentInformation() completed")); + } + +// ----------------------------------------------------------------------------- +// FinaliseMessageL Save the size of all the attachments and make visible. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::FinaliseMessageL( + CMsvEntry* aParentEntry, // Parent entry + TReceivedData& aRecData, // The obex received data + CMsvStore* aStore, // Attachment's store + TBool aIsBioMsg) // Is BIO message? + { + FLOG(_L("[OBEXUTILS]\t FinaliseMessageL()")); + // Save the size of all the attachment & make visible. + TMsvEntry parentTEntry = aParentEntry->Entry(); + parentTEntry.iDate = GetCurrentTime(); + parentTEntry.iSize = aRecData.bytesReceived; + parentTEntry.SetUnread(ETrue); + + // Saved OK. Make the entry visible and flag it as complete. + parentTEntry.SetVisible(ETrue); // visible + parentTEntry.SetInPreparation(EFalse); // complete + if (!aIsBioMsg) + { + parentTEntry.iDescription.Set(aRecData.msgName); // "Subject" + } + aParentEntry->ChangeL(parentTEntry); // commit changes + + aStore->CommitL(); + + FLOG(_L("[OBEXUTILS]\t FinaliseMessageL() completed")); + } + +// ----------------------------------------------------------------------------- +// FinaliseMessageL Save the size of all the attachments and make visible. +// for Saving file received via BT/IR directly to file system. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::FinaliseMessageL( + CMsvEntry* aParentEntry, + CMsvStore* aStore, + TEntry& aFileEntry, + TParse& aFileNameParser) + { + FLOG(_L("[OBEXUTILS]\t FinaliseMessageL() new ")); + + // Save the size of all the attachment & make visible. + TMsvEntry parentTEntry = aParentEntry->Entry(); + parentTEntry.iDate = GetCurrentTime(); + parentTEntry.iSize = aFileEntry.iSize; + // Saved OK. Make the entry visible and flag it as complete. + parentTEntry.SetVisible(ETrue); // visible + parentTEntry.SetUnread(ETrue); + parentTEntry.SetInPreparation(EFalse); // complete + parentTEntry.iDescription.Set(aFileNameParser.FullName()); // "Subject" + aParentEntry->ChangeL(parentTEntry); // commit changes + aStore->CommitL(); + + FLOG(_L("[OBEXUTILS]\t FinaliseMessageL() new completed ")); + } + +// ----------------------------------------------------------------------------- +// StoreAndUpdateBioMessageL Stores and updates a BIO message +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::StoreAndUpdateBioMessageL( + CBIODatabase* aBioDB, // Bio database + TUid aBioMsgId, // Bio message ID + CMsvEntry* parentEntry, // Parent message entry + RFile& aFile) // File to attachment + { + FLOG(_L("[OBEXUTILS]\t StoreAndUpdateBioMessageL()")); + + TInt index; + aBioDB->GetBioIndexWithMsgIDL(aBioMsgId, index); + + StoreAsRichTextL( parentEntry, aFile ); + + TMsvEntry parentTEntry = parentEntry->Entry(); + parentTEntry.iMtm = KUidBIOMessageTypeMtm; + parentTEntry.iServiceId = KMsvLocalServiceIndexEntryId; + parentTEntry.iBioType = aBioMsgId.iUid; + parentTEntry.iDescription.Set(aBioDB->BifReader(index).Description()); + parentEntry->ChangeL(parentTEntry); + + FLOG(_L("[OBEXUTILS]\t StoreAndUpdateBioMessageL() completed")); + } + +// ----------------------------------------------------------------------------- +// RecogniseObjectsL Recognised objects if no type field has been given. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::RecogniseObjectsL( + TFileName& aFileName, + CMsvAttachment* aAttachInfo) // Attachment information + { + FLOG(_L("[OBEXUTILS]\t RecogniseObjectsL()")); + + TPtrC8 mimeType; + RApaLsSession lsSess; + User::LeaveIfError( lsSess.Connect() ); + CleanupClosePushL(lsSess); + TDataType appDataType; + TUid appUid; + if (lsSess.AppForDocument(aFileName, appUid, appDataType) == KErrNone) + { + mimeType.Set(appDataType.Des8()); + } + else + { + // Don't trust on sender's MIME type here. Just set to empty. + mimeType.Set(KNullDesC8); + FLOG(_L("[OBEXUTILS]\t RecogniseObjectsL() MIME check failed")); + } + CleanupStack::PopAndDestroy(); // lsSess + HBufC* buf16 = HBufC::NewLC(mimeType.Length()); + buf16->Des().Copy(mimeType); + TPtrC mimeType16(buf16->Des()); + CleanupStack::PopAndDestroy(); // buf16 + + CUpdateMusicCollection* updateMusicCollection = CUpdateMusicCollection::NewL() ; + if (updateMusicCollection->isSupported(mimeType16)) + { + updateMusicCollection->addToCollectionL(aFileName); + } + + aAttachInfo->SetMimeTypeL( mimeType ); + + FLOG(_L("[OBEXUTILS]\t RecogniseObjectsL() completed")); + } + +// ----------------------------------------------------------------------------- +// SaveMimeAndGetBioLC Saves MIME type and gets BIO database for that MIME +// Returns: BIO database if BIO message +// ----------------------------------------------------------------------------- +// +CBIODatabase* TObexUtilsMessageHandler::SaveMimeAndGetBioLC( + TFileName& aFileName, + RFs& aFsSess, // File session + CMsvAttachment* aAttachInfo, // Attachment information + TUid &aBioMsgId) // BIO message ID for data + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveMimeAndGetBioLC()")); + + RecogniseObjectsL( aFileName, aAttachInfo ); + + // For attachments / BIO check. + CBIODatabase* bioDB = CBIODatabase::NewLC( aFsSess ); // 1st push + + // Run through the data objects, seeing if they can be accepted by BIO. + // Check if they are bio objects + + TBioMsgIdText bioMessageIdText; + SetBioDataTextL( bioMessageIdText, aAttachInfo->MimeType() ); + + // Remove any zero termination on mime type + // + TInt zeroTermination = bioMessageIdText.Locate( TChar(0) ); + + if ( zeroTermination != KErrNotFound ) + { + bioMessageIdText.SetLength( zeroTermination ); + } + + TInt bioMsgErr = bioDB->IsBioMessageL( EBioMsgIdIana, bioMessageIdText, NULL, aBioMsgId ); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveMimeAndGetBioLC() completed")); + if (bioMsgErr != KErrNone) + { + return NULL; + } + return bioDB; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CreateInboxAttachmentL Creates inbox entry and attachment for it +// If this leaves, it means the entry and obex object have already been deleted. +// In this case aMsvIdParent has been set to zero. +// Returns: None. +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::CreateInboxAttachmentL( + CObexBufObject* &aBufObject, // Obex object + const TUid aMtmId, // Mtm ID of the message + TMsvId &aMsvIdParent, // Message ID of the parent message entry + RFile &aFile) // File to the attachment + { + TMsvId msvId = 0; + TRAPD(retTrap, DoCreateInboxAttachmentL(aMtmId, msvId, aFile,KNullDesC)) + if (retTrap != KErrNone) + { + aMsvIdParent = 0; + if (msvId) + { + RemoveInboxEntriesL(aBufObject, msvId); + } + User::Leave(retTrap); + } + aMsvIdParent = msvId; + } + +// ----------------------------------------------------------------------------- +// CreateInboxAttachmentL Creates inbox entry and attachment for it +// If this leaves, it means the entry and obex object have already been deleted. +// In this case aMsvIdParent has been set to zero. +// Returns: None. +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::CreateInboxAttachmentL( + CObexBufObject* &aBufObject, // Obex object + const TUid aMtmId, // Mtm ID of the message + TMsvId &aMsvIdParent, // Message ID of the parent message entry + RFile &aFile, // File to the attachment + const TDesC& aRemoteBluetoothName) // bluetooth name of remote device + { + TMsvId msvId = 0; + TRAPD(retTrap, DoCreateInboxAttachmentL(aMtmId, msvId, aFile,aRemoteBluetoothName)) + if (retTrap != KErrNone) + { + aMsvIdParent = 0; + if (msvId) + { + RemoveInboxEntriesL(aBufObject, msvId); + } + User::Leave(retTrap); + } + aMsvIdParent = msvId; + } + +// ----------------------------------------------------------------------------- +// DoCreateInboxAttachmentL Creates inbox entry and attachment for it (private) +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::DoCreateInboxAttachmentL( + const TUid aMtmId, // Mtm ID of the message + TMsvId &aMsvIdParent, // Message ID of the parent message entry + RFile &aFile, // File to the attachment + const TDesC& aRemoteBluetoothName) // bluetooth name of remote device + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateInboxAttachmentL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* inbox; + CreateMsvSessionLC(sessionObs, msvSession, inbox, KMsvGlobalInBoxIndexEntryId); + // 1st, 2nd, 3rd push + + TBuf toFrom; + TInt resourceId; + + if (aMtmId == KUidMsgTypeBt) + { + resourceId = R_BT_TO_FROM_IN_INBOX; + } + else + { + resourceId = R_IR_TO_FROM_IN_INBOX; + } + + TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); + + TMsvEntry parentTEntry; + parentTEntry.iMtm = aMtmId; + parentTEntry.SetVisible(EFalse); // Make invisible.. + parentTEntry.SetUnread(ETrue); + + // ...and in preparation to make sure it gets cleaned up on errors. + // + parentTEntry.SetInPreparation(ETrue); + parentTEntry.iType = KUidMsvMessageEntry; + parentTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + // iDate & iSize will be set later + if ( aRemoteBluetoothName.Length() > 0 ) + { + parentTEntry.iDetails.Set(aRemoteBluetoothName); + } + else + { + parentTEntry.iDetails.Set(toFrom); + } + inbox->CreateL(parentTEntry); + + aMsvIdParent = parentTEntry.Id(); + + // Create attachment for the inbox entry + + TMsvEntry attachTEntry; + attachTEntry.iType = KUidMsvAttachmentEntry; + attachTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + attachTEntry.iMtm = aMtmId; + + CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); + CleanupStack::PushL(parentEntry); // 4th push + parentEntry->CreateL(attachTEntry); // create attachment as child of parent + + // create the v2 attachment, save RFile + + CMsvEntry* attachEntry = msvSession->GetEntryL(attachTEntry.Id()); + CleanupStack::PushL(attachEntry); // 5th push + + CMsvStore* store = attachEntry->EditStoreL(); + CleanupStack::PushL(store); // 6th push + CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); + CleanupStack::PushL(attachment); // 7th push + + store->AttachmentManagerExtensionsL().CreateAttachmentL(_L("Unnamed"), aFile, attachment); + CleanupStack::Pop(attachment); + store->CommitL(); + // CommitL() required here otherwise EditStoreL() will fail in SaveObjToInbox() + + CleanupStack::PopAndDestroy(6); + // store, attachEntry, parentEntry, inbox, msvSession, sessionObs + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateInboxAttachmentL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::RemoveInboxEntriesL +// ----------------------------------------------------------------------------- +EXPORT_C void TObexUtilsMessageHandler::RemoveInboxEntriesL( + CObexBufObject* &aBufObject, // Obex object + TMsvId aMsvIdParent) // Message ID of the parent message entry + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveInboxEntriesL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* inbox; + CreateMsvSessionLC(sessionObs, msvSession, inbox, KMsvGlobalInBoxIndexEntryId); + // 1st, 2nd, 3rd push + + // Close file + + RemoveObexBuffer(aBufObject); + + // Delete parent and descendants + if ( aMsvIdParent ) + { + inbox->DeleteL(aMsvIdParent); + } + + CleanupStack::PopAndDestroy(3); + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveInboxEntriesL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::SaveObjToInboxL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::SaveObjToInboxL( + CObexBufObject* /*aReceivedObject*/, const TDesC16& /*aPath*/, const TUid /*aMtmID*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::SaveObjToInboxL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::SaveObjToInboxL( + CObexBufObject* &aReceivedObject, // Obex object + RFile &aFile, + TMsvId aMsvIdParent) // Message ID of the parent message entry + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL()")); + + // Open session. + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CreateMsvSessionLC(sessionObs, msvSession); // 1st, 2nd push + + CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); + CleanupStack::PushL( parentEntry ); // 3rd push + +#ifdef __BT_SAP + if(CSapVMessageParser::HandleMessageL(aReceivedObject, parentEntry->Entry().iMtm, + aFile, msvSession, GetCurrentTime())) + { + RemoveObexBuffer(aReceivedObject); + CMsvEntry* inbox = msvSession->GetEntryL( KMsvGlobalInBoxIndexEntryId ); + CleanupStack::PushL( inbox ); //4th push + inbox->DeleteL(aMsvIdParent); + // Close session etc. + CleanupStack::PopAndDestroy(4, sessionObs); // inbox, parentEntry, session, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() completed")); + return; + } +#endif // __BT_SAP + CMsvEntry* attachEntry = msvSession->GetEntryL(((*parentEntry)[0]).Id()); + CleanupStack::PushL(attachEntry); // 4th push + + CMsvStore* store = attachEntry->EditStoreL(); + CleanupStack::PushL( store ); // 5th push + + // Collect obex received data before obex buffer deletion + + TReceivedData receivedData; + receivedData.bytesReceived = aReceivedObject->BytesReceived(); + receivedData.recTime = aReceivedObject->Time(); + + RFs& fsSess = msvSession->FileSession(); + receivedData.msgName = aReceivedObject->Name(); + MakeValidFileName(fsSess, receivedData.msgName); + + // Rename attachment for MIME type checking + + RemoveObexBuffer(aReceivedObject); + store->AttachmentManagerExtensionsL().RenameAttachmentL(0, receivedData.msgName); + RFile newFile = store->AttachmentManagerL().GetAttachmentFileL(0); + CleanupClosePushL(newFile); // 6th push + + // RenameAttachmentL() modified attachment info, so read it now + + CMsvAttachment* attachInfo = store->AttachmentManagerL().GetAttachmentInfoL(0); + CleanupStack::PushL( attachInfo ); // 7th push + + TUid bioMsgId; // SaveMimeAndGetBioLC modifies this + TFileName fileName; + newFile.FullName(fileName); + CBIODatabase* bioDB = SaveMimeAndGetBioLC( fileName, fsSess, attachInfo, bioMsgId ); + // 8th push + if (bioDB) // bio message + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() BIO")); + StoreAndUpdateBioMessageL( bioDB, bioMsgId, parentEntry, newFile ); + FinaliseMessageL(parentEntry, receivedData, store, ETrue); + TMsvId attachId = attachEntry->EntryId(); + CleanupStack::PopAndDestroy(5); // bioDB, attachInfo, newFile (close), + // store, attachEntry + // PopAndDestroying here because open store locks the entry, + // it can be deleted only after destroying the store pointer + parentEntry->DeleteL(attachId); // invalidate unused attachment + CleanupStack::PopAndDestroy(3); // parentEntry, msvSession, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() BIO completed")); + } + else // attachment message + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() Attachment")); + CleanupStack::PopAndDestroy(); // bioDB + UpdateAttachmentInformationL(receivedData, attachEntry, attachInfo, store); + CleanupStack::Pop(attachInfo); // ownership taken by ModifyAttachmentInfoL() + FinaliseMessageL(parentEntry, receivedData, store, EFalse); + CleanupStack::PopAndDestroy(6); // newFile (close), store, attachEntry, + // parentEntry, msvSession, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() Attachment completed")); + } + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveObjToInboxL() completed")); + } + + +// ----------------------------------------------------------------------------- +// GetCenRepKeyStringValueL Gets integer repository value +// Returns: Error +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetCenRepKeyStringValueL( + TUid aRepositoryUid, // aRepositoryUid Central repository's UID value + TUint32 aId, // Central repository's ID value + TDes& aVal) // Returned String + { + CRepository* storage = CRepository::NewLC( aRepositoryUid ); + TInt retval = storage->Get( aId, aVal ); + if (retval != KErrNone) + { + FLOG(_L("[OBEXUTILS]\t GetCenRepKeyStringValueL() Get failed")); + } + CleanupStack::PopAndDestroy( storage ); + return retval; + } + +// ----------------------------------------------------------------------------- +// CreateReceiveBufferL Creates an Obex receive buffer object and RFile object. +// Returns: Symbian error code +// ----------------------------------------------------------------------------- +// + +EXPORT_C TInt TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL( + RFile& aFile, + const TDesC& aPath, + TFileName& aFullName, + CBufFlat* &aReceiveObject, + const TInt aBufSize ) + { + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL()")); + + aReceiveObject = CBufFlat::NewL(aBufSize); + aReceiveObject->ResizeL(aBufSize); + + + RFs rfs; + User::LeaveIfError( rfs.Connect() ); + if ( !BaflUtils::FolderExists( rfs, aPath ) ) + { + User::LeaveIfError(rfs.MkDirAll(aPath)); + } + User::LeaveIfError( aFile.Temp( rfs, aPath, aFullName, EFileWrite) ); + // Set temp file hidden file. + // + TUint setAttMask(0); + TUint clearAttMask(0); + aFile.SetAtt(setAttMask | KEntryAttHidden, clearAttMask); + aFile.Flush(); + aFile.Close(); + + RFile logFile; + TFileName logFilePath; + TFileName cenRepFolder; + GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder,cenRepFolder); + + logFilePath.Zero(); + logFilePath.Append(PathInfo::PhoneMemoryRootPath()); + logFilePath.Append(cenRepFolder); + + if ( !BaflUtils::FolderExists(rfs , logFilePath) ) + { + User::LeaveIfError(rfs.MkDirAll(logFilePath)); + } + logFilePath.Append(_L("log.txt")); + if ( !BaflUtils::FileExists( rfs, logFilePath )) + { + logFile.Create(rfs, logFilePath, EFileWrite); + } + else + { + User::LeaveIfError(logFile.Open(rfs, logFilePath, EFileWrite)); + } + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL() log.txt is created")); + TFileText ft; + ft.Set(logFile); + ft.Write(aFullName); // restore tempfilename in logfile + + // Set log file + logFile.SetAtt(setAttMask | KEntryAttHidden, clearAttMask); + logFile.Flush(); + logFile.Close(); + rfs.Close(); + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL() completed")); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::RemoveTemporaryRFileL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::RemoveTemporaryRFileL ( const TFileName& aFullName ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveTemporaryRFileL()")); + RFs rfs; + User::LeaveIfError(rfs.Connect()); + + TParse fileNameParser; + User::LeaveIfError(fileNameParser.Set(aFullName, NULL, NULL)); + + TFileName logFilePath; + TFileName cenRepFolder; + GetCenRepKeyStringValueL(KCRUidBluetoothEngine, KLCReceiveFolder,cenRepFolder); + logFilePath.Zero(); + logFilePath.Append(PathInfo::PhoneMemoryRootPath()); + logFilePath.Append(cenRepFolder); + logFilePath.Append(_L("log.txt")); + + if ( fileNameParser.Ext().Compare(_L(".$$$")) == 0 ) + { + // aFullName is a temp file name, we need to remove it. + rfs.Delete( aFullName ); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveTemporaryRFileL() temp file is removed (bt off)")); + } + else if ( (aFullName.Length() == 0) && BaflUtils::FileExists(rfs, logFilePath)) + { + RFile logFile; + User::LeaveIfError(logFile.Open(rfs, logFilePath, EFileRead)); + TFileText ft; + ft.Set(logFile); + TFileName tempFileName; + ft.Read(tempFileName); // read tempfile name stored in logfile. + + if ( tempFileName.Length() > 0 ) + { + rfs.Delete(tempFileName); + } + logFile.Close(); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveTemporaryRFileL() temp files are removed (reboot)")); + } + rfs.Delete( logFilePath ); + rfs.Close(); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::RemoveTemporaryRFileL() completed")); + } +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::SaveFileToFileSystemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::SaveFileToFileSystemL( + CObexBufObject* &aReceivedObject, + const TUid aMtmId, + TMsvId& aMsvIdParent, + TFileName& aFullName, + RFile& aFile, + const TDesC& aSenderBluetoothName) + { + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveFileToFileSystemL()")); + // Create inbox entry ( this was done in CreateAttachment() before ) + // + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* inbox; + CreateMsvSessionLC(sessionObs, msvSession, inbox, KMsvGlobalInBoxIndexEntryId); + // 1st, 2nd, 3rd push + + TBuf toFrom; + TInt resourceId; + + if (aMtmId == KUidMsgTypeBt) + { + resourceId = R_BT_TO_FROM_IN_INBOX; + } + else + { + resourceId = R_IR_TO_FROM_IN_INBOX; + } + // NOTE: toFrom will be updated to Bluetooth sender's name + // + TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); // read the toForm ( will be updated to sender's bt name in the future ) + + TMsvEntry parentTEntry; + parentTEntry.iMtm = aMtmId; + parentTEntry.SetVisible(EFalse); // Make invisible.. + parentTEntry.SetUnread(ETrue); // Set msg to Unread + + // ...and in preparation to make sure it gets cleaned up on errors. + // + parentTEntry.SetInPreparation(ETrue); + parentTEntry.iType = KUidMsvMessageEntry; + parentTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + // iDate & iSize will be set later + if ( aSenderBluetoothName.Length() > 0 ) + { + parentTEntry.iDetails.Set(aSenderBluetoothName); + } + else + { + parentTEntry.iDetails.Set(toFrom); + } + inbox->CreateL(parentTEntry); + + aMsvIdParent = parentTEntry.Id(); + + // Create attachment for the inbox entry + + TMsvEntry attachTEntry; + attachTEntry.iType = KUidMsvAttachmentEntry; + attachTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + attachTEntry.iMtm = aMtmId; + + CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); + CleanupStack::PushL(parentEntry); // 4th push + parentEntry->CreateL(attachTEntry); // create attachment as child of parent + + // Check if message is sap message + // If we delete parent entry in sap, we have to delete the RFile object ourself as well ) + // + RFs& fsSess = msvSession->FileSession(); + TFileName tempFullName; + aFile.FullName(tempFullName); + +#ifdef __BT_SAP + if(CSapVMessageParser::HandleMessageL(aReceivedObject, parentEntry->Entry().iMtm, + aFile, msvSession, GetCurrentTime())) + { + RemoveObexBuffer(aReceivedObject); + CMsvEntry* inbox = msvSession->GetEntryL( KMsvGlobalInBoxIndexEntryId ); + CleanupStack::PushL( inbox ); //5th push + inbox->DeleteL(aMsvIdParent); + fsSess.Delete(tempFullName); // we have to use fullname to delete the file object in file system + // Close session etc. + CleanupStack::PopAndDestroy(5, sessionObs); // inbox, parentEntry, session, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveFileToFileSystemL() completed")); + return; + } +#endif // __BT_SAP + + // Collect obex received data before obex buffer deletion + TReceivedData receivedData; + receivedData.bytesReceived = aReceivedObject->BytesReceived(); + receivedData.recTime = aReceivedObject->Time(); + receivedData.msgName = aReceivedObject->Name(); + + TFileName filename; + TParse parse; + parse.Set(aFullName, NULL, NULL); + filename.Copy(receivedData.msgName); + FixExtremeLongFileName(filename, parse.DriveAndPath()); + MakeValidFileName( fsSess, filename); + RemoveObexBuffer(aReceivedObject); + + // We set file to visible before renaming + // so that photo/music app can scan the media files we recevie. + // + // Set file back to visible + // + TUint setAttMask(0); + TUint clearAttMask(0); + User::LeaveIfError(aFile.Open(fsSess,tempFullName,EFileWrite)); + User::LeaveIfError(aFile.SetAtt(setAttMask , clearAttMask | KEntryAttHidden)); + aFile.Close(); + + + // Move file to the actual drive and directory + // as well rename the file with the correct file name instead of temporary name + // tempFullName will be updated in RenameFileL() + TInt error = RenameFileL(tempFullName, filename, parse.DriveAndPath(), fsSess); + + if ( error != KErrNone ) + { + fsSess.Delete(tempFullName); // If rename fails, we remove the temp RFile object. + } + aFullName = tempFullName; // assign new full Name back to aFullName,which goes back to caller + + CleanupStack::PopAndDestroy(4); // parentEntry, inbox, msvSession, sessionObs + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::SaveFileToFileSystemL() completed")); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::AddEntryToInboxL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::AddEntryToInboxL( + TMsvId& aMsvIdParent, + TFileName& aFullName) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::AddEntryToInboxL() ")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CreateMsvSessionLC(sessionObs, msvSession); + // 1st, 2nd push + + CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); + CleanupStack::PushL(parentEntry); // 3th push + + CMsvEntry* attachEntry = msvSession->GetEntryL(((*parentEntry)[0]).Id()); + CleanupStack::PushL(attachEntry); // 4th push + + CMsvStore* store = attachEntry->EditStoreL(); + CleanupStack::PushL( store ); // 5th push + + CObexutilsEntryhandler* entryHandler = CObexutilsEntryhandler::NewL(); + CleanupStack::PushL(entryHandler); // 6th push + + CMsvAttachment* attachInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile); + CleanupStack::PushL(attachInfo); // 7th push + + // Create attachment Info + // + RFs& fsSess = msvSession->FileSession(); + + TParse fileNameParser; + User::LeaveIfError(fileNameParser.Set(aFullName, NULL, NULL)); + attachInfo->SetAttachmentNameL( fileNameParser.FullName()); + + TEntry fileEntry; + User::LeaveIfError(fsSess.Entry( fileNameParser.FullName(), fileEntry) ); + attachInfo->SetSize(fileEntry.iSize); + + // check if it's the bio message + + TUid bioMsgId; // SaveMimeAndGetBioLC modifies this + CBIODatabase* bioDB = SaveMimeAndGetBioLC( aFullName, fsSess, attachInfo, bioMsgId ); + // 8th push + if (bioDB) // bio message + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::AddEntryToInboxL() BIO")); + + RFile file; + User::LeaveIfError(file.Open(fsSess,aFullName,EFileRead)); + TReceivedData receivedData; + receivedData.bytesReceived = fileEntry.iSize; + receivedData.recTime = fileEntry.iModified; + receivedData.msgName = fileNameParser.Name(); + + StoreAndUpdateBioMessageL( bioDB, bioMsgId, parentEntry, file ); + FinaliseMessageL(parentEntry, receivedData, store, ETrue); + TMsvId attachId = attachEntry->EntryId(); + file.Close(); + fsSess.Delete(aFullName); + CleanupStack::PopAndDestroy(5); // bioDB, attachInfo, linkHandler, + // store, attachEntry + + // PopAndDestroying here because open store locks the entry, + // it can be deleted only after destroying the store pointer + parentEntry->DeleteL(attachId); // invalidate unused attachment + CleanupStack::PopAndDestroy(3); // parentEntry, msvSession, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::AddEntryToInboxL() BIO completed")); + } + else + { + + CleanupStack::PopAndDestroy(); // bioDB + // Add entry to Inbox + entryHandler->AddEntryAttachment(aFullName, attachInfo, store); + CleanupStack::Pop(attachInfo); // attachInfo, Pass ownership to store + CleanupStack::PopAndDestroy(entryHandler); // entryHandler + FinaliseMessageL(parentEntry, store,fileEntry, fileNameParser); + CleanupStack::PopAndDestroy(5); // linkHandler, attachInfo, store, attachEntry, + // parentEntry, msvSession, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::AddEntryToInboxL() completed ")); + } + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::AddEntryToInboxL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::AddEntryToInboxL( + TMsvId& aMsvIdParent, + TFileName& aFullName, + RArray* aMsvIdArray) + { + AddEntryToInboxL(aMsvIdParent, aFullName); + aMsvIdArray->Append(aMsvIdParent); + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::UpdateEntryAttachmentL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::UpdateEntryAttachmentL ( + TFileName& aFullName, + CMsvEntry* aParentEntry) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::UpdateEntryAttachmentL() ")); + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CreateMsvSessionLC(sessionObs, msvSession); + // 1st, 2nd push + + CMsvEntry* attachEntry = msvSession->GetEntryL(((*aParentEntry)[0]).Id()); + CleanupStack::PushL(attachEntry); // 3th push + + CMsvStore* store = attachEntry->EditStoreL(); + CleanupStack::PushL( store ); // 4th push + + CObexutilsEntryhandler* entryHandler = CObexutilsEntryhandler::NewL(); + CleanupStack::PushL(entryHandler); // 5th push + + // Note: + // Because setFilePath() in CMsvAttachment is not implementated by Symbian yet, + // we have to delete the original attachment and add another new one to fix the broken link. + // + + // remove the old attachment first. + // + store->AttachmentManagerExtensionsL().RemoveAttachmentL(0); + // Create a new attachment. + // + CMsvAttachment* attachInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile); + CleanupStack::PushL(attachInfo); // 6th push + + // Get mime type + // + RecogniseObjectsL(aFullName, attachInfo); + RFs& fsSess = msvSession->FileSession(); + + TParse fileNameParser; + User::LeaveIfError(fileNameParser.Set(aFullName, NULL, NULL)); + attachInfo->SetAttachmentNameL(fileNameParser.NameAndExt()); + TEntry fileEntry; + User::LeaveIfError(fsSess.Entry( fileNameParser.FullName(), fileEntry) ); + attachInfo->SetSize(fileEntry.iSize); + + entryHandler->AddEntryAttachment(aFullName,attachInfo, store); + CleanupStack::Pop(attachInfo); // attachInfo, Pass ownership to store + CleanupStack::PopAndDestroy(entryHandler); // entryHandler + FinaliseMessageL(aParentEntry, store,fileEntry, fileNameParser); + CleanupStack::PopAndDestroy(4); // store, + // attachEntry, msvSession, sessionObs + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::UpdateEntryAttachmentL() completed ")); + } + + +// Common methods + +// ----------------------------------------------------------------------------- +// ConstructRichTextLC Handles rich text initialisation. +// Returns: CRichText* A pointer to the rich text. +// ----------------------------------------------------------------------------- +// +CRichText* TObexUtilsMessageHandler::ConstructRichTextLC() + { + FLOG(_L("[OBEXUTILS]\t ConstructRichTextLC()")); + + CParaFormatLayer* richParaFormatLayer = CParaFormatLayer::NewL(); + CleanupStack::PushL( richParaFormatLayer ); + + CCharFormatLayer* richCharFormatLayer = CCharFormatLayer::NewL(); + CleanupStack::PushL( richCharFormatLayer ); + CRichText* richText = CRichText::NewL( richParaFormatLayer, + richCharFormatLayer ); + CleanupStack::PushL(richText); + + FLOG(_L("[OBEXUTILS]\t ConstructRichTextLC() completed")); + + return richText; + } + +// ----------------------------------------------------------------------------- +// MakeValidFileName Rename the given filename to a valid filename. +// Removes invalid characters from a filename; if no characters left, filename +// is set to R_NAME_FOR_INVALID_FILE +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::MakeValidFileName( + RFs& aFileSession, // A reference to file server session. + TDes& aFileName ) // The filename to modify. + { + FLOG(_L("[OBEXUTILS]\t MakeValidFileName()")); + + TParse fileParse; + fileParse.Set(aFileName, NULL, NULL); + + TBool nameempty = ETrue; + if (fileParse.NameOrExtPresent()) + { + aFileName = fileParse.NameAndExt(); + nameempty=EFalse; + TText badChar; + TInt nameLength = aFileName.Length(); + + while ( !aFileSession.IsValidName(aFileName, badChar) ) + { + // Locate and delete all instances of the bad char + FOREVER + { + TInt index = aFileName.Locate(TChar(badChar)); + nameLength--; + if (index == KErrNotFound) + { + break; + } + aFileName.Delete(index,1); + } + if ( nameLength <= 0 ) + { + break; + } + } + } + + // Did we delete all the characters? If so then we must have some filename + if ( aFileName.Length() == 0 || nameempty ) + { + TInt resourceId = R_NAME_FOR_INVALID_FILE; + TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aFileName, resourceId ) ); + if (retVal != KErrNone) + { + FLOG(_L("TObexUtilsMessageHandler::MakeValidFileName failed.")); + } + } + + FLOG(_L("[OBEXUTILS]\t MakeValidFileName() completed")); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::CreateOutboxEntryL +// ----------------------------------------------------------------------------- +// +EXPORT_C TMsvId TObexUtilsMessageHandler::CreateOutboxEntryL( + const TUid& aMtm, // Message type id + const TInt& aResourceID ) // Resource id for the message entry text + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateOutboxEntryL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* outBoxEntry; + CreateMsvSessionLC(sessionObs, msvSession, outBoxEntry, KMsvGlobalOutBoxIndexEntryId); + // 1st, 2nd, 3rd push + + TBuf toFrom; + TObexUtilsUiLayer::ReadResourceL( toFrom, aResourceID ); + + // Message entry fields + TMsvEntry newTEntry; + newTEntry.SetVisible( ETrue ); // Make visible + newTEntry.SetInPreparation( ETrue ); // and in preparation to make sure gets cleaned up on errors. + newTEntry.iDetails.Set( toFrom ); // To/From field on Outbox + newTEntry.SetSendingState( KMsvSendStateSending ); + newTEntry.iType = KUidMsvMessageEntry; + newTEntry.iMtm = aMtm; // message type id + newTEntry.iServiceId = KMsvGlobalOutBoxIndexEntryId; + outBoxEntry->CreateL( newTEntry ); + + CleanupStack::PopAndDestroy(3); //outBoxEntry, msvSession, sessionObs + return newTEntry.Id(); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::DeleteOutboxEntryL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::DeleteOutboxEntryL( const TMsvId& aMessageServerIndex ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::DeleteOutboxEntryL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* outBoxEntry; + CreateMsvSessionLC(sessionObs, msvSession, outBoxEntry, KMsvGlobalOutBoxIndexEntryId); + // 1st, 2nd, 3rd push + + outBoxEntry->DeleteL( aMessageServerIndex ); + + CleanupStack::PopAndDestroy(3); //outBoxEntry, msvSession, sessionObs + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::GetFileSystemStatus +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetFileSystemStatus() + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetFileSystemStatus()")); + + /** + * Free space level of FFS file system (drive C:) + * The integer value may be: + * 0: Free space OK + * -1: Free space at or below warning level + * -2: Free space at or below critical level + */ + + TInt status = KErrNone; + TInt retVal = KErrNone; + + retVal = GetPubSubKeyIntValue(KPSUidUikon, KUikFFSFreeLevel, status); + if ( ( retVal == KErrNone ) && ( status == KFFSBelowCritical ) ) + { + retVal = KErrDiskFull; + } + + FTRACE(FPrint(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetFileSystemStatus completed with %d."), retVal)); + return retVal; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::GetMmcFileSystemStatus +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetMmcFileSystemStatus() + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetMmcFileSystemStatus()")); + + /** + * Free space level of FFS file system (MMC) + * The integer value may be: + * 0: Free space OK + * -1: Free space at or below warning level + * -2: Free space at or below critical level + */ + + TInt retVal = KErrNone; + TInt status = KErrNone; + + retVal = GetPubSubKeyIntValue(KPSUidUikon, KUikMmcFFSFreeLevel, status); + if ( ( retVal == KErrNone ) && ( status == KFFSBelowCritical ) ) + { + retVal = KErrDiskFull; + } + + FTRACE(FPrint(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetMmcFileSystemStatus completed with %d."), retVal)); + return retVal; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::GetMessageCentreDriveL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetMessageCentreDriveL() + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetMessageCentreDriveL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CreateMsvSessionLC(sessionObs, msvSession); // 1st, 2nd push + + TDriveUnit driveUnit = msvSession->CurrentDriveL(); + CleanupStack::PopAndDestroy(2); // msvSession, sessionObs + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::GetMessageCentreDriveL() Completed")); + return driveUnit; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsMessageHandler::CreateDefaultMtmServiceL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsMessageHandler::CreateDefaultMtmServiceL(TUid aMtm) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateDefaultMtmServiceL()")); + + CDummySessionObserver* sessionObs; + CMsvSession* msvSession; + CMsvEntry* root; + CreateMsvSessionLC(sessionObs, msvSession, root, KMsvRootIndexEntryId); + // 1st, 2nd, 3rd push + + TMsvSelectionOrdering msvSelectionOrdering = root->SortType(); + msvSelectionOrdering.SetShowInvisibleEntries( ETrue ); + root->SetSortTypeL( msvSelectionOrdering ); + + CMsvEntrySelection* sel = root->ChildrenWithMtmL( aMtm ); + CleanupStack::PushL( sel ); // 4th push + if (sel->Count() == 0) + { + TMsvEntry serviceEntry; + serviceEntry.iMtm = aMtm; + serviceEntry.iType = KUidMsvServiceEntry; + serviceEntry.SetVisible(EFalse); + serviceEntry.SetReadOnly(ETrue); + serviceEntry.SetInPreparation(EFalse); + root->CreateL(serviceEntry); + } + CleanupStack::PopAndDestroy(4); // sel, root, msvSession, sessionObs + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::CreateDefaultMtmServiceL() Completed")); + } + +// ----------------------------------------------------------------------------- +// GetCenRepKeyIntValue Gets integer value for a specified CenRep key +// Returns: CenRep key's value +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsMessageHandler::GetPubSubKeyIntValue( + TUid aCategory, // Category of the key + TUint aKey, // PUBSUB key + TInt& value) // Returned value + { + TInt retVal; + RProperty property; + retVal = property.Attach(aCategory, aKey); + if ( retVal == KErrNone ) + { + retVal = property.Get(value); + if (retVal != KErrNone) + { + FLOG(_L("[OBEXUTILS]\t GetPubSubKeyIntValue() Get failed for CenRep key")); + } + } + else + { + FLOG(_L("[OBEXUTILS]\t GetPubSubKeyIntValue() Attach failed for CenRep key")); + } + property.Close(); + return retVal; + } + +// ----------------------------------------------------------------------------- +// SetBioDataTextL Converts message type to bio message id. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::SetBioDataTextL( + TBioMsgIdText& aText, // A bio message id text. + const TDesC8& aType ) // The type of the content. + { + FLOG(_L("[OBEXUTILS]\t SetBioDataTextL()")); + + HBufC16* unicode = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aType ); + CleanupStack::PushL( unicode ); + + if (unicode->Length() > KMaxBioIdText ) + { + User::Leave( KErrOverflow ); + } + + aText = unicode->Des(); + CleanupStack::PopAndDestroy( unicode ); + + FLOG(_L("[OBEXUTILS]\t SetBioDataTextL() completed")); + } + +// ----------------------------------------------------------------------------- +// SetDetailsLC Converts message type to unicode. +// Returns: None. +// ----------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::SetDetailsLC( + TPtrC& aDetails, // A message text. + const TDesC8& aType ) // The type of the content. + { + FLOG(_L("[OBEXUTILS]\t SetDetailsLC()")); + + HBufC16* unicode = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aType ); + CleanupStack::PushL( unicode ); + aDetails.Set(unicode->Des()); + + FLOG(_L("[OBEXUTILS]\t SetDetailsLC() completed")); + } + +//------------------------------------------------------------------------------- +// Rename a file and move file if needed +// Return: None. +//------------------------------------------------------------------------------- +// +TInt TObexUtilsMessageHandler::RenameFileL( + TFileName& aFileName, + TFileName& aNewFileName, + const TDesC& aNewPath, + RFs& aFileSession) + { + + // We move the file to the final location + // + CFileMan* fileMan= CFileMan::NewL(aFileSession); + CleanupStack::PushL(fileMan); + TPtrC tmpNewPath; + TParse fileParse; + fileParse.Set(aFileName, NULL, NULL); + + TInt error = fileMan->Move(aFileName,aNewPath,CFileMan::ERecurse ); + + // if error while moving to new location, keep file in old location and change file name + if (error != KErrNone) + { + tmpNewPath.Set (fileParse.DriveAndPath()); + } + else + { + tmpNewPath.Set (aNewPath); + } + + CleanupStack::PopAndDestroy(fileMan); + + TFileName tempFile; + tempFile.Append(tmpNewPath); + tempFile.Append(fileParse.NameAndExt()); + aFileName = tempFile; + + // check the duplicated file name. if so, we renamed in a different way. + TInt segmentNum = 0; + TBuf<64> segmentString; + + TFileName newFullName; + newFullName.Zero(); + newFullName.Append(tmpNewPath); + newFullName.Append(aNewFileName); + + aFileSession.SetSessionPath(tmpNewPath); + + while ( BaflUtils::FileExists(aFileSession, newFullName) ) + { + segmentNum++; + User::LeaveIfError( RenameFileWithSegmentNumL(aNewFileName, segmentNum, segmentString) ); + newFullName.Zero(); + newFullName.Append(tmpNewPath); + newFullName.Append(aNewFileName); + } + // rename the file. + // + error = aFileSession.Rename(aFileName, newFullName); + + aFileName = newFullName; + + return error; + } + +//------------------------------------------------------------------------------- +// Rename a file by adding a additional segment string +// Return: None. +//------------------------------------------------------------------------------- +// +TInt TObexUtilsMessageHandler::RenameFileWithSegmentNumL( + TDes &aFileName, // name for the file + TInt aSegmentNum, // segment number + TDes &aSegmentString) // segment String with parenthesis + { + + FLOG(_L("[OBEXUTILS]\t RenameFileWithSegmentNumL()")); + + const char KDot = '.'; + const char KLeftParenthesis = '('; + const char KRightParenthesis = ')'; + + // Convert Integer to String + // + TBuf<64> buf; + buf.Zero(); + _LIT(KNum, "%d" ); + buf.AppendFormat(KNum, aSegmentNum); + + // Rules to modify the duplicated filenames. + // case 1: No extention in filename, we append aSegmentString directly. + // case 2: Filename with extention, we insert aSegmentString right before dot (.) + // case 3: Filename with aSegmentString is still duplicated, + // we remove the old aSegmentString from aFileName and add a new one and add a new aSegmentString. + + TInt posOfDot = aFileName.LocateReverse(KDot); + + if ( aSegmentNum > 1 ) // filename with aSegementString is still duplicated + { + // In case the original file name contains the same string as our aSegmentString + // eg 1 with ext. original filename is file(1).txt, after renaming, it is changed to file(1)(1).txt. + // eg 2 without ext. original filename is file(1), after renaming, it is changed to file(1)(1). + TInt posDeleteStarts = posOfDot == KErrNotFound ? + aFileName.Length() - aSegmentString.Length() : + posOfDot - aSegmentString.Length(); + + aFileName.Delete(posDeleteStarts, aSegmentString.Length()); + } + + // Construct (New) aSegmentString + aSegmentString.Zero(); + aSegmentString.Append(KLeftParenthesis); + aSegmentString.Append(buf); + aSegmentString.Append(KRightParenthesis); + + // + // If the length of new filename will be larger than KMaxFileName, we remove few chars from the end of aFilename + // in order to add aSegmentString without panic. + // + if ( KMaxFileName < (aFileName.Length() + aSegmentString.Length())) + { + aFileName.Delete(KMaxFileName - aSegmentString.Length(), KMaxFileName - aFileName.Length()); + } + + posOfDot = aFileName.LocateReverse(KDot); + if ( posOfDot == KErrNotFound ) + { + // aFileName has no extension + // we append the modification to aFileName + // + aFileName.Append(aSegmentString); + } + else + { + // Dot (.) is found, we insert the modifications before dot. + // + aFileName.Insert(posOfDot,aSegmentString); + + } + + FLOG(_L("[OBEXUTILS]\t RenameFileWithSegmentNumL() completed")); + return KErrNone; + } + +//------------------------------------------------------------------------------- +// Shorten an extreme long file name +// Return: None. +//------------------------------------------------------------------------------- +// +void TObexUtilsMessageHandler::FixExtremeLongFileName(TFileName& aExtremeLongFileName, const TDesC& aDriveAndPath) + { + FLOG( _L( "[OBEXUTILS]\t FixExtremeLongFileName() ") ); + const char KDot = '.'; + TInt combinedLength = aExtremeLongFileName.Length() + aDriveAndPath.Length(); + + if ( combinedLength > aExtremeLongFileName.MaxLength() ) + { + FLOG( _L( "[OBEXUTILS]\t FixExtremeLongFileName: combinedLenght > aExtremeLongFileName.MaxLength()\t") ); + //KDefaultFileExtensionSeparator + TFileName tempFileName; + TInt dotPos = aExtremeLongFileName.LocateReverse( KDot ); + TInt overLap = combinedLength - aExtremeLongFileName.MaxLength() + KRenameOffSet; + + if ( dotPos > 0 ) + { + tempFileName.Copy( aExtremeLongFileName.Left( dotPos - overLap ) ); + tempFileName.Append( aExtremeLongFileName.Right( aExtremeLongFileName.Length() - dotPos ) ); + } + else + { + tempFileName.Copy( aExtremeLongFileName.Left(aExtremeLongFileName.Length() - overLap ) ); + } + aExtremeLongFileName.Copy( tempFileName ); + } + FLOG( _L( "[OBEXUTILS]\t FixExtremeLongFileName() completed") ); + } + +// End of File + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsopaquedata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsopaquedata.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "obexutilsopaquedata.h" + +// ================= MEMBER FUNCTIONS ======================= +EXPORT_C CObexUtilsOpaqueData::CObexUtilsOpaqueData(const TDesC8& aDes):iData(aDes) + { + } + + +// ----------------------------------------------------------------------------- +// GetString +// Get string from current location. Return error code if invalid string format. +// ----------------------------------------------------------------------------- +EXPORT_C TInt CObexUtilsOpaqueData::GetString(TBuf8 &aString) + { + // reset the output string + aString.Zero(); + + if (iData.Eos()) + return KErrNotFound ; + TChar c; + TInt ret; + while(c=iData.Get()) + { + if(c=='\\') + { + switch(iData.Peek()) + { + case 'x': + case 'X': + // parse hex number + TUint8 val; + iData.Inc(); + ret=iData.Val(val,EHex); + if(ret == KErrNone) + aString.Append(val); + else + return ret; + break; + case '|': + iData.Inc(); + aString.Append('|'); + break; + case '\\': + iData.Inc(); + aString.Append('\\'); + break; + default: + // if not a decimal number, then bad format + TInt8 dval; + ret=iData.Val(dval); + if(ret == KErrNone) + aString.Append(dval); + else + return ret; + } + } + else if(c=='|') + { + if(iData.Peek()=='|') + { + // delimiter "||" found, end of the string + iData.Inc(); + break; + } + else + aString.Append(c); + } + else + aString.Append(c); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// GetNumber +// Get number from current location. Return error code if invalid number format. +// ----------------------------------------------------------------------------- +EXPORT_C TInt CObexUtilsOpaqueData::GetNumber(TUint &aNumber) + { + if (iData.Eos()) + return KErrNotFound ; + + // skip dilimiter + if(iData.Peek()=='|') + { + iData.Inc(); + if(iData.Peek()=='|') + iData.Inc(); + else + return KErrNotFound ; + } + + if(iData.Peek()=='0') + { + iData.Inc(); + if(iData.Peek()=='x' || iData.Peek()=='X') + { + iData.Inc(); + return iData.Val(aNumber,EHex); + } + else + { + iData.UnGet(); + return iData.Val(aNumber,EOctal); + } + } + else + { + return iData.Val(aNumber); + } + } + +// ----------------------------------------------------------------------------- +// IsString +// Peek if next entry is string by looking for a '\'. +// ----------------------------------------------------------------------------- +EXPORT_C TBool CObexUtilsOpaqueData::IsString() + { + return iData.Peek()=='\\'; + } + diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilspropertynotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilspropertynotifier.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2004 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: Declares disk status watcher class for ObexUtils. +* +*/ + + +// INCLUDE FILES + +#include "obexutilspropertynotifier.h" +#include "obexutilsdebug.h" + +// ================= MEMBER FUNCTIONS ======================= + + +EXPORT_C CObexUtilsPropertyNotifier* CObexUtilsPropertyNotifier::NewL( + MObexUtilsPropertyNotifyHandler* aHandler, + TMemoryPropertyCheckType aCheckType ) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::NewL()")); + CObexUtilsPropertyNotifier* self=new(ELeave) CObexUtilsPropertyNotifier(aHandler, aCheckType); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::NewL() completed")); + return self; + } + +// --------------------------------------------------------- +// CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier( + MObexUtilsPropertyNotifyHandler* aHandler, + TMemoryPropertyCheckType aCheckType ) + : CActive( EPriorityNormal ), iHandler ( aHandler ), iCheckType ( aCheckType ) + { + CActiveScheduler::Add(this); + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier() completed")); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +// +CObexUtilsPropertyNotifier::~CObexUtilsPropertyNotifier() + { + Cancel(); + iProperty.Close(); + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::~CObexUtilsPropertyNotifier() completed")); + } + +// --------------------------------------------------------- +// CObexUtilsPropertyNotifier::ConstructL +// --------------------------------------------------------- +// +void CObexUtilsPropertyNotifier::ConstructL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL()")); + if (iCheckType == ECheckPhoneMemory) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() Phone")); + User::LeaveIfError(iProperty.Attach(KPSUidUikon,KUikFFSFreeLevel)); + } + else + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() MMC")); + User::LeaveIfError(iProperty.Attach(KPSUidUikon,KUikMmcFFSFreeLevel)); + } + Subscribe(); + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() completed")); + } + +// --------------------------------------------------------- +// CObexUtilsPropertyNotifier::Subscribe +// --------------------------------------------------------- +// +void CObexUtilsPropertyNotifier::Subscribe() + { + iProperty.Subscribe(iStatus); + SetActive(); + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::Subscribe() completed")); + } + +// --------------------------------------------------------- +// CObexUtilsPropertyNotifier::DoCancel +// --------------------------------------------------------- +// +void CObexUtilsPropertyNotifier::DoCancel() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::DoCancel()")); + iProperty.Cancel(); + } + +// --------------------------------------------------------- +// CObexUtilsPropertyNotifier::RunL +// --------------------------------------------------------- +// +void CObexUtilsPropertyNotifier::RunL() + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL()")); + + Subscribe(); + + TInt memorystatus; + if ((iProperty.Get(memorystatus)!=KErrNotFound) && (memorystatus!=0)) + { + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() notify")); + TRAPD(retTrap, iHandler->HandleNotifyL( iCheckType )); + retTrap = retTrap; + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() notify completed")); + } + FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() completed")); + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/obexutilsuilayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/obexutilsuilayer.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,628 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "obexutilsuilayer.h" +#include "obexutilslaunchwaiter.h" +#include "obexutilsdebug.h" + +#include +#include +#include +#include +#include +#include +#ifdef NO101APPDEPFIXES +#include +#else //NO101APPDEPFIXES +enum TMuiuConsts + { + EMbmMuiuQgn_prop_mce_ir_unread = 16402, + EMbmMuiuQgn_prop_mce_ir_unread_mask = 16403, + EMbmMuiuQgn_prop_mce_ir_read = 16404, + EMbmMuiuQgn_prop_mce_ir_read_mask = 16405, + EMbmMuiuQgn_prop_mce_bt_unread = 16406, + EMbmMuiuQgn_prop_mce_bt_unread_mask = 16407, + EMbmMuiuQgn_prop_mce_bt_read = 16408, + EMbmMuiuQgn_prop_mce_bt_read_mask = 16409 + }; +#endif //NO101APPDEPFIXES +#include +#include + +#include +#include + +// Launching file manager related header files +#include // The AIW service handler +#include +#include +#include // Used to launch file manager in embedded mode. +#include //for checking backup status + +//Constants +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 =============================== + + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::LaunchEditorApplicationOperationL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMsvOperation* TObexUtilsUiLayer::LaunchEditorApplicationOperationL( + CMsvSession& aMsvSession, + CMsvEntry* aMessage, + TRequestStatus& aObserverRequestStatus ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::LaunchEditorApplicationOperationL()")); + CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( + aMsvSession, + aMessage, + aObserverRequestStatus ); + + return waiterOperation; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::LaunchEditorApplication +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsUiLayer::LaunchEditorApplicationL( CMsvEntry* /*aMessage*/, + CMsvSession& /*aSession*/ ) + { + // Obsolete + return KErrNotSupported; + } + + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::LaunchFileManager +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::LaunchFileManagerL( + TDesC& aPath, + TInt aSortMethod, + TBool isEmbeddedMode ) + { + if ( isEmbeddedMode ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode")); + + CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); + inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aPath ) ) ); + inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aSortMethod ) ) ); + + CAknLaunchAppService* launchService = CAknLaunchAppService::NewL(TUid::Uid( KFileManagerUID3 ), // Use File Manager app UID directly + NULL, + inParams ); + CleanupStack::PopAndDestroy( inParams ); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() Embedded mode completed ")); + } + else + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() ")); + TApaAppInfo appInfo; + RApaLsSession apaLsSession; + User::LeaveIfError( apaLsSession.Connect() ); + CleanupClosePushL( apaLsSession ); + User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, TUid::Uid( KFileManagerUID3 ) ) ); // Use File Manager app UID directly + CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC(); + apaCmdLine->SetExecutableNameL( appInfo.iFullName ); + apaCmdLine->SetCommandL( EApaCommandOpen ); + apaCmdLine->SetDocumentNameL( aPath ); + TBuf8 sortMode; + sortMode.AppendNum( aSortMethod ); + apaCmdLine->SetTailEndL( sortMode ); + TThreadId dummy; + User::LeaveIfError( apaLsSession.StartApp( *apaCmdLine, dummy ) ); + CleanupStack::PopAndDestroy( apaCmdLine ); + CleanupStack::PopAndDestroy( &apaLsSession ); + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchFileManager() standalone mode completed ")); + } + } + +// ----------------------------------------------------------------------------- +// CObexUtilsMessageHandler::LaunchEditorApplication +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::LaunchEditorApplicationL (TMsvId& aMsvIdParent) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() ")); + CDummySessionObserver* sessionObs = new( ELeave )CDummySessionObserver; + CleanupStack::PushL( sessionObs ); //1st push + CMsvSession* msvSession = CMsvSession::OpenSyncL( *sessionObs ); + CleanupStack::PushL( msvSession ); //2nd push + + // 1st, 2nd push? + CMsvEntry* parentEntry = msvSession->GetEntryL(aMsvIdParent); + CleanupStack::PushL(parentEntry); // 3th push + + TRequestStatus status = KRequestPending; + CObexUtilsLaunchWaiter* waiterOperation = CObexUtilsLaunchWaiter::NewL( + *msvSession, + parentEntry, + status); + CleanupStack::PopAndDestroy(3); // parentEntry, sessionObs, msvSession + + FLOG(_L("[OBEXUTILS]\t TObexUtilsMessageHandler::LaunchEditorApplication() completed ")); + } + + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ShowErrorNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::ShowErrorNoteL( const TInt& aResourceID ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL()")); + + TBuf textdata; + ReadResourceL( textdata, aResourceID ); + + CAknErrorNote* note = new( ELeave )CAknErrorNote( ETrue ); + CleanupStack::PushL( note ); + PrepareDialogExecuteL( aResourceID, note ); + CleanupStack::Pop( note ); + note->ExecuteLD( textdata ); + + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowErrorNoteL() completed")); + + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ShowInformationNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::ShowInformationNoteL( const TInt& aResourceID ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL()")); + + TBuf textdata; + ReadResourceL( textdata, aResourceID ); + + CAknInformationNote* note = new( ELeave )CAknInformationNote; + CleanupStack::PushL( note ); + PrepareDialogExecuteL( aResourceID, note ); + CleanupStack::Pop( note ); + note->ExecuteLD( textdata ); + + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowInformationNoteL() completed")); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ShowGlobalInformationNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::ShowGlobalConfirmationQueryL( const TInt& aResourceID ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL()")); + + TBuf textdata; + TRequestStatus status; + + ReadResourceL( textdata, aResourceID ); + CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC(); + + status=KRequestPending; + note->ShowConfirmationQueryL(status, + textdata, + R_AVKON_SOFTKEYS_OK_EMPTY, + R_QGN_NOTE_ERROR_ANIM,KNullDesC, + 0, + 0, + CAknQueryDialog::EErrorTone + ); + User::WaitForRequest(status); + + CleanupStack::PopAndDestroy(note ); + + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ShowGlobalInformationNoteL() completed")); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalConfirmationQueryPlainL( const TInt& aResourceID) + { + CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); + CleanupStack::PushL(pQ); + HBufC* stringholder = NULL; + stringholder = StringLoader::LoadLC( aResourceID); + TRequestStatus status = KRequestPending; + pQ->ShowConfirmationQueryL(status,*stringholder,R_AVKON_SOFTKEYS_YES_NO); + User::WaitForRequest(status); + CleanupStack::PopAndDestroy(2);//PQ and Stringholder + return (status.Int() == EAknSoftkeyYes); + } + + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TObexUtilsUiLayer::ShowGlobalFileOpenConfirmationQueryL( const TInt& aResourceID, const TDesC& aFilePath) + { + // Read string from resource file + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + CStringResourceReader* stringResourceReader = CStringResourceReader::NewL(fileName); + CleanupStack::PushL(stringResourceReader); + const TDesC& resString = stringResourceReader->ReadResourceString(aResourceID); + RBuf manipString; + manipString.Assign(resString.AllocL()); + CleanupStack::PopAndDestroy(stringResourceReader); + manipString.CleanupClosePushL(); + + // Remove bracket section + _LIT(KPrefix, "["); + _LIT(KSuffix, "]"); + TInt prefixPos = manipString.Find(KPrefix); + if (prefixPos != KErrNotFound) + { + TInt keyLength = 0; + TInt suffixPos = manipString.Find(KSuffix); + keyLength = (manipString.Mid(prefixPos)).Length()-(manipString.Mid(suffixPos)).Length()+1; + manipString.Delete(prefixPos, keyLength); + } + + // Replace "%U" string parameter with file path + _LIT(KString, "%U"); + TInt replacePos = manipString.Find(KString); + if( replacePos == KErrNotFound ) + { + User::Leave(KErrNotFound); + } + const TInt minRequiredSize = manipString.Length() - KString().Length() + aFilePath.Length(); + // ensure that the buffer is big enough (otherwise re-alloc) + if(manipString.MaxLength() < minRequiredSize) + { + manipString.ReAllocL(minRequiredSize); + } + manipString.Replace(replacePos, KString().Length(), aFilePath); + + // Initiate query dialog + TRequestStatus status = KRequestPending; + + CAknGlobalConfirmationQuery* pQ = CAknGlobalConfirmationQuery::NewL(); + CleanupStack::PushL(pQ); + pQ->ShowConfirmationQueryL(status, manipString, R_AVKON_SOFTKEYS_YES_NO); + User::WaitForRequest(status); + CleanupStack::PopAndDestroy(2, &manipString); // pQ, manipString + return (status.Int() == EAknSoftkeyYes); + } + + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ReadResourceL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::ReadResourceL( TDes& aBuf, const TInt& aResourceID ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL()")); + + RFs fileSession; + CleanupClosePushL( fileSession ); + User::LeaveIfError( fileSession.Connect() ); + + TFileName fileName; + fileName += KObexUtilsFileDrive; + fileName += KDC_RESOURCE_FILES_DIR; + fileName += KObexUtilsResourceFileName; + + BaflUtils::NearestLanguageFile( fileSession, fileName ); + + RResourceFile resourcefile; + CleanupClosePushL( resourcefile ); + resourcefile.OpenL( fileSession, fileName ); + resourcefile.ConfirmSignatureL( 0 ); + HBufC8* readBuffer = resourcefile.AllocReadLC( aResourceID ); + + const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(),( readBuffer->Length() + 1 ) >> 1 ); + HBufC16* textBuffer=HBufC16::NewLC( ptrReadBuffer.Length() ); + *textBuffer = ptrReadBuffer; + aBuf.Copy( *textBuffer ); + + CleanupStack::PopAndDestroy( 4 ); // textBuffer, fileSession, resourcefile, readBuffer + + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ReadResourceL() completed")); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::OperationNotSupported +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsUiLayer::OperationNotSupported() + { + return R_EIK_TBUF_NOT_AVAILABLE; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ContextIcon +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TObexUtilsUiLayer::ContextIcon( const TMsvEntry& aContext, TContextMedia aMedia ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::ContextIcon()")); + + TInt icon = 0; + if( aMedia == EBluetooth ) + { + if( aContext.Unread() ) + { + icon = EMbmMuiuQgn_prop_mce_bt_unread - EMbmMuiuQgn_prop_mce_ir_unread; + } + else + { + icon = EMbmMuiuQgn_prop_mce_bt_read - EMbmMuiuQgn_prop_mce_ir_unread; + } + } + else if( aMedia == EInfrared ) + { + if( aContext.Unread() ) + { + icon = 0; + } + else + { + 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")); + + return icon; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::UpdateBitmaps +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::UpdateBitmaps( TUid aMedia, + TInt& aNumberOfZoomStates, TFileName& aBitmapFile, TInt& aStartBitmap, + TInt& aEndBitmap ) + { + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps()")); + + aBitmapFile = KCommonUiBitmapFile; + aNumberOfZoomStates = KUiNumberOfZoomStates; + if( aMedia == KUidMsgTypeBt ) + { + aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; + aEndBitmap = EMbmMuiuQgn_prop_mce_bt_read_mask; + } + else + { + aStartBitmap = EMbmMuiuQgn_prop_mce_ir_unread; + aEndBitmap = EMbmMuiuQgn_prop_mce_bt_unread_mask; + } + + FLOG(_L("[OBEXUTILS]\t TObexUtilsUiLayer::UpdateBitmaps() completed")); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::DeleteCBitMapArray +// ----------------------------------------------------------------------------- +// +inline void DeleteCBitMapArray(TAny* aPtr) + { + if (aPtr) + { + TObexUtilsUiLayer::CBitmapArray* array = + reinterpret_cast(aPtr); + array->ResetAndDestroy(); + delete array; + } + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::CreateAndAppendBitmapL +// ----------------------------------------------------------------------------- +// +void CreateAndAppendBitmapL(const TAknsItemID& aID, + const TInt aFileBitmapId, + CArrayPtr* aIconArrays ) + { + TFileName muiubmpFilename; + muiubmpFilename += KObexUtilsFileDrive; + muiubmpFilename += KDC_APP_BITMAP_DIR; + muiubmpFilename += KCommonUiBitmapFile; + + TObexUtilsUiLayer::CBitmapArray* array=NULL; + array=new(ELeave) CArrayPtrFlat(KUiNumberOfZoomStates); + CleanupStack::PushL(TCleanupItem(DeleteCBitMapArray, array)); + + CFbsBitmap* bitmap=0, *mask=0; + + //Can not use CreateIconLC since the order in which bitmap and mask are pushed into Cleanup Stack is undefined. + AknsUtils::CreateIconL( + AknsUtils::SkinInstance(), + aID, + bitmap, + mask, + muiubmpFilename, + aFileBitmapId, + aFileBitmapId+1); + CleanupStack::PushL(mask); + CleanupStack::PushL(bitmap); + + // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. + array->AppendL(bitmap); + CleanupStack::Pop(bitmap); + + // warning: bmp is deleted by the array CleanupItem. Immediately Pop or risk double deletion upon a Leave. + array->AppendL(mask); + CleanupStack::Pop(mask); + + aIconArrays->AppendL(array); + CleanupStack::Pop(array); + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::CreateIconsL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TObexUtilsUiLayer::CreateIconsL( + TUid aMedia, + CArrayPtr* aIconArrays ) + { + if( aMedia == KUidMsgTypeBt ) //Bluetooth + { + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceIrUnread, + EMbmMuiuQgn_prop_mce_ir_unread, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceIrRead, + EMbmMuiuQgn_prop_mce_ir_read, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceBtUnread, + EMbmMuiuQgn_prop_mce_bt_unread, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceBtRead, + EMbmMuiuQgn_prop_mce_bt_read, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceNfcRead, + 0, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceNfcUnread, + 0, + aIconArrays); + } + else //Infrared + { + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceIrUnread, + EMbmMuiuQgn_prop_mce_ir_unread, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceIrRead, + EMbmMuiuQgn_prop_mce_ir_read, + aIconArrays); + CreateAndAppendBitmapL( + KAknsIIDQgnPropMceBtUnread, + EMbmMuiuQgn_prop_mce_bt_unread, + aIconArrays); + } + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::IsBackupRunning +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TObexUtilsUiLayer::IsBackupRunning() + { + const TUint32 KFileManagerBkupStatus = 0x00000001; + + TInt status = EFileManagerBkupStatusUnset; + TBool retValue = EFalse; + TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus, + status ); + if ( err == KErrNone ) + { + if ( status == EFileManagerBkupStatusBackup || + status == EFileManagerBkupStatusRestore ) + { + TSecureId fileManagerSecureId( KFileManagerUID3 ); + //only returning ETrue if backup process is still active + retValue = ProcessExists( fileManagerSecureId ); + } + } + + return retValue; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::PrepareDialogExecuteL +// ----------------------------------------------------------------------------- +// +void TObexUtilsUiLayer::PrepareDialogExecuteL( const TInt& aResourceID, CEikDialog* aDialog ) + { + if (IsCoverDisplayL()) + { + TInt dialogIndex = + ((aResourceID & KResourceNumberMask) - KFirstResourceOffset) + KEnumStart; + aDialog->PublishDialogL( dialogIndex, KObexUtilsCategory ); + } + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::IsCoverDisplayL() +// ----------------------------------------------------------------------------- +// +TBool TObexUtilsUiLayer::IsCoverDisplayL() + { + TBool coverDisplay = EFalse; + FeatureManager::InitializeLibL(); + if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) + { + coverDisplay = ETrue; + } + FeatureManager::UnInitializeLib(); + return coverDisplay; + } + +// ----------------------------------------------------------------------------- +// TObexUtilsUiLayer::ProcessExists +// ----------------------------------------------------------------------------- +// +TBool TObexUtilsUiLayer::ProcessExists( const TSecureId& aSecureId ) + { + _LIT( KFindPattern, "*" ); + TFindProcess finder(KFindPattern); + TFullName processName; + while( finder.Next( processName ) == KErrNone ) + { + RProcess process; + if ( process.Open( processName ) == KErrNone ) + { + TSecureId processId( process.SecureId() ); + process.Close(); + if( processId == aSecureId ) + { + return ETrue; + } + } + } + return EFalse; + } +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/updatemusiccollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/updatemusiccollection.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,126 @@ +/* +* 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: update the music library after the musics are recieved using direct file saving +* +*/ + + + +//#include +#include + +#include "updatemusiccollection.h" +#include "obexutilsdebug.h" + +//#include +#include + +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::CUpdateMusicCollection +// Default constructor +// ----------------------------------------------------------------------------- +CUpdateMusicCollection::CUpdateMusicCollection() + { + } + +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::NewL +// ----------------------------------------------------------------------------- + +CUpdateMusicCollection* CUpdateMusicCollection::NewL() + { + CUpdateMusicCollection* self = new( ELeave ) CUpdateMusicCollection(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::ConstructL +// Symbian OS default constructor can leave. +// ----------------------------------------------------------------------------- + +void CUpdateMusicCollection::ConstructL() + { + iCollectionHelper = + CMPXCollectionHelperFactory::NewCollectionHelperL(); + iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeDefault, this ); + + } +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::addToCollectionL +// add the music to music library +// ----------------------------------------------------------------------------- + +void CUpdateMusicCollection::addToCollectionL(const TDesC& aFileName) + { + iCollectionHelper->AddL(aFileName,this); + } + +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::isSupported +// checks if the file is supported by music library +// ----------------------------------------------------------------------------- + TInt CUpdateMusicCollection::isSupported (const TDesC16& aPtr) + { + CDesCArray* SupportedMimeTypes = + iPlaybackUtility->SupportedMimeTypes(); + TInt pos = 0; + return SupportedMimeTypes->Find(aPtr,pos); + } + + // ----------------------------------------------------------------------------- + // CUpdateMusicCollection::HandleAddFileCompleteL + // callbackCalled back after a call to CCollectionHelper::AddL() to provide status + // ----------------------------------------------------------------------------- + void CUpdateMusicCollection::HandleAddFileCompleteL( TInt aErr ) + { + if(aErr == KErrNone) + { + FLOG(_L("[CUpdateMusicCollection]\t HandleAddFileCompleteL successful")); + } + else + { + FLOG(_L("[CUpdateMusicCollection]\t HandleAddFileCompleteL unsuccessful")); + } + + } + // ----------------------------------------------------------------------------- + // CUpdateMusicCollection::HandlePlaybackMessage + // ----------------------------------------------------------------------------- + +void CUpdateMusicCollection::HandlePlaybackMessage( CMPXMessage* aMessage,TInt aError ) + { + if ( aError == KErrNone && aMessage ) + { + FLOG(_L("[CUpdateMusicCollection]\t HandleAddFileCompleteL unsuccessful")); + } + } + +// ----------------------------------------------------------------------------- +// CUpdateMusicCollection::~CUpdateMusicCollection +// default destructor +// ----------------------------------------------------------------------------- + +CUpdateMusicCollection::~CUpdateMusicCollection() + { + if ( iCollectionHelper ) + { + iCollectionHelper->Close(); + } + if (iPlaybackUtility) + { + iPlaybackUtility->Close(); + } + } diff -r a0ea99b6fa53 -r 19bd632b5100 btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,628 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "vMessageHandler.h" +#include "obexutilsuilayer.h" +#include "obexutilsdebug.h" +#include "etelmm.h" +#include +#include // KUidMsgTypeSMS +#ifdef NO101APPDEPFIXES_NEW +#include +#endif //NO101APPDEPFIXES_NEW + +#include +#include +#include + +#include + +#ifdef NO101APPDEPFIXES_NEW +// SMUT Unbranch +#include +#endif //NO101APPDEPFIXES_NEW + +// ================= MEMBER FUNCTIONS ======================= +TBool CSapVMessageParser::HandleMessageL(CObexBufObject* aReceivedObject, const TUid aMtmID, + RFile& aFile, CMsvSession* aMsvSession, TTime aTime) +{ + FLOG( _L( " CSapVMessageParser: HandleMessageL\t" ) ); + + CSapVMessageParser* parser = CSapVMessageParser::NewLC(); + TBool isVmsg=parser->ParseMessageL(aReceivedObject, aMtmID, aFile, aTime); + if(isVmsg) + { + parser->SaveSapMessageL(aMsvSession); + } + CleanupStack::PopAndDestroy(parser); + + FLOG( _L( " CSapVMessageParser: HandleMessageL: Done\t" ) ); + + return isVmsg; +} + +CSapVMessageParser* CSapVMessageParser::NewLC() +{ + CSapVMessageParser* self = new (ELeave) CSapVMessageParser(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +void CSapVMessageParser::ConstructL() +{ +} + +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CSapVMessageParser::CSapVMessageParser() +{ +} + +// --------------------------------------------------------- +// ParseMessageL +// Recognises and parses SAP VMessage. +// --------------------------------------------------------- +// +TBool CSapVMessageParser::ParseMessageL(CObexBufObject* aReceivedObject, const TUid aMtmID, + RFile& aFile, TTime aTime) +{ + FLOG( _L( " CSapVMessageParser: ParseMessageL\t" ) ); + + static const TInt KExpandSize = 16; + + iType=ESapVMessageUnknown; + + if( aMtmID != KUidMsgTypeBt || + !CheckMime(aReceivedObject->Type()) || + !CheckName(aReceivedObject->Name()) || + !IsSapConnectionActive()) + { + FLOG( _L( " CSapVMessageParser: ParseMessageL: Unknown\t" ) ); + return EFalse; + } + + CBufFlat* buffer = CBufFlat::NewL( KExpandSize ); + CleanupStack::PushL(buffer); // 1st push + + TInt fileLength; + User::LeaveIfError( aFile.Size( fileLength ) ); + + // Read the file into buffer + buffer->ResizeL( fileLength ); + TPtr8 temp = buffer->Ptr(0); + TInt pos = 0; + aFile.Seek(ESeekStart, pos); + User::LeaveIfError( aFile.Read( temp ) ); + + pos=0; + aFile.Seek(ESeekStart, pos); // rewind file + + SimpleParseL(temp); + + CleanupStack::PopAndDestroy(buffer); // -1 pop + + iTimeReceived=aTime; + if(aReceivedObject->Time()==TTime(0)) + { + iTimeOriginal = aTime; + } + else + { + iTimeOriginal = aReceivedObject->Time(); + } + + return (iType!=ESapVMessageUnknown); +} + +// --------------------------------------------------------- +// IsSapConnectionActive +// Recognises active SAP connection. +// --------------------------------------------------------- +// +TBool CSapVMessageParser::IsSapConnectionActive() +{ + FLOG( _L( " CSapVMessageParser: IsSapConnectionActive\t" ) ); + + TInt state=EBTSapNotConnected; + RProperty::Get(KPSUidBluetoothSapConnectionState, KBTSapConnectionState, state); + return state==EBTSapConnected; +} + + +// --------------------------------------------------------- +// CheckMime +// Check MIME type of vMessage. +// --------------------------------------------------------- +// +TBool CSapVMessageParser::CheckMime(const TDesC8& aType) +{ + FLOG( _L( " CSapVMessageParser: CheckMime\t" ) ); + + _LIT8(KMimeVmsg,"text/x-vmsg\x00"); + + return (aType.Compare(KMimeVmsg)==0); +} + + +// --------------------------------------------------------- +// CheckName +// Check object name of SAP vMessage. +// --------------------------------------------------------- +// +TBool CSapVMessageParser::CheckName(const TDesC& aName) +{ + FLOG( _L( " CSapVMessageParser: CheckName\t" ) ); + + _LIT(KNameVmsg, "sap_sms.vmg"); + + return (aName.Compare(KNameVmsg)==0); +} + +// --------------------------------------------------------- +// Address +// Returns address field of parsed message. +// --------------------------------------------------------- +// +const TDesC& CSapVMessageParser::Address() const +{ + if(iType==ESapVMessageTextSMS && iAddress) + { + return *iAddress; + } + else + { + return KNullDesC; + } +} + +// --------------------------------------------------------- +// Message +// Returns body text of parsed message. +// --------------------------------------------------------- +// +const TDesC& CSapVMessageParser::Message() const +{ + if(iType==ESapVMessageTextSMS && iMessage) + { + return *iMessage; + } + else + { + return KNullDesC; + } +} + +// --------------------------------------------------------- +// ~CSapVMessageParser +// Destructor. +// --------------------------------------------------------- +// +CSapVMessageParser::~CSapVMessageParser() +{ + FLOG( _L( " CSapVMessageParser: ~CSapVMessageParser\t" ) ); + + delete iAddress; + delete iMessage; +} + +static TBool Compare(const TDesC8& aData, TInt& aReadBytes, const TDesC8& aToken) +{ + if( (aData.Length() >= aReadBytes + aToken.Length()) && + (aData.Mid(aReadBytes, aToken.Length()).Compare(aToken)==0) ) + { + aReadBytes+=aToken.Length(); + return ETrue; + } + else + { + return EFalse; + } +} + +// --------------------------------------------------------- +// SimpleParseL +// Parses SAP VMessage. +// --------------------------------------------------------- +// +void CSapVMessageParser::SimpleParseL(const TDesC8& aData) +{ + FLOG( _L( " CSapVMessageParser: SimpleParseL\t" ) ); + + // SAP VMessage format definitions + _LIT8(KVmsgStatus, "BEGIN:VMSG\x0d\x0a" + "VERSION:1.1\x0d\x0a" + "X-IRMC-STATUS:"); + _LIT8(KVmsgBox, "\x0d\x0a" + "X-IRMC-TYPE:SMS\x0d\x0a" + "X-IRMC-BOX:"); + _LIT8(KVmsgVCard, "BEGIN:VCARD\x0d\x0a" + "VERSION:2.1\x0d\x0a"); + _LIT8(KVmsgName1, "N:"); + _LIT8(KVmsgName2, "N;ENCODING=8BIT;CHARSET=UTF-8:"); + _LIT8(KVmsgTel, "\x0d\x0a" + "TEL:"); + _LIT8(KVmsgVCardEnd,"\x0d\x0a" + "END:VCARD\x0d\x0a"); + _LIT8(KVmsgVEnv, "BEGIN:VENV\x0d\x0a"); + _LIT8(KVmsgVBody, "BEGIN:VBODY\x0d\x0a" + "X-SMS;TYPE=TEXT;ENCODING=8BIT;CHARSET=UTF-8:"); + _LIT8(KVmsgEnd, "\x0d\x0a" + "END:VBODY\x0d\x0a" + "END:VENV\x0d\x0a" + "END:VMSG\x0d\x0a"); + _LIT8(KVmsgUnread, "UNREAD"); + _LIT8(KVmsgRead, "READ"); + _LIT8(KVmsgInbox, "INBOX\x0d\x0a"); + _LIT8(KVmsgSentbox, "SENTBOX\x0d\x0a"); + _LIT8(KCrLf, "\x0d\x0a"); + + // Simple SAP VMessage parsing + TInt readBytes=0; + if( Compare(aData, readBytes, KVmsgStatus) && + aData.Right(KVmsgEnd().Length()).Compare(KVmsgEnd)==0 ) + { // The begin and end of the message are correct + if(Compare(aData, readBytes, KVmsgUnread)) + { // Status: Unread + iStatus=ESapVMessageStatusUnread; + } + else if(Compare(aData, readBytes, KVmsgRead)) + { // Status: Read or Sent + iStatus=ESapVMessageStatusRead; + } + else + { // Unknown status + return; + } + if( Compare(aData, readBytes, KVmsgBox) ) + { + if(iStatus==ESapVMessageStatusRead && Compare(aData, readBytes, KVmsgSentbox)) + { // Status: Sent + iStatus=ESapVMessageStatusSent; + if(!Compare(aData, readBytes, KVmsgVEnv)) + { + return; + } + } + else if(! Compare(aData, readBytes, KVmsgInbox) ) + { + return; + } + if( Compare(aData, readBytes, KVmsgVCard) && + ( Compare(aData, readBytes, KVmsgName1) || + Compare(aData, readBytes, KVmsgName2) ) ) + { // The begin of the message is correct + TInt beginOfName=readBytes; + TInt endOfName=aData.Find(KVmsgTel); + TInt endOfFrom=aData.Find(KVmsgVCardEnd); + readBytes=endOfFrom+KVmsgVCardEnd().Length(); + if(iStatus!=ESapVMessageStatusSent) + { + if(!Compare(aData, readBytes, KVmsgVEnv)) + { + return; + } + } + if(endOfFrom!=KErrNotFound && endOfName!=KErrNotFound && + endOfName0 && + name.Length() <= RMobilePhone::KMaxMobileTelNumberSize) + { + iAddress = CnvUtfConverter::ConvertToUnicodeFromUtf8L(name); + } + else + { + iAddress = HBufC::NewL(from.Length()); + iAddress->Des().Copy(from); + } + + TPtrC8 body = aData.Mid(beginOfBody, bodyLength); + iMessage = CnvUtfConverter::ConvertToUnicodeFromUtf8L(body); + + FLOG( _L( " CSapVMessageParser: SimpleParseL: SMS\t" ) ); + iType=ESapVMessageTextSMS; + } + } + } + } + } + } +} + +// --------------------------------------------------------- +// SaveSapMessageL +// Saves parsed VMessage. +// --------------------------------------------------------- +// +void CSapVMessageParser::SaveSapMessageL(CMsvSession* aMsvSession) +{ + FLOG( _L( " CSapVMessageParser: SaveSapMessageL\t" ) ); + + switch(iType) + { + case ESapVMessageTextSMS: + SaveSapSmsL(aMsvSession); + break; + + case ESapVMessageMMSNotificationInd: + SaveSapMmsL(aMsvSession); + break; + + default: // Discard message + break; + } +} + +// --------------------------------------------------------- +// SaveSapSmsL +// Saves parsed VMessage as SMS. +// --------------------------------------------------------- +// +void CSapVMessageParser::SaveSapSmsL(CMsvSession* aMsvSession) +{ + FLOG( _L( " CSapVMessageParser: SaveSapSmsL\t" ) ); + + CParaFormatLayer* richParaFormatLayer = CParaFormatLayer::NewL(); + CleanupStack::PushL(richParaFormatLayer); // 1st push + CCharFormatLayer* richCharFormatLayer = CCharFormatLayer::NewL(); + CleanupStack::PushL(richCharFormatLayer); // 2nd push + CRichText* + richText = CRichText::NewL(richParaFormatLayer,richCharFormatLayer); + CleanupStack::PushL(richText); // 3rd push + + richText->InsertL(0, Message()); + + if(iStatus==ESapVMessageStatusSent) + { + SaveSmsToSentL(aMsvSession, richText); + } + else + { + SaveSmsToInboxL(aMsvSession, richText); + } + + CleanupStack::PopAndDestroy(3, richParaFormatLayer); + + FLOG( _L( " CSapVMessageParser: SaveSapSmsL: Done\t" ) ); +} + +// --------------------------------------------------------- +// SaveSapMmsL +// Saves parsed VMessage as MMS notification. +// --------------------------------------------------------- +// +void CSapVMessageParser::SaveSapMmsL(CMsvSession* /*aMsvSession*/) const +{ + // This is not supported +} + +// --------------------------------------------------------- +// SaveSmsToInboxL +// Saves parsed VMessage to Inbox as SMS. +// --------------------------------------------------------- +// +void CSapVMessageParser::SaveSmsToInboxL(CMsvSession* aMsvSession, CRichText* aMessage) +{ + #ifndef NO101APPDEPFIXES_NEW + (void) aMsvSession; + (void) aMessage; + #endif //NO101APPDEPFIXES_NEW + #ifdef NO101APPDEPFIXES_NEW + FLOG( _L( " CSapVMessageParser: SaveSmsToInboxL\t" ) ); + CSmsHeader* header=CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *aMessage ); + CleanupStack::PushL(header); // 1st push + header->SetFromAddressL(Address()); + header->SetReplyPathProvided(EFalse); + + TMsvEntry newTEntry; + + newTEntry.iType = KUidMsvMessageEntry; + newTEntry.iMtm = KUidMsgTypeSMS; + newTEntry.SetComplete(EFalse); + newTEntry.SetFailed(EFalse); + newTEntry.SetOperation(EFalse); + newTEntry.SetMultipleRecipients(EFalse); + newTEntry.SetVisible(EFalse); // Make invisible + // and in preparation to make sure gets cleaned up on errors. + newTEntry.SetInPreparation(ETrue); + newTEntry.SetSendingState(KMsvSendStateNotApplicable); + newTEntry.iServiceId = KMsvLocalServiceIndexEntryId; + newTEntry.iSize = 0; + newTEntry.iDate = iTimeReceived; + header->Message().SetTime(iTimeOriginal); + ((CSmsDeliver*)&header->Message().SmsPDU())->SetServiceCenterTimeStamp(iTimeOriginal); + +// SMUT Unbranch + CSmsGetDetDescInterface* smsPlugin = CSmsGetDetDescInterface::NewL(); + CleanupStack::PushL( smsPlugin ); + + TBuf description; + smsPlugin->GetDescription( header->Message(), description ); + newTEntry.iDescription.Set(description); + TBuf details; + smsPlugin->GetDetails( aMsvSession->FileSession(), header->Message(), details ); + newTEntry.iDetails.Set(details); + + CleanupStack::PopAndDestroy( smsPlugin ); + + // Create new entry to inbox + CMsvEntry* inbox = aMsvSession->GetEntryL( KMsvGlobalInBoxIndexEntryId ); + CleanupStack::PushL( inbox ); + inbox->CreateL(newTEntry); + CleanupStack::PopAndDestroy(inbox); + + TMsvId newEntryId=newTEntry.Id(); + aMsvSession->CleanupEntryPushL(newEntryId); //2nd push + + // Get the created entry + CMsvEntry* newEntry = aMsvSession->GetEntryL(newEntryId); + CleanupStack::PushL(newEntry); // 3rd push + + // Store SMS message to the entry + CMsvStore* newMessageStore = newEntry->EditStoreL(); + CleanupStack::PushL(newMessageStore); // 4th push + header->StoreL(*newMessageStore); + newMessageStore->StoreBodyTextL(*aMessage); + newMessageStore->CommitL(); + + // Save the size & make visible + newTEntry = newEntry->Entry(); + newTEntry.iSize = newMessageStore->SizeL(); + + // Saved OK. Make the entry visible and flag it as complete. + newTEntry.SetVisible(ETrue); + newTEntry.SetInPreparation(EFalse); + newTEntry.SetUnread(iStatus==ESapVMessageStatusUnread); + newTEntry.SetNew(iStatus==ESapVMessageStatusRead); + newTEntry.SetComplete(ETrue); + newTEntry.SetReadOnly(ETrue); + newEntry->ChangeL(newTEntry); + + CleanupStack::PopAndDestroy(2, newEntry); + aMsvSession->CleanupEntryPop(); + CleanupStack::PopAndDestroy(header); + + FLOG( _L( " CSapVMessageParser: SaveSmsToInboxL: Done\t" ) ); + #endif //NO101APPDEPFIXES_NEW +} + +// --------------------------------------------------------- +// SaveSmsToSentL +// Saves parsed VMessage to Sent folder as SMS. +// --------------------------------------------------------- +// +void CSapVMessageParser::SaveSmsToSentL(CMsvSession* aMsvSession, CRichText* aMessage) +{ + #ifndef NO101APPDEPFIXES_NEW + (void) aMsvSession; + (void) aMessage; + #endif //NO101APPDEPFIXES_NEW + + #ifdef NO101APPDEPFIXES_NEW + FLOG( _L( " CSapVMessageParser: SaveSmsToSentL\t" ) ); + + CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *aMessage ); + CleanupStack::PushL( header ); + header->SetFromAddressL(Address()); + + TMsvEntry newTEntry; + newTEntry.iType = KUidMsvMessageEntry; + newTEntry.iMtm = KUidMsgTypeSMS; + newTEntry.SetComplete(EFalse); + newTEntry.SetFailed(EFalse); + newTEntry.SetOperation(EFalse); + newTEntry.SetMultipleRecipients(EFalse); + newTEntry.SetVisible(EFalse); // Make invisible + // and in preparation to make sure gets cleaned up on errors. + newTEntry.SetInPreparation(ETrue); + newTEntry.SetSendingState(KMsvSendStateSent); + newTEntry.iServiceId = KMsvUnknownServiceIndexEntryId; + newTEntry.iSize = 0; + newTEntry.iDate=iTimeReceived; + header->Message().SetTime(iTimeOriginal); + +// SMUT Unbranch + CSmsGetDetDescInterface* smsPlugin = CSmsGetDetDescInterface::NewL(); + CleanupStack::PushL( smsPlugin ); + + TBuf description; + smsPlugin->GetDescription( header->Message(), description ); + newTEntry.iDescription.Set(description); + TBuf details; + smsPlugin->GetDetails( aMsvSession->FileSession(), header->Message(), details ); + newTEntry.iDetails.Set(details); + + CleanupStack::PopAndDestroy( smsPlugin ); + + CSmsSettings* settings = CSmsSettings::NewLC(); + CSmsAccount* account = CSmsAccount::NewLC(); + account->LoadSettingsL(*settings); + CleanupStack::PopAndDestroy(account); + header->SetSmsSettingsL( *settings ); + TInt scindex = settings->DefaultServiceCenter(); + if ( scindex != KErrNotFound ) + { + header->SetServiceCenterAddressL( ( settings->GetServiceCenter( scindex ) ).Address() ); + } + CleanupStack::PopAndDestroy(settings); + + CSmsNumber* rcpt = CSmsNumber::NewL(); + CleanupStack::PushL( rcpt ); + rcpt->SetAddressL(Address()); + if(Address()!=details) + { + rcpt->SetNameL(details); + } + header->Recipients().ResetAndDestroy(); + header->Recipients().AppendL( rcpt ); + CleanupStack::Pop( rcpt ); + + // Create new entry to Sent folder + CMsvEntry* sentFldr = aMsvSession->GetEntryL( KMsvSentEntryId ); + CleanupStack::PushL( sentFldr ); + sentFldr->CreateL(newTEntry); + CleanupStack::PopAndDestroy(sentFldr); + + TMsvId newEntryId=newTEntry.Id(); + aMsvSession->CleanupEntryPushL(newEntryId); //2nd push + + // Get the created entry + CMsvEntry* newEntry = aMsvSession->GetEntryL(newEntryId); + CleanupStack::PushL(newEntry); // 3rd push + + // Store SMS message to the entry + CMsvStore* newMessageStore = newEntry->EditStoreL(); + CleanupStack::PushL(newMessageStore); // 4th push + header->StoreL(*newMessageStore); + newMessageStore->StoreBodyTextL(*aMessage); + newMessageStore->CommitL(); + + // Save the size & make visible + newTEntry = newEntry->Entry(); + newTEntry.iSize = newMessageStore->SizeL(); + + // Saved OK. Make the entry visible and flag it as complete. + newTEntry.SetVisible(ETrue); + newTEntry.SetInPreparation(EFalse); + newTEntry.SetComplete(ETrue); + newEntry->ChangeL(newTEntry); + + CleanupStack::PopAndDestroy(2, newEntry); + aMsvSession->CleanupEntryPop(); + CleanupStack::PopAndDestroy(header); + + FLOG( _L( " CSapVMessageParser: SaveSmsToSentL: Done\t" ) ); + #endif //NO101APPDEPFIXES_NEW +} + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/group/bld.inf --- a/btservices_plat/group/bld.inf Mon May 17 11:06:23 2010 +0300 +++ b/btservices_plat/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -31,3 +31,7 @@ #include "../bluetooth_notifier_internal_api/group/bld.inf" #include "../bluetooth_sap_connection_state_api/group/bld.inf" #include "../bluetooth_secondary_display_notification_api/group/bld.inf" +#include "../obex_secondary_display_notification_api/group/bld.inf" +#include "../obex_service_plugin_api/group/bld.inf" +#include "../obex_service_utils_api/group/bld.inf" +#include "../usb_obexservicemanager_client_api/group/bld.inf" \ No newline at end of file diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_secondary_display_notification_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_secondary_display_notification_api/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: OBEX Secondary Display Notification API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/secondarydisplay/obexutilssecondarydisplayapi.h MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/obexutilssecondarydisplayapi.h) diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_secondary_display_notification_api/inc/secondarydisplay/obexutilssecondarydisplayapi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_secondary_display_notification_api/inc/secondarydisplay/obexutilssecondarydisplayapi.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2005 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: Contains dialog index for cover UI. +* +*/ + + +#ifndef OBEXUTILS_SECONDARY_DISPLAY_API_H +#define OBEXUTILS_SECONDARY_DISPLAY_API_H + +// INCLUDES +#include + +// Category +const TUid KObexUtilsCategory = { 0x101F86AF }; + +/** +* Enumerates types. +*/ +enum TSecondaryDisplayObexUtilsDialogs + { + ECmdNone, + ECmdIrConnecting, + ECmdIrCannotEstablish, + ECmdIrSendingData, + ECmdIrSendingFailed, + ECmdIrDataSent, + ECmdBtConnecting, + ECmdBtSendingData, + ECmdBtDevNotAvail, + ECmdBtFailedToSend, + ECmdBtDataSent, + ECmdBtNotReceiveOne, + ECmdOutOfMemory, + ECmdBtSentImageNumber, + ECmdBtNotReceiveAny, + ECmdBtNotSendAll, + ECmdBtNotAllSupported, + ECmdBtNotAllSupportedMixed, + ECmdBtConnectingWait, + ECmdIrConnectingWait, + ECmdBtPrintingWait, + ECmdSendingProgress + }; + +#endif // OBEXUTILS_SECONDARY_DISPLAY_API_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_secondary_display_notification_api/obex_secondary_display_notification_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_secondary_display_notification_api/obex_secondary_display_notification_api.metaxml Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,17 @@ + + + OBEX Secondary Display Notification API + defines message IDs for showing message on secondary display + c++ + localconnectivityservice + + + + + + + + no + no + + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_plugin_api/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: OBEX Service Plugin API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/SrcsInterface.inl MW_LAYER_PLATFORM_EXPORT_PATH(SrcsInterface.inl) +../inc/SrcsInterface.h MW_LAYER_PLATFORM_EXPORT_PATH(SrcsInterface.h) diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_plugin_api/inc/SrcsInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_plugin_api/inc/SrcsInterface.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,117 @@ +/* +* 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: Define obexserviceman's service controller ECom interface. +* +*/ + + + +#ifndef _SRCSINTERFACE_ +#define _SRCSINTERFACE_ + + +//INCLUDES +#include +#include +#include + +// CONSTANTS +const TUid KCSrcsInterfaceUid = {0x101F7C8C}; // UID of this interface + + +enum TSrcsMediaType //transport media types + { + ESrcsMediaBT = 1, + ESrcsMediaIrDA, + ESrcsMediaUSB + }; + +/** +* An abstract class being representative of the +* concrete class which the client wishes to use. +* +* It acts as a base, for a real class to provide all the +* functionality that a client requires. +* It supplies instantiation & destruction by using +* the ECom framework, and functional services +* by using the methods of the actual class. +*/ +class CSrcsInterface : public CBase + { +public: + + /** + * Two-phased constructor. + * @param aImplUid Implementation UId. + * @return newly created CSrcsInterface. + */ + static CSrcsInterface* NewL(TUid aImplUid); + + /** + * Destructor + */ + virtual ~CSrcsInterface(); + + /** + * Request a list of all available implementations which satisfies this given interface. + * @param aImplInfoArray Implementation instance array. + * @return none. + */ + static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray); + + /** + * Request a list of matching implementations which satisfies this given interface. + * @param aMatchString String to be matched by the implemention. + * @param aImplInfoArray Implementation instance array. + * @return none. + */ + static void ListImplementationsL(const TDesC8& aMatchString, RImplInfoPtrArray& aImplInfoArray); + + + /** + * Check if OBEX service is still active. + * @return ETrue: OBEX service is still active. + * EFalse: OBEX service is inactive. + */ + virtual TBool IsOBEXActive() = 0; + + /** + * Provide transport media information to service controller. + * @param aMediaType enum value specifying transport media type. + * @return none. + */ + virtual void SetMediaType( TSrcsMediaType aMediaType ) ; + + /** + * SetObexServer + * @param aObexServer pass obex server pointer to sevice controller + * @return none. + */ + virtual TInt SetObexServer( CObexServer* aObexServer ); + +protected: + /** + * C++ default Constructor + */ + inline CSrcsInterface(); + +private: + // Unique instance identifier key + TUid iDtor_ID_Key; + }; + +#include "SrcsInterface.inl" + +#endif + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_plugin_api/inc/SrcsInterface.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_plugin_api/inc/SrcsInterface.inl Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,85 @@ +/* +* 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: Define SRCS's service controller ECom interface. +* +*/ + + +// ----------------------------------------------------------------------------- +// CSrcsInterface +// ----------------------------------------------------------------------------- +// +inline CSrcsInterface::CSrcsInterface() + { + } + +// ----------------------------------------------------------------------------- +// destructor +// ----------------------------------------------------------------------------- +// +inline CSrcsInterface::~CSrcsInterface() + { + // Destroy any instance variables and then + // inform the framework that this specific + // instance of the interface has been destroyed. + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +inline CSrcsInterface* CSrcsInterface::NewL(TUid aImplUid) + { + return REINTERPRET_CAST(CSrcsInterface*, + REComSession::CreateImplementationL(aImplUid, + _FOFF(CSrcsInterface,iDtor_ID_Key))); + } + +// ----------------------------------------------------------------------------- +// ListAllImplementationsL +// ----------------------------------------------------------------------------- +// +inline void CSrcsInterface::ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + REComSession::ListImplementationsL(KCSrcsInterfaceUid, aImplInfoArray); + } + +// ----------------------------------------------------------------------------- +// ListImplementationsL +// ----------------------------------------------------------------------------- +// +inline void CSrcsInterface::ListImplementationsL(const TDesC8& aMatchString, RImplInfoPtrArray& aImplInfoArray) + { + TEComResolverParams resolverParams; + resolverParams.SetDataType(aMatchString); + resolverParams.SetWildcardMatch(EFalse); + REComSession::ListImplementationsL(KCSrcsInterfaceUid, resolverParams, aImplInfoArray); + } + +// ----------------------------------------------------------------------------- +// SetMediaType +// ----------------------------------------------------------------------------- +// +inline void CSrcsInterface::SetMediaType( TSrcsMediaType ) + { + } +// ----------------------------------------------------------------------------- +// SetObexServer +// ----------------------------------------------------------------------------- +// +inline TInt CSrcsInterface::SetObexServer( CObexServer* ) + { + return KErrNone; + } diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_plugin_api/obex_service_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_plugin_api/obex_service_plugin_api.metaxml Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,17 @@ + + + OBEX Service Plugin API + ECom interface for implementing obex service controllers, e.g. ftp, opp service controller + c++ + localconnectivityservice + + + + + + + + no + no + + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: OBEX Service Utils API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/obexutilsmessagehandler.h MW_LAYER_PLATFORM_EXPORT_PATH(obexutilsmessagehandler.h) diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/inc/obexutilsmessagehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/inc/obexutilsmessagehandler.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,479 @@ +/* +* Copyright (c) 2002 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 OBEXUTILSMESSAGEHANDLER_H +#define OBEXUTILSMESSAGEHANDLER_H + +// INCLUDES +#include +#include +#include +#include + +#include +#include + +// CLASS DECLARATION + +/** +* Utility methods for message handling. +*/ +class TObexUtilsMessageHandler + { + public: + + /** + * Get status of file system. (in C drive) + * @return Symbian OS errorcode + */ + IMPORT_C static TInt GetFileSystemStatus(); + + /** + * Get status of file system in MMC. + * @return Symbian OS errorcode + */ + IMPORT_C static TInt GetMmcFileSystemStatus(); + + /** + * Get current message centre drive + * @return Drive unit of the message centre drive + */ + IMPORT_C static TInt GetMessageCentreDriveL(); + + /** + * Creates default Mtm service + * @param aMtm Mtm + */ + IMPORT_C static void CreateDefaultMtmServiceL(TUid aMtm); + + /** + * Saves received object to Inbox. + * @param aReceivedObject The object to be saved. + * @param aDrive The current messaging drive. + * @param aMtmID The message type module id. + * @return None. + */ + IMPORT_C static void SaveObjToInboxL( CObexBufObject* aReceivedObject, + const TDesC16& aPath, + const TUid aMtmID ); + + /** + * Creates an Outbox entry + * @param aMTm Message type id + * @param aResourceID Resource id for the message entry text + * @return Message server entry. + */ + IMPORT_C static TMsvId CreateOutboxEntryL( const TUid& aMtm, const TInt& aResourceID ); + + /** + * Deletes an Outbox entry + * @param aMessageServerIndex Message server entry + * @return None. + */ + IMPORT_C static void DeleteOutboxEntryL( const TMsvId& aMessageServerIndex ); + + /** + * Create inbox attachment and entries. + * @param aBufObject The object to be saved + * @param aMtmId MTM Id + * @param aMsvIdParent Parent message entry (returned) + * @param aFile File to the attachment (returned) + * @return None. + */ + IMPORT_C static void CreateInboxAttachmentL( + CObexBufObject* &aBufObject, + const TUid aMtmId, + TMsvId &aMsvIdParent, + RFile &aFile); + + /** + * Create inbox attachment and entries. + * @param aBufObject The object to be saved + * @param aMtmId MTM Id + * @param aMsvIdParent Parent message entry (returned) + * @param aFile File to the attachment (returned) + * @param aRemoteBluetoothName sender's bluetooth name. + * @return None. + */ + IMPORT_C static void CreateInboxAttachmentL( + CObexBufObject* &aBufObject, + const TUid aMtmId, + TMsvId &aMsvIdParent, + RFile &aFile, + const TDesC& aRemoteBluetoothName); + + /** + * Saves received object to Inbox. + * @param aReceivedObject The object to be saved (set to null after remove). + * @param aFile File to the attachment + * @param aMsvIdParent Parent message entry + * @return None. + */ + IMPORT_C static void SaveObjToInboxL( + CObexBufObject* &aReceivedObject, + RFile &aFile, + TMsvId aMsvIdParent); + + /** + * Remove unfinished work from inbox + * @param aBufObject The object to be saved (set to null after remove) + * @param aMsvIdParent Parent message entry + * @return None. + */ + IMPORT_C static void RemoveInboxEntriesL(CObexBufObject* &aBufObject, TMsvId aMsvIdParent); + + /** + * Gets central repository key's integer value + * @param aRepositoryUid Central repository's UID value + * @param aId Central repository's ID value + * @param aVal Returned integer value + * @return Symbian OS errorcode + */ + IMPORT_C static TInt GetCenRepKeyIntValueL(TUid aRepositoryUid, TUint32 aId, TInt& aVal); + + /** + * Gets central repository key's string value + * @param aRepositoryUid Central repository's UID value + * @param aId Central repository's ID value + * @param aVal Returned string value + * @return Symbian OS errorcode + */ + + IMPORT_C static TInt GetCenRepKeyStringValueL(TUid aRepositoryUid, TUint32 aId, TDes& aVal); + + /** + * Gets Publish & Subscribe key's integer value + * @param aCategory Category of the key + * @param aKey PUBSUB Key + * @param value Returned value + * @return Symbian OS errorcode + */ + IMPORT_C static TInt GetPubSubKeyIntValue(TUid aCategory, TUint aKey, TInt& value); + + /** + * Create receive buffer and RFile object. + * @Since S60 v5.0 + * @param aFile File to temp file + * @param aPath Path The directory in which the file is created + * @param aFullName Contains the full path and file name of the file (returned) + * @param aReceiveObject Obex object for receive buffer ( returned ) + * @param aBufSize Size of receive buffer + * @return Symbian error code. + */ + IMPORT_C static TInt CreateReceiveBufferAndRFileL ( RFile& aFile, + const TDesC& aPath, + TFileName& aFullName, + CBufFlat* &aReceiveObject, + const TInt aBufSize ); + + /** + * Remove temporary RFile object. + * @Since S60 v5.0 + * @param aFullName Contains the full path and file name of the file + * @return Symbian error code. + */ + IMPORT_C static void RemoveTemporaryRFileL ( const TFileName& aFullName ); + + /** + * Create inbox entries and saves received object to file system + * @Since S60 v5.0 + * @param aReceiveObject Obex object for receive buffer + * @param aMtmId MTM Id + * @param aMsvIdParent Parent message entry (returned) + * @param aFullName The directory and file name in which the file is saved (returned) + * @param aFile File handler identical with the one in CreateReceiveBufferAndRFileL() + * it must be opened before use. + * @return None + */ + IMPORT_C static void SaveFileToFileSystemL(CObexBufObject* &aReceiveObject, + const TUid aMtmId, + TMsvId& aMsvIdParent, + TFileName& aFullName, + RFile& aFile, + const TDesC& aSenderBluetoothName); + + /** + * Add an entry to Inbox + * @Since S60 v5.0 + * @param aMsvIdParent Parent message entry + * @param aFullName Contains the full path and file name of the file + * @return None + */ + IMPORT_C static void AddEntryToInboxL( TMsvId& aMsvIdParent, + TFileName& aFullName); + + /** + * Add an entry to Inbox + * @Since S60 v5.0 + * @param aMsvIdParent Parent message entry + * @param aFullName Contains the full path and file name of the file + * @param aMsvIdArray an array contains a list of TMsvId ( returned ) + * @return None + */ + IMPORT_C static void AddEntryToInboxL( TMsvId& aMsvIdParent, + TFileName& aFullName, + RArray* aMsvIdArray); + + /** + * Update entry attachmeent in Inbox + * @Since S60 v5.0 + * @param aFullName Contains the full path and file name of the file + * @param aMsvIdParent Parent message entry + * @return None + */ + IMPORT_C static void UpdateEntryAttachmentL ( TFileName& aFullName,CMsvEntry* aParentEntry ); + + + + private: + + class CDummySessionObserver; + class TReceivedData; + + /** + * Create inbox attachment and entries. + * @param aMtmId Mtm ID of the message + * @param aMsvIdParent Parent message entry (returned) + * @param aFile File to the attachment (returned) + * @param aRemoteBluetoothName sender's bluetooth name. + */ + static void DoCreateInboxAttachmentL( + const TUid aMtmId, + TMsvId &aMsvIdParent, + RFile &aFile, + const TDesC& aRemoteBluetoothName = KNullDesC); + + /** + * Deletes Obex Buf Object buffer + * @param aBufObject The buffer object + * @return None. + */ + static void RemoveObexBuffer(CObexBufObject* &aBufObject); + + /* + * Creates Msv session + * @param aSessionObs Session observer + * @param aMsvSession Session + */ + static void CreateMsvSessionLC( + CDummySessionObserver* &aSessionObs, + CMsvSession* &aMsvSession); + + /* + * Creates Msv session to selected destination + * @param aSessionObs Session observer + * @param aMsvSession Session + * @param aDestination Destination + * @param aMsvId Destination type + */ + static void CreateMsvSessionLC( + CDummySessionObserver* &aSessionObs, + CMsvSession* &aMsvSession, + CMsvEntry* &aDestination, + TMsvId aMsvId); + + /** + * Gets current time + * @return None. + */ + static TTime GetCurrentTime(); + + /** + * Stores message as rich text + * @param aParentEntry Parent entry + * @param aFile File to store to the message entry's store + * @return None. + */ + static void StoreAsRichTextL(CMsvEntry* aParentEntry, RFile& aFile); + + /** + * Updates attachment's information + * @param aRecData Received obex data + * @param aAttachEntry Attachment entry + * @param aAttachInfo Attachment information + * @param aStore Message store (attachment) + * @return None. + */ + static void UpdateAttachmentInformationL( + TReceivedData& aRecData, + CMsvEntry* aAttachEntry, + CMsvAttachment* aAttachInfo, + CMsvStore* aStore); + + /** + * Finalises the parent entry to contain correct data + * @param aParentEntry Parent entry + * @param aReceivedData Received obex data + * @param aStore Attachment's store + * @param aIsBioMsg Is BIO message? + * @return None. + */ + static void FinaliseMessageL( + CMsvEntry* aParentEntry, + TReceivedData& aRecData, + CMsvStore* aStore, + TBool aIsBioMsg); + + /** + * Finalises the parent entry to contain correct data + * @Since v5.0 + * @param aParentEntry Parent entry + * @param aStore Attachment's store + * @param aFileEntry a file entry + * @param aFileNameParser a file name parser + * @return None. + */ + static void FinaliseMessageL( + CMsvEntry* aParentEntry, + CMsvStore* aStore, + TEntry& aFileEntry, + TParse& aFileNameParser); + + /** + * Stores BIO message to parent entry's body and updates information + * @param aBioDB BIO database for a BIO message + * @param parentEntry Parent entry + * @param aFile File to save to parent entry's body + * @return None. + */ + static void StoreAndUpdateBioMessageL( + CBIODatabase* aBioDB, + TUid aBioMsgId, + CMsvEntry* parentEntry, + RFile& aFile); + + /** + * Recognises MIME type of a file + * @param aFile File to recognise + * @param aAttachInfo Attachment information + * @return None. + */ + static void RecogniseObjectsL( + TFileName& aFileName, + CMsvAttachment* aAttachInfo); + + /** + * Saves MIME type and gets BIO for that MIME type + * @param aFile File to be recognised + * @param aFsSess File session to use for BIO database + * @param aAttachInfo Attachment information + * @param aBioMsgId Returned BIO message's ID + * @return BIO database for a MIME type (null if not BIO) + */ + static CBIODatabase* SaveMimeAndGetBioLC( + TFileName& aFileName, + RFs& aFsSess, + CMsvAttachment* aAttachInfo, + TUid &aBioMsgId); + + /** + * Constructs rich text + * @return Text in rich text. + */ + static CRichText* ConstructRichTextLC(); + + /** + * Makes a valid OS filesystem filename by removing illegal characters + * @param aFileSession File server filesession + * @param aFileName File name to check and modify + * @return None. + */ + static void MakeValidFileName(RFs& aFileSession, TDes& aFileName); + + /** + * Converts text from UTF-8 to two-byte Unicode + * @param aText destination where to store the converted text + * @param aType source of conversion in UTF-8 + * @return None. + */ + static void SetBioDataTextL(TBioMsgIdText& aText, const TDesC8& aType); + + /** + * Converts text from UTF-8 to two-byte Unicode + * @param aDetails destination where to store the converted text + * @param aType source of conversion in UTF-8 + * @return None. + */ + static void SetDetailsLC( + TPtrC& aDetails, + const TDesC8& aType); + + + /** + * Rename file and move file if needed. + * @Since S60 v5.0 + * @param anOldFileName a file name with absolute path ( returned ) + * @param aNewFileName new path where file will be moved to + * @param aFileSession a file session + * @return None + */ + static TInt RenameFileL(TFileName& aFileName, + TFileName& aNewFileName, + const TDesC& aNewPath, + RFs& aFileSession); + + /** + * Rename filename with a segement number. + * @Since S60 v5.0 + * @param aFilename name of the file ( returned ) + * @param aSegmentNum number used to modifed the file name + * @param aSegmentString string will be added to filename to solve the duplicate filenames + * @return None. + */ + static TInt RenameFileWithSegmentNumL( + TDes& aFileName, + TInt aSegmentNum, + TDes& aSegementString); + + /** + * FixExtremeLongFileName + * @param aFileName extreme long file name (returned) + * @param aDriveAndPath file drive and path + * @return None + */ + static void FixExtremeLongFileName(TFileName& aExtremeLongFileName, const TDesC& aDriveAndPath); + + + /** + * A dummy class for opening CMsvSession. + */ + class CDummySessionObserver : public CBase , public MMsvSessionObserver + { + public: + void HandleSessionEventL( TMsvSessionEvent/*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ ) {}; + }; + + /** + * Class for obex received data + */ + class TReceivedData + { + public: + TInt bytesReceived; + TTime recTime; + TFileName msgName; + }; + + }; + +#endif // OBEXUTILSMESSAGEHANDLER_H + +// End of File diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/obex_service_utils_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/obex_service_utils_api.metaxml Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,18 @@ + + + OBEX Service Utils API + provides common functionalities for all service controllers, e.g. showing progress bar on OBEX sending/receiving. + c++ + localconnectivityservice + + + + + + + + + no + no + + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/Bmarm/ObexServAPItestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/Bmarm/ObexServAPItestu.def Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/Bwins/ObexServAPItestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/Bwins/ObexServAPItestu.def Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/conf/obexservapitest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/conf/obexservapitest.cfg Fri May 28 17:03:06 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] diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/eabi/ObexServAPItestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/eabi/ObexServAPItestu.def Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/group/bld.inf Fri May 28 17:03:06 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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.mmp Fri May 28 17:03:06 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 +#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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.pkg Fri May 28 17:03:06 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 + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/inc/ObexServAPItest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/inc/ObexServAPItest.h Fri May 28 17:03:06 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 +#include +#include +#include +#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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h Fri May 28 17:03:06 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 + +// 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 aLogText, ...) const; + TInt Log(const TDesC& aCategory, TRefByValue aLogText, ...) const; + TInt Log(TLogLevel aLevel, TRefByValue aLogText, ...) const; + TInt Log(const TDesC& aCategory, TRefByValue 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 + diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/init/obexservapitest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/init/obexservapitest.ini Fri May 28 17:03:06 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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/rom/obexservapitest.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/rom/obexservapitest.iby Fri May 28 17:03:06 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 + +file=ABI_DIR\BUILD_DIR\ObexServAPItest.dll SHARED_LIB_DIR\ObexServAPItest.dll + +#endif // BTENGAPITEST_IBY diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItest.cpp Fri May 28 17:03:06 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 +#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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp Fri May 28 17:03:06 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 +#include +#include +#include +#include +#include +#include +#include "testlogger.h" +#include "ObexServAPItest.h" + +#include + +// 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 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 diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/obex_service_utils_api/tsrc/src/testlogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/obex_service_utils_api/tsrc/src/testlogger.cpp Fri May 28 17:03:06 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 +#include + +#include +#include +#include + +// RDebug +#include + +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 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, "
[%H:%T:%S.%*C4] " ); +// Date format string +_LIT( KFormatDate, "%F%D %N %Y" ); +// HTML header section +_LIT( KHtmlHeadSection, "\n\nObex Message Handler Test System results\n\n\n\n\n\n" ); +// HTML code which will display the statistics +_LIT( KHtmlStatSection, "

Logfile created on %S at %S
\nS60 version %S

\n\n
\n
\n\n" ); +// HTML identifier for test case start +_LIT( KHtmlTestCaseStart, "
" ); +// Test case result logging +_LIT( KTestCaseResult, "Test completed; function %S, parameter %S, result
%d
" ); +// JavaScript function for calculating test result +#define KJSSECTION _L( "" ) + +// 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 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 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 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 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(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(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 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 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 ); + } + } diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/usb_obexservicemanager_client_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/usb_obexservicemanager_client_api/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: USB OBEX Service Manager Client API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/usbobex.h MW_LAYER_PLATFORM_EXPORT_PATH(usbobex.h) diff -r a0ea99b6fa53 -r 19bd632b5100 btservices_plat/usb_obexservicemanager_client_api/inc/usbobex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btservices_plat/usb_obexservicemanager_client_api/inc/usbobex.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006-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: USB obexservicemanager client definition +* +*/ + + +#ifndef USBOBEX_H +#define USBOBEX_H + +#include + + +class CUSBClientWrapper; + + +/** +* Transportation string definition +*/ +_LIT8(KSrcsTransportBT,"OBEX/BT"); +_LIT8(KSrcsTransportUSB,"OBEX/USB"); +_LIT8(KSrcsTransportIrDA,"OBEX/IrDA"); + + +/** + * obexservicemanager client for usb. + * @lib obexusbapi.lib + * @since S60 v3.2 + */ +class CObexUSB : public CBase + { +public: + + /** + * Two-phased constructor. + */ + IMPORT_C static CObexUSB* NewL(); + + /** + * Destructor. + */ + ~CObexUSB(); + + /** + * Turn USB services on or off + * + * @since S60 v3.2 + * @param aUSBStatus the requested USB service status + * @param aStatus the Request status + * @return None + */ + IMPORT_C void ManageUSBServices( TBool aUSBStatus, TRequestStatus &aStatus ); + + /** + * Cancel managment request and turn services off + * @since S60 v3.2 + * + */ + IMPORT_C void CancelManageUSBServices(); + +private: + + CObexUSB(); + void ConstructL(); + +private: //data + + /** + * Obexserviceman client wrapper + */ + CUSBClientWrapper* iUSBWrapper; + }; +#endif // USBOBEX_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/data/2002C3BA.rss --- a/cbsatplugin/atmisccmdplugin/data/2002C3BA.rss Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/data/2002C3BA.rss Fri May 28 17:03:06 2010 +0300 @@ -31,7 +31,7 @@ implementation_uid = 0x2002DC6B;// KUidATMiscCmdEcomImpl; version_no = 1; display_name = "Miscellaneous AT commands Implementation"; - default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC"; + default_data = "MAT+CLCK|MAT+CPWD|MAT+CUSD|MAT+CPIN|MAT+CNUM|MAT+CFUN|MAT+CBC|OAT+CMEE"; opaque_data = ""; } }; diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp --- a/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/group/atmisccmdplugin.mmp Fri May 28 17:03:06 2010 +0300 @@ -26,7 +26,8 @@ SOURCEPATH ../src SOURCE main.cpp SOURCE atmisccmdplugin.cpp -SOURCE atmisccmdpluginbase.cpp +SOURCE atcmdasyncbase.cpp +SOURCE atcmdsyncbase.cpp SOURCE atcommandparser.cpp SOURCE clckcommandhandler.cpp SOURCE securitycodeverifier.cpp @@ -38,7 +39,9 @@ SOURCE cnumcommandhandler.cpp SOURCE cfuncommandhandler.cpp SOURCE cbccommandhandler.cpp -SOURCE cusdreadwriteimp.cpp +SOURCE ussdreadmessageimpl.cpp +SOURCE ussdsendmessageimpl.cpp + USERINCLUDE ../inc @@ -59,6 +62,11 @@ LIBRARY ProfileEng.lib LIBRARY StarterClient.lib -DEBUGLIBRARY flogger.lib +LIBRARY etel3rdparty.lib +LIBRARY sysutil.lib +LIBRARY flogger.lib + +MACRO _DEBUG +MACRO USE_FILE_LOGGING // End of File diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atcmdasyncbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/inc/atcmdasyncbase.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,49 @@ +/* +* 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: Base class for async commands +* +*/ + +#ifndef ATCMDASYNCBASE_H +#define ATCMDASYNCBASE_H + +#include +#include +#include "atcommandparser.h" +#include "atcmdbase.h" +#include "atmisccmdplugin.h" + +/** + * Abstract base class for async AT command handler interface. + * It can not be instantiated individually as it doesn't fully + * implement MATCmdBase. + * + */ +NONSHARABLE_CLASS( CATCmdAsyncBase ) : public CActive, + public MATCmdBase + { +public: + virtual ~CATCmdAsyncBase() {}; + CATCmdAsyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); + + // From MATCmdBase + virtual void HandleCommandCancel(); + +protected: + MATMiscCmdPlugin* iCallback; + TAtCommandParser& iATCmdParser; + RMobilePhone& iPhone; + }; + +#endif // ATCMDASYNCBASE_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atcmdbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/inc/atcmdbase.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,40 @@ +/* +* 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: Interface class for AT Commands +* +*/ + +#ifndef ATCMDBASE_H_ +#define ATCMDBASE_H_ + +/** + * Class for accessing AT command common functionality + */ +NONSHARABLE_CLASS( MATCmdBase ) + { +public: + /** + * @see CATExtPluginBase::HandleCommand + */ + virtual void HandleCommand( const TDesC8& aCmd, + RBuf8& aReply, + TBool aReplyNeeded ) = 0; + + /** + * @see CATExtPluginBase::HandleCommandCancel + */ + virtual void HandleCommandCancel() = 0; + }; + +#endif /* ATCMDBASE_H_ */ diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atcmdsyncbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/inc/atcmdsyncbase.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: Base class for sync commands. +* +*/ + +#ifndef ATCMDSYNCBASE_H +#define ATCMDSYNCBASE_H + +#include +#include +#include "atcommandparser.h" +#include "atcmdbase.h" +#include "atmisccmdplugin.h" + +/** + * Abstract base class for sync AT command handler interface. + * It can not be instantiated individually as it doesn't fully + * implement MATCmdBase. + */ +NONSHARABLE_CLASS( CATCmdSyncBase ) : public CBase, + public MATCmdBase + { +public: + virtual ~CATCmdSyncBase() {}; + CATCmdSyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); + + // From MATCmdBase + virtual void HandleCommandCancel(); + +protected: + MATMiscCmdPlugin* iCallback; + TAtCommandParser& iATCmdParser; + RMobilePhone& iPhone; + }; + +#endif // ATCMDSYNCBASE_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atcommandparser.h --- a/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/atcommandparser.h Fri May 28 17:03:06 2010 +0300 @@ -52,7 +52,8 @@ ECmdAtCpwd, ECmdAtCpin, ECmdAtCusd, - ECmdAtCnum + ECmdAtCnum, + ECmdAtCmee }; public: TAtCommandParser(); @@ -96,10 +97,10 @@ * This function validate the parameter is a valid string. * if the parameter is absent, it returns KErrNotFound. * if the parameter is an invalid string such as not in a pair of double quotes, it returns KErrArgument - * @param aError return the error code. - * @return Next text parameter when aError is not KErrNone; + * @param aParam the text string without quotes + * @return Symbian system wide error codes */ - TPtrC8 NextTextParam(TInt& aError); + TInt NextTextParam(TPtrC8& aParam); /** * Get ISA hash code for security code diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h --- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdplugin.h Fri May 28 17:03:06 2010 +0300 @@ -23,6 +23,10 @@ #include "atcommandparser.h" +class MATCmdBase; +class CATCmdAsyncBase; +class CATCmdSyncBase; + /** Character types: carriage return, line feed or backspace */ enum TCharacterTypes { @@ -39,36 +43,6 @@ }; -class MATMiscCmdPlugin; - - -/** - * Class for common AT command handler interface - */ -NONSHARABLE_CLASS( CATCmdAsyncBase ) : public CActive - { -public: - virtual ~CATCmdAsyncBase() {}; - CATCmdAsyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); - - /** - * @see CATExtPluginBase::HandleCommand - */ - virtual void HandleCommand( const TDesC8& aCmd, - RBuf8& aReply, - TBool aReplyNeeded ) = 0; - - /** - * @see CATExtPluginBase::HandleCommandCancel - */ - virtual void HandleCommandCancel() = 0; - -protected: - MATMiscCmdPlugin* iCallback; - TAtCommandParser& iATCmdParser; - RMobilePhone& iPhone; - }; - /** * Class for accessing plugin information and common functionality */ @@ -173,6 +147,7 @@ void ConstructL(); TInt CreatePartOfReply( RBuf8& aBuffer ); + void HandleCMEECommand(); /* * Utility function that connect to Etel server and establish a subsession to RMobilePhone @@ -191,12 +166,12 @@ * Current AT command handler in. * Used when IsCommandSupported() detects a matching handler class. */ - CATCmdAsyncBase* iCurrentHandler; + MATCmdBase* iCurrentHandler; CATCmdAsyncBase* iCLCKHandler; CATCmdAsyncBase* iCPWDHandler; CATCmdAsyncBase* iCPINHandler; - CATCmdAsyncBase* iCUSDHandler; + CATCmdSyncBase* iCUSDHandler; CATCmdAsyncBase* iCNUMHandler; CATCmdAsyncBase* iCFUNHandler; CATCmdAsyncBase* iCBCHandler; @@ -217,6 +192,11 @@ * Global reply buffer for the AT command replies */ RBuf8 iReplyBuffer; + + /** + * +CME error level + */ + TInt iErrorLevel; }; #endif // ATMISCCMDPLUGIN_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h --- a/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/atmisccmdpluginconsts.h Fri May 28 17:03:06 2010 +0300 @@ -31,7 +31,6 @@ _LIT8(KCBCSupportedCmdsList, "+CBC: (0,1,2,3),(1...100)\r\n\r\nOK\r\n"); _LIT8(KCUSDSupportedCmdsList, "+CUSD: (0,1)\r\n\r\nOK\r\n"); - _LIT8(KATCLCKPS, "PS"); _LIT8(KATCLCKSC, "SC"); _LIT8(KATCLCKAO, "AO"); @@ -43,4 +42,7 @@ _LIT8(KATCLCKAG, "AG"); _LIT8(KATCLCKAC, "AC"); +// Max buffer length for an MD5 digest - originally defined in SCPServerInterface.h +const TInt KSCPMaxHashLength( 32 ); + #endif // ATMISCCMDPLUGINCONSTS_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cbccommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cbccommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cbccommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -19,7 +19,7 @@ #ifndef CBCCOMMANDHANDLER_H #define CBCCOMMANDHANDLER_H -#include "atmisccmdplugin.h" +#include "atcmdasyncbase.h" /** * AT+CBC command handler implementation class @@ -35,9 +35,8 @@ virtual void DoCancel(); // RunError not needed as RunL does not leave -private: // methods from CATCmdAsyncBase +private: // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - virtual void HandleCommandCancel(); private: CCBCCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cfuncommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cfuncommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cfuncommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -19,7 +19,9 @@ #ifndef CFUNCOMMANDHANDLER_H #define CFUNCOMMANDHANDLER_H -#include "atmisccmdplugin.h" +#include + +#include "atcmdasyncbase.h" const TInt KGeneralProfileId = 0; const TInt KOfflineProfileId = 5; @@ -39,16 +41,15 @@ virtual void RunL(); virtual void DoCancel(); // RunError not needed as RunL does not leave - -private: // methods from CATCmdAsyncBase + +private: // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - virtual void HandleCommandCancel(); private: CCFUNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); void ConstructL(); - TInt ActivateProfile(TInt aFunc, TInt aReset); + TInt ActivateProfile(TInt aFunc); TInt SetActiveProfile(TInt aProfileId); TInt RestartDevice(); @@ -56,6 +57,9 @@ RBuf8 iReply; MProfileEngine* iProfileEngine; + RProperty iProperty; + TInt iExpectedState; + TInt iReset; // default 0 - do not reset the MT before setting it to power level }; #endif /* CFUNCOMMANDHANDLER_H */ diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/clckcommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/clckcommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/clckcommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -18,7 +18,7 @@ #include -#include "atmisccmdplugin.h" +#include "atcmdasyncbase.h" class CSecurityCodeVerifier; class CSecurityEventHandler; @@ -84,10 +84,9 @@ virtual void DoCancel(); // RunError not needed as RunL does not leave -private: // methods from CATCmdAsyncBase +private: // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - virtual void HandleCommandCancel(); - + private: CCLCKCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); void ConstructL(); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cnumcommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cnumcommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cnumcommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -16,7 +16,7 @@ #ifndef CNUMCOMMANDHANDLER_H #define CNUMCOMMANDHANDLER_H -#include "atmisccmdplugin.h" +#include "atcmdasyncbase.h" /** * This class implements an AO for AT+CPIN command using ATExt plugin framework. @@ -37,15 +37,8 @@ virtual void DoCancel(); // RunError is not required because RunL doesn't leave. - // inherited from CATCmdAsyncBase - /** - * @see CATCmdAsyncBase::HandleCommand - */ + // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - /** - * @see CATCmdAsyncBase::HandleCommandCancel - */ - virtual void HandleCommandCancel(); CCNUMCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone, RTelServer& aTelServer); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cpincommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cpincommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cpincommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -16,7 +16,7 @@ #ifndef CPINCOMMANDHANDLER_H #define CPINCOMMANDHANDLER_H -#include "atmisccmdplugin.h" +#include "atcmdasyncbase.h" /** * This class implements an AO for AT+CPIN command using ATExt plugin framework. @@ -36,14 +36,8 @@ virtual void DoCancel(); // RunError is not required because RunL doesn't leave. - /** - * @see CATCmdAsyncBase::HandleCommand - */ + // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - /** - * @see CATCmdAsyncBase::HandleCommandCancel - */ - virtual void HandleCommandCancel(); CCPINCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); void ConstructL(); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cpwdcommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cpwdcommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cpwdcommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -19,7 +19,7 @@ #include #include -#include "atmisccmdplugin.h" +#include "atcmdasyncbase.h" /** * This class implements an AO for AT+CPWD command using ATExt plugin framework. @@ -39,14 +39,8 @@ virtual void DoCancel(); // RunError is not required because RunL doesn't leave. - /** - * @see CATCmdAsyncBase::HandleCommand - */ + // method from CATCmdAsyncBase::MATCmdBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); - /** - * @see CATCmdAsyncBase::HandleCommandCancel - */ - virtual void HandleCommandCancel(); CCPWDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); void ConstructL(); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cusdcommandhandler.h --- a/cbsatplugin/atmisccmdplugin/inc/cusdcommandhandler.h Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/inc/cusdcommandhandler.h Fri May 28 17:03:06 2010 +0300 @@ -20,10 +20,10 @@ #include #include -#include "atmisccmdplugin.h" +#include "atcmdsyncbase.h" -class CCUSSDSendMessageImpl; -class CCUSSDReadMessageImpl; +class CUSSDSendMessageImpl; +class CUSSDReadMessageImpl; /** * Class for accessing plugin information and common functionality */ @@ -31,34 +31,31 @@ { public: /** - * Creates an AT command reply based on the reply type and completes the - * request to ATEXT. + * Callback method for handling received USSD messages + * @param aError - the result code from the read operation */ - virtual void HandleReadMessageComplete(TInt aResult) = 0; + virtual void HandleReadMessageComplete(TInt aError) = 0; /** - * Creates an AT command reply based on the reply type and completes the - * request to ATEXT. + * Callback method for handling sent USSD messages + * @param aError - the result code from the send operation */ - virtual void HandleSendMessageComplete(TInt aResult) = 0; + virtual void HandleSendMessageComplete(TInt aError) = 0; }; - -NONSHARABLE_CLASS( CCUSDCommandHandler ) : public CATCmdAsyncBase, +/** + * Class for handling USSD requests + */ +NONSHARABLE_CLASS( CCUSDCommandHandler ) : public CATCmdSyncBase, public MUSSDCallback { public: static CCUSDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); ~CCUSDCommandHandler(); - -private: // methods from CActive - virtual void RunL(); - virtual void DoCancel(); - // RunError not needed as RunL does not leave - + private: // methods from MUSSDCallback - virtual void HandleSendMessageComplete(TInt aResult); - virtual void HandleReadMessageComplete(TInt aResult); + virtual void HandleSendMessageComplete(TInt aError); + virtual void HandleReadMessageComplete(TInt aError); private: // methods from CATCmdAsyncBase virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded ); @@ -68,7 +65,7 @@ CCUSDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone); void ConstructL(); - TInt ParseCUSDCmd(const TDesC8& aCmd); + TInt ParseCUSDCmd(); void CCUSDCommandHandler::FindFirstCarriageReturnL( const TDesC& aBuffer , TUint& aSkipChars , @@ -86,11 +83,11 @@ RMobileUssdMessaging iUssdMessaging; - CCUSSDSendMessageImpl* iUSSDSender; + CUSSDSendMessageImpl* iUSSDSender; RMobileUssdMessaging::TMobileUssdAttributesV1 iSendAttributes; RBuf8 iUSSDCommand; - CCUSSDReadMessageImpl* iUSSDReader; + CUSSDReadMessageImpl* iUSSDReader; RMobileUssdMessaging::TGsmUssdMessageData iReceivedData; TInt iDisplayRetMessage; RMobileUssdMessaging::TMobileUssdAttributesV1 iReceiveAttributes; diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/cusdreadwriteimp.h --- a/cbsatplugin/atmisccmdplugin/inc/cusdreadwriteimp.h Mon May 17 11:06:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +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 : - * - */ - -#ifndef CUSDREADWRITEIMP_H -#define CUSDREADWRITEIMP_H - -#include -#include - -class MUSSDCallback; - -NONSHARABLE_CLASS( CCUSSDReadMessageImpl ) : public CActive -{ -public: - static CCUSSDReadMessageImpl* NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession); - ~CCUSSDReadMessageImpl(); - - TInt ReadUSSDMessage(TDes8& aReceivedData, - RMobileUssdMessaging::TMobileUssdAttributesV1& aUSDAttribute ); - -private: // methods from CActive - virtual void RunL(); - virtual void DoCancel(); - // RunError not needed as RunL does not leave - -private: - CCUSSDReadMessageImpl(MUSSDCallback* aCallback, - RMobileUssdMessaging& aUSSDMessagingSession); -private: - MUSSDCallback* iCallback; - RMobileUssdMessaging& iUssdSession; - }; - -NONSHARABLE_CLASS( CCUSSDSendMessageImpl ) : public CActive -{ -public: - static CCUSSDSendMessageImpl* NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession); - ~CCUSSDSendMessageImpl(); - - TInt HandleSendUSSDCmd(const TDesC8& aCmd, - RMobileUssdMessaging::TMobileUssdAttributesV1& aUSDAttribute); - -private: // methods from CActive - virtual void RunL(); - virtual void DoCancel(); - // RunError not needed as RunL does not leave - -private: - CCUSSDSendMessageImpl(MUSSDCallback* aCallback, - RMobileUssdMessaging& aUSSDMessagingSession); - -private: - MUSSDCallback* iCallback; - RMobileUssdMessaging& iUssdSession; - }; - -#endif // CUSDREADWRITEIMP_H diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/ussdreadmessageimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/inc/ussdreadmessageimpl.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,47 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * Description : + * + */ + +#ifndef USSDREADMESSAGEIMPL_H +#define USSDREADMESSAGEIMPL_H + +#include + +class MUSSDCallback; + +/** + * Class for receiving USSD data + */ +NONSHARABLE_CLASS( CUSSDReadMessageImpl ) : public CActive +{ +public: + static CUSSDReadMessageImpl* NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession); + ~CUSSDReadMessageImpl(); + + TInt ReadUSSDMessage(TDes8& aReceivedData, + RMobileUssdMessaging::TMobileUssdAttributesV1& aUSDAttribute ); + +private: // methods from CActive + virtual void RunL(); + virtual void DoCancel(); + // RunError not needed as RunL does not leave + +private: + CUSSDReadMessageImpl(MUSSDCallback* aCallback, + RMobileUssdMessaging& aUSSDMessagingSession); +private: + MUSSDCallback* iCallback; + RMobileUssdMessaging& iUssdSession; + }; + +#endif /* USSDREADMESSAGEIMPL_H */ diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/inc/ussdsendmessageimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/inc/ussdsendmessageimpl.h Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,48 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * Description : + * + */ + +#ifndef USSDSENDMESSAGEIMPL_H +#define USSDSENDMESSAGEIMPL_H + +#include + +class MUSSDCallback; + +/** + * Class for sending USSD data + */ +NONSHARABLE_CLASS( CUSSDSendMessageImpl ) : public CActive +{ +public: + static CUSSDSendMessageImpl* NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession); + ~CUSSDSendMessageImpl(); + + TInt SendUSSDCmd(const TDesC8& aCmd, + RMobileUssdMessaging::TMobileUssdAttributesV1& aUSDAttribute); + +private: // methods from CActive + virtual void RunL(); + virtual void DoCancel(); + // RunError not needed as RunL does not leave + +private: + CUSSDSendMessageImpl(MUSSDCallback* aCallback, + RMobileUssdMessaging& aUSSDMessagingSession); + +private: + MUSSDCallback* iCallback; + RMobileUssdMessaging& iUssdSession; + }; + +#endif /* USSDSENDMESSAGEIMPL_H */ diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/atcmdasyncbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/src/atcmdasyncbase.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,39 @@ +/* +* 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 "atcmdasyncbase.h" + +#include "debug.h" + + +CATCmdAsyncBase::CATCmdAsyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) : + CActive(CActive::EPriorityStandard), + iATCmdParser(aATCmdParser), + iPhone(aPhone) + { + TRACE_FUNC_ENTRY + iCallback = aCallback; + CActiveScheduler::Add(this); + TRACE_FUNC_EXIT + } + +void CATCmdAsyncBase::HandleCommandCancel() + { + TRACE_FUNC_ENTRY + Cancel(); + TRACE_FUNC_EXIT + } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/atcmdsyncbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/src/atcmdsyncbase.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,36 @@ +/* +* 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 that don't require async operation. +* +*/ + +#include "atcmdsyncbase.h" + +#include "debug.h" + + +CATCmdSyncBase::CATCmdSyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) : + iATCmdParser(aATCmdParser), + iPhone(aPhone) + { + TRACE_FUNC_ENTRY + iCallback = aCallback; + TRACE_FUNC_EXIT + } + +void CATCmdSyncBase::HandleCommandCancel() + { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT + } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp --- a/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/atcommandparser.cpp Fri May 28 17:03:06 2010 +0300 @@ -19,24 +19,23 @@ #include #include "debug.h" - - -// Max buffer length for an MD5 digest -const TInt KSCPMaxHashLength( 32 ); - +#include "atmisccmdpluginconsts.h" TAtCommandParser::TAtCommandParser() : iCmdType(EUnknown), iCmdHandlerType(ECmdHandlerTypeUndefined) { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT } TAtCommandParser::TAtCommandParser(const TDesC8& aCmd) : iCmdType(EUnknown), iCmdHandlerType(ECmdHandlerTypeUndefined) { + TRACE_FUNC_ENTRY ParseAtCommand(aCmd); + TRACE_FUNC_EXIT } - void TAtCommandParser::ParseAtCommand(const TDesC8& aCmd) { TRACE_FUNC_ENTRY @@ -59,37 +58,42 @@ _LIT8(KAtCpin, "AT+CPIN"); _LIT8(KAtCusd, "AT+CUSD"); _LIT8(KAtCnum, "AT+CNUM"); + _LIT8(KAtCmee, "AT+CMEE"); Trace(KDebugPrintS, "token: ", &token); // Determine the AT command type - if(!token.Compare(KAtCfun)) + if(!token.CompareF(KAtCfun)) { iCmdType = ECmdAtCfun; } - else if(!token.Compare(KAtCbc)) + else if(!token.CompareF(KAtCbc)) { iCmdType = ECmdAtCbc; } - else if(!token.Compare(KAtClck)) + else if(!token.CompareF(KAtClck)) { iCmdType = ECmdAtClck; } - else if(!token.Compare(KAtCpwd)) + else if(!token.CompareF(KAtCpwd)) { iCmdType = ECmdAtCpwd; } - else if(!token.Compare(KAtCpin)) + else if(!token.CompareF(KAtCpin)) { iCmdType = ECmdAtCpin; } - else if(!token.Compare(KAtCusd)) + else if(!token.CompareF(KAtCusd)) { iCmdType = ECmdAtCusd; } - else if(!token.Compare(KAtCnum)) + else if(!token.CompareF(KAtCnum)) { iCmdType = ECmdAtCnum; } + else if(!token.Compare(KAtCmee)) + { + iCmdType = ECmdAtCmee; + } else { iCmdType = EUnknown; @@ -128,11 +132,15 @@ TAtCommandParser::TCommandType TAtCommandParser::Command() const { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT return iCmdType; } TAtCommandParser::TCommandHandlerType TAtCommandParser::CommandHandlerType() const { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT return iCmdHandlerType; } @@ -166,25 +174,29 @@ return retVal; } -TPtrC8 TAtCommandParser::NextTextParam(TInt& aError) +TInt TAtCommandParser::NextTextParam(TPtrC8& aParam) { + TRACE_FUNC_ENTRY + TInt ret = KErrNone; TPtrC8 param = NextParam(); - if (param.Compare(KNullDesC8) == 0) + if (param.Length() == 0) { - aError = KErrNotFound; - return param; + aParam.Set(NULL,0); + ret = KErrNotFound; } - - if(param.Length()<2 - || param[0] != '"' + else if(param.Length() < 2 || param[0] != '"' || param[param.Length()-1] != '"') { - aError = KErrArgument; - return param.Left(0); + aParam.Set(NULL,0); + ret = KErrArgument; } - aError = KErrNone; - return param.Mid(1, param.Length() - 2); + else + { + aParam.Set(param.Mid(1, param.Length() - 2)); + } + TRACE_FUNC_EXIT + return ret; } TInt TAtCommandParser::NextIntParam(TInt& aValue) @@ -192,7 +204,7 @@ TRACE_FUNC_ENTRY TInt retVal =KErrNone; TPtrC8 param = NextParam(); - if (param.Compare(KNullDesC8) == 0) + if (param.Length() == 0) { retVal = KErrNotFound; } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp --- a/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp Fri May 28 17:03:06 2010 +0300 @@ -28,15 +28,14 @@ #include "atmisccmdpluginconsts.h" #include "debug.h" -#include // Additional RMobilePhone error code - +#include // Additional RMobilePhone error code // +CME error code -_LIT8(KCMEIncorrectPassword, "+CME: 16\r\n"); // Incorrect password.\r\n -_LIT8(KCMEPUKRequired, "+CME: 12\r\n"); // PUK required.\r\n -_LIT8(KCMENotAllowed, "+CME: 3\r\n"); // Operation not allowed.\r\n -_LIT8(KCMEPhoneError, "+CME: 0\r\n"); // Phone failure.\r\n -_LIT8(KCMEPhoneUnknown, "+CME: 100\r\n"); // unknown error +_LIT8(KCMEIncorrectPassword, "+CME ERROR: 16\r\n"); // Incorrect password.\r\n +_LIT8(KCMEPUKRequired, "+CME ERROR: 12\r\n"); // PUK required.\r\n +_LIT8(KCMENotAllowed, "+CME ERROR: 3\r\n"); // Operation not allowed.\r\n +_LIT8(KCMEPhoneError, "+CME ERROR: 0\r\n"); // Phone failure.\r\n +_LIT8(KCMEPhoneUnknown, "+CME ERROR: 100\r\n"); // unknown error const TInt KErrorReplyLength = 9; // CR+LF+"ERROR"+CR+LF @@ -149,6 +148,11 @@ iCurrentHandler = iCBCHandler; break; } + case (TAtCommandParser::ECmdAtCmee): + { + iCurrentHandler = NULL; + break; + } case (TAtCommandParser::EUnknown): default: { @@ -170,10 +174,17 @@ { TRACE_FUNC_ENTRY - if (iCurrentHandler != NULL) + if(iCommandParser.Command() == TAtCommandParser::ECmdAtCmee) + { + HandleCMEECommand(); + HandleCommandCompleted( KErrNone, EReplyTypeOk); + } + else if (iCurrentHandler != NULL) { iHcCmd = &aCmd; iHcReply = &aReply; + // No need to parse the command again as assumed that + // it is always called from CATMiscCmdPlugin::IsCommandSupported() iCurrentHandler->HandleCommand( aCmd, aReply, aReplyNeeded ); } TRACE_FUNC_EXIT @@ -456,59 +467,94 @@ { TRACE_FUNC_ENTRY - // TODO should return CME error according to CME state (and quiet mode?) - RBuf8 response; - response.Create(KDefaultCmdBufLength); + // currently only support +CME error level 0 and 1 + ASSERT(iErrorLevel == 0 || iErrorLevel == 1 ); - // log error code - response.AppendNum(aError); - Trace(KDebugPrintD, "complete with error ", &response); + // Log error code + Trace(KDebugPrintD, "complete with error ", aError); - // return error code to AT client - response.Zero(); // reuse RBuf - response.Append(KCRLF); - switch(aError) + if(iErrorLevel == 1 && !iQuietMode) { - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - response.Append(KCMEIncorrectPassword); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - // Pin blocked - response.Append(KCMEPUKRequired); - break; - } - case KErrGsm0707OperationNotAllowed: + // return error code to AT client + RBuf8 response; + response.Create(KDefaultCmdBufLength); + response.Append(KCRLF); + switch(aError) { - // not allowed with this sim - response.Append(KCMENotAllowed); - break; + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + response.Append(KCMEIncorrectPassword); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + // Pin blocked + response.Append(KCMEPUKRequired); + break; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + response.Append(KCMENotAllowed); + break; + } + case KErrUnknown: + { + // unknown error + response.Append(KCMEPhoneUnknown); + break; + } + default: + { + response.Append(KCMEPhoneError); + break; + } } - case KErrUnknown: - { - // unknown error - response.Append(KCMEPhoneUnknown); - break; - } - default: - response.Append(KCMEPhoneError); + CreateReplyAndComplete( EReplyTypeError, response ); + response.Close(); } - CreateReplyAndComplete( EReplyTypeError, response ); - response.Close(); + else + { + CreateReplyAndComplete( EReplyTypeError); + } + TRACE_FUNC_EXIT } - TInt CATMiscCmdPlugin::HandleUnsolicitedRequest(const TDesC8& aAT ) { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT return SendUnsolicitedResult(aAT); } +void CATMiscCmdPlugin::HandleCMEECommand() + { + TRACE_FUNC_ENTRY + TAtCommandParser::TCommandHandlerType cmdHandlerType = iCommandParser.CommandHandlerType(); + + if (cmdHandlerType == TAtCommandParser::ECmdHandlerTypeSet) + { + // +CMEE=n + TInt errLevel; + TInt ret = iCommandParser.NextIntParam(errLevel); + TPtrC8 param = iCommandParser.NextParam(); + _LIT8(KCMEDbg, "CME : NextIntParam returned %d, NextParam Length is %d, errLevel %d\r\n"); + Trace(KCMEDbg, ret, param.Length(), errLevel); + if (ret == KErrNone && param.Length() == 0 && + (errLevel == 0 || errLevel == 1)) + { + iErrorLevel = errLevel; + _LIT8(KCMEErrorLevel, "CME error level: %d\r\n"); + Trace(KCMEErrorLevel, iErrorLevel); + } + } + TRACE_FUNC_EXIT + } + void CATMiscCmdPlugin::ConnectToEtelL(RTelServer& aTelServer, RMobilePhone& aPhone) { TRACE_FUNC_ENTRY @@ -521,9 +567,10 @@ User::LeaveIfError(aTelServer.EnumeratePhones(phoneCount)); if (phoneCount < 1) { - User::Leave(KErrNotFound); // TODO: appropriate error code + User::Leave(KErrNotFound); } User::LeaveIfError(aTelServer.GetPhoneInfo(0, info)); User::LeaveIfError(aPhone.Open(aTelServer, info.iName)); TRACE_FUNC_EXIT } + diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/atmisccmdpluginbase.cpp --- a/cbsatplugin/atmisccmdplugin/src/atmisccmdpluginbase.cpp Mon May 17 11:06:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 "atmisccmdplugin.h" - -#include "debug.h" - - -CATCmdAsyncBase::CATCmdAsyncBase(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) : - CActive(CActive::EPriorityStandard), - iATCmdParser(aATCmdParser), - iPhone(aPhone) - { - TRACE_FUNC_ENTRY - iCallback = aCallback; - CActiveScheduler::Add(this); - TRACE_FUNC_EXIT - } - diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cbccommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cbccommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cbccommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -53,6 +53,7 @@ void CCBCCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/) { + TRACE_FUNC_ENTRY iReply.Zero(); TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType(); @@ -79,14 +80,6 @@ TRACE_FUNC_EXIT } -void CCBCCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - - void CCBCCommandHandler::RunL() { TRACE_FUNC_ENTRY diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cbsettinghandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cbsettinghandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cbsettinghandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -61,7 +61,6 @@ { iClassArray.Append(RMobilePhone::ETelephony); } - // TODO: confirm ECircuitDataService is not needed if ((aInfoClass & EInfoClassData) == EInfoClassData) { iClassArray.Append(RMobilePhone::EAllBearer); @@ -150,9 +149,11 @@ void CCBSettingHandler::Complete(TInt aError) { + TRACE_FUNC_ENTRY if (iQueuedStatus != NULL) { User::RequestComplete(iQueuedStatus, aError); iQueuedStatus = NULL; } + TRACE_FUNC_EXIT } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cfuncommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cfuncommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cfuncommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -17,6 +17,7 @@ #include #include +#include #include @@ -53,6 +54,7 @@ { TRACE_FUNC_ENTRY Cancel(); + iProperty.Close(); if (iProfileEngine != NULL) { iProfileEngine->Release(); @@ -62,6 +64,15 @@ void CCFUNCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/) { + TRACE_FUNC_ENTRY + + if (IsActive()) + { + iCallback->CreateReplyAndComplete(EReplyTypeError); + TRACE_FUNC_EXIT + return; + } + TInt ret = KErrNone; iReply.Zero(); TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType(); @@ -94,8 +105,7 @@ case (TAtCommandParser::ECmdHandlerTypeSet): { TInt func = 0; - TInt reset = 0; // default 0 - do not reset the MT before setting it to power level - + ret = iATCmdParser.NextIntParam(func); if (ret != KErrNone && ret != KErrNotFound) { @@ -103,73 +113,136 @@ TRACE_FUNC_EXIT return; } - ret = iATCmdParser.NextIntParam(reset); + iReset = 0; // default 0 - do not reset the MT before setting it to power level + ret = iATCmdParser.NextIntParam(iReset); // second parameter is optional, but only 0 and 1 are valid if it is specified - if (ret != KErrNone && ret != KErrNotFound && (reset != 0 || reset != 1)) + if (!(ret == KErrNone || ret == KErrNotFound) || !(iReset == 0 || iReset == 1)) { iCallback->CreateReplyAndComplete(EReplyTypeError); TRACE_FUNC_EXIT return; } - ret = ActivateProfile(func, reset); - + + ret = ActivateProfile(func); break; } default: { iCallback->CreateReplyAndComplete(EReplyTypeError); + break; } } - if (ret != KErrNone) + if (!IsActive()) { - iCallback->CreateReplyAndComplete(EReplyTypeError); - } - else - { - iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + if (ret != KErrNone) + { + iCallback->CreateReplyAndComplete(EReplyTypeError); + } + else + { + iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + } } TRACE_FUNC_EXIT } -void CCFUNCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - // no asyc requests are made in when using AT+CFUN - TRACE_FUNC_EXIT - } - - void CCFUNCommandHandler::RunL() { TRACE_FUNC_ENTRY - // no asyc requests are made in when using AT+CFUN + TInt systemState; + + TInt ret = iProperty.Get(systemState); + if (ret != KErrNone) + { + if (systemState != iExpectedState) + { + iProperty.Subscribe(iStatus); + SetActive(); + } + else if (iReset == 1) + { + ret = RestartDevice(); + } + } + if (!IsActive()) + { + if (ret != KErrNone) + { + iCallback->CreateReplyAndComplete(EReplyTypeError); + } + else + { + iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + } + } TRACE_FUNC_EXIT } void CCFUNCommandHandler::DoCancel() { TRACE_FUNC_ENTRY - // no asyc requests are made in when using AT+CFUN + iProperty.Cancel(); TRACE_FUNC_EXIT } -TInt CCFUNCommandHandler::ActivateProfile(TInt aFunc, TInt aReset) +TInt CCFUNCommandHandler::ActivateProfile(TInt aFunc) { - TInt err = KErrNone; + TRACE_FUNC_ENTRY + TInt systemState; + + //Listen to the property KPSGlobalSystemState for profile change. + TInt err = iProperty.Attach(KPSUidStartup, KPSGlobalSystemState); + if (err != KErrNone) + { + TRACE_FUNC_EXIT + return err; + } + + err = iProperty.Get(systemState); + if (err != KErrNone) + { + TRACE_FUNC_EXIT + return err; + } switch (aFunc) { case (0): case (4): { - err = SetActiveProfile(KOfflineProfileId); + // check of KPSGlobalSystemState is not already set to ESwStateNormalRfOff, + // issue the profile change request and start monitoring the property + if (systemState != ESwStateNormalRfOff) + { + err = SetActiveProfile(KOfflineProfileId); + + + if (err == KErrNone) + { + iExpectedState = ESwStateNormalRfOff; + iProperty.Subscribe(iStatus); + SetActive(); + } + } break; } case (1): { - err = SetActiveProfile(KGeneralProfileId); + // check of KPSGlobalSystemState is not already set to ESwStateNormalRfOn, + // issue the profile change request and start monitoring the property + if (systemState != ESwStateNormalRfOn) + { + err = SetActiveProfile(KGeneralProfileId); + + if (err == KErrNone) + { + iExpectedState = ESwStateNormalRfOn; + iProperty.Subscribe(iStatus); + SetActive(); + } + } break; } default: @@ -178,29 +251,26 @@ break; } } - - if (err == KErrNone && aReset == 1) - { - err = RestartDevice(); - } - + TRACE_FUNC_EXIT return err; } TInt CCFUNCommandHandler::SetActiveProfile(TInt aProfileId) { + TRACE_FUNC_ENTRY TInt err = KErrNone; if(iProfileEngine) { TRAP(err, iProfileEngine->SetActiveProfileL( aProfileId )); } - + TRACE_FUNC_EXIT return err; } TInt CCFUNCommandHandler::RestartDevice() { + TRACE_FUNC_ENTRY RStarterSession session; TInt err = session.Connect(); @@ -209,6 +279,6 @@ session.Reset(RStarterSession::EUnknownReset); session.Close(); } - + TRACE_FUNC_EXIT return err; } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/clckcommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -25,8 +25,6 @@ #include "atmisccmdpluginconsts.h" #include "debug.h" -const TInt KSCPMaxHashLength( 32 ); - CCLCKCommandHandler* CCLCKCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) { TRACE_FUNC_ENTRY @@ -304,13 +302,6 @@ return KErrNone; } -void CCLCKCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - void CCLCKCommandHandler::IssueCLCKCommand() { TRACE_FUNC_ENTRY @@ -327,7 +318,7 @@ } case (CCLCKCommandHandler::ECLCKLockSet): { - if (iPassword.Compare(KNullDesC8) == 0) + if (iPassword.Length() == 0) { iCallback->CreateReplyAndComplete( EReplyTypeError); } @@ -336,15 +327,14 @@ // Set the property to ignore security events in other clients // it allows to avoid GUI promt for security code TInt ret = KErrNone; - // TODO: reenable when KIgnoreSecurityEvent propety definition is submitted to codeline -// if (iLockType == RMobilePhone::ELockICC) -// { -// ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPin1Required); -// } -// else -// { -// ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPhonePasswordRequired); -// } + if (iLockType == RMobilePhone::ELockICC) + { + ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPin1Required); + } + else + { + ret = RProperty::Set(KPSUidStartup, KIgnoreSecurityEvent, EPSIgnoreSecurityEventEPhonePasswordRequired); + } Trace(KDebugPrintD, "RProperty::Set: ", ret); if (ret == KErrNone) { @@ -373,7 +363,7 @@ } case (CCLCKCommandHandler::ECLCKBarringSet): { - if (iPassword.Compare(KNullDesC8) == 0) + if (iPassword.Length() == 0) { iCallback->CreateReplyAndComplete(EReplyTypeError); } @@ -546,98 +536,97 @@ TInt CCLCKCommandHandler::ParseCCLCKCommand() { TRACE_FUNC_ENTRY - TCmdFacilityType facilityType = ECmdFacilityTypeUnknown; - TInt mode = 0; - TInt ret = KErrNone; - - TPtrC8 command = iATCmdParser.NextTextParam(ret); - if (!command.Compare(KNullDesC8) || ret != KErrNone) + TPtrC8 command; + TInt ret = iATCmdParser.NextTextParam(command); + if (ret != KErrNone) { TRACE_FUNC_EXIT return KErrArgument; } + TInt mode = 0; ret = iATCmdParser.NextIntParam(mode); - if (!command.Compare(KNullDesC8) || ret != KErrNone) + if (ret != KErrNone) { TRACE_FUNC_EXIT return KErrArgument; } - iPassword.Create(iATCmdParser.NextTextParam(ret)); - Trace(KDebugPrintD, "NextTextParam returned: ", ret); + TPtrC8 tmpPwd; + ret = iATCmdParser.NextTextParam(tmpPwd); if (ret != KErrNone && ret != KErrNotFound) { TRACE_FUNC_EXIT return KErrArgument; } - if (iPassword.Compare(KNullDesC8) != 0) + iPassword.Create(tmpPwd); + if (iPassword.Length() != 0) { - ret = iATCmdParser.NextIntParam(iInfoClass); - Trace(KDebugPrintD, "NextIntParam(iInfoClass): ", ret); + ret = iATCmdParser.NextIntParam(iInfoClass);; if (ret == KErrNotFound) { - iInfoClass = 7; + iInfoClass = 7; // Default value, see ETSI TS 127 007 V6.9.0 (2007-06) } - if ((ret != KErrNone && ret != KErrNotFound ) || - iATCmdParser.NextParam().Compare(KNullDesC8) != 0) + else if (ret != KErrNone || iATCmdParser.NextParam().Length() != 0) { TRACE_FUNC_EXIT return KErrArgument; } } - if (command.Compare(KATCLCKPS) == 0) + TCmdFacilityType facilityType = ECmdFacilityTypeUnknown; + + if (command.CompareF(KATCLCKPS) == 0) { // Lock phone to SIM on/off iSecurityCode = RMobilePhone::ESecurityCodePhonePassword; iLockType = RMobilePhone::ELockPhoneToICC; facilityType = ECmdFacilityTypeLock; } - else if (command.Compare(KATCLCKSC) == 0) + else if (command.CompareF(KATCLCKSC) == 0) { // PIN on/off iSecurityCode = RMobilePhone::ESecurityCodePin1; iLockType = RMobilePhone::ELockICC; facilityType = ECmdFacilityTypeLock; } - else if (command.Compare(KATCLCKAO) == 0) + else if (command.CompareF(KATCLCKAO) == 0) { iCondition = RMobilePhone::EBarAllOutgoing; facilityType = ECmdFacilityTypeBarring; } - else if (command.Compare(KATCLCKOI) == 0) + else if (command.CompareF(KATCLCKOI) == 0) { iCondition = RMobilePhone::EBarOutgoingInternational; facilityType = ECmdFacilityTypeBarring; } - else if (command.Compare(KATCLCKOX) == 0) + else if (command.CompareF(KATCLCKOX) == 0) { iCondition = RMobilePhone::EBarOutgoingInternationalExHC; facilityType = ECmdFacilityTypeBarring; } - else if (command.Compare(KATCLCKAI) == 0) + else if (command.CompareF(KATCLCKAI) == 0) { iCondition = RMobilePhone::EBarAllIncoming; facilityType = ECmdFacilityTypeBarring; } - else if (command.Compare(KATCLCKIR) == 0) + else if (command.CompareF(KATCLCKIR) == 0) { iCondition = RMobilePhone::EBarIncomingRoaming; facilityType = ECmdFacilityTypeBarring; } - else if (command.Compare(KATCLCKAB) == 0) + else if (command.CompareF(KATCLCKAB) == 0) { iCondition = RMobilePhone::EBarAllCases; facilityType = ECmdFacilityTypeAllBarring; } - else if (command.Compare(KATCLCKAG) == 0) + else if (command.CompareF(KATCLCKAG) == 0) { iCondition = RMobilePhone::EBarAllOutgoingServices; facilityType = ECmdFacilityTypeAllBarring; } - else if (command.Compare(KATCLCKAC) == 0) + else if (command.CompareF(KATCLCKAC) == 0) { iCondition = RMobilePhone::EBarAllIncomingServices; facilityType = ECmdFacilityTypeAllBarring; @@ -682,10 +671,6 @@ case (ECmdFacilityTypeBarring): { iCBInfo.iPassword.Copy(iPassword); - if (iInfoClass == 0) - { - iInfoClass = 7; // Default value, see ETSI TS 127 007 V6.9.0 (2007-06) - } switch (mode) { case 0: // AT+CLCK="AO",0 diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cnumcommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cnumcommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cnumcommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -126,13 +126,6 @@ TRACE_FUNC_EXIT } -void CCNUMCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - void CCNUMCommandHandler::RunL() { TRACE_FUNC_ENTRY @@ -162,7 +155,7 @@ { ASSERT(iPendingEvent == EMobilePhoneStoreRead); // step 5 append a phone number entry to the reply buffer - if(iOwnNumberEntry.iNumber.iTelNumber.Compare(KNullDesC) != 0) + if(iOwnNumberEntry.iNumber.iTelNumber.Length() != 0) { // 129 is the type of address octet in interger format _LIT8(KATNumReply, "\r\n+CNUM: ,\"%S\",129"); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -18,7 +18,7 @@ #include "cpincommandhandler.h" #include // define AO wrapper -#include // Additional RMobilePhone error code +#include // Additional RMobilePhone error code #include "debug.h" @@ -82,48 +82,39 @@ TRACE_FUNC_EXIT } -void CCPINCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - void CCPINCommandHandler::ChangePassword() { TRACE_FUNC_ENTRY - TRequestStatus status; - + TPtrC8 pukCode8; + TPtrC8 pinCode8; + // Get parameters from AT command - TInt ret1; - TInt ret2; - TPtrC8 pukCode8 = iATCmdParser.NextTextParam(ret1); - TPtrC8 pinCode8 = iATCmdParser.NextTextParam(ret2); + TInt ret1 = iATCmdParser.NextTextParam(pukCode8); + TInt ret2 = iATCmdParser.NextTextParam(pinCode8); + if(ret1 != KErrNone || ret2 != KErrNone - || iATCmdParser.NextParam().Compare(KNullDesC8) != 0) + || iATCmdParser.NextParam().Length() != 0) { iCallback->CreateReplyAndComplete( EReplyTypeError); - TRACE_FUNC_EXIT - return; + } + else + { + RMobilePhone::TMobilePassword pukCode; + RMobilePhone::TMobilePassword pinCode; + pukCode.Copy(pukCode8); + pinCode.Copy(pinCode8); + iPhone.VerifySecurityCode(iStatus, RMobilePhone::ESecurityCodePuk1, pinCode, pukCode); + // re-use the AO for VerifySecurityCode + iPendingEvent = EMobilePhoneVerifySecurityCode; + SetActive(); } - RMobilePhone::TMobilePassword pukCode; - RMobilePhone::TMobilePassword pinCode; - pukCode.Copy(pukCode8); - pinCode.Copy(pinCode8); - iPhone.VerifySecurityCode(iStatus, RMobilePhone::ESecurityCodePuk1, pinCode, pukCode); - // re-use the AO for VerifySecurityCode - iPendingEvent = EMobilePhoneVerifySecurityCode; - SetActive(); - TRACE_FUNC_EXIT - return; } void CCPINCommandHandler::RunL() { TRACE_FUNC_ENTRY - if( iPendingEvent == EMobilePhoneGetLockInfo) { // after calling GetLockInfo HandleGetLockInfo(); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cpwdcommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cpwdcommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cpwdcommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -15,32 +15,25 @@ // // - -#include // AO - #include "cpwdcommandhandler.h" +#include + +#include "atmisccmdpluginconsts.h" #include "debug.h" - // password types _LIT8(KATCPWDPS, "PS"); // Phone lock _LIT8(KATCPWDP2, "P2"); // PIN2 _LIT8(KATCPWDSC, "SC"); // PIN _LIT8(KATCPWDAB, "AB"); // All Barring code - - // strings for debugging trace _LIT8(KDbgStr, "+CPWD: %s \r\n"); _LIT8(KDbgTDes, "+CPWD: %s%S\r\n"); // constant for Set All barring code service - originally defined in mw/PSetConstants.h const TInt KPsetAllSSServices = 0; -// Max buffer length for an MD5 digest - originally defined in SCPServerInterface.h -const TInt KSCPMaxHashLength( 32 ); - - CCPWDCommandHandler* CCPWDCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) { @@ -94,28 +87,20 @@ TRACE_FUNC_EXIT } -void CCPWDCommandHandler::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - - void CCPWDCommandHandler::ChangePassword() { TRACE_FUNC_ENTRY // Get parameters from AT command - TInt ret1; - TInt ret2; - TInt ret3; - TPtrC8 passwordType = iATCmdParser.NextTextParam(ret1); - TPtrC8 oldPassword = iATCmdParser.NextTextParam(ret2); - TPtrC8 newPassword = iATCmdParser.NextTextParam(ret3); + TPtrC8 passwordType; + TPtrC8 oldPassword; + TPtrC8 newPassword; + TInt ret1 = iATCmdParser.NextTextParam(passwordType); + TInt ret2 = iATCmdParser.NextTextParam(oldPassword); + TInt ret3 = iATCmdParser.NextTextParam(newPassword); if(ret1 != KErrNone || ret2 != KErrNone || ret3 != KErrNone - || iATCmdParser.NextParam().Compare(KNullDesC8) != 0) + || iATCmdParser.NextParam().Length() != 0) { Trace(KDbgStr, "invalid arguments"); iCallback->CreateReplyAndComplete( EReplyTypeError); @@ -123,11 +108,11 @@ return; } - if(passwordType.Compare(KATCPWDPS) == 0) // Phone lock + if(passwordType.CompareF(KATCPWDPS) == 0) // Phone lock { - // "PS" PH-SIM (lock PHone to SIM/UICC card) (MT asks password when other than current SIM/UICC card - // inserted; MT may remember certain amount of previously used cards thus not requiring password when they - // are inserted) + // "PS" PH-SIM (lock PHone to SIM/UICC card) (MT asks password when other than current SIM/UICC card + // inserted; MT may remember certain amount of previously used cards thus not requiring password when they + // are inserted) RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange; // Phone lock password is hashed in RSPClient and NokiaTSY. See CSCPServer::HashISACode() for details. @@ -138,7 +123,7 @@ ChangeSecurityCode(RMobilePhone::ESecurityCodePhonePassword, hashOldPwd, hashNewPwd); } - else if(passwordType.Compare(KATCPWDSC) == 0) // SIM pin + else if(passwordType.CompareF(KATCPWDSC) == 0) // SIM pin { // "SC" SIM (lock SIM/UICC card) (SIM/UICC asks password in MT power-up and when this lock command // issued) @@ -147,11 +132,11 @@ // should check SIM Lock is on here and return an error if it is off. ChangeSecurityCode(RMobilePhone::ESecurityCodePin1, oldPassword, newPassword); } - else if(passwordType.Compare(KATCPWDP2) == 0) // SIM pin2 + else if(passwordType.CompareF(KATCPWDP2) == 0) // SIM pin2 { ChangeSecurityCode(RMobilePhone::ESecurityCodePin2, oldPassword, newPassword); } - else if(passwordType.Compare(KATCPWDAB) == 0) // All Barring services + else if(passwordType.CompareF(KATCPWDAB) == 0) // All Barring services { // "AB" All Barring services (refer 3GPP TS 22.030 [19]) (applicable only for =0) RMobilePhone::TMobilePhonePasswordChangeV2 passwordChange; @@ -171,9 +156,7 @@ Trace(KDbgTDes, "unknown password type:", &passwordType); iCallback->CreateCMEReplyAndComplete(KErrUnknown); } - TRACE_FUNC_EXIT - return; } void CCPWDCommandHandler::RunL() @@ -203,10 +186,12 @@ void CCPWDCommandHandler::ChangeSecurityCode(RMobilePhone::TMobilePhoneSecurityCode aType, TDesC8& aOldPassword, TDesC8& aNewPassword) { + TRACE_FUNC_ENTRY RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange; passwordChange.iOldPassword.Copy(aOldPassword); passwordChange.iNewPassword.Copy(aNewPassword); iPhone.ChangeSecurityCode(iStatus, aType, passwordChange); iPendingEvent = EMobilePhoneChangeSecurityCode; SetActive(); + TRACE_FUNC_EXIT } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cusdcommandhandler.cpp --- a/cbsatplugin/atmisccmdplugin/src/cusdcommandhandler.cpp Mon May 17 11:06:23 2010 +0300 +++ b/cbsatplugin/atmisccmdplugin/src/cusdcommandhandler.cpp Fri May 28 17:03:06 2010 +0300 @@ -15,8 +15,10 @@ #include +#include "ussdreadmessageimpl.h" +#include "ussdsendmessageimpl.h" + #include "atmisccmdpluginconsts.h" -#include "cusdreadwriteimp.h" #include "debug.h" const TUint8 KPhCltUssdCarriageReturn = 0x0d; @@ -42,7 +44,7 @@ } CCUSDCommandHandler::CCUSDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) : - CATCmdAsyncBase(aCallback, aATCmdParser, aPhone) + CATCmdSyncBase(aCallback, aATCmdParser, aPhone) { TRACE_FUNC_ENTRY iSendAttributes.iDcs = KPhCltUssdDcsNotSet; @@ -54,10 +56,12 @@ void CCUSDCommandHandler::ConstructL() { TRACE_FUNC_ENTRY + iReply.CreateL(KDefaultCmdBufLength); + User::LeaveIfError(iUssdMessaging.Open(iPhone)); - iUSSDSender = CCUSSDSendMessageImpl::NewL(this, iUssdMessaging); - iUSSDReader = CCUSSDReadMessageImpl::NewL(this, iUssdMessaging); + iUSSDSender = CUSSDSendMessageImpl::NewL(this, iUssdMessaging); + iUSSDReader = CUSSDReadMessageImpl::NewL(this, iUssdMessaging); //start a read session for network based ussd requests User::LeaveIfError(iUSSDReader->ReadUSSDMessage(iReceivedData, iReceiveAttributes)); @@ -75,25 +79,18 @@ TRACE_FUNC_EXIT } -void CCUSDCommandHandler::DoCancel() - { - TRACE_FUNC_ENTRY - // This would never get called as the AO is never activated - TRACE_FUNC_EXIT - } - -void CCUSDCommandHandler::HandleCommand( const TDesC8& aCmd, +void CCUSDCommandHandler::HandleCommand( const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/ ) { TRACE_FUNC_ENTRY TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType(); - + iReply.Zero(); + switch (cmdHandlerType) { case (TAtCommandParser::ECmdHandlerTypeTest): { - iReply.Create(KDefaultCmdBufLength); iReply.Append(KCRLF); iReply.Append(KCUSDSupportedCmdsList); iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); @@ -101,7 +98,6 @@ } case (TAtCommandParser::ECmdHandlerTypeRead): { - iReply.Create(KDefaultCmdBufLength); iReply.Append(KCRLF); iReply.Append(KAtCUSD); iReply.AppendNum(iDisplayRetMessage); @@ -112,28 +108,23 @@ } case (TAtCommandParser::ECmdHandlerTypeSet): { - if(ParseCUSDCmd(aCmd) == KErrNone) + if(ParseCUSDCmd() == KErrNone) { if(iUSSDCommand.Length() == 0) { Trace(KDebugPrintD, "No USSD command: ", iUSSDCommand.Length()); - + // the USSD command is not set then this is a set - iReply.Create(KDefaultCmdBufLength); - iReply.Append(KCRLF); - iReply.Append(KAtCUSD); - iReply.AppendNum(iDisplayRetMessage); - iReply.Append(KCRLF); - - iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + iReply.Append( KOKCRLF ); + iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply); } else { - if(iUSSDSender->HandleSendUSSDCmd(iUSSDCommand, iSendAttributes) == KErrNone) + if(iUSSDSender->SendUSSDCmd(iUSSDCommand, iSendAttributes) == KErrNone) { iSendCommandSent = ETrue; } - else + else { iCallback->CreateReplyAndComplete(EReplyTypeError); } @@ -155,121 +146,131 @@ TRACE_FUNC_EXIT } -void CCUSDCommandHandler::RunL() - { - TRACE_FUNC_ENTRY - // This would never get called as the AO is never activated - TRACE_FUNC_EXIT - } - - void CCUSDCommandHandler::HandleCommandCancel() { TRACE_FUNC_ENTRY iUSSDSender->Cancel(); + iSendCommandSent = EFalse; TRACE_FUNC_EXIT } -TInt CCUSDCommandHandler::ParseCUSDCmd(const TDesC8& aCmd) +TInt CCUSDCommandHandler::ParseCUSDCmd() { TRACE_FUNC_ENTRY - iReply.Create(KDefaultCmdBufLength); - TBool tempRetMessage = EFalse; - TInt ret = iATCmdParser.NextIntParam(tempRetMessage); - - if(ret == KErrNone) + TInt tempDispValue; + TInt ret = iATCmdParser.NextIntParam(tempDispValue); + + + if (ret == KErrNone && tempDispValue >= 0 && tempDispValue < 3) { - if(tempRetMessage < 0 || tempRetMessage > 2) - { - Trace(KDebugPrintD, "Display mode invalid: ", tempRetMessage); - TRACE_FUNC_EXIT - return KErrGeneral; - } - else - { - iDisplayRetMessage = tempRetMessage; - } + Trace(KDebugPrintD, "tempDispValue: ", tempDispValue); + iDisplayRetMessage = tempDispValue; + } + else if (ret != KErrNotFound) + { + Trace(KDebugPrintD, "First NextIntParam failed: ", ret); + TRACE_FUNC_EXIT + return KErrGeneral; } // now parse the USSD command - TPtrC8 command = iATCmdParser.NextTextParam(ret); - - if (ret == KErrNone) + TPtrC8 command; + ret = iATCmdParser.NextTextParam(command); + if (ret == KErrNone ) { if(iUSSDCommand.Create(command.Length()) != KErrNone) - { - TRACE_FUNC_EXIT - return KErrGeneral; - } - - if(Pack(command, iUSSDCommand) < 0) - { - Trace(KDebugPrintS, "Pack() returned error, command: ", &command); - TRACE_FUNC_EXIT - return KErrGeneral; - } - } - - TInt tempDcs = -1; - ret = iATCmdParser.NextIntParam(tempDcs); - - if(ret == KErrNone) - { - if(!IsDcsValid(tempDcs)) { - Trace(KDebugPrintD, "Invalid coding standard: ", tempDcs); + Trace(KDebugPrintD, "iUSSDCommand.Create() failed ", ret); TRACE_FUNC_EXIT return KErrGeneral; } - else + + Trace(KDebugPrintS, "command: ", &command); + if(Pack(command, iUSSDCommand) < 0) { - iSendAttributes.iDcs = tempDcs; - } - } + Trace(KDebugPrintS, "Pack() returned error, command: ", &command); + TRACE_FUNC_EXIT + return KErrGeneral; + } + } + else if (ret != KErrNotFound) + { + TRACE_FUNC_EXIT + return KErrGeneral; + } + TInt dcs = 0; // 3GPP TS 23.038 [25] Cell Broadcast Data Coding Scheme in integer format (default 0) + ret = iATCmdParser.NextIntParam(dcs); + + Trace(KDebugPrintD, "ret: ", ret); + Trace(KDebugPrintD, "IsDcsValid(dcs): ", IsDcsValid(dcs)); + Trace(KDebugPrintD, "iATCmdParser.NextParam().Length(): ", iATCmdParser.NextParam().Length()); + if(ret != KErrNone && ret != KErrNotFound || !IsDcsValid(dcs) || + iATCmdParser.NextParam().Length() != 0) + { + Trace(KDebugPrintD, "Second NextIntParam failed: ", ret); + TRACE_FUNC_EXIT + return KErrGeneral; + } + else + { + // dcs will have the default value if no parameter is given in the command line + Trace(KDebugPrintD, "dcs ", dcs); + iSendAttributes.iDcs = dcs; + } + TRACE_FUNC_EXIT return KErrNone; } -void CCUSDCommandHandler::HandleSendMessageComplete(TInt aResult) +void CCUSDCommandHandler::HandleSendMessageComplete(TInt aError) + { + TRACE_FUNC_ENTRY + if (aError != KErrNone) + { + // Only respond from a Send USSD request if there has been an error + iCallback->CreateReplyAndComplete(EReplyTypeError); + } + else if (iDisplayRetMessage == 0) + { + // if display mode is 0 then no response apart from OK should be displayed + iCallback->CreateReplyAndComplete( EReplyTypeOther, KOKCRLF ); + } + + iUSSDCommand.Close(); + TRACE_FUNC_EXIT + } + +void CCUSDCommandHandler::HandleReadMessageComplete(TInt aError) { TRACE_FUNC_ENTRY - if(aResult == KErrNone) + if(aError == KErrNone) { - iReply.Create(KDefaultCmdBufLength); - iReply.Append(KCRLF); - iReply.Append(KAtCUSD); - iReply.Append(KCRLF); - iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + if(iDisplayRetMessage) + { + FormatUSSDReceivedData(); + + if(iSendCommandSent) + { + iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); + } + else + { + iCallback->HandleUnsolicitedRequest(iReply); + } + } + + // as we have received the data initiated by the send USSD request we set + // this parameter to EFalse + iSendCommandSent = EFalse; + + // re-issue the read request + iUSSDReader->ReadUSSDMessage(iReceivedData, iReceiveAttributes); } else { iCallback->CreateReplyAndComplete(EReplyTypeError); } - - iSendCommandSent = EFalse; - iUSSDCommand.Close(); - TRACE_FUNC_EXIT - } - -void CCUSDCommandHandler::HandleReadMessageComplete(TInt aResult) - { - TRACE_FUNC_ENTRY - if(iDisplayRetMessage) - { - FormatUSSDReceivedData(); - - if(iSendCommandSent) - { - iCallback->CreateReplyAndComplete( EReplyTypeOther, iReply ); - } - else - { - iCallback->HandleUnsolicitedRequest(iReply); - } - } - // re-issue the read request - iUSSDReader->ReadUSSDMessage(iReceivedData, iReceiveAttributes); TRACE_FUNC_EXIT } @@ -280,7 +281,7 @@ // Ensure we've got the right length TInt packedOctetsRequired = PackedOctetsRequired( aIn.Length() ); - if ( packedOctetsRequired > ( aOut.MaxLength() - aOut.Length() ) ) + if (packedOctetsRequired > ( aOut.MaxLength() - aOut.Length() ) ) { Trace(KDebugPrintD, "packedOctetsRequired: ", packedOctetsRequired); TRACE_FUNC_EXIT @@ -289,72 +290,84 @@ // Do the conversion TInt elementSizeInBits = ElementSizeInBits(TSmsDataCodingScheme::ESmsAlphabet7Bit); - if ( elementSizeInBits == 8 ) // 8 bit data + + Trace(KDebugPrintD, "elementSizeInBits = : ", elementSizeInBits); + if (elementSizeInBits == 8) // 8 bit data { // Straight copy here aOut.Append( aIn ); } - else if ( elementSizeInBits == 7 ) // Need packing to 7-bit - { - // Get raw pointers and do packing - TUint8* outPtr = ( TUint8* )aOut.Ptr() + aOut.Length(); - const TUint8* inPtr = aIn.Ptr(); + else if (elementSizeInBits == 7) // Need packing to 7-bit + { + Trace(KDebugPrintS, "aOut: ", &aOut); + Trace(KDebugPrintS, "aIn: ", &aIn); + + // Get raw pointers and do packing + TUint8* outPtr = ( TUint8* )aOut.Ptr() + aOut.Length(); + const TUint8* inPtr = aIn.Ptr(); - outPtr[0] = 0; - for ( TInt i = 0; i < aIn.Length() ; ++i ) - { - TUint8 to = inPtr[i]; - *outPtr |= ( to << startBit ); - if ( startBit ) + TInt inLength = aIn.Length(); + outPtr[0] = 0; + + Trace(KDebugPrintD, "inLength = : ", inLength); + for (TInt i = 0; i < inLength; ++i) + { + TUint8 to = inPtr[i]; + *outPtr |= ( to << startBit ); + + if (startBit) + { + ++outPtr; + *outPtr = ( TUint8 ) ( to >> ( 8 - startBit ) ); + } + + startBit = (startBit + 7) % 8; // roll 0,1,2,3,4,5,6,7,0,1,2,... + } + + Trace(KDebugPrintD, "startBit = : ", startBit); + + if ((inPtr[inLength - 1] == KPhCltUssdCarriageReturn && startBit == 0) || startBit == 1 ) + { + //We have to add one CR more + *outPtr |= ( KPhCltUssdCarriageReturn << startBit ); + + if (startBit) { ++outPtr; - *outPtr = ( TUint8 ) ( to >> ( 8 - startBit ) ); + *outPtr = (TUint8) (KPhCltUssdCarriageReturn >> (8 - startBit)); + } + else + { + ++packedOctetsRequired; } - startBit = ( startBit + 7 )%8; // roll 0,1,2,3,4,5,6,7,0,1,2,... - - if ( i == aIn.Length() - 1 ) // if this is the last time - { - if ( ( to == KPhCltUssdCarriageReturn && startBit == 0 ) || - startBit == 1 ) - { - //We have to add one CR more - *outPtr |= ( KPhCltUssdCarriageReturn << startBit ); - if ( startBit ) - { - ++outPtr; - *outPtr = ( TUint8 ) ( KPhCltUssdCarriageReturn >> ( 8 - startBit ) ); - } - else - { - ++packedOctetsRequired; - } - startBit = ( startBit + 7 )%8; - } - } - } - // Increment the length for the packed data - aOut.SetLength( aOut.Length() + packedOctetsRequired ); + startBit = (startBit + 7)%8; } + + // Increment the length for the packed data + aOut.SetLength(aOut.Length() + packedOctetsRequired); + + Trace(KDebugPrintD, "aOut.Length() = : ", aOut.Length()); + } // Return number of bytes used TRACE_FUNC_EXIT return packedOctetsRequired; } - TInt CCUSDCommandHandler::PackedOctetsRequired( TInt aNumUDUnits ) const + TInt CCUSDCommandHandler::PackedOctetsRequired(TInt aNumUDUnits) const { TRACE_FUNC_ENTRY TInt startBit = 0; TInt octetsRequired = 0; TInt elementSizeInBits = ElementSizeInBits(TSmsDataCodingScheme::ESmsAlphabet7Bit); - if ( elementSizeInBits == 8 ) + if (elementSizeInBits == 8) { octetsRequired=aNumUDUnits; } else { - octetsRequired = ( startBit + aNumUDUnits*elementSizeInBits + 7 )/8; // Rounds up + octetsRequired = (startBit + aNumUDUnits*elementSizeInBits + 7 )/8; // Rounds up } TRACE_FUNC_EXIT return octetsRequired; @@ -363,13 +376,13 @@ TBool CCUSDCommandHandler::IsDcsValid( const TUint8 aDcs ) const { TRACE_FUNC_ENTRY - TBool isDcsValid( EFalse ); + TBool isDcsValid(EFalse); // 76543210 TUint8 codingGroup = ( aDcs & 0xF0 ) >> KHighNibbleShift; // bits XXXX____ TUint8 characterSet = ( aDcs & 0x0C ) >> KQuarterShift; // bits ____XX__ TUint8 lowQuartet = ( aDcs & 0x0F ); // bits ____XXXX - switch ( codingGroup ) + switch (codingGroup) { case 0x00: case 0x02: @@ -404,6 +417,10 @@ } break; } + default: + { + break; + } } TRACE_FUNC_EXIT return isDcsValid; @@ -413,7 +430,7 @@ { TRACE_FUNC_ENTRY TInt ret; - switch ( aAlphabet ) + switch (aAlphabet) { case TSmsDataCodingScheme::ESmsAlphabet7Bit: { @@ -438,8 +455,8 @@ void CCUSDCommandHandler::FormatUSSDReceivedData() { TRACE_FUNC_ENTRY - iReply.Create(KDefaultCmdBufLength); - + iReply.Zero(); + iReply.Append(KCRLF); iReply.Append(KAtCUSD); iReply.AppendNum(iDisplayRetMessage); diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/cusdreadwriteimp.cpp --- a/cbsatplugin/atmisccmdplugin/src/cusdreadwriteimp.cpp Mon May 17 11:06:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * Description : - * - */ - -#include "cusdreadwriteimp.h" - -#include "cusdcommandhandler.h" -#include "debug.h" - -CCUSSDReadMessageImpl* CCUSSDReadMessageImpl::NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession) - { - TRACE_FUNC_ENTRY - CCUSSDReadMessageImpl* self = new(ELeave) CCUSSDReadMessageImpl(aCallback, aUssdSession); - TRACE_FUNC_EXIT - return self; - } - -CCUSSDReadMessageImpl::CCUSSDReadMessageImpl(MUSSDCallback* aCallback, - RMobileUssdMessaging& aUssdSession): - CActive(CActive::EPriorityStandard), - iCallback(aCallback), - iUssdSession(aUssdSession) - { - TRACE_FUNC_ENTRY - CActiveScheduler::Add(this); - TRACE_FUNC_EXIT - } - -CCUSSDReadMessageImpl::~CCUSSDReadMessageImpl() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } - -void CCUSSDReadMessageImpl::RunL() - { - TRACE_FUNC_ENTRY - iCallback->HandleReadMessageComplete(iStatus.Int()); - TRACE_FUNC_EXIT - } - -void CCUSSDReadMessageImpl::DoCancel() - { - TRACE_FUNC_ENTRY - iUssdSession.CancelAsyncRequest(EMobileUssdMessagingReceiveMessage); - TRACE_FUNC_EXIT - } - -TInt CCUSSDReadMessageImpl::ReadUSSDMessage(TDes8& aReceivedData, - RMobileUssdMessaging::TMobileUssdAttributesV1& aUssdReadAttribute) - { - TRACE_FUNC_ENTRY - - TInt retCode = KErrNone; - if(!IsActive()) - { - TPckg msgAttributes(aUssdReadAttribute); - iUssdSession.ReceiveMessage(iStatus, aReceivedData, msgAttributes); - SetActive(); - } - else - { - retCode = KErrInUse; - } - - TRACE_FUNC_EXIT - return retCode; - } - -CCUSSDSendMessageImpl* CCUSSDSendMessageImpl::NewL(MUSSDCallback* aCallback, - RMobileUssdMessaging& aUssdSession) - { - TRACE_FUNC_ENTRY - CCUSSDSendMessageImpl* self = new(ELeave) CCUSSDSendMessageImpl(aCallback, aUssdSession); - TRACE_FUNC_EXIT - return self; - } - -CCUSSDSendMessageImpl::CCUSSDSendMessageImpl(MUSSDCallback* aCallback, - RMobileUssdMessaging& aUssdSession): - CActive(CActive::EPriorityStandard), - iCallback(aCallback), - iUssdSession(aUssdSession) - { - TRACE_FUNC_ENTRY - CActiveScheduler::Add(this); - TRACE_FUNC_EXIT - } - -void CCUSSDSendMessageImpl::RunL() - { - TRACE_FUNC_ENTRY - iCallback->HandleSendMessageComplete(iStatus.Int()); - TRACE_FUNC_EXIT - } - -void CCUSSDSendMessageImpl::DoCancel() - { - TRACE_FUNC_ENTRY - iUssdSession.CancelAsyncRequest(EMobileUssdMessagingSendMessage); - TRACE_FUNC_EXIT - } - -TInt CCUSSDSendMessageImpl::HandleSendUSSDCmd(const TDesC8& aCmd, - RMobileUssdMessaging::TMobileUssdAttributesV1& aUSSDAttribute) - { - TRACE_FUNC_ENTRY - TInt retCode = KErrNone; - if(!IsActive()) - { - // Get USSD messaging caps - RMobileUssdMessaging::TMobileUssdCapsV1 ussdCaps; - RMobileUssdMessaging::TMobileUssdCapsV1Pckg ussdCapsPckg(ussdCaps); - - iUssdSession.GetCaps(ussdCapsPckg); - ussdCaps=ussdCapsPckg(); - - if(ussdCaps.iUssdFormat != RMobileUssdMessaging::KCapsPackedString) - { - retCode = KErrArgument; - } - else - { - // we only support packed strings? - aUSSDAttribute.iFormat = RMobileUssdMessaging::EFormatPackedString; - TPckg msgAttributes(aUSSDAttribute); - iUssdSession.SendMessage(iStatus, aCmd, msgAttributes); - SetActive(); - } - } - else - { - retCode = KErrInUse; - } - TRACE_FUNC_EXIT - return retCode; - } - -CCUSSDSendMessageImpl::~CCUSSDSendMessageImpl() - { - TRACE_FUNC_ENTRY - Cancel(); - TRACE_FUNC_EXIT - } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/ussdreadmessageimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/src/ussdreadmessageimpl.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,79 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * Description : + * + */ + +#include "ussdreadmessageimpl.h" + +#include "cusdcommandhandler.h" +#include "debug.h" + +CUSSDReadMessageImpl* CUSSDReadMessageImpl::NewL(MUSSDCallback* aCallback, RMobileUssdMessaging& aUssdSession) + { + TRACE_FUNC_ENTRY + CUSSDReadMessageImpl* self = new(ELeave) CUSSDReadMessageImpl(aCallback, aUssdSession); + TRACE_FUNC_EXIT + return self; + } + +CUSSDReadMessageImpl::CUSSDReadMessageImpl(MUSSDCallback* aCallback, + RMobileUssdMessaging& aUssdSession): + CActive(CActive::EPriorityStandard), + iCallback(aCallback), + iUssdSession(aUssdSession) + { + TRACE_FUNC_ENTRY + CActiveScheduler::Add(this); + TRACE_FUNC_EXIT + } + +CUSSDReadMessageImpl::~CUSSDReadMessageImpl() + { + TRACE_FUNC_ENTRY + Cancel(); + TRACE_FUNC_EXIT + } + +void CUSSDReadMessageImpl::RunL() + { + TRACE_FUNC_ENTRY + iCallback->HandleReadMessageComplete(iStatus.Int()); + TRACE_FUNC_EXIT + } + +void CUSSDReadMessageImpl::DoCancel() + { + TRACE_FUNC_ENTRY + iUssdSession.CancelAsyncRequest(EMobileUssdMessagingReceiveMessage); + TRACE_FUNC_EXIT + } + +TInt CUSSDReadMessageImpl::ReadUSSDMessage(TDes8& aReceivedData, + RMobileUssdMessaging::TMobileUssdAttributesV1& aUssdReadAttribute) + { + TRACE_FUNC_ENTRY + + TInt retCode = KErrNone; + if(!IsActive()) + { + TPckg msgAttributes(aUssdReadAttribute); + iUssdSession.ReceiveMessage(iStatus, aReceivedData, msgAttributes); + SetActive(); + } + else + { + retCode = KErrInUse; + } + + TRACE_FUNC_EXIT + return retCode; + } diff -r a0ea99b6fa53 -r 19bd632b5100 cbsatplugin/atmisccmdplugin/src/ussdsendmessageimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cbsatplugin/atmisccmdplugin/src/ussdsendmessageimpl.cpp Fri May 28 17:03:06 2010 +0300 @@ -0,0 +1,94 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * Description : + * + */ + +#include "ussdsendmessageimpl.h" + +#include "cusdcommandhandler.h" +#include "debug.h" + +CUSSDSendMessageImpl* CUSSDSendMessageImpl::NewL(MUSSDCallback* aCallback, + RMobileUssdMessaging& aUssdSession) + { + TRACE_FUNC_ENTRY + CUSSDSendMessageImpl* self = new(ELeave) CUSSDSendMessageImpl(aCallback, aUssdSession); + TRACE_FUNC_EXIT + return self; + } + +CUSSDSendMessageImpl::CUSSDSendMessageImpl(MUSSDCallback* aCallback, + RMobileUssdMessaging& aUssdSession): + CActive(CActive::EPriorityStandard), + iCallback(aCallback), + iUssdSession(aUssdSession) + { + TRACE_FUNC_ENTRY + CActiveScheduler::Add(this); + TRACE_FUNC_EXIT + } + +void CUSSDSendMessageImpl::RunL() + { + TRACE_FUNC_ENTRY + iCallback->HandleSendMessageComplete(iStatus.Int()); + TRACE_FUNC_EXIT + } + +void CUSSDSendMessageImpl::DoCancel() + { + TRACE_FUNC_ENTRY + iUssdSession.CancelAsyncRequest(EMobileUssdMessagingSendMessage); + TRACE_FUNC_EXIT + } + +TInt CUSSDSendMessageImpl::SendUSSDCmd(const TDesC8& aCmd, + RMobileUssdMessaging::TMobileUssdAttributesV1& aUSSDAttribute) + { + TRACE_FUNC_ENTRY + TInt retCode = KErrNone; + if(!IsActive()) + { + // Get USSD messaging caps + RMobileUssdMessaging::TMobileUssdCapsV1 ussdCaps; + RMobileUssdMessaging::TMobileUssdCapsV1Pckg ussdCapsPckg(ussdCaps); + + iUssdSession.GetCaps(ussdCapsPckg); + ussdCaps=ussdCapsPckg(); + + if(ussdCaps.iUssdFormat != RMobileUssdMessaging::KCapsPackedString) + { + retCode = KErrArgument; + } + else + { + // we only support packed strings? + aUSSDAttribute.iFormat = RMobileUssdMessaging::EFormatPackedString; + TPckg msgAttributes(aUSSDAttribute); + iUssdSession.SendMessage(iStatus, aCmd, msgAttributes); + SetActive(); + } + } + else + { + retCode = KErrInUse; + } + TRACE_FUNC_EXIT + return retCode; + } + +CUSSDSendMessageImpl::~CUSSDSendMessageImpl() + { + TRACE_FUNC_ENTRY + Cancel(); + TRACE_FUNC_EXIT + } diff -r a0ea99b6fa53 -r 19bd632b5100 group/bld.inf --- a/group/bld.inf Mon May 17 11:06:23 2010 +0300 +++ b/group/bld.inf Fri May 28 17:03:06 2010 +0300 @@ -23,6 +23,7 @@ #include "../bluetoothengine/group/bld.inf" #include "../atcommands/group/bld.inf" #include "../cbsatplugin/group/bld.inf" +#include "../btobexprofiles/group/bld.inf" PRJ_EXPORTS