# HG changeset patch # User Pat Downey # Date 1283340004 -3600 # Node ID 9386f31cc85b0fb39ff6b05efa42788447be4440 # Parent 613943a2100484dc9ebaeb758eb947a419a27349 Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035 diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -20,6 +20,8 @@ @file */ +#include "../../../../../../os/bt/bluetoothmgmt/btcommon/config.cfg" + #include TARGET remconbeareravrcp.dll diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -88,7 +88,6 @@ void ClientStatus(TBool aControllerPresent, TBool aTargetPresent); TInt SetLocalAddressedClient(const TRemConClientId& aId); void ControllerFeaturesUpdatedL(RArray& aSupportedInterfaces); - void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); MIncomingCommandHandler& InternalCommandHandler(); // Interface to command handler @@ -107,10 +106,7 @@ void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); void MpsoError(TRemConClientId aId); - // Helper function for ClientAvailable and TargetFeaturesUpdated - TInt SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); - void UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem); - + //--------------------------------------------------------- // Bulk thread only functions //--------------------------------------------------------- diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -118,8 +118,6 @@ virtual TInt SetLocalAddressedClient(TRemConClientId& aId); - virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); - private: // from CRemConBearerPlugin TAny* GetInterface(TUid aUid); diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -564,13 +564,13 @@ // Can ignore this as we know we have allocated a big enough buffer TRAP_IGNORE(response.WriteL(responseBuf)); - - iCommandInterface.MrccciSetAddressedClient(iClientId); break; } }; SendInternalResponse(aId, responseBuf); + iCommandInterface.MrccciSetAddressedClient(iClientId); + responseBuf.Close(); } diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -133,33 +133,7 @@ iUidWatcher = NULL; } -// Helper function for ClientAvailable and TargetFeaturesUpdated -TInt CAvrcpPlayerInfoManager::SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - aItem.iPlayerType = aPlayerType; - aItem.iPlayerSubType = aPlayerSubType; - aItem.iName.Set(aName); - aItem.iFeatureBitmask = TPlayerFeatureBitmask(); - return SetPlayerFeatures(aItem.iId, aItem.iFeatureBitmask, aItem.iSdpFeatures, aItem.iAbsoluteVolumeSupport); - } - -// Helper function for ClientAvailable and TargetFeaturesUpdated -void CAvrcpPlayerInfoManager::UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem) - { - // Update SDP record, if this fails we carry on, it's non-fatal - TInt sdpErr = KErrNone; - if(!iTargetRecord) - { - TRAP(sdpErr, AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, iTargetRecord, ETrue, - (aItem.iSdpFeatures & AvrcpSdp::EBrowsing) ? AvrcpSdp::KAvrcpProfileVersion14 : AvrcpSdp::KAvrcpProfileVersion13)); - } - if(sdpErr == KErrNone) - { - TRAP_IGNORE(UpdateTgServiceRecordL()); - } - } - -void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) +void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName) { LOG_FUNC; ASSERT_CONTROL_THREAD; @@ -176,11 +150,15 @@ TAvrcpMediaPlayerItem& item = iPlayers[index]; item.iId = aId; + item.iPlayerType = aClientType; + item.iPlayerSubType = aClientSubType; + item.iName.Set(aName); item.iBulkClientAvailable = EFalse; item.iUidCounter = 0; item.iLastUpdatedUidCounter = 0; item.iPlaybackStatus = MPlayerEventsObserver::EStopped; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); + item.iFeatureBitmask = TPlayerFeatureBitmask(); + TInt err = SetPlayerFeatures(aId, item.iFeatureBitmask, item.iSdpFeatures, item.iAbsoluteVolumeSupport); // Release lock before calling out of player info manager in case // anyone needs to call back in - we're finished updating the @@ -190,21 +168,41 @@ if(!err) { TRAP(err, iPlayStatusWatcher->StartWatchingPlayerL(aId)); + if(!err) { - UpdateSdpRecord(item); - for(TInt i = 0; iMpcoAvailablePlayersChanged(); + TRAP(sdpErr, AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, + iTargetRecord, + ETrue, + (item.iSdpFeatures & AvrcpSdp::EBrowsing) ? + AvrcpSdp::KAvrcpProfileVersion14 : + AvrcpSdp::KAvrcpProfileVersion13)); + } + + if(sdpErr == KErrNone) + { + TRAP_IGNORE(UpdateTgServiceRecordL()); } } - else + } + + if(!err) + { + for(TInt i = 0; iMpcoAvailablePlayersChanged(); } } + else + { + iLock.Wait(); + iPlayers[index].iId = KNullClientId; + iLock.Signal(); + } } void CAvrcpPlayerInfoManager::ClientNotAvailable(const TRemConClientId& aId) @@ -305,46 +303,6 @@ AvrcpSdpUtils::UpdateSupportedFeaturesL(iSdpDatabase, iControllerRecord, AvrcpSdp::ERemoteControl, AvrcpSdp::KAvrcpBaseCtFeatures); } -void CAvrcpPlayerInfoManager::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC; - ASSERT_CONTROL_THREAD; - iLock.Wait(); - // Find this client in our client list - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index < 0) - { - // Couldn't find client in client list, maybe we removed it after an earlier failure - iLock.Signal(); - return; - } - - TAvrcpMediaPlayerItem& item = iPlayers[index]; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); - - // Release lock before calling out of player info manager in case - // anyone needs to call back in - we're finished updating the - // info now. - iLock.Signal(); - - if(!err) - { - UpdateSdpRecord(item); - } - else - { - // There was an error updating the features so remove this client from the client list - iLock.Wait(); - iPlayers[index].iId = KNullClientId; - iLock.Signal(); - } - - for(TInt i = 0; iMpcoAvailablePlayersChanged(); - } - } - MIncomingCommandHandler& CAvrcpPlayerInfoManager::InternalCommandHandler() { LOG_FUNC diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -37,17 +37,14 @@ void CPlayerWatcherBase::StopWatchingPlayer(TRemConClientId aClientId) { LOG_FUNC; - CInternalCommand** cmdPtr = iCommands.Find(aClientId); - if (cmdPtr) // This may be NULL if we've already stopped watching the player as a result of reciving a reject - { - CInternalCommand* cmd = *cmdPtr; - - TUint transId = cmd->RemConCommandId(); - iCommandInterface.MrcciCommandExpired(transId); - - iCommands.Remove(aClientId); - cmd->DecrementUsers(); - } + CInternalCommand* command = *iCommands.Find(aClientId); + __ASSERT_DEBUG(command, AVRCP_PANIC(ENotWatchingPlayer)); + + TUint transId = command->RemConCommandId(); + iCommandInterface.MrcciCommandExpired(transId); + + iCommands.Remove(aClientId); + command->DecrementUsers(); } void CPlayerWatcherBase::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/) diff -r 613943a21004 -r 9386f31cc85b bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -698,19 +698,6 @@ return iPlayerInfoManager->SetLocalAddressedClient(aId); } -void CRemConBearerAvrcp::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - iPlayerInfoManager->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName); - } - void CRemConBearerAvrcp::ControllerFeaturesUpdated(RArray& aSupportedInterfaces) { LOG_FUNC diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/inc/basrvacc.h --- a/bluetoothengine/btaudioman/inc/basrvacc.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/inc/basrvacc.h Wed Sep 01 12:20:04 2010 +0100 @@ -67,11 +67,6 @@ void OpenAudioL(TAccAudioType aType); /** - * Called when the audio open request is to be cancelled. - */ - void CancelOpenAudio(); - - /** * Called when an audio close request comes from Acc FW. */ void CloseAudioL(TAccAudioType aType); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/inc/basrvaccstate.h --- a/bluetoothengine/btaudioman/inc/basrvaccstate.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/inc/basrvaccstate.h Wed Sep 01 12:20:04 2010 +0100 @@ -102,12 +102,7 @@ * Called when an audio open request comes from Acc FW. */ virtual void OpenAudioL(TAccAudioType aType); - - /** - * Called when the audio open request is to be cancelled. - */ - virtual void CancelOpenAudio(); - + /** * Called when an audio close request comes from Acc FW. */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/inc/basrvaccstateattached.h --- a/bluetoothengine/btaudioman/inc/basrvaccstateattached.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/inc/basrvaccstateattached.h Wed Sep 01 12:20:04 2010 +0100 @@ -84,12 +84,6 @@ void OpenAudioL(TAccAudioType aType); /** - * Called when the audio open request is to be cancelled. - */ - void CancelOpenAudio(); - - - /** * Called when an audio close request comes from Acc FW. */ void CloseAudioL(TAccAudioType aType); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/src/basrvacc.cpp --- a/bluetoothengine/btaudioman/src/basrvacc.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/src/basrvacc.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -139,12 +139,6 @@ iState->CloseAudioL(aType); } -void CBasrvAcc::CancelOpenAudio() - { - TRACE_FUNC - iState->CancelOpenAudio(); - } - const TAccInfo* CBasrvAcc::AccInfo(const TBTDevAddr& aAddr) { TRACE_FUNC diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/src/basrvaccman.cpp --- a/bluetoothengine/btaudioman/src/basrvaccman.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/src/basrvaccman.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -12,7 +12,7 @@ * Contributors: * * Description: Implementation of an accessory management. -* Version : %version: 14.1.12 % +* Version : %version: 14.1.11 % * */ @@ -619,23 +619,27 @@ TInt idx = FindAcc(aAddr); if (idx >= 0) { - TInt audiolinks = AudioLinkStatus(); - if ( audiolinks && audiolinks != aProfile) + // Check if another audio link opened already + TInt audiolinks = AudioLinkStatus(); + + if ( ( audiolinks && audiolinks != aProfile) || + ( iAudioRequests.Count() && + iAudioRequests[0].iOngoing && + iAudioRequests[0].iAddr == aAddr) ) { - TRACE_INFO((_L(" [global audio link check] existing audio link %x. Audio should be rejected!"), + // another audio type is opened while we have an audio link or pending audio request. + if (iAudioRequests.Count()) + { + TRACE_INFO((_L(" [audio link check] existing audio link %x, audio request pending ? %d. Audio should be rejected!"), + audiolinks, iAudioRequests[0].iOngoing)) + } + else + { + TRACE_INFO((_L(" [audio link check] existing audio link %x. Audio should be rejected!"), audiolinks)) + } RejectAudioLink(aAddr, (aProfile == EStereo) ? EAccStereoAudio : EAccMonoAudio); } - else if ( iAudioRequests.Count() && - iAudioRequests[0].iReqType == EOpenReqFromAudioPolicy && - iAudioRequests[0].iAudioType == ((aProfile == EStereo) ? EAccStereoAudio : EAccMonoAudio) && - iAudioRequests[0].iOngoing && - iAudioRequests[0].iAddr == aAddr) - { - TRACE_INFO((_L(" [device-specific audio request check] audio request pending ? %d. Audio request should be cancelled!"), - iAudioRequests[0].iOngoing)) - iAccs[idx]->CancelOpenAudio(); - } else { iAccs[idx]->AccOpenedAudio(aProfile); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/src/basrvaccstate.cpp --- a/bluetoothengine/btaudioman/src/basrvaccstate.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/src/basrvaccstate.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -86,11 +86,6 @@ TRACE_FUNC } -void CBasrvAccState::CancelOpenAudio() - { - TRACE_FUNC - } - void CBasrvAccState::CloseAudioL(TAccAudioType /*aType*/) { TRACE_FUNC @@ -133,7 +128,7 @@ } void CBasrvAccState::NewProfileConnection(TProfiles aProfile) - { + { AccInfo().iConnProfiles |= aProfile; AccInfo().iSuppProfiles |= aProfile; if (aProfile == ERemConCT && diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/src/basrvaccstateattached.cpp --- a/bluetoothengine/btaudioman/src/basrvaccstateattached.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/src/basrvaccstateattached.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -12,7 +12,7 @@ * Contributors: * * Description: Implementation of Connected state. -* Version : %version: 22 % +* Version : %version: 21 % * */ @@ -228,16 +228,6 @@ User::RequestComplete( myStatus, KErrNone ); } -void CBasrvAccStateAttached::CancelOpenAudio() - { - TRACE_FUNC - - if (iAudioOpener) - { - iAudioOpener->Cancel(); - } - } - void CBasrvAccStateAttached::CloseAudioL(TAccAudioType aType) { TRACE_FUNC diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btaudioman/src/basrvmain.cpp --- a/bluetoothengine/btaudioman/src/basrvmain.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btaudioman/src/basrvmain.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -30,8 +30,8 @@ GLDEF_C TInt E32Main() { TRACE_STATIC_FUNC - //TODO uncomment UHEAP macros after orbit & Qt memory leaks are resolved till then it should be commented. -// __UHEAP_MARK; + + __UHEAP_MARK; CTrapCleanup* cleanup=CTrapCleanup::New(); TInt r=KErrNoMemory; if (cleanup) @@ -40,7 +40,7 @@ delete cleanup; } // -// __UHEAP_MARKEND; + __UHEAP_MARKEND; return r; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h --- a/bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -25,7 +25,6 @@ #include #include #include -#include /** @@ -90,11 +89,6 @@ * @since S60 v3.2 */ void SubscribeL(); - - /** - * Handles service load/unload when BT power changes. - */ - void HandleBtPowerChanged( TBTPowerStateValue aPower ); // from base class CActive @@ -150,8 +144,6 @@ * Own. */ CRepository* iSession; - - CHbIndicatorSymbian* iBTIndicator; }; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp --- a/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -23,9 +23,6 @@ #include "btpluginnotifier.h" #include "debug.h" #include -#include -#include "btindicatorconstants.h" -#include // ======== MEMBER FUNCTIONS ======== @@ -62,7 +59,6 @@ delete repository; CBTEngSettings* settings = CBTEngSettings::NewL(); - iBTIndicator = CHbIndicatorSymbian::NewL(); BluetoothFeatures::TEnterpriseEnablementMode mode = BluetoothFeatures::EnterpriseEnablementL(); TRACE_INFO( ( _L( "mode = %d" ), mode) ) @@ -72,23 +68,15 @@ TRACE_INFO( ( _L( "Turning BT on" ) ) ) TInt err = settings->SetPowerState( EBTPowerOn ); TRACE_INFO( ( _L( "SetPowerState returned %d" ), err ) ) - if ( !err ) + if( !err ) { - HandleBtPowerChanged( EBTPowerOn ); + iHandler.NotifyBearerStatus( ELocodBearerBT, power ); } } else { TRACE_INFO( ( _L( "Turning BT off" ) ) ) (void) settings->SetPowerState( EBTPowerOff ); // Result is not important here - TInt state = EBTIndicatorOff; - CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(&state,CHbSymbianVariant::EInt ); - TBool success = iBTIndicator->Activate(KIndicatorType(),parameters); - delete parameters; - if(!success) - { - User::Leave(iBTIndicator->Error()); - } } delete settings; if ( mode != BluetoothFeatures::EDisabled ) // only subscribe if there's any point (NB changing Enterprise Disabling mode requires a reboot) @@ -123,7 +111,6 @@ TRACE_FUNC_ENTRY Cancel(); delete iSession; - delete iBTIndicator; } @@ -142,30 +129,6 @@ SetActive(); } -// --------------------------------------------------------------------------- -// Handles power state change. Inform Locod. In addition, if BT is on, start -// btnotifier server. -// --------------------------------------------------------------------------- -// -void CBTPluginNotifier::HandleBtPowerChanged( TBTPowerStateValue aPower ) - { - TRACE_FUNC_ARG( ( _L( " to %d" ), aPower ) ) - TInt err (KErrNone ); - if ( aPower == EBTPowerOn ) - { - // Start BT notifier server by creating a session with it: - RBTNotifier btnotif; - err = btnotif.Connect(); - TRACE_INFO( ( _L( "start bt notifier server %d" ), err ) ) - // btnotif server manages its lifecycle. no need - // to keep this session: - btnotif.Close(); - } - if ( !err ) - { - iHandler.NotifyBearerStatus( ELocodBearerBT, aPower ); - } - } // --------------------------------------------------------------------------- // From class CActive. @@ -199,12 +162,9 @@ case EKeyInt: { TRACE_INFO( ( _L( "[CBTPluginNotifier::RunL2 %d]" ), status ) ) - TInt newValue = EBTPowerOff; - TInt err = iSession->Get( iId, newValue ); - if ( !err ) - { - HandleBtPowerChanged( static_cast( newValue ) ); - } + TInt newValue = 1; + iSession->Get( iId, newValue ); + iHandler.NotifyBearerStatus( ELocodBearerBT, newValue ); } break; default: diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengconnman/inc/btengconnhandler.h --- a/bluetoothengine/bteng/btengconnman/inc/btengconnhandler.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengconnman/inc/btengconnhandler.h Wed Sep 01 12:20:04 2010 +0100 @@ -146,7 +146,18 @@ * @since S60 v3.2 * @return ?description */ - void CancelNotifyConnectionEvents(); + TInt CancelNotifyConnectionEvents(); + + /** + * Set a pairing observer in BTEngine. + * + * @since S60 v3.2 + * @param aAddr The address of the remote device that is being paired. + * @param aActivate If ETrue, the observer will be activated, otherwise + * the observer will be removed. + * @return KErrNone on success, otherwise a system-wide error code. + */ + static TInt SetPairingObserver( const TBTDevAddr& aAddr, TBool aActivate ); /** * ?description @@ -155,6 +166,22 @@ * @return ?description */ inline TInt PrepareDiscovery(); + + + /** + * Pair a device + * + * @since S60 v5.1 + * @param aAddr the address of the device to pair with + * @param aDeviceClass the device class of the device to pair with + * @return KErrNone if this request has been accepted; an error situation otherwise. + */ + TInt StartPairing( const TBTDevAddr& aAddr, const TBTDeviceClass& aDeviceClass ); + + /** + * cancel the outstanding pairing request. + */ + void CancelPairing(); private: // from base class MBTEngActiveObserver @@ -165,22 +192,15 @@ * * @since S60 v3.2 */ - virtual void RequestCompletedL( CBTEngActive* aActive, TInt aStatus ); + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** * From MBTEngActiveObserver. * Handles an error during processing of connection status event. * * @since S60 v3.2 */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ); + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: @@ -202,6 +222,16 @@ * Client-server package to which the event result is copied. */ TBTEngEventPkg iEventPkg; + + /** + * Address of the remote device to pair with. + */ + TBTDevAddrPckgBuf iPairAddr; + + /** + * The CoD of the remote device to pair with. + */ + TUint32 iPairDevCod; /** * Session with BTEng server side. @@ -213,6 +243,12 @@ * Own. */ CBTEngActive* iConnEventActive; + + /** + * The actual active object for pairing a device. + * Own. + */ + CBTEngActive* iPairActive; /** * Reference to receiver of connection events. diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengconnman/inc/btengpairinghandler.h --- a/bluetoothengine/bteng/btengconnman/inc/btengpairinghandler.h Tue Aug 31 15:25:10 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: Bluetooth Engine API for connection management functionality. -* -*/ - -#ifndef BTENGPAIRINGHANDLER_H -#define BTENGPAIRINGHANDLER_H - -#include -#include - -#include "btengactive.h" - -class CBTEngConnMan; -class MBTEngConnObserver; - - -/** - * ?one_line_short_description - * - * ?more_complete_description - * - * @lib ?library - * @since S60 v3.2 - */ -NONSHARABLE_CLASS( CBTEngPairingHandler ) : public CBase, public MBTEngActiveObserver - { - -public: - - /** - * Two-phase constructor - */ - static CBTEngPairingHandler* NewL( MBTEngConnObserver* aObserver, - CBTEngConnMan* aParent ); - - /** - * Destructor - */ - virtual ~CBTEngPairingHandler(); - - /** - * ?description - * - * @since S60 v3.2 - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - void StartPairingL( const TBTDevAddr& aAddr, TBTDeviceClass& aDeviceClass ); - - /** - * ?description - * - * @since S60 v3.2 - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - void CancelPairing(); - -// from base class MBTEngActiveObserver - - /** - * From MBTEngActiveObserver. - * ?description - * - * @since S60 v3.2 - * @param ?arg1 ?description - */ - virtual void RequestCompletedL( CBTEngActive* aActive, - TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * From MBTEngActiveObserver. - * ?description - * - * @since S60 v3.2 - * @param ?arg1 ?description - */ - virtual void HandleError( CBTEngActive* aActive, - TInt aError ); - -private: - - /** - * C++ default constructor - */ - CBTEngPairingHandler( MBTEngConnObserver* aObserver, - CBTEngConnMan* aParent ); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - -private: // data - - /** - * the address of the remote device to be paired. - */ - TBTDevAddrPckgBuf iAddr; - - /** - * the class of device value of the remote device to be paired. - */ - TBTDeviceClass iCod; - - /** - * the session to notifier which handles the actual pairing operation. - * Own. - */ - RBTNotifier iBtNotifier; - - /** - * Active object for pairing request - * Own. - */ - CBTEngActive* iActive; - - /** - * the observer that receives the result of pairing operation. - * Not own. - */ - MBTEngConnObserver* iObserver; - - /** - * ?description_of_pointer_member - * Not own. - */ - CBTEngConnMan* iParent; - - }; - - -#endif // BTENGPAIRINGHANDLER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp --- a/bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengconnman/src/btengconnhandler.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -83,6 +83,7 @@ { TRACE_FUNC_ENTRY CancelNotifyConnectionEvents(); + CancelPairing(); iBTEng.Close(); } @@ -145,52 +146,128 @@ // ?implementation_description // --------------------------------------------------------------------------- // -void CBTEngConnHandler::CancelNotifyConnectionEvents() +TInt CBTEngConnHandler::CancelNotifyConnectionEvents() + { + TRACE_FUNC_ENTRY + TInt err = KErrNone; + if( iConnEventActive && iConnEventActive->IsActive() ) + { + err = iBTEng.CancelNotifyConnectionEvents(); + iConnEventActive->CancelRequest(); + } + delete iConnEventActive; + iConnEventActive = NULL; + return err; + } + +// ----------------------------------------------------------------------------- +// Request server side to activate/deactivate a pair observer +// ----------------------------------------------------------------------------- +// +TInt CBTEngConnHandler::SetPairingObserver( const TBTDevAddr& aAddr, + TBool aActivate ) + { + RBTEng bteng; + TInt err = bteng.Connect(); + if ( !err ) + { + err = bteng.SetPairingObserver( aAddr, aActivate ); + } + bteng.Close(); + return err; + } + +// --------------------------------------------------------------------------- +// Request BTEng to pair the device +// --------------------------------------------------------------------------- +// +TInt CBTEngConnHandler::StartPairing( const TBTDevAddr& aAddr, + const TBTDeviceClass& aDeviceClass ) { TRACE_FUNC_ENTRY - delete iConnEventActive; - iConnEventActive = NULL; + TInt err( KErrNone ); + if( iPairActive && iPairActive->IsActive() ) + { + err = KErrServerBusy; + } + + if( !iPairActive ) + { + // Use a higher prioritty than normal, because we want + // to be notified fast (e.g. to update the UI). + TRAP( err, iPairActive = CBTEngActive::NewL( *this, EPairDeviceId, + CActive::EPriorityUserInput ) ); + } + if ( !err ) + { + iPairAddr() = aAddr; + iPairDevCod = aDeviceClass.DeviceClass(); + iBTEng.PairDevice( iPairAddr, iPairDevCod, iPairActive->RequestStatus() ); + iPairActive->GoActive(); + } + TRACE_FUNC_EXIT + return err; } // --------------------------------------------------------------------------- +// Cancel any outstanding operation, free resources. +// --------------------------------------------------------------------------- +// +void CBTEngConnHandler::CancelPairing() + { + TRACE_FUNC_ENTRY + if( iPairActive && iPairActive->IsActive() ) + { + iBTEng.CancelPairDevice(); + } + delete iPairActive; + iPairActive = NULL; + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------------------------- // From class MBTEngActiveObserver. // Called by the active object when a change in connection status has occured. // --------------------------------------------------------------------------- // -void CBTEngConnHandler::RequestCompletedL( CBTEngActive* aActive, +void CBTEngConnHandler::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { - TRACE_FUNC_ARG( ( _L( "ID: %d status: %d" ), aActive->RequestId(), aStatus ) ) + TRACE_FUNC_ARG( ( _L( "ID: %d status: %d" ), aId, aStatus ) ) + (void) aActive; - ASSERT( aActive->RequestId() == EConnectionEventId ); - HandleConnectionEvent( aStatus ); + switch ( aId ) + { + case EConnectionEventId: + { + HandleConnectionEvent( aStatus ); + break; + } + case EPairDeviceId: + { + if ( iObserver ) + { + iObserver->PairingComplete( iPairAddr(), aStatus ); + } + } + } + TRACE_FUNC_EXIT } -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngConnHandler::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ) - ASSERT( aRequestId == EConnectionEventId ); - ( void ) aRequestId; - iBTEng.CancelNotifyConnectionEvents(); - TRACE_FUNC_EXIT - } // --------------------------------------------------------------------------- // From class MBTEngActiveObserver. // Called when RequestCompletedL/RunL leaves. // --------------------------------------------------------------------------- // -void CBTEngConnHandler::HandleError( CBTEngActive* aActive, TInt aError ) +void CBTEngConnHandler::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { TRACE_FUNC_ARG( ( _L( "error: %d" ), aError ) ) // Should any info be passed to the client?? (void) aActive; + (void) aId; (void) aError; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengconnman/src/btengconnman.cpp --- a/bluetoothengine/bteng/btengconnman/src/btengconnman.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengconnman/src/btengconnman.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -23,7 +23,6 @@ #include "btengconnman.h" #include "btengconnhandler.h" -#include "btengpairinghandler.h" #include "debug.h" // ======== MEMBER FUNCTIONS ======== @@ -93,7 +92,6 @@ { TRACE_FUNC_ENTRY delete iConnHandler; - delete iPairingHandler; } @@ -226,20 +224,9 @@ EXPORT_C TInt CBTEngConnMan::PairDevice( const TBTDevAddr& aAddr, TBTDeviceClass aDeviceClass ) { TRACE_FUNC_ENTRY - TInt err = KErrNone; - if( !iPairingHandler ) - { - TRAP( err, iPairingHandler = CBTEngPairingHandler::NewL( iObserver, this ) ); - } - if( !err ) - { - iPairingHandler->CancelPairing(); + return iConnHandler->StartPairing( aAddr, aDeviceClass ); + } - TRAP( err, iPairingHandler->StartPairingL( aAddr, aDeviceClass ) ); - } - TRACE_FUNC_RES( ( _L( "result: %d" ), err ) ) - return err; - } // --------------------------------------------------------------------------- // Cancels an ongoing pairing. @@ -248,25 +235,21 @@ EXPORT_C void CBTEngConnMan::CancelPairDevice() { TRACE_FUNC_ENTRY - if( iPairingHandler ) + if( iConnHandler ) { - iPairingHandler->CancelPairing(); - delete iPairingHandler; - iPairingHandler = NULL; + iConnHandler->CancelPairing(); } } // --------------------------------------------------------------------------- // Tell BTEng to start observing the status of an ongoing pairing. -// Deprecated since Symbian^4. // --------------------------------------------------------------------------- // EXPORT_C TInt CBTEngConnMan::StartPairingObserver( const TBTDevAddr& aAddr ) { TRACE_FUNC_ENTRY - (void) aAddr; - return KErrNone; + return CBTEngConnHandler::SetPairingObserver( aAddr, ETrue ); } @@ -281,14 +264,13 @@ } // --------------------------------------------------------------------------- -// Deprecated since Symbian^4. +// ?implementation_description // --------------------------------------------------------------------------- // EXPORT_C TInt CBTEngConnMan::StopPairingObserver( const TBTDevAddr& aAddr ) { TRACE_FUNC_ENTRY - (void) aAddr; - return KErrNone; + return CBTEngConnHandler::SetPairingObserver( aAddr, EFalse ); } // --------------------------------------------------------------------------- diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengconnman/src/btengpairinghandler.cpp --- a/bluetoothengine/bteng/btengconnman/src/btengpairinghandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +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: Implementation of pairing a Bluetooth device. -* -*/ -#include "btengpairinghandler.h" -#include "btengconnman.h" -#include "btengactive.h" -#include "debug.h" - -const TInt KPairingRequestId = 60; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTEngPairingHandler::CBTEngPairingHandler( MBTEngConnObserver* aObserver, - CBTEngConnMan* aParent ) -: iObserver( aObserver ), - iParent( aParent ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::ConstructL() - { - ASSERT( iObserver ); - iActive = CBTEngActive::NewL( *this, KPairingRequestId, - CActive::EPriorityStandard ); - } - - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTEngPairingHandler* CBTEngPairingHandler::NewL( MBTEngConnObserver* aObserver, - CBTEngConnMan* aParent ) - { - CBTEngPairingHandler* self = new( ELeave ) CBTEngPairingHandler( aObserver, - aParent ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTEngPairingHandler::~CBTEngPairingHandler() - { - delete iActive; - iBtNotifier.Close(); - } - -// --------------------------------------------------------------------------- -// ?implementation_description -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::StartPairingL( const TBTDevAddr& aAddr, - TBTDeviceClass& aDeviceClass ) - { - TRACE_FUNC_ENTRY - if ( !iBtNotifier.Handle() ) - { - User::LeaveIfError( iBtNotifier.Connect() ); - } - iAddr() = aAddr; - iCod = aDeviceClass; - iBtNotifier.PairDevice( iAddr, iCod.DeviceClass(), iActive->RequestStatus() ); - iActive->GoActive(); - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Cancel a pairing request. -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::CancelPairing() - { - TRACE_FUNC_ENTRY - if( iActive->IsActive() ) - { - iBtNotifier.CancelPairDevice(); - iActive->Cancel(); - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// ?implementation_description -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::RequestCompletedL( CBTEngActive* aActive, - TInt aStatus ) - { - TRACE_FUNC_ARG( ( _L( "status: %d" ), aStatus ) ) - ASSERT( aActive->RequestId() != 0 ); - (void) aActive; - // Pairing completes, inform client. - iObserver->PairingComplete( iAddr(), aStatus ); - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ); - if ( aRequestId == KPairingRequestId ) - { - iBtNotifier.CancelPairDevice(); - } - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// ?implementation_description -// --------------------------------------------------------------------------- -// -void CBTEngPairingHandler::HandleError( CBTEngActive* aActive, - TInt aError ) - { - // Our RunL can actually not leave, so we should never reach here. - (void) aActive; - (void) aError; - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengdiscovery/inc/btengdevicesearch.h --- a/bluetoothengine/bteng/btengdiscovery/inc/btengdevicesearch.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengdiscovery/inc/btengdevicesearch.h Wed Sep 01 12:20:04 2010 +0100 @@ -89,23 +89,16 @@ * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void RequestCompletedL( CBTEngActive* aActive, + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - + /** * Callback to notify that an error has occurred in RunL. * * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ); + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp --- a/bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengdiscovery/src/btengdevicesearch.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -72,6 +72,11 @@ // CBTEngDeviceSearch::~CBTEngDeviceSearch() { + if( iNotifier.Handle()&& iActive->IsActive()) + { + iNotifier.CancelNotifier( KDeviceSelectionNotifierUid ); + iActive->CancelRequest(); + } delete iActive; iNotifier.Close(); iHostResolver.Close(); @@ -127,17 +132,20 @@ TRACE_FUNC_ENTRY if( iActive->IsActive() && iClientReq == EDeviceSearch) { - iActive->Cancel(); if (iActive->RequestId() == KDevSearchAoReqId) { + iNotifier.CancelNotifier( KDeviceSelectionNotifierUid ); + iActive->CancelRequest(); iNotifier.Close(); NotifyClient(KErrAbort); } else if (iActive->RequestId() == KDevEirServiceListAoReqId) { + iHostResolver.Cancel(); iHostResolver.Close(); } } + TRACE_FUNC_EXIT } @@ -174,7 +182,7 @@ TRACE_FUNC_ENTRY if( iActive->IsActive() && iClientReq == EGetDeviceEir) { - iActive->Cancel(); + iHostResolver.Cancel(); iHostResolver.Close(); } TRACE_FUNC_EXIT @@ -185,16 +193,16 @@ // Callback to notify that an outstanding request has completed. // --------------------------------------------------------------------------- // -void CBTEngDeviceSearch::RequestCompletedL( CBTEngActive* aActive, +void CBTEngDeviceSearch::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { TRACE_FUNC_ARG( ( _L( "status: %d") , aStatus ) ) (void) aActive; - if ( aActive->RequestId() == KDevSearchAoReqId ) + if ( aId == KDevSearchAoReqId ) { HandleDeviceSelectionResultL(aStatus); } - else if ( aActive->RequestId() == KDevEirServiceListAoReqId ) + else if (aId == KDevEirServiceListAoReqId) { HandleDeviceEirDataResult( aStatus ); } @@ -203,33 +211,15 @@ // --------------------------------------------------------------------------- // From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngDeviceSearch::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ) - if ( aRequestId == KDevSearchAoReqId ) - { - iNotifier.CancelNotifier( KDeviceSelectionNotifierUid ); - } - else if ( aRequestId == KDevEirServiceListAoReqId ) - { - iHostResolver.Cancel(); - } - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. // Callback to notify that an error has occurred in RunL. // --------------------------------------------------------------------------- // -void CBTEngDeviceSearch::HandleError( CBTEngActive* aActive, +void CBTEngDeviceSearch::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { TRACE_FUNC_ARG( ( _L( "error: %d") , aError ) ) (void) aActive; + (void) aId; iNotifier.Close(); iHostResolver.Close(); NotifyClient(aError); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengsettings/inc/btengsettingsnotify.h --- a/bluetoothengine/bteng/btengsettings/inc/btengsettingsnotify.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengsettings/inc/btengsettingsnotify.h Wed Sep 01 12:20:04 2010 +0100 @@ -78,24 +78,17 @@ * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void RequestCompletedL( CBTEngActive* aActive, + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** * From MBTEngActiveObserver. * Handle an error in the setting change handling. * * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ); + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengsettings/src/btengsettings.cpp --- a/bluetoothengine/bteng/btengsettings/src/btengsettings.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengsettings/src/btengsettings.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -191,7 +191,7 @@ TRACE_FUNC_ENTRY aName.Zero(); TBool nameStatus = EFalse; - TBuf tmpName; + TBuf tmpName; TInt err = GetLocalNameModified( nameStatus ); @@ -413,7 +413,7 @@ if( !err ) { // BT registry keeps the device name in UTF-8 format. - TBuf8 utf8Name; + TBuf8 utf8Name; if( aName.Length() == 0 ) { // The error can be > 0 if there are unconverted characters. diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/btengsettings/src/btengsettingsnotify.cpp --- a/bluetoothengine/bteng/btengsettings/src/btengsettingsnotify.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/btengsettings/src/btengsettingsnotify.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -90,11 +90,22 @@ // CBTEngSettingsNotify::~CBTEngSettingsNotify() { - delete iPowerKeyWatcher; + if ( iPowerKeyCenRep ) + { + iPowerKeyCenRep->NotifyCancel( KBTPowerState ); + } + delete iPowerKeyWatcher; // Will call Cancel() delete iPowerKeyCenRep; - delete iVisiKeyWatcher; + if ( iVisiKeyCenRep ) + { + iVisiKeyCenRep->NotifyCancel( KBTDiscoverable ); + } + delete iVisiKeyWatcher; // Will call Cancel() delete iVisiKeyCenRep; - iBTeng.Close(); + if( iBTeng.Handle() ) + { + iBTeng.Close(); + } } @@ -127,12 +138,12 @@ // Handles notification of a setting change, and informs our observer. // --------------------------------------------------------------------------- // -void CBTEngSettingsNotify::RequestCompletedL( CBTEngActive* aActive, +void CBTEngSettingsNotify::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { - TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aActive->RequestId(), aStatus ) ) + TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aId, aStatus ) ) - if( aActive->RequestId() == KPowerKeyReqId && aStatus == KBTPowerState ) + if( aId == KPowerKeyReqId && aStatus == KBTPowerState ) { iPowerKeyCenRep->NotifyRequest( KBTPowerState, iPowerKeyWatcher->RequestStatus() ); @@ -144,7 +155,7 @@ iObserver->PowerStateChanged( (TBTPowerStateValue) value ); } } - else if( aActive->RequestId() == KVisibilityKeyReqId && aStatus == KBTDiscoverable ) + else if( aId == KVisibilityKeyReqId && aStatus == KBTDiscoverable ) { iVisiKeyCenRep->NotifyRequest( KBTDiscoverable, iVisiKeyWatcher->RequestStatus() ); @@ -161,42 +172,23 @@ // Coudl be a repository-wide reset (KInvalidNotificationId), // or an invalid key ID. Anyway we know the ID of the active // object, so we can just reset the watcher. - HandleError( aActive, aStatus ); + HandleError( aActive, aId, aStatus ); } TRACE_FUNC_EXIT } -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngSettingsNotify::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ) - - if( aRequestId == KPowerKeyReqId ) - { - iPowerKeyCenRep->NotifyCancel( KBTPowerState ); - } - else if( aRequestId == KVisibilityKeyReqId ) - { - iVisiKeyCenRep->NotifyCancel( KBTDiscoverable ); - } - TRACE_FUNC_EXIT - } // --------------------------------------------------------------------------- // From class MBTEngCenRepNotify. // Handles error situation by just re-ordering notification from CenRep. // --------------------------------------------------------------------------- // -void CBTEngSettingsNotify::HandleError( CBTEngActive* aActive, +void CBTEngSettingsNotify::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { - TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aActive->RequestId(), aError ) ) + TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aId, aError ) ) (void) aError; - if( aActive->RequestId() == KPowerKeyReqId ) + if( aId == KPowerKeyReqId ) { delete iPowerKeyCenRep; iPowerKeyCenRep = NULL; @@ -209,7 +201,7 @@ aActive->GoActive(); } } - else if( aActive->RequestId() == KVisibilityKeyReqId ) + else if( aId == KVisibilityKeyReqId ) { delete iVisiKeyCenRep; iVisiKeyCenRep = NULL; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/bttoggle/src/bttoggle.cpp --- a/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/bttoggle/src/bttoggle.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -154,7 +154,7 @@ } else //other than offline { - TBuf localName; + TBuf localName; iSettings->GetLocalName(localName); //There is no BT local name defined @@ -360,8 +360,7 @@ // TInt CBTToggle::RunError(TInt aError) { - TRACE_INFO((_L("[BTENG][BTTOGGLE] RunError %d"), aError )) - (void) aError; + TRACE_INFO((_L("[BTENG][BTTOGGLE] RunError %d"), aError )) iActiveNotifier = ENoneQuery; CActiveScheduler::Stop(); return KErrNone; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/conf/bteng.confml Binary file bluetoothengine/bteng/conf/bteng.confml has changed diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/group/bld.inf --- a/bluetoothengine/bteng/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -26,8 +26,8 @@ PRJ_EXPORTS ../inc/btengprivatecrkeys.h |../../inc/btengprivatecrkeys.h ../inc/btengprivatepskeys.h |../../inc/btengprivatepskeys.h +../inc/btotgpairpub.inl |../../inc/btotgpairpub.inl ../inc/btengutil.h |../../inc/btengutil.h - ../rom/bteng.iby CORE_MW_LAYER_IBY_EXPORT_PATH(bteng.iby) ../data/10204DA9.xml z:/private/2000B187/10204DA9.xml @@ -37,7 +37,6 @@ ../conf/bteng_10204DAB.crml MW_LAYER_CRML(bteng_10204DAB.crml) ../conf/bteng_10204DAC.crml MW_LAYER_CRML(bteng_10204DAC.crml) - ../data/btrfs.txt z:/resource/btrfs.txt diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/group/btbearer.mmp --- a/bluetoothengine/bteng/group/btbearer.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/group/btbearer.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -37,19 +37,16 @@ TARGET btbearer.rsc END // RESOURCE -USERINCLUDE ../inc ../../inc +USERINCLUDE ../inc USERINCLUDE ../btbearer/inc MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom SYSTEMINCLUDE ../../../inc -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore LIBRARY euser.lib LIBRARY ecom.lib LIBRARY centralrepository.lib LIBRARY btengsettings.lib LIBRARY btfeatures.lib -LIBRARY btnotifclient.lib -LIBRARY hbcore.lib DEBUGLIBRARY flogger.lib // File logging services diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/group/bteng.mmp --- a/bluetoothengine/bteng/group/bteng.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/group/bteng.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -35,6 +35,10 @@ SOURCE btengsrvbbconnectionmgr.cpp SOURCE btengsdpdbhandler.cpp SOURCE btengsrvkeywatcher.cpp +SOURCE btengpairman.cpp +SOURCE btengpairbase.cpp +SOURCE btengincpair.cpp +SOURCE btengotgpair.cpp SOURCE btengsrvsettingsmgr.cpp START RESOURCE ../data/btengsdp.rss HEADER @@ -43,7 +47,6 @@ USERINCLUDE ../inc SYSTEMINCLUDE ../../inc -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib @@ -60,7 +63,6 @@ LIBRARY featmgr.lib LIBRARY aknnotify.lib LIBRARY btfeatures.lib -LIBRARY hbcore.lib LIBRARY btpowercontrol.lib #ifndef __WINS__ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/group/btengconnman.mmp --- a/bluetoothengine/bteng/group/btengconnman.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/group/btengconnman.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -29,19 +29,17 @@ SOURCEPATH ../btengconnman/src SOURCE btengconnman.cpp SOURCE btengconnhandler.cpp -SOURCE btengpairinghandler.cpp SOURCEPATH ../src SOURCE btengclient.cpp USERINCLUDE ../inc USERINCLUDE ../btengconnman/inc -SYSTEMINCLUDE ../../inc MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY btdevice.lib LIBRARY bluetooth.lib -LIBRARY btnotifclient.lib +LIBRARY esock.lib LIBRARY featmgr.lib LIBRARY centralrepository.lib // Central Repository DEBUGLIBRARY flogger.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengactive.h --- a/bluetoothengine/bteng/inc/btengactive.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengactive.h Wed Sep 01 12:20:04 2010 +0100 @@ -40,6 +40,7 @@ */ class MBTEngActiveObserver { + public: /** @@ -47,27 +48,25 @@ * * @since S60 v3.2 * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. * @param aStatus The status of the completed request. */ - virtual void RequestCompletedL( CBTEngActive* aActive, TInt aStatus ) = 0; - - /** - * Callback for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ) = 0; + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, + TInt aStatus ) = 0; /** * Callback to notify that an error has occurred in RunL. * * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ) = 0; + virtual void HandleError( CBTEngActive* aActive, TInt aId, + TInt aError ) = 0; + }; + /** * Class CBTEngActive * @@ -123,6 +122,13 @@ inline void GoActive(); /** + * Cancel an outstanding request. + * + * @since S60 v3.2 + */ + inline void CancelRequest(); + + /** * Get a reference to the active object request status. * * @since S60 v3.2 @@ -130,7 +136,6 @@ */ TRequestStatus& RequestStatus(); -private: // from base class CActive /** diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengactive.inl --- a/bluetoothengine/bteng/inc/btengactive.inl Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengactive.inl Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -73,9 +73,10 @@ // inline void CBTEngActive::DoCancel() { - iObserver.CancelRequest( iRequestId ); } + + // ----------------------------------------------------------------------------- // Get the identifier of this instance. // ----------------------------------------------------------------------------- @@ -105,6 +106,17 @@ SetActive(); } + +// ----------------------------------------------------------------------------- +// Cancel an outstanding request. +// ----------------------------------------------------------------------------- +// +inline void CBTEngActive::CancelRequest() + { + Cancel(); + } + + // ----------------------------------------------------------------------------- // Get a reference to the active object request status. // ----------------------------------------------------------------------------- @@ -114,6 +126,7 @@ return iStatus; } + // --------------------------------------------------------------------------- // From class CActive. // Called by the active scheduler when the request has been completed. @@ -121,7 +134,7 @@ // inline void CBTEngActive::RunL() { - iObserver.RequestCompletedL( this, iStatus.Int() ); + iObserver.RequestCompletedL( this, iRequestId, iStatus.Int() ); } @@ -132,6 +145,6 @@ // inline TInt CBTEngActive::RunError( TInt aError ) { - iObserver.HandleError( this, aError ); + iObserver.HandleError( this, iRequestId, aError ); return KErrNone; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengclient.h --- a/bluetoothengine/bteng/inc/btengclient.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengclient.h Wed Sep 01 12:20:04 2010 +0100 @@ -158,6 +158,17 @@ * @return ?description */ TInt CancelNotifyConnectionEvents(); + + /** + * Set a pairing observer in BTEngine. + * + * @since S60 v3.2 + * @param aAddr The address of the remote device that is being paired. + * @param aActivate If ETrue, the observer will be activated, otherwise + * the observer will be removed. + * @return KErrNone on success, otherwise a system-wide error code. + */ + TInt SetPairingObserver( const TBTDevAddr& aAddr, TBool aActivate ); /** * ?description @@ -167,6 +178,21 @@ */ TInt PrepareDiscovery(); + /** + * Pair a device. + * @param aAddr The address of the remote device to be paired. + * @param aDeviceClass the CoD of the device to be paired. + * @param aStatus contains the pair result at request completion. + */ + void PairDevice( const TBTDevAddrPckgBuf& aAddr, + const TUint32& aDeviceClass, + TRequestStatus& aStatus ); + + /** + * Cancels an outstanding pair request + */ + void CancelPairDevice(); + }; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengclientserver.h --- a/bluetoothengine/bteng/inc/btengclientserver.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengclientserver.h Wed Sep 01 12:20:04 2010 +0100 @@ -55,6 +55,9 @@ EBTEngNotifyConnectionEvents, // 41 EBTEngCancelEventNotifier, // 42 EBTEngPrepareDiscovery, // 43 + EBTEngSetPairingObserver, // 44 + EBTEngPairDevice, // 45 + EBTEngCancelPairDevice, // 46 }; /** TBTDevAddr class size */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengincpair.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/inc/btengincpair.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Incoming Pairing handler definition +* +*/ + + +#ifndef BTENGINCPAIR_H_ +#define BTENGINCPAIR_H_ + +#include +#include "btengpairbase.h" + +/** + * Class CBTEngIncPair + * + * Handles an incoming pairing. + * + * @since S60 S60 v5.1 + */ +NONSHARABLE_CLASS( CBTEngIncPair ) : public CBTEngPairBase + { +public: + + /** + * Two-phase constructor + * @param aParent the owner of this observer + * @param aAddr the remote device this observer is targeted to + */ + static CBTEngIncPair* NewL( CBTEngPairMan& aParent, + const TBTDevAddr& aAddr); + + /** + * Destructor + */ + ~CBTEngIncPair(); + + +private: // From CBTEngPairBase + + /** + * Start observing the result of pairing which was originated from + * the remote device. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + TInt ObserveIncomingPair( const TBTDevAddr& aAddr ); + + /** + * Start an outgoing pairing with the remote device. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ); + + /** + * Cancels pairing handling with the specified device + * @param aAddr the address of the device the pairing is with + */ + void StopPairHandling( const TBTDevAddr& aAddr ); + + /** + * Handle a pairing result with the remote device which this is for. + * Must be specialized by subclass. + * + * @param aResult The status code of the pairing or authentication result. + */ + void DoHandlePairServerResult( TInt aResult ); + + /** + * Handles event of registry new paired event with the remote + * device this is for. + * @aType the type of authentication with the device. + */ + void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); + +private: // from base class MBTEngActiveObserver + + /** + * From MBTEngActiveObserver. + * Callback to notify that an outstanding request has completed. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTEngActiveObserver. + * Callback to notify that an error has occurred in RunL. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); + +private: + + /** + * C++ default constructor + */ + CBTEngIncPair(CBTEngPairMan& aParent, const TBTDevAddr& aAddr); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Start monitoring physical link events if it hasn't yet. + * + * @since S60 v5.1 + * + */ + void MonitorPhysicalLink(); + + /** + * Opens physical link adaptor with the device. + * + * @since S60 v5.1 + * @return KErrNone if the physical link exists. + * + */ + TInt OpenPhysicalLinkAdaptor(); + + /** + * Cancel all outstanding requests. + * + * @since S60 v5.1 + */ + void CancelPlaNotification(); + + /** + * Handle a physical link event. + * + * @since S60 v5.1 + * @param aResult The status code of the event. + */ + void HandlePhysicalLinkResultL( TInt aResult ); + +private: + + /** + * Package buffer for retrieving physical link events. + */ + TBTBasebandEvent iBbEvent; + + /** + * Subsession with the socket server for + * getting physical link event notifications. + */ + RBTPhysicalLinkAdapter iPla; + + /** + * iPairingOkTimer is activated if the link goes down. + * If it expires it means the pairing process has failed, + * then the error popup will be shown. + * If the pairing process ends correctly, DoHandleRegistryNewPairedEvent + * will be called and it will cancel the timer. + * iActivePairingOk is the active object associated to the timer. + */ + RTimer iPairingOkTimer; + CBTEngActive* iActivePairingOk; + TBool iUserAwarePairing; + }; + +#endif /*BTENGINCPAIR_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengotgpair.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/inc/btengotgpair.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,181 @@ +/* +* 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: Helper class for performing pairing (i.e. bonding) +* with another device. +* +*/ + +#ifndef BTENGOTGPAIR_H_ +#define BTENGOTGPAIR_H_ + +#include +#include +#include +#include "btengpairbase.h" +#include "btengprivatepskeys.h" + +/** + * Perform a outgoing pair with a BT device. + * + * @lib ?library + * @since S60 v5.1 + */ +NONSHARABLE_CLASS( CBTEngOtgPair ) : public CBTEngPairBase + { + +public: + + /** + * Two-phase constructor + * @param aParent the owner of this object + * @param aAddr the remote device this observer is targeted to + */ + static CBTEngPairBase* NewL( CBTEngPairMan& aParent, + const TBTDevAddr& aAddr ); + + /** + * Destructor + */ + ~CBTEngOtgPair(); + +private: // From CBTEngPairBase + + /** + * Start observing the result of pairing which was originated from + * the remote device. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + TInt ObserveIncomingPair( const TBTDevAddr& aAddr ); + + /** + * Start an outgoing pairing with the remote device. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ); + + /** + * Cancel any outstanding pairing operation. + */ + void CancelOutgoingPair(); + + /** + * Cancels pairing handling with the specified device + * @param aAddr the address of the device the pairing is with + */ + void StopPairHandling( const TBTDevAddr& aAddr ); + + /** + * Handle a pairing result with the remote device which this is for. + * Must be specialized by subclass. + * + * @param aResult The status code of the pairing or authentication result. + */ + void DoHandlePairServerResult( TInt aResult ); + + /** + * Handles registry new paired event for the remote + * device this is pairing with. + * @aType the type of authentication with the device. + */ + void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); + +private: // from base class MBTEngActiveObserver + + /** + * From MBTEngActiveObserver. + * Callback to notify that an outstanding request has completed. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTEngActiveObserver. + * Callback to notify that an error has occurred in RunL. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); + +private: + + /** + * C++ default constructor + */ + CBTEngOtgPair( CBTEngPairMan& aParent, const TBTDevAddr& aAddr ); + + /** + * Symbian 2nd-phase constructor + */ + void ConstructL(); + + /** + * Starts an actual pair operation. + */ + void DoPairingL(); + + /** + * Cancel any outstanding pairing operation. + */ + void DoCancelOutgoingPair(); + +private: // data + + /** + * Socket address of the remote device to pair with. + */ + TBTSockAddr iSockAddr; + + /** + * The CoD of the device to be paired + */ + TUint32 iCod; + + /** + * Dedicated bonding session to the pairing server. + */ + RBluetoothDedicatedBondingInitiator iBondingSession; + + /** + * socket for creating L2CAP link with the remote device. + */ + RSocket iSocket; + + /** + * Timer for recovery from Repeated Attempts + */ + RTimer iTimer; + + /** + * used for getting and setting outgoing pair state + */ + RProperty iOutgoProperty; + + /** + * the current pairing mode this class is in + */ + TBTOutgoingPairMode iPairMode; + + }; + + +#endif // BTENGOTGPAIR_H_ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengpairbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/inc/btengpairbase.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: the base class of pairing handling +* +*/ + + +#ifndef BTENGPAIRBASE_H_ +#define BTENGPAIRBASE_H_ + +#include +#include +#include +#include "btengactive.h" + +class CBTEngPairMan; + +/** Identification for asynchronous operations */ +enum TPairBaseActiveRequestId + { + EDevicePairUserNotification = 1 + }; + +/** + * Class CBTEngPairBase + * + * The base class for pairing handling. + * When the pairing has completed (successfully or unsuccessfully), the user + * is informed of the result + * + * @since S60 S60 v5.1 + */ +NONSHARABLE_CLASS( CBTEngPairBase ) : public CBase, public MBTEngActiveObserver + { +public: + + /** + * Destructor + */ + virtual ~CBTEngPairBase(); + + /** + * Handle a pairing result from the pairing server. + * + * @param aAddr the address of the remote device which the result is for. + * @param aResult The status code of the pairing or authentication result. + */ + void HandlePairServerResult( const TBTDevAddr& aAddr, TInt aResult ); + + /** + * Handles event of new paired device event in registry. + * @param aDev the remote device which the pair is with. + */ + void HandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); + + /** + * Start observing the result of the pairing originated by + * the remote device. + * Must be specialized by subclass. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + virtual TInt ObserveIncomingPair( const TBTDevAddr& aAddr ) = 0; + + /** + * Start an outgoing pairing with the remote device. + * Must be specialized by subclass. + * @param the address of the remote device to be paired + * @return KErrNone if this request is accepted; otherwise an error code + */ + virtual void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) = 0; + + /** + * Cancel the outstanding pairing operation. + */ + virtual void CancelOutgoingPair(); + + /** + * Cancels pairing handling with the specified device + * @param aAddr the address of the device the pairing is with + */ + virtual void StopPairHandling( const TBTDevAddr& aAddr ) = 0; + +protected: + + /** + * Handle a pairing result with the remote device which this is for. + * Must be specialized by subclass. + * + * @param aResult The status code of the pairing or authentication result. + */ + virtual void DoHandlePairServerResult( TInt aResult ) = 0; + + /** + * Handles event of registry new paired event with the remote + * device this is for. + * Must be specialized by subclass. + * @aType the type of authentication with the device. + */ + virtual void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) = 0; + +protected: + + /** + * C++ default constructor + */ + CBTEngPairBase(CBTEngPairMan& aParent, const TBTDevAddr& aAddr); + + /** + * Symbian 2nd-phase constructor + */ + void BaseConstructL(); + + /** + * Cancels notifying user about the pairing result. + */ + void CancelNotifier(); + + /** + * Show the pairing result and ask the user to authorize the device if + * pair succeeded. + * + * @since S60 v5.1 + */ + void ShowPairingNoteAndAuthorizeQuery(); + + /** + * Invalidate the pair result flag of this + */ + void UnSetPairResult(); + + /** + * Sets the pair result and validate pair result flag + */ + void SetPairResult( TInt aResult ); + + /** + * Tells if the pair result has been set. + * @ETrue if the result has been set. + */ + TBool IsPairResultSet(); + + /** + * Tells if this is notifying user the pairing result. + * @return ETrue if this is is notifying user the pairing result + */ + TBool IsNotifyingPairResult(); + +protected: + + /** + * Address of the remote device we are trying to pair. + */ + TBTDevAddr iAddr; + + /** + * Contains the final result of pairing with the remote device + */ + TInt iPairResult; + + /** + * Pair result flag, ETrue if iPairResult is been set. + */ + TBool iPairResultSet; + + /** + * Reference to the owner of this object. + */ + CBTEngPairMan& iParent; + + /** + * Package buffer for passing parameters to authorization notifier. + */ + TBTPairedDeviceSettingParamsPckg iAuthoPckg; + + /** + * Session with the notifier server. + * Own. + */ + RNotifier iNotifier; + + /** + * Active object helper for asynchronous operations. + * Own. + */ + CBTEngActive* iActive; + }; + +#endif /*BTENGPAIRBASE_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengpairman.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/inc/btengpairman.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,355 @@ +/* +* 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: Pairing manager header definition +* +*/ + +#ifndef BTENGPAIRMANAGER_H_ +#define BTENGPAIRMANAGER_H_ + +#include +#include +#include +#include "btengactive.h" +#include "btengconstants.h" + +class CBTEngPairBase; +class CBTEngServer; + +/** + * Class CBTEngPairMan + * + * This class manages pairing with BT devices. + * The responsibility of handling incoming and outgoing pairings is + * delegated to CBTEngIncPair and CBTEngOtgPair respectively. + * + * @since S60 S60 v5.1 + */ +NONSHARABLE_CLASS( CBTEngPairMan ) : public CBase, public MBTEngActiveObserver + { +public: + + /** + * Two-phase constructor + */ + static CBTEngPairMan* NewL( CBTEngServer& aServer ); + + /** + * Destructor + */ + ~CBTEngPairMan(); + + /** + * Cancels an outstanding pairing request. + */ + void CancelOutgoingPair(); + + /** + * Process commands relevant to pairing + */ + void ProcessCommandL( const RMessage2& aMessage ); + + /** + * Handle a change in BTRegistry remote device table. + * + * @since S60 v5.1 + */ + void RemoteRegistryChangeDetected(); + + /** + * Gets the instance of pairing server. + * @return the server instance. NULL if dedicated bonding is unavailable. + */ + RBluetoothPairingServer* PairingServer(); + + /** + * gets the reference of socket server session + */ + RSocketServ& SocketServ(); + + /** + * gets the reference of registry session. + */ + RBTRegServ& BTRegServ(); + + /** + * Transfer responsiblity to the specified object. + * @param aPairer the object to which the responsibility is transfered. + */ + void RenewPairer( CBTEngPairBase* aPairer ); + + /** + * Be notified when handling of an outgoing pair has been completed. + * @param aErr the result of pairing + * + */ + void OutgoingPairCompleted( TInt aErr ); + + /** + * Be informed that a session will be closed. + * + * @since Symbian^3 + * @param aSession the session to be cloased. + */ + void SessionClosed(CSession2* aSession ); + + /** + * Unpair a device via registry + */ + void UnpairDevice( const TBTDevAddr& aAddr ); + + /** + * Add the bit indicating the device is user-aware Just worked paired to + * UI cookie. + */ + TInt AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ); + + /** + * Update a nameless device in registry + */ + TInt UpdateRegDevice( const TBTNamelessDevice& aDev ); + + + /** + * Returns the service (limited to services managed in bteng scope) + * level connection status of the specified device. + * + * @param aAddr the address of the device + * @return one of TBTEngConnectionStatus enums + */ + TBTEngConnectionStatus IsDeviceConnected( const TBTDevAddr& aAddr ); + +private: // from base class MBTEngActiveObserver + + /** + * From MBTEngActiveObserver. + * Callback to notify that an outstanding request has completed. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTEngActiveObserver. + * Callback to notify that an error has occurred in RunL. + * + * @since S60 v5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); + +private: + + /** + * C++ default constructor + */ + CBTEngPairMan( CBTEngServer& aServer ); + + /** + * Symbian 2nd-phase constructor + */ + void ConstructL(); + + /** + * Initialiases the paired devices list + */ + void InitPairedDevicesList(); + + /** + * Initialises the paired devices list (second stage) + */ + void DoInitPairedDevicesList(); + + /** + * Activate / deactivate a pair observer + */ + TInt SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate); + + /** + * Pair a BT device. + */ + void PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ); + + /** + * Cancel all subscribes to pairng server + */ + void CancelSubscribe(); + + /** + * subscribe to receive SSP pairing result from pairing server + */ + void SubscribeSspPairingResult(); + + /** + * Subscribe to receive authentication result from pairing server + */ + void SubscribeAuthenticateResult(); + + /** + * Handle a pairing result from the pairing server. + * + * @since S60 v5.1 + * @param aResult The status code of the authentication result. + */ + void HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ); + + /** + * Creates a registry view which shall contain all paired devices. + */ + void CreatePairedDevicesView( TInt aReqId ); + + /** + * retrieves paired devices from registry. + */ + void GetPairedDevices( TInt aReqId ); + + /** + * handles the completion of paired device view creation + */ + void HandleCreatePairedDevicesViewCompletedL( TInt aStatus, TInt aReqId ); + + /** + * handles the completion of getting paired devices + */ + void HandleGetPairedDevicesCompletedL( TInt aStatus, TInt aReqId ); + + /** + * Copy the paired devices to internal array storage. + */ + void UpdatePairedDeviceListL(); + + /** + * Checks if any devices have been paired or unpaired. For each new paired device, + * the pair event will be delegated to corresponding pair observer if it exists; + * otherwise create a new pair observer for this pair event. + */ + void CheckPairEventL(); + +private: + + /** + * Owner of this class. + * Not owned. + */ + CBTEngServer& iServer; + + /** + * Registry sub session for remote device db + */ + RBTRegistry iBTRegistry; + + /** + * contains the list of all paired devices. + * Using heap here to make efficient array swap. + */ + RArray* iPairedDevices; + + /** + * temporary instance to retrieve paired devices. + */ + CBTRegistryResponse* iPairedDevicesResp; + + /** + * the counter of not handled registry events. + */ + TInt iNotHandledRegEventCounter; + + /** + * Session with the pairing server. + * Allocate it in heap to ease the handling for + * situation of unavailable dedicated pairing service. + * + * own. + */ + RBluetoothPairingServer* iPairingServ; + + /** + * Subsession with the pairing server for + * getting the simple pairing result. + * own + */ + RBluetoothPairingResult iPairingResult; + + /** + * Subsession with the pairing server for + * getting the authentication result. + * own + */ + RBluetoothAuthenticationResult iAuthenResult; + + /** + * the address with which a simple pairing has been performed + */ + TBTDevAddr iSimplePairingRemote; + + /** + * the address with which an authentication has been performed + */ + TBTDevAddr iAuthenticateRemote; + + /** + * Active object helper for receiving simple pairing results. + * Own. + */ + CBTEngActive* iSSPResultActive; + + /** + * Active object helper for receiving authentication results. + * Own. + */ + CBTEngActive* iAuthenResultActive; + + /** + * AO for registry operations + */ + CBTEngActive* iRegistryActive; + + /** + * pair hanlder at the time. + * Own. + */ + CBTEngPairBase* iPairer; + + /** + * Client-server message for power change requests. + */ + RMessage2 iMessage; + + /** + * AO for local address updates. + */ + CBTEngActive* iLocalAddrActive; + + /** + * Provides access to the BT local device address. + */ + RProperty iPropertyLocalAddr; + + /** + * Records whether or not this CBTEngPairMan has ever been involed in a pairing operaton. + */ + TBool iPairingOperationAttempted; + + /** + * Counter of unhandled paired device view initialisation requests. + */ + TInt iNotHandledInitEventCounter; + }; + +#endif /*BTENGPAIRMANAGER_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengserver.h --- a/bluetoothengine/bteng/inc/btengserver.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengserver.h Wed Sep 01 12:20:04 2010 +0100 @@ -32,6 +32,7 @@ class CBTEngSrvBBConnMgr; class CBTEngSrvKeyWatcher; class CBTEngSdpDbHandler; +class CBTEngPairMan; class CPolicyServer; class TEComResolverParams; class CImplementationInformation; @@ -149,6 +150,14 @@ inline CBTEngSrvBBConnMgr* BasebandConnectionManager() const { return iBBConnMgr; } + /** + * Getter for pairing manager. Ownership is not transferred. + * + * @since Symbian^3 + * @return Pointer to instance of baseband connection manager. + */ + inline CBTEngPairMan* PairManager() const + { return iPairMan; } /** * Getter for socket server session. @@ -161,6 +170,16 @@ { return iSocketServ; } /** + * Getter for registry server session. + * This handle can be used for creating subsessions. + * + * @since Symbian^3 + * @return Reference to session with the registry server. + */ + inline RBTRegServ& RegistrServer() + { return iBTRegServ; } + + /** * Set Bluetooth on or off * * @since S60 v3.2 @@ -386,6 +405,11 @@ * Callback for expiry of Simple Pairing debug mode. */ TDeltaTimerEntry iDebugModeCallBack; + + /** + * Pairing manager. + */ + CBTEngPairMan* iPairMan; /** * Socket Server instance for this and other classes to access Bluetooth socket APIs. @@ -393,6 +417,11 @@ RSocketServ iSocketServ; /** + * Registry Server instance for bteng to access Bluetooth registry APIs. + */ + RBTRegServ iBTRegServ; + + /** * Our state machine for handling power on/off. * Own. */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengsrvbbconnectionmgr.h --- a/bluetoothengine/bteng/inc/btengsrvbbconnectionmgr.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengsrvbbconnectionmgr.h Wed Sep 01 12:20:04 2010 +0100 @@ -149,27 +149,22 @@ * * @since S60 v3.2 * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. * @param aStatus The status of the completed request. */ - virtual void RequestCompletedL( CBTEngActive* aActive, + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** * From MBTEngActiveObserver. * Callback to notify that an error has occurred in RunL. * * @since S60 v3.2 * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. * @param aStatus The status of the completed request. */ - virtual void HandleError( CBTEngActive* aActive, + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengsrvkeywatcher.h --- a/bluetoothengine/bteng/inc/btengsrvkeywatcher.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengsrvkeywatcher.h Wed Sep 01 12:20:04 2010 +0100 @@ -60,24 +60,17 @@ * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void RequestCompletedL( CBTEngActive* aActive, + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** * From MBTEngActiveObserver. * Notification that a key value has changed. * * @since S60 v3.2 * @param ?arg1 ?description */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ); + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: @@ -149,6 +142,11 @@ RProperty iSspDebugModeKey; /** + * Property containing the BT registry change monitoring key + */ + RProperty iBtRegistryKey; + + /** * Session with the central repository for BT SAP mode setting. * We load/unload BT SAP plugin. * Own. @@ -210,6 +208,12 @@ CBTEngActive* iSspDebugModeWatcher; /** + * Active object for subscribing to BT registry property changes. + * Own. + */ + CBTEngActive* iBtRegistryWatcher; + + /** * Pointer to our parent. * Not own. */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btengsrvsettingsmgr.h --- a/bluetoothengine/bteng/inc/btengsrvsettingsmgr.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/inc/btengsrvsettingsmgr.h Wed Sep 01 12:20:04 2010 +0100 @@ -29,7 +29,6 @@ #include "btengactive.h" class CBTEngServer; -class CHbIndicatorSymbian; /** @@ -113,13 +112,12 @@ void StopBTStackL(); /** - * Handles a power event that HW power is going to turn off or - * has been changed turned on. + * Update the central repository key for Bluetooth power state. * - * @since Symbian^4 - * @param aValue The new Bluetooth HW power state. + * @since Symbian^3 + * @param aValue The new Bluetooth power state. */ - void HandleHwPowerChangeL( TBTPowerState aValue ); + void UpdateCenRepPowerKeyL( TBTPowerState aValue ); /** * ?description @@ -131,11 +129,12 @@ /** * ?description - * - * @param aState Current State of the Bluetooth + * + * @since S60 v3.2 + * @param ?arg1 ?description */ - void SetIndicatorStateL( const TInt aState ); - + void SetIndicatorStateL( const TInt aIndicator, const TInt aState ); + /** * Update the Bluetooth visibility mode. * @@ -200,26 +199,21 @@ * * @since Symbian^3 * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. * @param aStatus The status of the completed request. */ - virtual void RequestCompletedL( CBTEngActive* aActive, TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - + virtual void RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ); + /** * From MBTEngActiveObserver. * Callback to notify that an error has occurred in RunL. * * @since Symbian^3 * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. * @param aStatus The status of the completed request. */ - virtual void HandleError( CBTEngActive* aActive, TInt aError ); + virtual void HandleError( CBTEngActive* aActive, TInt aId, TInt aError ); private: @@ -251,7 +245,7 @@ * @param aTemporary Indicates if this is about a tempororary state change. */ void CheckTemporaryPowerStateL( TBTPowerState& aCurrentState, - TBTPowerState aNewState, TBool aTemporary ); + TBTPowerState aNewState, TBool aTemporary ); private: // data @@ -305,15 +299,6 @@ */ RMessage2 iMessage; - /** - * Orbit Indicator to display Bluetooth Status - */ - CHbIndicatorSymbian* iBTIndicator; - - /* - * Indicator State - */ - TInt iIndicatorState; }; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/inc/btotgpairpub.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/inc/btotgpairpub.inl Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,137 @@ +/* +* 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: Implements getting/setting outgoing pair status +* from/to P&S KBTOutgoingPairing from btengprivatepskeys.h. +* +*/ + +#include "btengprivatepskeys.h" +#include + +// ---------------------------------------------------------- +// Get outgoing pair status from PS +// ---------------------------------------------------------- +// +inline void OutgoPairingProperty(RProperty& aProperty, + TBTDevAddr& aAddr, TBTOutgoingPairMode& aMode) + { + TBuf8 propDes; + TInt err = aProperty.Get( propDes ); + if ( !err && propDes.Length() == sizeof( TBTOutgoingPairProperty ) ) + { + TBTOutgoingPairProperty prop; + TPckgC tmpPckg( prop ); + tmpPckg.Set( propDes ); + aAddr = tmpPckg().iAddr; + aMode = tmpPckg().iMode; + } + else + { + aMode = EBTOutgoingPairNone; + } + } + +// ---------------------------------------------------------- +// Get outgoing pair status from PS +// ---------------------------------------------------------- +// +inline void OutgoPairingProperty(TBTDevAddr& aAddr, TBTOutgoingPairMode& aMode) + { + RProperty property; + TInt err = property.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTOutgoingPairing ); + if ( !err ) + { + OutgoPairingProperty( property, aAddr, aMode ); + } + else + { + aMode = EBTOutgoingPairNone; + } + property.Close(); + } + +// ---------------------------------------------------------- +// Tells if another outgoing pairing is ongoing with a device +// other than the specified one. +// ---------------------------------------------------------- +// +inline TBool OtherOutgoPairing( const TBTDevAddr& aAddr ) + { + TBTDevAddr outpaddr; + TBTOutgoingPairMode mode; + OutgoPairingProperty( outpaddr, mode ); + return mode != EBTOutgoingPairNone && outpaddr != aAddr; + } + +// ---------------------------------------------------------- +// Gets the status of outgoing pair with the specified device. +// ---------------------------------------------------------- +// +inline TBTOutgoingPairMode OutgoPairingMode( + RProperty& aProperty, const TBTDevAddr& aAddr ) + { + TBTDevAddr addr; + TBTOutgoingPairMode mode; + OutgoPairingProperty(aProperty, addr, mode ); + return ( addr == aAddr ) ? mode : EBTOutgoingPairNone; + } + +// ---------------------------------------------------------- +// Gets the status of outgoing pair with the specified device. +// ---------------------------------------------------------- +// +inline TBTOutgoingPairMode OutgoPairingMode(const TBTDevAddr& aAddr) + { + TBTDevAddr addr; + TBTOutgoingPairMode mode; + OutgoPairingProperty( addr, mode ); + return ( addr == aAddr ) ? mode : EBTOutgoingPairNone; + } + +// ---------------------------------------------------------- +// publish outgoing pairing status to PS +// ---------------------------------------------------------- +// +inline void SetOutgoPairProperty(RProperty& aProperty, + const TBTDevAddr& aAddr, + TBTOutgoingPairMode aMode ) + { + if ( aMode == EBTOutgoingPairNone ) + { + (void) aProperty.Set( KNullDesC8 ); + return; + } + TPckgBuf tmpPckg; + tmpPckg().iAddr = aAddr; + tmpPckg().iMode = aMode; + (void) aProperty.Set( tmpPckg ); + } + +// ---------------------------------------------------------- +// Locally instantiate a RProperty and Set Outgoing Pair Property +// ---------------------------------------------------------- +// +inline void SetOutgoPairProperty(const TBTDevAddr& aAddr, + TBTOutgoingPairMode aMode ) + { + RProperty property; + TInt err = property.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTOutgoingPairing ); + if ( !err ) + { + SetOutgoPairProperty( property, aAddr, aMode ); + } + property.Close(); + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengclient.cpp --- a/bluetoothengine/bteng/src/btengclient.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengclient.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -255,6 +255,17 @@ // --------------------------------------------------------------------------- +// Set a pairing observer in BTEngine. +// --------------------------------------------------------------------------- +// +TInt RBTEng::SetPairingObserver( const TBTDevAddr& aAddr, TBool aActivate ) + { + TBTDevAddrPckgBuf addrPkg( aAddr ); + return SendReceive( EBTEngSetPairingObserver, TIpcArgs( &addrPkg, aActivate ) ); + } + + +// --------------------------------------------------------------------------- // ?implementation_description // --------------------------------------------------------------------------- // @@ -262,3 +273,22 @@ { return SendReceive( EBTEngPrepareDiscovery, TIpcArgs() ); } + +// --------------------------------------------------------------------------- +// Start to pair a device in BTEngine. +// --------------------------------------------------------------------------- +// +void RBTEng::PairDevice( const TBTDevAddrPckgBuf& aAddr, + const TUint32& aDeviceClass, TRequestStatus& aStatus ) + { + SendReceive( EBTEngPairDevice, TIpcArgs( &aAddr, aDeviceClass ), aStatus ); + } + +// --------------------------------------------------------------------------- +// cancel pairing request +// --------------------------------------------------------------------------- +// +void RBTEng::CancelPairDevice( ) + { + (void) SendReceive( EBTEngCancelPairDevice); + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengincpair.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/src/btengincpair.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,362 @@ +/* +* 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: BT determines pairing status +* +*/ + +#include "btengincpair.h" +#include "btengpairman.h" +#include "btengotgpair.h" +#include "btengconstants.h" +#include "debug.h" + +const TInt KBTEngWaitingForPairingOkDelay = 500000; // 0.5s + +enum TPairingStageId + { + /** + * is monitoring physical link status + */ + EPhysicalLinkNotify = EDevicePairUserNotification + 1, + EWaitingForPairingOk, + }; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTEngIncPair::CBTEngIncPair( CBTEngPairMan& aParent, + const TBTDevAddr& aAddr) : CBTEngPairBase( aParent, aAddr ) + { + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::ConstructL() + { + BaseConstructL(); + iActivePairingOk = CBTEngActive::NewL(*this, EWaitingForPairingOk, CActive::EPriorityStandard); + User::LeaveIfError( iPairingOkTimer.CreateLocal() ); + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTEngIncPair* CBTEngIncPair::NewL( CBTEngPairMan& aParent, + const TBTDevAddr& aAddr) + { + CBTEngIncPair* self = new (ELeave) CBTEngIncPair(aParent, aAddr); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTEngIncPair::~CBTEngIncPair() + { + TRACE_FUNC_ENTRY + // Cancel all outstanding requests + CancelPlaNotification(); + iPla.Close(); + iPairingOkTimer.Cancel(); + iPairingOkTimer.Close(); + if(iActivePairingOk) + { + iActivePairingOk->CancelRequest(); + delete iActivePairingOk; + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Accept this message only if the specified device is the same as this is +// dealing with. +// --------------------------------------------------------------------------- +// +TInt CBTEngIncPair::ObserveIncomingPair( const TBTDevAddr& aAddr ) + { + TInt err( KErrServerBusy ); + if ( iAddr == aAddr ) + { + err = KErrNone; + iUserAwarePairing = ETrue; // This function is called by a notifier, which means the UI has been involved + // Therefore we can display it in the paired devices list + if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() ) + { + // If we are observing physical link, or showing user a note, + // we won't interrupt it. + UnSetPairResult(); + MonitorPhysicalLink(); + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Assign the responsibility of outgoing pair handling to CBTEngOtgPair +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) + { + TRACE_FUNC_ENTRY + // Outgoing pairing always takes highest priority: + CBTEngPairBase* pairer = CBTEngOtgPair::NewL( iParent, aAddr ); + pairer->HandleOutgoingPairL( aAddr, aCod ); + iParent.RenewPairer( pairer ); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Accept this message only if the specified device is the same as this is +// dealing with. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::StopPairHandling( const TBTDevAddr& aAddr ) + { + if ( aAddr == iAddr ) + { + TRACE_FUNC_ENTRY + iParent.RenewPairer( NULL ); + TRACE_FUNC_EXIT + } + } + +// --------------------------------------------------------------------------- +// Notify user if pairing failed. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::DoHandlePairServerResult( TInt aResult ) + { + CancelPlaNotification(); + // For a successful pairing, we need wait for registry table change. + if( aResult != KErrNone && aResult != KHCIErrorBase ) + { + // Pair failure situation. + SetPairResult( aResult ); + ShowPairingNoteAndAuthorizeQuery(); + } + } + +// --------------------------------------------------------------------------- +// Kill this if the linkkey type indicates OBEX authentication. +// Otherwise notify user the pair result. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) + { + TRACE_FUNC_ENTRY + + // First of all cancel the iPairingOkTimer timer, if active + if (iActivePairingOk->IsActive()) + { + iPairingOkTimer.Cancel(); + iActivePairingOk->CancelRequest(); + UnSetPairResult(); // we might have set it before (if the link went down) so we want to reset it. + } + if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing) + { + // If an application uses btengconnman API to connect a service of + // this device and JW pairing occurred as part of security enforcement, + // it shall be a user aware pairing, and we shall add this device in paired + // view. In this way, user is able to disconnect the device from our UI. + // Otherwise the link key has been created by a device without IO requesting + // a service connection with phone. We won't take any action (e.g. remove + // link key) in this case. As the result, this device can't be seen in our UI, + // however other applications are still freely to use its services. + TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with no IO device" ) ) + TBTEngConnectionStatus status = iParent.IsDeviceConnected( aDev.Address() ); + if ( status == EBTEngConnecting || status == EBTEngConnected ) + { + // the return error is ingore as we can not have other proper + // exception handling option: + (void) iParent.AddUiCookieJustWorksPaired( aDev ); + } + iParent.RenewPairer( NULL ); + } + else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing) + { + // The linkkey has been created by an incoming OBEX service request + // which resulted a pairing event received from pair server. + TRACE_INFO(_L("[BTEng]: CBTEngIncPair: JW pairing with IO device" ) ) + iParent.RenewPairer( NULL ); + } + else + { + if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable) + { + // The user was involved in the pairing, so display in the paired devices list + (void) iParent.AddUiCookieJustWorksPaired(aDev); + } + TRACE_INFO(_L("[BTEng]: CBTEngIncPair: Non-JW pairing")) + // Other pairing model than Just Works: + CancelPlaNotification(); + SetPairResult( KErrNone ); + ShowPairingNoteAndAuthorizeQuery(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::RequestCompletedL( CBTEngActive* /*aActive*/, TInt aId, TInt aStatus ) + { + TRACE_FUNC_ARG( ( _L( "aId: %d, aStatus: %d"), aId, aStatus ) ) + // Check which request completed. + switch( aId ) + { + case EPhysicalLinkNotify: + { + // Check if the link has disconnected. + HandlePhysicalLinkResultL( aStatus ); + break; + } + case EDevicePairUserNotification: + { + // the user has been informed of the result, kill this: + TRACE_INFO(_L("[BTENG]:CBTEngIncPair authorization notifier completed") ) + iParent.RenewPairer( NULL ); + break; + } + case EWaitingForPairingOk: + { + // pairing failed, inform user: + if (iPairResult == KErrNone) + { + // iPairResult must have been set as an error. if it's not it means somewhere else + // it has been reset. But we need to have it set to an error as we are notifying + // the "unable to pair" message. + SetPairResult(KErrGeneral); + } + ShowPairingNoteAndAuthorizeQuery(); + break; + } + default: + // Should not be possible, but no need for handling. + TRACE_INFO( (_L("[BTEng]: CBTEngIncPair::RequestCompletedL unhandled event!!") ) ) + break; + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Handles a leave in RequestCompleted by simply self-destructing. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) + { + TRACE_FUNC_ARG( ( _L( "request id: %d, error: %d" ), aId, aError ) ) + (void) aActive; + (void) aId; + (void) aError; + // Our error handling is to just stop observing. + // Nothing critical to be preserved herer, the user + // just won't get any notification of pairing result. + iParent.RenewPairer( NULL ); + } + +// --------------------------------------------------------------------------- +// Subscribe to physical link notifications. +// physical link must exist when calling this function. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::MonitorPhysicalLink() + { + TRACE_FUNC_ENTRY + iActive->SetRequestId( EPhysicalLinkNotify ); + // Subscribe to disconnect and error events. + iPla.NotifyNextBasebandChangeEvent( iBbEvent, + iActive->RequestStatus(), + ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); + iActive->GoActive(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Opens the adaptor if physical link exists. +// --------------------------------------------------------------------------- +// +TInt CBTEngIncPair::OpenPhysicalLinkAdaptor() + { + TRACE_FUNC_ENTRY + TInt err ( KErrNone ); + if( !iPla.IsOpen() ) + { + // Try to open the adapter in case it failed earlier. + // This can happen for outgoing dedicated bonding with + // non-SSP device, as the PIN dialog can be kept open even + // though the link has dropped because of a time-out. + err = iPla.Open( iParent.SocketServ(), iAddr ); + } + TRACE_INFO( (_L("[BTEng]: CBTEngIncPair::HasPhysicalLink ? %d"), iPla.IsOpen() ) ) + return err; + } + +// --------------------------------------------------------------------------- +// Cancel outstanding physical link notification +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::CancelPlaNotification() + { + TRACE_FUNC_ENTRY + if( iActive && iActive->IsActive() && + iActive->RequestId() == EPhysicalLinkNotify ) + { + // cancel Baseband monitor + iPla.CancelNextBasebandChangeEventNotifier(); + iActive->Cancel(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Handle a physical link event. Notify pair failed if physical link is down. +// --------------------------------------------------------------------------- +// +void CBTEngIncPair::HandlePhysicalLinkResultL( TInt aResult ) + { + TRACE_FUNC_ARG( ( _L( " BBEvent 0x%08X, code %d"), + iBbEvent().EventType(), iBbEvent().SymbianErrorCode() ) ) + // Check if the connection is still alive. + TBool physicalLinkDown = + ( iBbEvent().EventType() == ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); + + if( aResult || physicalLinkDown ) + { + // link went down. It might be because of pairing failed or the remote device disconnected the + // physical link after a successful pairing. + // we wait for 0.5 secs before notifying the "unable to pair" message as, if the pair is + // successful, we manage it to show the right confirmation message. + SetPairResult( (aResult == 0) ? KErrGeneral : aResult ); + iPairingOkTimer.After(iActivePairingOk->iStatus, KBTEngWaitingForPairingOkDelay); + iActivePairingOk->GoActive(); + } + else + { + // Uninteresting event, re-subscribe. + MonitorPhysicalLink(); + } + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengotgpair.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/src/btengotgpair.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,368 @@ +/* +* Copyright (c) 2006-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: Helper class for performing pairing (i.e. bonding) +* with another device. +* +*/ + +#include "btengotgpair.h" +#include +#include "btengpairman.h" +#include "btotgpairpub.inl" +#include "debug.h" + +enum TPairingStageId + { + /** + * no pairing operation ongoing + */ + ENoBonding = 0, + + /** + * pair with dedicated bonding method + */ + EDedicatedBonding = EDevicePairUserNotification + 1, + + /** + * pair with general bonding by establishing L2CAP connection. + */ + EGeneralBonding, + + /** + * delaying next pairing request for a while + */ + EGeneralBondingRetryTimer, + + /** + * The last pairing retry + */ + EGeneralBondingRetry + }; + +/** SDP PSM (used for pairing) */ +const TInt KSDPPSM = 0x0001; + +// Delay time to void Repeated Attempts on pairing +const TInt KBTEngGeneralBondingRetryDelayMicroSeconds = 5000000; // 5.0s + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTEngOtgPair::CBTEngOtgPair( CBTEngPairMan& aParent, const TBTDevAddr& aAddr) + : CBTEngPairBase( aParent, aAddr ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::ConstructL() + { + TRACE_FUNC_ENTRY + BaseConstructL(); + User::LeaveIfError( iOutgoProperty.Attach( KPSUidBluetoothEnginePrivateCategory, + KBTOutgoingPairing ) ); + User::LeaveIfError( iTimer.CreateLocal() ); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTEngPairBase* CBTEngOtgPair::NewL( CBTEngPairMan& aParent, + const TBTDevAddr& aAddr ) + { + CBTEngOtgPair* self = new( ELeave ) CBTEngOtgPair( aParent, aAddr ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTEngOtgPair::~CBTEngOtgPair() + { + TRACE_FUNC_ENTRY + SetOutgoPairProperty( iOutgoProperty, TBTDevAddr(), EBTOutgoingPairNone ); + CancelNotifier(); + DoCancelOutgoingPair(); + iBondingSession.Close(); + iSocket.Close(); + iTimer.Close(); + iOutgoProperty.Close(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Simply deny the request as this is handing outgoing pairing +// --------------------------------------------------------------------------- +// +TInt CBTEngOtgPair::ObserveIncomingPair( const TBTDevAddr& /*aAddr*/ ) + { + return KErrServerBusy; + } + +// --------------------------------------------------------------------------- +// Accept the request only this device is not busy with another pairing request. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) + { + TRACE_FUNC_ARG( ( _L(" cod 0x%08x"), aCod ) ) + if ( iActive->IsActive() || aAddr != iAddr ) + { + // we don't allow another pairing request. + User::Leave( KErrServerBusy ); + } + + iAddr = aAddr; + iCod = aCod; + UnSetPairResult(); + iParent.UnpairDevice( iAddr ); + TBTDeviceClass decls( iCod ); + if ( decls.MajorDeviceClass() == EMajorDeviceAV && + decls.MinorDeviceClass() != EMinorDeviceAVHandsfree ) + { + // If the devie is a headset, set to 0000 pin auto pairing + iPairMode = EBTOutgoingHeadsetAutoPairing; + } + else + { + iPairMode = EBTOutgoingNoneHeadsetPairing; + } + SetOutgoPairProperty( iOutgoProperty, iAddr, iPairMode ); + DoPairingL(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Cancels an outstanding pair request by self-destruct +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::CancelOutgoingPair() + { + TRACE_FUNC_ENTRY + iParent.RenewPairer( NULL ); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Abort pairing handling, request the owner to destroy this. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::StopPairHandling( const TBTDevAddr& aAddr ) + { + if ( aAddr == iAddr ) + { + TRACE_FUNC_ENTRY + iParent.OutgoingPairCompleted( KErrCancel ); + iParent.RenewPairer( NULL ); + TRACE_FUNC_EXIT + } + } + +// --------------------------------------------------------------------------- +// Pairing result will be received when pairing operation completes. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::DoHandlePairServerResult( TInt aResult ) + { + if (aResult == (KHCIErrorBase-EPairingNotAllowed)) + { + // if EPairingNotAllowed is recieved then any further pairing attempts will fail + // so don't attampt to pair + iPairMode = EBTOutgoingPairNone; + } + } + +// --------------------------------------------------------------------------- +// Cancels possible outstanding pairing and notify user pair success. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) + { + TRACE_FUNC_ENTRY + if ( !IsNotifyingPairResult() ) + { + TInt err( KErrNone ); + // If pairing was performed using Just Works mode, we set a + // UICookie to indicate that the device is successfully + // bonded so that this device will be listed in paired device view of + // bluetooth application: + if ( aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable ) + { + TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair, Just Works pairing" ) ) ); + err = iParent.AddUiCookieJustWorksPaired( aDev ); + } + DoCancelOutgoingPair(); + SetPairResult( err ? err : KErrNone ); + ShowPairingNoteAndAuthorizeQuery(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Based on the result code, decides the next operation, either try pairing +// with another mode, or complete pair request. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::RequestCompletedL( CBTEngActive* aActive, TInt aId, + TInt aStatus ) + { + TRACE_FUNC_ARG( ( _L( "reqid %d, status: %d, pair mode %d " ), aId, aStatus, iPairMode ) ) + (void) aActive; + (void) aId; + + if ( aId == EDevicePairUserNotification) + { + // user notification completes: + iParent.OutgoingPairCompleted( aStatus ? aStatus : iPairResult ); + iParent.RenewPairer( NULL ); + return; + } + + if( aId == EDedicatedBonding && + ( aStatus == KErrRemoteDeviceIndicatedNoBonding || + ( aStatus && iPairMode != EBTOutgoingNoneHeadsetPairing && iPairMode != EBTOutgoingPairNone ) ) ) + { + // try general pairing if the remote doesn't have dedicated bonding, or + // pairing fails with a headset. + DoPairingL(); + } + else if ( aStatus && iPairMode == EBTOutgoingHeadsetAutoPairing ) + { + iPairMode = EBTOutgoingHeadsetManualPairing; + // auto pairing with headset failed, try to pair again with manual pin: + ( void ) SetOutgoPairProperty( iOutgoProperty, iAddr, iPairMode ); + TRACE_INFO( _L( " auto pairing failed, switch to manual pairing") ); + DoPairingL(); + } + else if ( aStatus && aId == EGeneralBonding && + iPairMode == EBTOutgoingHeadsetManualPairing ) + { + // pairing headset with manual pin failed, wait for a while and try again: + iActive->SetRequestId( EGeneralBondingRetryTimer ); + iTimer.After( iActive->iStatus, KBTEngGeneralBondingRetryDelayMicroSeconds ); + iActive->GoActive(); + } + else if( aId == EGeneralBondingRetryTimer ) + { + // try to pair headset again with manual pin again: + DoPairingL(); + } + else if ( aStatus ) + { + // we only starts showing note if pairing failed. + // For a successful pair, we must wait until registry has been updated. + if ( !IsPairResultSet() ) + { + SetPairResult( aStatus ); + } + if ( aStatus ) + { + ShowPairingNoteAndAuthorizeQuery(); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Handles a leave in RequestCompleted by self-destructing. +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::HandleError( CBTEngActive* aActive, TInt aId, + TInt aError ) + { + TRACE_FUNC_ARG( ( _L( "error: %d" ), aError ) ) + // Our RunL can actually not leave, so we should never reach here. + (void) aActive; + (void) aId; + iParent.OutgoingPairCompleted( aError ); + iParent.RenewPairer( NULL ); + } + +// --------------------------------------------------------------------------- +// decide the next state and issue pair request +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::DoPairingL() + { + TRACE_FUNC_ENTRY + TPairingStageId currentMode = ( TPairingStageId ) iActive->RequestId(); + ASSERT( !iActive->IsActive() ); + TPairingStageId nextMode( EGeneralBonding ); + + // if running BTv2.0 stack, dedicated bonding method + // is not available. + if ( currentMode == ENoBonding && iParent.PairingServer() != NULL ) + { + nextMode = EDedicatedBonding; + } + else if(currentMode == EGeneralBondingRetryTimer) + { + nextMode = EGeneralBondingRetry; + } + + TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d"), currentMode, nextMode ) ); + + iActive->SetRequestId( nextMode ); + if ( nextMode == EDedicatedBonding ) + { + iBondingSession.Start( *iParent.PairingServer(), iAddr, iActive->RequestStatus() ); + } + else + { + TBTServiceSecurity sec; + sec.SetAuthentication( ETrue ); + iSockAddr.SetBTAddr( iAddr ); + iSockAddr.SetPort(KSDPPSM); + iSockAddr.SetSecurity( sec ); + iSocket.Close(); + User::LeaveIfError( iSocket.Open( iParent.SocketServ(), KL2CAPDesC ) ); + iSocket.Connect( iSockAddr, iActive->RequestStatus() ); + } + iActive->GoActive(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Make sure no outstanding pairing request is existing +// --------------------------------------------------------------------------- +// +void CBTEngOtgPair::DoCancelOutgoingPair() + { + TRACE_FUNC_ENTRY + if( iActive->IsActive() ) + { + iBondingSession.Close(); + if( iSocket.SubSessionHandle() ) + { + iSocket.CancelConnect(); + iSocket.Close(); + } + iTimer.Cancel(); + iActive->CancelRequest(); + } + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengpairbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/src/btengpairbase.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,176 @@ +/* +* 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: the base class of pairing handling +* +*/ + +#include "btengpairman.h" +#include "btengpairbase.h" +#include "debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTEngPairBase::CBTEngPairBase( CBTEngPairMan& aParent, const TBTDevAddr& aAddr) + : iAddr( aAddr ), iParent( aParent ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::BaseConstructL( ) + { + iActive = CBTEngActive::NewL(*this, 0, CActive::EPriorityStandard); + TRACE_BDADDR( iAddr ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTEngPairBase::~CBTEngPairBase() + { + CancelNotifier(); + iNotifier.Close(); + delete iActive; + } + +// --------------------------------------------------------------------------- +// Message passes through only if the result is for the same device this +// object is for. +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::HandlePairServerResult( const TBTDevAddr& aAddr, TInt aResult ) + { + if ( aAddr == iAddr ) + { + TRACE_FUNC_ENTRY + DoHandlePairServerResult( aResult ); + TRACE_FUNC_EXIT + } + } + +// --------------------------------------------------------------------------- +// Message passes through only if the result is for the same device this +// object is for. +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::HandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) + { + if ( aDev.Address() == iAddr ) + { + TRACE_FUNC_ENTRY + DoHandleRegistryNewPairedEvent( aDev ); + TRACE_FUNC_EXIT + } + } + +// --------------------------------------------------------------------------- +// Default impl of virtual function. do nothing +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::CancelOutgoingPair() + { + } + +// --------------------------------------------------------------------------- +// Cancel outstanding notifier +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::CancelNotifier() + { + if( iActive && iActive->IsActive() && + iActive->RequestId() == EDevicePairUserNotification ) + { + TRACE_FUNC_ENTRY + iNotifier.CancelNotifier( KBTPairedDeviceSettingNotifierUid ); + iActive->Cancel(); + TRACE_FUNC_EXIT + } + } + +// --------------------------------------------------------------------------- +// Show the pairing result and ask the user to authorize the device. +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::ShowPairingNoteAndAuthorizeQuery() + { + TRACE_FUNC_ENTRY + if ( iActive->IsActive() ) + { + // In profress of showing note, won't interrupt it: + return; + } + TInt err ( KErrNone ); + if (!iNotifier.Handle()) + { + err = iNotifier.Connect(); + } + if ( !err ) + { + // Inform the user of the pairing status. + iActive->SetRequestId( EDevicePairUserNotification ); + iAuthoPckg().iPairingStatus = iPairResult; + iAuthoPckg().iRemoteAddr = iAddr; + iNotifier.StartNotifierAndGetResponse( iActive->RequestStatus(), + KBTPairedDeviceSettingNotifierUid, + iAuthoPckg, iAuthoPckg ); + iActive->GoActive(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Invalidate iPairResultSet +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::UnSetPairResult() + { + iPairResultSet = EFalse; + } + +// --------------------------------------------------------------------------- +// Save the result and validate the flag +// --------------------------------------------------------------------------- +// +void CBTEngPairBase::SetPairResult( TInt aResult ) + { + iPairResult = aResult; + iPairResultSet = ETrue; + } + +// --------------------------------------------------------------------------- +// Returns the flag +// --------------------------------------------------------------------------- +// +TBool CBTEngPairBase::IsPairResultSet() + { + return iPairResultSet; + } + +// --------------------------------------------------------------------------- +// check AO validity and its request information +// --------------------------------------------------------------------------- +// +TBool CBTEngPairBase::IsNotifyingPairResult() + { + return iActive && iActive->IsActive() && + iActive->RequestId() == EDevicePairUserNotification ; + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengpairman.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bteng/src/btengpairman.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,916 @@ +/* +* 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: Pairing result receiver in Bluetooth engine subsystem +* +*/ + +#include "btengpairman.h" +#include "btengserver.h" +#include "btengsrvsession.h" +#include "btengotgpair.h" +#include "btengincpair.h" +#include "btengclientserver.h" +#include "debug.h" +#include + +/** Identification for active object */ +enum TPairManActiveRequestId + { + ESimplePairingResult, + EAuthenticationResult, + ERegistryInitiatePairedDevicesView, + ERegistryPairedDevicesNewView, + ERegistryInitiatePairedDevicesList, + ERegistryGetPairedDevices, + ERegistryGetLocalAddress, + }; + +/** The message argument which holds the Bluetooth address. */ +const TInt KBTEngAddrSlot = 0; + +// --------------------------------------------------------------------------- +// Tells if two TBTNamelessDevice instances are for the same remote device +// --------------------------------------------------------------------------- +// +TBool CompareDeviceByAddress( const TBTNamelessDevice& aDevA, const TBTNamelessDevice& aDevB ) + { + return aDevA.Address() == aDevB.Address(); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTEngPairMan::CBTEngPairMan( CBTEngServer& aServer ) + : iServer( aServer ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::ConstructL() + { + TRACE_FUNC_ENTRY + // Connect to pairing server for authentication & simple pairing + // results directly from the BT stack. + // Pairing server doesn't exist if we run BT 2.0 stack: + iPairingServ = new (ELeave) RBluetoothPairingServer; + TInt err = iPairingServ->Connect(); + if ( err) + { + delete iPairingServ; + iPairingServ = NULL; + } + else + { + User::LeaveIfError( iPairingResult.Open( *iPairingServ ) ); + User::LeaveIfError( iAuthenResult.Open( *iPairingServ ) ); + iSSPResultActive = CBTEngActive::NewL( *this, ESimplePairingResult, CActive::EPriorityStandard ); + iAuthenResultActive = CBTEngActive::NewL( *this, EAuthenticationResult, CActive::EPriorityStandard ); + } + + // RProperty for accessing the local device address + User::LeaveIfError( iPropertyLocalAddr.Attach(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetLocalDeviceAddress) ); + + // connect to registry + User::LeaveIfError( iBTRegistry.Open( BTRegServ() ) ); + iRegistryActive = CBTEngActive::NewL( *this, ERegistryInitiatePairedDevicesView, CActive::EPriorityStandard ); + iPairedDevices = new (ELeave) RArray; + + // Initialise paired devices list + iLocalAddrActive = CBTEngActive::NewL( *this, ERegistryGetLocalAddress, CActive::EPriorityStandard ); + InitPairedDevicesList(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTEngPairMan* CBTEngPairMan::NewL( CBTEngServer& aServer ) + { + CBTEngPairMan* self = NULL; + self = new CBTEngPairMan( aServer ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTEngPairMan::~CBTEngPairMan() + { + TRACE_FUNC_ENTRY + CancelSubscribe(); + delete iSSPResultActive; + delete iAuthenResultActive; + delete iRegistryActive; + delete iPairedDevicesResp; + delete iPairer; + if ( iPairedDevices ) + { + iPairedDevices->Close(); + delete iPairedDevices; + } + iBTRegistry.Close(); + iPairingResult.Close(); + iAuthenResult.Close(); + if ( iPairingServ ) + { + iPairingServ->Close(); + delete iPairingServ; + } + if ( !iMessage.IsNull() ) + { + iMessage.Complete( KErrCancel ); + } + iPropertyLocalAddr.Cancel(); + iPropertyLocalAddr.Close(); + delete iLocalAddrActive; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Initialises the paired devices list. +// If the local address is not available from the P&S key +// KPropertyKeyBluetoothGetLocalDeviceAddress, then the list may need to be +// updated once the H/W is switched on. This is so that any registry update +// from a restore operation can be included in the list, without mistaking the +// new devices for new pairings. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::InitPairedDevicesList() + { + TRACE_FUNC_ENTRY + + // Check that we have the Bluetooth local address. If we don't then initialise anyway, but subscribe for an update. + // This allows us to refresh our paired devices list to include updates made to the remote devices table of the + // Bluetooth registry from a restore operation. We need to include these devices without mistaking them for new + // pairings. We look solely at the P&S key for the address to avoid the condition whereby the address has been + // entered into the reigstry but the Bluetooth Manager server has not begun the restore process yet. The signalling + // of the P&S key will cause Bluetooth Manager to update the registry with any restored devices before fulfilling + // any further requests. + + // Subscribe to local address property in case we need an update. + iPropertyLocalAddr.Subscribe( iLocalAddrActive->iStatus ); + iLocalAddrActive->SetRequestId( ERegistryGetLocalAddress ); + iLocalAddrActive->GoActive(); + + // Attempt to read address from P&S key. + TBuf8 btAddrDes; + TInt err = iPropertyLocalAddr.Get( btAddrDes ); + + // Is the P&S key defined yet? (if not, stack not up yet) + if ( err == KErrNone ) + { + // P&S key defined, is local address set? (if not, H/W not initialised yet) + if ( btAddrDes.Length() == KBTDevAddrSize ) + { + TBTDevAddr btAddr = btAddrDes; + + if ( btAddr != TBTDevAddr() ) + { + // Non-zero local address is available. + iPropertyLocalAddr.Cancel(); + iLocalAddrActive->CancelRequest(); + } + } + } + + // Perform initialisation of the paired devices list. + DoInitPairedDevicesList(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Initialises the paired devices list (second stage) +// This method performs the actual initialisation, now that the local BT H/W +// address had been made available. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::DoInitPairedDevicesList() + { + TRACE_FUNC_ENTRY + + if ( !iRegistryActive->IsActive() ) + { + // Start to get the list of all paired devices. + CreatePairedDevicesView( ERegistryInitiatePairedDevicesView ); + } + else + { + iNotHandledInitEventCounter++; + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Handles pairing related commands from BTEng clients. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::ProcessCommandL( const RMessage2& aMessage ) + { + TRACE_FUNC_ENTRY + TInt opcode = aMessage.Function(); + TBTDevAddrPckgBuf addrPkg; + switch( opcode ) + { + case EBTEngSetPairingObserver: + { + aMessage.ReadL( KBTEngAddrSlot, addrPkg ); + SetPairObserver( addrPkg(), aMessage.Int1() ); + break; + } + case EBTEngPairDevice: + { + if ( !iMessage.IsNull() ) + { + User::Leave( KErrServerBusy ); + } + TBTDevAddrPckgBuf addrPkg; + aMessage.ReadL( KBTEngAddrSlot, addrPkg ); + PairDeviceL( addrPkg(), aMessage.Int1() ); + iMessage = RMessage2( aMessage ); + break; + } + case EBTEngCancelPairDevice: + { + // Only the client who requested pairing can cancel it: + if ( !iMessage.IsNull() && aMessage.Session() == iMessage.Session() ) + { + iPairer->CancelOutgoingPair(); + iMessage.Complete( KErrCancel ); + } + break; + } + default: + { + TRACE_INFO( ( _L( "CBTEngPairMan ProcessCommandL: bad request (%d)" ), + aMessage.Function() ) ) + User::Leave( KErrArgument ); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Handle a change in BTRegistry remote devices table. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::RemoteRegistryChangeDetected() + { + if ( !iRegistryActive->IsActive() ) + { + CreatePairedDevicesView( ERegistryPairedDevicesNewView ); + } + else + { + iNotHandledRegEventCounter++; + } + } + +// --------------------------------------------------------------------------- +// Returns the RBluetoothPairingServer instance. +// --------------------------------------------------------------------------- +// +RBluetoothPairingServer* CBTEngPairMan::PairingServer() + { + return iPairingServ; + } + +// --------------------------------------------------------------------------- +// Access the reference of RSockServ +// --------------------------------------------------------------------------- +// +RSocketServ& CBTEngPairMan::SocketServ() + { + return iServer.SocketServer(); + } + +// --------------------------------------------------------------------------- +// Access the reference of RBTRegSrv +// --------------------------------------------------------------------------- +// +RBTRegServ& CBTEngPairMan::BTRegServ() + { + return iServer.RegistrServer(); + } + +// --------------------------------------------------------------------------- +// Deletes the current pairing handler and transfer the responsibility +// to the specified. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::RenewPairer( CBTEngPairBase* aPairer ) + { + delete iPairer; + iPairer = aPairer; + } + +// --------------------------------------------------------------------------- +// Find the session who requested this and completes its request. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::OutgoingPairCompleted( TInt aErr ) + { + TRACE_FUNC_ENTRY + // the meaning of KHCIErrorBase equals KErrNone. Hide this specific BT stack + // detail from clients: + if ( aErr == KHCIErrorBase ) + { + aErr = KErrNone; + } + // we must complete client's pairing request: + if ( !iMessage.IsNull() ) + { + iMessage.Complete( aErr ); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// A session will be ended, completes the pending request for this session. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::SessionClosed( CSession2* aSession ) + { + TRACE_FUNC_ARG( ( _L( " session %x"), aSession ) ) + if ( !iMessage.IsNull() && iMessage.Session() == aSession ) + { + iMessage.Complete( KErrCancel ); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Unpair the device from registry +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::UnpairDevice( const TBTDevAddr& aAddr ) + { + TRACE_FUNC_ENTRY + TIdentityRelation addrComp( CompareDeviceByAddress ); + TBTNamelessDevice dev; + dev.SetAddress( aAddr ); + // only do unpairing if the we have a link key with it. + TInt index = iPairedDevices->Find( dev, addrComp ); + if ( index > KErrNotFound ) + { + dev = (*iPairedDevices)[index]; + + TRequestStatus status( KRequestPending ); + // Unpair the device in registry (synchronously) + iBTRegistry.UnpairDevice( dev.Address(), status ); + User::WaitForRequest( status ); + TRACE_INFO( ( _L( "Delete link key, res %d"), status.Int() ) ) + + if ( status == KErrNone ) + { + TBTDeviceSecurity security = dev.GlobalSecurity(); + // Clear trust setting so that correct icon will be shown in ui applications. + security.SetNoAuthenticate(EFalse ); + security.SetNoAuthorise(EFalse ); + dev.SetGlobalSecurity(security); + dev.DeleteLinkKey(); + if ( dev.IsValidUiCookie() && + ( dev.UiCookie() & EBTUiCookieJustWorksPaired ) ) + { + // Remove the UI cookie bit for Just Works pairing. + TInt32 cookie = dev.UiCookie() & ~EBTUiCookieJustWorksPaired; + dev.SetUiCookie( cookie ); + TRACE_INFO( ( _L( "UI cookie %x cleared"), EBTUiCookieJustWorksPaired ) ); + } + // modify the device in registry synchronously + // status.Int() could be -1 if the device is not in registry + // which is totally fine for us. + (void) UpdateRegDevice( dev ); + } + } + TRACE_FUNC_EXIT + } + +TInt CBTEngPairMan::AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ) + { + TRACE_FUNC_ENTRY + TInt err( KErrNone ); + // There might be UI cookies used by other applications, + // we should not overwrite them. + TInt32 cookie = aDev.IsValidUiCookie() ? aDev.UiCookie() : EBTUiCookieUndefined; + if ( !( cookie & EBTUiCookieJustWorksPaired ) ) + { + // Only update the cookie if the wanted one is not in registry yet + // to keep minimal operations with registry. + TBTNamelessDevice dev = aDev; + cookie |= EBTUiCookieJustWorksPaired; + dev.SetUiCookie( cookie ); + err = UpdateRegDevice( dev ); + TRACE_INFO( ( _L( "[BTENG] CBTEngOtgPair write Ui cookie ret %d"), err ) ); + } + TRACE_FUNC_EXIT + return err; + } + +// --------------------------------------------------------------------------- +// update a nameless device in registry +// --------------------------------------------------------------------------- +// +TInt CBTEngPairMan::UpdateRegDevice( const TBTNamelessDevice& aDev ) + { + TRequestStatus status( KRequestPending ); + // update the device in registry synchronously + iBTRegistry.ModifyDevice( aDev, status ); + User::WaitForRequest( status ); + TRACE_INFO( ( _L( "UpdateRegDevice, ret %d"), status.Int() ) ) + return status.Int(); + } + +// --------------------------------------------------------------------------- +// Ask server class the connection status of the specified device +// --------------------------------------------------------------------------- +// +TBTEngConnectionStatus CBTEngPairMan::IsDeviceConnected( const TBTDevAddr& aAddr ) + { + return iServer.IsDeviceConnected( aAddr ); + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Checks if there is an authentication result. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::RequestCompletedL( CBTEngActive* /*aActive*/, TInt aId, TInt aStatus ) + { + TRACE_FUNC_ARG( ( _L( "aId: %d, aStatus: %d"), aId, aStatus ) ) + // Check which request completed. + switch( aId ) + { + case ESimplePairingResult: + { + TBTDevAddr tmpAddr = iSimplePairingRemote; + if (aStatus != KErrServerTerminated) + { + SubscribeSspPairingResult(); + } + HandlePairingResultL( tmpAddr, aStatus ); + break; + } + case EAuthenticationResult: + { + TBTDevAddr tmpAddr = iAuthenticateRemote; + if (aStatus != KErrServerTerminated) + { + SubscribeAuthenticateResult(); + } + HandlePairingResultL( tmpAddr, aStatus ); + break; + } + case ERegistryInitiatePairedDevicesView: + case ERegistryPairedDevicesNewView: + { + HandleCreatePairedDevicesViewCompletedL( aStatus, aId ); + break; + } + case ERegistryInitiatePairedDevicesList: + { + if (iSSPResultActive && iAuthenResultActive) + { + SubscribeSspPairingResult(); + SubscribeAuthenticateResult(); + } + HandleGetPairedDevicesCompletedL( aStatus, aId ); + break; + } + case ERegistryGetPairedDevices: + { + HandleGetPairedDevicesCompletedL( aStatus, aId ); + break; + } + case ERegistryGetLocalAddress: + { + // Refresh paired devices list to include any restored devices. + DoInitPairedDevicesList(); + break; + } + default: + // Should not be possible, but no need for handling. + TRACE_INFO( (_L("[BTEng]: CBTEngPairMan::RequestCompletedL unhandled event!!") ) ) + break; + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) + { + TRACE_FUNC_ARG( ( _L( "request id: %d, error: %d" ), aId, aError ) ) + (void) aActive; + (void) aError; + if ( aId == ERegistryInitiatePairedDevicesList || + aId == ERegistryGetPairedDevices ) + {// leave happened in registry operation, delete registry response: + delete iPairedDevicesResp; + iPairedDevicesResp = NULL; + } + } + +// --------------------------------------------------------------------------- +// Activate or deactivate a pairing handler +// --------------------------------------------------------------------------- +// +TInt CBTEngPairMan::SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate) + { + TRACE_FUNC_ARG( ( _L( "%d" ), aActivate ) ) + TRACE_BDADDR( aAddr ) + iPairingOperationAttempted = ETrue; + TInt err( KErrNone ); + if ( !aActivate ) + { + if ( iPairer ) + { + iPairer->StopPairHandling( aAddr ); + } + return err; + } + + if ( !iPairer) + { + // This is an incoming pair, unpair it from registry and + // create the handler: + UnpairDevice( aAddr ); + TRAP( err, iPairer = CBTEngIncPair::NewL( *this, aAddr )); + } + if ( iPairer) + { + // let the handler decide what to do: + err = iPairer->ObserveIncomingPair( aAddr ); + } + TRACE_FUNC_EXIT + return err; + } + +// --------------------------------------------------------------------------- +// Delegates the request to current pair handler +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ) + { + iPairingOperationAttempted = ETrue; + if ( !iPairer) + { + // no existing pair handling, create one: + iPairer = CBTEngOtgPair::NewL( *this, aAddr ); + } + // let pair handler decide what to do: + iPairer->HandleOutgoingPairL( aAddr, aCod ); + } + +// --------------------------------------------------------------------------- +// cancel Subscribings to simple pairing result and authentication result from +// Pairing Server +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::CancelSubscribe() + { + TRACE_FUNC_ENTRY + if( iSSPResultActive && iSSPResultActive->IsActive() ) + { + // Cancel listening Simple pairing result + iPairingResult.CancelSimplePairingResult(); + iSSPResultActive->Cancel(); + } + if( iAuthenResultActive && iAuthenResultActive->IsActive() ) + { + // Cancel listening authentication result + iAuthenResult.CancelAuthenticationResult(); + iAuthenResultActive->Cancel(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Subscribes to simple pairing result from Pairing Server (if not already +// subscribed). +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::SubscribeSspPairingResult() + { + TRACE_FUNC_ENTRY + if ( !iSSPResultActive->IsActive() ) + { + iPairingResult.SimplePairingResult( iSimplePairingRemote, iSSPResultActive->RequestStatus() ); + iSSPResultActive->GoActive(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Subscribes to authentication result from Pairing Server (if not already +// subscribed). +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::SubscribeAuthenticateResult() + { + TRACE_FUNC_ENTRY + if ( !iAuthenResultActive->IsActive() ) + { + // Subscribe authentication result (which requires pairing for unpaired devices) + iAuthenResult.AuthenticationResult( iAuthenticateRemote, iAuthenResultActive->RequestStatus() ); + iAuthenResultActive->GoActive(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Handle a pairing result from the pairing server. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ) + { + TRACE_FUNC_ARG( (_L("result %d"), aResult ) ) + TRACE_BDADDR( aAddr ); + if ( !iPairer && ( aResult == KErrNone || aResult == KHCIErrorBase ) ) + { + // we only create new handler if incoming pairing succeeds. + // Pairing failure could be caused by user local cancellation, as the + // result, the handler was destroyed by notifier. We shall not + // instantiate the handler again. + // If a pairing failed due to other reasons than user local cancelling, + // it will be catched by the already started handler + // (except Just Works pairing - no handler for it at all until we receive + // registry change event. Thus if incoming JWs pairing failed, no user + // notification will be shown.) + TBTNamelessDevice dev; + dev.SetAddress( aAddr ); + TIdentityRelation addrComp( CompareDeviceByAddress ); + TInt index = iPairedDevices->Find( dev, addrComp ); + + // If the device is not found in the old paired device list, it is a new + // paired device: + if ( index == KErrNotFound) + { + // No handler yet, create incoming pairing handler: + iPairer = CBTEngIncPair::NewL( *this, aAddr ); + } + } + if ( iPairer ) + { + iPairer->HandlePairServerResult( aAddr, aResult ); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// issue creating a bonded devices view +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::CreatePairedDevicesView( TInt aReqId ) + { + TRACE_FUNC_ENTRY + if ( aReqId == ERegistryInitiatePairedDevicesView ) + { + iNotHandledInitEventCounter = 0; + } + else + { + iNotHandledRegEventCounter = 0; + } + TBTRegistrySearch searchPattern; + searchPattern.FindBonded(); + iRegistryActive->SetRequestId( aReqId ); + iBTRegistry.CreateView( searchPattern, iRegistryActive->iStatus ); + iRegistryActive->GoActive(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// gets the paired devices from the view created by CreatePairedDevicesView +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::GetPairedDevices( TInt aReqId ) + { + TRACE_FUNC_ENTRY + delete iPairedDevicesResp; + iPairedDevicesResp = NULL; + TRAP_IGNORE( iPairedDevicesResp = CBTRegistryResponse::NewL( iBTRegistry ) ); + if ( iPairedDevicesResp ) + { + iRegistryActive->SetRequestId( aReqId ); + iPairedDevicesResp->Start( iRegistryActive->iStatus ); + iRegistryActive->GoActive(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// re-create a paired device view if registry was changed during the previous +// operation. otherwise if the view is not empty, get the paired devices. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::HandleCreatePairedDevicesViewCompletedL( TInt aStatus, TInt aReqId ) + { + TRACE_FUNC_ENTRY + + if ( aReqId == ERegistryInitiatePairedDevicesView ) + {// Initialization phase, list paired devices if there are any. + if ( iNotHandledInitEventCounter ) + { + // Reinitialisaton detected, create paired device view again: + (void) iBTRegistry.CloseView(); + CreatePairedDevicesView( ERegistryInitiatePairedDevicesView ); + } + else if ( aStatus > KErrNone ) + { + GetPairedDevices( ERegistryInitiatePairedDevicesList ); + } + else + {//no paired device, close the view. + (void) iBTRegistry.CloseView(); + } + } + else + { + if ( iNotHandledInitEventCounter ) + { + // We need to reinitialise but we may be pairing. + // This situation is not expected to arise, as reinitialisation means + // that the H/W was only just switched on. + // If we have ever started to take part in a pairing, then prioritise that + // pairing. + (void) iBTRegistry.CloseView(); + if ( iPairingOperationAttempted ) + { + iNotHandledInitEventCounter = 0; + CreatePairedDevicesView( ERegistryPairedDevicesNewView ); + } + else + { + CreatePairedDevicesView( ERegistryInitiatePairedDevicesView ); + } + } + else if (iNotHandledRegEventCounter) + { // more registry change detected, create paired device view again: + (void) iBTRegistry.CloseView(); + CreatePairedDevicesView( ERegistryPairedDevicesNewView ); + } + else if ( aStatus > KErrNone ) + { // paired device available, get them: + GetPairedDevices( ERegistryGetPairedDevices ); + } + else + { + // No paired devices in registry, empty local db: + (void) iBTRegistry.CloseView(); + iPairedDevices->Reset(); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// update paired device list. if registry was changed, create a new view. +// otherwise check for new pairing event. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::HandleGetPairedDevicesCompletedL( TInt /*aStatus*/, TInt aReqId ) + { + TRACE_FUNC_ENTRY + (void) iBTRegistry.CloseView(); + if ( aReqId == ERegistryInitiatePairedDevicesList ) + { + if ( iNotHandledInitEventCounter ) + { + // Reinitialisation required, create paired device view again: + CreatePairedDevicesView( ERegistryInitiatePairedDevicesView ); + } + else + { + // We completed the initialisation of paired device list, + // move all paired devices to the array: + UpdatePairedDeviceListL(); + } + } + else + { + if (iNotHandledInitEventCounter) + { + // We need to reinitialise but we may be pairing. + // This situation is not expected to arise, as reinitialisation means + // that the H/W was only just switched on. + // If we have ever started to take part in a pairing, then prioritise that + // pairing. + if ( iPairingOperationAttempted ) + { + iNotHandledInitEventCounter = 0; + CreatePairedDevicesView( ERegistryPairedDevicesNewView ); + } + else + { + CreatePairedDevicesView( ERegistryInitiatePairedDevicesView ); + } + } + else if (iNotHandledRegEventCounter) + { // more registry change detected, create paired device view again: + CreatePairedDevicesView( ERegistryPairedDevicesNewView ); + } + else if ( aReqId == ERegistryGetPairedDevices) + { + // no more registry change detected, find new pairings: + CheckPairEventL(); + } + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// copy the nameless devices to local array +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::UpdatePairedDeviceListL() + { + TRACE_FUNC_ENTRY + iPairedDevices->Reset(); + for ( TInt i = 0; i < iPairedDevicesResp->Results().Count(); i++ ) + { + TRACE_BDADDR( iPairedDevicesResp->Results()[i]->BDAddr() ); + TRACE_INFO((_L("[BTENG]\t linkkeytype %d"), + iPairedDevicesResp->Results()[i]->LinkKeyType())) + iPairedDevices->AppendL( iPairedDevicesResp->Results()[i]->AsNamelessDevice() ); + } + delete iPairedDevicesResp; + iPairedDevicesResp = NULL; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// find new paired devices. for each, delegate the information to +// current pair handler. +// --------------------------------------------------------------------------- +// +void CBTEngPairMan::CheckPairEventL() + { + TRACE_FUNC_ENTRY + RArray* pairedDevicesOld; + pairedDevicesOld = iPairedDevices; + CleanupStack::PushL( pairedDevicesOld ); + CleanupClosePushL( *pairedDevicesOld ); + iPairedDevices = NULL; + iPairedDevices = new (ELeave) RArray; + UpdatePairedDeviceListL(); + + TIdentityRelation addrComp( CompareDeviceByAddress ); + for ( TInt i = 0; i < iPairedDevices->Count(); i++ ) + { + TBTNamelessDevice& dev = (*iPairedDevices)[i]; + TInt index = pairedDevicesOld->Find( dev, addrComp ); + + // If the device is not found in the old paired device list or + // the link key type has been changed from + // ELinkKeyUnauthenticatedUpgradable, the device is a new + // paired device: + TBool newPaired = dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable && + ( index == KErrNotFound || + ( index > KErrNotFound && + dev.LinkKeyType() != (*pairedDevicesOld)[index].LinkKeyType() ) ); + TRACE_BDADDR( dev.Address() ); + if ( newPaired && !iPairer) + { + iPairingOperationAttempted = ETrue; + iPairer = CBTEngIncPair::NewL( *this, dev.Address() ); + } + if ( newPaired && iPairer ) + { + // Ask pair handler to decide what to do: + iPairer->HandleRegistryNewPairedEvent( dev ); + } + } + // Free old paired device list resource: + CleanupStack::PopAndDestroy( 2 ); + TRACE_FUNC_EXIT + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengserver.cpp --- a/bluetoothengine/bteng/src/btengserver.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengserver.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -37,6 +37,7 @@ #include "btengsecpolicy.h" #include "btengprivatepskeys.h" #include "btengplugin.h" +#include "btengpairman.h" #include "debug.h" /** Bluetooth Engine server thread name */ @@ -166,7 +167,8 @@ iPluginMgr = CBTEngSrvPluginMgr::NewL( this ); iBBConnMgr = CBTEngSrvBBConnMgr::NewL( this, iSocketServ ); - iSdpDbHandler = NULL; + User::LeaveIfError( iBTRegServ.Connect() ); + iPairMan = CBTEngPairMan::NewL( *this ); TCallBack idleCb( IdleTimerCallBack, this ); iIdleCallBack.Set( idleCb ); @@ -217,16 +219,15 @@ RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn ); RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); delete iTimer; - if ( iSdpDbHandler ) - { - delete iSdpDbHandler; - } + delete iSdpDbHandler; delete iWatcher; delete iSettingsMgr; delete iPluginMgr; delete iBBConnMgr; delete iServerState; + delete iPairMan; iSocketServ.Close(); + iBTRegServ.Close(); } // --------------------------------------------------------------------------- @@ -314,6 +315,7 @@ TRACE_INFO( ( _L( "[CBTEngServer]\t iSessionCount %d"), iSessionCount )) iSessionCount--; iSettingsMgr->SessionClosed( aSession ); + iPairMan->SessionClosed( aSession ); if( aAutoOff ) { TRAP_IGNORE( SetPowerStateL( EBTOff, ETrue ) ); @@ -600,8 +602,7 @@ // GLDEF_C TInt E32Main() { - //TODO uncomment UHEAP macros after orbit memory leaks are resolved till then it should be commented. -// __UHEAP_MARK; + __UHEAP_MARK; TRACE_FUNC_ENTRY CTrapCleanup* cleanup = CTrapCleanup::New(); TInt err = KErrNoMemory; @@ -610,6 +611,6 @@ TRAP( err, RunServerL() ); delete cleanup; } -// __UHEAP_MARKEND; + __UHEAP_MARKEND; return err; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp --- a/bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvbbconnectionmgr.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -92,13 +92,15 @@ // CBTEngSrvBBConnMgr::~CBTEngSrvBBConnMgr() { - delete iLinkCountWatcher; - delete iWlanWatcher; + Unsubscribe(); iLinkCountProperty.Close(); iWlanStatusProperty.Close(); + delete iLinkCountWatcher; + delete iWlanWatcher; delete iPhyLinks; } + // --------------------------------------------------------------------------- // Start listening to the relevant properties. // --------------------------------------------------------------------------- @@ -124,10 +126,19 @@ // void CBTEngSrvBBConnMgr::Unsubscribe() { - iLinkCountWatcher->Cancel(); - iWlanWatcher->Cancel(); + if( iLinkCountWatcher->IsActive() ) + { + iLinkCountProperty.Cancel(); + iLinkCountWatcher->CancelRequest(); + } + if( iWlanWatcher && iWlanWatcher->IsActive() ) + { + iWlanStatusProperty.Cancel(); + iWlanWatcher->CancelRequest(); + } } + // --------------------------------------------------------------------------- // ?implementation_description // --------------------------------------------------------------------------- @@ -353,20 +364,22 @@ // ?implementation_description // --------------------------------------------------------------------------- // -void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive, +void CBTEngSrvBBConnMgr::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { - TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aStatus ) ) - ASSERT( aActive->RequestId() == KBTEngSrvBBConnId || aActive->RequestId() == KBTEngSrvWlanStatusId ); + TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aStatus ) ) + ASSERT( aId == KBTEngSrvBBConnId || aId == KBTEngSrvWlanStatusId ); + (void) aActive; + (void) aId; if( aStatus != KErrPermissionDenied ) { - // Ignore any other errors. - // First subscribe again, so that we don't miss any updates. - Subscribe(); + // Ignore any other errors. + // First subscribe again, so that we don't miss any updates. + Subscribe(); } (void) ManageTopology( EFalse ); // Ignore result; nothing to do // about it here. - if( aActive->RequestId() == KBTEngSrvBBConnId ) + if( aId == KBTEngSrvBBConnId ) { TRACE_INFO( ( _L( "[BTENG] PHY count key changed, update UI connection status" ) ) ) iServer->SettingsManager()->SetUiIndicatorsL(); @@ -374,24 +387,6 @@ TRACE_FUNC_EXIT } -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngSrvBBConnMgr::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ); - if ( aRequestId == KBTEngSrvBBConnId ) - { - iLinkCountProperty.Cancel(); - } - else if ( aRequestId == KBTEngSrvWlanStatusId ) - { - iWlanStatusProperty.Cancel(); - } - TRACE_FUNC_EXIT - } // --------------------------------------------------------------------------- // From class MBTEngActiveObserver. @@ -399,11 +394,12 @@ // RunL cannot actually leave. // --------------------------------------------------------------------------- // -void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive, +void CBTEngSrvBBConnMgr::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { - TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aActive->RequestId(), aError ) ) + TRACE_FUNC_ARG( ( _L( "id: %d; status: %d" ), aId, aError ) ) (void) aActive; + (void) aId; (void) aError; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvkeywatcher.cpp --- a/bluetoothengine/bteng/src/btengsrvkeywatcher.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvkeywatcher.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -27,6 +27,7 @@ #include "btengserver.h" #include "btengsrvpluginmgr.h" #include "btengsrvsettingsmgr.h" +#include "btengpairman.h" #include "btengprivatepskeys.h" #include "btengprivatecrkeys.h" #include "debug.h" @@ -47,7 +48,8 @@ const TInt KBTEngSapWatcher = 22; /** Identification for active object */ const TInt KBTEngAddrWatcher = 23; - +/** Identification for active object */ +const TInt KBTEngRegistryWatcher = 24; /** Identification for active object */ const TInt KBTEngSspDebugWatcher = 25; /** Buffer size for BT device address as stored in CenRep */ @@ -127,6 +129,16 @@ iEmergencyCallKey.Subscribe( iEmergencyCallWatcher->RequestStatus() ); iEmergencyCallWatcher->GoActive(); } + + err = iBtRegistryKey.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetRegistryTableChange ); + if( !err ) + { + iBtRegistryWatcher = CBTEngActive::NewL( *this, KBTEngRegistryWatcher, + CActive::EPriorityStandard ); + iBtRegistryKey.Subscribe( iBtRegistryWatcher->RequestStatus() ); + iBtRegistryWatcher->GoActive(); + } + err = iSspDebugModeKey.Attach( KPSUidBluetoothTestingMode, KBTSspDebugmode ); if( !err ) { @@ -180,32 +192,75 @@ // CBTEngSrvKeyWatcher::~CBTEngSrvKeyWatcher() { + if( iDutModeKey.Handle() ) + { + iDutModeKey.Cancel(); + } delete iDutModeWatcher; iDutModeKey.Close(); #ifdef RD_REMOTELOCK + if( iPhoneLockKey.Handle() ) + { + iPhoneLockKey.Cancel(); + } delete iPhoneLockWatcher; iPhoneLockKey.Close(); #endif //RD_REMOTELOCK + if( iSystemStateKey.Handle() ) + { + iSystemStateKey.Cancel(); + } delete iSystemStateWatcher; - iSystemStateKey.Close(); - + iSystemStateKey.Close(); + + if( iBtConnectionKey.Handle() ) + { + iBtConnectionKey.Cancel(); + } delete iBtConnectionWatcher; iBtConnectionKey.Close(); - + + if( iBtScanningKey.Handle() ) + { + iBtScanningKey.Cancel(); + } delete iBtScanningWatcher; iBtScanningKey.Close(); + if( iEmergencyCallKey.Handle() ) + { + iEmergencyCallKey.Cancel(); + } delete iEmergencyCallWatcher; iEmergencyCallKey.Close(); - + + if( iSspDebugModeKey.Handle() ) + { + iSspDebugModeKey.Cancel(); + } delete iSspDebugModeWatcher; iSspDebugModeKey.Close(); + if( iBtRegistryKey.Handle() ) + { + iBtRegistryKey.Cancel(); + } + delete iBtRegistryWatcher; + iBtRegistryKey.Close(); + + if( iSapKeyCenRep ) + { + iSapKeyCenRep->NotifyCancel( KBTSapEnabled ); + } delete iSapModeWatcher; delete iSapKeyCenRep; + if( iBdaddrKey.Handle() ) + { + iBdaddrKey.Cancel(); + } delete iBdaddrWatcher; iBdaddrKey.Close(); } @@ -216,13 +271,13 @@ // Processes a changed key value. // --------------------------------------------------------------------------- // -void CBTEngSrvKeyWatcher::RequestCompletedL( CBTEngActive* aActive, +void CBTEngSrvKeyWatcher::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { TRACE_FUNC_ARG( ( _L( "status %d" ), aStatus ) ) ASSERT( aStatus != KErrPermissionDenied ); TInt val = 0; - switch( aActive->RequestId() ) + switch( aId ) { case KBTEngDutWatcher: { @@ -305,6 +360,22 @@ } break; } + case KBTEngRegistryWatcher: + { + TRACE_INFO( ( _L( "BT Registry key changed" ) ) ) + TInt myChangedTable; + + iBtRegistryKey.Subscribe( aActive->RequestStatus() ); + aActive->GoActive(); + + TInt err = iBtRegistryKey.Get( myChangedTable ); + if( !err && myChangedTable == KRegistryChangeRemoteTable ) + { + TRACE_INFO( ( _L("BT Remote registry key changed") ) ) + iServer->PairManager()->RemoteRegistryChangeDetected(); + } + break; + } case KBTEngSapWatcher: { TRACE_INFO( ( _L( "SAP mode key changed" ) ) ) @@ -357,7 +428,7 @@ break; default: { - TRACE_INFO( ( _L( "[BTENG]\t wrong key notification! id=%d" ), aActive->RequestId() ) ) + TRACE_INFO( ( _L( "[BTENG]\t wrong key notification! id=%d" ), aId ) ) } break; @@ -365,73 +436,6 @@ TRACE_FUNC_EXIT } -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngSrvKeyWatcher::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ) - switch( aRequestId ) - { - case KBTEngDutWatcher: - { - iDutModeKey.Cancel(); - break; - } - case KBTEngLockWatcher: - { - iPhoneLockKey.Cancel(); - break; - } - case KBTEngSysWatcher: - { - iSystemStateKey.Cancel(); - break; - } - case KBTEngBtConnectionWatcher: - { - iBtConnectionKey.Cancel(); - break; - } - - case KBTEngScanningWatcher: - { - iBtScanningKey.Cancel(); - break; - } - - case KBTEngEmergencyWatcher: - { - iEmergencyCallKey.Cancel(); - break; - } - - case KBTEngSspDebugWatcher: - { - iSspDebugModeKey.Cancel(); - break; - } - case KBTEngSapWatcher: - { - iSapKeyCenRep->NotifyCancel( KBTSapEnabled ); - break; - } - - case KBTEngAddrWatcher: - { - iBdaddrKey.Cancel(); - break; - } - default: - { - TRACE_INFO( ( _L( "[BTENG]\t wrong key notification! id=%d" ), aRequestId ) ) - break; - } - } - TRACE_FUNC_EXIT - } // --------------------------------------------------------------------------- // From class MBTEngActiveObserver. @@ -439,14 +443,14 @@ // the subscriptions are active. // --------------------------------------------------------------------------- // -void CBTEngSrvKeyWatcher::HandleError( CBTEngActive* aActive, +void CBTEngSrvKeyWatcher::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { TRACE_FUNC_ARG( ( _L( "status %d" ), aError ) ) (void) aError; if( !aActive->IsActive() ) { - switch( aActive->RequestId() ) + switch( aId ) { case KBTEngDutWatcher: { @@ -479,7 +483,7 @@ break; default: { - TRACE_INFO( ( _L( "[BTENG]\t wrong key notification! id=%d" ), aActive->RequestId() ) ) + TRACE_INFO( ( _L( "[BTENG]\t wrong key notification! id=%d" ), aId ) ) } return; // we don't want to go active without subscribing } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvpluginmgr.cpp --- a/bluetoothengine/bteng/src/btengsrvpluginmgr.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvpluginmgr.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -83,7 +83,6 @@ { iPluginInfoArray.Close(); iPluginArray.ResetAndDestroy(); - REComSession::FinalClose(); } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvsession.cpp --- a/bluetoothengine/bteng/src/btengsrvsession.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvsession.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -21,6 +21,7 @@ #include "btengsrvsession.h" #include "btengserver.h" #include "btengsrvbbconnectionmgr.h" +#include "btengpairman.h" #include "btengsrvsettingsmgr.h" #include "btengclientserver.h" #include "debug.h" @@ -157,6 +158,7 @@ if( !aMessage.IsNull() && ( err || ( aMessage.Function() != EBTEngNotifyConnectionEvents && + aMessage.Function() != EBTEngPairDevice && aMessage.Function() != EBTEngSetPowerState ) ) ) { // Return the error code to the client. @@ -258,6 +260,25 @@ Server()->BasebandConnectionManager()->ManageTopology( ETrue ); } break; + case EBTEngSetPairingObserver: + { + CheckPowerOnL(); + // Simply forward it to the pairing manager + Server()->PairManager()->ProcessCommandL( aMessage ); + break; + } + case EBTEngPairDevice: + { + CheckPowerOnL(); + // Simply forward it to the pairing manager + Server()->PairManager()->ProcessCommandL( aMessage ); + break; + } + case EBTEngCancelPairDevice: + { + Server()->PairManager()->ProcessCommandL( aMessage ); + break; + } default: { TRACE_INFO( ( _L( "[BTENG]\t DispatchMessageL: bad request (%d)" ), aMessage.Function() ) ) diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp --- a/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvsettingsmgr.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -22,14 +22,14 @@ #include #include #include +#include +#include + #include "btengserver.h" #include "btengsrvpluginmgr.h" #include "btengsrvbbconnectionmgr.h" #include "btengsrvstate.h" #include "debug.h" -#include -#include -#include /** ID of active object helper */ const TInt KBTEngSettingsActive = 30; @@ -49,7 +49,7 @@ // --------------------------------------------------------------------------- // CBTEngSrvSettingsMgr::CBTEngSrvSettingsMgr( CBTEngServer* aServer ) -: iServer( aServer ),iIndicatorState(-1) +: iServer( aServer ) { } @@ -62,7 +62,6 @@ { TRACE_FUNC_ENTRY iActive = CBTEngActive::NewL( *this, KBTEngSettingsActive ); - iBTIndicator = CHbIndicatorSymbian::NewL(); LoadBTPowerManagerL(); iEnterpriseEnablementMode = BluetoothFeatures::EnterpriseEnablementL(); TRACE_INFO( ( _L( "iEnterpriseEnablementMode = %d" ), iEnterpriseEnablementMode) ) @@ -94,8 +93,12 @@ // CBTEngSrvSettingsMgr::~CBTEngSrvSettingsMgr() { + if( iActive && iActive->IsActive() ) + { + // Cancel the outstanding request. + iPowerMgr.Cancel(); + } delete iActive; - delete iBTIndicator; iPowerMgr.Close(); } @@ -181,11 +184,11 @@ if ( currentState == aState ) { // Make sure that the CenRep key is in sync. - // During boot-up, the power is set from the CenRep key, so we could + // During boot-up, the pwoer is set from the CenRep key, so we could // end up out-of-sync. TRACE_INFO( ( _L( "SetPowerStateL: currentState == aState" ) ) ) - HandleHwPowerChangeL( aState ); - } + UpdateCenRepPowerKeyL( aState ); + } return; } if ( aState == EBTOn ) @@ -315,20 +318,21 @@ // --------------------------------------------------------------------------- -// Update the power state CenRep key, and start BTNotif server if BT is on. +// Update the power state CenRep key. // --------------------------------------------------------------------------- // -void CBTEngSrvSettingsMgr::HandleHwPowerChangeL( TBTPowerState aState ) +void CBTEngSrvSettingsMgr::UpdateCenRepPowerKeyL( TBTPowerState aState ) { TRACE_FUNC_ENTRY CRepository* cenrep = CRepository::NewLC( KCRUidBluetoothPowerState ); // TBTPowerState power state type is inverted from TBTPowerStateValue... - TBTPowerStateValue power = ( aState == EBTOn ) ? EBTPowerOn : EBTPowerOff; + TBTPowerStateValue power = (TBTPowerStateValue) !aState; User::LeaveIfError( cenrep->Set( KBTPowerState, (TInt) power ) ); CleanupStack::PopAndDestroy( cenrep ); TRACE_FUNC_EXIT } + // --------------------------------------------------------------------------- // ?implementation_description // --------------------------------------------------------------------------- @@ -650,9 +654,9 @@ // Callback to notify that an outstanding request has completed. // --------------------------------------------------------------------------- // -void CBTEngSrvSettingsMgr::RequestCompletedL( CBTEngActive* aActive, TInt aStatus ) +void CBTEngSrvSettingsMgr::RequestCompletedL( CBTEngActive* aActive, TInt aId, TInt aStatus ) { - __ASSERT_ALWAYS( aActive->RequestId() == KBTEngSettingsActive, PanicServer( EBTEngPanicCorrupt ) ); + __ASSERT_ALWAYS( aId == KBTEngSettingsActive, PanicServer( EBTEngPanicCorrupt ) ); TRACE_FUNC_ENTRY (void) aActive; if ( aStatus != KErrNone && aStatus != KErrAlreadyExists && aStatus != KErrCancel ) @@ -660,6 +664,7 @@ // Something went wrong, so we turn BT off again. SetPowerStateL( EBTOff, EFalse ); } + if ( !iMessage.IsNull()) { iMessage.Complete( aStatus ); @@ -667,29 +672,16 @@ TRACE_FUNC_EXIT } -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles cancelation of an outstanding request -// --------------------------------------------------------------------------- -// -void CBTEngSrvSettingsMgr::CancelRequest( TInt aRequestId ) - { - TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) ); - if ( aRequestId == KBTEngSettingsActive ) - { - iPowerMgr.Cancel(); - } - TRACE_FUNC_EXIT - } // --------------------------------------------------------------------------- // From class MBTEngActiveObserver. // Callback to notify that an error has occurred in RunL. // --------------------------------------------------------------------------- // -void CBTEngSrvSettingsMgr::HandleError( CBTEngActive* aActive, TInt aError ) +void CBTEngSrvSettingsMgr::HandleError( CBTEngActive* aActive, TInt aId, TInt aError ) { (void) aActive; + (void) aId; if ( !iMessage.IsNull()) { iMessage.Complete( aError ); @@ -707,6 +699,7 @@ TRACE_INFO( ( _L( "[CBTEngSrvSettingsMgr]\t Using HCI API v2 power manager" ) ) ) User::LeaveIfError( iPowerMgr.Open() ); #ifndef __WINS__ + TRequestStatus reqStatus; iPowerMgr.SetPower( EBTOff, NULL, reqStatus ); User::WaitForRequest( reqStatus ); @@ -730,7 +723,7 @@ TBTVisibilityMode visibilityMode = EBTVisibilityModeHidden; CRepository* cenrep = NULL; TInt phys = 0; - // TInt connecting = 0; + TInt connecting = 0; cenrep = CRepository::NewLC( KCRUidBluetoothPowerState ); User::LeaveIfError( cenrep->Get( KBTPowerState, (TInt&) powerState ) ); @@ -738,13 +731,16 @@ if( powerState == EBTPowerOff ) { - SetIndicatorStateL(EBTIndicatorOff); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); } else { // Power is on. RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount, phys ); - // RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting, connecting ); + RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting, connecting ); cenrep = CRepository::NewLC( KCRUidBTEngPrivateSettings ); User::LeaveIfError( cenrep->Get( KBTDiscoverable, (TInt&) visibilityMode ) ); @@ -752,44 +748,58 @@ if( visibilityMode == EBTVisibilityModeHidden ) { - if ( phys > 0 ) // BT connection active and hidden + if ( connecting ) // BT connecting and hidden { - SetIndicatorStateL(EBTIndicatorHiddenConnected); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateAnimate ); + } + else if ( phys > 0 ) // BT connection active and hidden + { + SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOn ); } else // BT connection not active and hidden { - SetIndicatorStateL(EBTIndicatorOnHidden); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOn ); + SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); } + SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); } else if( visibilityMode == EBTVisibilityModeGeneral || visibilityMode == EBTVisibilityModeTemporary ) { - if ( phys > 0 ) // BT connection active and visible + if ( connecting ) // BT connecting and visible { - SetIndicatorStateL(EBTIndicatorVisibleConnected); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateAnimate ); + } + else if ( phys > 0 ) // BT connection active and visible + { + SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOn ); } else // BT connection not active and visible { - SetIndicatorStateL(EBTIndicatorOnVisible); + SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOn ); + SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); } + SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); + SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); } } TRACE_FUNC_EXIT } -void CBTEngSrvSettingsMgr::SetIndicatorStateL( const TInt aState ) + +// --------------------------------------------------------------------------- +// ?implementation_description +// --------------------------------------------------------------------------- +// +void CBTEngSrvSettingsMgr::SetIndicatorStateL( const TInt aIndicator, const TInt aState ) { - TBool success = EFalse; - if(iIndicatorState != aState) - { - CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(&aState,CHbSymbianVariant::EInt ); - success = iBTIndicator->Activate(KIndicatorType(),parameters); - delete parameters; - if(!success) - { - User::Leave(iBTIndicator->Error()); - } - iIndicatorState = aState; - } + CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC( TUid::Uid( aIndicator ) ); + indicator->SetIndicatorStateL( aState ); + CleanupStack::PopAndDestroy( indicator ); //indicator } @@ -878,4 +888,3 @@ } TRACE_FUNC_EXIT } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bteng/src/btengsrvstate.cpp --- a/bluetoothengine/bteng/src/btengsrvstate.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bteng/src/btengsrvstate.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -108,7 +108,7 @@ // Power off, starting state is to disconnect the plug-ins iState = EDisconnectPlugins; iOperation = EPowerOff; - iServer->SettingsManager()->HandleHwPowerChangeL( EBTOff ); + iServer->SettingsManager()->UpdateCenRepPowerKeyL( EBTOff ); iServer->SettingsManager()->SetUiIndicatorsL(); } ChangeState(); @@ -212,7 +212,7 @@ { if( iOperation == EPowerOn ) { - iServer->SettingsManager()->HandleHwPowerChangeL( EBTOn ); + iServer->SettingsManager()->UpdateCenRepPowerKeyL( EBTOn ); iServer->SettingsManager()->SetUiIndicatorsL(); } iOperation = ESrvOpIdle; diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def --- a/bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/bthidclient/eabi/bthidclientu.def Wed Sep 01 12:20:04 2010 +0100 @@ -8,5 +8,4 @@ _ZN12RBTHidClient7ConnectEv @ 7 NONAME _ZNK12RBTHidClient19CancelConnectDeviceEv @ 8 NONAME _ZNK12RBTHidClient24CancelNotifyStatusChangeEv @ 9 NONAME - _ZNK12RBTHidClient7VersionEv @ 10 NONAME diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidclient/src/bthidclient.cpp --- a/bluetoothengine/bthid/bthidclient/src/bthidclient.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/bthidclient/src/bthidclient.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -57,7 +57,7 @@ // Defines server version number // --------------------------------------------------------- // -EXPORT_C TVersion RBTHidClient::Version() const +TVersion RBTHidClient::Version() const { return (TVersion(KBTHIDServMajorVersionNumber, KBTHIDServMinorVersionNumber, KBTHIDServBuildVersionNumber)); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/group/bld.inf --- a/bluetoothengine/bthid/bthidkbdsettings/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/bthidkbdsettings/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -21,7 +21,17 @@ PRJ_EXPORTS +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE btkeyboard.mif +OPTION TARGETFILE btkeyboard_aif.mif +OPTION HEADERFILE btkeyboard.mbg +OPTION SOURCEDIR ../aif +OPTION SOURCES -c8,8 qgn_wka_cxt +END + PRJ_MMPFILES bthidsettings.mmp +bthidkbdsettings.mmp diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettingcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettingcontainer.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declares setting container class. + * +*/ + +#ifndef BTHIDSETTINGCONTAINER_H +#define BTHIDSETTINGCONTAINER_H + +/** + * CBTHidSettingContainer + * container control class. + */ +class CBTHidSettingContainer : public CCoeControl, public MCoeControlObserver + { +public: + // Constructors and destructor + + /** + * EPOC default constructor. + * @param aRect Frame rectangle for container. + */ + void ConstructL(const TRect& aRect); + + /** + * Constructs common parts of the container. + * @param aRect control's rect. + */ + void BaseConstructL(const TRect& aRect); + + /** + * Destructor. + */ + ~CBTHidSettingContainer(); + +private: + // Functions from base classes + + /** + * From CCoeControl,Draw. + */ + void Draw(const TRect& aRect) const; + + /** + * From CCoeControl + */ + void HandleResourceChange(TInt aType); + + /** + * From CoeControl,SizeChanged. + */ + void SizeChanged(); + + /** + * From CoeControl,CountComponentControls. + */ + TInt CountComponentControls() const; + + /** + * From CCoeControl,ComponentControl. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + /** + * From MCoeControlObserver + */ + void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); + + /** + * Pass skin information if needed. + */ + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + + /** + * From CCoeControl + */ + void GetHelpContext(TCoeHelpContext& aContext) const; + +private: + //data + CAknsBasicBackgroundControlContext* iBackGround; //for skins support + + + }; + +#endif // BTHIDSETTINGCONTAINER_H +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declares settings list class. + * +*/ + + +#ifndef __BTHIDSETTINGLIST_H__ +#define __BTHIDSETTINGLIST_H__ + +#include + +class CBtHidSettings; +class CBtHidSettingView; + +class CBTKeySettingList : public CAknSettingItemList + { +public: + CBTKeySettingList(CBtHidSettings& aSettings, + CBtHidSettingView* aBtHidSettingView); + + CAknSettingItem* CreateSettingItemL(TInt identifier); + + // handles the listbox events + void HandleListBoxEventL(CEikListBox* aListBox, + TListBoxEvent aEventType); + + void EditCurrentItemL(TInt aCommand); + +private: + void SizeChanged(); + +private: + // From CCoeControl + +private: + /*! A reference to the BtHidSettings object */ + CBtHidSettings& iSettings; + + /*! Temporary layout code variable */ + TInt iLayoutCode; + + CBtHidSettingView* iBtHidSettingView; + }; + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettingview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettingview.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declares the setting view for keyboard device. + * +*/ + + +#ifndef BTHIDSETTINGVIEW_H +#define BTHIDSETTINGVIEW_H + +// INCLUDES + +#include // AVKON components +#include +#include // Menu pane definitions +#include +#include +#include "BtuiPluginInterface.h" +#include "bthidsettings.h" +#include "bthidsettinglist.h" +#include "bthidcenrepwatcher.h" +// FORWARD DECLARATIONS +class CBTHidSettingContainer; +class CBTKeySettingList; +#include "bthidsettings.h" +#include "layoutmgr.h" +#include "hidlayoutids.h" +// CONSTANTS +_LIT(KFileDrive,"z:"); +_LIT(KResourceFileName, "BthidResource.rsc"); + +// CLASS DECLARATION + +/** + * Main view of the application. Handles view activation, + * deactivation, commands and dynamic options menus. + */ +class CBtHidSettingView : public CBtuiPluginInterface, + public MBtHidCenRepObserver + { +public: + // Constructors and destructor + + /** + * ECOM implementation instantiation function of + * interface "CBtuiPluginInterface", to be used by BtuiPairedView. + */ + static CBtHidSettingView* NewBtuiPluginL( /* TAny* aAppUi */); + + /** + * Destructor. + */ + virtual ~CBtHidSettingView(); + +protected: + + /** + * C++ default constructor. + */ + CBtHidSettingView(/* CAknViewAppUi* aAppUi */); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + +public: + // Functions from base classes + + /** + * From CAknView Returns view id. + * @param None. + * @return View id. + */ + TUid Id() const; + + /** + * From CAknView Handles user commands. + * @param aCommand A command id. + * @return None. + */ + void HandleCommandL(TInt aCommand); + void CenRepDataChanged(TUid& aUid, TUint32 aKey); + +private: + // Functions from base classes + + /** + * From CAknView Activates view. + * @param aPrevViewId Id of previous view. + * @param aCustomMessageId Custom message id. + * @param aCustomMessage Custom message. + * @return None. + */ + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * From CAknView Deactivates view. + * @param None. + * @return None. + */ + void DoDeactivate(); + + /** + * From CAknView Dynamically initialises options menu. + * @param aResourceId Id identifying the menu pane to initialise. + * @param aMenuPane The in-memory representation of the menu pane. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + +public: + // New functions + + +private: + + /** + * Creates List Box + */ + void CreateSettingListL(); + THidKeyboardLayoutId CurrentLayoutL() const; + + void SetNavipaneTextL(const TDesC8& aDeviceName); + +public: + void SetCurrentLayoutL(THidKeyboardLayoutId aLayoutValue); + +private: + // Data + CBTHidSettingContainer* iContainer; + CBtHidSettings* iSettings; // Settings handler class + CBTKeySettingList* iSettingList; // The settings-list list view + + //CIdle* iIdle; // Idle time class (for doing operation delayed) + TVwsViewId iPrevViewId; // Previous view of GS app. + TInt iResourceFileFlag; // Flag for eikon env. + CEikonEnv* iEikEnv; + + /*! The Layout Manager Server session */ + RLayoutManager iLayoutSession; + + /*! The last keyboard layout selected by the user */ + THidKeyboardLayoutId iLastSelectedLayout; + TBool iIsNokiaKeyboard; + /** + * Needed when creating navipane text + * Own this pointer + */ + CAknNavigationDecorator* iNaviDecorator; + CAknContextPane* iContextPane; + CBtHidCenRepWatcher* iCenRepWatcher; + + }; + +#endif // BTHIDSETTINGVIEW_H +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/inc/btkeyenumtextsettingitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/inc/btkeyenumtextsettingitem.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declares the setting view for keyboard device. + * +*/ + + +#ifndef __BTKEYENUMTEXTSETTINGITEM_H__ +#define __BTKEYENUMTEXTSETTINGITEM_H__ + +#include + +class CBtHidSettings; +class CBtHidSettingView; + +class CBTKeyEnumTextSettingItem : public CAknEnumeratedTextPopupSettingItem + { +public: + + /*! + Constructs this object + */ + CBTKeyEnumTextSettingItem(TInt aResourceId, TInt& aValue, + CBtHidSettings& aSettings, CBtHidSettingView* aBtHidSettingView); + + /*! + Destroy the object and release all memory objects + */ + ~CBTKeyEnumTextSettingItem(); + +public: + // from CAknSettingItem + void HandleSettingPageEventL(CAknSettingPage *aSettingPage, + TAknSettingPageEvent aEventType); + +private: + CBtHidSettings& iSettings; + CBtHidSettingView* iBtHidSettingView; + }; + +#endif // __BTKEYENUMTEXTSETTINGITEM_H__ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/src/bthidpluginimplementationtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/src/bthidpluginimplementationtable.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,52 @@ +/* +* 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: +* ECOM proxy table for this plugin +* +*/ + + +// System includes +// +#include +#include + +// User includes +// +#include "bthidsettingview.h" +#include "hiduids.h" + +// Constants +// +const TImplementationProxy KBtHidPluginImplementationTable[] = + { + // UPDATE THIS - Uid for plugin implementation: + + //This impl is for BtuiPluginInterface. + IMPLEMENTATION_PROXY_ENTRY( KBDSETTINGS_UIPLUGIN_IMP, CBtHidSettingView::NewBtuiPluginL ), + }; + + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// Gate/factory function +// +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KBtHidPluginImplementationTable) + / sizeof(TImplementationProxy); + return KBtHidPluginImplementationTable; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/src/bthidsettingcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/src/bthidsettingcontainer.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,199 @@ +/* +* 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 implementation of setting container class +* +*/ + + +// INCLUDE FILES +#include // for font +#include // skin +#include //skin +#include +#include "bthidsettingcontainer.h" +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif +#include "btui.h" +#include "debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBTHidSettingContainer::ConstructL(const TRect& aRect) +// EPOC two phased constructor +// --------------------------------------------------------- +// +void CBTHidSettingContainer::ConstructL(const TRect& aRect) + { + CreateWindowL(); //makes the control a window-owning control + BaseConstructL( aRect ); + } + +// --------------------------------------------------------- +// CBTHidBaseContainer::BaseConstructL() +// --------------------------------------------------------- +// +void CBTHidSettingContainer::BaseConstructL( const TRect& aRect ) + { + SetRect(aRect); + iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); + ActivateL(); + } + + +// Destructor +CBTHidSettingContainer::~CBTHidSettingContainer() + { + delete iBackGround; + } + + +// --------------------------------------------------------------------------- +// CBTHidSettingContainer::SizeChanged +// called by framwork when the view size is changed +// +// --------------------------------------------------------------------------- +// +void CBTHidSettingContainer::SizeChanged() + { + TRACE_INFO( (_L("[BTHID]\t CBTHidBaseContainer::SizeChanged(); Width %d Height %d "),Rect().Height(), Rect().Width())); + + //Handle SizeChanged for Skin + TRect parentRect(Rect()); + if (iBackGround) + iBackGround->SetRect(parentRect); + } + +// --------------------------------------------------------------------------- +// CBTHidSettingContainer::CountComponentControls +// +// +// --------------------------------------------------------------------------- +// +TInt CBTHidSettingContainer::CountComponentControls() const + { + return 0; + } + +// --------------------------------------------------------------------------- +// CBTHidSettingContainer::ComponentControl +// +// +// --------------------------------------------------------------------------- +// +CCoeControl* CBTHidSettingContainer::ComponentControl(TInt /*aIndex*/) const + { + return NULL; + } + +void CBTHidSettingContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) + { + // TODO: Add your control event handler code here + } + +// --------------------------------------------------------- +// CBTHidBaseContainer::HandleResourceChange +// --------------------------------------------------------- +// + +void CBTHidSettingContainer::HandleResourceChange( TInt aType ) + { + + //Handle change in layout orientation + if (aType == KEikDynamicLayoutVariantSwitch) + { + + //TRect rect = iAvkonAppUi->ClientRect(); + // The line above provides to big rectangle in the bottom causing cba's overdrawn by by blank area. + // Correct way to do this is below. + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + DrawNow(); + } + + else + { + CCoeControl::HandleResourceChange(aType); + } + } + +// --------------------------------------------------------- +// CBTHidBaseContainer::Draw(const TRect& aRect) const +// --------------------------------------------------------- +// +void CBTHidSettingContainer::Draw(const TRect& aRect) const + { + TRACE_FUNC(_L("[BTHID]\t CBTHidSettingContainer::Draw()")); + TRgb color; + + CWindowGc& gc = SystemGc(); + + // draw background + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + + // get skin text color + AknsUtils::GetCachedColor( skin, color , KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); + gc.SetPenColor( color ); + + MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); + AknsDrawUtils::Background( skin, cc, this, gc, aRect ); + } + +// --------------------------------------------------------- +// CBTHidBaseContainer::MopSupplyObject() +// Pass skin information if needed. +// --------------------------------------------------------- +// +TTypeUid::Ptr CBTHidSettingContainer::MopSupplyObject(TTypeUid aId) + { + if(aId.iUid == MAknsControlContext::ETypeId && iBackGround) + { + return MAknsControlContext::SupplyMopObject( aId, iBackGround); + } + + return CCoeControl::MopSupplyObject( aId ); + } + +#ifdef __SERIES60_HELP + +// --------------------------------------------------------- +// From CCoeControl +// CBTHidSettingContainer::GetHelpContext +// --------------------------------------------------------- +// +void CBTHidSettingContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + TRACE_FUNC_ENTRY + + aContext.iMajor = KBtuiUid3; + aContext.iContext = KBTKEYBOARD_HLP_SETTINGS; + } + +#else + +// --------------------------------------------------------- +// From CCoeControl +// CBTHidSettingContainer::GetHelpContext +// --------------------------------------------------------- +// +void CBTHidSettingContainer::GetHelpContext(TCoeHelpContext& /*aContext*/) const + { + TRACE_FUNC_ENTRY + } + +#endif +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/src/bthidsettingview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/src/bthidsettingview.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,436 @@ +/* +* 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 implementation of setting view class +* +*/ + +#include +#include +#include +#include +#include +#include // Help launcher +#include +#include +#include +#include // Help IDs +#include +#include +#include "bthidsettingview.h" +#include "bthidsettingcontainer.h" +#include "bthidsettings.h" +#include "bthidsettinglist.h" +#include "btkeyboard.hrh" +#include +#include "btengprivatecrkeys.h" +#include "layoutmgr.h" +#include "hidlayoutids.h" +#include "debug.h" + +const TUid KBtHidSettingViewId = + { + 0x2001E30B + } + ; // UID of HID device setting view. +// --------------------------------------------------------- +// CBtHidSettingView::NewNewGsPluginL +// Two phased constructor +// --------------------------------------------------------- +// +CBtHidSettingView* CBtHidSettingView::NewBtuiPluginL() + { + //TRACE_FUNC(_L("[BTHID]\t CBtHidSettingView::NewBtuiPluginL(), BEGIN")); + + CBtHidSettingView* self = new (ELeave) CBtHidSettingView(); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + //TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::NewBtuiPluginL, END"),self) ); + + return self; + } + + +// ---------------------------------------------------- +// CBtHidSettingView::CBtHidSettingView +// default constructor +// ---------------------------------------------------- +// +CBtHidSettingView::CBtHidSettingView() + {} + +// ---------------------------------------------------- +// CBtHidSettingView::ConstructL +// ---------------------------------------------------- +// +void CBtHidSettingView::ConstructL() + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]:ConstructL(), BEGIN"),this) ); + + User::LeaveIfError(iLayoutSession.Connect()); + + // Check to see what type of layout code the layout manager will return + // us. (i.e nokia or standard) + // This is used to know which settings page to display. + TBool ignore; + TRACE_INFO(_L("[BTHID]\t CBtHidMainView::ConstructL(), get layout info...")); + User::LeaveIfError(iLayoutSession.GetDeviceInfo(iIsNokiaKeyboard, ignore)); + + iEikEnv = CEikonEnv::Static(); + TFileName filename; + filename += KFileDrive; + filename += KDC_RESOURCE_FILES_DIR; + filename += KResourceFileName; + BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), filename ); + iResourceFileFlag=iEikEnv->AddResourceFileL(filename); + BaseConstructL( R_BTKEYBOARD_SETTING_VIEW ); + + CEikStatusPane *sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); + // Fetch pointer to the default title pane control + iContextPane = (CAknContextPane *)sp->ControlL(TUid::Uid(EEikStatusPaneUidContext)); + + iSettings = CBtHidSettings::NewL(); + + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]:ConstructL(), END"),this) ); + } +// ---------------------------------------------------- +// CBtHidSettingView::~CBtHidSettingView() +// Destructor +// Frees reserved resources +// ---------------------------------------------------- +// +CBtHidSettingView::~CBtHidSettingView() + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::~CBtHidSettingView()"), this) ); + iLayoutSession.Close(); + + delete iNaviDecorator; + iEikEnv->DeleteResourceFile(iResourceFileFlag); + + if ( iSettingList ) + { + AppUi()->RemoveFromStack( (CCoeControl*) iSettingList ); + delete iSettingList; + } + if ( iContainer ) + { + AppUi()->RemoveFromStack(iContainer ); + delete iContainer; + } + if( iCenRepWatcher ) + delete iCenRepWatcher; + + if (iSettings ) + delete iSettings; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// TUid CBtHidSettingView::Id +// --------------------------------------------------------- +// +TUid CBtHidSettingView::Id() const + { + TUid id = KBtHidSettingViewId; //view id + return id; + } + +// ---------------------------------------------------- +// CBtHidSettingView::HandleCommandL(TInt aCommand) +// takes care of command handling +// ---------------------------------------------------- +// +void CBtHidSettingView::HandleCommandL(TInt aCommand) + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::HandleCommandL(%d)"),this, aCommand) ); + switch ( aCommand ) + { + case EEikCmdExit: // fall-through, handled similarily + case EAknSoftkeyExit: // fall-through, handled similarily + //case EBTKeyCmdExit: + { + AppUi()->HandleCommandL( EEikCmdExit); + } + case EAknSoftkeyChange: + case EBTKeyCmdAppChange: + { + if( iSettingList ) + { + iCenRepWatcher->DisableNotifications(); + iSettingList->EditCurrentItemL( aCommand ); + iCenRepWatcher->EnableNotifications(); + } + break; + } + case EAknSoftkeyBack: + { + AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); + break; + } + +#ifdef __SERIES60_HELP + case EBTKeyCmdAppHelp: + { + HlpLauncher::LaunchHelpApplicationL( + iEikEnv->WsSession(), AppUi()->AppHelpContextL()); + break; + } + +#endif + default: + { + AppUi()->HandleCommandL( aCommand ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CBtHidSettingView::DoActivateL() +// --------------------------------------------------------------------------- +// +void CBtHidSettingView::DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ) + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::DoActivateL, BEGIN"),this) ); + iPrevViewId = aPrevViewId; + (void) aCustomMessageId; + + // Setup the title + HBufC* title; + title = iCoeEnv->AllocReadResourceLC(R_BTKEYBOARD_SETTINGS_STATUS_PANE_TITLE); + + CEikStatusPane* statusPane = StatusPane(); + CAknTitlePane* titlePane; + titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); + titlePane->SetTextL(title->Des()); + CleanupStack::PopAndDestroy(); // title + title = NULL; + + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::DoActivateL(), Creating container..."),this) ); + iContainer = new (ELeave) CBTHidSettingContainer; + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect()); + iContainer->MakeVisible( ETrue ); + iContainer->ActivateL(); + AppUi()->AddToStackL(iContainer); + + CreateSettingListL(); + iCenRepWatcher = CBtHidCenRepWatcher::NewL( KCRUidBTEngPrivateSettings, *this ); // create listener for cenrep events. + SetNavipaneTextL(aCustomMessage); + + TRACE_INFO((_L("[BTHID]\t CBtHidSettingView[0x%08x]::DoActivateL, END"),this) ); + } + + +// --------------------------------------------------------------------------- +// CBtHidSettingView::DoDeactivate +// +// Deactivate the settings view. +// --------------------------------------------------------------------------- +// +void CBtHidSettingView::DoDeactivate() + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::DoDeactivate, BEGIN"),this) ); + if ( iSettingList ) + { + AppUi()->RemoveFromStack( (CCoeControl*) iSettingList ); + delete iSettingList; + iSettingList = NULL; + } + if( iContainer ) + { + iContainer->MakeVisible(EFalse); + AppUi()->RemoveFromStack( iContainer ); + delete iContainer; + iContainer = NULL; + } + + if (iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + iLastSelectedLayout = iSettings->LoadLayoutSetting(); + iLayoutSession.SetLayout(iLastSelectedLayout); + delete iCenRepWatcher; + iCenRepWatcher = NULL; + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------- +// CBtHidSettingView::DynInitMenuPaneL +// ---------------------------------------------------- +// +void CBtHidSettingView::DynInitMenuPaneL( + TInt aResourceId, CEikMenuPane* aMenuPane) + { + if (aResourceId == R_BTKEYBOARD_SETTING_MENU ) + { + aMenuPane->SetItemDimmed(EBTKeyCmdAppChange, ETrue); + } + + + } + +// ---------------------------------------------------- +// CBtHidSettingView::CreateSettingListL +// ---------------------------------------------------- +// +void CBtHidSettingView::CreateSettingListL() + { + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::CreateSettingListL, BEGIN"),this) ); + + TInt resourceId = R_BTKEYBOARD_STANDARD_SETTING_LIST; + + TBool foundLayout; + User::LeaveIfError(iLayoutSession.GetDeviceInfo(iIsNokiaKeyboard, foundLayout)); + + if(iIsNokiaKeyboard) + { + resourceId = R_BTKEYBOARD_NOKIA_SETTING_LIST; + } + else + { + resourceId = R_BTKEYBOARD_STANDARD_SETTING_LIST; + } + + TInt layoutCode; + if ( !foundLayout ) + { + //No layout found, find an appropriate one. + layoutCode = CurrentLayoutL(); + SetCurrentLayoutL(static_cast(layoutCode)); + } + else + { + //Layout found, load it as default + iLayoutSession.GetLayout(layoutCode); + SetCurrentLayoutL(static_cast(layoutCode)); + } + + if ( iSettingList ) + { + AppUi()->RemoveFromStack( (CCoeControl*) iSettingList ); + } + delete iSettingList; + iSettingList = NULL; + + iSettingList = new (ELeave) CBTKeySettingList( *iSettings, this); + iSettingList->SetMopParent(this); + iSettingList->ConstructFromResourceL(resourceId); + AppUi()->AddToStackL( (CCoeControl*) iSettingList ); + iSettingList->MakeVisible(ETrue); + iSettingList->SetRect(ClientRect()); + iSettingList->ActivateL(); + iSettingList->DrawNow(); + TRACE_INFO( (_L("[BTHID]\t CBtHidSettingView[0x%08x]::CreateSettingListL, END"),this) ); + } + +// ---------------------------------------------------- +// CBtHidSettingView::SetCurrentLayoutL +// ---------------------------------------------------- +// +void CBtHidSettingView::SetCurrentLayoutL(THidKeyboardLayoutId aLayoutValue) + { + // Ask the layout manager to change layout. + // Use the leaving version so we the user can't confirm a selection + // if an error occurs. + iLayoutSession.SetLayoutL(aLayoutValue); + + iSettings->SaveLayoutSettingL( aLayoutValue ); + } + +THidKeyboardLayoutId CBtHidSettingView::CurrentLayoutL() const + { + // Ask the layout manager for the current layout. + // Use the leaving version. + TInt layoutCode = iLayoutSession.GetLayoutL(); + + // Convert the Int to the enum. + THidKeyboardLayoutId layoutID = + static_cast(layoutCode); + + // If we believe this to be a Nokia keyboard then the layout settings + // page will contain the list of Nokia Su8 items. + // Conversly if we think this is a Standard keyboard the layout settings + // page will contain the list of Standard layouts. + // We must pass a valid value to the Settings page or it will panic. + // Validate the code from the Layout Manager before returning it. + if ( iIsNokiaKeyboard ) + { + CLayoutUtils::ValidateNokiaSU8Layout(layoutID); + } + else + { + CLayoutUtils::ValidateStandardLayout(layoutID); + } + + return layoutID; + } + +void CBtHidSettingView::SetNavipaneTextL(const TDesC8& aDeviceName) + { + TRACE_INFO(_L("[BTHID]\t CBtHidSettingView::SetNavipaneTextL Start")); + CEikStatusPane* sp = + iEikonEnv->AppUiFactory()->StatusPane(); + + CAknNavigationControlContainer* np = + static_cast( + sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); + + delete iNaviDecorator; + iNaviDecorator = NULL; + + TInt blank(1); + if (aDeviceName.Length()>0 ) + { + HBufC* stringHolder = HBufC::NewLC(aDeviceName.Length() + blank); + stringHolder->Des().Copy(aDeviceName); + stringHolder->Des().Append(_L(" ")); + iNaviDecorator = np->CreateNavigationLabelL( *stringHolder ); + np->PushL( *iNaviDecorator ); + sp->DrawNow(); + CleanupStack::PopAndDestroy(stringHolder); // stringHolder + } + else + { + HBufC* temp = HBufC::NewLC(aDeviceName.Length()); + temp->Des().Copy(aDeviceName); + iNaviDecorator = np->CreateNavigationLabelL( *temp ); + np->PushL( *iNaviDecorator ); + sp->DrawNow(); + CleanupStack::PopAndDestroy(temp); // temp + } + TRACE_INFO(_L("[BTHID]\t CBtHidSettingView::SetNavipaneTextL End")); + } +// ---------------------------------------------------- +// CBtHidSettingView::CenRepDataChanged +// ---------------------------------------------------- +// +void CBtHidSettingView::CenRepDataChanged(TUid& aUid, TUint32 aKey) + { + // just recreate the setting list + TRACE_INFO((_L("[BTHID]\t CBtHidSettingView[0x%08x]::CenRepDataChanged"),this)); + (void) aUid; + if ( aKey == KBtHidKeyboardLayout ) + { + TRAPD( err, CreateSettingListL()); + err = err; + } + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/src/btkeyenumtextsettingitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/src/btkeyenumtextsettingitem.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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 "btkeyenumtextsettingitem.h" +#include "btkeyboard.hrh" +#include "bthidsettingview.h" +#include "bthidsettings.h" +#include "debug.h" + +//----------------------------------------------------------------------------- +// CBTKeyEnumTextSettingItem::CBTKeyEnumTextSettingItem +//----------------------------------------------------------------------------- +// +CBTKeyEnumTextSettingItem::CBTKeyEnumTextSettingItem( + TInt aResourceId, TInt& aValue, CBtHidSettings& aSettings, CBtHidSettingView* aBtHidSettingView) : + CAknEnumeratedTextPopupSettingItem ( aResourceId, aValue ), + iSettings(aSettings), + iBtHidSettingView(aBtHidSettingView) + {} + + +//----------------------------------------------------------------------------- +// CBTKeyEnumTextSettingItem::~CBTKeyEnumTextSettingItem +//----------------------------------------------------------------------------- +// +CBTKeyEnumTextSettingItem::~CBTKeyEnumTextSettingItem() + {} + +//----------------------------------------------------------------------------- +// CBTKeyEnumTextSettingItem::HandleSettingPageEventL +//----------------------------------------------------------------------------- +// +void CBTKeyEnumTextSettingItem::HandleSettingPageEventL( + CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType) + { + switch( aEventType ) + { + case EEventSettingOked: + { + TRACE_INFO(_L("[BTHID]\t CBTKeyEnumTextSettingItem::HandleSettingPageEventL: OK")); + // Get the new index and new value + TInt newIndex = QueryValue()->CurrentValueIndex(); + TInt newValue = EnumeratedTextArray()->At(newIndex)->EnumerationValue(); + + // Reset the index to the initial value, so if we leave when + // trying to use the new value and the user then selects cancel + // the setting item won't set the new value on the display. + QueryValue()->SetCurrentValueIndex(IndexFromValue(InternalValue())); + + switch ( Identifier() ) + { + case EBTKeySettingLayout: + { + THidKeyboardLayoutId newLayout = + static_cast(newValue); + iSettings.SaveLayoutSettingL(newLayout); + iBtHidSettingView->SetCurrentLayoutL(newLayout); + } + break; + + default: + break; + } + + // We have finished using the new value. Set the index to the new + // value so the UI is updated when this function exits + QueryValue()->SetCurrentValueIndex(newIndex); + + // store the setting page internal value to the external variable + StoreL(); + break; + } + case EEventSettingCancelled: + { + TRACE_INFO(_L("[BTHID]\t CBTKeyEnumTextSettingItem::HandleSettingPageEventL: Cancel")); + // Reset the index to the initial value + QueryValue()->SetCurrentValueIndex(IndexFromValue(InternalValue())); + break; + } + case EEventSettingChanged: + { + TRACE_INFO(_L("[BTHID]\t CBTKeyEnumTextSettingItem::HandleSettingPageEventL: Changed")); + // Flow through + } + default: + { + //do nothing + break; + } + } + // call the base class handler to take care of other event types + CAknSettingItem::HandleSettingPageEventL(aSettingPage, aEventType); + } + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/bthidkbdsettings/src/btkeysettinglist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/bthid/bthidkbdsettings/src/btkeysettinglist.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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 "bthidsettingview.h" +#include "bthidsettings.h" +#include "bthidsettinglist.h" +#include "btkeyenumtextsettingitem.h" +#include "btkeyboard.hrh" + +//----------------------------------------------------------------------------- +// CBTKeySettingList::CBTKeySettingList +//----------------------------------------------------------------------------- +// +CBTKeySettingList::CBTKeySettingList(CBtHidSettings& aSettings, CBtHidSettingView* aBtHidSettingView): + CAknSettingItemList(), iSettings(aSettings), iBtHidSettingView(aBtHidSettingView) + { + } + +//----------------------------------------------------------------------------- +// CBTKeySettingList::CreateSettingItemL +//----------------------------------------------------------------------------- +// +CAknSettingItem* CBTKeySettingList::CreateSettingItemL( TInt aIdentifier ) + { + CAknSettingItem* settingItem = 0; + switch ( aIdentifier ) + { + case EBTKeySettingLayout: + iLayoutCode = iSettings.LoadLayoutSetting(); + settingItem = new (ELeave) CBTKeyEnumTextSettingItem( + aIdentifier, iLayoutCode, iSettings, iBtHidSettingView); + break; + default: + break; + } + + return settingItem; + } + +//----------------------------------------------------------------------------- +// CBTKeySettingList::HandleListBoxEventL +//----------------------------------------------------------------------------- +// +void CBTKeySettingList::HandleListBoxEventL( + CEikListBox* aListBox, TListBoxEvent aEventType) + { + // call the base classes handler to handle this event. + CAknSettingItemList::HandleListBoxEventL(aListBox, aEventType); + + // store the values from all setting items to their external variables + StoreSettingsL(); + } + +//----------------------------------------------------------------------------- +// CBTKeySettingList::SizeChanged +//----------------------------------------------------------------------------- +// +void CBTKeySettingList::SizeChanged() + { + if ( ListBox() ) + { + ListBox()->SetRect(Rect()); + } + } + +//----------------------------------------------------------------------------- +// CBTKeySettingList::EditCurrentItemL +//----------------------------------------------------------------------------- +// +void CBTKeySettingList::EditCurrentItemL( TInt aCommand ) + { + if ( ListBox() ) + { + TInt index = ListBox()->CurrentItemIndex(); + EditItemL(index, EBTKeyCmdAppChange == aCommand); + StoreSettingsL(); + } + } +//End of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/keyboard/group/keyboard.mmp --- a/bluetoothengine/bthid/keyboard/group/keyboard.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/group/keyboard.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -60,4 +60,5 @@ LIBRARY apgrfx.lib LIBRARY apparc.lib LIBRARY bthidsettings.lib +LIBRARY avkon.lib DEBUGLIBRARY flogger.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/keyboard/inc/keyboard.h --- a/bluetoothengine/bthid/keyboard/inc/keyboard.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/inc/keyboard.h Wed Sep 01 12:20:04 2010 +0100 @@ -22,6 +22,7 @@ #include #include #include +#include #include "hidinterfaces.h" #include "hidkeys.h" @@ -244,12 +245,18 @@ void LaunchApplicationL(TInt aAppUid); // Checks if multimedia-key (play,stop,..) and sends to RemCon - TBool HandleMultimediaKeys(TUint16 aScancodeKey, TBool aIsKeyDown, + TBool HandleKeyMapping(TDecodedKeyInfo& aKey, TBool aIsKeyDown, + TUint8 aModifiers); + TBool HandleKeyMappingUp(TDecodedKeyInfo& aKey, TBool aIsKeyDown, + TUint8 aModifiers); + TBool HandleKeyMappingDown(TDecodedKeyInfo& aKey, TBool aIsKeyDown, TUint8 aModifiers); - TBool HandleMultimediaKeysForNokia(TUint16 aScancodeKey, - TBool aIsKeyDown, TUint8 aModifiers); - TBool HandleMultimediaKeysForStandard(TUint16 aScancodeKey, - TBool aIsKeyDown, TUint8 aModifiers); + TBool HandleKeyMappingLeft(TDecodedKeyInfo& aKey, TBool aIsKeyDown, + TUint8 aModifiers); + TBool HandleKeyMappingRight(TDecodedKeyInfo& aKey, TBool aIsKeyDown, + TUint8 aModifiers); + TBool HandleKeyMappingOther(TDecodedKeyInfo& aKey, TBool aIsKeyDown, + TUint8 aModifiers); TInt AppMenuId(); TInt PhoneAppId(); @@ -260,12 +267,23 @@ // bitmap for Multimedia key states enum TMmKeyDown { - EVolUp = 1, - EVolDown = 2, - EPlay = 4, - EStop = 8, - ENext = 16, - EPrev = 32 + ENone = 0x00, + EVolUp = 0x01, + EVolDown = 0x02, + EPlay = 0x04, + EStop = 0x08, + ENext = 0x10, + EPrev = 0x20, + }; + + // bitmap for navigation keys + enum TNavKeyDown + { + ELsk = 0x01, + ERsk = 0x02, + ESend = 0x04, + EEnd = 0x08, + EEsc = 0x10 }; void ResetBitmap(TBool aIsKeyDown, TMmKeyDown aBitmapToReset); @@ -340,6 +358,9 @@ // This timer stops key repeating after defined time to prevent endless key repeats in error cases. Fix for EMKD-7FBB9H CTimeOutTimer* iRepeatEndTimer; + + TUint8 iNavKeyDown; + RAknKeyLock iKeyLock; }; // ---------------------------------------------------------------------- diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/keyboard/src/keyboard.cpp --- a/bluetoothengine/bthid/keyboard/src/keyboard.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/keyboard/src/keyboard.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -23,6 +23,9 @@ #include #include #include +#include +#include +#include #include "hidtranslate.h" #include "finder.h" @@ -50,6 +53,28 @@ const TInt KKeyRepeatDelay = 500000; const TInt KKeyRepeatInterval = 75000; + +// The bitmap of modifier byte is defined in the HID spec. +// 8.3 Report Format for Array Items (HID1_11.pdf p56) +// +// bit description mask +// ------------------------- +// 0 LEFT CTRL = 0x01 +// 1 LEFT SHIFT = 0x02 +// 2 LEFT ALT = 0x04 +// 3 LEFT GUI = 0x08 +// 4 RIGHT CTRL = 0x10 +// 5 RIGHT SHIFT = 0x20 +// 6 RIGHT ALT = 0x40 +// 7 RIGHT GUI = 0x80 + +const TUint KHidModifierCtrl = 0x01; +const TUint KHidModifierCtrlRight = 0x10; +const TUint KHidModifierAlt = 0x04; +const TUint KHidModifierAltRight = 0x40; +const TUint KHidModifierShift = 0x02; +const TUint KHidModifierShiftRight = 0x20; + //---------------------------------------------------------------------------- // CHidKeyboardDriver::CHidKeyboardDriver //---------------------------------------------------------------------------- @@ -110,6 +135,11 @@ iIdleAppId = IdleAppId(); iSettings = CBtHidSettings::NewL(); + + // create a keylock session + TInt err = iKeyLock.Connect(); + TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::ConstructL: key lock err = %d"), err)); + User::LeaveIfError(err); } //---------------------------------------------------------------------------- @@ -133,6 +163,8 @@ if (iSettings) delete iSettings; + + iKeyLock.Close(); } //---------------------------------------------------------------------------- @@ -143,6 +175,7 @@ { TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::StartL"))); aConnectionId = aConnectionId; + // No keys are pressed: iModifiers = 0; for (TInt i = 0; i < KNumInputFieldTypes; ++i) @@ -495,8 +528,7 @@ //check if the key is multimedia key that needs to be sent as RawEvent and send it. // if key event is consumed don't send it anymore. - if (!HandleMultimediaKeys(decodedKeys.iScanCode, aIsKeyDown, - iModifiers)) //check if the key is multimedia key that needs to be sent as RawEvent and send it. + if (!HandleKeyMapping(decodedKeys, aIsKeyDown, iModifiers)) { if (decodedKeys.iScanCode != EStdKeyNull) { @@ -515,7 +547,8 @@ //Send key codes differently to idle app if ((IsDigitKey(decodedKeys.iScanCode) || IsSpecialHandleKey( unikey) || decodedKeys.iScanCode == EStdKeyYes - || decodedKeys.iScanCode == EStdKeyBackspace) + || decodedKeys.iScanCode == EStdKeyBackspace + || decodedKeys.iScanCode == EStdKeyNo) && IsPhoneAppTopMost()) { TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::KeyEvent: Send event %c to idle editor"), unikey)); @@ -1156,17 +1189,6 @@ TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::WindowGroupForKeyEvent: type %d, kc 0x%08x, sc 0x%08x, mod 0x%06x, rep %d]"), aType, aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aKeyEvent.iRepeats)); - _LIT(KBackDrop, "*EiksrvBackdrop*"); - - if (EStdKeyApplication0 == aKeyEvent.iScanCode && (EEventKeyDown == aType - || EEventKeyUp == aType)) - { - // Application key up/down events go to the Eikon server - // Use this old way for application key - TInt result = iWsSession.FindWindowGroupIdentifier(0, KBackDrop); //This was in A2.x __EIKON_SERVER_NAME - DBG(if (KErrNotFound == result) RDebug::Print(_L("[HID]\tCHidKeyboardDriver::WindowGroupForKeyEvent(): BackDropWindowGroup Name not found!"))); - return result; - } if (EKeyDevice2 == aKeyEvent.iCode && EEventKey == aType) { @@ -1347,7 +1369,33 @@ void CHidKeyboardDriver::LaunchApplicationL(TInt aAppUid) { TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::LaunchApplication: UID 0x%08x"), aAppUid)); - + + //KeyLock or phone auto lock is on, refuse to continue + if (iKeyLock.IsKeyLockEnabled()) + { + TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF KEYLOCK")); + return; + } + + TInt devLockStatus( EAutolockStatusUninitialized ); + TInt err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, devLockStatus ); + + if (!err) + { + if ( EAutolockOff != devLockStatus && EAutolockStatusUninitialized != devLockStatus) + { + //Auto lock is on, refuse to continue + TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF AUTO LOCK")); + return; + } + } + else + { + //failed to get AUTO LOCK status + TRACE_INFO( _L("[HID]\tCHidKeyboardDriver::LaunchApplicationL() SKIPPED BECAUSE OF FAILED TO GET AUTO LOCK STATUS")); + return; + } + TApaTaskList taskList(iWsSession); TUid uid = TUid::Uid(aAppUid); TApaTask task = taskList.FindApp(uid); @@ -1399,17 +1447,616 @@ //---------------------------------------------------------------------------- // -TBool CHidKeyboardDriver::HandleMultimediaKeys(TUint16 aScancodeKey, - TBool aIsKeyDown, TUint8 aHIDModifiers) +TBool CHidKeyboardDriver::HandleKeyMapping(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 aHIDModifiers) + { + TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleKeyMapping"))); + + TBool ret = EFalse; + + switch (aKey.iScanCode) + { + case EStdKeyUpArrow: + { + ret = HandleKeyMappingUp(aKey, aIsKeyDown, aHIDModifiers); + break; + } + case EStdKeyDownArrow: + { + ret = HandleKeyMappingDown(aKey, aIsKeyDown, aHIDModifiers); + break; + } + case EStdKeyLeftArrow: + { + ret = HandleKeyMappingLeft(aKey, aIsKeyDown, aHIDModifiers); + break; + } + case EStdKeyRightArrow: + { + ret = HandleKeyMappingRight(aKey, aIsKeyDown, aHIDModifiers); + break; + } + case EStdKeyEscape: + // fall through + case EStdKeyF8: + // fall through + case EStdKeyApplication0: + // fall through + case EStdKeyApplication2: + // fall through + case EStdKeyApplication3: + // fall through + case EStdKeyF9: + // break; + case EStdKeyApplication4: + // fall through + case EStdKeyF7: + // fall through + case EStdKeyApplication5: + // fall through + case EStdKeyF12: + // fall through + case EStdKeyIncVolume: + // fall through + case EStdKeyF11: + // fall through + case EStdKeyDecVolume: + // fall through + case EStdKeyF10: + { + ret = HandleKeyMappingOther(aKey, aIsKeyDown, aHIDModifiers); + break; + } + default: + { + // no actions for these keys + break; + } + } + + return ret; + } + +// ---------------------------------------------------------------------- +// CHidKeyboardDriver::HandleKeyMappingUp +// Handle key mapping gor UP + MODIFIER +// ---------------------------------------------------------------------- +// +TBool CHidKeyboardDriver::HandleKeyMappingUp(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 aHIDModifiers) { - TBool ret = HandleMultimediaKeysForNokia(aScancodeKey, aIsKeyDown, - aHIDModifiers); + TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingUp"))); + + TBool ret = EFalse; + TInt scancode = 0; + TUint modifier = 0; + TBool isMmKey = EFalse; + TMmKeyDown bitmapToReset = ENone; + + switch (aKey.iScanCode) + { + case EStdKeyUpArrow: + { + // Key up and send key was emulated + if (!aIsKeyDown && + iNavKeyDown & ESend) + { + TRACE_INFO((_L("[HID]\tCTRL + UP >>> SEND KEY UP"))); + + aKey.iScanCode = EStdKeyYes; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyYes; + key.iUnicode = EKeyYes; + + iNavKeyDown = (iNavKeyDown & !ESend); + } + + //CTRL = Send key + else if (aIsKeyDown && + aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)) + { + TRACE_INFO((_L("[HID]\tCTRL + UP >>> SEND KEY DOWN"))); + + aKey.iScanCode = EStdKeyYes; + aKey.iCount = 1; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyYes; + key.iUnicode = EKeyYes; + + iNavKeyDown = (iNavKeyDown | ESend); + } + + //ALT = Stop + else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) || + iMmKeyDown & EStop) + { + TRACE_INFO((_L("[HID]\tALT + UP >>> STOP"))); + + scancode = EStdKeyApplication3; + isMmKey = ETrue; + bitmapToReset = EStop; + } + + //SHIFT = Volume up + else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) || + iMmKeyDown & EVolUp) + { + TRACE_INFO((_L("[HID]\tSHIFT + UP >>> VOLUME UP"))); + + scancode = EStdKeyIncVolume; + isMmKey = ETrue; + bitmapToReset = EVolUp; + } + break; + } + default: + { + // no actions + break; + } + } + + if (isMmKey) + { + if (bitmapToReset) + { + ResetBitmap(aIsKeyDown, bitmapToReset); + } + SendRawEvent(scancode, aIsKeyDown, modifier); + ret = ETrue; + } + + return ret; + } + +// ---------------------------------------------------------------------- +// CHidKeyboardDriver::HandleKeyMappingDown +// Handle key mapping gor DOWN + MODIFIER +// ---------------------------------------------------------------------- +// +TBool CHidKeyboardDriver::HandleKeyMappingDown(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 aHIDModifiers) + { + TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingDown"))); + + TBool ret = EFalse; + TInt scancode = 0; + TUint modifier = 0; + TBool isMmKey = EFalse; + TMmKeyDown bitmapToReset = ENone; + + switch (aKey.iScanCode) + { + case EStdKeyDownArrow: + { + // Key up and end key was emulated + if (!aIsKeyDown && + iNavKeyDown & EEnd) + { + TRACE_INFO((_L("[HID]\tCTRL + DOWN >>> END KEY UP"))); + + aKey.iScanCode = EStdKeyNo; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyNo; + key.iUnicode = EKeyNo; + + iNavKeyDown = (iNavKeyDown & !EEnd); + } + + //CTRL = End key + else if (aIsKeyDown && + aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)) + { + TRACE_INFO((_L("[HID]\tCTRL + DOWN >>> END KEY DOWN"))); + + aKey.iScanCode = EStdKeyNo; + aKey.iCount = 1; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyNo; + key.iUnicode = EKeyNo; + + iNavKeyDown = (iNavKeyDown | EEnd); + } + + //ALT = Stop + else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) || + iMmKeyDown & EPlay) + { + TRACE_INFO((_L("[HID]\tALT + DOWN >>> PLAY / PAUSE"))); + + scancode = EStdKeyApplication2; + isMmKey = ETrue; + bitmapToReset = EPlay; + } + + //SHIFT = Volume down + else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) || + iMmKeyDown & EVolDown) + { + TRACE_INFO((_L("[HID]\tSHIFT + DOWN >>> VOLUME DOWN"))); + + scancode = EStdKeyDecVolume; + isMmKey = ETrue; + bitmapToReset = EVolDown; + } + break; + } + default: + { + // no actions + break; + } + } + + if (isMmKey) + { + if (bitmapToReset) + { + ResetBitmap(aIsKeyDown, bitmapToReset); + } + SendRawEvent(scancode, aIsKeyDown, modifier); + ret = ETrue; + } + + return ret; + } + +// ---------------------------------------------------------------------- +// CHidKeyboardDriver::HandleKeyMappingLeft +// Handle key mapping gor LEFT + MODIFIER +// ---------------------------------------------------------------------- +// +TBool CHidKeyboardDriver::HandleKeyMappingLeft(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 aHIDModifiers) + { + TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingLeft"))); - if (!ret) + TBool ret = EFalse; + TInt scancode = 0; + TUint modifier = 0; + TBool isMmKey = EFalse; + TMmKeyDown bitmapToReset = ENone; + + switch (aKey.iScanCode) + { + case EStdKeyLeftArrow: + { + // Key up and LSK was simulated + if (!aIsKeyDown && + iNavKeyDown & ELsk) + { + TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> LEFT SOFTKEY UP"))); + + aKey.iScanCode = EStdKeyDevice0; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyDevice0; + key.iUnicode = EKeyDevice0; + + iNavKeyDown = (iNavKeyDown & !ELsk); + } + + //CTRL = LSK + else if (aIsKeyDown && + aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)) + { + TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> LEFT SOFTKEY DOWN"))); + + aKey.iScanCode = EStdKeyDevice0; + aKey.iCount = 1; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyDevice0; + key.iUnicode = EKeyDevice0; + + iNavKeyDown = (iNavKeyDown | ELsk); + } + + //ALT (short) = Previous + //ALT (long) = Backwards + else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) || + iMmKeyDown & EPrev) + { + TRACE_INFO((_L("[HID]\tALT + LEFT >>> PREVIOUS / REW"))); + + scancode = EStdKeyApplication5; + isMmKey = ETrue; + bitmapToReset = ENext; + } + + //SHIFT = Mute toggle + else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) || + iMmKeyDown & EPlay) + { + TRACE_INFO((_L("[HID]\tSHIFT + LEFT >>> MUTE / UNMUTE"))); + + scancode = EStdKeyApplication2; + isMmKey = ETrue; + bitmapToReset = EPlay; + } + break; + } + default: + { + // no actions + break; + } + } + + if (isMmKey) + { + if (bitmapToReset) + { + ResetBitmap(aIsKeyDown, bitmapToReset); + } + SendRawEvent(scancode, aIsKeyDown, modifier); + ret = ETrue; + } + + return ret; + } + +// ---------------------------------------------------------------------- +// CHidKeyboardDriver::HandleKeyMappingRight +// Handle key mapping gor RIGHT + MODIFIER +// ---------------------------------------------------------------------- +// +TBool CHidKeyboardDriver::HandleKeyMappingRight(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 aHIDModifiers) + { + TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingRight"))); + + TBool ret = EFalse; + TInt scancode = 0; + TUint modifier = 0; + TBool isMmKey = EFalse; + TMmKeyDown bitmapToReset = ENone; + + switch (aKey.iScanCode) { - ret = HandleMultimediaKeysForStandard(aScancodeKey, aIsKeyDown, - aHIDModifiers); + case EStdKeyRightArrow: + { + // Key up and RSK was simulated + if (!aIsKeyDown && + iNavKeyDown & ERsk) + { + TRACE_INFO((_L("[HID]\tCTRL + LEFT >>> RIGHT SOFTKEY UP"))); + + aKey.iScanCode = EStdKeyDevice1; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyDevice1; + key.iUnicode = EKeyDevice1; + + iNavKeyDown = (iNavKeyDown & !ERsk); + } + + //CTRL = RSK + else if (aIsKeyDown && + aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight)) + { + TRACE_INFO((_L("[HID]\tCTRL + RIGHT >>> RIGHT SOFTKEY DOWN"))); + + aKey.iScanCode = EStdKeyDevice1; + aKey.iCount = 1; + TTranslatedKey& key = aKey.iEvent[0]; + key.iIsRepeatingKey = aIsKeyDown; + key.iScanCode = EStdKeyDevice1; + key.iUnicode = EKeyDevice1; + + iNavKeyDown = (iNavKeyDown | ERsk); + } + + //ALT (short) = Next + //ALT (long) = Forward + else if (aHIDModifiers & (KHidModifierAlt | KHidModifierAltRight) || + iMmKeyDown & EPrev) + { + TRACE_INFO((_L("[HID]\tALT + RIGHT >>> NEXT / FF"))); + + scancode = EStdKeyApplication4; + isMmKey = ETrue; + bitmapToReset = EPrev; + } + + //SHIFT = Mute toggle (currently just toggle play / pause) + else if (aHIDModifiers & (KHidModifierShift | KHidModifierShiftRight) || + iMmKeyDown & EPlay) + { + TRACE_INFO((_L("[HID]\tSHIFT + RIGHT >>> MUTE / UNMUTE"))); + + scancode = EStdKeyApplication2; + isMmKey = ETrue; + bitmapToReset = EPlay; + } + break; + } + default: + { + // no actions + break; + } + } + + if (isMmKey) + { + if (bitmapToReset) + { + ResetBitmap(aIsKeyDown, bitmapToReset); + } + SendRawEvent(scancode, aIsKeyDown, modifier); + ret = ETrue; } + + return ret; + } + +// ---------------------------------------------------------------------- +// CHidKeyboardDriver::HandleKeyMappingOther +// Handle key mapping gor OTHER + MODIFIER +// ---------------------------------------------------------------------- +// +TBool CHidKeyboardDriver::HandleKeyMappingOther(TDecodedKeyInfo& aKey, + TBool aIsKeyDown, + TUint8 /*aHIDModifiers*/) + { + TRACE_INFO((_L("[HID]\tCHidKeyboardDriver::HandleKeyMappingOther"))); + + TBool ret = EFalse; + TInt scancode = 0; + TUint modifier = 0; + TBool isMmKey = EFalse; + + switch (aKey.iScanCode) + { + case EStdKeyEscape: + { + // ESC is released and keys were locked, eat the key press + if (!aIsKeyDown && + iNavKeyDown & EEsc) + { + TRACE_INFO((_L("[HID]\tESC >>> DISBALE KEY LOCK UP"))); + + ret = ETrue; + iNavKeyDown = (iNavKeyDown & !EEsc); + } + + // ESC when keylock enabled >>> Disabled key lock + else if (aIsKeyDown && + iKeyLock.IsKeyLockEnabled()) + { + TInt devLockStatus( EAutolockStatusUninitialized ); + TInt err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, devLockStatus ); + + if (!err) + { + if (EAutolockOff == devLockStatus || EAutolockStatusUninitialized == devLockStatus) + { + TRACE_INFO((_L("[HID]\tESC >>> AUTO LOCK IS OFF, DISBALE KEY LOCK DOWN "))); + iKeyLock.DisableKeyLock(); + ret = ETrue; + iNavKeyDown = (iNavKeyDown | EEsc); + } + else + { + TRACE_INFO((_L("[HID]\tESC >>> AUTO LOCK IS ON, DISBALE KEY LOCK DOWN SKIPPED"))); + } + } + else + { + TRACE_INFO((_L("[HID]\tESC >>> FAILED to get AUTO LOCK status, DISBALE KEY LOCK DOWN SKIPPED"))); + } + + } + + break; + } + case EStdKeyApplication0: + { + TRACE_INFO((_L("[HID]\tAPPLICATION KEY(Alt+Tab) >>> TSW"))); + + // Dedicated Application key + scancode = EStdKeyApplication0; + isMmKey = ETrue; + break; + } + case EStdKeyF8: + // fall through + case EStdKeyApplication2: + { + TRACE_INFO((_L("[HID]\tF8 / APPLICATION2 >>> PLAY / PAUSE"))); + + // PLAY / PAUSE + if (aKey.iScanCode != EStdKeyApplication2) + { + scancode = EStdKeyApplication2; + isMmKey = ETrue; + } + break; + } + case EStdKeyApplication3: + { + TRACE_INFO((_L("[HID]\tAPPLICATION3 >>> STOP"))); + + // STOP + scancode = EStdKeyApplication3; + isMmKey = ETrue; + break; + } + case EStdKeyF9: + // break; + case EStdKeyApplication4: + { + TRACE_INFO((_L("[HID]\tF9 / APPLICATION4 >>> NEXT / FF"))); + + // NEXT + scancode = EStdKeyApplication4; + isMmKey = ETrue; + break; + } + case EStdKeyF7: + // fall through + case EStdKeyApplication5: + { + TRACE_INFO((_L("[HID]\tF7 / APPLICATION5 >>> PREVIOUS / REW"))); + + // PREVIOUS + scancode = EStdKeyApplication5; + isMmKey = ETrue; + break; + } + case EStdKeyF12: + // fall through + case EStdKeyIncVolume: + { + TRACE_INFO((_L("[HID]\tF12 / INCVOLUME >>> VOLUME UP"))); + + // VOLUME UP + scancode = EStdKeyIncVolume; + isMmKey = ETrue; + break; + } + case EStdKeyF11: + // fall through + case EStdKeyDecVolume: + { + TRACE_INFO((_L("[HID]\tF11 / DECVOLUME >>> VOLUME DOWN"))); + + // VOLUME DOWN + scancode = EStdKeyDecVolume; + isMmKey = ETrue; + break; + } + case EStdKeyF10: + { + TRACE_INFO((_L("[HID]\tF10 >>> MUTE"))); + + // MUTE (currently just toggle play / pause) + scancode = EStdKeyApplication2; + isMmKey = ETrue; + break; + } + default: + { + break; + } + } + + if (isMmKey) + { + SendRawEvent(scancode, aIsKeyDown, modifier); + ret = ETrue; + } + return ret; } @@ -1426,184 +2073,6 @@ } } -TBool CHidKeyboardDriver::HandleMultimediaKeysForNokia(TUint16 aScancodeKey, - TBool aIsKeyDown, TUint8 aHIDModifiers) - { - const TUint KHidModifierCtrl = 0x01; - const TUint KHidModifierCtrlRight = 0x10; - const TUint KHidModifierAlt = 0x04; - - // const TUint KHidModifierAltGr = 0x64; - TInt scancode = 0; - TUint modifier = 0; - TBool isMmKey = EFalse; - - TMmKeyDown bitmapToReset; - - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: scancode 0x%08x, HIDmodifiers 0x%08x"), aScancodeKey, aHIDModifiers)); - - switch (aScancodeKey) - { - - // Mappings for Nokia SU-8W - // Key down events are stored into bitmap in order to detect if keys are released in reverse order, which caused jamming. - // For example: control key released before arrow key. - - case EStdKeyUpArrow: - { - if (aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight) - || iMmKeyDown & EVolUp) - { - scancode = EStdKeyIncVolume; //Volume Up = Ctrl + ArrowUp - isMmKey = ETrue; - // Set or reset flag bit - - bitmapToReset = EVolUp; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume up %d"), aIsKeyDown)); - } - break; - } - - case EStdKeyDownArrow: - { - if (aHIDModifiers & (KHidModifierCtrl | KHidModifierCtrlRight) - || iMmKeyDown & EVolDown) - { - scancode = EStdKeyDecVolume; //Volume Down = Ctrl + ArrowDown - isMmKey = ETrue; - bitmapToReset = EVolDown; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume down %d"), aIsKeyDown)); - } - break; - } - - case EStdKeyRightArrow: - { - if (aHIDModifiers & KHidModifierAlt || iMmKeyDown & EPlay) - { - scancode = EStdKeyApplication2; //Play = Alt + ArrowRight - isMmKey = ETrue; - bitmapToReset = EPlay; - - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Play %d"), aIsKeyDown)); - } - else if (aHIDModifiers & (KHidModifierCtrl - | KHidModifierCtrlRight) || iMmKeyDown & ENext) - { - scancode = EStdKeyApplication4; //Next = Ctrl + ArrowRight - isMmKey = ETrue; - bitmapToReset = ENext; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Next %d"), aIsKeyDown)); - } - break; - } - - case EStdKeyLeftArrow: - { - if (aHIDModifiers & KHidModifierAlt || iMmKeyDown & EStop) - { - scancode = EStdKeyApplication3; //Stop = Alt + ArrowLeft - isMmKey = ETrue; - bitmapToReset = EStop; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Stop %d"), aIsKeyDown)); - } - else if (aHIDModifiers & (KHidModifierCtrl - | KHidModifierCtrlRight) || iMmKeyDown & EPrev) - { - scancode = EStdKeyApplication5; //Prev = Ctrl + ArrowLeft - isMmKey = ETrue; - bitmapToReset = EPrev; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Prev %d"), aIsKeyDown)); - } - break; - } - - default: - break; - } - - if (isMmKey) - { - ResetBitmap(aIsKeyDown, bitmapToReset); - SendRawEvent(scancode, aIsKeyDown, modifier); - } - return isMmKey; - } - -TBool CHidKeyboardDriver::HandleMultimediaKeysForStandard( - TUint16 aScancodeKey, TBool aIsKeyDown, TUint8 aHIDModifiers) - { - TInt scancode = 0; - TUint modifier = 0; - TBool isMmKey = EFalse; - - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: scancode 0x%08x, HIDmodifiers 0x%08x"), aScancodeKey, aHIDModifiers)); - //please complier... - (void) aHIDModifiers; - - switch (aScancodeKey) - { - // Mappings for standard keyboards - - case EStdKeyApplication2: //Play - { - scancode = EStdKeyApplication2; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Play %d"), aIsKeyDown)); - break; - } - - case EStdKeyApplication3: //Stop - { - scancode = EStdKeyApplication3; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Stop %d"), aIsKeyDown)); - break; - } - - case EStdKeyApplication4: //Next - { - scancode = EStdKeyApplication4; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Next %d"), aIsKeyDown)); - break; - } - - case EStdKeyApplication5: //Prev - { - scancode = EStdKeyApplication5; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Prev %d"), aIsKeyDown)); - break; - } - - case EStdKeyIncVolume: //Volume up - { - scancode = EStdKeyIncVolume; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume up %d"), aIsKeyDown)); - break; - } - - case EStdKeyDecVolume: //Volume down - { - scancode = EStdKeyDecVolume; - isMmKey = ETrue; - TRACE_INFO( (_L("[HID]\tCHidKeyboardDriver::HandleNokiaMultimediaKeys: Volume down %d"), aIsKeyDown)); - break; - } - - default: - break; - } - - if (isMmKey) - { - SendRawEvent(scancode, aIsKeyDown, modifier); - } - return isMmKey; - } - // ---------------------------------------------------------------------- // CHidKeyboardDriver::SendRawEvent // Send raw key event to window server diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp --- a/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/mouse/Sesame_client/src/clientimagecommander.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -27,7 +27,6 @@ #include #include #include -#include #include "clientimagecommander.h" #ifndef DBG diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/rom/btkeyboard.iby --- a/bluetoothengine/bthid/rom/btkeyboard.iby Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/rom/btkeyboard.iby Wed Sep 01 12:20:04 2010 +0100 @@ -38,6 +38,7 @@ ECOM_PLUGIN(hidkeyboard.dll, hidkeyboard.rsc) ECOM_PLUGIN(hidmouse.dll, hidmouse.rsc) ECOM_PLUGIN(kbdlayout.dll, kbdlayout.rsc) +ECOM_PLUGIN(bthidkbdsettings.dll, bthidkbdsettings.rsc) ECOM_PLUGIN(bthidengplugin.dll, bthidengplugin.rsc) data=DATAZ_\APP_BITMAP_DIR\BTMouseBitMaps.mbm APP_BITMAP_DIR\BTMouseBitMaps.mbm diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/bthid/rom/btkeyboard_resources.iby --- a/bluetoothengine/bthid/rom/btkeyboard_resources.iby Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/bthid/rom/btkeyboard_resources.iby Wed Sep 01 12:20:04 2010 +0100 @@ -20,6 +20,7 @@ #ifndef BTKEYBOARD_RESOURCES_IBY #define BTKEYBOARD_RESOURCES_IBY +data=DATAZ_\RESOURCE_FILES_DIR\BthidResource.rsc RESOURCE_FILES_DIR\BthidResource.rsc data=DATAZ_\APP_RESOURCE_DIR\PaintCursor.rsc APP_RESOURCE_DIR\PaintCursor.rsc #endif //BTKEYBOARD_RESOURCES_IBY diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/btindicator.pro --- a/bluetoothengine/btindicator/btindicator.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -# - -TEMPLATE = lib -TARGET = btindicator -CONFIG += hb plugin - -HEADERS += inc/btindicatorplugin.h \ - inc/btindicator.h \ - inc/btindicatorconstants.h - -SOURCES += src/btindicatorplugin.cpp \ - src/btindicator.cpp - -MOC_DIR = moc -OBJECTS_DIR = obj - -LIBS += -lxqservice -lcpframework -symbian { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.UID3 = 0x200315E9 - pluginstub.sources = $${TARGET}.dll - pluginstub.path = /resource/plugins/indicators - DEPLOYMENT += pluginstub - -BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ - "qmakepluginstubs/$${TARGET}.qtplugin /epoc32/data/z/pluginstub/$${TARGET}.qtplugin" \ - "rom/btindicator.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btindicator.iby)" \ - "inc/btindicatorconstants.h |../inc/btindicatorconstants.h" -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/inc/btindicator.h --- a/bluetoothengine/btindicator/inc/btindicator.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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: Bluetooth Indicator class - * - */ - -#ifndef BTINDICATOR_H -#define BTINDICATOR_H - - -#include -//#include -/** - * Bluetooth indicator class. - * Handles client request and showing the indications. - */ -class BTIndicator : public HbIndicatorInterface -{ -public: - /** - * Constructor - */ - BTIndicator(const QString &indicatorType); - - /** - * Destructor - */ - ~BTIndicator(); - - /** - * @see HbIndicatorInterface - */ - bool handleInteraction(InteractionType type); - - /** - * @see HbIndicatorInterface - */ - QVariant indicatorData(int role) const; - -protected: - /** - * @see HbIndicatorInterface - */ - bool handleClientRequest(RequestType type, const QVariant ¶meter); - -private: -// void launchBTCpSettingView(); - -/*private slots: - void handleReturnValue(const QVariant &returnValue); - void handleError(int errorCode,const QString &errorMessage);*/ - -private: - - QString mSecDisplayName; -// XQApplicationManager mAppMgr; - int mIndicatorStatus; - -private: - -}; - -#endif /* BTINDICATOR_H */ - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/inc/btindicatorconstants.h --- a/bluetoothengine/btindicator/inc/btindicatorconstants.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +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: Bluetooth Indicator constants - * - */ - -#ifndef BTINDICATORCONSTANTS_H -#define BTINDICATORCONSTANTS_H - - - -/** - * Bluetooth indicator constants - * - */ - -_LIT(KIndicatorType, "com.nokia.bluetooth.indicatorplugin/1.0"); - -enum TBTDisplayStatus - { - EBTIndicatorOff, - EBTIndicatorOnVisible, - EBTIndicatorOnHidden, - EBTIndicatorVisibleConnected, - EBTIndicatorHiddenConnected - }; - -#endif /* BTINDICATORCONSTANTS_H */ - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/inc/btindicatorplugin.h --- a/bluetoothengine/btindicator/inc/btindicatorplugin.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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: Bluetooth Indicator Plugin Class - * - */ - -#ifndef BTINDICATORPLUGIN_H -#define BTINDICATORPLUGIN_H - - -#include -#include - -class HbTranslator; - -/** - * Bluetooth indicator plugin class. - * Main class of bluetooth indicator plugin. - */ -class BTIndicatorPlugin : public QObject, public HbIndicatorPluginInterface -{ - Q_OBJECT - Q_INTERFACES(HbIndicatorPluginInterface) - -public: - /** - * Constructor - */ - BTIndicatorPlugin(); - - /** - * Destructor - */ - ~BTIndicatorPlugin(); - - /** - * @see HbIndicatorPluginInterface - */ - QStringList indicatorTypes() const; - - /** - * @see HbIndicatorPluginInterface - */ - bool accessAllowed(const QString &indicatorType, - const QVariantMap &securityInfo) const; - /** - * @see HbIndicatorPluginInterface - */ - HbIndicatorInterface* createIndicator(const QString &indicatorType); - - /** - * @see HbIndicatorPluginInterface - */ - int error() const; - -private: - Q_DISABLE_COPY(BTIndicatorPlugin) - - /** - * Error value - */ - int mError; - - /** - * Indicator types - * supported indicator types. - */ - QStringList mIndicatorTypes; - - HbTranslator* mIndicatorTranslator; -}; - - -#endif /* BTINDICATORPLUGIN_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/rom/btindicator.iby --- a/bluetoothengine/btindicator/rom/btindicator.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +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 __BTINDICATOR_IBY__ -#define __BTINDICATOR_IBY__ - -REM DLL -file=ABI_DIR\UREL\btindicator.dll SHARED_LIB_DIR\btindicator.dll -data=\epoc32\data\z\pluginstub\btindicator.qtplugin \resource\plugins\indicators\btindicator.qtplugin -#endif \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/src/btindicator.cpp --- a/bluetoothengine/btindicator/src/btindicator.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +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 "btindicator.h" -#include -//#include -//#include -#include "btindicatorconstants.h" -//#include -//#include -//#include -#define LOC_BLUETOOTH hbTrId("txt_bt_dblist_bluetooth") -#define LOC_BLUETOOTH_OFF hbTrId("txt_bt_dblist_bluetooth_val_off") -#define LOC_BLUETOOTH_ON_VISIBLE hbTrId("txt_bt_dblist_bluetooth_val_on_and_visible") -#define LOC_BLUETOOTH_VISIBLE_CONNECTED hbTrId("txt_bt_dblist_bluetooth_val_visible_and_connected") -#define LOC_BLUETOOTH_ON_HIDDEN hbTrId("txt_bt_dblist_bluetooth_val_on_and_hidden") -#define LOC_BLUETOOTH_HIDDEN_CONNECTED hbTrId("txt_bt_dblist_bluetooth_val_hidden_and_connected") - -struct BTIndicatorInfo - { - QString icon; - QString secondaryText; - }; - -static const int BTIndicatorCount = 5; - - -static const BTIndicatorInfo IndicatorInfo[BTIndicatorCount] = { - { "qtg_large_bluetooth_off", "LOC_BLUETOOTH_OFF" }, - { "qtg_large_bluetooth", "LOC_BLUETOOTH_ON_VISIBLE" }, - { "qtg_large_bluetooth_hide","LOC_BLUETOOTH_ON_HIDDEN" }, - { "qtg_large_bluetooth_active_connection", "LOC_BT_VISIBLE_CONNECT" }, - { "qtg_large_bluetooth_hide_connection","LOC_BT_HIDDEN_CONNECT" } - }; - - -// ---------------------------------------------------------------------------- -// BTIndicator::BTIndicator -// ---------------------------------------------------------------------------- -BTIndicator::BTIndicator(const QString &indicatorType) : -HbIndicatorInterface(indicatorType, - HbIndicatorInterface::SettingCategory , - InteractionActivated) - { - mIndicatorStatus = 0; - } - -// ---------------------------------------------------------------------------- -// BTIndicator::~BTIndicator -// ---------------------------------------------------------------------------- -BTIndicator::~BTIndicator() - { - } - - -// ---------------------------------------------------------------------------- -// BTIndicator::handleInteraction -// ---------------------------------------------------------------------------- -bool BTIndicator::handleInteraction(InteractionType type) - { - // bool handled = false; - if (type == InteractionActivated) - { - //@TODO need to code for launching the BT Control Panel Plugin is available - - // launchBTCpSettingView(); - } - return true; - } - -// ---------------------------------------------------------------------------- -// BTIndicator::indicatorData -// returns the data and icon that needs to be displayed in the universal pop up and indicator menu -// ---------------------------------------------------------------------------- -QVariant BTIndicator::indicatorData(int role) const -{ - switch(role) - { - case PrimaryTextRole: - { - QString text(LOC_BLUETOOTH); - return text; - } - case SecondaryTextRole: - { - return IndicatorInfo[mIndicatorStatus].secondaryText;//mSecDisplayName; - } - case DecorationNameRole: - { - //QString iconName("qtg_large_bluetooth"); - return IndicatorInfo[mIndicatorStatus].icon;//iconName; - } - case MonoDecorationNameRole : - { - // QString iconName("qtg_large_bluetooth"); - return IndicatorInfo[mIndicatorStatus].icon;//iconName; - } - - default: - return QVariant(); - } -} - -// ---------------------------------------------------------------------------- -// BTIndicator::handleClientRequest -// handles client's activate and deactivate request -// ---------------------------------------------------------------------------- -bool BTIndicator::handleClientRequest( RequestType type, - const QVariant ¶meter) - { - bool handled(false); - switch (type) { - case RequestActivate: - { - mSecDisplayName.clear(); -/* if(parameter.toInt() == EBTIndicatorOff) - mSecDisplayName.append("LOC_BLUETOOTH_OFF"); - else if(parameter.toInt() == EBTIndicatorOnVisible) - mSecDisplayName.append("LOC_BLUETOOTH_ON_VISIBLE"); - else if(parameter.toInt() == EBTIndicatorOnHidden) - mSecDisplayName.append("LOC_BLUETOOTH_ON_HIDDEN"); - else if(parameter.toInt() == EBTIndicatorVisibleConnected) - mSecDisplayName.append("LOC_BT_VISIBLE_CONNECT"); - else if(parameter.toInt() == EBTIndicatorHiddenConnected) - mSecDisplayName.append("LOC_BT_HIDDEN_CONNECT");*/ - mIndicatorStatus = parameter.toInt(); - emit dataChanged(); - handled = true; - } - break; - default: - { - mSecDisplayName.clear(); - emit deactivate(); - } - break; - } - return handled; - } - - -/*void BTIndicator::launchBTCpSettingView() - { - XQAiwRequest *request = mAppMgr.create("obexhighway","com.nokia.symbian.IFileShare","send(QVariant)",true); - - if (!request) - { - qDebug("BTIndicator request returned with NULL"); - return; - } - else - { - connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); - connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); - } - // Set arguments for request - QList args; - //c:\resource\qt\plugins\controlpanel\nfccpplugin.qtplugin - args << QVariant( "c:\\two.jpg" );//btcpplugin.dll -// args << QVariant ( "c:\\two.jpg" ); - request->setArguments(args); - - // Make the request - if (!request->send()) - { - //report error - qDebug("BTIndicator::launchBTCpSettingView request not sent"); - } - - delete request; - - }*/ - - -/*void BTIndicator::handleReturnValue(const QVariant &returnValue) -{ -} - -void BTIndicator::handleError(int errorCode,const QString &errorMessage) - { - Q_UNUSED(errorCode); - }*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btindicator/src/btindicatorplugin.cpp --- a/bluetoothengine/btindicator/src/btindicatorplugin.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +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 "btindicatorplugin.h" -#include "btindicator.h" -#include - -const char* BTINDICATOR_TRANSLATION = "btindimenu"; - -Q_EXPORT_PLUGIN(BTIndicatorPlugin) - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::BTIndicatorPlugin -// ---------------------------------------------------------------------------- -BTIndicatorPlugin::BTIndicatorPlugin() : mError(0),mIndicatorTranslator(0) -{ -} - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::~BTIndicatorPlugin -// ---------------------------------------------------------------------------- -BTIndicatorPlugin::~BTIndicatorPlugin() -{ - delete mIndicatorTranslator; -} - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::indicatorTypes -// Return notification types this plugin implements -// ---------------------------------------------------------------------------- -QStringList BTIndicatorPlugin::indicatorTypes() const -{ - QStringList types; - types << "com.nokia.bluetooth.indicatorplugin/1.0"; - return types; -} - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::accessAllowed -// ---------------------------------------------------------------------------- -bool BTIndicatorPlugin::accessAllowed(const QString &indicatorType, - const QVariantMap &securityInfo) const -{ - Q_UNUSED(indicatorType) - Q_UNUSED(securityInfo) - - // This plugin doesn't perform operations that may compromise security. - // All clients are allowed to use. - return true; -} - - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::createIndicator -// Creates and returns the HbIndicatorInterface -// ---------------------------------------------------------------------------- -HbIndicatorInterface* BTIndicatorPlugin::createIndicator(const QString &indicatorType) -{ - if(!mIndicatorTranslator) { - mIndicatorTranslator = new HbTranslator(BTINDICATOR_TRANSLATION); - } - HbIndicatorInterface *indicator = new BTIndicator(indicatorType); - return indicator; -} - -// ---------------------------------------------------------------------------- -// BTIndicatorPlugin::error -// ---------------------------------------------------------------------------- -int BTIndicatorPlugin::error() const -{ - return mError; -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btmac/group/BTMonoCmdHandler.mmp --- a/bluetoothengine/btmac/group/BTMonoCmdHandler.mmp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btmac/group/BTMonoCmdHandler.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -57,9 +57,7 @@ USERINCLUDE ../../inc USERINCLUDE ../../../inc -#ifdef NO101APPDEPFIXES APP_LAYER_SYSTEMINCLUDE -#endif //NO101APPDEPFIXES MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btmac/inc/btmac/btmman.h --- a/bluetoothengine/btmac/inc/btmac/btmman.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btmac/inc/btmac/btmman.h Wed Sep 01 12:20:04 2010 +0100 @@ -12,7 +12,7 @@ * Contributors: * * Description: the entry of this plugin. -* Version : %version: 12.1.7.1.1 % +* Version : %version: 12.1.8 % * */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btmac/inc/btmonocmdhandler/btmc_defs.h --- a/bluetoothengine/btmac/inc/btmonocmdhandler/btmc_defs.h Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btmac/inc/btmonocmdhandler/btmc_defs.h Wed Sep 01 12:20:04 2010 +0100 @@ -35,16 +35,6 @@ EBTMonoVoiceRecognitionDeactivatedByRemote, }; -#ifndef NO101APPDEPFIXES -// Local definition of application-layer PubSub key -// (TSINDKeys::ERecognitionState, in KSINDUID = KUidSystemCategoryValue): -const TInt KBTMonoVoiceRecognitionStateKey = 0; - -// Local definition of application-layer key value -// (TRecognitionStateValues::ERecognitionStarted): -const TInt KBTMonoVoiceRecognitionStarted = 0; -#endif //NO101APPDEPFIXES - enum TBTMonoATPhoneIndicatorId { EBTMonoATNetworkIndicator = 1, diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btmac/src/BTMonoCmdHandler/btmcphonestatus.cpp --- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcphonestatus.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcphonestatus.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -19,9 +19,7 @@ // INCLUDE FILES #include "btmcphonestatus.h" -#ifdef NO101APPDEPFIXES #include -#endif //NO101APPDEPFIXES #include #include "atcodec.h" #include "btmcprotocol.h" @@ -102,11 +100,7 @@ if (aEnabled && !iVoiceRecognitionEnabled) { // AO for Voice Dial -#ifdef NO101APPDEPFIXES LEAVE_IF_ERROR(iVoiceDialProperty.Attach(KSINDUID, ERecognitionState)) -#else //NO101APPDEPFIXES - LEAVE_IF_ERROR(iVoiceDialProperty.Attach(KUidSystemCategory, KBTMonoVoiceRecognitionStateKey)) -#endif //NO101APPDEPFIXES CBtmcActive* ao = CBtmcActive::NewLC(*this, CActive::EPriorityStandard, KVoiceDialSubscribe); iActives.AppendL(ao); iVoiceDialProperty.Subscribe(ao->iStatus); @@ -213,11 +207,7 @@ TRACE_INFO((_L("Voice dial Initiator %d, Voice dial event %d"), iVoiceRecogInitiator, aEnabled)) TBTMonoATVoiceRecognition value = EBTMonoATVoiceRecognitionOff; -#ifdef NO101APPDEPFIXES if (iVoiceRecogInitiator != EBTMonoVoiceRecognitionActivatedByRemote && aEnabled == ERecognitionStarted) -#else //NO101APPDEPFIXES - if (iVoiceRecogInitiator != EBTMonoVoiceRecognitionActivatedByRemote && aEnabled == KBTMonoVoiceRecognitionStarted) -#endif //NO101APPDEPFIXES {// phone activated or headset deactivated voice recognition, informs headset status change value = EBTMonoATVoiceRecognitionOn; } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btmac/src/btmac/btmman.cpp --- a/bluetoothengine/btmac/src/btmac/btmman.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btmac/src/btmac/btmman.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -12,7 +12,7 @@ * Contributors: * * Description: CBtmMan definition -* Version : %version: 15.1.8.1.1 % +* Version : %version: 15.1.9 % * */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/bmarm/Btnotifu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/bmarm/Btnotifu.def Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + NotifierArray__Fv @ 1 NONAME R3UNUSED ; NotifierArray(void) + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: Global confirmation query notification plugin -# - -TEMPLATE = lib -TARGET = btdevicedialogplugin -CONFIG += hb plugin -INCLUDEPATH += . ../inc ../../btui/inc -DEPENDPATH += . -DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs - -MOC_DIR = moc -OBJECTS_DIR = obj - -# dependencies -HEADERS += inc/btdevicedialoginputwidget.h \ - inc/btdevicedialogquerywidget.h \ - inc/btdevicedialognotifwidget.h \ - inc/btdevicedialogpluginerrors.h \ - inc/btdevicedialogplugin.h \ - inc/btdevicesearchdialogwidget.h \ - inc/btmoredevicesdialogwidget.h \ - inc/btsenddialogwidget.h \ - inc/btdevicedialogplugintrace.h \ - inc/btdevicedialogrecvquerywidget.h \ - inc/btrecvprgrsdialogwidget.h \ - inc/btrecvcompleteddialogwidget.h - - -SOURCES += src/btdevicedialogplugin.cpp \ - src/btdevicedialoginputwidget.cpp \ - src/btdevicedialogquerywidget.cpp \ - src/btdevicedialognotifwidget.cpp \ - src/btdevicesearchdialogwidget.cpp \ - src/btmoredevicesdialogwidget.cpp \ - src/btsenddialogwidget.cpp \ - src/btdevicedialogrecvquerywidget.cpp \ - src/btrecvprgrsdialogwidget.cpp \ - src/btrecvcompleteddialogwidget.cpp - -RESOURCES += btdevicedialogplugin.qrc - -symbian: { - SYMBIAN_PLATFORMS = WINSCW ARMV5 - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.UID3 = 0x2002E6DF - - LIBS += -lbtdevice \ - -lhbcore \ - -lxqservice \ - -lxqserviceutil \ - - hblib.sources = Hb.dll - hblib.path = \sys\bin - hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" - pluginstub.sources = $${TARGET}.dll - pluginstub.path = /resource/plugins/devicedialogs - DEPLOYMENT += pluginstub -} -!local { - target.path = $${HB_PLUGINS_DIR}/devicedialogs - INSTALLS += target -} - -BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include " \ - "rom/btdevicedialogplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btdevicedialogplugin.iby)" \ - "qmakepluginstubs/$${TARGET}.qtplugin /epoc32/data/z/pluginstub/$${TARGET}.qtplugin" diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - docml/bt-device-search-dialog.docml - docml/bt-more-devices-dialog.docml - docml/bt-send-dialog.docml - icons/qgn_prop_sml_bt.svg - icons/qtg_large_bluetooth.svg - docml/bt-receive-auth-dialog.docml - docml/bt-recv-progress-dialog.docml - docml/bt-receive-done-dialog.docml - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-auth-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-auth-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-done-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-receive-done-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-recv-progress-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-recv-progress-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-send-dialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/icons/qgn_prop_sml_bt.svg --- a/bluetoothengine/btnotif/btdevicedialogplugin/icons/qgn_prop_sml_bt.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/icons/qtg_large_bluetooth.svg --- a/bluetoothengine/btnotif/btdevicedialogplugin/icons/qtg_large_bluetooth.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialoginputwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialoginputwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#ifndef BTDEVICEDIALOGINPUTWIDGET_H -#define BTDEVICEDIALOGINPUTWIDGET_H - -#include - -#include -#include -#include - -/*! - \class BtDeviceDialogInputWidget - \brief Widget class with properties setting. - - BtDeviceDialogInputWidget, inherited from HbInputDialog, - implements interface HbDeviceDialogInterface. The Q_Properties - here are interfaces for caller of HbDeviceDialog to configue - what to be shown in the widget. - - */ -class BtDeviceDialogInputWidget : - public QObject, public HbDeviceDialogInterface -{ - Q_OBJECT - -public: - BtDeviceDialogInputWidget(const QVariantMap ¶meters); - - // From base class HbDeviceDialogInterface - virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); - virtual int deviceDialogError() const; - virtual void closeDeviceDialog(bool byClient); - virtual HbDialog *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -signals: - // Required by the framework - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -public slots: - void inputClosed(HbAction *action); - -private: - void processParam(const QVariantMap ¶meters); - bool constructInputDialog(const QVariantMap ¶meters); - void resetProperties(); - -private: - Q_DISABLE_COPY(BtDeviceDialogInputWidget) - - int mLastError; - int mSendAction; - bool mShowEventReceived; - HbInputDialog *mInputDialog; -}; - -#endif // BTDEVICEDIALOGINPUTWIDGET_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#ifndef BTDEVICEDIALOGNOTIFWIDGET_H -#define BTDEVICEDIALOGNOTIFWIDGET_H - -#include - -#include -#include -#include -#include - -/*! - \class BtDeviceDialogNotifWidget - \brief Widget class with properties setting. - - BtDeviceDialogQueryWidget, inherited from HbNotificationDialog, - implements interface HbDeviceDialogInterface. The Q_Properties - here are interfaces for caller of HbDeviceDialog to configue - what to be shown in the widget. - - */ -class BtDeviceDialogNotifWidget : - public QObject, public HbDeviceDialogInterface -{ - Q_OBJECT - -public: - BtDeviceDialogNotifWidget(const QVariantMap ¶meters); - ~BtDeviceDialogNotifWidget(); - - // From base class HbDeviceDialogInterface - virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); - virtual int deviceDialogError() const; - virtual void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -signals: - // Required by the framework - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - - void processParam(const QVariantMap ¶meters); - bool constructNotifDialog(const QVariantMap ¶meters); - void resetProperties(); - -public slots: - void NotifClosed(HbAction *action); - -private: - Q_DISABLE_COPY(BtDeviceDialogNotifWidget) - - int mLastError; - int mSendAction; - bool mShowEventReceived; - HbNotificationDialog* mNotificationDialog; -}; - -#endif // BTDEVICEDIALOGNOTIFWIDGET_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogPlugin class declaration. -* -*/ - - -#ifndef BTDEVICEDIALOGPLUGIN_P_H -#define BTDEVICEDIALOGPLUGIN_P_H - -#include -#include - -#include - -// Forward declarations -class BtDeviceDialogPluginPrivate; -class HbTranslator; - -/*! - \class BtDeviceDialogPlugin - \brief Device dialog widget plugin providing generic input dialog. - - BtDeviceDialogPlugin implements interface HbDeviceDialogPlugin and - creates device dialog widget, which allows user's input. - Currently this plugin implements only one dialog type, identified by - "com.nokia.hb.btdevicedialog/1.0". - - ToDo: create widget base on dialog types when multiple dialog types available. - */ -class BtDeviceDialogPlugin : public HbDeviceDialogPlugin -{ - Q_OBJECT - -public: - friend class BtDeviceDialogPluginPrivate; - - BtDeviceDialogPlugin(); - ~BtDeviceDialogPlugin(); - - // from base HbDeviceDialogPluginInterface - virtual HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, - const QVariantMap ¶meters); - - // from base HbDeviceDialogPlugin - virtual bool accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, const QVariantMap &securityInfo) const; - virtual bool deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, DeviceDialogInfo *info) const; - virtual QStringList deviceDialogTypes() const; - virtual PluginFlags pluginFlags() const; - virtual int error() const; - -private: - HbDeviceDialogInterface *checkDialogType( const QVariantMap ¶meters ); - -private: - Q_DISABLE_COPY(BtDeviceDialogPlugin) - BtDeviceDialogPluginPrivate *d; - HbTranslator* mDialogTranslator; - HbTranslator* mViewTranslator; -}; - -#endif // BTDEVICEDIALOGPLUGIN_P_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogpluginerrors.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogpluginerrors.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Plugin error constants -* -*/ - -#ifndef BTDEVICEDIALOGPLUGINERRORS_H -#define BTDEVICEDIALOGPLUGINERRORS_H - -#include - -// No error -const int NoError = 0; -// Illegal parameter error -const int ParameterError = HbDeviceDialog::PluginErrors + 1; -// Unknown device dialog error -const int UnknownDeviceDialogError = HbDeviceDialog::PluginErrors + 2; - -#endif // BTDEVICEDIALOGPLUGINERRORS_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugintrace.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugintrace.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Tracing macros -* -*/ - -#ifndef BTDEVICEDIALOGPLUGINTRACE_H -#define BTDEVICEDIALOGPLUGINTRACE_H - -#include // QDebug -#include // qDebug() - - -#ifdef ENABLE_TRACE_OUTPUT - #define INSTALL_MESSAGE_HANDLER HbDeviceDialogMessageHandler::installMessageHandler(QString(TRACE_OUTPUT_FILE), TRACE_OUTPUT_FILE_REQUIRED); - #define UNINSTALL_MESSAGE_HANDLER HbDeviceDialogMessageHandler::uninstallMessageHandler(); - #define TRACE_UNUSED(name) - #define TRACE_STATIC_ENTRY qDebug() << __PRETTY_FUNCTION__ << "entry"; - #define TRACE_STATIC_ENTRY_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "entry," << args; - #define TRACE_ENTRY qDebug() << __PRETTY_FUNCTION__ << "this" << (void *)this << "entry"; - #define TRACE_ENTRY_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "this" << (void *)this << "entry," << args; - #define TRACE_EXIT qDebug() << __PRETTY_FUNCTION__ << "exit"; - #define TRACE_EXIT_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "exit," << args; - #define TRACE(args) qDebug() << __PRETTY_FUNCTION__ << args; -#else - #define INSTALL_MESSAGE_HANDLER - #define UNINSTALL_MESSAGE_HANDLER - #define TRACE_UNUSED(name) Q_UNUSED(name) - #define TRACE_STATIC_ENTRY - #define TRACE_STATIC_ENTRY_ARGS(args) - #define TRACE_ENTRY - #define TRACE_ENTRY_ARGS(args) - #define TRACE_EXIT - #define TRACE_EXIT_ARGS(args) - #define TRACE(args) -#endif // ENABLE_TRACE_OUTPUT - -#endif // BTDEVICEDIALOGPLUGINTRACE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogquerywidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogquerywidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#ifndef BTDEVICEDIALOGQUERYWIDGET_H -#define BTDEVICEDIALOGQUERYWIDGET_H - -#include - -#include -#include -#include - -/*! - \class BtDeviceDialogQueryWidget - \brief Widget class with properties setting. - - BtDeviceDialogQueryWidget, inherited from HbMessageBox, - implements interface HbDeviceDialogInterface. The Q_Properties - here are interfaces for caller of HbDeviceDialog to configue - what to be shown in the widget. - - */ -class BtDeviceDialogQueryWidget : - public QObject, public HbDeviceDialogInterface -{ - Q_OBJECT - -public: - BtDeviceDialogQueryWidget(HbMessageBox::MessageBoxType type, const QVariantMap ¶meters); - - // From base class HbDeviceDialogInterface - virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); - virtual int deviceDialogError() const; - virtual void closeDeviceDialog(bool byClient); - virtual HbDialog *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -signals: - // Required by the framework - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -public slots: - void messageBoxClosed(HbAction*); - -private: - void processParam(const QVariantMap ¶meters); - bool constructQueryDialog(const QVariantMap ¶meters); - void resetProperties(); - -private: - Q_DISABLE_COPY(BtDeviceDialogQueryWidget) - - int mLastError; - int mSendAction; - bool mShowEventReceived; - - HbMessageBox *mMessageBox; -}; - -#endif // BTDEVICEDIALOGQUERYWIDGET_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#ifndef BTDEVICEDIALOGRECVQUERYWIDGET_H -#define BTDEVICEDIALOGRECVQUERYWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class BTRecvQueryDialogWidget : public QObject, - public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTRecvQueryDialogWidget(const QVariantMap ¶meters); - ~BTRecvQueryDialogWidget(); - -public: // from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: - void yesClicked(); - void noClicked(); - void checkBoxStateChanged(bool checked); - -private: - bool constructDialog(const QVariantMap ¶meters); - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - HbDocumentLoader *mLoader; - QStandardItemModel *mContentItemModel; - HbLabel *mHeading; - HbLabel *mDeviceName; - HbLabel *mDeviceType; - HbLabel *mDeviceIcon; - HbAction *mYes; - HbAction *mNo; - HbCheckBox *mCheckBox; - HbDialog *mDialog; - - Q_DISABLE_COPY(BTRecvQueryDialogWidget) - }; - -#endif /* BTDEVICEDIALOGRECVQUERYWIDGET_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogutils.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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 BTDEVICESDIALOGUTILS_H -#define BTDEVICESDIALOGUTILS_H - -#include -#include -#include - -// A data item in this model DLL. For example, power state item consists -// of the information regarding the current Bluetooth power state. -typedef QMap< int, QVariant > BtSendDataItem; - -// A category of the model data for specific group -typedef QList< BtSendDataItem > BtSendDataSource; - - -Q_DECLARE_METATYPE(BtSendDataItem) -Q_DECLARE_METATYPE(BtSendDataSource) - -enum DevDataRole { - NameAliasRole = Qt::DisplayRole, // QVariant::String, the name showing in UI - ReadableBdaddrRole = Qt::UserRole, // QString, the readable format of a BD_ADDR (BT Device address) - MajorPropertyRole, // QVariant::Int, bits of DevMajorProperty - MinorPropertyRole, // QVariant::Int, bits of DevMinorProperty - CoDRole, // QVariant::Int, the value of Class of Device - DeviceTypeRole //QVairant::Int, the value of Device Type -}; - - -inline void setMajorProperty( - BtSendDataItem& qtdev, int prop, bool addto) -{ - if ( addto ) { - qtdev[MajorPropertyRole] = - QVariant( qtdev[MajorPropertyRole].toInt() | prop); - } - else { - qtdev[MajorPropertyRole] = - QVariant( qtdev[MajorPropertyRole].toInt() & ~prop); - } -} - - -#endif /*BTDEVICESDIALOGUTILS_H*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#ifndef BTDEVICESEARCHDIALOGWIDGET_H -#define BTDEVICESEARCHDIALOGWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "btdevicedialogutils.h" - - - -/*struct device - { - QString mDeviceName; - QString mDeviceType; - int mDeviceIdx; - };*/ - - -class BTDeviceSearchDialogWidget : public QObject, - public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTDeviceSearchDialogWidget(const QVariantMap ¶meters); - ~BTDeviceSearchDialogWidget(); - -public: // from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: - void stopRetryClicked(); - void retryClicked(); - void viewByClicked(); - void deviceSelected(const QModelIndex& modelIndex); -// void viewByItemSelected(int index); - void selectionDialogClosed(HbAction *action); - void searchDialogClosed(); - -private: - bool constructDialog(const QVariantMap ¶meters); - -private: - enum devTypeSelectionList { - BtUiDevAudioDevice = 0, - BtUiDevComputer, - BtUiDevInputDevice, - BtUiDevPhone, - BtUiDevOtherDevice - }; - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - HbDocumentLoader *mLoader; - - /** - * - * item model for content list view. - */ - - QStandardItemModel* mContentItemModel; - - HbSelectionDialog *mQuery; -// QList mDeviceTypeList; - QStringList mDevTypeList; -// QList mDeviceList; - HbListView* mListView; - HbLabel* mSearchLabel; - HbLabel* mSearchIconLabel; - HbLabel* mSearchDoneLabel; -// bool mViewByChosen; -// QList mDeviceLstOfType; -// int mDeviceLstIdx; - int mSelectedDeviceType; -// int mDeviceDialogData; - HbDialog *mSearchDevicesDialog; - HbAction *mStopRetryAction; - HbAction *mShowAction; - HbAction *mCancelAction; - - int mStopRetryFlag; - - BtSendDataSource mData; - BtSendDataSource mSelectedData; - - Q_DISABLE_COPY(BTDeviceSearchDialogWidget) - }; - -#endif /* BTDEVICESEARCHDIALOGWIDGET_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#ifndef BTMOREDEVICESDIALOGWIDGET_H -#define BTMOREDEVICESDIALOGWIDGET_H - -#include "btdevicedialogutils.h" -#include -#include -#include -#include -#include -#include -#include -#include - -class BTMoreDevicesDialogWidget : public QObject, public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTMoreDevicesDialogWidget(const QVariantMap ¶meters); - ~BTMoreDevicesDialogWidget(); - -public: // from HbDeviceDialogInterface` - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: - void moreDevicesClicked(); - void cancelClicked(); - void deviceSelected(const QModelIndex& modelIndex); - // void inputClosed(HbAction *action); - -private: - bool constructDialog(const QVariantMap ¶meters); - // void hideEvent(QHideEvent *event); - // void showEvent(QShowEvent *event); - QIcon icon(/*QString deviceType*/); - // void setMajorProperty( -// BtSendDataItem& qtdev, int prop, bool addto); - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - HbDocumentLoader *mLoader; - int mDeviceDialogData; - HbDialog *mMoreDeviceDialog; - HbAction *mMoreAction; - HbAction *mCancelAction; - - /** - * - * item model for content list view. - */ - - QStandardItemModel* mContentItemModel; - - BtSendDataSource mData; - - Q_DISABLE_COPY(BTMoreDevicesDialogWidget) - }; - -#endif /* BTMOREDEVICESDIALOGWIDGET_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#ifndef BTRECVCOMPLETEDDIALOGWIDGET_H_ -#define BTRECVCOMPLETEDDIALOGWIDGET_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class CoversationViewServiceStarter : public QRunnable - { -public: - CoversationViewServiceStarter(qint64 conversationId); - ~CoversationViewServiceStarter(); - void run(); -private: - qint64 mCnvId; - }; - - -class BTRecvcompletedDialogWidget : public QObject, - public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTRecvcompletedDialogWidget(const QVariantMap ¶meters); - ~BTRecvcompletedDialogWidget(); - -public: // from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: - void showClicked(); - void cancelClicked(); - -private: - bool constructDialog(const QVariantMap ¶meters); - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - HbDocumentLoader *mLoader; - QStandardItemModel *mContentItemModel; - HbLabel *mHeading; - HbLabel *mFileName; - HbLabel *mFileSize; - HbLabel *mFileCount; - HbAction *mShow; - HbAction *mCancel; - HbDialog *mDialog; - int mFileSz; - - Q_DISABLE_COPY(BTRecvcompletedDialogWidget) - }; - - - -#endif /* BTRECVCOMPLETEDDIALOGWIDGET_H_ */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - -#ifndef BTRECVPRGRSDIALOGWIDGET_H -#define BTRECVPRGRSDIALOGWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class BTRecvPrgrsDialogWidget : public QObject, - public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTRecvPrgrsDialogWidget(const QVariantMap ¶meters); - ~BTRecvPrgrsDialogWidget(); - -public: // from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: - void hideClicked(); - void cancelClicked(); - -private: - bool constructDialog(const QVariantMap ¶meters); - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - -private: - HbDocumentLoader *mLoader; - QStandardItemModel *mContentItemModel; - HbLabel *mHeading; - HbLabel *mFileName; - HbLabel *mFileSize; - HbLabel *mFileCount; - HbAction *mHide; - HbAction *mCancel; - HbDialog *mDialog; - HbProgressBar *mProgressBar; - int mFileSz; - - Q_DISABLE_COPY(BTRecvPrgrsDialogWidget) - }; - -#endif /* BTRECVPRGRSDIALOGWIDGET_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/inc/btsenddialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btsenddialogwidget.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#ifndef BTSENDDIALOGWIDGET_H -#define BTSENDDIALOGWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class BTSendDialogWidget : public QObject, - public HbDeviceDialogInterface - { - Q_OBJECT - -public: - BTSendDialogWidget(const QVariantMap ¶meters); - ~BTSendDialogWidget(); - -public: // from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbPopup *deviceDialogWidget() const; - virtual QObject *signalSender() const; - -public slots: -// void hideClicked(); - void cancelClicked(); -// void inputClosed(HbAction* action); -private: - bool constructDialog(const QVariantMap ¶meters); - void hideEvent(QHideEvent *event); - void showEvent(QShowEvent *event); - -signals: - void deviceDialogClosed(); - -private: - HbDocumentLoader *mLoader; - // QStandardItemModel* mContentItemModel; - HbProgressBar* mProgressBar; - HbLabel* mDialogHeading; - HbLabel* mFileIconLabel; - HbLabel* mFileNameLabel; - HbLabel* mFileSizeLabel; - -// HbListView* mListView; - HbDialog *mSendDialog; - HbAction *mHideAction; - HbAction *mCancelAction; - int mFileIndex; - - - Q_DISABLE_COPY(BTSendDialogWidget) - }; - -#endif /* BTSENDDIALOGWIDGET_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/rom/btdevicedialogplugin.iby --- a/bluetoothengine/btnotif/btdevicedialogplugin/rom/btdevicedialogplugin.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 btdevicedialogplugin -* -*/ - - -#ifndef BTDEVICEDIALOGPLUGIN_IBY -#define BTDEVICEDIALOGPLUGIN_IBY - -#include - -#ifdef __BT -file=ABI_DIR/BUILD_DIR/btdevicedialogplugin.dll SHARED_LIB_DIR/btdevicedialogplugin.dll -data=/epoc32/data/z/pluginstub/btdevicedialogplugin.qtplugin resource/plugins/devicedialogs/btdevicedialogplugin.qtplugin -#endif // __BT - -#endif // BTDEVICEDIALOGPLUGIN_IBY \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class implementation. -* -*/ - - -#include "btdevicedialoginputwidget.h" -#include "btdevicedialogplugintrace.h" -#include -#include -#include -#include -#include -#include "btdevicedialogpluginerrors.h" - -const int PASSCODE_MAX_LEN = 16; // from BT specs - -/*! - class Constructor - */ -BtDeviceDialogInputWidget::BtDeviceDialogInputWidget( - const QVariantMap ¶meters) -{ - TRACE_ENTRY - // set properties - mLastError = NoError; - mShowEventReceived = false; - mInputDialog = new HbInputDialog(); - - resetProperties(); - constructInputDialog(parameters); - TRACE_EXIT -} - -/*! - Set parameters, implementation of interface - Invoked when HbDeviceDialog::update calls. - */ -bool BtDeviceDialogInputWidget::setDeviceDialogParameters( - const QVariantMap ¶meters) -{ - TRACE_ENTRY - mLastError = NoError; - processParam(parameters); - TRACE_EXIT - return true; -} - -/*! - Get error, implementation of interface - */ -int BtDeviceDialogInputWidget::deviceDialogError() const -{ - TRACE_ENTRY - TRACE_EXIT - return mLastError; -} - -/*! - Close notification, implementation of interface - */ -void BtDeviceDialogInputWidget::closeDeviceDialog(bool byClient) -{ - TRACE_ENTRY - Q_UNUSED(byClient); - // Closed by client or internally by server -> no action to be transmitted. - mSendAction = false; - mInputDialog->close(); - // If show event has been received, close is signalled from hide event. If not, - // hide event does not come and close is signalled from here. - if (!mShowEventReceived) { - emit deviceDialogClosed(); - } - TRACE_EXIT -} - -/*! - Return display widget, implementation of interface - */ -HbDialog *BtDeviceDialogInputWidget::deviceDialogWidget() const -{ - TRACE_ENTRY - TRACE_EXIT - return mInputDialog; -} - -QObject *BtDeviceDialogInputWidget::signalSender() const -{ - return const_cast(this); -} - -/*! - Construct display widget - */ -bool BtDeviceDialogInputWidget::constructInputDialog(const QVariantMap ¶meters) -{ - TRACE_ENTRY - // analyze the parameters to compose the properties of the widget - processParam(parameters); - connect(mInputDialog, SIGNAL(finished(HbAction*)), this, SLOT(inputClosed(HbAction*))); - - TRACE_EXIT - return true; -} - -/*! - Take parameter values and generate relevant property of this widget - */ -void BtDeviceDialogInputWidget::processParam(const QVariantMap ¶meters) -{ - TRACE_ENTRY - - QString keyStr, prompt,title,regExp; - QVariant name; - keyStr.setNum( TBluetoothDialogParams::EResource ); - // Validate if the resource item exists. - QVariantMap::const_iterator i = parameters.constFind( keyStr ); - // item of ResourceId is not found, can't continue. - if ( i == parameters.constEnd() ) { - mLastError = UnknownDeviceDialogError; - return; - } - - QVariant param = parameters.value( keyStr ); - if ( param.toInt() == EPinInput ) { - // Numeric value only - mInputDialog->setInputMode(HbInputDialog::RealInput); - title = QString(hbTrId("txt_bt_title_pairing_with_1")); - // todo: Fixe the multiline problem - prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); - } - else { - mLastError = ParameterError; - return; - } - - // check if minLength of passcode required - keyStr.setNum( TBluetoothDeviceDialog::EAdditionalDesc ); - i = parameters.constFind( keyStr ); - // Mini Length required, update prompt - // ToDo: The validator doesn't seem to work properly - if ( i != parameters.constEnd() ) { - // Todo : The string ID for the localization is not available yet - // for string : "Enter %1 digit passcode for device %2:" - // I'm using the "Enter the passcode for device %1" instead - prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); - param = parameters.value( keyStr ); - regExp = tr("^\\d{%1,}$"); - regExp.arg(param.toString()); - HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); - validator->addField( - new QRegExpValidator( - QRegExp(regExp, Qt::CaseInsensitive), validator ),""); - mInputDialog->setValidator(validator); - }else{ - // Minimum requirement is to have at least 1 digit - regExp = tr("^\\d{1,}$"); - HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); - validator->addField( - new QRegExpValidator( - QRegExp(regExp, Qt::CaseInsensitive), validator ),""); - mInputDialog->setValidator(validator); - } - // replace % with the miniLength and device name - int repls = prompt.count( QString( "%" ) ); - if ( repls > 1 ) { - prompt = prompt.arg( param.toString() ); - } - if ( repls > 0 ) { - name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - } - repls = title.count(QString("%")); - if(repls > 0){ - title = title.arg( name.toString() ); - } - mInputDialog->setHeadingWidget(new HbLabel(title)); - mInputDialog->lineEdit(0)->setMaxLength(PASSCODE_MAX_LEN); - mInputDialog->lineEdit(0)->setText(tr("")); // clear the input field - mInputDialog->setPromptText(prompt); - TRACE_EXIT -} - -/*! - Reset properties to default values - */ -void BtDeviceDialogInputWidget::resetProperties() -{ - TRACE_ENTRY - // set to default values - mInputDialog->setModal(true); - mInputDialog->setTimeout(HbDialog::NoTimeout); - mInputDialog->setDismissPolicy(HbDialog::NoDismiss); - mSendAction = true; - // Todo: clean the Validator - TRACE_EXIT - return; -} - -void BtDeviceDialogInputWidget::inputClosed(HbAction *action) -{ - QVariantMap data; - - HbInputDialog *dlg=static_cast(sender()); - if(dlg->actions().first() == action) { - //Ok - QVariant result( dlg->value().toString().toUtf8() ); - data.insert( QString( "result" ), QVariant(true)); - data.insert( QString( "input" ), result ); - } - else if(dlg->actions().at(1) == action) { - //Cancel - data.insert( QString( "result" ), QVariant(false)); - } - - emit deviceDialogData(data); - emit deviceDialogClosed(); - mSendAction = false; -} - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class implementation. -* -*/ - - -#include "btdevicedialognotifwidget.h" -#include "btdevicedialogplugintrace.h" -#include -#include -#include -#include "btdevicedialogpluginerrors.h" -#include -/*! - class Constructor - */ -BtDeviceDialogNotifWidget::BtDeviceDialogNotifWidget( const QVariantMap ¶meters ) -{ - TRACE_ENTRY - // set properties - mLastError = NoError; - mShowEventReceived = false; - mNotificationDialog = new HbNotificationDialog(); - resetProperties(); - constructNotifDialog(parameters); - TRACE_EXIT -} - -/*! - class Constructor - */ -BtDeviceDialogNotifWidget::~BtDeviceDialogNotifWidget() -{ - TRACE_ENTRY - delete mNotificationDialog; - return; -} - -/*! - Set parameters, implementation of interface - Invoked when HbDeviceDialog::update calls. - */ -bool BtDeviceDialogNotifWidget::setDeviceDialogParameters( - const QVariantMap ¶meters) -{ - TRACE_ENTRY - mLastError = NoError; - processParam(parameters); - TRACE_EXIT - return true; -} - -/*! - Get error, implementation of interface - */ -int BtDeviceDialogNotifWidget::deviceDialogError() const -{ - TRACE_ENTRY - TRACE_EXIT - return mLastError; -} - -/*! - Close notification, implementation of interface - */ -void BtDeviceDialogNotifWidget::closeDeviceDialog(bool byClient) -{ - TRACE_ENTRY - Q_UNUSED(byClient); - // Closed by client or internally by server -> no action to be transmitted. - mSendAction = false; - mNotificationDialog->close(); - // If show event has been received, close is signalled from hide event. If not, - // hide event does not come and close is signalled from here. - if (!mShowEventReceived) { - emit deviceDialogClosed(); - } - TRACE_EXIT -} - -/*! - Return display widget, implementation of interface - */ -HbPopup *BtDeviceDialogNotifWidget::deviceDialogWidget() const -{ - TRACE_ENTRY - TRACE_EXIT - return mNotificationDialog; -} - -QObject* BtDeviceDialogNotifWidget::signalSender() const - { - return const_cast(this); - } - -/*! - Construct display widget - */ -bool BtDeviceDialogNotifWidget::constructNotifDialog(const QVariantMap ¶meters) -{ - TRACE_ENTRY - // analyze the parameters to compose the properties of the message box widget - processParam(parameters); - connect(mNotificationDialog, SIGNAL(finished(HbAction*)), this, SLOT(NotifClosed(HbAction*))); - TRACE_EXIT - return true; -} - -/*! - Take parameter values and generate relevant property of this widget - */ -void BtDeviceDialogNotifWidget::processParam(const QVariantMap ¶meters) -{ - TRACE_ENTRY - QString keyStr, prompt,title; - QVariant classOfDevice; - keyStr.setNum( TBluetoothDialogParams::EResource ); - // Validate if the resource item exists. - QVariantMap::const_iterator i = parameters.constFind( keyStr ); - // item of ResourceId is not found, can't continue. - if ( i == parameters.constEnd() ) { - mLastError = UnknownDeviceDialogError; - return; - } - HbIcon icon; - QVariant param = parameters.value( keyStr ); - int key = param.toInt(); - switch ( key ) { - case EPairingSuccess: - title = QString(hbTrId( "txt_bt_dpophead_paired" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_paired_to_1" ) ); - classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); - icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); - mNotificationDialog->setIcon(icon); - break; - // todo: remove this Unpaired notification if not used - case EUnpairedDevice: - title = QString(hbTrId( "txt_bt_dpophead_unpaired" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_with_1" ) ); - classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); - icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); - mNotificationDialog->setIcon(icon); - break; - case EVisibilityTimeout: - title = QString(hbTrId( "txt_bt_dpophead_bluetooth" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_is_now_hidden" ) ); - mNotificationDialog->setIcon(HbIcon("qtg_large_bluetooth")); - break; - default: - mLastError = ParameterError; - break; - } - int repls = prompt.count( QString( "%" ) ); - if ( repls > 0 ) { - QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - } - mNotificationDialog->setTitle( title ); - mNotificationDialog->setText( prompt ); - TRACE_EXIT -} - -/*! - Reset properties to default values - */ -void BtDeviceDialogNotifWidget::resetProperties() -{ - TRACE_ENTRY - mSendAction = true; - TRACE_EXIT - return; -} - -void BtDeviceDialogNotifWidget::NotifClosed(HbAction *action) -{ - Q_UNUSED(action); - emit deviceDialogClosed(); - mSendAction = false; -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogPlugin class implementation. -* -*/ - - -#include "btdevicedialogplugin.h" -#include "btdevicedialogplugintrace.h" -#include -#include -#include -#include "btdevicedialoginputwidget.h" -#include "btdevicedialogquerywidget.h" -#include "btdevicedialognotifwidget.h" -#include "btrecvprgrsdialogwidget.h" - -#include "btdevicedialogpluginerrors.h" -#include "btdevicesearchdialogwidget.h" -#include "btmoredevicesdialogwidget.h" -#include "btsenddialogwidget.h" -#include "btdevicedialogrecvquerywidget.h" -#include "btrecvcompleteddialogwidget.h" -#include - -Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin) - -const char* BTDIALOG_TRANSLATION = "btdialogs"; -const char* BTVIEW_TRANSLATION = "btviews"; - -// This plugin implements one device dialog type -static const struct { - const char *mTypeString; -} noteInfos[] = { - {"com.nokia.hb.btdevicedialog/1.0"} -}; - -class BtDeviceDialogPluginPrivate -{ -public: - BtDeviceDialogPluginPrivate(); -public: - int mError; -}; -/*! - BtDeviceDialogPluginPrivate Constructor - */ -BtDeviceDialogPluginPrivate::BtDeviceDialogPluginPrivate() -{ - mError = NoError; -} - -/*! - BtDeviceDialogPlugin Constructor - */ -BtDeviceDialogPlugin::BtDeviceDialogPlugin(): - mDialogTranslator(0),mViewTranslator(0) -{ - d = new BtDeviceDialogPluginPrivate; -} - -/*! - Destructor - */ -BtDeviceDialogPlugin::~BtDeviceDialogPlugin() -{ - delete d; - delete mDialogTranslator; - delete mViewTranslator; -} - -/*! - Check if client is allowed to use device dialog widget - */ -bool BtDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, const QVariantMap &securityInfo) const -{ - Q_UNUSED(deviceDialogType) - Q_UNUSED(parameters) - Q_UNUSED(securityInfo) - - // This plugin doesn't perform operations that may compromise security. - // All clients are allowed to use. - return true; -} - -/*! - From interface class. - Use the dialog type in the parameter to create widget. - */ -HbDeviceDialogInterface *BtDeviceDialogPlugin::createDeviceDialog( - const QString &deviceDialogType, const QVariantMap ¶meters) -{ - d->mError = NoError; - - int i; - - if(!mDialogTranslator) - { - mDialogTranslator = new HbTranslator(BTDIALOG_TRANSLATION); - } - if(!mViewTranslator) - { - mViewTranslator = new HbTranslator(BTVIEW_TRANSLATION); - } - // verify that requested dialog type is supported - const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]); - for(i = 0; i < numTypes; i++) { - if (noteInfos[i].mTypeString == deviceDialogType) { - break; - } - } - // dialog type was found - if (i < numTypes) { - return checkDialogType( parameters ); - } - else { - // unknown dialog type, return error - d->mError = UnknownDeviceDialogError; - return 0; - } -} - -/*! - Return information of device dialog the plugin creates - Currently only supporting 1 device dialog type, so no need to check the type. - */ -bool BtDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, DeviceDialogInfo *info) const -{ - Q_UNUSED(parameters) - Q_UNUSED(deviceDialogType) - // set return values - info->group = GenericDeviceDialogGroup; - info->flags = NoDeviceDialogFlags; - info->priority = DefaultPriority; - return true; -} - -/*! - Return device dialog types this plugin implements - Function will work fine (unchanged) when new dialogs are added. - */ -QStringList BtDeviceDialogPlugin::deviceDialogTypes() const -{ - QStringList types; - // read supported types from noteInfos - const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]); - for(int i = 0; i < numTypes; i++) { - types.append(noteInfos[i].mTypeString); - } - return types; -} - -/*! - Return plugin flags - */ -HbDeviceDialogPlugin::PluginFlags BtDeviceDialogPlugin::pluginFlags() const -{ - return NoPluginFlags; -} - -/*! - Return last error - */ -int BtDeviceDialogPlugin::error() const -{ - return d->mError; -} - -/*! - Check the device dialog type to decide which widget to be used. - And create the specified widget. - */ -HbDeviceDialogInterface *BtDeviceDialogPlugin::checkDialogType( const QVariantMap ¶meters ) -{ - // Construct the key of EDialogType - QString keyStr; - keyStr.setNum( TBluetoothDialogParams::EDialogType ); - // Find the const iterator with key EDialogType - QVariantMap::const_iterator i = parameters.constFind( keyStr ); - - // item with key EDialogType is not found - if ( i == parameters.constEnd() ) { - d->mError = UnknownDeviceDialogError; - return NULL; - } - - // item with key EDialogType is found - // generate specified widget based on the dialog type value. - HbDeviceDialogInterface *deviceDialog = NULL; - switch ( i.value().toInt() ) { - case TBluetoothDialogParams::ENote: - deviceDialog = - new BtDeviceDialogNotifWidget(parameters); - break; - case TBluetoothDialogParams::EQuery: - deviceDialog = - new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeWarning,parameters); - break; - case TBluetoothDialogParams::EInput: - deviceDialog = new BtDeviceDialogInputWidget(parameters); - break; - case TBluetoothDialogParams::EMoreDevice: - deviceDialog = new BTMoreDevicesDialogWidget(parameters); - break; - case TBluetoothDialogParams::EDeviceSearch: - deviceDialog = new BTDeviceSearchDialogWidget(parameters); - break; - case TBluetoothDialogParams::ESend: - deviceDialog = new BTSendDialogWidget(parameters); - break; - case TBluetoothDialogParams::EGlobalNotif: - deviceDialog = new BtDeviceDialogNotifWidget(parameters); - break; - case TBluetoothDialogParams::EUserAuthorization: - deviceDialog = new BTRecvQueryDialogWidget(parameters); - break; - case TBluetoothDialogParams::EReceiveProgress: - deviceDialog = new BTRecvPrgrsDialogWidget(parameters); - break; - case TBluetoothDialogParams::EReceiveDone: - deviceDialog = new BTRecvcompletedDialogWidget(parameters); - break; - default: - d->mError = UnknownDeviceDialogError; - break; - } - if ( deviceDialog ) { - // verify no error has occurred - d->mError = deviceDialog->deviceDialogError(); - if ( d->mError ) { - // Do not continue if an error occurred - delete deviceDialog; - deviceDialog = NULL; - } - else { - d->mError = UnknownDeviceDialogError; - } - } - return deviceDialog; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class implementation. -* -*/ - - -#include "btdevicedialogquerywidget.h" -#include "btdevicedialogplugintrace.h" -#include -#include -#include -#include -#include "btdevicedialogpluginerrors.h" - -/*! - class Constructor - */ -BtDeviceDialogQueryWidget::BtDeviceDialogQueryWidget( - HbMessageBox::MessageBoxType type, const QVariantMap ¶meters) -{ - TRACE_ENTRY - // set properties - mLastError = NoError; - mShowEventReceived = false; - mMessageBox = new HbMessageBox(type); - resetProperties(); - constructQueryDialog(parameters); - TRACE_EXIT -} - -/*! - Set parameters, implementation of interface - Invoked when HbDeviceDialog::update calls. - */ -bool BtDeviceDialogQueryWidget::setDeviceDialogParameters( - const QVariantMap ¶meters) -{ - TRACE_ENTRY - mLastError = NoError; - processParam(parameters); - TRACE_EXIT - return true; -} - -/*! - Get error, implementation of interface - */ -int BtDeviceDialogQueryWidget::deviceDialogError() const -{ - TRACE_ENTRY - TRACE_EXIT - return mLastError; -} - -/*! - Close notification, implementation of interface - */ -void BtDeviceDialogQueryWidget::closeDeviceDialog(bool byClient) -{ - TRACE_ENTRY - Q_UNUSED(byClient); - // Closed by client or internally by server -> no action to be transmitted. - mSendAction = false; - mMessageBox->close(); - // If show event has been received, close is signalled from hide event. If not, - // hide event does not come and close is signalled from here. - if (!mShowEventReceived) { - emit deviceDialogClosed(); - } - TRACE_EXIT -} - -/*! - Return display widget, implementation of interface - */ -HbDialog *BtDeviceDialogQueryWidget::deviceDialogWidget() const -{ - TRACE_ENTRY - TRACE_EXIT - return mMessageBox; -} - -QObject *BtDeviceDialogQueryWidget::signalSender() const -{ - return const_cast(this); -} - -/*! - Construct display widget - */ -bool BtDeviceDialogQueryWidget::constructQueryDialog(const QVariantMap ¶meters) -{ - TRACE_ENTRY - // analyze the parameters to compose the properties of the message box widget - processParam(parameters); - - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); - - TRACE_EXIT - return true; -} - -/*! - Take parameter values and generate relevant property of this widget - */ -void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters) -{ - TRACE_ENTRY - QString keyStr, prompt,title; - QVariant name,param,addval; - keyStr.setNum( TBluetoothDialogParams::EResource ); - // Validate if the resource item exists. - QVariantMap::const_iterator i = parameters.constFind( keyStr ); - // item of ResourceId is not found, can't continue. - if ( i == parameters.constEnd() ) { - mLastError = UnknownDeviceDialogError; - return; - } - - param = parameters.value( keyStr ); - int key = param.toInt(); - switch ( key ) { - case ENumericComparison: - prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) ); - break; - case EPasskeyDisplay: - prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) ); - break; - case EPairingFailureRetry: - prompt = QString( hbTrId( "txt_bt_info_pairing_with_1_failed_either_the_pas" ) ); - break; - case EPairingFailureOk: - prompt = QString( hbTrId( "txt_bt_info_unable_to_pair_with_1" ) ); - break; - // Input dialogs - case EPinInput: - case EObexPasskeyInput: - // NULL parameters - case ENoResource: - case EUnusedResource: - default: - mLastError = ParameterError; - break; - } - int repls = prompt.count( QString( "%" ) ); - if ( repls > 0 ) { - name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - if(key != EPairingFailureRetry && key != EPairingFailureOk) - { - addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); - // todo: Formating the prompt need to be discussed with UI designer - // The passcode could be displayed on a separate row if it the label did support - // the use of newline escape character. - prompt.append(tr("\n\n")); // insert 2 newlines for clarity - prompt.append(addval.toString()); - if(key == EPasskeyDisplay) - { - prompt.append("\n"); - } - } - } - // set property value to this dialog widget - if(key != EPairingFailureRetry && key != EPairingFailureOk) - { - title = QString(hbTrId("txt_bt_title_pairing_with_1")); - title = title.arg(name.toString()); - mMessageBox->setHeadingWidget(new HbLabel(title)); - mMessageBox->setIconVisible(false); - mMessageBox->setStandardButtons( HbMessageBox::Yes | HbMessageBox::No); - } - else - { - if(key == EPairingFailureRetry) - { - mMessageBox->setStandardButtons( HbMessageBox::Retry | HbMessageBox::Cancel); - } - else - { - mMessageBox->setStandardButtons( HbMessageBox::Ok); - } - } - mMessageBox->setText( prompt ); - TRACE_EXIT -} - -/*! - Reset properties to default values - */ -void BtDeviceDialogQueryWidget::resetProperties() -{ - TRACE_ENTRY - // set to default values - mMessageBox->setModal(true); - mMessageBox->setTimeout(HbDialog::NoTimeout); - mMessageBox->setDismissPolicy(HbDialog::NoDismiss); - mSendAction = true; - TRACE_EXIT - return; -} - - -void BtDeviceDialogQueryWidget::messageBoxClosed(HbAction* action) -{ - QVariantMap data; - - HbMessageBox *dlg=static_cast(sender()); - if(dlg->actions().first() == action) { - //Yes - data.insert( QString( "result" ), QVariant(true)); - } - else if(dlg->actions().at(1) == action) { - //No - data.insert( QString( "result" ), QVariant(false)); - } - - emit deviceDialogData(data); - emit deviceDialogClosed(); - mSendAction = false; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +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: BtDeviceDialogWidget class declaration. -* -*/ - - -#include "btdevicedialogrecvquerywidget.h" -#include "bluetoothdevicedialogs.h" -#include - -const char* DOCML_BT_RECV_QUERY_DIALOG = ":/docml/bt-receive-auth-dialog.docml"; - - -BTRecvQueryDialogWidget::BTRecvQueryDialogWidget(const QVariantMap ¶meters) -{ - mLoader = 0; - constructDialog(parameters); -} - -BTRecvQueryDialogWidget::~BTRecvQueryDialogWidget() -{ - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } -} - -bool BTRecvQueryDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) -{ - Q_UNUSED(parameters); - return true; -} - -int BTRecvQueryDialogWidget::deviceDialogError() const -{ - return 0; -} - -void BTRecvQueryDialogWidget::closeDeviceDialog(bool byClient) -{ - Q_UNUSED(byClient); - mDialog->close(); -} - -HbPopup* BTRecvQueryDialogWidget::deviceDialogWidget() const -{ - return mDialog; -} - -QObject* BTRecvQueryDialogWidget::signalSender() const -{ - return const_cast(this); -} - -bool BTRecvQueryDialogWidget::constructDialog(const QVariantMap ¶meters) -{ - mLoader = new HbDocumentLoader(); - bool ok = false; - - mLoader->load(DOCML_BT_RECV_QUERY_DIALOG, &ok); - if(ok) - { - mDialog = qobject_cast(mLoader->findWidget("senddialog")); - mHeading = qobject_cast(mLoader->findWidget("heading")); - - mDeviceName = qobject_cast(mLoader->findWidget("deviceName")); - mDeviceType = qobject_cast(mLoader->findWidget("deviceType")); - mDeviceIcon = qobject_cast(mLoader->findWidget("deviceIcon")); - - int classOfDevice = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble(); - HbIcon icon = getBadgedDeviceTypeIcon(classOfDevice); - mDeviceIcon->setIcon(icon); - - mDeviceName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - mDeviceType->setPlainText(getDeviceTypeString(classOfDevice)); - - mYes = qobject_cast(mLoader->findObject("yesaction")); - mNo = qobject_cast(mLoader->findObject("noaction")); - - mCheckBox = qobject_cast(mLoader->findWidget("checkbox")); - - int dialogType = parameters.value(QString::number(TBluetoothDialogParams::EDialogTitle)).toInt(); - switch(dialogType) - { - case TBluetoothDialogParams::EReceive: - { - mHeading->setPlainText(hbTrId("txt_bt_title_receive_messages_from")); - }break; - - case TBluetoothDialogParams::EReceiveFromPairedDevice: - { - mHeading->setPlainText(hbTrId("txt_bt_title_receive_messages_from_paired_device")); - mCheckBox->setCheckState(Qt::Checked); - }break; - - case TBluetoothDialogParams::EConnect: - { - mHeading->setPlainText(hbTrId("txt_bt_title_connect_to")); - mCheckBox->setCheckState(Qt::Checked); - }break; - case TBluetoothDialogParams::EPairingRequest: - mHeading->setPlainText(hbTrId("txt_bt_title_pair_with")); - mCheckBox->setCheckState(Qt::Checked); - break; - default: - break; - - } - mDialog->setHeadingWidget(mHeading); - } - - mDialog->setBackgroundFaded(false); - mDialog->setDismissPolicy(HbPopup::NoDismiss); - mDialog->setTimeout(HbPopup::NoTimeout); - - connect(mYes, SIGNAL(triggered()), this, SLOT(yesClicked())); - connect(mNo, SIGNAL(triggered()), this, SLOT(noClicked())); - connect(mCheckBox, SIGNAL(clicked(bool)), this, SLOT(checkBoxStateChanged(bool))); - - return true; -} - -void BTRecvQueryDialogWidget::yesClicked() -{ - QVariantMap data; - data.insert(QString("actionResult"), QVariant(true)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - -void BTRecvQueryDialogWidget::noClicked() -{ - QVariantMap data; - data.insert(QString("actionResult"), QVariant(false)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - -void BTRecvQueryDialogWidget::checkBoxStateChanged(bool checked) -{ - QVariantMap data; - data.insert(QString("checkBoxState"), QVariant(checked)); - emit deviceDialogData(data); -} - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,445 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#include "btdevicesearchdialogwidget.h" - -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - -const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml"; - - -#define LOC_SEARCHING_DEVICE hbTrId("txt_bt_subhead_searching") -#define LOC_SEARCH_DONE hbTrId("txt_bt_subhead_search_done") -#define LOC_SEARCH_STOP hbTrId("txt_common_button_stop") -#define LOC_SEARCH_RETRY hbTrId("txt_common_button_retry") - - -BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap ¶meters) - { -// mDeviceLstIdx = 0; -// mViewByChosen = false; - mSelectedDeviceType = 0; - // mDeviceDialogData = 0; - mLoader = 0; - mContentItemModel = 0; - mStopRetryFlag = 0; // Stop - mQuery = 0; - mSelectedDeviceType |= (BtuiDevProperty::AVDev | BtuiDevProperty::Computer | - BtuiDevProperty::Phone | BtuiDevProperty::Peripheral | - BtuiDevProperty::LANAccessDev | BtuiDevProperty::Toy | - BtuiDevProperty::WearableDev | BtuiDevProperty::ImagingDev | - BtuiDevProperty::HealthDev | BtuiDevProperty::UncategorizedDev); - constructDialog(parameters); - } - -BTDeviceSearchDialogWidget::~BTDeviceSearchDialogWidget() - { - delete mLoader; - delete mContentItemModel; - if ( mQuery ) { - delete mQuery; - } - - // delete mRbl; - // delete mViewByDialog; - } - -bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) - { - if(parameters.keys().at(0).compare("Search Completed")==0) - { - mStopRetryFlag = 1; // Retry - mSearchLabel->hide(); - - mSearchIconLabel->hide(); - - mSearchDoneLabel->show(); - mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); - mSearchDoneLabel->setAlignment(Qt::AlignLeft); - mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); - - mStopRetryAction->setText(LOC_SEARCH_RETRY); - } - else - { - double cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble(); - int uiMajorDevice; - int uiMinorDevice; - - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - - BtSendDataItem devData; - devData[NameAliasRole] = QVariant(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - devData[ReadableBdaddrRole] = QVariant(parameters.value(QString::number(TBluetoothDialogParams::EAddress)).toString()); - devData[CoDRole] = QVariant(cod); - devData[DeviceTypeRole] = QVariant(uiMajorDevice); - setMajorProperty(devData,BtuiDevProperty::Bonded, - parameters.value("Bonded").toBool()); - setMajorProperty(devData,BtuiDevProperty::Blocked, - parameters.value("Blocked").toBool()); - setMajorProperty(devData,BtuiDevProperty::Trusted, - parameters.value("Trusted").toBool()); - setMajorProperty(devData,BtuiDevProperty::Connected, - parameters.value("Connected").toBool()); - mData.append(devData); - - if(mSelectedDeviceType & devData[DeviceTypeRole].toInt()) - { - QStandardItem* listitem = new QStandardItem(); - QStringList info; - info.append(devData[NameAliasRole].toString()); - listitem->setData(info, Qt::DisplayRole); - HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toDouble(), - devData[MajorPropertyRole].toInt(), - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); - listitem->setIcon(icon.qicon()); - mContentItemModel->appendRow(listitem); - mSelectedData.append(devData); - } - } - - return true; - } - -int BTDeviceSearchDialogWidget::deviceDialogError() const - { - return 0; - } - -void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient) - { - Q_UNUSED(byClient); - mSearchDevicesDialog->close(); - //@ TODO to check below code is required which is written based on the documentation of closeDeviceDialog API - - /* QVariantMap val; - QVariant index(-1); - val.insert("selectedindex",index); - emit deviceDialogData(val); - emit deviceDialogClosed();*/ - } - -HbPopup* BTDeviceSearchDialogWidget::deviceDialogWidget() const - { - return mSearchDevicesDialog; - } - -QObject* BTDeviceSearchDialogWidget::signalSender() const - { - return const_cast(this); - } - -bool BTDeviceSearchDialogWidget::constructDialog(const QVariantMap ¶meters) - { - (void) parameters; - bool ok = false; - - mLoader = new HbDocumentLoader(); - mLoader->load(DOCML_BTDEV_SEARCH_DIALOG, &ok); - if(ok) - { - mSearchDevicesDialog = qobject_cast(mLoader->findWidget("searchdialog")); - - /* HbLabel* heading = qobject_cast(mLoader->findWidget("heading")); - heading->setTextWrapping(Hb::TextWordWrap); - heading->setAlignment(Qt::AlignHCenter); - heading->setPlainText("Bluetooth - Found devices"); - setHeadingWidget(heading);*/ - - mSearchLabel = qobject_cast(mLoader->findWidget("searchLabel")); - mSearchLabel->setTextWrapping(Hb::TextWordWrap); - mSearchLabel->setAlignment(Qt::AlignHCenter); - mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE); - - mSearchIconLabel = qobject_cast(mLoader->findWidget("iconLabel")); - mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg"))); - - mSearchDoneLabel = qobject_cast(mLoader->findWidget("searchDoneLabel")); - mSearchDoneLabel->hide(); - - - mSearchDevicesDialog->setFrameType(HbDialog::Strong); - mSearchDevicesDialog->setBackgroundFaded(false); - - // mViewByBtn = qobject_cast(mLoader->findWidget("viewby")); - // mStopRetryBtn = qobject_cast(mLoader->findWidget("stop")); - - mListView = qobject_cast(mLoader->findWidget("listView")); - mListView->setSelectionMode(HbAbstractItemView::SingleSelection); - - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel);//, prototype); - - connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - // connect(mStopRetryBtn, SIGNAL(clicked()), this, SLOT(stopRetryClicked())); - // connect(mViewByBtn, SIGNAL(clicked()), this, SLOT(viewByClicked())); - - mShowAction = static_cast( mLoader->findObject( "viewaction" ) ); - mShowAction->disconnect(mSearchDevicesDialog); - - mStopRetryAction = static_cast( mLoader->findObject( "stopretryaction" ) ); - mStopRetryAction->disconnect(mSearchDevicesDialog); - -// mCancelAction = static_cast( mLoader->findObject( "cancelaction" ) ); -// mCancelAction->disconnect(mSearchDevicesDialog); - - connect(mShowAction, SIGNAL(triggered()), this, SLOT(viewByClicked())); - connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked())); - - connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed())); - -// QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - //setContentWidget(widget); - } - mSearchDevicesDialog->setBackgroundFaded(false); - mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss); - mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); - mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose); - - mDevTypeList << hbTrId("txt_bt_list_audio_devices") - << hbTrId("txt_bt_list_computers") - << hbTrId("txt_bt_list_input_devices") - << hbTrId("txt_bt_list_phones") - << hbTrId("txt_bt_list_other_devices"); - - /* mViewByDialog = new HbDialog(); - mRbl = new HbRadioButtonList(mViewByDialog); - connect(mRbl, SIGNAL(itemSelected(int)), this, SLOT(viewByItemSelected(int)));*/ - - return true; - } - - -void BTDeviceSearchDialogWidget::stopRetryClicked() - { - QVariantMap val; - if(mStopRetryFlag == 1)//mStopRetryAction->text().compare(LOC_SEARCH_RETRY)==0 - { - mStopRetryFlag = 0; // Stop - QVariant index("Retry"); - val.insert("Retry",index); - emit deviceDialogData(val); - delete mContentItemModel; - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel); - mStopRetryAction->setText(LOC_SEARCH_STOP); - - mSearchLabel->setTextWrapping(Hb::TextWordWrap); - mSearchLabel->setAlignment(Qt::AlignHCenter); - mSearchLabel->setPlainText(LOC_SEARCHING_DEVICE); - - mSearchIconLabel->setIcon(QIcon(QString(":/icons/qtg_large_bluetooth.svg"))); - mSearchLabel->show(); - - mSearchIconLabel->show(); - - mSearchDoneLabel->hide(); - } - else - { - mStopRetryFlag = 1; //Retry - mStopRetryAction->setText(LOC_SEARCH_RETRY); - - mSearchLabel->hide(); - - mSearchIconLabel->hide(); - - mSearchDoneLabel->show(); - mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); - mSearchDoneLabel->setAlignment(Qt::AlignLeft); - mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); - - QVariantMap val; - QVariant index("Stop"); - val.insert("Stop",index); - emit deviceDialogData(val); - } - } - -void BTDeviceSearchDialogWidget::retryClicked() - { - QVariantMap val; - QVariant index("Retry"); - val.insert("Retry",index); - emit deviceDialogData(val); - delete mContentItemModel; - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel); - - - } - -void BTDeviceSearchDialogWidget::viewByClicked() - { - - if ( !mQuery ) { - mQuery = new HbSelectionDialog; - mQuery->setStringItems(mDevTypeList, 0); - mQuery->setSelectionMode(HbAbstractItemView::MultiSelection); - - QList current; - current.append(QVariant(0)); - mQuery->setSelectedItems(current); - - //todo need to check whether the dialog is destroyed without setting this flag - //if not destoryed then set this flag in the destructor and then delete it - -// mQuery->setAttribute(Qt::WA_DeleteOnClose); - // Set the heading for the dialog. - HbLabel *headingLabel = new HbLabel(hbTrId("txt_bt_title_show"), mQuery); - mQuery->setHeadingWidget(headingLabel); - } - mQuery->open(this,SLOT(selectionDialogClosed(HbAction*))); - - - } - -void BTDeviceSearchDialogWidget::searchDialogClosed() - { - QVariantMap val; - QVariant index(-1); - val.insert("selectedindex",index); - emit deviceDialogData(val); - emit deviceDialogClosed(); - } - -void BTDeviceSearchDialogWidget::selectionDialogClosed(HbAction* action) - { - Q_UNUSED(action); - - disconnect( mQuery ); - int devTypesWanted = 0; - - if (action == mQuery->actions().first()) { // user pressed "Ok" - // Get selected items. - QList selections; - selections = mQuery->selectedItems(); - - for (int i=0; i < selections.count(); i++) { - switch (selections.at(i).toInt()) { - case BtUiDevAudioDevice: - devTypesWanted |= BtuiDevProperty::AVDev; - break; - case BtUiDevComputer: - devTypesWanted |= BtuiDevProperty::Computer; - break; - case BtUiDevInputDevice: - devTypesWanted |= BtuiDevProperty::Peripheral; - break; - case BtUiDevPhone: - devTypesWanted |= BtuiDevProperty::Phone; - break; - case BtUiDevOtherDevice: - devTypesWanted |= (BtuiDevProperty::LANAccessDev | - BtuiDevProperty::Toy | - BtuiDevProperty::WearableDev | - BtuiDevProperty::ImagingDev | - BtuiDevProperty::HealthDev | - BtuiDevProperty::UncategorizedDev); - break; - default: - // should never get here - break; - } - } - } - else - { - devTypesWanted = mSelectedDeviceType; - } - - - - /* HbSelectionDialog *dlg = (HbSelectionDialog*)(sender()); - if(dlg->actions().first() == action) { - - } - else if(dlg->actions().at(1) == action) { - }*/ - - if((devTypesWanted != mSelectedDeviceType) &&(devTypesWanted !=0)) - { - mSelectedDeviceType = devTypesWanted; -// mViewByChosen = true; - delete mContentItemModel; - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel); - mSelectedData.clear(); - for(int i=0;isetData(info, Qt::DisplayRole); - HbIcon icon = getBadgedDeviceTypeIcon(qtdev[CoDRole].toDouble(), - qtdev[MajorPropertyRole].toInt(), - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); - listitem->setIcon(icon.qicon()); - mContentItemModel->appendRow(listitem); - mSelectedData.append(qtdev); - } - } - } - } - -void BTDeviceSearchDialogWidget::deviceSelected(const QModelIndex& modelIndex) - { - int row = 0; - - /* if(mViewByChosen) - { - row = mDeviceLstOfType[modelIndex.row()].mDeviceIdx; - } - - else*/ - { - row = modelIndex.row(); - } - - QVariantMap val; -// QVariant index(row); -// val.insert("selectedindex",index); - - const BtSendDataItem& qtdev = mSelectedData.at(row); - val.insert("selectedindex",QVariant(row)); - val.insert("devicename",QVariant(qtdev[NameAliasRole])); - val.insert("deviceaddress",QVariant(qtdev[ReadableBdaddrRole])); - val.insert("deviceclass",QVariant(qtdev[CoDRole])); - - emit deviceDialogData(val); -// mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog - //emit deviceDialogClosed(); - // this->close(); - } - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "btmoredevicesdialogwidget.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -const char* DOCML_BT_MORE_DEV_DIALOG = ":/docml/bt-more-devices-dialog.docml"; - - -BTMoreDevicesDialogWidget::BTMoreDevicesDialogWidget(const QVariantMap ¶meters) - { - mDeviceDialogData = 0; - mLoader = 0; - mContentItemModel = 0; - constructDialog(parameters); -/* try - { - //May throws badAlloc on exception - constructDialog(parameters); - } - catch(std::bad_alloc &badAlloc) - { - //Failure to allocate memory - Q_UNUSED(badAlloc); - // = UnknownDeviceDialogError; - }*/ - } - -BTMoreDevicesDialogWidget::~BTMoreDevicesDialogWidget() - { - delete mLoader; - delete mContentItemModel; - } - -bool BTMoreDevicesDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) - { - double cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble(); - int uiMajorDevice; - int uiMinorDevice; - - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) ) - { - BtSendDataItem devData; - devData[NameAliasRole] = QVariant(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - devData[ReadableBdaddrRole] = QVariant(parameters.value(QString::number(TBluetoothDialogParams::EAddress)).toString()); - devData[CoDRole] = QVariant(cod); - - setMajorProperty(devData,BtuiDevProperty::Bonded, - parameters.value("Bonded").toBool()); - setMajorProperty(devData,BtuiDevProperty::Blocked, - parameters.value("Blocked").toBool()); - setMajorProperty(devData,BtuiDevProperty::Trusted, - parameters.value("Trusted").toBool()); - setMajorProperty(devData,BtuiDevProperty::Connected, - parameters.value("Connected").toBool()); - mData.append(devData); - - QStandardItem* listitem = new QStandardItem(); - QStringList info; - info.append(devData[NameAliasRole].toString()); - - listitem->setData(info, Qt::DisplayRole); - HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toDouble(), - devData[MajorPropertyRole].toInt(), - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); - listitem->setIcon(icon.qicon()); - // listitem->setIcon(icon(parameters.value("deviceType").toString())); - - mContentItemModel->appendRow(listitem); - } - return true; - } - - - - -int BTMoreDevicesDialogWidget::deviceDialogError() const - { - return 0; - } - -void BTMoreDevicesDialogWidget::closeDeviceDialog(bool byClient) - { - Q_UNUSED(byClient); - // below code is required and written based on the documentation of closeDeviceDialog API - mMoreDeviceDialog->close(); - QVariantMap val; - QVariant index(-1); - val.insert("selectedindex",index); - emit deviceDialogData(val); - //below signal is emitted to make dialog server aware that our dialog is closed - emit deviceDialogClosed(); - } - -HbPopup* BTMoreDevicesDialogWidget::deviceDialogWidget() const - { - return mMoreDeviceDialog; - } - -QObject* BTMoreDevicesDialogWidget::signalSender() const - { - return const_cast(this); - } - -bool BTMoreDevicesDialogWidget::constructDialog(const QVariantMap &/*parameters*/) - { - mLoader = new HbDocumentLoader(); - bool ok = false; - - mLoader->load(DOCML_BT_MORE_DEV_DIALOG, &ok); - if(ok) - { - mMoreDeviceDialog = qobject_cast(mLoader->findWidget("lastuseddialog")); - mMoreDeviceDialog->setFrameType(HbDialog::Strong); - mMoreDeviceDialog->setBackgroundFaded(false); -/* HbLabel* label = qobject_cast(mLoader->findWidget("label")); - if(label) - { - label->setTextWrapping(Hb::TextWordWrap); - label->setPlainText("Send to:"); - } - this->setHeadingWidget(label);*/ - // HbPushButton* moreDevices = qobject_cast(mLoader->findWidget("moreDevices")); - // HbPushButton* cancel = qobject_cast(mLoader->findWidget("cancel")); - - HbListView* listView = qobject_cast(mLoader->findWidget("listView")); - listView->setSelectionMode(HbAbstractItemView::SingleSelection); - - mContentItemModel = new QStandardItemModel(this); - listView->setModel(mContentItemModel);//, prototype); - - // QList values = parameters.values(); - - /* for(int i=0;i < values.count();i++) - { - QStandardItem* listitem = new QStandardItem(); - // parameters. - // QString string = values.at(i).toString(); - - listitem->setData(values.at(i).toString(), Qt::DisplayRole); - // listitem->setData(QString("search"), Qt::DisplayRole); - //Todo - Insert icons based on the device class - QIcon icon(QString(":/qgn_prop_sml_bt.svg")); - listitem->setIcon(icon); - - mContentItemModel->appendRow(listitem); - }*/ - - connect(listView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - // connect(moreDevices, SIGNAL(clicked()), this, SLOT(moreDevicesClicked())); - // connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked())); - mMoreAction = static_cast( mLoader->findObject( "moreaction" ) ); - mMoreAction->disconnect(mMoreDeviceDialog); - - mCancelAction = static_cast( mLoader->findObject( "cancelaction" ) ); - mCancelAction->disconnect(mMoreDeviceDialog); -// QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - // mMoreDeviceDialog->setContentWidget(widget); - - connect(mMoreAction, SIGNAL(triggered()), this, SLOT(moreDevicesClicked())); - connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - } - - - mMoreDeviceDialog->setBackgroundFaded(false); - mMoreDeviceDialog->setDismissPolicy(HbPopup::NoDismiss); - mMoreDeviceDialog->setTimeout(HbPopup::NoTimeout); - mMoreDeviceDialog->setAttribute(Qt::WA_DeleteOnClose); - return true; - } - -/*void BTMoreDevicesDialogWidget::hideEvent(QHideEvent *event) - { - //HbDialog::hideEvent(event); - mMoreDeviceDialog->hideEvent(event); -// if(mDeviceDialogData == 0) - { - QVariantMap val; - QVariant index(-1); - val.insert("selectedindex",index); - emit deviceDialogData(val); - emit deviceDialogClosed(); - }*/ - // - // } - -/*void BTMoreDevicesDialogWidget::showEvent(QShowEvent *event) - { - //HbDialog::showEvent(event); - }*/ - -void BTMoreDevicesDialogWidget::moreDevicesClicked() - { - QVariantMap val; - QVariant index("MoreDevices"); - val.insert("MoreDevices",index); - emit deviceDialogData(val); - // mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog - // this->close(); - // TODO - } - -void BTMoreDevicesDialogWidget::cancelClicked() - { - // TODO - mMoreDeviceDialog->close(); - QVariantMap val; - QVariant index(-1); - val.insert("selectedindex",index); - emit deviceDialogData(val); - emit deviceDialogClosed(); - } - -void BTMoreDevicesDialogWidget::deviceSelected(const QModelIndex& modelIndex) - { - int row = modelIndex.row(); - QVariantMap val; -// QVariant index(row); - const BtSendDataItem& qtdev = mData.at(row); - val.insert("selectedindex",QVariant(row)); - val.insert("devicename",QVariant(qtdev[NameAliasRole])); - val.insert("deviceaddress",QVariant(qtdev[ReadableBdaddrRole])); - val.insert("deviceclass",QVariant(qtdev[CoDRole])); - emit deviceDialogData(val); - // mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog - // this->close(); - - } - -QIcon BTMoreDevicesDialogWidget::icon(/*QString deviceType*/) - { - /* if(deviceType == "Audio") - { - return (QIcon(QString(":/qgn_prop_bt_audio.svg"))); - } - else if(deviceType == "Car-kit") - { - return (QIcon(QString(":/qgn_prop_bt_car_kit.svg"))); - } - else if(deviceType == "Computer") - { - return (QIcon(QString(":/qgn_prop_bt_computer.svg"))); - } - else if(deviceType == "Headset") - { - return (QIcon(QString(":/qgn_prop_bt_headset.svg"))); - } - else if(deviceType == "Keyboard") - { - return (QIcon(QString(":/qgn_prop_bt_keyboard.svg"))); - } - else if(deviceType == "Mouse") - { - return (QIcon(QString(":/qgn_prop_bt_mouse.svg"))); - } - else if(deviceType == "Phone") - { - return (QIcon(QString(":/qgn_prop_bt_phone.svg"))); - } - else if(deviceType == "Printer") - { - return (QIcon(QString(":/qgn_prop_bt_printer.svg"))); - } - else - { - return (QIcon(QString(":/qgn_prop_bt_unknown.svg"))); - }*/ - return QIcon(QString(":/icons/qtg_large_bluetooth.svg")); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BTRecvcompletedDialogWidget class declaration. -* -*/ - -#include -#include -#include -#include "btrecvcompleteddialogwidget.h" -#include "bluetoothdevicedialogs.h" - -const char* DOCML_BT_RECV_CMPLTD_DIALOG = ":/docml/bt-receive-done-dialog.docml"; -const qint64 KBluetoothMsgsConversationId = 0x01; - - -CoversationViewServiceStarter::CoversationViewServiceStarter(qint64 conversationId) -:mCnvId(conversationId) - { - - } - -CoversationViewServiceStarter::~CoversationViewServiceStarter() - { - - } - -void CoversationViewServiceStarter::run() - { - QList args; - QString serviceName("com.nokia.services.hbserviceprovider"); - QString operation("open(qint64)"); - XQAiwRequest* request; - XQApplicationManager appManager; - request = appManager.create(serviceName, "conversationview", operation, false); // not embedded - if ( request == NULL ) - { - return; - } - args << QVariant(mCnvId); - request->setArguments(args); - request->send(); - delete request; - } - - -BTRecvcompletedDialogWidget::BTRecvcompletedDialogWidget(const QVariantMap ¶meters) -{ - mLoader = 0; - constructDialog(parameters); -} - -BTRecvcompletedDialogWidget::~BTRecvcompletedDialogWidget() -{ - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } -} - -bool BTRecvcompletedDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) -{ - return true; -} - -int BTRecvcompletedDialogWidget::deviceDialogError() const -{ - return 0; -} - -void BTRecvcompletedDialogWidget::closeDeviceDialog(bool byClient) -{ - Q_UNUSED(byClient); - mDialog->close(); -} - -HbPopup* BTRecvcompletedDialogWidget::deviceDialogWidget() const -{ - return mDialog; -} - -QObject* BTRecvcompletedDialogWidget::signalSender() const -{ - return const_cast(this); -} - -bool BTRecvcompletedDialogWidget::constructDialog(const QVariantMap ¶meters) -{ - mLoader = new HbDocumentLoader(); - bool ok = false; - - mLoader->load(DOCML_BT_RECV_CMPLTD_DIALOG, &ok); - if(ok) - { - mDialog = qobject_cast(mLoader->findWidget("recvCompleteddialog")); - mHeading = qobject_cast(mLoader->findWidget("heading")); - - mFileName = qobject_cast(mLoader->findWidget("fileName")); - mFileSize = qobject_cast(mLoader->findWidget("fileSize")); - mFileCount = qobject_cast(mLoader->findWidget("fileCount_label")); - mFileCount->setVisible(false); - - //TODO - set icon based on the file icon. - - mShow = qobject_cast(mLoader->findObject("showaction")); - mCancel = qobject_cast(mLoader->findObject("cancelaction")); - - QString headingStr(hbTrId("txt_bt_title_received_from_1")); - QString senderName(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - mHeading->setPlainText(headingStr.arg(senderName)); - mDialog->setHeadingWidget(mHeading); - - mFileName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileName)).toString()); - - mFileSz = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileSize)).toInt(); - - //Format the file size into a more readable format - if ( mFileSz >> 20 ) // size in MB - { - float sizeInMB = 0; - sizeInMB = ((float)mFileSz ) / (1024*1024); - QString fileSzMb; - fileSzMb.setNum(sizeInMB); - //TODO - check for localization - fileSzMb.append(QString(" Mb")); - mFileSize->setPlainText(fileSzMb); - } - - else if( mFileSz >> 10 ) // size in KB - { - TInt64 sizeInKB = 0; - sizeInKB = mFileSz >> 10; - QString fileSzKb; - fileSzKb.setNum(sizeInKB); - //TODO - check for localization - fileSzKb.append(QString(" Kb")); - mFileSize->setPlainText(fileSzKb); - } - - else // size is unknown or less than 1K - { - QString fileSzB; - fileSzB.setNum(mFileSz); - //TODO - check for localization - fileSzB.append(QString(" Bytes")); - mFileSize->setPlainText(fileSzB); - } - - //Set the received file count - int fCnt = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivedFileCount)).toInt(); - if(fCnt > 1) - { - mFileCount->setVisible(true); - - QString fCntStr(hbTrId("txt_bt_info_ln_other_files_received", (fCnt-1))); - mFileCount->setPlainText(fCntStr); - } - } - - mDialog->setBackgroundFaded(false); - mDialog->setDismissPolicy(HbPopup::NoDismiss); - mDialog->setTimeout(HbPopup::NoTimeout); - - connect(mShow, SIGNAL(triggered()), this, SLOT(showClicked())); - connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - return true; -} - -void BTRecvcompletedDialogWidget::showClicked() -{ - CoversationViewServiceStarter* service = new CoversationViewServiceStarter(KBluetoothMsgsConversationId); - service->setAutoDelete(true); - - QThreadPool::globalInstance()->start(service); - - QVariantMap data; - data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::EShow)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - -void BTRecvcompletedDialogWidget::cancelClicked() -{ - QVariantMap data; - data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::ECancelShow)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BtDeviceDialogWidget class declaration. -* -*/ - - -#include "btrecvprgrsdialogwidget.h" -#include "bluetoothdevicedialogs.h" - -const char* DOCML_BT_RECV_PRGRS_DIALOG = ":/docml/bt-recv-progress-dialog.docml"; - - -BTRecvPrgrsDialogWidget::BTRecvPrgrsDialogWidget(const QVariantMap ¶meters) -{ - mLoader = 0; - constructDialog(parameters); -} - -BTRecvPrgrsDialogWidget::~BTRecvPrgrsDialogWidget() -{ - if(mLoader) - { - delete mLoader; - mLoader = NULL; - } -} - -bool BTRecvPrgrsDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) -{ - mProgressBar->setMinimum(0); - mProgressBar->setMaximum(mFileSz); - mProgressBar->setProgressValue(parameters.value("progress").toInt()); - return true; -} - -int BTRecvPrgrsDialogWidget::deviceDialogError() const -{ - return 0; -} - -void BTRecvPrgrsDialogWidget::closeDeviceDialog(bool byClient) -{ - Q_UNUSED(byClient); - mDialog->close(); -} - -HbPopup* BTRecvPrgrsDialogWidget::deviceDialogWidget() const -{ - return mDialog; -} - -QObject* BTRecvPrgrsDialogWidget::signalSender() const -{ - return const_cast(this); -} - -bool BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap ¶meters) -{ - mLoader = new HbDocumentLoader(); - bool ok = false; - - mLoader->load(DOCML_BT_RECV_PRGRS_DIALOG, &ok); - if(ok) - { - mDialog = qobject_cast(mLoader->findWidget("senddialog")); - mHeading = qobject_cast(mLoader->findWidget("heading")); - - mFileName = qobject_cast(mLoader->findWidget("fileName")); - mFileSize = qobject_cast(mLoader->findWidget("fileSize")); - mFileCount = qobject_cast(mLoader->findWidget("fileCount_label")); - mFileCount->setVisible(false); - - //TODO - set icon based on the file icon. - - mHide = qobject_cast(mLoader->findObject("hideaction")); - mCancel = qobject_cast(mLoader->findObject("cancelaction")); - - mProgressBar = qobject_cast(mLoader->findWidget("horizontalProgressBar")); - - int dialogType = parameters.value(QString::number(TBluetoothDialogParams::EDialogTitle)).toInt(); - switch(dialogType) - { - case TBluetoothDialogParams::EReceive: - { - QString headingStr(hbTrId("txt_bt_title_receiving_files_from_1")); - QString senderName(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - mHeading->setPlainText(headingStr.arg(senderName)); - }break; - - default: - break; - } - mDialog->setHeadingWidget(mHeading); - - mFileName->setPlainText(parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileName)).toString()); - - mFileSz = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivingFileSize)).toInt(); - mProgressBar->setMinimum(0); - mProgressBar->setMaximum(mFileSz); - mProgressBar->setProgressValue(0); - - //Format the file size into a more readable format - if ( mFileSz >> 20 ) // size in MB - { - float sizeInMB = 0; - sizeInMB = ((float)mFileSz ) / (1024*1024); - QString fileSzMb; - fileSzMb.setNum(sizeInMB); - //TODO - check for localization - fileSzMb.append(QString(" Mb")); - mFileSize->setPlainText(fileSzMb); - } - - else if( mFileSz >> 10 ) // size in KB - { - TInt64 sizeInKB = 0; - sizeInKB = mFileSz >> 10; - QString fileSzKb; - fileSzKb.setNum(sizeInKB); - //TODO - check for localization - fileSzKb.append(QString(" Kb")); - mFileSize->setPlainText(fileSzKb); - } - - else // size is unknown or less than 1K - { - QString fileSzB; - fileSzB.setNum(mFileSz); - //TODO - check for localization - fileSzB.append(QString(" Bytes")); - mFileSize->setPlainText(fileSzB); - } - - //Set the received file count - int fCnt = parameters.value(QString::number(TBluetoothDeviceDialog::EReceivedFileCount)).toInt(); - if(fCnt > 0) - { - mFileCount->setVisible(true); - - QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received", fCnt)); - mFileCount->setPlainText(fCntStr); - } - } - - mDialog->setBackgroundFaded(false); - mDialog->setDismissPolicy(HbPopup::NoDismiss); - mDialog->setTimeout(HbPopup::NoTimeout); - - connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked())); - connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - return true; -} - -void BTRecvPrgrsDialogWidget::hideClicked() -{ - QVariantMap data; - data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::EHide)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - -void BTRecvPrgrsDialogWidget::cancelClicked() -{ - QVariantMap data; - data.insert(QString("actionResult"), QVariant(TBluetoothDialogParams::ECancelReceive)); - emit deviceDialogData(data); - emit deviceDialogClosed(); -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "btsenddialogwidget.h" -#include -#include -#include -#include -#include -#include - - -#define LOC_SENDING_FILES_TO_DEVICE hbTrId("txt_bt_title_sending_file_l1l2_to_3") - -const char* DOCML_BT_SEND_DIALOG = ":/docml/bt-send-dialog.docml"; - -BTSendDialogWidget::BTSendDialogWidget(const QVariantMap ¶meters) - { - mLoader = 0; - constructDialog(parameters); - } - -BTSendDialogWidget::~BTSendDialogWidget() - { - delete mLoader; - /* if(mContentItemModel) - { - delete mContentItemModel; - mContentItemModel = NULL; - }*/ - } - -bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) - { - if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) - { - mDialogHeading->setTextWrapping(Hb::TextWordWrap); - mDialogHeading->setAlignment(Qt::AlignHCenter); - //Todo - replace this with the actual text from parameters - - QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) - .arg(parameters.value("totalFilesCnt").toInt()) - .arg(parameters.value("destinationName").toString()); - /* headLabel.append(QString("Sending file ")); - headLabel.append(parameters.value("currentFileIdx").toString()); - headLabel.append('/'); - headLabel.append(parameters.value("totalFilesCnt").toString()); - headLabel.append(QString(" to ")); - headLabel.append(parameters.value("destinationName").toString());*/ - mDialogHeading->setPlainText(headLabel); - - /* QStringList info; - info.append(parameters.value("fileName").toString()); - info.append(parameters.value("fileSzTxt").toString()); - - QStandardItem* listitem = new QStandardItem(); - // parameters. - listitem->setData(info, Qt::DisplayRole); - - //Todo - Insert file icons here thumbnail icon - QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); - listitem->setIcon(icon); - - delete mContentItemModel; - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel);//, prototype); - - mContentItemModel->appendRow(listitem);*/ - //Todo - Insert file icons here thumbnail icon - QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); - mFileIconLabel->setIcon(icon); - mFileNameLabel->setPlainText(parameters.value("fileName").toString()); - mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); - mProgressBar->setMinimum(0); - mProgressBar->setProgressValue(0); - mProgressBar->setMaximum(parameters.value("fileSz").toInt()); - mFileIndex = parameters.value("currentFileIdx").toString().toInt(); - } - else - { - mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); - } - return true; - } - -int BTSendDialogWidget::deviceDialogError() const - { - return 0; - } - -void BTSendDialogWidget::closeDeviceDialog(bool byClient) - { - Q_UNUSED(byClient); - mSendDialog->close(); -// below redundant call is required because of the api documentation. - emit deviceDialogClosed(); - } - -HbPopup* BTSendDialogWidget::deviceDialogWidget() const - { - return mSendDialog; - } - -QObject *BTSendDialogWidget::signalSender() const -{ - return const_cast(this); -} - -bool BTSendDialogWidget::constructDialog(const QVariantMap&/*parameters*/) - { - mLoader = new HbDocumentLoader(); - bool ok = false; - - mLoader->load(DOCML_BT_SEND_DIALOG, &ok); - if(ok) - { - mSendDialog = qobject_cast(mLoader->findWidget("senddialog")); - mDialogHeading = qobject_cast(mLoader->findWidget("heading")); - mFileIconLabel = qobject_cast(mLoader->findWidget("fileiconlabel")); - mFileNameLabel = qobject_cast(mLoader->findWidget("filenamelabel")); - mFileSizeLabel = qobject_cast(mLoader->findWidget("filesizelabel")); - // mSendDialog->setHeadingWidget(mLabel); - /* mListView = qobject_cast(mLoader->findWidget("listView")); - if(mListView) - { - mContentItemModel = new QStandardItemModel(this); - mListView->setModel(mContentItemModel);//, prototype); - }*/ - - mProgressBar = qobject_cast(mLoader->findWidget("horizontalProgressBar")); - - // HbAction* hide = new HbAction("Hide"); - // HbAction* cancel = new HbAction("Cancel"); - - // this->addAction(hide); - // this->addAction(cancel); - - // QGraphicsWidget *widget = mLoader->findWidget(QString("container")); - // this->setContentWidget(widget); - } - - mSendDialog->setBackgroundFaded(false); - mSendDialog->setDismissPolicy(HbPopup::NoDismiss); - mSendDialog->setTimeout(HbPopup::NoTimeout); - mSendDialog->setAttribute(Qt::WA_DeleteOnClose); - - mHideAction = static_cast( mLoader->findObject( "hideaction" ) ); - mHideAction->disconnect(mSendDialog); - - mCancelAction = static_cast( mLoader->findObject( "cancelaction" ) ); - mCancelAction->disconnect(mSendDialog); - - connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - return true; - } - -/*void BTSendDialogWidget::hideEvent(QHideEvent *event) - { - HbDialog::hideEvent(event); - emit deviceDialogClosed(); - } - -void BTSendDialogWidget::showEvent(QShowEvent *event) - { - HbDialog::showEvent(event); - }*/ - -/*void BTSendDialogWidget::hideClicked() - { - // TODO - this->close(); - emit deviceDialogClosed(); - }*/ - -void BTSendDialogWidget::cancelClicked() - { - mSendDialog->close(); - emit deviceDialogClosed(); - } - -/*void BTSendDialogWidget::inputClosed(HbAction* action) - { - QVariantMap data; - - HbDialog *dlg=static_cast(sender()); - if(dlg->actions().first() == action) { - } - else if(dlg->actions().at(1) == action) { - } - }*/ - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/bwins/btnotifclientu.def --- a/bluetoothengine/btnotif/btnotifclient/bwins/btnotifclientu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ??0RBTNotifier@@QAE@XZ @ 1 NONAME ; RBTNotifier::RBTNotifier(void) - ?CancelNotifier@RBTNotifier@@QAEHVTUid@@@Z @ 2 NONAME ; int RBTNotifier::CancelNotifier(class TUid) - ?Connect@RBTNotifier@@QAEHXZ @ 3 NONAME ; int RBTNotifier::Connect(void) - ?StartNotifier@RBTNotifier@@QAEHVTUid@@ABVTDesC8@@@Z @ 4 NONAME ; int RBTNotifier::StartNotifier(class TUid, class TDesC8 const &) - ?StartNotifierAndGetResponse@RBTNotifier@@QAEXAAVTRequestStatus@@VTUid@@ABVTDesC8@@AAVTDes8@@@Z @ 5 NONAME ; void RBTNotifier::StartNotifierAndGetResponse(class TRequestStatus &, class TUid, class TDesC8 const &, class TDes8 &) - ?UpdateNotifier@RBTNotifier@@QAEHVTUid@@ABVTDesC8@@AAVTDes8@@@Z @ 6 NONAME ; int RBTNotifier::UpdateNotifier(class TUid, class TDesC8 const &, class TDes8 &) - ?Version@RBTNotifier@@QAE?AVTVersion@@XZ @ 7 NONAME ; class TVersion RBTNotifier::Version(void) - ?CancelPairDevice@RBTNotifier@@QAEXXZ @ 8 NONAME ; void RBTNotifier::CancelPairDevice(void) - ?PairDevice@RBTNotifier@@QAEXABV?$TPckgBuf@VTBTDevAddr@@@@JAAVTRequestStatus@@@Z @ 9 NONAME ; void RBTNotifier::PairDevice(class TPckgBuf const &, long, class TRequestStatus &) - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/eabi/btnotifclientu.def --- a/bluetoothengine/btnotif/btnotifclient/eabi/btnotifclientu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -EXPORTS - _ZN11RBTNotifier13StartNotifierE4TUidRK6TDesC8 @ 1 NONAME - _ZN11RBTNotifier14CancelNotifierE4TUid @ 2 NONAME - _ZN11RBTNotifier14UpdateNotifierE4TUidRK6TDesC8R5TDes8 @ 3 NONAME - _ZN11RBTNotifier27StartNotifierAndGetResponseER14TRequestStatus4TUidRK6TDesC8R5TDes8 @ 4 NONAME - _ZN11RBTNotifier7ConnectEv @ 5 NONAME - _ZN11RBTNotifier7VersionEv @ 6 NONAME - _ZN11RBTNotifierC1Ev @ 7 NONAME - _ZN11RBTNotifierC2Ev @ 8 NONAME - _ZN11RBTNotifier10PairDeviceERK8TPckgBufI10TBTDevAddrElR14TRequestStatus @ 9 NONAME - _ZN11RBTNotifier16CancelPairDeviceEv @ 10 NONAME - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/group/bld.inf --- a/bluetoothengine/btnotif/btnotifclient/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* ============================================================================ -* Name : bld.inf -* Part of : bluetoothengine / bluetoothengine -* Description : Build information file for bluetoothengine subsystem -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1.1 -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/btnotifclient.h |../../../inc/btnotifclient.h -../rom/btnotifclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btnotifclient.iby) -PRJ_MMPFILES - -btnotifclient.mmp - -PRJ_TESTMMPFILES - -../tsrc/btnotifclienttest/group/btnotifclienttest.mmp - -PRJ_TESTEXPORTS diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/group/btnotifclient.mmp --- a/bluetoothengine/btnotif/btnotifclient/group/btnotifclient.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifclient.mmp -* Part of : bluetoothengine / btnotifclient -* Description : Project definition file for project btnotifclient -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include -#include - -TARGET btnotifclient.dll -TARGETTYPE DLL -UID 0x1000008d 0x20026FF6 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE btnotifclient.cpp - -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE ../../inc - -LIBRARY euser.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/inc/btnotifclient.h --- a/bluetoothengine/btnotif/btnotifclient/inc/btnotifclient.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifclient.h -* Part of : bluetoothengine / btnotifclient -* Description : Session class for client-server interaction with btnotifserver. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef RBTNOTIFCLIENT_H -#define RBTNOTIFCLIENT_H - -#include -#include - -/** - * A handle to a session with the Bluetooth notifier server for showing - * Bluetooth-related notifications to the user. - * - * ?more_complete_description - * @code - * ?good_class_usage_example(s) - * @endcode - * - * @lib ?library - * @since Symbian^4 - */ -NONSHARABLE_CLASS( RBTNotifier ) : public RSessionBase - { -public: - - /** - * Constructor. - * - * @since Symbian^4 - */ - IMPORT_C RBTNotifier(); - - /** - * Connect to the Bluetooth notifier server. - * - * @since Symbian^4 - * @return KErrNone, if successful. Otherwise one of - * the system-wide error codes. - */ - IMPORT_C TInt Connect(); - - /** - * Get the version information about the client. - * - * @since Symbian^4 - * @return The version of the client-server interface implemented by this client. - */ - IMPORT_C TVersion Version(); - - /** - * Requests the extended notifier server to start the notifier - * identified by the specified UID. The request is synchronous; - * the call returns when the request is complete. - * - * @since Symbian^4 - * @param aNotifierUid The UID identifying the notifier. This is - * the same UID as used with RNotifier for the same purpose. - * @param aBuffer Data that can be passed to the notifier; the format and - * meaning of this depends on the notifier. - * @return KErrNone, if successful; KErrNotFound, if there - * is no notifier matching the specified UID; otherwise - * one of the other system-wide error codes. - */ - IMPORT_C TInt StartNotifier( TUid aNotifierUid, const TDesC8& aBuffer ); - - /** - * Requests the extended notifier server to start the notifier - * identified by the specified UID. This is an asynchronous request. - * - * @since Symbian^4 - * @param aRs The request status. On request completion, contains KErrNone, - * if successful; KErrNotFound, if there is no notifier matching the - * specified UID; KErrCancel, if the notifier was cancelled through - * RBTNotifier::CancelNotifier; otherwise, one of the other system - * wide error codes. - * @param aNotifierUid The UID identifying the notifier. This is - * the same UID as used with RNotifier for the same purpose. - * @param aBuffer Data that can be passed to the notifier; the format and - * meaning of this depends on the notifier. - * @param aResponse Response data from the notifier; the format and meaning - * of this depends on the notifier. - */ - IMPORT_C void StartNotifierAndGetResponse( TRequestStatus& aRs, - TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse ); - - /** - * Requests the Bluetooth notifier server to cancel the notifier - * identified by the specified UID. The request is synchronous; - * the call returns when the request is complete. - * - * @since Symbian^4 - * @param aNotifierUid The UID identifying the notifier. This is - * the same UID as used with RNotifier for the same purpose. - * @return KErrNone, if successful; KErrNotFound, if there - * is no notifier matching the specified UID; otherwise - * one of the other system-wide error codes. - */ - IMPORT_C TInt CancelNotifier( TUid aNotifierUid ); - - /** - * Requests the Bluetooth notifier server to update the active - * notifier identified by the specified UID, with the data supplied. - * The request is synchronous; the call returns when the request is complete. - * - * @since Symbian^4 - * @param aNotifierUid The UID identifying the notifier. This is - * the same UID as used with RNotifier for the same purpose. - * @param aBuffer Data that can be passed to the notifier; the format and - * meaning of this depends on the notifier. - * @param aResponse Response data from the notifier; the format and meaning - * of this depends on the notifier. - * @return KErrNone, if successful; KErrNotFound, if there - * is no notifier matching the specified UID; otherwise - * one of the other system-wide error codes. - */ - IMPORT_C TInt UpdateNotifier( TUid aNotifierUid, - const TDesC8& aBuffer, TDes8& aResponse ); - - /** - * Requests the Bluetooth notifier server to pair with the device - * specified by the given Bluetooth device address. - * The request is asynchronous; Use CancelPairing() to cancel - * an outstanding pairing request. - * - * @since Symbian^4 - * @param aAddr The address of the remote device to perform pairing with. - * @param aDeviceClass the CoD of the remote device. - * @param aStatus The request status. On request completion, contains KErrNone, - * if successful; KErrCancel, if the notifier was cancelled through - * RBTNotifier::CancelPair; otherwise, one of the other system - * wide error codes. - */ - IMPORT_C void PairDevice( const TBTDevAddrPckgBuf& aAddr, TInt32 aDeviceClass, - TRequestStatus& aStatus ); - - /** - * Requests the Bluetooth notifier server to cancel the current pairing - * request. The request is synchronous; - * the call returns when the request is complete. - * - * If this request is issued when the Bluetooth - * notifier server has completed pairing with the device, the pairing - * will not be un-done. That is, the device will not be unpaired. - * - * @since Symbian^4 - */ - IMPORT_C void CancelPairDevice(); - -private: - -private: // data - - /** - * ?description_of_member - */ -// ?type ?member_name; - - }; - -#endif // RBTNOTIFCLIENT_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/rom/btnotifclient.iby --- a/bluetoothengine/btnotif/btnotifclient/rom/btnotifclient.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 BTNOTIFCLIENT_IBY -#define BTNOTIFCLIENT_IBY - -#include - -#ifdef __BT - -file=ABI_DIR/BUILD_DIR/btnotifclient.dll SHARED_LIB_DIR/btnotifclient.dll - -#endif // __BT - -#endif // BTNOTIFCLIENT_IBY diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifclient/src/btnotifclient.cpp --- a/bluetoothengine/btnotif/btnotifclient/src/btnotifclient.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifclient.cpp -* Part of : bluetoothengine / btnotifclient -* Description : Session class for client-server interaction with btnotifserver. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include "btnotifclient.h" -#include "btnotifclientserver.h" - - -// --------------------------------------------------------------------------- -// start btnotif server from client. -// --------------------------------------------------------------------------- -// -TInt StartBTNotifSrv() - { - const TUidType serverUid( KNullUid, KNullUid, KBTNotifServerUid3 ); - // Create a new server process. Simultaneous launching of two processes - // should be detected when the second one attempts to create the server - // object, failing with KErrAlreadyExists. - RProcess server; - TInt err = server.Create( KBTNotifServerName, KNullDesC, serverUid ); - if( err != KErrNone ) - { - return err; - } - TRequestStatus status; - server.Rendezvous( status ); - if( status != KRequestPending ) - { - server.Kill( KErrCancel ); // Abort startup - } - else - { - server.Resume(); - } - User::WaitForRequest( status ); // Wait for start or death - err = status.Int(); - if( server.ExitType() == EExitPanic ) - { - // The server actually panicked; inform the client. - err = KErrDied; - } - server.Close(); - return err; - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -EXPORT_C RBTNotifier::RBTNotifier() -: RSessionBase() - { - } - -// --------------------------------------------------------------------------- -// Return the client-server version number we implement. -// --------------------------------------------------------------------------- -// -EXPORT_C TVersion RBTNotifier::Version() - { - return TVersion( KBTNotifServerVersionMajor, KBTNotifServerVersionMinor, - KBTNotifServerVersionBuild ); - } - - -// --------------------------------------------------------------------------- -// Connect to the notifier server. Start the server if necessary. -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RBTNotifier::Connect() - { - TInt err = CreateSession( KBTNotifServerName, Version() ); - if( err == KErrNotFound || err == KErrServerTerminated ) - { - err = StartBTNotifSrv(); - if( err == KErrNone || err == KErrAlreadyExists ) - { - err = CreateSession( KBTNotifServerName, Version() ); - } - } - return err; - } - - -// --------------------------------------------------------------------------- -// Start the specified notifier, synchronous call. -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RBTNotifier::StartNotifier( TUid aNotifierUid, const TDesC8& aBuffer ) - { - return SendReceive( EBTNotifStartSyncNotifier, - TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer ) ); - } - - -// --------------------------------------------------------------------------- -// Start the specified notifier, asynchronous call. -// --------------------------------------------------------------------------- -// -EXPORT_C void RBTNotifier::StartNotifierAndGetResponse( TRequestStatus& aRs, - TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse ) - { - SendReceive( EBTNotifStartAsyncNotifier, - TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer, &aResponse ), aRs ); - } - - -// --------------------------------------------------------------------------- -// Cancel the specified notifier. -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RBTNotifier::CancelNotifier( TUid aNotifierUid ) - { - return SendReceive( EBTNotifCancelNotifier, TIpcArgs( (TInt) aNotifierUid.iUid ) ); - } - - -// --------------------------------------------------------------------------- -// Update the specified notifier, synchronous call. -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RBTNotifier::UpdateNotifier( TUid aNotifierUid, - const TDesC8& aBuffer, TDes8& aResponse ) - { - return SendReceive( EBTNotifUpdateNotifier, - TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer, &aResponse ) ); - } - -// --------------------------------------------------------------------------- -// Issue a pairing request. asynchronous call. -// --------------------------------------------------------------------------- -// -EXPORT_C void RBTNotifier::PairDevice( const TBTDevAddrPckgBuf& aDevice, - TInt32 aDeviceClass, TRequestStatus& aStatus ) - { - SendReceive( EBTNotifPairDevice, - TIpcArgs( (TInt) EBTNotifPairDevice, &aDevice, aDeviceClass ), aStatus ); - } - -// --------------------------------------------------------------------------- -// Cancel an ongoing pair request. -// --------------------------------------------------------------------------- -// -EXPORT_C void RBTNotifier::CancelPairDevice() - { - (void) SendReceive( EBTNotifCancelPairDevice ); - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/bluetoothnotification.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/bluetoothnotification.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +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: Class for managing an actual user notification or query. -* It hides UI framework-specifics in a private class. -* -*/ - -#ifndef BLUETOOTHNOTIFICATION_H -#define BLUETOOTHNOTIFICATION_H - -#include -#include -#include "bluetoothdevicedialogs.h" -#include "btnotificationresult.h" -#include "bluetoothtrace.h" - -class CBTNotificationManager; -class CHbSymbianVariantMap; - -/** - * CBluetoothNotification manages and controls notifications. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBluetoothNotification ) : public CBase, - public MHbDeviceDialogObserver - { - - -public: - - /** - * Two-phased constructor. - * @param aManager Reference to the notification manager. - * @param aObserver Reference to our observer. - */ - static CBluetoothNotification* NewL( CBTNotificationManager* aManager ); - - /** - * Destructor. - */ - virtual ~CBluetoothNotification(); - - /** - * Sets the receiver of callbacks. - * - * @since Symbian^4 - * @param aObserver Pointer to the callback interface. - */ - inline void SetObserver( MBTNotificationResult* aObserver ) - { iObserver = aObserver; } - - /** - * Clears the receiver of callbacks. - * - * @since Symbian^4 - */ - inline void RemoveObserver() - { iObserver = NULL; } - - /** - * Getter for the notification type. - * - * @since Symbian^4 - * @return Notification type. - */ - inline TBluetoothDialogParams::TBTDialogType NotificationType() - { return iType; } - - /** - * Getter for the resource id. - * - * @since Symbian^4 - * @return Resource identifier. - */ - inline TBTDialogResourceId ResourceId() - { return iResourceId; } - - inline CHbSymbianVariantMap* Data() - { return iNotificationData; } - - /** - * Sets the type of notification (query, note, etc). - * - * @since Symbian^4 - * @param aType The type of the notification. - * @param aResourceId The id of the resource to be shown. - * @return Error code - */ - inline void SetNotificationType( TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ) - { iType = aType; iResourceId = aResourceId; } - - /** - * Sets the data to be shown to the user. - * - * @since Symbian^4 - * @param aType Identifies the type of data parameter to be set. - * @param aData Additional descriptor data to be shown in the dialog. - * @return Error code - */ - TInt SetData( TInt aDataType, const TDesC& aData ); - - /** - * Sets the data to be shown to the user. - * - * @since Symbian^4 - * @param aType Identifies the type of data parameter to be set. - * @param aData Additional integer data to be shown in the dialog. - * @return Error code - */ - TInt SetData( TInt aDataType, TInt aData ); - - /** - * Updates the data to be shown to the user. - * - * @since Symbian^4 - * @param ?arg1 ?description - * @return Error code - */ - TInt Update( const TDesC& aData =KNullDesC ); - - /** - * Show the notification, which means that it - * is added to the queue. - * - * @since Symbian^4 - * @param ?arg1 ?description - * @return Error code - */ - void ShowL(); - - /** - * Stop showing the notification. - * - * @since Symbian^4 - * @param ?arg1 ?description - * @return Error code - */ - TInt Close(); - - -private: - - CBluetoothNotification( CBTNotificationManager* aManager ); - - void ConstructL(); - - /** - * Sets the data to be shown to the user, leaves on error. - * - * @since Symbian^4 - * @param aType Identifies the type of data parameter to be set. - * @param aData Additional descriptor data to be shown in the dialog. - */ - void SetDataL( TInt aType, const TDesC& aData ); - - /** - * Sets the data to be shown to the user, leaves on error. - * - * @since Symbian^4 - * @param aType Identifies the type of data parameter to be set. - * @param aData Additional integer data to be shown in the dialog. - */ - void SetDataL( TInt aType, TInt aData ); - - /** - * From MHbDeviceDialogObserver. - * This callback is called when data is received from a device dialog. - * - * @since Symbian^4 - * @param aData contains data from the dialog plugin. - */ - virtual void DataReceived( CHbSymbianVariantMap& aData ); - - /** - * From MHbDeviceDialogObserver. - * This callback is called when a device dialog is closed. Any data sent by - * the dialog is indicated by the dataReceived() callback. If no observer is - * set in CHbDeviceDialogSymbian::Show the latest data can be retrieved with - * CHbDeviceDialogSymbian::receivedData(). - * - * @since Symbian^4 - * @param aCompletionCode gives the result of the dialog completion. Code can be - * either Symbian error code or device dialog error code. - */ - virtual void DeviceDialogClosed( TInt aCompletionCode ); - -#ifdef BLUETOOTHTRACE_ENABLED - void debugHbSymbianVariantMap( CHbSymbianVariantMap& aData); -#endif // BLUETOOTHTRACE_ENABLED - -private: // data - - /** - * The type of notification currently showing. - */ - TBluetoothDialogParams::TBTDialogType iType; - - /** - * The id of the resource (string identifier) - * of the currently showing notification. - */ - TBTDialogResourceId iResourceId; - - /** - * Reference to the queue manager. - * Not own. - */ - CBTNotificationManager* iManager; - - /** - * Reference to the receiver of the results. - * Not own. - */ - MBTNotificationResult* iObserver; - - /** - * The data to be shown to the user in a device dialog. - * Own. - */ - CHbSymbianVariantMap* iNotificationData; - - /** - * Buffer for receiving return data from the notifier. - */ - CHbSymbianVariantMap* iReturnData; - - /** - * Session object with the notification server. - * Own. - */ - CHbDeviceDialogSymbian *iDialog; - - BTUNITTESTHOOK - - }; - -#endif // BLUETOOTHNOTIFICATION_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifbasepairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifbasepairinghandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +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 BTNOTIFBASEPAIRINGHANDLER_H -#define BTNOTIFBASEPAIRINGHANDLER_H - -#include -#include -#include -#include -#include - -class CBTNotifSecurityManager; - -/** - * Class CBTNotifBasePairingHandler - * - * The base class for pairing handling. - * When the pairing has completed (successfully or unsuccessfully), the user - * is informed of the result - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifBasePairingHandler ) : - public CBase, public MBtSimpleActiveObserver - { -public: - - /** - * Destructor - */ - virtual ~CBTNotifBasePairingHandler(); - - /** - * Handle a pairing result from the pairing server. - * - * @param aAddr the address of the remote device which the result is for. - * @param aResult The status code of the pairing or authentication result. - */ - void HandlePairServerResult( const TBTDevAddr& aAddr, TInt aResult ); - - /** - * Handles event of new paired device event in registry. - * @param aDev the remote device which the pair is with. - */ - void HandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); - - /** - * Start observing the result of the pairing originated by - * the remote device. - * Must be specialized by subclass. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - virtual TInt ObserveIncomingPair( const TBTDevAddr& aAddr ) = 0; - - /** - * Start an outgoing pairing with the remote device. - * Must be specialized by subclass. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - virtual void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) = 0; - - /** - * Cancel the outstanding pairing operation. - */ - virtual void CancelOutgoingPair(); - - /** - * Cancels pairing handling with the specified device - * @param aAddr the address of the device the pairing is with - */ - virtual void StopPairHandling( const TBTDevAddr& aAddr ) = 0; - - /** - * Gets the pin code to be used for pairing a device. - * @param aPin contains the pin code if it is not empty - * @param aAddr the device to which pairing is performed. - * @param the required minimum length of a pin code. - */ - virtual void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); - - /** - * Show a dialog for pairing success or failure - * @param aResult The result of the pairing - */ - void ShowPairingResultNoteL(TInt aResult); - -protected: - - /** - * Handle a pairing result with the remote device which this is for. - * Must be specialized by subclass. - * - * @param aResult The status code of the pairing or authentication result. - */ - virtual void DoHandlePairServerResult( TInt aResult ) = 0; - - /** - * Handles a registry new paired event with the remote - * device with which this handler is dealing. - * Must be specialized by subclass. - * @aType the type of authentication with the device. - */ - virtual void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) = 0; - -protected: - - /** - * C++ default constructor - */ - CBTNotifBasePairingHandler(CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr); - - /** - * Symbian 2nd-phase constructor - */ - void BaseConstructL(); - - /** - * Invalidate the pair result flag of this - */ - void UnSetPairResult(); - - /** - * Sets the pair result and validate pair result flag - */ - void SetPairResult( TInt aResult ); - - /** - * Tells if the pair result has been set. - * @ETrue if the result has been set. - */ - TBool IsPairResultSet(); - -protected: - - /** - * Address of the remote device we are trying to pair. - */ - TBTDevAddr iAddr; - - /** - * Contains the final result of pairing with the remote device - */ - TInt iPairResult; - - /** - * Pair result flag, ETrue if iPairResult is been set. - */ - TBool iPairResultSet; - - /** - * Reference to the owner of this object. - */ - CBTNotifSecurityManager& iParent; - - /** - * Active object helper for asynchronous operations. - * Own. - */ - CBtSimpleActive* iActive; - }; - -#endif /*BTNOTIFBASEPAIRINGHANDLER_H*/ - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +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: Bluetooth connection tracker and manager. -* -*/ - -#ifndef BTNOTIFCONNECTIONTRACKER_H -#define BTNOTIFCONNECTIONTRACKER_H - - -#include -#include -#include -#include "btnotifserver.h" - -class CBTNotificationManager; -class CbtnotifConnectionTrackerTest; -class CBTNotifSecurityManager; - - - -/** - * CBTNotifConnectionTracker keeps track of remote device connections - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifConnectionTracker ) : public CBase - { - -public: - - /** - * Two-phased constructor. - * @param aServer Pointer to our parent - */ - static CBTNotifConnectionTracker* NewL( CBTNotifServer* aServer ); - - /** - * Destructor. - */ - virtual ~CBTNotifConnectionTracker(); - - /** - * Get a pointer to the btnotif server object. - * - * @since Symbian^4 - * @return The server. - */ - inline CBTNotifServer* Server() const - { return iServer; } - - /** - * Get a pointer to the notification manager. - * This handle can be used for queueing notifications. - * - * @since Symbian^4 - * @return The notification manager. - */ - inline CBTNotificationManager* NotificationManager() const - { return iServer->NotificationManager(); } - - /** - * Get the shared handle to BT registry server. - * This handle can be used for creating subsessions. - * - * @since Symbian^4 - * @return Session with BT registry server. - */ - inline RBTRegServ& RegistryServerSession() - { return iBTRegistrySession; } - - /** - * Get the handle to the socket server. - * This handle can be used for creating subsessions. - * - * @since Symbian^4 - * @return Session with the socket server. - */ - inline RSocketServ& SocketServerSession() - { return iSockServ; } - - /** - * Processes a message for notifiers related to remote devices. - * ( These are usually issued by BT stack. However, any application - * is not restricted to do so (e.g., for testing purpose). - * - * @since Symbian^4 - * @param aMessage The message containing the details of the client request. - */ - void HandleNotifierRequestL( const RMessage2& aMessage ); - - /** - * Handle a request related to pairing. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the client request. - */ - void HandleBondingRequestL( const RMessage2& aMessage ); - - /** - * Check repeated connection attempts, and record rejected/accepted queries. - * - * @since Symbian^4 - * @param aDevice The details of the remote device for this query. - * @param aAccepted ETrue if the user accepted the request, EFalse if rejected. - * @return ETrue if the user should be queried for blocking this device, - * EFalse if no query should be launched by the caller. - */ - TBool UpdateBlockingHistoryL( const CBTDevice* aDevice, TBool aAccepted ); - -private: - - CBTNotifConnectionTracker( CBTNotifServer* aServer ); - - void ConstructL(); - - /** - * Record and check the time between connection attempts. - * - * @since Symbian^4 - * @param aAccepted ETrue if the user accepted the request, EFalse if rejected. - * @return EFalse if the attempt followed the previous attempt too fast, - * otherwise ETrue. - */ - TBool RecordConnectionAttempts( TBool aAccepted ); - -private: // data - - /** - * Time of the last denied connection attempt. - */ - TInt64 iLastReject; - - /** - * Array of device addresses that the user has denied access. - */ - RArray iDeniedRequests; - - /** - * Single session with BTRegistry, to be used for subsessions. - */ - RBTRegServ iBTRegistrySession; - - /** - * Single session with the socket server, to be used for subsessions. - */ - RSocketServ iSockServ; - - /** - * Reference to our parent the server class. - * Not own. - */ - CBTNotifServer* iServer; - - /** - * Object for managing the application pairing. - * Own. - */ - CBTNotifSecurityManager* iPairingManager; - - BTUNITTESTHOOK - - }; - -#endif // BTNOTIFCONNECTIONTRACKER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifdeviceselector.h -* Part of : BTProximity / BTProximity -* Description : Class for tracking Bluetooth settings, and also for -* handling notes unrelated to specific connection. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BTNOTIFDEVICESELECTOR_H -#define BTNOTIFDEVICESELECTOR_H - - -#include -#include -#include -#include "bluetoothnotification.h" -#include -#include - -class CBTNotifServer; -class CAdvanceDevDiscoverer; -class CBtDevExtension; - -/** - * ?one_line_short_description - * ?more_complete_description - * - * @code - * ?good_class_usage_example(s) - * @endcode - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -NONSHARABLE_CLASS( CBTNotifDeviceSelector ) : - public CBase, - public MBTNotificationResult, - public MDevDiscoveryObserver, - public MBtDevRepositoryObserver - { - -public: - - /** - * Two-phased constructor. - * @param aServer Pointer to our parent - */ - static CBTNotifDeviceSelector* NewL( CBTNotifServer& aServer ); - - /** - * Destructor. - */ - virtual ~CBTNotifDeviceSelector(); - - /** - * Processes a message from a notifier client related to settings. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the client request. - */ - void DispatchNotifierMessageL( const RMessage2& aMessage ); - - /** - * Cancels an oustanding message from a notifier client related to settings. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the original client request. - */ - void CancelNotifierMessageL( const RMessage2& aMessage ); - -private: -// from base class MBTNotificationResult - - /** - * From MBTNotificationResult. - * Handle an intermediate result from a user query. - * This ffunction is called if the user query passes information - * back before it has finished i.e. is dismissed. The final acceptance/ - * denial of a query is passed back in MBRNotificationClosed. - * - * @since Symbian^4 - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRDataReceived( CHbSymbianVariantMap& aData ); - - /** - * From MBTNotificationResult. - * The notification is finished. The resulting data (e.g. user input or - * acceptance/denial of the query) is passed back here. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ); - - // From MDevDiscoveryObserver - - /** - * Callback to notify that a device has been found. - * - * @param aAddr the inquiry address that contains the inquiry information - * of the found device. - * @param aName the Bluetooth device name of the found device - */ - virtual void HandleNextDiscoveryResultL( - const TInquirySockAddr& aAddr, const TDesC& aName ); - - /** - * Callback to notify that the device search has completed. - * - * @param aErr the error code of device search result. - */ - virtual void HandleDiscoveryCompleted( TInt aErr ); - - - // From MBtDeviceRepositoryObserver - - void RepositoryInitialized(); - - void DeletedFromRegistry( const TBTDevAddr& addr ); - - void AddedToRegistry( const CBtDevExtension& dev ); - - void ChangedInRegistry( const CBtDevExtension& dev, TUint similarity ); - - void ServiceConnectionChanged( - const CBtDevExtension& dev, TBool connected ); - - -private: - - CBTNotifDeviceSelector( CBTNotifServer& aServer ); - - void ConstructL(); - - void PrepareNotificationL( - TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ); - - void LoadUsedDevicesL(); - - void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, const TAny* aData, - CHbSymbianVariant::TType aDataType); - - void setMajorProperty(TInt aMajorProperty, TInt prop, TBool addto); - - TBool isBonded( const CBTDevice &dev ); - - CBtDevExtension* GetDeviceFromRepositoryL( const TBTDevAddr& addr ); - - void SendSelectedDeviceL( CHbSymbianVariantMap& aData ); - -private: // data - - /** - * Reference to our parent the server class. - * Not own. - */ - CBTNotifServer& iServer; - - /** - * Pointer to an outstanding user interaction. - * Not own. - */ - CBluetoothNotification* iNotification; - - /** - * device inquiry handler: - */ - CAdvanceDevDiscoverer* iDiscoverer; - - /** - * own's the elements in the array. - */ - RDevExtensionArray iDevices; - - /** - * The message for a pending device selection request from a RNotifier client. - */ - RMessage2 iMessage; - - TBool iRepositoryInitialized; - - TBool iLoadDevices; - - }; - -#endif // BTNOTIFDEVICESELECTOR_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotificationmanager.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotificationmanager.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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: Class for managing user notification and query objects, -* and for serializing access to the notification server. -* -*/ - -#ifndef BTNOTIFICATIONMANAGER_H -#define BTNOTIFICATIONMANAGER_H - - -#include - -class CBTNotifServer; -class CBluetoothNotification; - -/** - * CBTNotificationManager manages Bt Notifications - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotificationManager ) : public CBase - { - -public: - - /** Enumeration for the priority of the notification. */ - enum TNotificationPriority - { - EPriorityLow, - EPriorityStandard, - EPriorityHigh - }; - - /** - * Two-phased constructor. - * @param aServer Pointer to our parent - */ - static CBTNotificationManager* NewL( const CBTNotifServer* aServer ); - - /** - * Destructor. - */ - virtual ~CBTNotificationManager(); - - CBluetoothNotification* GetNotification(); - - void ReleaseNotification( CBluetoothNotification* aNotification ); - - /** - * Add a notification to the queue of notifications scheduled to be - * shown. Notifications are serialized, to avoid overlapping notes. - * The queue is managed on priority of each notification. - * - * @since Symbian^4 - * @param aNotification The notification to be added. - * @param aPriority The priority of the notification. EPriorityHigh means - * that the note is put to the front of the queue. - * EPriorityStandard means that it is appended to the end, - * and should be used for most notes. EPriorityLow is not - * used yet. - */ - void QueueNotificationL( CBluetoothNotification* aNotification, - TNotificationPriority aPriority = EPriorityStandard ); - -private: - - CBTNotificationManager( const CBTNotifServer* aServer ); - - void ConstructL(); - - /** - * Process the notification queue and launch the next notification. - * - * @since Symbian^4 - */ - void ProcessNotificationQueueL(); - - /** - * Process the notification queue and launch the next notification. - * - * @since Symbian^4 - */ - void CleanupUnusedQueueL(); - - /** - * Create and queue an idle timer if there are no outstanding notifications, - * otherwise cancel the idle timer. - * - * @since Symbian^4 - */ - void CheckIdle(); - -private: // data - - /** - * The queue of notifications to be shown to the user. - */ - RPointerArray iNotificationQ; - - /** - * Pointer to our parent. - * Not own. - */ - const CBTNotifServer* iServer; - - }; - -#endif // BTNOTIFICATIONMANAGER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotificationresult.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotificationresult.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* ============================================================================ -* Name : btnotificationresult.h -* Part of : bluetoothengine / btnotif -* Description : Abstract interface for receiving the result of a user query. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BTNOTIFICATIONRESULT_H -#define BTNOTIFICATIONRESULT_H - -class CHbSymbianVariantMap; - -/** - * MBTNotificationResult returns the result from a user query. - * - * - * @since Symbian^4 - */ -class MBTNotificationResult - { - -public: - - /** - * Handle an intermediate result from a user query. - * This function is called if the user query passes information - * back before it has finished i.e. is dismissed. The final acceptance/ - * denial of a query is passed back in MBRNotificationClosed. - * - * @since Symbian^4 - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRDataReceived( CHbSymbianVariantMap& aData ) = 0; - - - /** - * The notification is finished. The resulting data (e.g. user input or - * acceptance/denial of the query) is passed back here. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ) = 0; - - }; - - -#endif // BTNOTIFICATIONRESULT_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifincomingpairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifincomingpairinghandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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 BTNOTIFINCOMINGPAIRINGHANDLER_H -#define BTNOTIFINCOMINGPAIRINGHANDLER_H - -#include -#include "btnotifBasePairingHandler.h" - -/** - * Class CBTNotifIncomingPairingHandler - * - * Handles an incoming pairing. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifIncomingPairingHandler ) : public CBTNotifBasePairingHandler - { -public: - - /** - * Two-phase constructor - * @param aParent the owner of this observer - * @param aAddr the remote device this observer is targeted to - */ - static CBTNotifBasePairingHandler* NewL( CBTNotifSecurityManager& aParent, - const TBTDevAddr& aAddr); - - /** - * Destructor - */ - ~CBTNotifIncomingPairingHandler(); - - -private: // From CBTNotifBasePairingHandler - - /** - * Start observing the result of pairing which was originated from - * the remote device. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - TInt ObserveIncomingPair( const TBTDevAddr& aAddr ); - - /** - * Start an outgoing pairing with the remote device. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ); - - /** - * Cancels pairing handling with the specified device - * @param aAddr the address of the device the pairing is with - */ - void StopPairHandling( const TBTDevAddr& aAddr ); - - /** - * Handle a pairing result with the remote device which this is for. - * Must be specialized by subclass. - * - * @param aResult The status code of the pairing or authentication result. - */ - void DoHandlePairServerResult( TInt aResult ); - - /** - * Handles event of registry new paired event with the remote - * device this is for. - * @aType the type of authentication with the device. - */ - void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); - -private: // from base class MBtSimpleActiveObserver - - /** - * Callback to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); - -private: - - /** - * C++ default constructor - */ - CBTNotifIncomingPairingHandler(CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * Start monitoring physical link events if it hasn't yet. - * - * @since Symbian^4 - * - */ - void MonitorPhysicalLink(); - - /** - * Opens physical link adaptor with the device. - * - * @since Symbian^4 - * @return KErrNone if the physical link exists. - * - */ - TInt OpenPhysicalLinkAdaptor(); - - /** - * Cancel all outstanding requests. - * - * @since Symbian^4 - */ - void CancelPlaNotification(); - - /** - * Handle a physical link event. - * - * @since Symbian^4 - * @param aResult The status code of the event. - */ - void HandlePhysicalLinkResultL( TInt aResult ); - -private: - - /** - * Package buffer for retrieving physical link events. - */ - TBTBasebandEvent iBbEvent; - - /** - * Subsession with the socket server for - * getting physical link event notifications. - */ - RBTPhysicalLinkAdapter iPla; - - /** - * iPairingOkTimer is activated if the link goes down. - * If it expires it means the pairing process has failed, - * then the error popup will be shown. - * If the pairing process ends correctly, DoHandleRegistryNewPairedEvent - * will be called and it will cancel the timer. - * iActivePairingOk is the active object associated to the timer. - */ - RTimer iPairingOkTimer; - CBtSimpleActive* iActivePairingOk; - TBool iUserAwarePairing; - }; - -#endif /*BTNOTIFINCOMINGPAIRINGHANDLER_H*/ - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifoutgoingpairinghandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,284 +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: Pairing handler for local device initiated pairing -* -*/ - -#ifndef BTNOTIFOUTGOINGPAIRINGHANDLER_H_ -#define BTNOTIFOUTGOINGPAIRINGHANDLER_H_ - -#include -#include -#include -#include "btnotifclientserver.h" -#include "btnotifBasePairingHandler.h" -#include -#include "btnotificationresult.h" -#include "bluetoothdevicedialogs.h" - -class CBluetoothNotification; - -enum TBTOutgoingPairMode - { - /** - * not outgoing pairing operation - */ - EBTOutgoingPairNone = 0, - - /** - * outgoing automatic 0000 pin pairing with headset in progress - */ - EBTOutgoingHeadsetAutoPairing, - - /** - * outgoing manual pairing with headset in progress - */ - EBTOutgoingHeadsetManualPairing, - - /** - * outgoing pairing with non-headset device in progress - */ - EBTOutgoingNoneHeadsetPairing, - }; - -/** - * Perform a outgoing pair with a BT device. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifOutgoingPairingHandler ) : public CBTNotifBasePairingHandler, - public MBTNotificationResult - { - -public: - - /** - * Two-phase constructor - * @param aParent the owner of this object - * @param aAddr the remote device this observer is targeted to - */ - static CBTNotifBasePairingHandler* NewL( CBTNotifSecurityManager& aParent, - const TBTDevAddr& aAddr ); - - /** - * Destructor - */ - ~CBTNotifOutgoingPairingHandler(); - - - // from base class MBTNotificationResult - - /** - * From MBTNotificationResult. - * Handle an intermediate result from a user query. - * This function is called if the user query passes information - * back before it has finished i.e. is dismissed. The final acceptance/ - * denial of a query is passed back in MBRNotificationClosed. - * - * @since Symbian^4 - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRDataReceived( CHbSymbianVariantMap& aData ); - - /** - * From MBTNotificationResult. - * The notification is finished. The resulting data (e.g. user input or - * acceptance/denial of the query) is passed back here. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ); - -private: - - /** - * Start observing the result of pairing which was originated from - * the remote device. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - TInt ObserveIncomingPair( const TBTDevAddr& aAddr ); - - /** - * Start an outgoing pairing with the remote device. - * @param the address of the remote device to be paired - * @return KErrNone if this request is accepted; otherwise an error code - */ - void HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ); - - /** - * Cancel any outstanding pairing operation. - */ - void CancelOutgoingPair(); - - /** - * Gets the pin code to be used for pairing a device. - * @param aPin contains the pin code if it is not empty - * @param aAddr the device to which pairing is performed. - * @param the required minimum length of a pin code. - */ - void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); - - /** - * Cancels pairing handling with the specified device - * @param aAddr the address of the device the pairing is with - */ - void StopPairHandling( const TBTDevAddr& aAddr ); - - /** - * Handle a pairing result with the remote device which this is for. - * Must be specialized by subclass. - * - * @param aResult The status code of the pairing or authentication result. - */ - void DoHandlePairServerResult( TInt aResult ); - - /** - * Handles registry new paired event for the remote - * device this is pairing with. - * @aType the type of authentication with the device. - */ - void DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ); - -private: // from base class MBtSimpleActiveObserver - - /** - * Callback to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - void HandleError( CBtSimpleActive* aActive, TInt aError ); - -private: - /** - * Get a notification and configure it according to the current operation. - * - * @since Symbian^4 - * @param aType The notification type. - * @param aResourceId Identifier for the resource to display. - */ - void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ); - - /** - * Handle the result from a notification that is finished. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData The returned data. The actual format - * is dependent on the actual notifier. - */ - void NotificationClosedL( TInt aError, const TDesC8& aData ); - -private: - - /** - * C++ default constructor - */ - CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr ); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - - /** - * Starts an actual pair operation. - */ - void DoPairingL(); - - /** - * Ask the user to retry pairing. - */ - void ShowPairingRetryDialog(); - - /** - * Tell the user the pairing failed. - */ - void ShowPairingFailureDialog(); - -private: // data - - /** - * Socket address of the remote device to pair with. - */ - TBTSockAddr iSockAddr; - - /** - * The CoD of the device to be paired - */ - TBTDeviceClass iCod; - - /** - * Dedicated bonding session to the pairing server. - */ - RBluetoothDedicatedBondingInitiator iBondingSession; - - /** - * socket for creating L2CAP link with the remote device. - */ - RSocket iSocket; - - /** - * Timer for recovery from Repeated Attempts - */ - RTimer iTimer; - - /** - * the current pairing mode this class is in - */ - TBTOutgoingPairMode iPairMode; - - /** - * Pointer to an outstanding user interaction. - * Not own. - */ - CBluetoothNotification* iNotification; - - /** - * Number of pairing attempt - */ - TInt iPairingAttempt; - - }; - - -#endif /* BTNOTIFOUTGOINGPAIRINGHANDLER_H_ */ - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairnotifier.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairnotifier.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +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 BTNOTIFPAIRNOTIFIER_H -#define BTNOTIFPAIRNOTIFIER_H - -#include -#include -#include -#include "bluetoothdevicedialogs.h" -#include "btnotificationresult.h" -#include "bluetoothtrace.h" - -class CBTNotifSecurityManager; -class CBTNotifConnectionTracker; -class CBluetoothNotification; - -/** - * Helper class for performing user prompt for pairing. - * - * The design of this class is focussed on structure and maintainability first. - * Duplicate (state) information is kept to a minimum. And memory usage comes - * before processing. Pairing is an infrequent operation, and this class is - * only instantiated when there is pairing-related processing, so extreme - * focus on memory or processing efficiency would have relatively little effect. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifPairNotifier ) : public CBase, - public MBTNotificationResult - { - -public: - - /** - * Two-phased constructor. - * @param aConnection Pointer to the parent. - * @param aDevice Pointer to information of the remote device. - * aParam The owner of this object - */ - static CBTNotifPairNotifier* NewL( CBTNotifSecurityManager& aParent ); - - /** - * Destructor. - */ - virtual ~CBTNotifPairNotifier(); - - /** - * Handle a notifier request for pairing with the remote device - * of this connection. - * - * @since Symbian^4 - * @param aMessage The client of this request. - */ - void StartPairingNotifierL( const RMessage2& aMessage ); - - /** - * Update an outstanding request for this connection. - * - * @since Symbian^4 - * @param aUid The UID of the notifier for this update. - * @param aParams The updated parameters for this request from the client. - */ - void UpdatePairingNotifierL( TInt aUid, const TDesC8& aParams ); - - /** - * Cancel an outstanding request for this connection. - * - * @since Symbian^4 - * @param aUid The UID of the notifier for this pairing request. - */ - void CancelPairingNotifierL( TInt aUid ); - -// from base class MBTNotificationResult - - /** - * From MBTNotificationResult. - * Handle an intermediate result from a user query. - * This function is called if the user query passes information - * back before it has finished i.e. is dismissed. The final acceptance/ - * denial of a query is passed back in MBRNotificationClosed. - * - * @since Symbian^4 - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRDataReceived( CHbSymbianVariantMap& aData ); - - /** - * From MBTNotificationResult. - * The notification is finished. The resulting data (e.g. user input or - * acceptance/denial of the query) is passed back here. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ); - -private: - - /** - * C++ default constructor. - */ - CBTNotifPairNotifier( CBTNotifSecurityManager& aParent ); - - /** - * Symbian 2nd-phase constructor. - */ - void ConstructL(); - - void StartPairingUserInputL(); - - /** - * Process the user input and complete the outstanding pairing request. - * - * @since Symbian^4 - * @param aError The result off the notification. - * @param aResult The user response; ETrue if the user accepted the query, - * otherwise EFalse. - * @param aData The data returned from the notification dialog. - */ - void CompletePairingNotifierL( TInt aError, TBool aResult, const TDesC8& aData ); - - /** - * Ask the user to allow incoming pairing. - * - * @since Symbian^4 - */ - void StartAcceptPairingQueryL(); - - /** - * Process the user input and for accepting an incoming pairing and - * continue with the outstanding pairing request. - * - * @since Symbian^4 - * @param aError The result of the notification. - * @param aResult The user response; ETrue if the user accepted the query, - * otherwise EFalse. - */ - void CompleteAcceptPairingQueryL( TInt aError); - - /** - * Parse the parameters of a request for pairing. - * This function also returns values to use for dialog config, and sets - * the operation state member variable (iOperation). - * - * @since Symbian^4 - */ - void ParseNotifierReqParamsL(); - - /** - * Parse the parameters of a request for pairing using pin query. - * - * @since Symbian^4 - * @param aLocallyInitiated On return, will be set to ETrue if the pairing - * was initiated by us. - * @param aMinPinLength On return, this will contain the minimum passcode length. - */ - void ParseLegacyPinCodeReqParamsL( TBool& aLocallyInitiated, - TInt& aMinPinLength, TBTDevAddr& aAddr ); - - /** - * Parse the parameters of a request for pairing using pin query. - * - * @since Symbian^4 - * @param aLocallyInitiated On return, will be set to ETrue if the pairing - * was initiated by us. - * @param aMinPinLength On return, this will contain the minimum passcode length. - */ - void ParsePinCodeReqParamsL( TBool& aLocallyInitiated, TInt& aMinPinLength, - TBTDevAddr& aAddr); - - /** - * Parse the parameters of a request for pairing using numeric comparison. - * - * @since Symbian^4 - * @param aLocallyInitiated On return, will be set to ETrue if the pairing - * was initiated by us. - * @param aNumVal On return, this descriptor will contain the passkey to - * show to the user. - */ - void ParseNumericCompReqParamsL( TBool& aLocallyInitiated, TDes& aNumVal, - TBTDevAddr& aAddr); - - /** - * Parse the parameters of a request for pairing using passkey display. - * - * @since Symbian^4 - * @param aLocallyInitiated On return, will be set to ETrue if the pairing - * was initiated by us. - * @param aNumVal On return, this descriptor will contain the passkey to - * show to the user. - */ - void ParsePasskeyDisplayReqParamsL( TBool& aLocallyInitiated, TDes& aNumVal, - TBTDevAddr& aAddr ); - - /** - * Get a notification and configure it according to the current operation. - * - * @since Symbian^4 - * @param aType The notification type. - * @param aResourceId Identifier for the resource to display. - */ - void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ); - - /** - * Handle the result from a notification that is finished. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData The returned data. The actual format - * is dependent on the actual notifier. - */ - void NotificationClosedL( TInt aError, const TDesC8& aData ); - -private: // data - - enum TNotifierState - { - EIncomingPairingAcceptconfirm, - EPairingInputConfirm, - }; - - CBTNotifSecurityManager& iParent; - - /** - * The client request. - */ - RMessage2 iNotifierMessage; - - /** - * Buffer containing the parameters of the client message. - * Own. - */ - RBuf8 iParams; - - /** - * Pointer to an outstanding user interaction. - * Not own. - */ - CBluetoothNotification* iNotification; - - // will be set to ETrue if the pairing - // was initiated by us. - TBool iLocallyInitiated; - - // contain a number to use in the pairing dialog. - TBuf<8> iDialogNumeric; - - // the dialog type. - TBluetoothDialogParams::TBTDialogType iDialog; - - // the resource id to be loaded to the dialog - TBTDialogResourceId iDialogResource; - - // the address of the device with which the pairing is performed. - TBTDevAddr iRemote; - - // contains the minimum requirements for pin - // code length. -1 indicates this is not PIn code pairing. - TInt iMinPinLength; - - // Contains the device name provided in params - TBTDeviceName iCurrentDeviceName; - - TNotifierState iState; - - // Defines if the check box in the dialog is checked or not. - TBool iCheckBoxState; - - TBool iAcceptPairingResult; - - BTUNITTESTHOOK - - }; - -#endif // BTNOTIFPAIRNOTIFIER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifsecuritymanager.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsecuritymanager.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,413 +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 BTNOTIFSECURITYMANAGER_H -#define BTNOTIFSECURITYMANAGER_H - -#include -#include -#include -#include -#include -#include - -class CBTNotifBasePairingHandler; -class CBTNotifPairNotifier; -class CBTNotifConnectionTracker; -class CBtDevRepository; -class CBTNotifServiceAuthorizer; - -/** - * Class CBTNotifSecurityManager - * - * This class manages pairing with BT devices. - * The responsibility of handling incoming and outgoing pairings is - * delegated to CBTNotifIncomingPairingHandler and CBTNotifOutgoingPairingHandler - * respectively. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifSecurityManager ) : - public CBase, - public MBtSimpleActiveObserver, - public MBtDevRepositoryObserver - { -public: - - /** - * Two-phase constructor - */ - static CBTNotifSecurityManager* NewL( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ); - - /** - * Destructor - */ - ~CBTNotifSecurityManager(); - - /** - * Cancels an outstanding pairing request. - */ - void CancelOutgoingPair(); - - /** - * Process commands relevant to pairing - */ - void HandleBondingRequestL( const RMessage2& aMessage ); - - void HandleNotifierRequestL( const RMessage2& aMessage ); - - /** - * Gets the instance of pairing server. - * @return the server instance. NULL if dedicated bonding is unavailable. - */ - RBluetoothPairingServer* PairingServer(); - - /** - * gets the reference of socket server session - */ - RSocketServ& SocketServ(); - - /** - * gets the reference of devrepository. - */ - CBtDevRepository& BTDevRepository(); - - /** - * gets the reference of connection tracker. - */ - CBTNotifConnectionTracker& ConnectionTracker(); - - /** - * Transfer responsiblity to the specified object. - * @param aPairer the object whose the responsibility is transfered. - */ - void RenewPairingHandler( CBTNotifBasePairingHandler* aPairingHandler ); - - /** - * Be notified when handling of an outgoing pair has been completed. - * @param aErr the result of pairing - * - */ - void OutgoingPairCompleted( TInt aErr ); - - /** - * Be informed that a session will be closed. - * - * @since Symbian^4 - * @param aSession the session to be cloased. - */ - void SessionClosed(CSession2* aSession ); - - /** - * Unpair a device via registry - */ - void UnpairDevice( const TBTDevAddr& aAddr ); - - /** - * Block a device via registry - */ - void BlockDevice( const TBTDevAddr& aAddr , TBool aBanned); - - /** - * Add the bit indicating the device is user-aware Just worked paired to - * UI cookie. - */ - TInt AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ); - - /** - * Update a nameless device in registry - */ - TInt UpdateRegDevice( const TBTNamelessDevice& aDev ); - - /** - * Gets the pin code to be used for pairing a device. - * @param aPin contains the pin code if it is not empty - * @param aAddr the device to which pairing is performed. - * @param the required minimum length of a pin code. - */ - void GetPinCode( TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ); - - /** - * Returns the service (limited to services managed in bteng scope) - * level connection status of the specified device. - * - * @param aAddr the address of the device - * @return one of TBTEngConnectionStatus enums - */ - TBTEngConnectionStatus ConnectStatus( const TBTDevAddr& aAddr ); - - /** - * Activate / deactivate a pair observer - */ - TInt SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate); - - /** - * Trust a device via the registry - */ - void TrustDevice( const TBTDevAddr& aAddr ); - -private: - - // from base class MBtSimpleActiveObserver - - /** - * - * Callback to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aId The ID that identifies the outstanding request. - * @param aStatus The status of the completed request. - */ - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); - - // From base class MBtDevRepositoryObserver - - /** - * Callback to notify that the repository has finished initialization. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - */ - virtual void RepositoryInitialized(); - - /** - * Callback to notify that a device has been deleted from BT registry. - * - * - * @param aAddr the bd_addr of the deleted device - */ - virtual void DeletedFromRegistry( const TBTDevAddr& aAddr ); - - /** - * Callback to notify that the device has been added to BT registry. - * - * @param aDevice the device that has been added to registry - */ - virtual void AddedToRegistry( const CBtDevExtension& aDevice ); - - /** - * Callback to notify that the property of a device in BT registry has been - * changed. - * - * @param aDevice the device that possesses the latest properties. - * @param aSimilarity the similarity of the properties comparing to the ones - * prior to this change. - * Refer CBTDevice::TBTDeviceNameSelector and - * TBTNamelessDevice::TBTDeviceSet for the meanings of the bits - * in this parameter. - */ - virtual void ChangedInRegistry( - const CBtDevExtension& aDevice, TUint aSimilarity ); - - /** - * Callback to notify that the status of service (limited to - * services maintained in btengsrv scope) connections with - * a device has changed. - * - * @param aDevice the device to which the status change refers - * @param aConnected ETrue if at least one service is currently connected. - * EFalse if no service is currently connected. - */ - virtual void ServiceConnectionChanged( - const CBtDevExtension& aDevice, TBool aConnected ); - - -private: - - /** - * C++ default constructor - */ - CBTNotifSecurityManager( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - - /** - * Subscribe local device address for determining - * Bluetooth HW power status - */ - void SubscribeLocalAddress(); - - TBool IsLocalAddressAvailable(); - - /** - * Pair a BT device. - */ - void PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ); - - /** - * Cancel all subscribes to pairng server - */ - void CancelSubscribePairingAuthenticate(); - - /** - * subscribe to receive SSP pairing result from pairing server - */ - void SubscribeSspPairingResult(); - - /** - * Subscribe to receive authentication result from pairing server - */ - void SubscribeAuthenticateResult(); - - /** - * Handle a pairing result from the pairing server. - * - * @since Symbian^4 - * @param aResult The status code of the authentication result. - */ - void HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ); - - /** - * Copy the paired devices to internal array storage. - */ - void UpdatePairedDeviceListL(); - - /** - * Handles a new bonding event from Registry. - */ - void HandleRegistryBondingL( const TBTNamelessDevice& aNameless ); - - -private: - - /** - * Owner of this class. - * Not owned. - */ - CBTNotifConnectionTracker& iParent; - - /** - * Reference to repository. - * Not owned. - */ - CBtDevRepository& iDevRepository; - - /** - * The session with BT registry. - * own. - */ - RBTRegistry iRegistry; - - /** - * contains the list of all paired devices. - */ - RArray iPairedDevices; - - /** - * Session with the pairing server. - * Allocate it in heap to ease the handling for - * situation of unavailable dedicated pairing service. - * - * own. - */ - RBluetoothPairingServer* iPairingServ; - - /** - * Subsession with the pairing server for - * getting the simple pairing result. - * own - */ - RBluetoothPairingResult iPairingResult; - - /** - * Subsession with the pairing server for - * getting the authentication result. - * own - */ - RBluetoothAuthenticationResult iAuthenResult; - - /** - * the address with which a simple pairing has been performed - */ - TBTDevAddr iSimplePairingRemote; - - /** - * the address with which an authentication has been performed - */ - TBTDevAddr iAuthenticateRemote; - - /** - * Active object helper for receiving simple pairing results. - * Own. - */ - CBtSimpleActive* iSSPResultActive; - - /** - * Active object helper for receiving authentication results. - * Own. - */ - CBtSimpleActive* iAuthenResultActive; - - /** - * pairing hanlder at the time. - * Own. - */ - CBTNotifBasePairingHandler* iPairingHandler; - - /** - * The handler for pairing notifiers - */ - CBTNotifPairNotifier* iPairNotifier; - - /** - * Client-server message for power change requests. - */ - RMessage2 iMessage; - - /** - * AO for local address updates. - */ - CBtSimpleActive* iLocalAddrActive; - - /** - * Provides access to the BT local device address. - */ - RProperty iPropertyLocalAddr; - - CBTNotifServiceAuthorizer* iServiceAuthorizer; - }; - -#endif /*BTNOTIFSECURITYMANAGER_H*/ - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifserver.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserver.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +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: Server class for handling commands from clients, and the -* central class in btnotif thread. -* -*/ - -#ifndef BTNOTIFSERVER_H -#define BTNOTIFSERVER_H - - -#include -#include - -#include "bluetoothtrace.h" - -class CBTNotifConnectionTracker; -class CBTNotifSettingsTracker; -class CBTNotificationManager; -class CBTNotifDeviceSelector; -class CBtDevRepository; - -class CbtnotifServerTest; // ToDo: shall be refactored under compile flag? - -/** - * Utility function for panicking the server. - * - * @since Symbian^4 - * @param aReason The panic reason code. - */ -void PanicServer( TInt aReason ); - -/** - * Utility function for panicking the server. - * - * @since Symbian^4 - * @param aMessage The handle to the client side. - * @param aReason The panic reason code. - */ -void PanicClient( const RMessage2& aMessage, TInt aReason ); - -/** BTNotif panic codes */ -enum TBTNotifServerPanic - { - EBTNotifPanicUnknown, - EBTNotifPanicCorrupt, - EBTNotifPanicMissing, - EBTNotifPanicNullMember, - EBTNotifPanicBadState, - EBTNotifPanicBadArgument, - EBTNotifPanicBadResult - }; - -/** Convenience macro for indicating unimplemented events */ -#define NOTIF_NOTIMPL -//{ __ASSERT_ALWAYS( 1, PanicServer( EBTNotifPanicNotImplemented ) ); } -/** Convenience macro for indicating unhandled events */ -#define NOTIF_NOTHANDLED( cond ) -//{ __ASSERT_ALWAYS( cond, PanicServer( EBTNotifPanicNotHandled ) ); } - - -/** - * CBTNotifServer handles notifications and also maintains state information related to - * the local device as well as remote devices. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifServer ) : public CPolicyServer - { - -public: - - /** - * Two-phased constructor. - */ - static CBTNotifServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CBTNotifServer(); - - /** - * Called when the BT power state changes. - * - * @since Symbian^4 - * @param aState The new BT power state. - */ - void HandlePowerStateChangeL( TBTPowerStateValue aState ); - - /** - * Called by a session during creation, to keep track of the number - * of active sessions. - * - * @since Symbian^4 - */ - void AddSession(); - - /** - * Called by a session during destruction, to keep track of the number - * of active sessions. - * - * @since Symbian^4 - */ - void RemoveSession(); - - /** - * Returns a handle to the settings tracker. - * - * @since Symbian^4 - * @param Pointer to the settings tracker. - */ - inline CBTNotifSettingsTracker* SettingsTracker() const - { return iSettingsTracker; } - - /** - * Returns a handle to the connection tracker. - * - * @since Symbian^4 - * @param Pointer to the connection tracker. - */ - inline CBTNotifConnectionTracker* ConnectionTracker() const - { return iConnectionTracker; } - - /** - * Returns a handle to the notification manager. - * - * @since Symbian^4 - * @param Pointer to the notification manager. - */ - inline CBTNotificationManager* NotificationManager() const - { return iNotificationMgr; } - - CBtDevRepository& DevRepository(); - - CBTNotifDeviceSelector& DeviceSelectorL(); - -// from base class CPolicyServer - - /** - * From CPolicyServer. - * Creates and returns a server-side session object. - * - * @since Symbian^4 - * @param aVersion The version information supplied by the client. - * @param aMessage Represents the details of the client request that - * is requesting the creation of the session. - * @return A pointer to the newly created server-side session object. - */ - virtual CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; - -private: - - CBTNotifServer(); - - void ConstructL(); - - /** - * Asynchronous second-phase constructor. This function is called asynchronously - * from ConstructL, to facilitate short initial construction, and allow construction - * of e.g. session to BTEngine. So in fact this is a third-phase constructor. - * - * @since Symbian^4 - */ - void AsyncConstructL(); - - void CheckIdle( TBTPowerStateValue aState ); - - /** - * Callback function for asynchronous construction. - * - * @since Symbian^4 - * @param aPtr Pointer to server instance. - */ - static TInt AsyncConstructCb( TAny* aPtr ); - - static TInt ShutdownTimeout( TAny* aPtr ); - -private: // data - - /** - * Counter for the number of active sessions. - */ - TInt iSessionCount; - - /** - * Helper class for tracking settings. - * Own. - */ - CBTNotifSettingsTracker* iSettingsTracker; - - /** - * Helper class for tracking connections. - * Own. - */ - CBTNotifConnectionTracker* iConnectionTracker; - - /** - * Helper class for managing the actual notifications. - * Own. - */ - CBTNotificationManager* iNotificationMgr; - - /** - * Remote device repository. - * Singleton in btnotifsrv. This is useful - * for getting the correct name for displaying in UI - * without the need getting the device everytime - * when a name is needed. - * Pairing handling also needs this repository to drive - * the logic flow. - */ - CBtDevRepository* iDevRep; - - /** - * Helper class for device searching and selection. - * Own. - */ - CBTNotifDeviceSelector* iDevSelector; - - /** - * Callback for asynchronous processing. - * Own. - */ - CAsyncCallBack* iAsyncCb; - - /** - * Timer for various timeouts. - * Own. - */ - CDeltaTimer* iTimer; - - /** - * The function entry of shutdown timeout. - */ - TDeltaTimerEntry iShutdownTimerEntry; - - BTUNITTESTHOOK - - }; - -#endif // BTNOTIFSERVER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifserversecpolicy.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserversecpolicy.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifserversecpolicy.h -* Part of : bluetoothengine / btnotif *** Info from the SWAD -* Description : Security policy for btnotif client-server interface. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BTNOTIFSRVSECPOLICY_H -#define BTNOTIFSRVSECPOLICY_H - -/** Number of ranges in btnotif security policy */ -const TInt KBTNotifRangeCount = 4; - -/** Ranges of btnotif command opcodes */ -const TInt KBTNotifRanges[ KBTNotifRangeCount ] = - { - 0, // Range 0: 0 - EBTNotifMinValue (Out of range) - 10, // Range 1: All commands requiring no access control - 30, // Range 2: All commands requiring local services - // More ranges may be added here - 50 // Range 3: Out of range - }; - -/** Mapping of ranges to policies */ -const TUint8 KBTNotifElementsIndex[ KBTNotifRangeCount ] = - { - CPolicyServer::ENotSupported, // applies to 0th range (out of range) - CPolicyServer::EAlwaysPass, // no policy for the 1st range - 0, // policy 0 applies to 2nd range - CPolicyServer::ENotSupported // applies to xth range(out of range) - }; - -/** BTEng security policies, applied on a range of commands */ -const CPolicyServer::TPolicyElement KBTNotifPolicyElements[] = - { - { _INIT_SECURITY_POLICY_C1( ECapabilityLocalServices ), - CPolicyServer::EFailClient - } //policy 0, for now on all operations - // More policies may be added here - }; - -/** BTNotif security policy package (combining all the above) */ -const CPolicyServer::TPolicy KBTNotifServerPolicy = - { - CPolicyServer::EAlwaysPass, // Connection attempts may pass - KBTNotifRangeCount, // Number of ranges - KBTNotifRanges, // Array of ranges - KBTNotifElementsIndex, // Mapping of ranges to policies - KBTNotifPolicyElements // Array of policies - }; - -#endif // BTNOTIFSRVSECPOLICY_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifserviceauthorizer.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserviceauthorizer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: class for prompting user to authorize a service -* connection request. -* -*/ - -#ifndef BTNOTIFSERVICEAUTHORIZER_H -#define BTNOTIFSERVICEAUTHORIZER_H - -#include -#include "btnotificationresult.h" -#include "bluetoothdevicedialogs.h" - -class CBTNotifSecurityManager; -class CBluetoothNotification; - - -NONSHARABLE_CLASS(CBTNotifServiceAuthorizer) - : public CBase, public MBTNotificationResult - { -public: - static CBTNotifServiceAuthorizer* NewL(CBTNotifSecurityManager& aParent); - ~CBTNotifServiceAuthorizer(); - -private: - CBTNotifServiceAuthorizer(CBTNotifSecurityManager& aParent); - void ConstructL(); - -public: - void StartNotifierL(const RMessage2& aMessage); - -private: // From MBTNotificationResult - void MBRDataReceived(CHbSymbianVariantMap& aData); - void MBRNotificationClosed(TInt aError, const TDesC8& aData); - -private: - void PrepareNotificationL(TBool& aAutoAuthorize, - TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId, TBool aPaired); - TBool IsExistingConnectionToAudioL(const TBTDevAddr& aDevAddr); - -private: - CBTNotifSecurityManager& iParent; - - /** - * Buffer containing the parameters of the client message. - * Own. - */ - RBuf8 iParams; - - /** - * Pointer to an outstanding user interaction. - * Not owned. - */ - CBluetoothNotification* iNotification; - - // Contains the device name provided in params - TBTDeviceName iCurrentDeviceName; - - // The client request. - RMessage2 iNotifierMessage; - - // The bluetooth SDP Id of the connecting device. - TUint iServiceId; - - // Variable that defines if the connecting device is to be trusted or not. - TBool iSetTrusted; - - // Defines if the check box in the dialog is checked or not. - TBool iCheckBoxState; - - // Defines if the connecting device is paired or not. - TBool iPairedDevice; - - // Defines the class of the connecting device. - TInt iDeviceClass; - }; - -#endif /* BTNOTIFSERVICEAUTHORIZER_H_ */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifsession.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsession.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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: Session class for handling commands from clients. -* -*/ - -#ifndef BTNOTIFSESSION_H -#define BTNOTIFSESSION_H - -#include "btnotifserver.h" - -/** - * CBTNotifSession maintains a session with a client. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifSession ) : public CSession2 - { - -public: - - /** - * Two-phased constructor. - */ - static CBTNotifSession* NewL(); - - /** - * Destructor. - */ - virtual ~CBTNotifSession(); - -// from base class CSession2 - - /** - * From CSession2. - * Receives a message from a client. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the client request. - */ - virtual void ServiceL( const RMessage2& aMessage ); - - /** - * From CSession2. - * Completes construction of the session. - * - * @since Symbian^4 - */ - virtual void CreateL(); - -private: - - CBTNotifSession(); - - void ConstructL(); - - /** - * Returns a handle to our server. - * - * @since Symbian^4 - * @param Pointer to our server. - */ - inline CBTNotifServer* Server() const - { return (CBTNotifServer*) CSession2::Server(); } - -private: // data - - BTUNITTESTHOOK - - }; - -#endif // BTNOTIFSESSION_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifsettingstracker.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsettingstracker.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +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: Class for tracking Bluetooth settings, and also for -* handling notes unrelated to specific connection. -* -*/ - -#ifndef BTNOTIFSETTINGSTRACKER_H -#define BTNOTIFSETTINGSTRACKER_H - - -#include -#include - -#include "bluetoothnotification.h" - -class CBTNotifServer; - -/** - * CBTNotifSettingsTracker keeps track of local device settings - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifSettingsTracker ) : public CBase, - public MBTEngSettingsObserver, - public MBTNotificationResult - { - -public: - - /** - * Two-phased constructor. - * @param aServer Pointer to our parent - */ - static CBTNotifSettingsTracker* NewL( CBTNotifServer* aServer ); - - /** - * Destructor. - */ - virtual ~CBTNotifSettingsTracker(); - - /** - * Return the current power state - * - * @since Symbian^4 - * @return The current power state. - */ - inline TBTPowerStateValue GetPowerState() const - { return iPowerState; } - - /** - * Processes a message from a notifier client related to settings. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the client request. - */ - void DispatchNotifierMessageL( const RMessage2& aMessage ); - - /** - * Cancels an oustanding message from a notifier client related to settings. - * - * @since Symbian^4 - * @param aMessage The message containing the details of the original client request. - */ - void CancelNotifierMessageL( const RMessage2& aMessage ); - -// from base class MBTEngSettingsObserver - - /** - * From MBTEngSettingsObserver. - * Provides notification of changes in the power state - * of the Bluetooth hardware. - * - * @since Symbian^4 - * @param aState EBTPowerOff if the BT hardware has been turned off, - * EBTPowerOn if it has been turned off. - */ - virtual void PowerStateChanged( TBTPowerStateValue aState ); - - /** - * From MBTEngSettingsObserver. - * Provides notification of changes in the discoverability - * mode of the Bluetooth hardware. - * - * @since Symbian^4 - * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode, - * EBTDiscModeGeneral if it is in visible mode. - */ - virtual void VisibilityModeChanged( TBTVisibilityMode aState ); - -// from base class MBTNotificationResult - - /** - * From MBTNotificationResult. - * Handle an intermediate result from a user query. - * This ffunction is called if the user query passes information - * back before it has finished i.e. is dismissed. The final acceptance/ - * denial of a query is passed back in MBRNotificationClosed. - * - * @since Symbian^4 - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRDataReceived( CHbSymbianVariantMap& aData ); - - /** - * From MBTNotificationResult. - * The notification is finished. The resulting data (e.g. user input or - * acceptance/denial of the query) is passed back here. - * - * @since Symbian^4 - * @param aErr KErrNone or one of the system-wide error codes. - * @param aData the returned data. The actual format - * is dependent on the actual notifier. - */ - virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ); - -private: - - CBTNotifSettingsTracker( CBTNotifServer* aServer ); - - void ConstructL(); - -private: // data - - /** - * Local copy of current power state. - */ - TBTPowerStateValue iPowerState; - - /** - * Local copy of current visibility mode. - */ - TBTVisibilityMode iVisibilityMode; - - /** - * ?description_of_pointer_member - * Own. - */ - CBTEngSettings* iSettings; - - /** - * Pointer to an outstanding user interaction. - * Not own. - */ - CBluetoothNotification* iNotification; - - /** - * Reference to our parent the server class. - * Not own. - */ - CBTNotifServer* iServer; - - }; - -#endif // BTNOTIFSETTINGSTRACKER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/btnotifutil.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifutil.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 BTNOTIFUTIL_H -#define BTNOTIFUTIL_H - -#include -#include - -class CBtDevExtension; - -/** - * Utility class providing common functions required by various classes within - * btnotifsrv. - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( TBTNotifUtil ) - { -public: - - /** - * Gets the name of a device for displaying in UI. - * - * @param aNameBuf The buffer that will contain the name at return. - * @param aDevExt the DevExt instance representing the remote device. - * @param aNameInParam the given name from the parameter of a notifier request. - * @param aAddr the address of the device. Used only when aDevExt is null. - */ - static void GetDeviceUiNameL( TDes& aNameBuf, - const CBtDevExtension* aDevExt, - const TDesC& aNameInParam, const TBTDevAddr& aAddr ); - }; - -#endif // BTNOTIFUTIL_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* ============================================================================ -* Name : traceconfig_template.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : Configuration of debug tracing in btnotif -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ -#ifndef BLUETOOTHTRACECONFIG_H -#define BLUETOOTHTRACECONFIG_H - -/* -Sample usage: - void testTracing() - { - BOstrace0( TRACE_FATAL, TNAME_DEVLIST_1, "BOstrace0" ); - BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_2, "BOstrace1 %d", 123 ); - _LIT(String, "\"Symbian Descriptor\""); - TPtrC ptr(String); - TBuf<20> buf(ptr); - BOstraceExt1( TRACE_NORMAL, TNAME_DEVLIST_3, "BOstraceExt1 %S", &ptr); - BOstraceExt2( TRACE_API, TNAME_DEVLIST_4, "BOstraceExt2 %d %S", 456, &ptr ); - BOstraceExt3( TRACE_FLOW, TNAME_DEVLIST, "BOstraceExt3 0x%x %d %S", 128, 256, &ptr ); - BOstraceExt4( TRACE_DETAILED, TNAME_DEVL_5IST, "BOstraceExt4 0x%x %d %S %S", 128, 256, &ptr, &buf ); - BOstraceExt5( TRACE_DEBUG, TNAME_DEVLIST_6, "BOstraceExt5 0x%x %d %S %S, %b", 128, 256, &ptr, &buf, 512 ); - BOstraceFunctionEntry0( TNAME_DEVLIST_7 ); - BOstraceFunctionEntry1( TNAME_DEVLIST_8, 0x00abcdef ); - BOstraceFunctionEntryExt(TNAME_DEVLIST_9, 0xdeadbeef, 123); - BOstraceFunctionExit0( TNAME_DEVLIST_9 ); - BOstraceFunctionExit1( TNAME_DEVLIST_10, 0x00beebee ); - BOstraceFunctionExitExt(TNAME_DEVLIST_11, 0x00badbed, -1); - BOstraceEventStart0( TNAME_DEVLIST_12, "BOstraceEventStart0" ); - BOstraceEventStart1( TNAME_DEVLIST_13, "BOstraceEventStart1", 789 ); - BOstraceEventStop( TNAME_DEVLIST_14, "BOstraceEventStop" ); - BOstraceState0( TNAME_DEVLIST_15, "connection state", 1 ); - BOstraceState1( TNAME_DEVLIST_16, "audio state", 2, 0xdeadbeef ); - BtTraceBlock( - for (int i = 0; i < 5; ++i) { - BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_, "BtTraceBlock counter(1-5): %d", i+1 ); - }); - QString str("\"Qt String\""); - BtTraceQString0( TRACE_NORMAL, TNAME_DEVLIST_17, str); - BtTraceQString1( TRACE_NORMAL, TNAME_DEVLIST_18, "additional text;", str); - TBTDevAddr addr; - addr.SetReadable(_L("0060576ff376")); - BtTraceBtAddr0( TRACE_NORMAL, TNAME_DEVLIST_19, addr ); - BtTraceBtAddr1( TRACE_NORMAL, TNAME_DEVLIST_20, "additional trace;", addr ); - } - - */ - -// At early development phase, tracing is activated -#ifdef _DEBUG -#define BLUETOOTHTRACE_ENABLED -#endif //_DEBUG - -/* - * Tracing media configuration - */ -#ifdef BLUETOOTHTRACE_ENABLED - //#ifdef __WINS__ - //#define BLUETOOTHTRACE_MEDIA_FILE - //#else - // RDEBUG is used for tracing output before we migrate to OST tracing. - #define BLUETOOTHTRACE_MEDIA_RDEBUG - // #define BLUETOOTHTRACE_MEDIA_OST - //#endif // __WINS__ -#endif //BLUETOOTHTRACE_ENABLED - -/* - * Configuration of tracing to file - */ -#ifdef BLUETOOTHTRACE_MEDIA_FILE - -_LIT( KLogFile, "btenglog.txt" ); -_LIT( KLogDir, "bt" ); - -#endif //BLUETOOTHTRACE_MEDIA_FILE - -/* - * Configuration of tracing using RDebug - */ -#ifdef BLUETOOTHTRACE_MEDIA_RDEBUG - -#endif //BLUETOOTHTRACE_MEDIA_RDEBUG - -/* - * Configuration of tracing using OST - */ -#ifndef BLUETOOTHTRACE_MEDIA_OST - -/** - * Group-mapping aligning with OST groups. - * The purpose of using groups is to ease migrating tracing from legacy logging to OST. - */ -#define TRACE_FATAL "[FATAL]" -#define TRACE_IMPORTANT "[IMPTT]" -#define TRACE_NORMAL "[NORML]" -#define TRACE_API "[ API ]" -#define TRACE_FLOW "[FLOW ]" -#define TRACE_STATE "[STATE]" -#define TRACE_DETAILED "[DETLD]" -#define TRACE_DEBUG "[DEBUG]" -#define TRACE_PERFORMANCE "[PFMAN]" - -/** - * Component Identifier to be written into traces: - */ -_LIT(KComponentName, "[BtNotif]"); - -#endif //BLUETOOTHTRACE_MEDIA_OST - -#endif // BLUETOOTHTRACECONFIG_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,395 +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: Description: Class for managing an actual user notification or query. -* It hides UI framework-specifics in a private class. -* -*/ - -#include "bluetoothnotification.h" -#include -#include "btnotificationmanager.h" -#include "btnotifserver.h" -#include "bluetoothtrace.h" -#include // for debugging - -/** Identifier of Bluetooth device dialog plug-in. */ -_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" ); -/** Key name of result. */ -_LIT( KBTDevDialogResult, "result" ); -_LIT( KBTDevDialogInput, "input" ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBluetoothNotification::CBluetoothNotification( CBTNotificationManager* aManager ) -: iManager( aManager ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::ConstructL() - { - iNotificationData = CHbSymbianVariantMap::NewL(); - iDialog = CHbDeviceDialogSymbian::NewL(); - } - - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBluetoothNotification* CBluetoothNotification::NewL( - CBTNotificationManager* aManager ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CBluetoothNotification* self = new( ELeave ) CBluetoothNotification( aManager ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBluetoothNotification::~CBluetoothNotification() -{ - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - delete iDialog; - delete iNotificationData; - delete iReturnData; - BOstraceFunctionExit1( DUMMY_DEVLIST, this ) -} - -// --------------------------------------------------------------------------- -// Sets the data to be shown to the user. -// --------------------------------------------------------------------------- -// -TInt CBluetoothNotification::SetData( TInt aDataType, const TDesC& aData ) - { - TRAPD( err, SetDataL( aDataType, aData ) ); - return (int) err; - } - - -// --------------------------------------------------------------------------- -// Sets the data to be shown to the user. -// --------------------------------------------------------------------------- -// -TInt CBluetoothNotification::SetData( TInt aDataType, TInt aData ) - { - TRAPD( err, SetDataL( aDataType, aData ) ); - return (int) err; - } - -// --------------------------------------------------------------------------- -// Updates the data to be shown to the user. -// --------------------------------------------------------------------------- -// -TInt CBluetoothNotification::Update( const TDesC& aData ) - { - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - (void) aData; - int ret = iDialog->Update( *iNotificationData ); - delete iNotificationData; - iNotificationData = NULL; - TRAP( ret, iNotificationData = CHbSymbianVariantMap::NewL() ); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - return ret; - } - - -// --------------------------------------------------------------------------- -// Show the notification, which means that it is added to the queue. -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::ShowL() - { - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - SetDataL( TBluetoothDialogParams::EDialogType, iType ); - SetDataL( TBluetoothDialogParams::EResource, iResourceId ); - delete iReturnData; - iReturnData = NULL; - iReturnData = CHbSymbianVariantMap::NewL(); - iDialog->Show( KBTDevDialogId(), *iNotificationData, this ); - delete iNotificationData; - iNotificationData = NULL; - iNotificationData = CHbSymbianVariantMap::NewL(); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Stop showing the notification. -// --------------------------------------------------------------------------- -// -TInt CBluetoothNotification::Close() - { - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - iDialog->Cancel(); - iManager->ReleaseNotification( this ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// Sets the data to be shown to the user. -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::SetDataL( TInt aType, const TDesC& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType ); - TBuf16<6> key; - CHbSymbianVariant* value = NULL; - switch( aType ) - { - case TBluetoothDialogParams::EAddress: - case TBluetoothDeviceDialog::EDeviceName: - case TBluetoothDeviceDialog::EAdditionalDesc: - case TBluetoothDialogParams::EDialogTitle: - key.Num(aType); - value = CHbSymbianVariant::NewL( (TAny*) &aData, CHbSymbianVariant::EDes ); - BtTraceBlock( - TBuf<32> buf; - switch (aType) { - case TBluetoothDialogParams::EAddress: - _LIT(KAddress,"EAddress"); - buf.Append(KAddress); - break; - case TBluetoothDeviceDialog::EDeviceName: - _LIT(KDeviceName,"EDeviceName"); - buf.Append(KDeviceName); - break; - case TBluetoothDeviceDialog::EAdditionalDesc: - _LIT(KAdditionalDesc,"EAdditionalDesc"); - buf.Append(KAdditionalDesc); - break; - } - TPtrC p(buf); - TPtrC16 *ptr = (TPtrC16 *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%S]", &p, ptr); - ); - User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value - break; - case TBluetoothDialogParams::EResource: - case TBluetoothDeviceDialog::EDeviceClass: - case TBluetoothDeviceDialog::EAdditionalInt: - PanicServer( EBTNotifPanicBadArgument ); - break; - case TBluetoothDialogParams::ENoParams: - case TBluetoothDeviceDialog::ENoParams: - default: - break; - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - - -// --------------------------------------------------------------------------- -// Sets the data to be shown to the user. -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::SetDataL( TInt aType, TInt aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType ); - TBuf<6> key; - CHbSymbianVariant* value = NULL; - switch( aType ) - { - case TBluetoothDialogParams::EDialogType: - case TBluetoothDialogParams::EResource: - case TBluetoothDialogParams::EDialogTitle: - case TBluetoothDeviceDialog::EDeviceClass: - case TBluetoothDeviceDialog::EAdditionalInt: - key.Num(aType); - value = CHbSymbianVariant::NewL( (TAny*) &aData, CHbSymbianVariant::EInt ); - BtTraceBlock( - TBuf<32> buf; - switch (aType) { - case TBluetoothDialogParams::EDialogType: - buf = _L("EDialogType"); - break; - case TBluetoothDialogParams::EResource: - buf = _L("EResource"); - break; - case TBluetoothDeviceDialog::EDeviceClass: - buf = _L("EDeviceClass"); - break; - case TBluetoothDeviceDialog::EAdditionalInt: - buf = _L("EAdditionalInt"); - break; - } - TPtrC p(buf); - TInt *intPtr = (TInt *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%d]", &p, *intPtr); - ); - User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value - break; - case TBluetoothDialogParams::EAddress: - case TBluetoothDeviceDialog::EDeviceName: - PanicServer( EBTNotifPanicBadArgument ); - break; - case TBluetoothDialogParams::ENoParams: - case TBluetoothDeviceDialog::ENoParams: - default: - break; - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// From class MHbDeviceDialogObserver. -// Callback called when data is received from a device dialog. -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::DataReceived( CHbSymbianVariantMap& aData ) - { - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - BtTraceBlock( debugHbSymbianVariantMap(aData); ); - CHbSymbianVariant* value = NULL; - for( TInt i = 0; i < aData.Keys().MdcaCount(); i++ ) - { - TPtrC key( aData.Keys().MdcaPoint( i ).Ptr(), aData.Keys().MdcaPoint( i ).Length() ); - const CHbSymbianVariant* valueRef = aData.Get( key ); - value = NULL; - TRAP_IGNORE( value = - CHbSymbianVariant::NewL( valueRef->Data(), valueRef->Type() ) ); - if ( value ) - { - TInt err = iReturnData->Add( key, value ); - if ( err ) - { - // todo: better exception handing than ignoring this failure? - } - } - } - if( iObserver ) - { - iObserver->MBRDataReceived( aData ); - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -#ifdef BLUETOOTHTRACE_ENABLED - -void CBluetoothNotification::debugHbSymbianVariantMap( CHbSymbianVariantMap& aData) - { - for( TInt i = 0; i < aData.Keys().MdcaCount(); i++ ) - { - TBuf<128> buf; - TPtrC key( aData.Keys().MdcaPoint( i ).Ptr(), aData.Keys().MdcaPoint( i ).Length() ); - buf = key; - buf.Append(_L(" = ")); - const CHbSymbianVariant* value = aData.Get( key ); - TBuf<16> nbr; - TBuf<32> newBuf; - switch (value->Type()) { - case CHbSymbianVariant::EInt : - buf.Append(_L("[EInt] ")); - nbr.Num(*((TInt*)value->Data())); - buf.Append(nbr); - break; - case CHbSymbianVariant::EBool : - buf.Append(_L("[EBool] ")); - buf.Append(*((TBool*)value->Data()) ? _L("True") : _L("False")); - break; - case CHbSymbianVariant::EUint : - buf.Append( _L("[EUint] ")); - nbr.Num(*((TUint*)value->Data())); - buf.Append(nbr); - break; - case CHbSymbianVariant::EReal : - buf.Append(_L("[EReal] ")); - nbr.Num(*((TReal*)value->Data())); - buf.Append(nbr); - break; - case CHbSymbianVariant::EDes : // TDesC - buf.Append(_L("[EDes] ")); - buf.Append(*((TPtrC16 *)value->Data())); - break; - case CHbSymbianVariant::EBinary : // TDesC8 - buf.Append(_L("[EBinary] ")); - // the following function caused problems when converting this function to - // a trace function in bluetoothtrace.h - CnvUtfConverter::ConvertToUnicodeFromUtf8(newBuf,*((TPtrC8 *)value->Data()) ); - buf.Append(newBuf); - break; - case CHbSymbianVariant::EChar : // a TChar - buf.Append(_L("[EChar] ")); - buf.Append(*((TChar *)value->Data())); - break; - case CHbSymbianVariant::ERect : // a TRect - case CHbSymbianVariant::EPoint : // a TPoint - case CHbSymbianVariant::ESize : // a TSize - case CHbSymbianVariant::EDesArray : // a MDesCArray - break; - default: - break; - } - TPtrC p(buf); - BOstraceExt1( TRACE_DEBUG, DUMMY_DEVLIST, "HbSymbianVariantMap [%S]", &p); - } - } -#endif // BLUETOOTHTRACE_ENABLED -// --------------------------------------------------------------------------- -// From class MHbDeviceDialogObserver. -// Callback called when a device dialog is closed. -// --------------------------------------------------------------------------- -// -void CBluetoothNotification::DeviceDialogClosed( TInt aCompletionCode ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aCompletionCode ); - TPckg result( EFalse ); - TPtrC8 resultPtr( result ); - const CHbSymbianVariant* value = iReturnData->Get( KBTDevDialogResult ); - if( value && value->IsValid() ) - { - result() = *value->Value(); - } - RBuf8 resultBuf; - value = iReturnData->Get( KBTDevDialogInput ); - if( value && value->IsValid() ) - { - HBufC8* data = value->Value(); - if( !resultBuf.Create( data->Length() + result.Length() ) ) - { - resultBuf = *data; - resultBuf.Insert( 0, result ); - resultPtr.Set( resultBuf ); - } - } - if( iObserver ) - { - if( aCompletionCode == CHbDeviceDialogSymbian::ECancelledError ) - { - aCompletionCode = KErrCancel; - } - iObserver->MBRNotificationClosed( aCompletionCode, resultPtr ); - } - resultBuf.Close(); - iManager->ReleaseNotification( this ); - // Note that we might get deleted after releasing ourselves. - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifbasepairinghandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +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 "btnotifsecuritymanager.h" -#include "btnotifbasepairinghandler.h" -#include "btnotificationmanager.h" -#include "bluetoothnotification.h" -#include "btnotifconnectiontracker.h" -#include "bluetoothtrace.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifBasePairingHandler::CBTNotifBasePairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) - : iAddr( aAddr ), iParent( aParent ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::BaseConstructL( ) - { - iActive = CBtSimpleActive::NewL( *this, 0 ); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifBasePairingHandler::~CBTNotifBasePairingHandler() - { - delete iActive; - } - -// --------------------------------------------------------------------------- -// Message passes through only if the result is for the same device this -// object is for. -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::HandlePairServerResult( const TBTDevAddr& aAddr, TInt aResult ) - { - if ( aAddr == iAddr ) - { - DoHandlePairServerResult( aResult ); - } - } - -// --------------------------------------------------------------------------- -// Message passes through only if the result is for the same device this -// object is for. -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::HandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) - { - if ( aDev.Address() == iAddr ) - { - DoHandleRegistryNewPairedEvent( aDev ); - } - } - -// --------------------------------------------------------------------------- -// Default impl of virtual function. do nothing -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::CancelOutgoingPair() - { - } - -// --------------------------------------------------------------------------- -// Default impl does not offer a known PIN code for pairing -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::GetPinCode( - TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) - { - aPin().iLength = 0; - (void) aAddr; - (void) aMinPinLength; - } - -// --------------------------------------------------------------------------- -// Invalidate iPairResultSet -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::UnSetPairResult() - { - iPairResultSet = EFalse; - } - -// --------------------------------------------------------------------------- -// Save the result and validate the flag -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::SetPairResult( TInt aResult ) - { - iPairResult = aResult; - iPairResultSet = ETrue; - } - -// --------------------------------------------------------------------------- -// Returns the flag -// --------------------------------------------------------------------------- -// -TBool CBTNotifBasePairingHandler::IsPairResultSet() - { - return iPairResultSet; - } - -// --------------------------------------------------------------------------- -// Invalidate iPairResultSet -// --------------------------------------------------------------------------- -// -void CBTNotifBasePairingHandler::ShowPairingResultNoteL(TInt aResult) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CBluetoothNotification* notification = - iParent.ConnectionTracker().NotificationManager()->GetNotification(); - User::LeaveIfNull( notification ); // For OOM exception, leaves with KErrNoMemory - TBTDialogResourceId resourceId = EPairingSuccess; - if(KErrNone != aResult) - { - resourceId = EPairingFailureOk; - } - notification->SetNotificationType( TBluetoothDialogParams::ENote, resourceId ); - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iAddr); - if(dev) - { - User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceName, dev->Alias())); - User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceClass, dev->Device().DeviceClass().DeviceClass())); - } - else - { - TBTDeviceName name; - iAddr.GetReadable(name); - User::LeaveIfError(notification->SetData( TBluetoothDialogParams::EAddress, name )); - User::LeaveIfError(notification->SetData( TBluetoothDeviceDialog::EDeviceClass, 0)); // No device class - } - iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( notification); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +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: Bluetooth connection tracker and manager. -* -*/ - -#include "btnotifconnectiontracker.h" -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif - -#include -#include - -#include "btnotifsession.h" -#include "btnotifclientserver.h" -#include "bluetoothtrace.h" -#include "btnotifsecuritymanager.h" - -/** Time window for determining if there are too many requests. */ -#ifndef __WINS__ -#define KDENYTHRESHOLD TTimeIntervalSeconds(3) -#else //__WINS__ -#define KDENYTHRESHOLD TTimeIntervalSeconds(5) -#endif //__WINS__ - - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifConnectionTracker::CBTNotifConnectionTracker( CBTNotifServer* aServer ) -: iServer( aServer ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifConnectionTracker::ConstructL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Open a handle to the registry server - User::LeaveIfError( iBTRegistrySession.Connect() ); - // Open a handle to the socket server - User::LeaveIfError( iSockServ.Connect() ); - iPairingManager = CBTNotifSecurityManager::NewL(*this, iServer->DevRepository() ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBTNotifConnectionTracker* CBTNotifConnectionTracker::NewL( CBTNotifServer* aServer ) - { - CBTNotifConnectionTracker* self = new( ELeave ) CBTNotifConnectionTracker( aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifConnectionTracker::~CBTNotifConnectionTracker() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iDeniedRequests.Close(); - delete iPairingManager; - iSockServ.Close(); - iBTRegistrySession.Close(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Process notifier message related to pairing notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifConnectionTracker::HandleNotifierRequestL( const RMessage2& aMessage ) - { - BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() ); - iPairingManager->HandleNotifierRequestL(aMessage); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Handle a request related to pairing. -// --------------------------------------------------------------------------- -// -void CBTNotifConnectionTracker::HandleBondingRequestL( const RMessage2& aMessage ) - { - BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() ); - iPairingManager->HandleBondingRequestL(aMessage); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Check if this device has been denied a connection already before. -// Also check if a previous connection attempt has just been rejected. -// --------------------------------------------------------------------------- -// -TBool CBTNotifConnectionTracker::UpdateBlockingHistoryL( const CBTDevice* aDevice, - TBool aAccepted ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - __ASSERT_ALWAYS( aDevice, PanicServer( EBTNotifPanicBadArgument ) ); - // Check the time since the previous event. - TBool result = RecordConnectionAttempts( aAccepted ); - TInt pos = iDeniedRequests.Find( aDevice->BDAddr() ); - if( !aAccepted ) - { - if( pos == KErrNotFound ) - { - // The user denied the request from a new device, record the device address. - if( aDevice->IsValidPaired() && aDevice->IsPaired() ) - //[MCL]: && iDevice->LinkKeyType() != ELinkKeyUnauthenticatedUpgradable ) - { - // Paired devices are allowed one time rejection without a prompt for blocking. - result = EFalse; - } - iDeniedRequests.AppendL( aDevice->BDAddr() ); - } - // Nothing needed here if the address is already in the array. - } - else if( pos > KErrNotFound ) - { - // The user accepted a request, and it was from a device he/she - // previously rejected. Clear the history for this device from the array. - iDeniedRequests.Remove( pos ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return result; - } - -// --------------------------------------------------------------------------- -// Record and check the time between connection attempts. -// --------------------------------------------------------------------------- -// -TBool CBTNotifConnectionTracker::RecordConnectionAttempts( TBool aAccepted ) - { - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - TBool result = ETrue; - TTime now( 0 ); - if( !aAccepted ) - { - now.UniversalTime(); - if( iLastReject ) - { - // Check the time between denied connections, that it does not go too fast. - TTimeIntervalSeconds prev( 0 ); - if( !now.SecondsFrom( TTime( iLastReject ), prev ) ) - { - if( prev <= KDENYTHRESHOLD ) - { - // We are getting the requests too fast. Present the user with - // an option to turn BT off. - //iServer->SettingsTracker()->SetPower( EFalse ); - result = EFalse; - } - } - } - } - // Record the current timestamp. - // It is reset in case the user accepted the request. - iLastReject = now.Int64(); - BOstraceFunctionExitExt( DUMMY_DEVLIST, this, result ); - return result; - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,538 +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 -#include -#include -#include -#include "btnotifdeviceselector.h" - -#include "btnotifserver.h" -#include "btnotificationmanager.h" -#include "btnotifclientserver.h" -// Key description length -const TInt KMaxKeyDesCLength = 20; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifDeviceSelector::CBTNotifDeviceSelector( CBTNotifServer& aServer ) -: iServer( aServer ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::ConstructL() - { - iServer.DevRepository().AddObserverL(this); - iDiscoverer = CAdvanceDevDiscoverer::NewL( iServer.DevRepository(), *this ); - } - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBTNotifDeviceSelector* CBTNotifDeviceSelector::NewL( CBTNotifServer& aServer ) - { - CBTNotifDeviceSelector* self = new( ELeave ) CBTNotifDeviceSelector( aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifDeviceSelector::~CBTNotifDeviceSelector() - { - iServer.DevRepository().RemoveObserver(this); - if( iNotification ) - { - // Clear the notification callback, we cannot receive them anymore. - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - iDevices.ResetAndDestroy(); - iDevices.Close(); - delete iDiscoverer; - - } - -// --------------------------------------------------------------------------- -// Process a client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::DispatchNotifierMessageL( const RMessage2& aMessage ) - { - BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() ); - TInt opcode = aMessage.Function(); - TInt uid = aMessage.Int0(); - switch ( opcode ) - { - case EBTNotifCancelNotifier: - { - // We only accept a cancel message from the same session as the original - // request (this is enforced by the RNotifier backend). - TInt err( KErrNotFound ); - if ( !iMessage.IsNull() && opcode == iMessage.Function() && - aMessage.Session() == iMessage.Session() ) - { - iMessage.Complete( KErrCancel ); - err = KErrNone; - } - aMessage.Complete( err ); - break; - } - case EBTNotifUpdateNotifier: - { - // not handling so far - break; - } - case EBTNotifStartSyncNotifier: - { - // synch version of device searching is not supported: - aMessage.Complete( KErrNotSupported ); - break; - } - case EBTNotifStartAsyncNotifier: - { - if ( !iMessage.IsNull() ) - { - aMessage.Complete( KErrServerBusy ); - return; - } - - iLoadDevices = EFalse; - if(iServer.DevRepository().IsInitialized()) - { - iLoadDevices = ETrue; - if(iServer.DevRepository().AllDevices().Count()==0) - { - PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource); - iDevices.ResetAndDestroy(); - iDiscoverer->DiscoverDeviceL(); - } - else - { - iDevices.ResetAndDestroy(); - PrepareNotificationL(TBluetoothDialogParams::EMoreDevice, ENoResource); - LoadUsedDevicesL(); - } - } - iMessage = aMessage; - break; - } - default: - { - aMessage.Complete( KErrNotSupported ); - } - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - - -// --------------------------------------------------------------------------- -// Cancels an outstanding client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::CancelNotifierMessageL( const RMessage2& aMessage ) - { - (void) aMessage; - } - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// Handle a result from a user query. -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::MBRDataReceived( CHbSymbianVariantMap& aData ) - { - TInt err = KErrCancel; - if(aData.Keys().MdcaPoint(aData.Keys().MdcaCount()-1).Compare(_L("selectedindex"))==KErrNone) - { - TInt val = *(static_cast(aData.Get(_L("selectedindex"))->Data())); - BOstrace1( TRACE_DEBUG, TNAME_DEVLIST_2, "MBRDataReceived, val %d", val ); - - if ( !iMessage.IsNull() ) - { - // TInt sel = val;// - TBluetoothDialogParams::EDialogExt; - TBTDeviceResponseParamsPckg devParams; - if ( val > -1 && val < iDevices.Count() ) - { - TRAP(err,SendSelectedDeviceL(aData)); - /* devParams().SetDeviceAddress( iDevices[val]->Addr() ); - devParams().SetDeviceClass(iDevices[val]->Device().DeviceClass()); - devParams().SetDeviceName(iDevices[val]->Alias()); - err = iMessage.Write( EBTNotifSrvReplySlot, devParams );*/ - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - iMessage.Complete( err ); - } - iDiscoverer->CancelDiscovery(); - } - else if(aData.Keys().MdcaPoint(0).Compare(_L("Stop"))==KErrNone) - { - iDiscoverer->CancelDiscovery(); - } - else if(aData.Keys().MdcaPoint(0).Compare(_L("Retry"))==KErrNone) - { - iDiscoverer->CancelDiscovery(); - iDevices.ResetAndDestroy(); - TRAP_IGNORE( iDiscoverer->DiscoverDeviceL() ); - - } - else if(aData.Keys().MdcaPoint(0).Compare(_L("MoreDevices"))==KErrNone) - { - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - iDevices.ResetAndDestroy(); - TRAP_IGNORE( { - PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource); - iDiscoverer->DiscoverDeviceL(); } ); - } - } - - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// The notification is finished. -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::MBRNotificationClosed( TInt aError, const TDesC8& aData ) - { - (void) aError; - (void) aData; - iNotification->RemoveObserver(); - iNotification = NULL; - } - -// --------------------------------------------------------------------------- -// HandleNextDiscoveryResultL -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::HandleNextDiscoveryResultL( - const TInquirySockAddr& aAddr, const TDesC& aName ) - { - // Todo: look for this device in repository before creating it. - TBuf addr; - - - - CBtDevExtension* devext = GetDeviceFromRepositoryL(aAddr.BTAddr()); - - if(!devext) - { - devext = CBtDevExtension::NewLC( aAddr, aName ); - } - else - { - CleanupStack::PushL(devext); - } - iDevices.AppendL( devext ); - CleanupStack::Pop( devext ); - - if(iNotification) - {// conditional check required as CAdvanceDevDiscoverer sends discovered devices at times - // even after canceldiscovery is issued and notification is set to NULL - // this causes EExcDataAbort - CHbSymbianVariantMap* map = iNotification->Data(); -/* TBuf keyStr; - CHbSymbianVariant* devEntry; - - keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 ); - devEntry = CHbSymbianVariant::NewL( (TAny*) &(devext->Alias()), - CHbSymbianVariant::EDes ); - map->Add( keyStr, devEntry );*/ - - User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName, - devext->Alias())); - - devext->Addr().GetReadable(addr); - User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr)); - - TInt classOfDevice; - classOfDevice = devext->Device().DeviceClass().DeviceClass(); - User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice)); - - TBool status; - status = isBonded( devext->Device()); - - // setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() )); - AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool); - status = devext->Device().GlobalSecurity().Banned(); - AddDataL(map,_L("Blocked"),&status, - CHbSymbianVariant::EBool); - status = devext->Device().GlobalSecurity().NoAuthorise(); - AddDataL(map,_L("Trusted"),&status, - CHbSymbianVariant::EBool); - status = devext->ServiceConnectionStatus() == EBTEngConnected; - AddDataL(map,_L("Connected"),&status, - CHbSymbianVariant::EBool); - - iNotification->Update(); - } - } - -// --------------------------------------------------------------------------- -// HandleDiscoveryCompleted -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::HandleDiscoveryCompleted( TInt aErr ) - { - (void) aErr; - CHbSymbianVariantMap* map = iNotification->Data(); - TBuf keyStr; - - - //TODO compile fail here we need to send the discovery completed text to the dialog - //TODO change the hardcoded string - keyStr.Copy(_L("Search Completed")); - CHbSymbianVariant* devEntry( NULL ); - TRAP_IGNORE( devEntry = CHbSymbianVariant::NewL( (TAny*) &(keyStr), - CHbSymbianVariant::EDes ) ); - if ( devEntry ) - { - map->Add( keyStr, devEntry ); - iNotification->Update(); - } - else - { - // todo: Complete client request with error - } - } - -// From MBtDeviceRepositoryObserver - -void CBTNotifDeviceSelector::RepositoryInitialized() - { - iRepositoryInitialized = ETrue; - TInt err(KErrNone); - if(!iLoadDevices) - { - iLoadDevices = ETrue; - if(iServer.DevRepository().AllDevices().Count()==0) - { - iDevices.ResetAndDestroy(); - TRAP(err, { - PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource); - iDiscoverer->DiscoverDeviceL(); } ); - } - else - { - iDevices.ResetAndDestroy(); - TRAP( err, - {PrepareNotificationL( - TBluetoothDialogParams::EMoreDevice, ENoResource); - LoadUsedDevicesL(); - } ); - } - } - if ( err ) - { - // todo: complete client request - } - } - -void CBTNotifDeviceSelector::DeletedFromRegistry( const TBTDevAddr& aAddr ) - { - (void) aAddr; - } - -void CBTNotifDeviceSelector::AddedToRegistry( const CBtDevExtension& aDev ) - { - (void) aDev; - } - -void CBTNotifDeviceSelector::ChangedInRegistry( const CBtDevExtension& aDev, TUint aSimilarity ) - { - (void) aDev; - (void) aSimilarity; - } - -void CBTNotifDeviceSelector::ServiceConnectionChanged(const CBtDevExtension& aDev, TBool aConnected ) - { - (void) aDev; - (void) aConnected; - } - - -// --------------------------------------------------------------------------- -// Get and configure a notification. -// --------------------------------------------------------------------------- -// -void CBTNotifDeviceSelector::PrepareNotificationL( - TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if(iNotification) - { - iNotification->RemoveObserver(); - iNotification = NULL; - } - iNotification = iServer.NotificationManager()->GetNotification(); - User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory - iNotification->SetObserver( this ); - iNotification->SetNotificationType( aType, aResourceId ); - - iServer.NotificationManager()->QueueNotificationL( iNotification,CBTNotificationManager::EPriorityHigh ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -void CBTNotifDeviceSelector::LoadUsedDevicesL() - { - const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices(); - TBuf addr; - for(TInt i=0; i< devArray.Count(); i++ ) - { - const TTime& usedTime = devArray[i]->Device().Used(); - TTime monthBack; - monthBack.HomeTime(); - monthBack -= TTimeIntervalDays(30); - if(usedTime >= monthBack) - { - iDevices.AppendL( devArray[i]->CopyL() ); - CHbSymbianVariantMap* map = iNotification->Data(); - // TBuf keyStr; - // CHbSymbianVariant* devEntry; - - // keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 ); -// devEntry = CHbSymbianVariant::NewL( (TAny*) &(devArray[i]->Alias()), - // CHbSymbianVariant::EDes ); - // map->Add( keyStr, devEntry, ); - User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceName, - devArray[i]->Alias())); -// AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes); - devArray[i]->Addr().GetReadable(addr); - User::LeaveIfError(iNotification->SetData(TBluetoothDialogParams::EAddress,addr)); - addr.Zero(); - TInt classOfDevice; - classOfDevice = devArray[i]->Device().DeviceClass().DeviceClass(); - User::LeaveIfError(iNotification->SetData(TBluetoothDeviceDialog::EDeviceClass,classOfDevice)); - - TBool status; - status = isBonded( devArray[i]->Device()); - - // setMajorProperty(majorProperty, _L("Bonded"), isBonded( devArray[i]->Device() )); - AddDataL(map,_L("Bonded"),&status,CHbSymbianVariant::EBool); - status = devArray[i]->Device().GlobalSecurity().Banned(); - AddDataL(map,_L("Blocked"),&status, - CHbSymbianVariant::EBool); - status = devArray[i]->Device().GlobalSecurity().NoAuthorise(); - AddDataL(map,_L("Trusted"),&status, - CHbSymbianVariant::EBool); - status = devArray[i]->ServiceConnectionStatus() == EBTEngConnected; - AddDataL(map,_L("Connected"),&status, - CHbSymbianVariant::EBool); - // set blocked status: -/* setMajorProperty(majorProperty, BtuiDevProperty::Blocked, - devArray[i]->Device().GlobalSecurity().Banned() ); - // set trusted status: - setMajorProperty(majorProperty, BtuiDevProperty::Trusted, - devArray[i]->Device().GlobalSecurity().NoAuthorise() ); - // set connected status: - // EBTEngConnecting is an intermediate state between connected and not-connected, - // we do not treat it as connected: - setMajorProperty(majorProperty, BtuiDevProperty::Connected, devArray[i]->ServiceConnectionStatus() == EBTEngConnected); - - */ - - // AddDataL(map,keyStr,&(devArray[i]->Alias()),CHbSymbianVariant::EDes); - iNotification->Update(); - } - } - } - - - -/*! - Tells if the given device is bonded. -*/ -TBool CBTNotifDeviceSelector::isBonded( const CBTDevice &dev ) -{ - // todo: this has not addresses Just Works pairing mode yet. - return dev.IsValidPaired() && dev.IsPaired() && - dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable; -} - -void CBTNotifDeviceSelector::AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, - const TAny* aData, CHbSymbianVariant::TType aDataType) - { - CHbSymbianVariant* value = CHbSymbianVariant::NewL(aData, aDataType); - CleanupStack::PushL( value ); - User::LeaveIfError( aMap->Add( aKey, value ) ); // aMap takes the ownership of value - CleanupStack::Pop( value ); - } - -// --------------------------------------------------------------------------- -// Tells if these two instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBtDevExtension& aDev) - { - return *aAddr == aDev.Device().BDAddr(); - } - - -CBtDevExtension* CBTNotifDeviceSelector::GetDeviceFromRepositoryL( const TBTDevAddr& aAddr ) -{ - const RDevExtensionArray& devArray= iServer.DevRepository().AllDevices(); - - TInt pos = devArray.Find( aAddr, MatchDeviceAddress); - if(pos > -1) - { - return devArray[pos]->CopyL(); - } - return NULL; -/* addrSymbianToReadbleString( addrStr, addr ); - for (int i = 0; i < mData.count(); ++i ) { - if ( mData.at( i ).value( BtDeviceModel::ReadableBdaddrRole ) - == addrStr ) { - return i; - } - } - return -1;*/ -} - - -void CBTNotifDeviceSelector::SendSelectedDeviceL( CHbSymbianVariantMap& aData ) - { - TInt err; - TBTDeviceResponseParamsPckg devParams; - TBTDevAddr address; - User::LeaveIfError(address.SetReadable( - *(static_cast(aData.Get(_L("deviceaddress"))->Data())))); - devParams().SetDeviceAddress( address ); - devParams().SetDeviceClass(*(static_cast(aData.Get(_L("deviceclass"))->Data()))); - devParams().SetDeviceName(*(static_cast(aData.Get(_L("devicename"))->Data()))); - User::LeaveIfError(iMessage.Write( EBTNotifSrvReplySlot, devParams )); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +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: Class for managing user notification and query objects, -* and for serializing access to the notification server. -* -*/ - -#include "btnotificationmanager.h" -#include "btnotifserver.h" - -#include "bluetoothnotification.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotificationManager::CBTNotificationManager( const CBTNotifServer* aServer ) -: iServer( aServer ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotificationManager::ConstructL() - { - } - - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBTNotificationManager* CBTNotificationManager::NewL( const CBTNotifServer* aServer ) - { - CBTNotificationManager* self = new( ELeave ) CBTNotificationManager( aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotificationManager::~CBTNotificationManager() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iNotificationQ.ResetAndDestroy(); - iNotificationQ.Close(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - -// --------------------------------------------------------------------------- -// Get a new notification -// --------------------------------------------------------------------------- -// -CBluetoothNotification* CBTNotificationManager::GetNotification() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CBluetoothNotification* notification = NULL; - TRAP_IGNORE( notification = CBluetoothNotification::NewL( this ) ); - if( notification ) - { - if( iNotificationQ.Append( notification ) ) - { - // In case the appending fails, we just delete the notification. - // Otherwise we cannot keep track of it anymore. - delete notification; - notification = NULL; - } - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return notification; - } - - -// --------------------------------------------------------------------------- -// Release the notification -// --------------------------------------------------------------------------- -// -void CBTNotificationManager::ReleaseNotification( CBluetoothNotification* aNotification ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - __ASSERT_ALWAYS( aNotification, PanicServer( EBTNotifPanicBadArgument ) ); - TInt pos = iNotificationQ.Find( aNotification ); - __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) ); - delete iNotificationQ[pos]; - iNotificationQ.Remove( pos ); - iNotificationQ.Compress(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - -// --------------------------------------------------------------------------- -// Queue the notification with given priority -// --------------------------------------------------------------------------- -// -void CBTNotificationManager::QueueNotificationL( - CBluetoothNotification* aNotification, - TNotificationPriority aPriority ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - (void) aPriority; - TInt pos = iNotificationQ.Find( aNotification ); - __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) ); - // Always move the newly added notification on top - if(pos != 0 ) - { - CBluetoothNotification* notification = NULL; - notification = iNotificationQ[pos]; - iNotificationQ.Remove( pos ); - iNotificationQ.InsertL(notification,0); - } - ProcessNotificationQueueL(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Process the notification queue and launch the next notification. -// --------------------------------------------------------------------------- -// -void CBTNotificationManager::ProcessNotificationQueueL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if( iNotificationQ.Count() ) - { - iNotificationQ[0]->ShowL(); - } - else - { - // No outstanding notifications - iNotificationQ.Compress(); // the queue is empty, reset it. - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,384 +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 "btnotifincomingpairinghandler.h" -#include "btnotifsecuritymanager.h" -#include "btnotifoutgoingpairinghandler.h" -#include -#include "bluetoothtrace.h" - -const TInt KBTNotifWaitingForPairingOkDelay = 500000; // 0.5s - -enum TPairingStageId - { - /** - * is monitoring physical link status - */ - EPhysicalLinkNotify = 100, - EWaitingForPairingOk, - }; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifIncomingPairingHandler::CBTNotifIncomingPairingHandler( CBTNotifSecurityManager& aParent, - const TBTDevAddr& aAddr) : CBTNotifBasePairingHandler( aParent, aAddr ) - { - } - -// --------------------------------------------------------------------------- -// 2nd phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::ConstructL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BaseConstructL(); - iActivePairingOk = CBtSimpleActive::NewL(*this, EWaitingForPairingOk ); - User::LeaveIfError( iPairingOkTimer.CreateLocal() ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTNotifBasePairingHandler* CBTNotifIncomingPairingHandler::NewL( CBTNotifSecurityManager& aParent, - const TBTDevAddr& aAddr) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CBTNotifIncomingPairingHandler* self = new (ELeave) CBTNotifIncomingPairingHandler(aParent, aAddr); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifIncomingPairingHandler::~CBTNotifIncomingPairingHandler() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Cancel all outstanding requests - CancelPlaNotification(); - iPla.Close(); - delete iActivePairingOk; - iPairingOkTimer.Close(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Accept this message only if the specified device is the same as this is -// dealing with. -// --------------------------------------------------------------------------- -// -TInt CBTNotifIncomingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TInt err( KErrServerBusy ); - if ( iAddr == aAddr ) - { - err = KErrNone; - // This function is called by a notifier, which means the UI has been involved - // Therefore we can display it in the paired devices list - iUserAwarePairing = ETrue; - if ( !iActive->IsActive() && !OpenPhysicalLinkAdaptor() ) - { - // If we are observing physical link, or showing user a note, - // we won't interrupt it. - UnSetPairResult(); - MonitorPhysicalLink(); - } - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return err; - } - -// --------------------------------------------------------------------------- -// Assign the responsibility of outgoing pair handling to CBTEngOtgPair -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Outgoing pairing always takes highest priority: - CBTNotifBasePairingHandler* pairinghandler = CBTNotifOutgoingPairingHandler::NewL( iParent, aAddr ); - pairinghandler->HandleOutgoingPairL( aAddr, aCod ); - iParent.RenewPairingHandler( pairinghandler ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Accept this message only if the specified device is the same as this is -// dealing with. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if ( aAddr == iAddr ) - { - iParent.RenewPairingHandler( NULL ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Notify user if pairing failed. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::DoHandlePairServerResult( TInt aResult ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CancelPlaNotification(); - // For a successful pairing, we need wait for registry table change. - if( aResult != KErrNone && aResult != KHCIErrorBase ) - { - // Pair failure situation. - SetPairResult( aResult ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Kill this if the linkkey type indicates OBEX authentication. -// Otherwise notify user the pair result. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::DoHandleRegistryNewPairedEvent( const TBTNamelessDevice& aDev ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - - // First of all cancel the iPairingOkTimer timer, if active - if (iActivePairingOk->IsActive()) - { - iActivePairingOk->Cancel(); - UnSetPairResult(); // we might have set it before (if the link went down) so we want to reset it. - } - if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable && !iUserAwarePairing) - { - // If an application uses btengconnman API to connect a service of - // this device and JW pairing occurred as part of security enforcement, - // it shall be a user aware pairing, and we shall add this device in paired - // view. In this way, user is able to disconnect the device from our UI. - // Otherwise the link key has been created by a device without IO requesting - // a service connection with phone. We won't take any action (e.g. remove - // link key) in this case. As the result, this device can't be seen in our UI, - // however other applications are still freely to use its services. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with no IO device"); - TBTEngConnectionStatus status = iParent.ConnectStatus( aDev.Address() ); - if ( status == EBTEngConnecting || status == EBTEngConnected ) - { - // the return error is ingore as we can not have other proper - // exception handling option: - (void) iParent.AddUiCookieJustWorksPaired( aDev ); - } - TRAP_IGNORE(ShowPairingResultNoteL(KErrNone)); - iParent.RenewPairingHandler( NULL ); - } - else if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable && !iUserAwarePairing) - { - // The linkkey has been created by an incoming OBEX service request - // which resulted a pairing event received from pair server. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with IO device"); - iParent.RenewPairingHandler( NULL ); - } - else - { - if (aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable || aDev.LinkKeyType() == ELinkKeyUnauthenticatedUpgradable) - { - // The user was involved in the pairing, so display in the paired devices list - (void) iParent.AddUiCookieJustWorksPaired(aDev); - } - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: Non-JW pairing"); - // Other pairing model than Just Works: - CancelPlaNotification(); - SetPairResult( KErrNone ); - TRAP_IGNORE(ShowPairingResultNoteL(KErrNone)); - iParent.RenewPairingHandler( NULL ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Check which request completed. - switch( aActive->RequestId() ) - { - case EPhysicalLinkNotify: - { - // Check if the link has disconnected. - HandlePhysicalLinkResultL( aStatus ); - break; - } - case EWaitingForPairingOk: - { - // pairing failed, inform user: - if (iPairResult == KErrNone) - { - // iPairResult must have been set as an error. if it's not it means somewhere else - // it has been reset. But we need to have it set to an error as we are notifying - // the "unable to pair" message. - SetPairResult(KErrGeneral); - } - iParent.RenewPairingHandler( NULL ); - break; - } - default: - // Should not be possible, but no need for handling. - break; - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// cancels an outstanding request according to the given id. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::CancelRequest( TInt aRequestId ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - switch ( aRequestId ) - { - case EPhysicalLinkNotify: - { - iPla.CancelNextBasebandChangeEventNotifier(); - break; - } - case EWaitingForPairingOk: - { - iPairingOkTimer.Cancel(); - break; - } - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// Handles a leave in RequestCompleted by simply self-destructing. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - (void) aActive; - (void) aError; - // Our error handling is to just stop observing. - // Nothing critical to be preserved here, the user - // just won't get any notification of pairing result. - iParent.RenewPairingHandler( NULL ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Subscribe to physical link notifications. -// physical link must exist when calling this function. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::MonitorPhysicalLink() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iActive->SetRequestId( EPhysicalLinkNotify ); - // Subscribe to disconnect and error events. - iPla.NotifyNextBasebandChangeEvent( iBbEvent, - iActive->RequestStatus(), - ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); - iActive->GoActive(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Opens the adaptor if physical link exists. -// --------------------------------------------------------------------------- -// -TInt CBTNotifIncomingPairingHandler::OpenPhysicalLinkAdaptor() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TInt err ( KErrNone ); - if( !iPla.IsOpen() ) - { - // Try to open the adapter in case it failed earlier. - // This can happen for outgoing dedicated bonding with - // non-SSP device, as the PIN dialog can be kept open even - // though the link has dropped because of a time-out. - err = iPla.Open( iParent.SocketServ(), iAddr ); - } - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:HasPhysicalLink ? %d", iPla.IsOpen() ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return err; - } - -// --------------------------------------------------------------------------- -// Cancel outstanding physical link notification -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::CancelPlaNotification() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if( iActive && iActive->RequestId() == EPhysicalLinkNotify ) - { - // cancel Baseband monitor - iActive->Cancel(); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Handle a physical link event. Notify pair failed if physical link is down. -// --------------------------------------------------------------------------- -// -void CBTNotifIncomingPairingHandler::HandlePhysicalLinkResultL( TInt aResult ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Check if the connection is still alive. - TBool physicalLinkDown = - ( iBbEvent().EventType() == ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ); - - if( aResult || physicalLinkDown ) - { - // link went down. It might be because of pairing failed or the remote device disconnected the - // physical link after a successful pairing. - // we wait for 0.5 secs before notifying the "unable to pair" message as, if the pair is - // successful, we manage it to show the right confirmation message. - SetPairResult( (aResult == 0) ? KErrGeneral : aResult ); - iPairingOkTimer.After(iActivePairingOk->iStatus, KBTNotifWaitingForPairingOkDelay); - iActivePairingOk->GoActive(); - } - else - { - // Uninteresting event, re-subscribe. - MonitorPhysicalLink(); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,553 +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: Pairing handler for local device initiated pairing -* -*/ - -#include "btnotifoutgoingpairinghandler.h" -#include -#include -#include "btnotifsecuritymanager.h" -#include "bluetoothtrace.h" -#include "bluetoothnotification.h" -#include "btnotifserver.h" -#include "btnotifconnectiontracker.h" -#include "btnotificationmanager.h" - -/** Length of the default PIN. */ -const TInt KDefaultHeadsetPinLength = 4; - -/** Maximum repeated outgoing pairing attempt. - * if the pairing fails the UI specs says - * we can ask twice the user if he/she want - * to retry pairing. - */ -const TInt KMaxRepeatedPairingAttempt = 2; - -enum TPairingStageId - { - /** - * no pairing operation ongoing - */ - ENoBonding = 0, - - /** - * pair with dedicated bonding method - */ - EDedicatedBonding = 200, - - /** - * pair with general bonding by establishing L2CAP connection. - */ - EGeneralBonding, - - /** - * delaying next pairing request for a while - */ - EGeneralBondingRetryTimer, - - /** - * The last pairing retry - */ - EGeneralBondingRetry, - - /** - * disconnecting physical link after pairing operation. - * - * todo: not used yet. - */ - EDisconnectLinkAfterBonding, - }; - -/** SDP PSM (used for pairing) */ -const TInt KSDPPSM = 0x0001; - -// Delay time to void Repeated Attempts on pairing -const TInt KGeneralBondingRetryDelayMicroSeconds = 5000000; // 5.0s - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifOutgoingPairingHandler::CBTNotifOutgoingPairingHandler( CBTNotifSecurityManager& aParent, const TBTDevAddr& aAddr) - : CBTNotifBasePairingHandler( aParent, aAddr ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::ConstructL() - { - BaseConstructL(); - User::LeaveIfError( iTimer.CreateLocal() ); - iPairingAttempt = KMaxRepeatedPairingAttempt; - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTNotifBasePairingHandler* CBTNotifOutgoingPairingHandler::NewL( CBTNotifSecurityManager& aParent, - const TBTDevAddr& aAddr ) - { - CBTNotifOutgoingPairingHandler* self = new( ELeave ) CBTNotifOutgoingPairingHandler( aParent, aAddr ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifOutgoingPairingHandler::~CBTNotifOutgoingPairingHandler() - { - if ( iActive ) - { - iActive->Cancel(); - } - iBondingSession.Close(); - iSocket.Close(); - iTimer.Close(); - if( iNotification ) - { - // Clear the notification callback, we cannot receive them anymore. - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - } - -// --------------------------------------------------------------------------- -// Simply deny the request as this is handing outgoing pairing -// --------------------------------------------------------------------------- -// -TInt CBTNotifOutgoingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr ) - { - (void)aAddr; - return KErrServerBusy; - } - -// --------------------------------------------------------------------------- -// Accept the request only this device is not busy with another pairing request. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) - { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," cod 0x%08x", aCod ); - if ( iActive->IsActive() || aAddr != iAddr ) - { - // we don't allow another pairing request. - User::Leave( KErrServerBusy ); - } - iAddr = aAddr; - iCod = TBTDeviceClass( aCod ); - UnSetPairResult(); - iParent.UnpairDevice( iAddr ); - if ( CBtDevExtension::IsHeadset( iCod ) ) - { - // If the devie is a headset, set to 0000 pin auto pairing - iPairMode = EBTOutgoingHeadsetAutoPairing; - } - else - { - iPairMode = EBTOutgoingNoneHeadsetPairing; - } - DoPairingL(); - } - -// --------------------------------------------------------------------------- -// Cancels an outstanding pair request by self-destruct -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::CancelOutgoingPair() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iParent.RenewPairingHandler( NULL ); - if( iNotification ) - { - // Cancel the user query - // This will also unregister us from the notification. - TInt err = iNotification->Close(); - NOTIF_NOTHANDLED( !err ) - iNotification = NULL; - } - } - - -// --------------------------------------------------------------------------- -// when phone initiated a pairing request towards a headset, -// Pin code 0000 is first tried. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::GetPinCode( - TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - aPin().iLength = 0; - if ( aMinPinLength <= KDefaultHeadsetPinLength - && aAddr == iAddr - && iPairMode == EBTOutgoingHeadsetAutoPairing) - { - // if the pairing requires a stronger security level (indicated - // by aMinPinLength), - // 0000 will not be supplied as it does not mmet the security - // requirements - const TUint8 KZeroPinValue = '0'; - for (TInt i = 0; i < KDefaultHeadsetPinLength; ++i) - { - aPin().iPIN[i] = KZeroPinValue; - } - aPin().iLength = KDefaultHeadsetPinLength; - } - } - -// --------------------------------------------------------------------------- -// Abort pairing handling, request the owner to destroy this. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::StopPairHandling( const TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if ( aAddr == iAddr ) - { - iParent.OutgoingPairCompleted( KErrCancel ); - iParent.RenewPairingHandler( NULL ); - if( iNotification ) - { - // Cancel the user query - // This will also unregister us from the notification. - TInt err = iNotification->Close(); - NOTIF_NOTHANDLED( !err ) - iNotification = NULL; - } - } - } - -// --------------------------------------------------------------------------- -// Pairing result will be received when pairing operation completes. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::DoHandlePairServerResult( TInt aResult ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if (aResult == (KHCIErrorBase-EPairingNotAllowed)) - { - // if EPairingNotAllowed is recieved then any further pairing attempts will fail - // so don't attampt to pair - iPairMode = EBTOutgoingPairNone; - } - } - -// --------------------------------------------------------------------------- -// Cancels possible outstanding pairing and notify user pair success. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::DoHandleRegistryNewPairedEvent( - const TBTNamelessDevice& aDev ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TInt err( KErrNone ); - // If pairing was performed using Just Works mode, we set a - // UICookie to indicate that the device is successfully - // bonded so that this device will be listed in paired device view of - // bluetooth application: - if ( aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable ) - { - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNOTIF] Outgoing Pairing, Just Works pairing"); - err = iParent.AddUiCookieJustWorksPaired( aDev ); - } - iActive->Cancel(); - SetPairResult( err ? err : KErrNone ); - if(err == KErrNone){ - TRAP_IGNORE(ShowPairingResultNoteL(err)); - } - iParent.OutgoingPairCompleted( err ); - iParent.RenewPairingHandler( NULL ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// Based on the result code, decides the next operation, either try pairing -// with another mode, or complete pair request. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::RequestCompletedL( - CBtSimpleActive* aActive, TInt aStatus ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstraceExt3(TRACE_DEBUG,DUMMY_DEVLIST,"reqid %d, status: %d, pair mode %d ", aActive->RequestId(), aStatus, iPairMode); - if( aActive->RequestId() == EDedicatedBonding && - ( aStatus == KErrRemoteDeviceIndicatedNoBonding || - ( aStatus && iPairMode != EBTOutgoingNoneHeadsetPairing && iPairMode != EBTOutgoingPairNone ) ) ) - { - // try general pairing if the remote doesn't have dedicated bonding, or - // pairing fails with a headset. - DoPairingL(); - } - else if ( aStatus && iPairMode == EBTOutgoingHeadsetAutoPairing ) - { - iPairMode = EBTOutgoingHeadsetManualPairing; - // auto pairing with headset failed, try to pair again with manual pin: - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST," auto pairing failed, switch to manual pairing"); - DoPairingL(); - } - else if ( aStatus && aActive->RequestId() == EGeneralBonding && - iPairMode == EBTOutgoingHeadsetManualPairing ) - { - // pairing headset with manual pin failed, wait for a while and try again: - iActive->SetRequestId( EGeneralBondingRetryTimer ); - iTimer.After( iActive->iStatus, KGeneralBondingRetryDelayMicroSeconds ); - iActive->GoActive(); - } - else if( aActive->RequestId() == EGeneralBondingRetryTimer ) - { - // try to pair headset again with manual pin again: - DoPairingL(); - } - else if ( aStatus ) - { - // we only starts showing note if pairing failed. - // For a successful pair, we must wait until registry has been updated. - if ( !IsPairResultSet() ) - { - SetPairResult( aStatus ); - } - if ( aStatus ) - { - // retry pairing - if(aStatus && iPairingAttempt > 0) - { - if(aActive->RequestId() == EGeneralBondingRetry && iPairMode == EBTOutgoingHeadsetManualPairing) - { - // Headset pairing failed, reset and try again from auto pairing - iActive->SetRequestId(EGeneralBonding); - } - iPairingAttempt --; - ShowPairingRetryDialog(); - } - else - { - iPairingAttempt --; - ShowPairingFailureDialog(); - } - } - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// cancels an outstanding request according to the given id. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::CancelRequest( TInt aRequestId ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - switch ( aRequestId ) - { - case EDedicatedBonding: - { - iBondingSession.Close(); - break; - } - case EGeneralBonding: - case EGeneralBondingRetry: - { - iSocket.CancelConnect(); - iSocket.Close(); - break; - } - case EGeneralBondingRetryTimer: - { - iTimer.Cancel(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// Handles a leave in RequestCompleted by self-destructing. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::HandleError( - CBtSimpleActive* aActive, TInt aError ) - { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"error: %d", aError ); - // Our RunL can actually not leave, so we should never reach here. - (void) aActive; - iParent.OutgoingPairCompleted( aError ); - iParent.RenewPairingHandler( NULL ); - if( iNotification ) - { - // Cancel the user query - // This will also unregister us from the notification. - TInt err = iNotification->Close(); - NOTIF_NOTHANDLED( !err ) - iNotification = NULL; - } - } - -// --------------------------------------------------------------------------- -// decide the next state and issue pair request -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::DoPairingL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TPairingStageId currentMode = ( TPairingStageId ) iActive->RequestId(); - ASSERT( !iActive->IsActive() ); - TPairingStageId nextMode( EGeneralBonding ); - - // if running BTv2.0 stack, dedicated bonding method - // is not available. - if ( currentMode == ENoBonding && iParent.PairingServer() != NULL ) - { - nextMode = EDedicatedBonding; - } - else if(currentMode == EGeneralBondingRetryTimer) - { - nextMode = EGeneralBondingRetry; - } - - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"[BTENG] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d", currentMode, nextMode); - - iActive->SetRequestId( nextMode ); - if ( nextMode == EDedicatedBonding ) - { - iBondingSession.Start( *iParent.PairingServer(), iAddr, iActive->RequestStatus() ); - } - else - { - TBTServiceSecurity sec; - sec.SetAuthentication( ETrue ); - iSockAddr.SetBTAddr( iAddr ); - iSockAddr.SetPort(KSDPPSM); - iSockAddr.SetSecurity( sec ); - iSocket.Close(); - User::LeaveIfError( iSocket.Open( iParent.SocketServ(), KL2CAPDesC ) ); - iSocket.Connect( iSockAddr, iActive->RequestStatus() ); - } - iActive->GoActive(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// Handle a result from a user query. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::MBRDataReceived( CHbSymbianVariantMap& aData ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - (void) aData; - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// The notification is finished. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::MBRNotificationClosed( TInt aError, const TDesC8& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); - // First unregister from the notification, so we can already get the next one. - iNotification->RemoveObserver(); - iNotification = NULL; - TRAP_IGNORE( NotificationClosedL( aError, aData ) ); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Get and configure a notification. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iNotification = - iParent.ConnectionTracker().NotificationManager()->GetNotification(); - User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory - iNotification->SetObserver( this ); - iNotification->SetNotificationType( aType, aResourceId ); - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iAddr); - if(dev) - { - User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, dev->Alias())); - } - else - { - TBTDeviceName name; - iAddr.GetReadable(name); - User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, name)); - NOTIF_NOTHANDLED( !err ) - } - iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( iNotification); - NOTIF_NOTHANDLED( !err ) - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// The notification is finished, handle the result. -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::NotificationClosedL( TInt aError, const TDesC8& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); - // Read the result. - TPckgC result( EFalse ); - result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result - // Set a pointer descriptor to capture the remaining data, if any. - TPtrC8 dataPtr( aData.Mid( result.Length() ) ); - - if(result() && iPairingAttempt >= 0) - { - HandleOutgoingPairL(iAddr,iCod.DeviceClass()); - } - else - { - iPairingAttempt = KMaxRepeatedPairingAttempt; // reset the counter - iParent.OutgoingPairCompleted( KErrCancel ); - iParent.RenewPairingHandler( NULL ); - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Show a dialog to ask the user to retry the pairing -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::ShowPairingRetryDialog() - { - PrepareNotificationL( TBluetoothDialogParams::EQuery, EPairingFailureRetry); - } - -// --------------------------------------------------------------------------- -// Show a dialog to tell the user pairing retry attempt failed -// --------------------------------------------------------------------------- -// -void CBTNotifOutgoingPairingHandler::ShowPairingFailureDialog() - { - PrepareNotificationL( TBluetoothDialogParams::EQuery, EPairingFailureOk ); - } - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,698 +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 "btnotifpairnotifier.h" -#include "btnotifclientserver.h" -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif -#include "btnotifconnectiontracker.h" -#include "btnotifsecuritymanager.h" -#include "btnotificationmanager.h" -#include "bluetoothnotification.h" -#include "btnotifserver.h" -#include "bluetoothtrace.h" - - -/** Format syntax for numeric comparison value. */ -_LIT( KNumCompFormat, "%06u" ); -/** Format syntax for passkey display value. */ -_LIT( KPassKeyFormat, "%06u" ); - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor. -// --------------------------------------------------------------------------- -// -CBTNotifPairNotifier::CBTNotifPairNotifier( - CBTNotifSecurityManager& aParent ) -: iParent( aParent ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTNotifPairNotifier* CBTNotifPairNotifier::NewL( - CBTNotifSecurityManager& aParent ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - CBTNotifPairNotifier* self = new( ELeave ) CBTNotifPairNotifier( aParent ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -// -CBTNotifPairNotifier::~CBTNotifPairNotifier() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if( iNotification ) - { - // Clear the notification callback, we cannot receive them anymore. - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - iParams.Close(); - if ( !iNotifierMessage.IsNull() ) - { - iNotifierMessage.Complete( KErrServerTerminated ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Handle a notifier request for pairing with a remote device. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::StartPairingNotifierL(const RMessage2& aMessage ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - - TInt uid = aMessage.Int0(); - TInt opCode = aMessage.Function(); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Opcode: %d",opCode); - - if ( (!iNotifierMessage.IsNull()) && - (opCode != EBTNotifCancelNotifier )&&(opCode != EBTNotifUpdateNotifier)) - { - // todo: do we allow concurrent pairing? - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); - User::Leave(KErrServerBusy ); - } - - if(opCode == EBTNotifCancelNotifier){ - CancelPairingNotifierL(uid); - aMessage.Complete(KErrNone); - return; - } - - // Store the parameters locally, we need them later again. - iParams.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); - aMessage.ReadL( EBTNotifSrvParamSlot, iParams ); - iNotifierMessage = aMessage; - - // Read the notifier parameters - ParseNotifierReqParamsL(); - - if(opCode ==EBTNotifUpdateNotifier ){ - UpdatePairingNotifierL(uid,iParams); - aMessage.Complete(KErrNone); - return; - } - - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - if(dev) - { - if (!iLocallyInitiated && dev->Device().GlobalSecurity().Banned() ) - { - // If the device is banned and pairing is not locally initiated - // then we reject. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); - iNotifierMessage.Complete( KErrCancel ); - return; - } - if (iLocallyInitiated && dev->Device().GlobalSecurity().Banned()) - { - // Remove the banned device from the blocking history - iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),ETrue); - iParent.BlockDevice(dev->Addr(),EFalse); - } - if(0 != dev->Device().FriendlyName().Length()&& dev->Device().IsValidFriendlyName()) - { - // If we have a friendly name use it for the UI - iCurrentDeviceName = dev->Device().FriendlyName(); - } - else - { - // We don't have any friendly name then chek if we have the device name - // otherwise use the Alias - if(0 >= iCurrentDeviceName.Length()) - { - iCurrentDeviceName = dev->Alias(); - } - } - } - else - { - //If we didn't get a name then we make one from the Bluetooth device address - if(0 >= iCurrentDeviceName.Length()) - { - iRemote.GetReadable(iCurrentDeviceName); - } - } - // If this is an incoming pairing, we first ask the user to accept it. - if( !iLocallyInitiated ) - { - User::LeaveIfError(iParent.SetPairObserver(iRemote,ETrue)); - StartAcceptPairingQueryL(); - } - else - { - TInt uid = iNotifierMessage.Int0(); - if(uid == KBTNumericComparisonNotifierUid.iUid) - { - StartPairingUserInputL(); - } - else - { - TBTPinCode pinCode; - if ( iMinPinLength > -1 ) - { - // Legacy Pin pairing. Check if a pin code is already available - // in pairing manager for this device: - iParent.GetPinCode( pinCode, iRemote, iMinPinLength ); - } - if ( pinCode().iLength > 0 ) - { - // a pin is ready for this pairing. - // write it back to client (stack) - TInt err = iNotifierMessage.Write( EBTNotifSrvReplySlot, pinCode ); - iNotifierMessage.Complete( err ); - } - else - { - // no pin code is available or a pin code does not meet - // the security requirement. - // User need to interact: - StartPairingUserInputL(); - } - } - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Update a notifier, update the outstanding dialog if the notifier request -// is currently being served. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::UpdatePairingNotifierL( TInt aUid, const TDesC8& aParams ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - (void) aUid; - TBTNotifierUpdateParams2 params; // Enough for reading the base class type parameter - TPckgC paramsPckg( params ); - paramsPckg.Set( aParams ); - if( paramsPckg().Type() == TBTNotifierUpdateParams2::EPasskeyDisplay ) - { - // Paskey display update - keypress on remote device. - } - else - { - // name update - TBTDeviceNameUpdateParams nameUpdate; - TPckgC nameUpdatePckg( nameUpdate ); - nameUpdatePckg.Set( aParams ); - // The result means result of conversion to unicode - if( !nameUpdatePckg().Result() ) - { - // Check first if we already have a friendly name - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - if(dev) - { - if(0 != dev->Device().FriendlyName().Length()&& dev->Device().IsValidFriendlyName()) - { - return; - } - // We don't have a friendly name then use this name - iCurrentDeviceName = nameUpdatePckg().DeviceName(); - if(0 == iCurrentDeviceName.Length()) - { - // The new name is empty then use the Alias - iCurrentDeviceName = dev->Alias(); - } - } - else - { - // We don't have a friendly name then use this name - iCurrentDeviceName = nameUpdatePckg().DeviceName(); - if(0 == iCurrentDeviceName.Length()) - { - // The new name is empty then use the Alias - iRemote.GetReadable(iCurrentDeviceName); - } - } - if( iNotification ) - { - // Update the dialog with the new name. It is up to the dialog to - // determine the validity (in case another dialog is shown). - iNotification->Update(iCurrentDeviceName); - } - } - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Cancel a request, dismiss the outstanding dialog if the notifier request -// is currently being served. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::CancelPairingNotifierL( TInt aUid ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if( iNotifierMessage.Int0() == aUid ) - { - if( iNotification ) - { - // Cancel the user query - // This will also unregister us from the notification. - TInt err = iNotification->Close(); - NOTIF_NOTHANDLED( !err ) - iNotification = NULL; - } - // todo: Any bonding requester needs to be informed. - // Currently we don't show any "Unable to pair" note - // so no need to inform any bonding requester. - if ( !iNotifierMessage.IsNull() ) - { - iNotifierMessage.Complete( KErrCancel ); - } - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// Handle a result from a user query. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::MBRDataReceived( CHbSymbianVariantMap& aData ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) - { - TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); - if(val) - { - iAcceptPairingResult = ETrue; - } - else - { - iAcceptPairingResult = EFalse; - } - } - else if(aData.Keys().MdcaPoint(0).Compare(_L("checkBoxState")) == 0) - { - iCheckBoxState = *(static_cast(aData.Get(_L("checkBoxState"))->Data())); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// The notification is finished. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::MBRNotificationClosed( TInt aError, const TDesC8& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); - // First unregister from the notification, so we can already get the next one. - iNotification->RemoveObserver(); - iNotification = NULL; - TRAP_IGNORE( NotificationClosedL( aError, aData ) ); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Request a user input for the outstanding pairing request. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::StartPairingUserInputL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - PrepareNotificationL( iDialog, iDialogResource ); - iState = EPairingInputConfirm; - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Process the user input and complete the outstanding pairing request. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::CompletePairingNotifierL( TInt aError, TBool aResult, - const TDesC8& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); - if ( iNotifierMessage.IsNull() ) - { - // Request not anymore active -> ignore - return; - } - TInt err = aError; - TPtrC8 resultData(KNullDesC8); - TBTPinCode pinCode; - TPckgBuf userAcceptance; - TInt uid = iNotifierMessage.Int0(); - - if( !err ) - { - // The returned data is the entered passkey. - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - if(dev) - { - iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),aResult); - } - if( uid == KBTNumericComparisonNotifierUid.iUid ) - { - // Numeric comparison needs the boolean result passed back. - userAcceptance() = aResult; - resultData.Set( userAcceptance ); - } - if( aResult ) - { - if( uid == KBTManPinNotifierUid.iUid - || uid == KBTPinCodeEntryNotifierUid.iUid ) - { - // Check the passkey entered by the user. - // The length of the returned data equals the number of characters - // entered by the user. - // Check that the passkey length do not exceed the maximum allowed size - TInt pinCodeLength = aData.Length(); - if(pinCodeLength > KHCIPINCodeSize) - { - pinCodeLength = KHCIPINCodeSize; - } - pinCode().iLength = pinCodeLength; - // Check that the length of the passkey meets the minimum - // required pin code length - if( pinCodeLength >= iMinPinLength ) - { - for( TInt i = 0; i < pinCodeLength; i++ ) - { - pinCode().iPIN[i] = aData[i]; - } - resultData.Set( pinCode ); - } - else - { - // shouldn't happen since the length is checked in the dialog - err = KErrCompletion; - } - } - } - else - { - err = KErrCancel; - } - } - // Complete the message with the result, and result data if any. - if ( !err && resultData.Length() ) - { - err = iNotifierMessage.Write( EBTNotifSrvReplySlot, resultData ); - } - if(err && (uid == KBTNumericComparisonNotifierUid.iUid)) - { - // We need to reject the numeric comparaison otherwise - // the link will remain active - userAcceptance() = aResult; - resultData.Set( userAcceptance ); - err = iNotifierMessage.Write( EBTNotifSrvReplySlot, resultData ); - } - iNotifierMessage.Complete( err ); - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - -// --------------------------------------------------------------------------- -// Ask the user to allow incoming pairing. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::StartAcceptPairingQueryL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - PrepareNotificationL( TBluetoothDialogParams::EUserAuthorization, EAuthorization ); - iState = EIncomingPairingAcceptconfirm; - // if rejected, the client message is completed in CompleteAcceptPairingQueryL - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// The user was asked to accept an incoming pairing. Process and proceed. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::CompleteAcceptPairingQueryL( TInt aError) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TInt err = aError; - TBool proceed = EFalse; - - if( !err ) - { - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - if(dev) - { - proceed = iParent.ConnectionTracker().UpdateBlockingHistoryL(&dev->Device(),iAcceptPairingResult); - } - if( iAcceptPairingResult ) - { - // User accepted, continue to show pairing query. - // Trust the device - if(iCheckBoxState){ - iParent.TrustDevice(iRemote); - } - StartPairingUserInputL(); - } - else - { - if( proceed && iCheckBoxState ) - { - //ask to block the device. - iParent.BlockDevice(iRemote,proceed); - } - err = iParent.SetPairObserver(iRemote,EFalse); - err = KErrCancel; // We need to complete the pairing request here - } - } - if( err ) - { - // The user denied the connection, or something else prevented completion. - CompletePairingNotifierL( err, EFalse, KNullDesC8 ); - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Parse the parameters of a request for pairing. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ParseNotifierReqParamsL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - // Reset to make sure all vars contain initial values. - iLocallyInitiated = EFalse; - iDialogNumeric.Zero(); - iDialog = TBluetoothDialogParams::EInvalidDialog; - iDialogResource = ENoResource; - iRemote = TBTDevAddr(); - iMinPinLength = -1; - - TInt uid = iNotifierMessage.Int0(); - // Reset for other pairing modes than PIN code. - // Determine the notifier type by the length of the parameter buffer - if( uid == KBTManPinNotifierUid.iUid || uid == KBTPinCodeEntryNotifierUid.iUid ) - { - if ( uid == KBTManPinNotifierUid.iUid ) - { - ParseLegacyPinCodeReqParamsL( iLocallyInitiated, iMinPinLength, iRemote ); - } - else - { - ParsePinCodeReqParamsL( iLocallyInitiated, iMinPinLength, iRemote ); - } - iDialog = TBluetoothDialogParams::EInput; - iDialogResource = EPinInput; - } - else if( uid == KBTNumericComparisonNotifierUid.iUid ) - { - ParseNumericCompReqParamsL( iLocallyInitiated, iDialogNumeric, iRemote ); - iDialog = TBluetoothDialogParams::EQuery; - iDialogResource = ENumericComparison; - } - else if( uid == KBTPasskeyDisplayNotifierUid.iUid ) - { - ParsePasskeyDisplayReqParamsL( iLocallyInitiated, iDialogNumeric, iRemote ); - iDialog = TBluetoothDialogParams::EQuery; - iDialogResource = EPasskeyDisplay; - } - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Parse the parameters of a request for pairing using pin query. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ParseLegacyPinCodeReqParamsL( TBool& aLocallyInitiated, - TInt& aMinPinLength, TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TBTPasskeyNotifierParams params; - TPckgC paramsPckg( params ); - paramsPckg.Set( iParams ); - aLocallyInitiated = paramsPckg().iLocallyInitiated; - aMinPinLength = paramsPckg().iPasskeyMinLength; - aAddr = paramsPckg().iBDAddr; - iCurrentDeviceName = paramsPckg().iName; - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Parse the parameters of a request for pairing using pin query. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ParsePinCodeReqParamsL( TBool& aLocallyInitiated, - TInt& aMinPinLength, TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TBTPinCodeEntryNotifierParams params; - TPckgC paramsPckg( params ); - paramsPckg.Set( iParams ); - aLocallyInitiated = paramsPckg().LocallyInitiated(); - aMinPinLength = paramsPckg().PinCodeMinLength(); - aAddr = paramsPckg().DeviceAddress(); - iCurrentDeviceName = paramsPckg().DeviceName(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Parse the parameters of a request for pairing using numeric comparison. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ParseNumericCompReqParamsL( TBool& aLocallyInitiated, - TDes& aNumVal, TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TBTNumericComparisonParams params; - TPckgC paramsPckg( params ); - paramsPckg.Set( iParams ); - aLocallyInitiated = paramsPckg().LocallyInitiated(); - TBTNumericComparisonParams::TComparisonScenario scenario = - paramsPckg().ComparisonScenario(); - aNumVal.Format( KNumCompFormat, paramsPckg().NumericalValue() ); - aNumVal.Insert(3,_L(" ")); - aAddr = paramsPckg().DeviceAddress(); - iCurrentDeviceName = paramsPckg().DeviceName(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Parse the parameters of a request for pairing using passkey display. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::ParsePasskeyDisplayReqParamsL( TBool& aLocallyInitiated, - TDes& aNumVal, TBTDevAddr& aAddr ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - TBTPasskeyDisplayParams params; - TPckgC paramsPckg( params ); - paramsPckg.Set( iParams ); - aLocallyInitiated = paramsPckg().LocallyInitiated(); - aNumVal.Format( KPassKeyFormat, paramsPckg().NumericalValue() ); - aAddr = paramsPckg().DeviceAddress(); - iCurrentDeviceName = paramsPckg().DeviceName(); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Get and configure a notification. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId ) - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - iNotification = - iParent.ConnectionTracker().NotificationManager()->GetNotification(); - User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory - iNotification->SetObserver( this ); - iNotification->SetNotificationType( aType, aResourceId ); - TInt err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, iCurrentDeviceName ); - NOTIF_NOTHANDLED( !err ) - TBTDeviceName name; - iRemote.GetReadable(name); - err = iNotification->SetData( TBluetoothDialogParams::EAddress, name ); - NOTIF_NOTHANDLED( !err ) - const CBtDevExtension* dev = iParent.BTDevRepository().Device(iRemote); - TInt classofdevice = 0; - if(dev) - { - if(dev->Device().IsValidDeviceClass()) - { - classofdevice = dev->Device().DeviceClass().DeviceClass(); - } - } - err = iNotification->SetData( (TInt) TBluetoothDeviceDialog::EDeviceClass, - classofdevice ); - if( iDialogNumeric.Length() ) - { - err = iNotification->SetData( - TBluetoothDeviceDialog::EAdditionalDesc, iDialogNumeric ); - } - err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EPairingRequest); - iCheckBoxState = ETrue; - iAcceptPairingResult = EFalse; - iParent.ConnectionTracker().NotificationManager()->QueueNotificationL( iNotification); - NOTIF_NOTHANDLED( !err ) - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// The notification is finished, handle the result. -// --------------------------------------------------------------------------- -// -void CBTNotifPairNotifier::NotificationClosedL( TInt aError, const TDesC8& aData ) - { - BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); - // Read the result. - TPckgC result( EFalse ); - result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result - // Set a pointer descriptor to capture the remaining data, if any. - TPtrC8 dataPtr( aData.Mid( result.Length() ) ); - - if ( iState == EIncomingPairingAcceptconfirm ) - { - CompleteAcceptPairingQueryL(aError); - } - else - { - CompletePairingNotifierL( aError, result(), dataPtr ); - } - BOstraceFunctionExit1( DUMMY_DEVLIST, this ); - } - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,860 +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 "btnotifsecuritymanager.h" -#include "btnotifoutgoingpairinghandler.h" -#include "btnotifincomingpairinghandler.h" -#include "btnotifpairnotifier.h" -#include "btnotifclientserver.h" -#include -#include "btnotifconnectiontracker.h" -#include "btnotifserviceauthorizer.h" - -/** Identification for active object */ -enum TPairManActiveRequestId - { - ESimplePairingResult, - EAuthenticationResult, - ERegistryGetLocalAddress, - }; - -// --------------------------------------------------------------------------- -// Tells if two TBTNamelessDevice instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool CompareDeviceByAddress( const TBTNamelessDevice& aDevA, const TBTNamelessDevice& aDevB ) - { - return aDevA.Address() == aDevB.Address(); - } - -// --------------------------------------------------------------------------- -// Tells if these two instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const TBTNamelessDevice& aDev) - { - return *aAddr == aDev.Address(); - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifSecurityManager::CBTNotifSecurityManager( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository) - : iParent( aParent ), iDevRepository( aDevRepository ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::ConstructL() - { - // Connect to pairing server for authentication & simple pairing - // results directly from the BT stack. - // Pairing server doesn't exist if we run BT 2.0 stack: - iPairingServ = new (ELeave) RBluetoothPairingServer; - TInt err = iPairingServ->Connect(); - if ( err) - { - delete iPairingServ; - iPairingServ = NULL; - } - else - { - User::LeaveIfError( iPairingResult.Open( *iPairingServ ) ); - User::LeaveIfError( iAuthenResult.Open( *iPairingServ ) ); - iSSPResultActive = CBtSimpleActive::NewL( *this, ESimplePairingResult ); - iAuthenResultActive = CBtSimpleActive::NewL( *this, EAuthenticationResult ); - SubscribeSspPairingResult(); - SubscribeAuthenticateResult(); - } - User::LeaveIfError( iRegistry.Open( iParent.RegistryServerSession() ) ); - // RProperty for accessing the local device address - User::LeaveIfError( iPropertyLocalAddr.Attach( - KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetLocalDeviceAddress) ); - // Initialise paired devices list - iLocalAddrActive = CBtSimpleActive::NewL( *this, ERegistryGetLocalAddress ); - SubscribeLocalAddress(); - iPairNotifier = CBTNotifPairNotifier::NewL( *this ); - iDevRepository.AddObserverL( this ); - iServiceAuthorizer = CBTNotifServiceAuthorizer::NewL(*this); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBTNotifSecurityManager* CBTNotifSecurityManager::NewL( - CBTNotifConnectionTracker& aParent, - CBtDevRepository& aDevRepository ) - { - CBTNotifSecurityManager* self = NULL; - self = new CBTNotifSecurityManager( aParent, aDevRepository ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifSecurityManager::~CBTNotifSecurityManager() - { - delete iSSPResultActive; - delete iAuthenResultActive; - delete iPairNotifier; - delete iPairingHandler; - iPairedDevices.Close(); - iPairingResult.Close(); - iAuthenResult.Close(); - if ( iPairingServ ) - { - iPairingServ->Close(); - delete iPairingServ; - } - iRegistry.Close(); - delete iLocalAddrActive; - iPropertyLocalAddr.Close(); - if ( !iMessage.IsNull() ) - { - iMessage.Complete( KErrCancel ); - } - delete iServiceAuthorizer; - } - -// --------------------------------------------------------------------------- -// Initialises the paired devices list. -// If the local address is not available from the P&S key -// KPropertyKeyBluetoothGetLocalDeviceAddress, then the list may need to be -// updated once the H/W is switched on. This is so that any registry update -// from a restore operation can be included in the list, without mistaking the -// new devices for new pairings. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::SubscribeLocalAddress() - { - // Check that we have the Bluetooth local address. If we don't then initialise anyway, but subscribe for an update. - // This allows us to refresh our paired devices list to include updates made to the remote devices table of the - // Bluetooth registry from a restore operation. We need to include these devices without mistaking them for new - // pairings. We look solely at the P&S key for the address to avoid the condition whereby the address has been - // entered into the reigstry but the Bluetooth Manager server has not begun the restore process yet. The signalling - // of the P&S key will cause Bluetooth Manager to update the registry with any restored devices before fulfilling - // any further requests. - - // Subscribe to local address property in case we need an update. - iPropertyLocalAddr.Subscribe( iLocalAddrActive->iStatus ); - iLocalAddrActive->SetRequestId( ERegistryGetLocalAddress ); - iLocalAddrActive->GoActive(); - } - -// --------------------------------------------------------------------------- -// Tells whether the local address is available from the P&S key -// KPropertyKeyBluetoothGetLocalDeviceAddress. -// --------------------------------------------------------------------------- -// -TBool CBTNotifSecurityManager::IsLocalAddressAvailable() - { - // Attempt to read address from P&S key. - TBuf8 btAddrDes; - TInt err = iPropertyLocalAddr.Get( btAddrDes ); - - // Is the P&S key defined yet? (if not, stack not up yet) - if ( err == KErrNone ) - { - // P&S key defined, is local address set? (if not, H/W not initialised yet) - if ( btAddrDes.Length() == KBTDevAddrSize ) - { - TBTDevAddr btAddr = btAddrDes; - if ( btAddr != TBTDevAddr() ) - { - return ETrue; - } - } - } - return EFalse; - } - -// --------------------------------------------------------------------------- -// Handles pairing related requests from BTNotif clients. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::HandleBondingRequestL( const RMessage2& aMessage ) - { - TInt opcode = aMessage.Function(); - TBTDevAddrPckgBuf addrPkg; - switch( opcode ) - { - case EBTNotifPairDevice: - { - if ( !iMessage.IsNull() ) - { - User::Leave( KErrServerBusy ); - } - TBTDevAddrPckgBuf addrPkg; - aMessage.ReadL( EBTNotifSrvParamSlot, addrPkg ); - BlockDevice(addrPkg(),EFalse); - UnpairDevice( addrPkg() ); - PairDeviceL( addrPkg(), aMessage.Int2() ); - iMessage = RMessage2( aMessage ); - break; - } - case EBTNotifCancelPairDevice: - { - // Only the client who requested pairing can cancel it: - if ( !iMessage.IsNull() && aMessage.Session() == iMessage.Session() ) - { - iPairingHandler->CancelOutgoingPair(); - iMessage.Complete( KErrCancel ); - } - aMessage.Complete( KErrNone ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -// --------------------------------------------------------------------------- -// Process a client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::HandleNotifierRequestL( const RMessage2& aMessage ) - { - if(aMessage.Int0() == KBTManAuthNotifierUid.iUid) - { - iServiceAuthorizer->StartNotifierL( aMessage ); - } - else - { - iPairNotifier->StartPairingNotifierL( aMessage ); - } - - BOstraceFunctionExit0( DUMMY_DEVLIST); - } - -// --------------------------------------------------------------------------- -// Returns the RBluetoothPairingServer instance. -// --------------------------------------------------------------------------- -// -RBluetoothPairingServer* CBTNotifSecurityManager::PairingServer() - { - return iPairingServ; - } - -// --------------------------------------------------------------------------- -// Access the reference of RSockServ -// --------------------------------------------------------------------------- -// -RSocketServ& CBTNotifSecurityManager::SocketServ() - { - return iParent.SocketServerSession(); - } - -// --------------------------------------------------------------------------- -// Access the reference of RBTRegSrv -// --------------------------------------------------------------------------- -// -CBtDevRepository& CBTNotifSecurityManager::BTDevRepository() - { - return iDevRepository; - } - -// --------------------------------------------------------------------------- -// Access the reference of CBTNotifConnectionTracker -// --------------------------------------------------------------------------- -// -CBTNotifConnectionTracker& CBTNotifSecurityManager::ConnectionTracker() - { - return iParent; - } - -// --------------------------------------------------------------------------- -// Deletes the current pairing handler and transfer the responsibility -// to the specified. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::RenewPairingHandler( - CBTNotifBasePairingHandler* aPairingHandler ) - { - delete iPairingHandler; - iPairingHandler = aPairingHandler; - } - -// --------------------------------------------------------------------------- -// Find the session who requested this and completes its request. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::OutgoingPairCompleted( TInt aErr ) - { - // the meaning of KHCIErrorBase equals KErrNone. Hide this specific BT stack - // detail from clients: - if ( !iMessage.IsNull() ) - { - iMessage.Complete( (aErr == KHCIErrorBase) ? KErrNone : aErr ); - } - } - -// --------------------------------------------------------------------------- -// A session will be ended, completes the pending request for this session. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::SessionClosed( CSession2* aSession ) - { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," session %x", aSession); - if ( !iMessage.IsNull() && iMessage.Session() == aSession ) - { - iMessage.Complete( KErrCancel ); - } - } - -// --------------------------------------------------------------------------- -// Unpair the device from registry -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::UnpairDevice( const TBTDevAddr& aAddr ) - { - TIdentityRelation addrComp( CompareDeviceByAddress ); - TBTNamelessDevice dev; - dev.SetAddress( aAddr ); - // only do unpairing if the we have a link key with it. - TInt index = iPairedDevices.Find( dev, addrComp ); - if ( index > KErrNotFound ) - { - dev = iPairedDevices[index]; - TRequestStatus status( KRequestPending ); - // Unpair the device in registry (synchronously) - iRegistry.UnpairDevice( dev.Address(), status ); - User::WaitForRequest( status ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Delete link key, res %d", status.Int()); - if ( status == KErrNone ) - { - TBTDeviceSecurity security = dev.GlobalSecurity(); - // Clear trust setting so that correct icon will be shown in ui applications. - security.SetNoAuthenticate(EFalse ); - security.SetNoAuthorise(EFalse ); - dev.SetGlobalSecurity(security); - dev.DeleteLinkKey(); - if ( dev.IsValidUiCookie() && - ( dev.UiCookie() & EBTUiCookieJustWorksPaired ) ) - { - // Remove the UI cookie bit for Just Works pairing. - TInt32 cookie = dev.UiCookie() & ~EBTUiCookieJustWorksPaired; - dev.SetUiCookie( cookie ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UI cookie %x cleared", EBTUiCookieJustWorksPaired ); - } - // modify the device in registry synchronously - // status.Int() could be -1 if the device is not in registry - // which is totally fine for us. - (void) UpdateRegDevice( dev ); - } - } - } - -void CBTNotifSecurityManager::BlockDevice( const TBTDevAddr& aAddr , TBool aBanned) - { - TIdentityRelation addrComp( CompareDeviceByAddress ); - TBTNamelessDevice dev; - dev.SetAddress( aAddr ); - TRequestStatus status( KRequestPending ); - // Unpair the device in registry (synchronously) - iRegistry.GetDevice(dev,status); - User::WaitForRequest( status ); - if(status == KErrNone) - { - TBTDeviceSecurity security = dev.GlobalSecurity(); - security.SetBanned(aBanned); - if ( aBanned ) - { - security.SetNoAuthorise(EFalse); - } - dev.SetGlobalSecurity(security); - (void)UpdateRegDevice(dev); - } - } - -TInt CBTNotifSecurityManager::AddUiCookieJustWorksPaired( const TBTNamelessDevice& aDev ) - { - TInt err( KErrNone ); - // There might be UI cookies used by other applications, - // we should not overwrite them. - TInt32 cookie = aDev.IsValidUiCookie() ? aDev.UiCookie() : EBTUiCookieUndefined; - if ( !( cookie & EBTUiCookieJustWorksPaired ) ) - { - // Only update the cookie if the wanted one is not in registry yet - // to keep minimal operations with registry. - TBTNamelessDevice dev = aDev; - cookie |= EBTUiCookieJustWorksPaired; - dev.SetUiCookie( cookie ); - err = UpdateRegDevice( dev ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Outgoing Pairing write Ui cookie ret %d", err ); - } - return err; - } - -// --------------------------------------------------------------------------- -// update a nameless device in registry -// --------------------------------------------------------------------------- -// -TInt CBTNotifSecurityManager::UpdateRegDevice( const TBTNamelessDevice& aDev ) - { - TRequestStatus status( KRequestPending ); - // update the device in registry synchronously - iRegistry.ModifyDevice( aDev, status ); - User::WaitForRequest( status ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UpdateRegDevice, ret %d", status.Int()); - return status.Int(); - } - -// --------------------------------------------------------------------------- -// 0000 for outgoing pairing with a headset. -// The placeholder for future extension (pin code passed in for pairing) -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::GetPinCode( - TBTPinCode& aPin, const TBTDevAddr& aAddr, TInt aMinPinLength ) - { - if ( iPairingHandler ) - { - iPairingHandler->GetPinCode( aPin, aAddr, aMinPinLength ); - } - else - { - // make sure not to leave any text as PIN. - aPin.Zero(); - aPin().iLength = 0; - } - } - -// --------------------------------------------------------------------------- -// Ask server class the connection status of the specified device -// --------------------------------------------------------------------------- -// -TBTEngConnectionStatus CBTNotifSecurityManager::ConnectStatus( const TBTDevAddr& aAddr ) - { - const CBtDevExtension* devExt = iDevRepository.Device(aAddr); - TBTEngConnectionStatus status = EBTEngNotConnected; - if ( devExt ) - { - status = devExt->ServiceConnectionStatus(); - } - return status; - } - -// --------------------------------------------------------------------------- -// From class MBTNotifPairingAOObserver. -// Checks if there is an authentication result. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"aId: %d, aStatus: %d", aActive->RequestId(), aStatus); - // Check which request is completed. - switch( aActive->RequestId() ) - { - case ESimplePairingResult: - { - TBTDevAddr tmpAddr = iSimplePairingRemote; - if (aStatus != KErrServerTerminated) - { - SubscribeSspPairingResult(); - } - HandlePairingResultL( tmpAddr, aStatus ); - break; - } - case EAuthenticationResult: - { - TBTDevAddr tmpAddr = iAuthenticateRemote; - if (aStatus != KErrServerTerminated) - { - SubscribeAuthenticateResult(); - } - HandlePairingResultL( tmpAddr, aStatus ); - break; - } - case ERegistryGetLocalAddress: - { - TBool value = IsLocalAddressAvailable(); - SubscribeLocalAddress(); - if ( value ) - { - // Refresh paired devices list to include any restored devices. - iDevRepository.ReInitialize(); - } - break; - } - default: - // Should not be possible, but no need for handling. - break; - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngActiveObserver. -// cancels an outstanding request according to the given id. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::CancelRequest( TInt aRequestId ) - { - switch ( aRequestId ) - { - case ESimplePairingResult: - { - // Cancel listening Simple pairing result - iPairingResult.CancelSimplePairingResult(); - break; - } - case EAuthenticationResult: - { - // Cancel listening authentication result - iAuthenResult.CancelAuthenticationResult(); - break; - } - case ERegistryGetLocalAddress: - { - // cancel listening local address status change - iPropertyLocalAddr.Cancel(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"request id: %d, error: %d", aActive->RequestId(), aError); - (void) aActive; - (void) aError; - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::RepositoryInitialized() - { - TRAPD(err, UpdatePairedDeviceListL() ); - if ( !err && iPairingHandler ) - { - // non-null pairing handler means we are involved in a - // pairing operation already. - // todo: is some handling for above case needed? - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::DeletedFromRegistry( const TBTDevAddr& aAddr ) - { - // We are only interested in the removal of a paired device. - // thus check whether it is in our local paired list: - TInt i = iPairedDevices.Find( aAddr, MatchDeviceAddress); - if ( i > KErrNotFound ) - { - iPairedDevices.Remove( i ); - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::AddedToRegistry( const CBtDevExtension& aDevice ) - { - // We are only interested in paired device. - if ( CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) - { - TRAP_IGNORE( - HandleRegistryBondingL( aDevice.Device().AsNamelessDevice() ) ); - } - } - - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::ChangedInRegistry( - const CBtDevExtension& aDevice, TUint aSimilarity ) - { - // We are only interested in paired device. - // thus check whether it is in our local paired list: - TInt i = iPairedDevices.Find( aDevice.Addr(), MatchDeviceAddress); - TBool bonded = CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ); - if ( i == KErrNotFound ) - { - if ( bonded ) - { - TRAP_IGNORE( - HandleRegistryBondingL( - aDevice.Device().AsNamelessDevice() ) ); - } - return; - } - // Device was inregistry before, but we need to evaluate its bonding - // status. - // The given similarity will tell if the linkkey and paired is changed - // or not. - TInt pairingProperty = TBTNamelessDevice::EIsPaired - | TBTNamelessDevice::ELinkKey; - if ( ( pairingProperty & aSimilarity) == pairingProperty ) - { - // no pairing or linkkey change. Nothing to do for pairing handling. - // but we'd better update local copy just in case other data - // of this device is needed by someone: - iPairedDevices[i] = aDevice.Device().AsNamelessDevice(); - return; - } - if ( !CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ) ) - { - // device is not user-bonded. - iPairedDevices.Remove( i ); - return; - } - // it is a new paired device if its link-key has been upgraded - if ( aDevice.Device().LinkKeyType() != ELinkKeyUnauthenticatedUpgradable ) - { - iPairedDevices.Remove( i ); - TRAP_IGNORE( - HandleRegistryBondingL( - aDevice.Device().AsNamelessDevice() ) ); - } - } - -// --------------------------------------------------------------------------- -// From class MBtDevRepositoryObserver. -// This class is not interested in such events. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::ServiceConnectionChanged( - const CBtDevExtension& aDevice, TBool aConnected ) - { - (void) aDevice; - (void) aConnected; - } - -// --------------------------------------------------------------------------- -// Activate or deactivate a pairing handler -// --------------------------------------------------------------------------- -// -TInt CBTNotifSecurityManager::SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate) - { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"%d", aActivate); - BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); - TInt err( KErrNone ); - if ( !aActivate ) - { - if ( iPairingHandler ) - { - iPairingHandler->StopPairHandling( aAddr ); - } - return err; - } - - if ( !iPairingHandler) - { - // This is an incoming pair, unpair it from registry and - // create the handler: - UnpairDevice( aAddr ); - TRAP( err, iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr )); - } - if ( iPairingHandler) - { - // let the handler decide what to do: - err = iPairingHandler->ObserveIncomingPair( aAddr ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Delegates the request to current pair handler -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::PairDeviceL( const TBTDevAddr& aAddr, TUint32 aCod ) - { - if ( !iPairingHandler) - { - // no existing pair handling, create one: - iPairingHandler = CBTNotifOutgoingPairingHandler::NewL( *this, aAddr ); - } - // let pair handler decide what to do: - iPairingHandler->HandleOutgoingPairL( aAddr, aCod ); - } - -// --------------------------------------------------------------------------- -// cancel Subscribings to simple pairing result and authentication result from -// Pairing Server -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::CancelSubscribePairingAuthenticate() - { - if( iSSPResultActive ) - { - // Cancel listening Simple pairing result - iSSPResultActive->Cancel(); - } - if( iAuthenResultActive ) - { - iAuthenResultActive->Cancel(); - } - } - -// --------------------------------------------------------------------------- -// Subscribes to simple pairing result from Pairing Server (if not already -// subscribed). -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::SubscribeSspPairingResult() - { - if ( !iSSPResultActive->IsActive() ) - { - iPairingResult.SimplePairingResult( iSimplePairingRemote, iSSPResultActive->RequestStatus() ); - iSSPResultActive->GoActive(); - } - } - -// --------------------------------------------------------------------------- -// Subscribes to authentication result from Pairing Server (if not already -// subscribed). -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::SubscribeAuthenticateResult() - { - if ( !iAuthenResultActive->IsActive() ) - { - // Subscribe authentication result (which requires pairing for unpaired devices) - iAuthenResult.AuthenticationResult( iAuthenticateRemote, iAuthenResultActive->RequestStatus() ); - iAuthenResultActive->GoActive(); - } - } - -// --------------------------------------------------------------------------- -// Handle a pairing result from the pairing server. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ) - { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"result %d", aResult); - BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); - - if ( !iPairingHandler && ( aResult == KErrNone || aResult == KHCIErrorBase ) ) - { - // we only create new handler if incoming pairing succeeds. - // Pairing failure could be caused by user local cancellation, as the - // result, the handler was destroyed by notifier. We shall not - // instantiate the handler again. - // If a pairing failed due to other reasons than user local cancelling, - // it will be catched by the already started handler - // (except Just Works pairing - no handler for it at all until we receive - // registry change event. Thus if incoming JWs pairing failed, no user - // notification will be shown.) - iPairedDevices.Find( aAddr, MatchDeviceAddress); - TInt index = iPairedDevices.Find( aAddr, MatchDeviceAddress); - // If the device is not found in the old paired device list, it is a new - // paired device: - if ( index == KErrNotFound) - { - // No handler yet, create incoming pairing handler: - iPairingHandler = CBTNotifIncomingPairingHandler::NewL( *this, aAddr ); - } - } - if ( iPairingHandler ) - { - iPairingHandler->HandlePairServerResult( aAddr, aResult ); - } - } - -// --------------------------------------------------------------------------- -// copy the nameless devices to local array -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::UpdatePairedDeviceListL() - { - iPairedDevices.Reset(); - const RDevExtensionArray& alldevs = iDevRepository.AllDevices(); - for ( TInt i = 0; i < alldevs.Count(); i++ ) - { - if ( CBtDevExtension::IsBonded( alldevs[i]->Device().AsNamelessDevice() ) ) - { - iPairedDevices.AppendL( alldevs[i]->Device().AsNamelessDevice() ); - } - } - } - -// --------------------------------------------------------------------------- -// Create incoming pairing handler if no one exists yet. -// --------------------------------------------------------------------------- -// -void CBTNotifSecurityManager::HandleRegistryBondingL( - const TBTNamelessDevice& aNameless) - { - TInt err = iPairedDevices.Append( aNameless ); - if ( !err && !iPairingHandler) - { - // New paired device, but no pairing handler yet. - // this means an incoming pairing has occured: - TRAP( err, iPairingHandler = - CBTNotifIncomingPairingHandler::NewL( *this, aNameless.Address() ) ); - } - if ( !err ) - { - // We have a pairing handler now. - // Ask pair handler to decide what to do: - iPairingHandler->HandleRegistryNewPairedEvent( - aNameless ); - } - else if ( iPairingHandler ) - { - // error could occur due to no memory, - // let us try aborting pairing handling - iPairingHandler->StopPairHandling( aNameless.Address() ); - } - } - -void CBTNotifSecurityManager::TrustDevice( const TBTDevAddr& aAddr ) - { - TIdentityRelation addrComp( CompareDeviceByAddress ); - TBTNamelessDevice dev; - dev.SetAddress( aAddr ); - TRequestStatus status( KRequestPending ); - - iRegistry.GetDevice(dev,status); - User::WaitForRequest( status ); - if(status == KErrNone) - { - TBTDeviceSecurity security = dev.GlobalSecurity(); - security.SetNoAuthorise(ETrue); - security.SetBanned(EFalse); - dev.SetGlobalSecurity(security); - (void)UpdateRegDevice(dev); - } - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +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: Server class for handling commands from clients, and the -* central class in btnotif thread. -* -*/ - -#include "btnotifserver.h" -#include -#include "btnotifsession.h" -#include "btnotifconnectiontracker.h" -#include "btnotifsettingstracker.h" -#include "btnotificationmanager.h" -#include "btnotifdeviceselector.h" -#include "btnotifserversecpolicy.h" -#include "btnotifclientserver.h" - -/** Panic category */ -_LIT( KBTNotifPanic, "BTNotif panic" ); - -/** Timeout (10 sec) for shutting down the server - * (when BT power is off and no clients connected). */ -const TInt KBTNtoifShutdownTimeout = 10 * 1000 * 1000; - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Start the server. -// --------------------------------------------------------------------------- -// -static void RunServerL() - { - BOstraceFunctionEntry0( DUMMY_DEVLIST ); - - (void) User::RenameThread( KBTNotifServerName ); - // Create and install the active scheduler for this thread. - CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler(); - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); - // create the server (and leave it on the cleanup stack) - CBTNotifServer* notifServer = CBTNotifServer::NewLC(); - // Initialisation complete, now signal the client - RProcess::Rendezvous( KErrNone ); - // The server is now up and running. - BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST, "[BTNOTIF]\t BTNotif server now up and running" ); - // The active scheduler runs during the lifetime of this thread. - CActiveScheduler::Start(); - // Stopping the active scheduler means terminating the thread. - // Cleanup the server and scheduler. - CleanupStack::PopAndDestroy( notifServer ); - CleanupStack::PopAndDestroy( scheduler ); - BOstraceFunctionExit0( DUMMY_DEVLIST ); - } - -// --------------------------------------------------------------------------- -// Panic the server. -// --------------------------------------------------------------------------- -// -void PanicServer( TInt aReason ) - { - User::Panic( KBTNotifPanic, aReason ); - } - -// --------------------------------------------------------------------------- -// Panic the client through the client-side message. -// --------------------------------------------------------------------------- -// -void PanicClient( const RMessage2& aMessage, TInt aReason ) - { - aMessage.Panic( KBTNotifPanic, aReason ); - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifServer::CBTNotifServer() -: CPolicyServer( EPriorityUserInput, KBTNotifServerPolicy ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifServer::ConstructL() - { - // Add the server to the active scheduler (from CServer2): - StartL( KBTNotifServerName ); - iAsyncCb = new( ELeave ) CAsyncCallBack( EPriorityHigh ); - TCallBack cb( AsyncConstructCb, this ); - iAsyncCb->Set( cb ); - iAsyncCb->CallBack(); - } - -// --------------------------------------------------------------------------- -// Asynchronous 3rd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifServer::AsyncConstructL() - { - // The server class owns this registry object and provides it - // as a singleton in the whole server process. - // Server itself does not handle any registry events. - // Classes that want to receive these events must register - // observers via CBtDevRepository interface. - iDevRep = CBtDevRepository::NewL(); - iNotificationMgr = CBTNotificationManager::NewL( this ); - iSettingsTracker = CBTNotifSettingsTracker::NewL( this ); - iConnectionTracker = CBTNotifConnectionTracker::NewL( this ); - iTimer = CDeltaTimer::NewL(CActive::EPriorityLow); - TCallBack shutdownCb( ShutdownTimeout, this ); - iShutdownTimerEntry.Set( shutdownCb ); - } - -// --------------------------------------------------------------------------- -// Callback for asynchronous construction. -// --------------------------------------------------------------------------- -// -TInt CBTNotifServer::AsyncConstructCb( TAny* aPtr ) - { - TRAPD( err, ( (CBTNotifServer*) aPtr )->AsyncConstructL() ); - return err; - } - - -// --------------------------------------------------------------------------- -// NewLC. -// --------------------------------------------------------------------------- -// -CBTNotifServer* CBTNotifServer::NewLC() - { - CBTNotifServer* self = new( ELeave ) CBTNotifServer(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifServer::~CBTNotifServer() - { - delete iDevSelector; - delete iSettingsTracker; - delete iConnectionTracker; - delete iNotificationMgr; - delete iAsyncCb; - delete iTimer; - delete iDevRep; - } - -// --------------------------------------------------------------------------- -// Handle a change in BT power state. -// --------------------------------------------------------------------------- -// -void CBTNotifServer::HandlePowerStateChangeL( TBTPowerStateValue aState ) - { - CheckIdle( aState ); - } - -// --------------------------------------------------------------------------- -// Increase the session count. -// --------------------------------------------------------------------------- -// -void CBTNotifServer::AddSession() - { - ++iSessionCount; - iTimer->Remove( iShutdownTimerEntry ); - } - - -// --------------------------------------------------------------------------- -// Decrease the session count. -// --------------------------------------------------------------------------- -// -void CBTNotifServer::RemoveSession() - { - if ( iSessionCount > 0 ) - { - // session counter can't be less than 0 - --iSessionCount; - } - CheckIdle( iSettingsTracker->GetPowerState() ); - } - -// --------------------------------------------------------------------------- -// get the singleton instance of device repository -// --------------------------------------------------------------------------- -// -CBtDevRepository& CBTNotifServer::DevRepository() - { - return *iDevRep; - } - -// --------------------------------------------------------------------------- -// get the singleton instance of device search notifier -// --------------------------------------------------------------------------- -// -CBTNotifDeviceSelector& CBTNotifServer::DeviceSelectorL() - { - if ( ! iDevSelector ) - { - iDevSelector = CBTNotifDeviceSelector::NewL( *this ); - } - return *iDevSelector; - } - -// --------------------------------------------------------------------------- -// From class CPolicyServer. -// Create a new session object. -// --------------------------------------------------------------------------- -// -CSession2* CBTNotifServer::NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const - { - (void) aMessage; - // Compare our version with client-side version, CServer2 requires that - // we leave if they are not compatible. - TVersion srvVersion( KBTNotifServerVersionMajor, KBTNotifServerVersionMinor, - KBTNotifServerVersionBuild ); - - if( !User::QueryVersionSupported( aVersion, srvVersion ) ) - { - // EFalse is returned if our version is not less than or - // equal to the client version. - User::Leave( KErrNotSupported ); - } - return CBTNotifSession::NewL(); - } - -void CBTNotifServer::CheckIdle( TBTPowerStateValue aState ) - { - // In special scenarios, we do not have to remove the timer and queue it - // again, but these scenarios rarely happen in end-user use cases. - iTimer->Remove( iShutdownTimerEntry ); - if ( iSessionCount == 0 && aState == EBTPowerOff ) - { - // BT power is off, start the shutdown timer. - TTimeIntervalMicroSeconds32 interval = KBTNtoifShutdownTimeout; - iTimer->Queue( interval, iShutdownTimerEntry ); - } - } - -TInt CBTNotifServer::ShutdownTimeout( TAny* aPtr ) - { - (void) aPtr; - CActiveScheduler::Stop(); - return KErrNone; - } - -// ======== GLOBAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Main function of the executable. -// --------------------------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - // Disabled until memory leak in QT/Open C are fixed - // __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt err = KErrNoMemory; - if ( cleanup ) - { - TRAP( err, RunServerL() ); - delete cleanup; - } - // Disabled until memory leak in QT/Open C are fixed - // __UHEAP_MARKEND; - return err; - } - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +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: class for prompting user to authorize a service -* connection request. -* -*/ - -#include -#include -#include "btnotifserviceauthorizer.h" -#include "btnotifsecuritymanager.h" -#include "bluetoothtrace.h" -#include "btnotifclientserver.h" -#include "bluetoothnotification.h" -#include "btnotifconnectiontracker.h" -#include "btnotificationmanager.h" -#include "btnotifserver.h" -#include "btnotifutil.h" - -// -// SDP UUID Constants - Short form -// Taken from Bluetooth Profile specification v1.1 -// These are used when registering the service to -// local SDP database and when searching the service -// information from remote device. -const TUint KBTSdpDun = 0x1103; -const TUint KBTSdpGenericTelephony = 0x1204; -const TUint KBTSdpFax = 0x1111; -const TUint KBTSdpObjectPush = 0x1105; -const TUint KBTSdpFileTransfer = 0x1106; -const TUint KBTSdpHeadSet = 0x1108; -const TUint KBTSdpGenericNetworking = 0x1201; -const TUint KBTSdpBasicImaging = 0x111b; - - -CBTNotifServiceAuthorizer* CBTNotifServiceAuthorizer::NewL( - CBTNotifSecurityManager& aParent) - { - CBTNotifServiceAuthorizer* me = new (ELeave) CBTNotifServiceAuthorizer(aParent); - CleanupStack::PushL(me); - me->ConstructL(); - CleanupStack::Pop(me); - return me; - } - -CBTNotifServiceAuthorizer::~CBTNotifServiceAuthorizer() - { - iParams.Close(); - if( iNotification ) - { - // Clear the notification callback, we cannot receive them anymore. - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - if ( !iNotifierMessage.IsNull() ) - { - iNotifierMessage.Complete( KErrServerTerminated ); - } - } - -CBTNotifServiceAuthorizer::CBTNotifServiceAuthorizer( - CBTNotifSecurityManager& aParent) -:iParent(aParent) - { - } - -void CBTNotifServiceAuthorizer::ConstructL() - { - } - -void CBTNotifServiceAuthorizer::StartNotifierL(const RMessage2& aMessage) - { - if (!iNotifierMessage.IsNull()) - { - if(aMessage.Function() == EBTNotifCancelNotifier) - { - TInt err = iNotification->Close(); - iNotifierMessage.Complete(KErrCancel); - aMessage.Complete(err); - return; - } - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); - User::Leave(KErrServerBusy ); - } - - iParams.ReAllocL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); - aMessage.ReadL( EBTNotifSrvParamSlot, iParams ); - - TBTAuthorisationParams params; - TPckgC paramsPckg( params ); - paramsPckg.Set( iParams ); - - iServiceId = paramsPckg().iUid.iUid; - - const CBtDevExtension* dev = NULL; - dev = iParent.BTDevRepository().Device(paramsPckg().iBDAddr); - - if(dev && dev->Device().GlobalSecurity().Banned() ) - { - // If the device is banned, service connection from - // this device is not allowed: - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); - aMessage.Complete( KErrCancel); - return; - } - - if(dev && dev->Device().GlobalSecurity().NoAuthorise()) - { - // If the device is a trusted one, no need to pop up query messages. - TPckgBuf answer; - answer() = ETrue; - aMessage.Write(EBTNotifSrvReplySlot, answer); - aMessage.Complete(KErrNone); - return; - } - - // User must namually authorize this request. - // Get needed info for the dialog: - iPairedDevice = (dev == NULL ) ? EFalse : dev->IsUserAwareBonded(); - iDeviceClass = (dev == NULL ) ? 0 : dev->Device().DeviceClass().DeviceClass(); - TBTNotifUtil::GetDeviceUiNameL(iCurrentDeviceName, - dev, paramsPckg().iName, paramsPckg().iBDAddr ); - - TBool autoAuthorize; - PrepareNotificationL(autoAuthorize, - TBluetoothDialogParams::EUserAuthorization, - EAuthorization, iPairedDevice); - if ( autoAuthorize ) - { - TPckgBuf answer; - answer() = ETrue; - aMessage.Write(EBTNotifSrvReplySlot, answer); - aMessage.Complete(KErrNone); - } - else - { - iNotification->ShowL(); - // we do not save the message until all leavable functions have executed successfully. - // This makes sure the iNotifierMessage has a valid handle. - iNotifierMessage = aMessage; - } - } - -void CBTNotifServiceAuthorizer::MBRDataReceived( CHbSymbianVariantMap& aData ) - { - // "actionResult" will be true if the user clicks 'Yes' on the dialog and false, if he/she clicks 'No' - // "iCheckBoxState" will be set to true of the checkbox is checked, else false. - if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) - { - TBTAuthorisationParams params; - TPckgC paramsPckg(params); - paramsPckg.Set(iParams); - - TPckgBuf answer; - TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); - if(val) - { - answer() = ETrue; - if(iCheckBoxState) - { - // Set the device "Trusted" property - iParent.TrustDevice(paramsPckg().iBDAddr); - } - } - else - { - answer() = EFalse; - if(iCheckBoxState) - { - // If the device is paried, unpair it as well. - if(iPairedDevice) - { - iParent.UnpairDevice(paramsPckg().iBDAddr); - } - - //Set the device "Blocked" property - iParent.BlockDevice(paramsPckg().iBDAddr,ETrue); - } - } - if ( !iNotifierMessage.IsNull() ) - { - iNotifierMessage.Write(EBTNotifSrvReplySlot, answer); - iNotifierMessage.Complete(KErrNone); - } - } - else if(aData.Keys().MdcaPoint(0).Compare(_L("checkBoxState")) == 0) - { - iCheckBoxState = *(static_cast(aData.Get(_L("checkBoxState"))->Data())); - } - } - -void CBTNotifServiceAuthorizer::MBRNotificationClosed( TInt aError, const TDesC8& aData ) - { - (void) aError; - (void) aData; - iNotification->RemoveObserver(); - iNotification = NULL; - } - -void CBTNotifServiceAuthorizer::PrepareNotificationL(TBool& aAutoAuthorize, - TBluetoothDialogParams::TBTDialogType aType, - TBTDialogResourceId aResourceId, TBool aPaired) - { - iNotification = iParent.ConnectionTracker().NotificationManager()->GetNotification(); - User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory - iNotification->SetObserver( this ); - iNotification->SetNotificationType( aType, aResourceId ); - TInt err = KErrNone; - aAutoAuthorize = EFalse; - - //Set the dialog title based on the service IDs - switch(iServiceId) - { - case KBTSdpObjectPush: - case KBTSdpBasicImaging: - { - if(aPaired) - { - err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EReceiveFromPairedDevice); - // In case of receiving a msg from a paired deivce, the checkbox is checked by default. - iCheckBoxState = ETrue; - User::LeaveIfError(err); - } - else - { - err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EReceive); - iCheckBoxState = EFalse; - User::LeaveIfError(err); - } - } - break; - - case KBTSdpFax: - case KBTSdpDun: - case KBTSdpFileTransfer: - case KBTSdpHeadSet: - case KBTSdpGenericTelephony: - case KBTSdpGenericNetworking: - { - err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EConnect); - // In case of an incoming connection, the checkbox is checked by default. - iCheckBoxState = ETrue; - User::LeaveIfError(err); - } - break; - - default: - { - TBTAuthorisationParams params; - TPckgC paramsPckg(params); - paramsPckg.Set(iParams); - - // In this case, if there already exists a connection to an audio device, then we simply accept - // the incoming connection without querying the user. - // If there is no existing connection, then we pop up a query message. - if(IsExistingConnectionToAudioL(paramsPckg().iBDAddr)) - { - aAutoAuthorize = ETrue; - return; - } - else - { - err = iNotification->SetData( TBluetoothDialogParams::EDialogTitle, TBluetoothDialogParams::EConnect); - // In case of an incoming connection, the checkbox is checked by default. - iCheckBoxState = ETrue; - User::LeaveIfError(err); - } - } - break; - } - - //Add the device name - err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, iCurrentDeviceName ); - User::LeaveIfError(err); - //Add the device class - err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceClass, iDeviceClass ); - User::LeaveIfError(err); - - } - -TBool CBTNotifServiceAuthorizer::IsExistingConnectionToAudioL(const TBTDevAddr& aDevAddr) - { - CBTEngConnMan* connMan = CBTEngConnMan::NewL(); - TBTEngConnectionStatus conntatus(EBTEngNotConnected); - (void) connMan->IsConnected(aDevAddr,conntatus); - delete connMan; - return (conntatus==EBTEngConnected || conntatus==EBTEngConnecting); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +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: Session class for handling commands from clients. -* -*/ - -#include "btnotifsession.h" -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif -#include "btnotifclientserver.h" -#include "btnotifsettingstracker.h" -#include "btnotifconnectiontracker.h" -#include "btnotifdeviceselector.h" - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// Start the server. -// --------------------------------------------------------------------------- -// -void LeaveIfNullL( const TAny* aPtr, TInt aLeaveCode ) - { - if( aPtr == NULL ) - { - User::Leave( aLeaveCode ); - } - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifSession::CBTNotifSession() -: CSession2() - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifSession::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBTNotifSession* CBTNotifSession::NewL() - { - CBTNotifSession* self = new( ELeave ) CBTNotifSession(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifSession::~CBTNotifSession() - { - // clients must complete the message they are responsible for - // we do not complete any message here - Server()->RemoveSession(); - } - -// --------------------------------------------------------------------------- -// From class CSession2. -// Receives a message from a client. -// --------------------------------------------------------------------------- -// -void CBTNotifSession::ServiceL( const RMessage2& aMessage ) - { - CBTNotifConnectionTracker* connTracker = Server()->ConnectionTracker(); - TInt opCode = aMessage.Function(); - TInt uid = aMessage.Int0(); - TInt err( KErrNotReady ); - switch(opCode){ - case EBTNotifCancelNotifier: - case EBTNotifStartSyncNotifier: - case EBTNotifStartAsyncNotifier: - case EBTNotifUpdateNotifier: - if( uid == KDeviceSelectionNotifierUid.iUid ) - { - TRAP( err, { - CBTNotifDeviceSelector& selector = Server()->DeviceSelectorL(); - selector.DispatchNotifierMessageL( aMessage ); } - ); - if ( err ) - { - aMessage.Complete( err ); - } - // deviceselector takes the ownership of aMessage. - } - else - { - // PIN/ SSP pairing notifiers from BT stack: - // ***** Note for implementers: - // message queue is not used for this notifier handling. - if ( uid == KBTManAuthNotifierUid.iUid || - uid == KBTManPinNotifierUid.iUid || - uid == KBTPinCodeEntryNotifierUid.iUid || - uid == KBTNumericComparisonNotifierUid.iUid || - uid == KBTPasskeyDisplayNotifierUid.iUid || - uid == KBTUserConfirmationNotifierUid.iUid ) - { - if( connTracker ) - { - // Pass it to the connection tracker. - TRAP( err, - connTracker->HandleNotifierRequestL( aMessage ) ); - } - if ( err ) - { - // tracker not available, can't do this now. - aMessage.Complete( err ); - } - } - } - break; - case EBTNotifPairDevice: - case EBTNotifCancelPairDevice: - // Pairing requests from clients: - if ( connTracker ) - { - TRAP( err, connTracker->HandleBondingRequestL( aMessage ) ); - } - if ( err ) - { - // tracker not available, can't do this now. - aMessage.Complete( err ); - } - break; - default: - aMessage.Complete( KErrNotSupported ); - break; - } -} - - -// --------------------------------------------------------------------------- -// From class CSession2. -// Completes construction of the session. -// --------------------------------------------------------------------------- -// -void CBTNotifSession::CreateL() - { - Server()->AddSession(); - } - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifsettingstracker.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsettingstracker.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +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: Class for tracking Bluetooth settings, and also for -* handling notes unrelated to specific connection. -* -*/ - -#include "btnotifsettingstracker.h" -#include - -#include "btnotifserver.h" -#include "btnotificationmanager.h" -#include "btnotifclientserver.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBTNotifSettingsTracker::CBTNotifSettingsTracker( CBTNotifServer* aServer ) -: iServer( aServer ) - { - } - - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::ConstructL() - { - iSettings = CBTEngSettings::NewL( this ); - User::LeaveIfError( iSettings->GetPowerState( iPowerState ) ); - } - - -// --------------------------------------------------------------------------- -// NewL. -// --------------------------------------------------------------------------- -// -CBTNotifSettingsTracker* CBTNotifSettingsTracker::NewL( CBTNotifServer* aServer ) - { - CBTNotifSettingsTracker* self = new( ELeave ) CBTNotifSettingsTracker( aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBTNotifSettingsTracker::~CBTNotifSettingsTracker() - { - if( iNotification ) - { - // Clear the notification callback, we cannot receive them anymore. - iNotification->RemoveObserver(); - iNotification->Close(); // Also dequeues the notification from the queue. - iNotification = NULL; - } - delete iSettings; - } - - -// --------------------------------------------------------------------------- -// Process a client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::DispatchNotifierMessageL( const RMessage2& aMessage ) - { - TUid uid = TUid::Uid( aMessage.Int0() ); - (void) uid; - } - - -// --------------------------------------------------------------------------- -// Cancels an outstanding client message related to notifiers. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::CancelNotifierMessageL( const RMessage2& aMessage ) - { - (void) aMessage; - } - - -// --------------------------------------------------------------------------- -// From class MBTEngSettingsObserver. -// Handle a power status change. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::PowerStateChanged( TBTPowerStateValue aState ) - { - iPowerState = aState; - TRAP_IGNORE( iServer->HandlePowerStateChangeL( aState ) ); - } - - -// --------------------------------------------------------------------------- -// From class MBTEngSettingsObserver. -// Handle a visibility mode change. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::VisibilityModeChanged( TBTVisibilityMode aState ) - { - if( iVisibilityMode == EBTVisibilityModeTemporary && - aState == EBTVisibilityModeHidden && iPowerState == EBTPowerOn ) - { - // Timeout expired, launch a note. - // Note that we get the power state change before this one, when powering - // off and setting visibility mode to hidden automatically. - NOTIF_NOTHANDLED( !iNotification ) - iNotification = iServer->NotificationManager()->GetNotification(); - if ( iNotification ) - { - iNotification->SetObserver( this ); - iNotification->SetNotificationType( TBluetoothDeviceDialog::ENote, EVisibilityTimeout ); - TRAP_IGNORE( - iServer->NotificationManager()->QueueNotificationL( iNotification ) ); - } - } - iVisibilityMode = aState; - } - - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// Handle a result from a user query. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::MBRDataReceived( CHbSymbianVariantMap& aData ) - { - (void) aData; - } - - -// --------------------------------------------------------------------------- -// From class MBTNotificationResult. -// The notification is finished. -// --------------------------------------------------------------------------- -// -void CBTNotifSettingsTracker::MBRNotificationClosed( TInt aError, const TDesC8& aData ) - { - (void) aError; - (void) aData; - iNotification->RemoveObserver(); - iNotification = NULL; - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifsrv/src/btnotifutil.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifutil.cpp Tue Aug 31 15:25:10 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: -* -*/ -#include "btnotifutil.h" -#include -#include -#include "bluetoothtrace.h" - -// --------------------------------------------------------------------------- -// If aDevExt contains a valid friendly name, the friendly name will be displayed; -// Otherwise, if the given name from the parameter of a notifier request is valid, -// the given name will be displayed; -// Otherwise, If aDevExt contains a valid device name, the name will be displayed; -// Otherwise, the a name will be created by this function. -// --------------------------------------------------------------------------- -// -void TBTNotifUtil::GetDeviceUiNameL( TDes& aNameBuf, - const CBtDevExtension* aDevExt, - const TDesC& aNameInParam, - const TBTDevAddr& aAddr) - { - CBtDevExtension* tempDev( NULL ); - TPtrC namePtr; - if ( aDevExt && - aDevExt->Device().IsValidFriendlyName() && - aDevExt->Device().FriendlyName().Length() != 0 ) - { - // We always use the friendly name regardless of - // the device-name of the device is available or not. - namePtr.Set( aDevExt->Device().FriendlyName() ); - } - else - { - // this will take care of name formating. Either the - // name from iNameInParam or the address will be - // the alias: - tempDev = CBtDevExtension::NewLC( aAddr, aNameInParam ); - namePtr.Set( tempDev->Alias() ); - } - // Make sure no overflow: - if ( aNameBuf.MaxLength() < namePtr.Length() ) - { - aNameBuf.Copy( namePtr.Left( aNameBuf.MaxLength() ) ); - } - else - { - aNameBuf.Copy( namePtr ); - } - if ( tempDev ) - { - CleanupStack::PopAndDestroy( tempDev ); - } - } - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifwrapper/data/101fd68f.rss --- a/bluetoothengine/btnotif/btnotifwrapper/data/101fd68f.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* ============================================================================ -* Name : 101fd68f.rss -* Part of : bluetoothengine / btnotifwrapper -* Description : Resource definitions for project btnotifwrapper -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include -#include - -// --------------------------------------------------------------------------- -// ecomInfo -// ECOM registration info -// --------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO ecomInfo - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x101FD68F; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUikonUidPluginInterfaceNotifiers; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x20026FEE; - version_no = 2; - display_name = "BTNOTIFPLUGINWRAPPER vQT"; - default_data = "BTNOTIFPLUGIN vQT"; - opaque_data = ""; - } - }; - } - }; - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifwrapper/inc/btnotifwrapper.h --- a/bluetoothengine/btnotif/btnotifwrapper/inc/btnotifwrapper.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifwrapper.h -* Part of : bluetoothengine / btnotif -* Description : Wrapper for Bluetooth Notifiers -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BTNOTIFWRAPPER_H -#define BTNOTIFWRAPPER_H - - -#include -#include -#include - -class CBTNotifWrapperUnitTester; - -/** - * Function for creating the array of notifiers supported by this plug-in. - * The main purpose for declaring it here is to allow it to be used - * by the test module. - * - * @since Symbian^4 - * @return Array of notifiers. - */ -CArrayPtr* CreateNotifierArrayL(); - -/** - * RNotif plugin implementation providing the client API for BTNotif - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( CBTNotifWrapper ) : public CBase, - public MEikSrvNotifierBase2, - public MBtSimpleActiveObserver - { - -public: - - /** - * Two-phased constructor. - */ - static CBTNotifWrapper* NewLC( const TUid& aUid, const TUid& aChannel ); - - /** - * Destructor. - */ - virtual ~CBTNotifWrapper(); - -private: - -// from base class MEikSrvNotifierBase2 - - /** - * From MEikSrvNotifierBase2. - * Frees all resources owned by this notifier. - * - * @since Symbian^4 - */ - virtual void Release(); - - /** - * From MEikSrvNotifierBase2. - * Performs any initialisation that this notifier may require. - * As a minimum, the function should return a TNotifierInfo instance - * describing the notifier parameters. - * - * @since Symbian^4 - * @return Describes the parameters of the notifier. - */ - virtual TNotifierInfo RegisterL(); - - /** - * From MEikSrvNotifierBase2. - * Gets the notifier parameters. - * - * @since Symbian^4 - * @return Describes the parameters of the notifier. - */ - virtual TNotifierInfo Info() const; - - /** - * From MEikSrvNotifierBase2. - * This is called as a result of a client-side call to - * RNotifier::StartNotifier(), which the client uses to - * start a notifier from which it does not expect a response. - * - * @since Symbian^4 - * @param aBuffer Data that can be passed from the client-side. The format - * and meaning of any data is implementation dependent. - * @return A pointer descriptor representing data that may be returned. - * The format and meaning of any data is implementation dependent. - */ - virtual TPtrC8 StartL(const TDesC8& aBuffer); - - /** - * From MEikSrvNotifierBase2. - * This is called as a result of a client-side call to the asynchronous - * function RNotifier::StartNotifierAndGetResponse(). This means that the - * client is waiting, asynchronously, for the notifier to tell the - * client that it has finished its work. - * - * @since Symbian^4 - * @param aBuffer Data that can be passed from the client-side. The format - * and meaning of any data is implementation dependent. - * @param aReplySlot Identifies which message argument to use for the reply. - * This message argument will refer to a modifiable - * descriptor, a TDes8 type, into which data can be - * returned. The format and meaning of any returned data - * is implementation dependent. - * @param aMessage Encapsulates a client request. - */ - virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); - - /** - * From MEikSrvNotifierBase2. - * Cancels an active notifier. - * This is called as a result of a client-side call to RNotifier::CancelNotifier(). - * - * @since Symbian^4 - */ - virtual void Cancel(); - - /** - * From MEikSrvNotifierBase2. - * Updates a currently active notifier with new data. - * This is called as a result of a client-side call - * to RNotifier::UpdateNotifier(). - * - * @since Symbian^4 - * @param aBuffer Data that can be passed from the client-side. The format - * and meaning of any data is implementation dependent. - * @return A pointer descriptor representing data that may be returned. - * The format and meaning of any data is implementation dependent. - */ - virtual TPtrC8 UpdateL(const TDesC8& aBuffer); - - /** - * From MEikSrvNotifierBase2. - * Updates a currently active notifier with new data. - * This is called as a result of a client-side call to the asynchronous - * function RNotifier::UpdateNotifierAndGetResponse(). - * - * @since Symbian^4 - * @param aBuffer Data that can be passed from the client-side. The format - * and meaning of any data is implementation dependent. - * @param aReplySlot Identifies which message argument to use for the reply. - * This message argument will refer to a modifiable - * descriptor, a TDes8 type, into which data can be - * returned. The format and meaning of any returned data - * is implementation dependent. - * @param aMessage Encapsulates a client request. - */ - virtual void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); - -// from base class MBtSimpleActiveObserver - - /** - * Callback to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aStatus The status of the completed request. - */ - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. - */ - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); - -private: - - CBTNotifWrapper( const TUid& aUid, const TUid& aChannel ); - - void ConstructL(); - - /** - * Check if this notifier is a synchronous or asunchronous notifier. - * - * @since Symbian^4 - * @return ETrue is the notifier is synchronous, EFalse if asyncrhonous. - */ - TBool IsSync() const; - -private: // data - - /** - * The UID identifying the notifier. - */ - TUid iUid; - - /** - * The channel of the notifier. - */ - TUid iChannel; - - /** - * The replyslot for the result. - */ - TInt iReplySlot; - - /** - * Session with the BT notifier server. - */ - RBTNotifier iBTNotif; - - /** - * The client-side message containing the current request. - */ - RMessagePtr2 iMessage; - - /** - * Buffer containing a copy of the notifier parameters, for async notifiers. - * Own. - */ - RBuf8 iParamsBuf; - - /** - * Modifiable pointer descriptor for getting the response back. - */ - TPtr8 iResponsePtr; - - /** - * Buffer for receiving the response from the BT notifier server. - * Own. - */ - RBuf8 iResponseBuf; - - /** - * Active object helper class. - * Own. - */ - CBtSimpleActive* iActive; - - friend class CBTNotifWrapperUnitTester; - - }; - -#endif // BTNOTIFWRAPPER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapper.cpp --- a/bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapper.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,302 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifwrapper.cpp -* Part of : bluetoothengine / btnotif -* Description : Wrapper for Bluetooth Notifiers -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include "btnotifwrapper.h" -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif - -/** Identifier of the active object. */ -const TInt KWrapperActive = 10; - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CBTNotifWrapper::CBTNotifWrapper( const TUid& aUid, const TUid& aChannel ) -: MEikSrvNotifierBase2(), - iUid( aUid ), - iChannel( aChannel ), - iResponsePtr( NULL, 0 ) - { - } - - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::ConstructL() - { - // lazy initialization: members are created and destroyed when needed. - } - - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -CBTNotifWrapper* CBTNotifWrapper::NewLC( const TUid& aUid, const TUid& aChannel ) - { - CBTNotifWrapper* self = new( ELeave ) CBTNotifWrapper( aUid, aChannel ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CBTNotifWrapper::~CBTNotifWrapper() - { - Cancel(); // Cleans up buffers - delete iActive; - iBTNotif.Close(); - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// Frees all the resources i.e. destruct ourselves. -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::Release() - { - delete this; - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// ?implementation_description -// --------------------------------------------------------------------------- -// -MEikSrvNotifierBase2::TNotifierInfo CBTNotifWrapper::RegisterL() - { - return Info(); - } - - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// ?implementation_description -// --------------------------------------------------------------------------- -// -MEikSrvNotifierBase2::TNotifierInfo CBTNotifWrapper::Info() const - { - MEikSrvNotifierBase2::TNotifierInfo info; - info.iUid = iUid; - info.iChannel = iChannel; - info.iPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; - return info; - } - - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// ?implementation_description -// --------------------------------------------------------------------------- -// -TPtrC8 CBTNotifWrapper::StartL(const TDesC8& aBuffer) - { - if( !IsSync() ) - { - // due to the charasteristics of Bluetooth and UI operations, - // most of Bluetooth notifiers do not support synchronous version. - User::Leave( KErrNotSupported ); - } - // Call notifier server and get response. - if( !iBTNotif.Handle() ) - { - User::LeaveIfError( iBTNotif.Connect() ); - } - User::LeaveIfError( iBTNotif.StartNotifier( iUid, aBuffer ) ); - iBTNotif.Close(); - return KNullDesC8(); - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// ?implementation_description -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::StartL(const TDesC8& aBuffer, TInt aReplySlot, - const RMessagePtr2& aMessage) - { - if( !iMessage.IsNull() ) - { - aMessage.Complete( KErrAlreadyExists ); - return; - } - - // Call notifier server and get response. - if( !iBTNotif.Handle() ) - { - User::LeaveIfError( iBTNotif.Connect() ); - } - if( !iActive ) - { - iActive = CBtSimpleActive::NewL( *this, KWrapperActive ); - } - - // We need to store the parameters locally, as aBuffer is destroyed after - // returning from this call. We do it on the heap, so we do not permanently - // consume memory for the buffer. - - iParamsBuf.CreateL( aBuffer ); - TInt len = aMessage.GetDesMaxLength( aReplySlot ); - - iResponseBuf.CreateL( len ); - aMessage.ReadL( aReplySlot, iResponseBuf ); - - iBTNotif.StartNotifierAndGetResponse( iActive->RequestStatus(), - iUid, iParamsBuf, iResponseBuf ); - iActive->GoActive(); - // record the request - iReplySlot = aReplySlot; - iMessage = aMessage; - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// ?implementation_description -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::Cancel() - { - // Call notifier server to cancel. - if( iActive ) - { - iActive->Cancel(); - } - if( !iMessage.IsNull() ) - { - iMessage.Complete( KErrCancel ); - } - iReplySlot = 0; - iParamsBuf.Close(); - iResponseBuf.Close(); - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// Synchronous notifier update. -// --------------------------------------------------------------------------- -// -TPtrC8 CBTNotifWrapper::UpdateL(const TDesC8& aBuffer) - { - // Call notifier server and get response. - TBuf8<256> response; - if( !iBTNotif.Handle() ) - { - User::LeaveIfError( iBTNotif.Connect() ); - } - User::LeaveIfError( iBTNotif.UpdateNotifier( iUid, aBuffer, response ) ); - return response; - } - -// --------------------------------------------------------------------------- -// From class MEikSrvNotifierBase2. -// Asynchronous notifier update. -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) - { - (void) aReplySlot; - (void) aBuffer; - if( iMessage.IsNull() ) - { - // There is no outstanding request, can't relate this to anything. - aMessage.Complete( KErrNotFound ); - return; - } - // Call notifier server and get response. - // Async updates are just for updating parameters, so they are still - // done synchronously between here and btnotif, as they don't - // require any user feedback or other response with - // asynchronous/long cycles. - TPtrC8 response = UpdateL( aBuffer ); - aMessage.WriteL( aReplySlot, response ); - aMessage.Complete( KErrNone ); - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// Callback to notify that an outstanding request has completed. -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - ASSERT( aActive->RequestId() == KWrapperActive ); - (void) aActive; - if( !iMessage.IsNull() ) - { - TInt err( aStatus ); - if( !err ) - { - err = iMessage.Write( iReplySlot, iResponseBuf ); - } - iMessage.Complete( err ); - } - // Clean up after usage. - iBTNotif.Close(); - delete iActive; - iActive = NULL; - } - - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// Cancel and clean up all requests related to the active object. -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::CancelRequest( TInt aRequestId ) - { - ASSERT( aRequestId == KWrapperActive ); - (void) aRequestId; - iBTNotif.CancelNotifier( iUid ); - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// -// --------------------------------------------------------------------------- -// -void CBTNotifWrapper::HandleError( CBtSimpleActive* aActive, - TInt aError ) - { - // RequestCompletedL() is not leavable. - (void) aActive; - (void) aError; - } - -// --------------------------------------------------------------------------- -// Check if this is a synchronous notifier or not. -// --------------------------------------------------------------------------- -// -TBool CBTNotifWrapper::IsSync() const - { - return ( iUid == KBTGenericInfoNotifierUid ); - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapperproxy.cpp --- a/bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapperproxy.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifwrapperproxy.cpp -* Part of : bluetoothengine / btnotifwrapper -* Description : ECOM plug-in entry implementation. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - - -#include -#include -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#endif -#include -//#include - -#include "btnotifwrapper.h" - -/** Granularity for constructing the array of notifiers */ -const TInt KBTNotifWrapperArraySize = 11; -/** Channel for discovery notifiers */ -const TUid KBTDiscoveryChannel = { 0x00000601 }; -/** Channel for authentication and authorisation notifiers */ -const TUid KBTAuthChannel = {0x00000602}; -/** Channel for OBEX passkey notifiers */ -//const TUid KBTObexAuthChannel = {0x00000603}; -/** Channel for power mode query */ -//const TUid KBTPowerModeChannel = {0x00000605}; -/** Channel for query notifiers */ -//const TUid KBTQueryChannel = {0x00000606}; -/** Channel for power mode query */ -//const TUid KBTInfoChannel = {0x00000610}; - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// ?description -// --------------------------------------------------------------------------- -// -void CreateAndAppendNotifierLC( CArrayPtr& aArray, - const TUid& aUid, const TUid& aChannel ) - { - CBTNotifWrapper* notifier = CBTNotifWrapper::NewLC( aUid, aChannel ); - aArray.AppendL( notifier ); - } - -// --------------------------------------------------------------------------- -// ?description -// --------------------------------------------------------------------------- -// -CArrayPtr* CreateNotifierArrayL() - { - CArrayPtrFlat* notifiers = - new( ELeave ) CArrayPtrFlat( KBTNotifWrapperArraySize ); - CleanupStack::PushL( notifiers ); - // Create all the notifiers: - // Connection authorization notifier - CreateAndAppendNotifierLC( *notifiers, KBTManAuthNotifierUid, KBTAuthChannel ); - // Old and new PIN notifiers - CreateAndAppendNotifierLC( *notifiers, KBTManPinNotifierUid, KBTAuthChannel ); - CreateAndAppendNotifierLC( *notifiers, KBTPinCodeEntryNotifierUid, KBTAuthChannel ); - // Secure simple pairing notifiers - CreateAndAppendNotifierLC( *notifiers, KBTNumericComparisonNotifierUid, KBTAuthChannel ); - CreateAndAppendNotifierLC( *notifiers, KBTPasskeyDisplayNotifierUid, KBTAuthChannel ); - - // todo: add - // KBTUserConfirmationNotifierUid for incoming JW dedicated bonding. - - CreateAndAppendNotifierLC( *notifiers, KDeviceSelectionNotifierUid, KBTDiscoveryChannel ); - - /* - * todo: - * Other notifiers to be migrated: - * - * existing stack notifiers: - * CreateAndAppendNotifierL( aArray, KPbapAuthNotifierUid, KBTObexPINChannel ); - * - * S60 SDK API: - * CreateAndAppendNotifierL( aArray, KPowerModeSettingNotifierUid, KBTPowerModeChannel ); - * - * S60-defined platform: - * CreateAndAppendNotifierL( aArray, KBTObexPasskeyQueryNotifierUid, KBTObexPINChannel ); - * CreateAndAppendNotifierL( aArray, KBTGenericInfoNotifierUid, KBTInfoChannel ); - * CreateAndAppendNotifierL( aArray, KBTGenericQueryNotifierUid, KBTQueryChannel ); - * - * new (PAN-related): - * CreateAndAppendNotifierL( aArray, KBTPanDeviceSelectionNotifierUid, KBTDiscoveryChannel ); - * CreateAndAppendNotifierL( aArray, KBTPanNapUplinkAuthorisationNotifierUid, KBTAuthChannel ); - */ - CleanupStack::Pop( notifiers->Count() + 1, notifiers ); // Each notifier + notifier array itself - return notifiers; - } - -// --------------------------------------------------------------------------- -// ECOM entry point. -// --------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x20026FEE, CreateNotifierArrayL ) - }; - -// ======== GLOBAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// ECOM factory method. -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - return ImplementationTable; - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/bwins/Btnotifu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/bwins/Btnotifu.def Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr * __cdecl NotifierArray(void) + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/data/BTNotif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/data/BTNotif.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,754 @@ +/* +* 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 module BTNotif. +* +*/ + + +NAME BNOT + +#include + +#include + +#include +#include +#include +#include +#include +#include "btnotif.hrh" + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +// === ICONS ================================================================= + +//---------------------------------------------------- +// Icon array for BTNOTIF +//---------------------------------------------------- +// +RESOURCE AKN_ICON_ARRAY r_btnotif_icons + { + //This resource is removed because of skinable icon change. The title is still staying here + //to prevent intruducing BC break. + } + +// === TITLES AND PROMPTS ==================================================== + +//---------------------------------------------------- +// Titles for popup windows +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_search_devs_popup_title { buf = qtn_bt_searching_found; } + +RESOURCE TBUF r_bt_found_devs_popup_title { buf = qtn_bt_devices_found; } + +RESOURCE TBUF r_bt_last_seen_devs_popup_title { buf = qtn_bt_last_seen_devices; } + +RESOURCE TBUF r_bt_last_used_devs_popup_title { buf = qtn_bt_last_used_devices; } + +//---------------------------------------------------- +// Fixed list items +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_more_devices_item { buf = qtn_bt_more_devices; } + +//---------------------------------------------------- +// Prompts for queries +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_passkey_prompt { buf = qtn_bt_enter_pk_for_conn; } + +RESOURCE TBUF r_bt_dialog_def_name { buf = qtn_bt_dialog_def_name; } + +RESOURCE TBUF r_bt_authorisation_name { buf = qtn_bt_accept_conn_request; } + +RESOURCE TBUF r_bt_receive_message { buf = qtn_bt_receive_message; } + +RESOURCE TBUF r_bt_receive_message_paired { buf = qtn_bt_receive_message_paired; } + +RESOURCE TBUF r_bt_no_devices_found { buf =qtn_bt_no_devices_found; } +//same text than in r_bt_try_again_query + +RESOURCE TBUF r_bt_power_is_off { buf = qtn_bt_is_off; } +//same text than in R_BT_POWER_IS_OFF_QUERY + +RESOURCE TBUF r_bt_activate_in_offline { buf= qtn_bt_activate_in_offline; } +//same text than in R_BT_ACTIVATE_IN_OFFLINE_QUERY + +RESOURCE TBUF r_bt_is_hidden_java { buf=qtn_bt_is_hidden_java; } + +RESOURCE TBUF r_bt_is_off_java { buf=qtn_bt_is_off_java; } + +RESOURCE TBUF r_bt_is_hidden_java_appname { buf=qtn_bt_is_hidden_java_appname; } + +RESOURCE TBUF r_bt_is_off_java_appname { buf=qtn_bt_is_off_java_appname; } + +RESOURCE TBUF r_bt_turn_bt_off { buf = qtn_bt_dos_query; } + +RESOURCE TBUF r_bt_switch_off_anyway { buf= qtn_bt_switch_off_anyway; } + +//---------------------------------------------------- +// Headers of the r_bt_is_hidden_java and r_bt_is_off_java queries +//---------------------------------------------------- +RESOURCE TBUF r_bt_is_off_java_header { buf=qtn_bt_is_off_java_header ; } + +RESOURCE TBUF r_bt_is_hidden_java_header { buf=qtn_bt_is_hidden_java_header ; } + +//---------------------------------------------------- +// Prompts for global notes +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_audio_accessory_prompt { buf = qtn_bt_audio_accessory; } + +RESOURCE TBUF r_bt_audio_handset_prompt { buf = qtn_bt_audio_handset; } + +RESOURCE TBUF r_bt_conf_connected_prompt { buf = qtn_bt_conf_connected; } + +RESOURCE TBUF r_bt_conf_disconnected_prompt { buf = qtn_bt_conf_disconnected; } + +RESOURCE TBUF r_bt_conn_closed_prompt { buf = qtn_bt_conn_closed; } + +RESOURCE TBUF r_bt_device_not_avail { buf = qtn_bt_device_not_avail; } + +RESOURCE TBUF r_bt_offline_disabled { buf = qtn_bt_offline_disabled; } +//text of R_BT_BUSY +RESOURCE TBUF r_bt_busy_text { buf =qtn_bt_busy; } + +RESOURCE TBUF r_ir_not_supported { buf =qtn_ir_not_supported; } + + +//---------------------------------------------------- +// Default name array for BTNotif +// These names are used if no name is received in inquiry. +// Note! The order must match enum TBTDefaultDevNameArrayIndexes +// defined in BTNInqUi.cpp. +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_default_device_names + { + items = { + LBUF { txt=qtn_bt_computer; }, + LBUF { txt=qtn_bt_phone; }, + LBUF { txt=qtn_bt_audio; }, + LBUF { txt=qtn_bt_keyboard; }, + LBUF { txt=qtn_bt_mouse; }, + LBUF { txt=qtn_bt_printer; }, + LBUF { txt=qtn_bt_carkit; }, + LBUF { txt=qtn_bt_dialog_def_name; } + }; + } + + +// === SOFTKEYS ============================================================== + +//---------------------------------------------------- +// Softkeys for "Searching devices" wait note +//---------------------------------------------------- +// +RESOURCE CBA r_bt_softkeys_empty_cancel + { + buttons = + { + CBA_BUTTON {txt="";}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt = text_softkey_cancel; } + }; + } + + +//---------------------------------------------------- +// Softkeys for found devices popup list +//---------------------------------------------------- +// +RESOURCE CBA r_bt_softkeys_select_stop + { + buttons = + { + CBA_BUTTON {id=EAknSoftkeySelect; txt = text_softkey_select;}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt = qtn_bt_softkey_stop; }, + CBA_BUTTON {id=EAknSoftkeySelect; txt = text_softkey_select;} + }; + } + +// === QUERIES =============================================================== + +//---------------------------------------------------- +// PIN request query +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_enter_passkey_query + { + flags = EGeneralQueryFlags | EEikDialogFlagVirtualInput ; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + maxlength = KBTPassKeyMaxLength; + default_input_mode = EAknEditorNumericInputMode; + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + avkon_flags = EAknEditorFlagLatinInputModesOnly; + }; + }; + } + }; + } + +//---------------------------------------------------- +// OBEX PIN request query +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_obex_passkey_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_bt_enter_obex_pcode; + control = EDWIN + { + maxlength = KBTPassKeyMaxLength; + default_input_mode = EAknEditorNumericInputMode; + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + }; + }; + } + }; + } + +//---------------------------------------------------- +// Query for accepting incoming connections +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_authorisation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// If device search has been unsuccessful, the new +// search is asked with this query from user. +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_try_again_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_bt_no_devices_found; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Ask BT power mode setting from user +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_power_is_off_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_bt_is_off; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Ask BT power mode setting from user in offline mode +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_activate_in_offline_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_bt_activate_in_offline; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Inform user that data receiving failed because of low memory. +//---------------------------------------------------- +// +RESOURCE DIALOG r_memlo_memory_low_data_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_memlo_memory_low_data; + animation = R_QGN_NOTE_ERROR_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Inform user that data receiving to MMC failed because of low memory. +//---------------------------------------------------- +// +RESOURCE DIALOG r_memlo_mmc_memory_low_data_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_memlo_mmc_memory_low_data; + animation = R_QGN_NOTE_ERROR_ANIM; + }; + } + }; + } + +RESOURCE DIALOG r_bt_passkey_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +// === NOTES ================================================================= + +//---------------------------------------------------- +// Wait note right after bluetooth device search +// has been launched. +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_searching_devices_note + { + flags = EAknWaitNoteFlags | EEikDialogFlagWait; + buttons = r_bt_softkeys_empty_cancel; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTNotifSearchingDevicesNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_bt_searching; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note when maximum number of connections +// is reached and new one could not be created. +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_busy_note + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTNotifBtBusyNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_busy; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + + +// === ANIMATIONS ============================================================ + +//---------------------------------------------------- +// Animation for r_bt_searching_devices_popuplist +//---------------------------------------------------- +// +RESOURCE BMPANIM_DATA r_bt_animation_for_popuplist + { + frameinterval = 200; + playmode = EAknBitmapAnimationPlayModeCycle; + bmpfile = btnotif_bitmap_file_data_caging; + frames = r_bt_animation_for_popuplist_images; + } + +//---------------------------------------------------- +// Image frames for r_bt_animation_for_popuplist_images +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_animation_for_popuplist_images + { + items= + { + BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup_2; maskid=EMbmBtnotifQgn_note_bt_popup_2_mask; }, + BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup; maskid=EMbmBtnotifQgn_note_bt_popup_mask; }, + BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup_3; maskid=EMbmBtnotifQgn_note_bt_popup_3_mask; }, + BMPANIM_FRAME {bmpid=EMbmBtnotifQgn_note_bt_popup; maskid=EMbmBtnotifQgn_note_bt_popup_mask; } + }; + } + +//--------------------------------------------------------------- +// Prompts for Remote SIM Access Profile notes +//---------------------------------------------------------------- +RESOURCE TBUF r_bt_enter_sap_note { buf = qtn_bt_wait_sap_entering; } + +RESOURCE TBUF r_bt_enter_sap_succeed_note { buf = qtn_bt_sap_entering_succeeded; } + +RESOURCE TBUF r_bt_enter_sap_failed_note { buf = qtn_bt_sap_entering_failed; } + +RESOURCE TBUF r_bt_min_passkey_prompt { buf = qtn_bt_enter_pk_sap; } + +//---------------------------------------------------- +// Data query "Enter Bluetooth name for your phone" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_enter_local_name_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_enter_bt_name; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + maxlength = KBTUIMaxNameLength; + }; + }; + } + }; + } +// --------------------------------------------------- +// +// r_bt_generic_message_query +// +// This is the query blanket used by Generic Message queries. +// They are java power and java visibility at the time +// of this writing, but probably in the future there will be +// others. +// --------------------------------------------------- +// +RESOURCE DIALOG r_bt_generic_message_query + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +//---------------------------------------------------- +// r_bt_generic_query +// +// This is the blanket for all the generic yes/no queries, which +// do NOT use message query. This is not only used by CBTNGenericQueryNotifier +// but other notifiers such as PinNotifier use also this. +// +// NOTE: There is no blanket for empty genric message. +// It is just based on empty CAknInformationNote. +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_generic_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note that will be shown when temp +// visibility expire. +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_hidden_from_others_note + { + buf = qtn_bt_hidden_from_others; + } +//---------------------------------------------------- +// Block devices related items +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_block_device_header + { + buf = qtn_bt_block_device_header; + } + +//---------------------------------------------------- +// Blocking question asked, when the +// user is asked about blocking a non-paired device. +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_block_device_nohelp + { + buf= qtn_bt_block_all_conn_attempts; + } + +//---------------------------------------------------- +// Blocking question asked, when the +// user is asked about blocking a paired device. +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_block_paired_device_nohelp + { + buf= qtn_bt_block_paired_device; + } + +//---------------------------------------------------- +// Query for incoming pairing request +//---------------------------------------------------- +RESOURCE TBUF r_bt_accept_pairing_request + { + buf=qtn_bt_accept_pairing_request; + } + +//---------------------------------------------------- +// Information note that will be shown when temp +// visibility expire. +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_no_device_discovery_voip { buf = qtn_bt_no_device_discovery_voip; } + +//---------------------------------------------------- +// Information note that will be shown if SIM card +// is not available while trying SAP connection. +//---------------------------------------------------- +// + +RESOURCE TBUF r_bt_sap_no_sim_note { buf = qtn_bt_sap_no_sim; } + +//---------------------------------------------------- +// Information note when maximum number of connections +// is reached and new one could not be created. +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_turn_bt_off_note + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + label = qtn_bt_dos_query; + }; + } + }; + } + + +//--------------------------------------------------- +// Title for search filter +//--------------------------------------------------- +RESOURCE TBUF r_bt_search_filter_popup_title { buf = qtn_bt_search_for; } + +//---------------------------------------------------- +//List item text in search filter +//---------------------------------------------------- +RESOURCE TBUF r_bt_search_for_all { buf = qtn_bt_search_for_all; } +RESOURCE TBUF r_bt_search_for_phone { buf = qtn_bt_search_for_phone; } +RESOURCE TBUF r_bt_search_for_computer { buf = qtn_bt_search_for_computer; } +RESOURCE TBUF r_bt_search_for_audio { buf = qtn_bt_search_for_audio; } +RESOURCE TBUF r_bt_search_for_input { buf = qtn_bt_search_for_input; } + +//------------------------------------------------------------ +// query for unblocking selected blocked device +//------------------------------------------------------------ +RESOURCE DIALOG r_bt_unblock_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_unblock_device { buf = qtn_bt_unblock_device; } + +//---------------------------------------------------- +// Information note for AVRCP 1.3 Battery low info +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_accessory_low { buf = qtn_bt_accessory_low; } +RESOURCE TBUF r_bt_accessory_critical { buf = qtn_bt_accessory_critical; } +RESOURCE TBUF r_bt_permanently_on { buf = qtn_bt_permanently_on; } +RESOURCE TBUF r_bt_switched_on { buf = qtn_bt_switched_on; } +RESOURCE TBUF r_bt_switched_off { buf = qtn_bt_switched_off; } + +//---------------------------------------------------- +// SSP NumericComparison and PasskeyEntry +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_ssp_passkey_comparison_prompt { buf = qtn_bt_simple_passkey_comparison; } +RESOURCE TBUF r_bt_ssp_passkey_entry { buf = qtn_bt_simple_passkey_entry; } + +//---------------------------------------------------- +// Confirmation note "Pairing successfully done with %U" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_succesfully_paired_prompt { buf = qtn_bt_succesfully_paired; } + +//---------------------------------------------------- +// Error notes of SSP +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_pairing_failed_prompt { buf = qtn_bt_pairing_failed; } +RESOURCE TBUF r_bt_ssp_busy { buf = qtn_bt_simple_busy; } + +//----------------------------------------------------------------------------- +// Confirmation note "Authorise this device to make connections automatically?" +//----------------------------------------------------------------------------- +// +RESOURCE TBUF r_bt_authorization_prompt { buf = qtn_bt_authorisation_query; } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/eabi/BTNotifu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/eabi/BTNotifu.DEF Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z13NotifierArrayv @ 1 NONAME + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/ecom/101FD68F.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/ecom/101FD68F.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,48 @@ +/* +* 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 specifies the interface and implementation information +* for BTnotif Ecom Plugins. +* +*/ + + +#include +#include + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + +RESOURCE REGISTRY_INFO theInfo +{ + dll_uid = 0x101FD68F; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUikonUidPluginInterfaceNotifiers; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101FD690; + version_no = 1; + display_name = "TTNOTIFY2V2 Plugin 1"; + default_data = "TTNOTIFY2V2"; + opaque_data = "0"; + } + }; + } + }; +} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/ecom/BtnotifWrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/ecom/BtnotifWrapper.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,223 @@ +/* +* 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: Methods for BT notifier Ecom Plugins entry point +* +*/ + + +#include +#include // link against aknnotifierwrapper.lib +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include // define btninqnotifer uid +#else +#include // define btninqnotifer uid +#include // define btninqnotifer uid +#endif +#include // notifier id for power mode setting + +// @todo remove this declaration once both stack and UI layers are in codeline +const TUid KBTUserConfirmationNotifierUidCopyForWrapper={0x2002E224}; + + +const TInt KMaxSynchReplyBufLength = 256; //what should be? + +const TUid KBTInquiryChannel = {0x00000601}; // Channel for inquiry notifier +const TUid KBTAuthorisationChannel = {0x00000602}; // Channel for authorisation notifier +const TUid KBTAuthenticationChannel = {0x00000603}; // Channel for PIN query notifier +const TUid KBTObexPINChannel = {0x00000605}; // Channel for OBEX PIN notifier +const TUid KBTPowerModeChannel = {0x00000606}; // Channel for power mode notifier +const TUid KBTPairedDeviceSettingChannel = {0x00000610}; // Channel for Visibility timeout notifier + +const TInt KBTInquiryPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTAuthorisationPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTAuthenticationPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTObexPinPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTPowerModePriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTGenericInfoNotifierPriority = MEikSrvNotifierBase2::ENotifierPriorityHigh; +const TInt KBTGenericQueryNotifierPriority = MEikSrvNotifierBase2::ENotifierPriorityHigh; +const TInt KBTNumericComparisonPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; // for SSP +const TInt KBTPasskeyEntryNotifierPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; // for SSP +const TInt KBTUserConfirmationNotifierPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; // for SSP +const TInt KBTPairedDeviceSettingPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh; +const TInt KBTEnterpriseItSecurityInfoNotifierPriority = MEikSrvNotifierBase2::ENotifierPriorityHigh; + +const TInt KBTNotifierArrayIncrement = 8; + +void CleanupArray(TAny* aArray) + { + CArrayPtrFlat* + subjects=static_cast*>(aArray); + TInt lastInd = subjects->Count()-1; + for (TInt i=lastInd; i >= 0; i--) + subjects->At(i)->Release(); + delete subjects; + } + +CArrayPtr* DoCreateNotifierArrayL() + { + + CArrayPtrFlat* subjects= + new (ELeave)CArrayPtrFlat(KBTNotifierArrayIncrement); + + CleanupStack::PushL(TCleanupItem(CleanupArray, subjects)); + + // Create Wrappers + + // Session owning notifier(if default implementation is enough) + + CAknCommonNotifierWrapper* master = + CAknCommonNotifierWrapper::NewL( KDeviceSelectionNotifierUid, + KBTInquiryChannel, + KBTInquiryPriority, + _L("BTNotif.dll"), + KMaxSynchReplyBufLength); + + CleanupStack::PushL( master ); + subjects->AppendL( master ); + CleanupStack::Pop( master ); + + // Notifiers using masters session + CAknNotifierWrapperLight* notif = NULL; + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTManAuthNotifierUid, + KBTAuthorisationChannel, + KBTAuthorisationPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTPinCodeEntryNotifierUid, + KBTAuthenticationChannel, + KBTAuthenticationPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTObexPasskeyQueryNotifierUid, + KBTObexPINChannel, + KBTObexPinPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KPowerModeSettingNotifierUid, + KBTPowerModeChannel, + KBTPowerModePriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTGenericInfoNotifierUid, + KBTGenericInfoNotifierUid, + KBTGenericInfoNotifierPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTGenericQueryNotifierUid, + KBTGenericQueryNotifierUid, + KBTGenericQueryNotifierPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KPbapAuthNotifierUid, + KBTObexPINChannel, + KBTObexPinPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTPairedDeviceSettingNotifierUid, + KBTPairedDeviceSettingChannel, + KBTPairedDeviceSettingPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTNumericComparisonNotifierUid, + KBTNumericComparisonNotifierUid, + KBTNumericComparisonPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTPasskeyDisplayNotifierUid, + KBTPasskeyDisplayNotifierUid, + KBTPasskeyEntryNotifierPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTUserConfirmationNotifierUidCopyForWrapper, + KBTUserConfirmationNotifierUidCopyForWrapper, + KBTUserConfirmationNotifierPriority); + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + notif = new (ELeave) CAknNotifierWrapperLight(*master, + KBTEnterpriseItSecurityInfoNotifierUid, + KBTEnterpriseItSecurityInfoNotifierUid, + KBTEnterpriseItSecurityInfoNotifierPriority); + + CleanupStack::PushL( notif ); + subjects->AppendL( notif ); + CleanupStack::Pop( notif ); + + CleanupStack::Pop(); // array cleanup + return(subjects); + } + + +CArrayPtr* NotifierArray() + // old Lib main entry point + { + + CArrayPtr* array = 0; + TRAPD(ignore, array = DoCreateNotifierArrayL()); + if (ignore != KErrNone) + { + ignore = KErrNone; + } + return array; + } + +const TImplementationProxy ImplementationTable[] = + { +#ifdef __EABI__ + {{0x101FD690},(TFuncPtr)NotifierArray} +#else + {{0x101FD690},NotifierArray} +#endif + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; + return ImplementationTable; + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/ecom/BtnotifWrapper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/ecom/BtnotifWrapper.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: This is project specification file for the BTNotif Ecom Plugins. +* +*/ + + +#include + +TARGET btnotifwrapper.DLL +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN + +VENDORID VID_DEFAULT + +UID 0x10009D8D 0x101FD68F + +SOURCEPATH . +USERINCLUDE ../inc + + +SYSTEMINCLUDE /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + + + +LANG SC +SOURCE BtnotifWrapper.cpp +START RESOURCE 101FD68F.rss +TARGET btnotifwrapper.rsc +END + +LIBRARY ECOM.LIB +LIBRARY AKNNOTIFIERWRAPPER.LIB +LIBRARY EUSER.LIB diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/group/BTNotif.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/group/BTNotif.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* 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 BTNotif. +* +*/ + +#include +#include + +TARGET BTNotif.dll +TARGETTYPE DLL +UID 0x101fdfae 0x10005953 +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +SOURCEPATH ../src +SOURCE BTNMain.cpp +SOURCE BTNotifier.cpp +SOURCE BTNAuthNotifier.cpp +SOURCE BTNPinNotifier.cpp +SOURCE BTNInqNotifier.cpp +SOURCE BTNInqUI.cpp +SOURCE BTNInquiAO.cpp +SOURCE BTNObexPinNotifier.cpp +SOURCE BTNPwrNotifier.cpp +SOURCE BTNGenericInfoNotifier.cpp +SOURCE BTNGenericQueryNotifier.cpp +SOURCE BTNPBAPPinNotifier.cpp +SOURCE btnpaireddevsettnotifier.cpp +SOURCE btnssppasskeyentrynotifier.cpp +SOURCE btnumcmpnotifier.cpp +SOURCE btuserconfnotifier.cpp +SOURCE btnotifuiutil.cpp +SOURCE btnotifactive.cpp +SOURCE btnpairnotifier.cpp +SOURCE btnotifnameutils.cpp +SOURCE btnenterpriseitsecurityinfonotifier.cpp + +START RESOURCE ../data/BTNotif.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../inc //for private API headers (BluetoothEngine subsystem) +SYSTEMINCLUDE ../../../inc //for internal API headers (localconnectivity) +APP_LAYER_SYSTEMINCLUDE // Standard system include paths + +LIBRARY euser.lib cone.lib // Symbian OS framework libraries +LIBRARY avkon.lib // UI library +LIBRARY bafl.lib // Basic Application Framework Library +LIBRARY bluetooth.lib // Bluetooth libraries +LIBRARY btdevice.lib // Bluetooth library +LIBRARY btextnotifiers.lib // Bluetooth library + +//Bteng New APIs +LIBRARY btengdevman.lib //btengdevman.dll +LIBRARY btengsettings.lib //btengsettings.dll +LIBRARY btengconnman.lib //btengconnman.dll + +LIBRARY commonengine.lib // Series 60 common components library +LIBRARY charconv.lib // Character conversion library +LIBRARY eikcoctl.lib eiksrv.lib // Eikon libraries +LIBRARY eikcore.lib // Library for eikonEnv static functions (BringForwards) +LIBRARY eiksrvui.lib // Eikon server ui (for suppressing app -key) +LIBRARY esock.lib // Sockects library for host resolver +LIBRARY AknSkins.lib // Skinned icons +LIBRARY aknicon.lib +LIBRARY aknNotifierWrapper.lib +LIBRARY centralrepository.lib // Central Repository +LIBRARY egul.lib +LIBRARY CdlEngine.lib AknLayout2.lib +LIBRARY btmanclient.lib // reguired by TBTRegistrySearch +LIBRARY hlplch.lib // required by help callback + +// For cover display support: +LIBRARY eikdlg.lib +LIBRARY estor.lib +LIBRARY FeatMgr.lib +LIBRARY efsrv.lib +LIBRARY etul.lib + +DEBUGLIBRARY flogger.lib // File logging services + +//Optional for codewarrior ide +//DOCUMENT data/BTNotif.rss +//DOCUMENT BTNotif.loc + +CAPABILITY CAP_GENERAL_DLL +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/group/bld.inf --- a/bluetoothengine/btnotif/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btnotif/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -19,21 +19,30 @@ #include PRJ_PLATFORMS -DEFAULT +//DEFAULT PRJ_EXPORTS +../loc/btnotif.loc MW_LAYER_LOC_EXPORT_PATH(btnotif.loc) +../rom/Btnotif.iby CORE_MW_LAYER_IBY_EXPORT_PATH(Btnotif.iby) +../rom/BtnotifResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(BtnotifResources.iby) +../inc/devui_const.h |../../inc/devui_const.h -../rom/btnotif.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btnotif.iby) -../inc/bluetoothdevicedialogs.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/bluetoothdevicedialogs.h) +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE btnotif.mif +OPTION HEADERFILE btnotif.mbg +OPTION SOURCES -c8,8 qgn_note_bt_popup -c8,8 qgn_note_bt_popup_2 \ + -c8,8 qgn_note_bt_popup_3 -c8,8 qgn_indi_bt_blocked +END + PRJ_MMPFILES -btnotifsrv.mmp -btnotifwrapper.mmp +// gnumakefile btnotif_icons_dc.mk + +../group/BTNotif.mmp +../ecom/BtnotifWrapper.mmp PRJ_TESTMMPFILES -//../btnotifsrv/tsrc/btnotifsrvtest/group/btnotifsrvtest.mmp -//../btnotifsrv/tsrc/btnotifsrvtest/group/btnotifserversessiontest.mmp -//../btnotifwrapper/tsrc/btnotifwrappertest/group/btnotifwrappertest.mmp - -PRJ_TESTEXPORTS +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/group/btnotif_icons_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/group/btnotif_icons_dc.mk Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,75 @@ +# +# 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\btnotif.mif + +HEADERDIR=\epoc32\include +HEADERFILENAME=$(HEADERDIR)\btnotif.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 qgn_note_bt_popup.bmp \ + /c8,8 qgn_note_bt_popup_2.bmp \ + /c8,8 qgn_note_bt_popup_3.bmp \ + /c8,8 qgn_indi_bt_blocked.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/group/btnotifsrv.mmp --- a/bluetoothengine/btnotif/group/btnotifsrv.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifsrv.mmp -* Part of : bluetoothengine / btnotif -* Description : Project definition file for project btnotif -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include -#include - -TARGET btnotifsrv.exe -TARGETTYPE exe -UID 0x1000008d 0x20026FED - -CAPABILITY CAP_SERVER NetworkControl PowerMgmt CommDD -VENDORID VID_DEFAULT - -SOURCEPATH ../btnotifsrv/src -SOURCE btnotifserver.cpp -SOURCE btnotifsession.cpp -SOURCE btnotifconnectiontracker.cpp -SOURCE btnotifsettingstracker.cpp -SOURCE btnotificationmanager.cpp -SOURCE bluetoothnotification.cpp -SOURCE btnotifdeviceselector.cpp -SOURCE btnotifpairnotifier.cpp -SOURCE btnotifbasepairinghandler.cpp -SOURCE btnotifincomingpairinghandler.cpp -SOURCE btnotifoutgoingpairinghandler.cpp -SOURCE btnotifsecuritymanager.cpp -SOURCE btnotifserviceauthorizer.cpp -SOURCE btnotifutil.cpp - -USERINCLUDE ../btnotifsrv/inc ../inc - -MW_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE ../../inc -SYSTEMINCLUDE ../../../inc - -LIBRARY euser.lib -LIBRARY esock.lib -LIBRARY bluetooth.lib -LIBRARY btdevice.lib -LIBRARY btmanclient.lib -LIBRARY btextnotifiers.lib -LIBRARY btengsettings.lib -LIBRARY btengconnman.lib -LIBRARY btengdevman.lib -LIBRARY btserviceutil.lib -LIBRARY HbCore.lib -LIBRARY commonengine.lib -LIBRARY flogger.lib -LIBRARY charconv.lib - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/group/btnotifwrapper.mmp --- a/bluetoothengine/btnotif/group/btnotifwrapper.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifwrapper.mmp -* Part of : bluetoothengine / btnotifwrapper -* Description : Project definition file for project btnotifwrapper -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1 -*/ - -#include -#include - -TARGET btnotifwrapper.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101FD68F - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -START RESOURCE ../btnotifwrapper/data/101fd68f.rss -HEADER -TARGET btnotifwrapper.rsc -END // RESOURCE - -SOURCEPATH ../btnotifwrapper/src -SOURCE btnotifwrapper.cpp -SOURCE btnotifwrapperproxy.cpp - -USERINCLUDE ../btnotifwrapper/inc ../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../../inc - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY eiksrv.lib -LIBRARY btnotifclient.lib -LIBRARY btserviceutil.lib - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/BTNGenericInfoNotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,103 @@ +/* +* 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: Declares generic information notifier class. +* +*/ + + +#ifndef BTNGENERICINFONNOTIFIER_H +#define BTNGENERICINFONNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class + +// FORWARD DECLARATIONS +class CAknInformationNote; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CBTGenericInfoNotifier) : public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTGenericInfoNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTGenericInfoNotifier(); + + private: // Functions from base classes + + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** From CBTNotifierBase Synchronic notifier launch. + * @param aBuffer Received parameter data. + * @return A pointer to return value. + */ + TPtrC8 StartL(const TDesC8& aBuffer ); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + private: + + /** + * Parse the data out of the message that is sent by the client of the notifier. + * @param aBuffer A package buffer containing received parameters. + * @return None. + */ + void ProcessParamBufferL(const TDesC8& aBuffer, TBool aSyncCall); + + /** + * C++ default constructor. + */ + CBTGenericInfoNotifier(); + + /** + * Show Information note and complete message. + */ + void ShowNoteAndCompleteL(TBool aSyncCall); + + private: + RBuf iQueryMessage; + TInt iMessageResourceId; + TSecondaryDisplayBTnotifDialogs iSecondaryDisplayCommand; + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/BTNGenericQueryNotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/BTNGenericQueryNotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,137 @@ +/* + * 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: Declares Generic Query Notifier Class. + * + */ + +#ifndef BTNGENERICQUERYNOTIFIER_H +#define BTNGENERICQUERYNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class +#include "btnotifactive.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +NONSHARABLE_CLASS(CBTGenericQueryNotifier): public CBTNotifierBase, + public MBTNotifActiveObserver + { +public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTGenericQueryNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTGenericQueryNotifier(); + +private: + // Functions from base classes + + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** From CBTNotifierBase Synchronic notifier launch. + * @param aBuffer Received parameter data. + * @return A pointer to return value. + */ + TPtrC8 StartL(const TDesC8& aBuffer); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + TPtrC8 UpdateL(const TDesC8& aBuffer); + + /** + * From MBTNotifActiveObserver + * Gets called when P&S key notifies change. + */ + void RequestCompletedL(CBTNotifActive* aActive, TInt aId, TInt aStatus); + + /** + * From MBTNotifActiveObserver + */ + void HandleError(CBTNotifActive* aActive, TInt aId, TInt aError); + + /** + * From MBTNotifActiveObserver + */ + void DoCancelRequest(CBTNotifActive* aActive, TInt aId); + +private: + + /** + * Parse the data out of the message that is sent by the client of the notifier. + * @param aBuffer A package buffer containing received parameters. + * @return None. + */ + void ProcessParamBufferL(const TDesC8& aBuffer); + + /** + * C++ default constructor. + */ + CBTGenericQueryNotifier(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Show query and complete message. + */ + void ShowQueryAndCompleteL(); + +private: + + RBuf iQueryMessage; + HBufC* iQueryHeader; + HBufC* iName; + + TInt iMessageResourceId; + TSecondaryDisplayBTnotifDialogs iSecondaryDisplayCommand; + TBool iIsMessageQuery; + TBool iIsNameQuery; + RProperty iPhonePowerKey; + CBTNotifActive* iPhonePowerKeyWatcher; + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h --- a/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -/* -* ============================================================================ -* Name : bluetoothdevicedialogs.h -* Part of : bluetoothengine / btnotif -* Description : Data structures for passing dialog type and formatting between btnotif and the UI component showing the actual dialogs. Also defines identifiers for Bluetooth device dialogs. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BLUETOOTHDEVICEDIALOGS_H -#define BLUETOOTHDEVICEDIALOGS_H - -#include - -/** Enumeration for the type of notification to be launched. */ -enum TBTDialogResourceId - { - ENoResource, - EAuthorization, - EIncomingPairing, - EPinInput, - ENumericComparison, - EPasskeyDisplay, - EObexPasskeyInput, - ESetTrusted, - EBlockUnpairedDevice, - EBlockPairedDevice, - EPairingSuccess, - EPairingFailureRetry, - EPairingFailureOk, - EVisibilityTimeout, - EUnpairedDevice, - EUnusedResource // The last ID - }; - - -/** - * TBluetoothDialogParams contains device dialog parameters except for device name and type - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( TBluetoothDialogParams ) - { - -public: - - /** Enumeration for the type of notification to be launched. */ - enum TBTDialogType - { - EInvalidDialog, - ENote, - EQuery, - EInput, - EMoreDevice, - EDeviceSearch, - ESend, - EGlobalNotif, - EUserAuthorization, - EReceiveProgress, - ETransferFailed, - EReceiveDone - }; - - /** Enumeration for the notification parameters data type to be configured. */ - enum TDialogDataType - { - ENoParams, - EDialogType, - EResource, - EAddress, - EDialogTitle, - EDialogExt // Id for first data type of derived class. - }; - - /** Enumeration for the notification dialog heading type. */ - enum TDialogTitleDataType - { - EReceive, - EReceiveFromPairedDevice, - EConnect, - EPairingRequest, - ERecvFailed, - ESendFailed, - EReceiveCompleted - }; - - enum TDialogActionType - { - EHide, - EShow, - ECancelReceive, - ECancelShow - }; - - inline TBluetoothDialogParams(); - -public: // data - - /** - * Identifier for the type of notification. - */ - TInt iDialogType; - - /** - * Identifier for the resource to be shown in the dialog. - */ - TInt iResourceId; - - /** - * Address of the remote device (not used, for future extension). - */ - TBTDevAddr iAddr; - - /** - * Unused padding (not used, for future extension). - */ - TUint32 iPadding; - - }; - - -/** - * TBluetoothDeviceDialog contains more device dialog parameters - * - * @since Symbian^4 - */ -NONSHARABLE_CLASS( TBluetoothDeviceDialog ) : public TBluetoothDialogParams - { - -public: - - /** Enumeration for the notification parameters data type to be configured. */ - enum TDialogDataType - { - ENoParams = TBluetoothDialogParams::EDialogExt, - EDeviceName, - EDeviceClass, - EAdditionalInt, - EAdditionalDesc, - EReceivingFileName, - EReceivingFileSize, - EReceivedFileCount - }; - - inline TBluetoothDeviceDialog(); - -public: // data - - /** - * The name of the remote device. - */ - TBTDeviceName iDeviceName; - - /** - * The class of device of the remote device. - */ - TInt iDeviceClass; - - /** - * Additional data depending on the resource. - */ - TInt iIntParam; - - /** - * Additional data depending on the resource. - */ - TBuf<10> iDescParam; - - }; - - -/** Typedef'ed pckgbuf to send dialog parameters to the notification framework. */ -typedef TPckgBuf TBluetoothDialogParamsPckg; - -/** Typedef'ed pckgbuf to send dialog parameters to the notification framework. */ -typedef TPckgBuf TBluetoothDeviceDialogPckg; - - -inline TBluetoothDialogParams::TBluetoothDialogParams() -: iDialogType( EInvalidDialog ), - iResourceId( ENoResource ), - iAddr( TBTDevAddr() ), - iPadding( 0 ) - { - } - -inline TBluetoothDeviceDialog::TBluetoothDeviceDialog() -: iDeviceName( 0 ), - iDeviceClass( 0 ), - iIntParam( 0 ) - { - } - - -#endif // BLUETOOTHDEVICEDIALOGS_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/bluetoothtrace.h --- a/bluetoothengine/btnotif/inc/bluetoothtrace.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,455 +0,0 @@ -/* -* ============================================================================ -* Name : bluetoothtrace.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : API declaration of run-time debug tracing -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BLUETOOTHTRACE_H -#define BLUETOOTHTRACE_H - -#include -#include "traceconfig.h" - -/* - * Common tracing utility definition to be used by Bluetooth projects. - * The configuration is loaded from traceconfig.h which shall be private for - * each individual project. - * - * In this utility, a set of OST-alike tracing macros are defined. - * (The purpose is to ease migration to OST in future.) - * - * Individual project can also define new macros based on this utility in - * its own space. - * - */ - -#ifdef BLUETOOTHTRACE_ENABLED - -#ifdef BLUETOOTHTRACE_MEDIA_OST - -/** - * Convert own macros to OST macros when OST tracing is used. - * In OST tracing, aTraceName must be a unique identifier in scope of a module. - * Thus many OST compiling errors may occur if the same TraceName is used in multiple - * tracing lines where tracing is miigrated from non-OST to OST. - * The fix is to renaming the TraceName:s to be unique. - */ -#include - -#define BOstrace0( aGroupName, aTraceName, aTraceText ) \ - OstTrace0( aGroupName, aTraceName, aTraceText ) - -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \ - OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) - -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \ - OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) - -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \ - OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) - -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ - OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) - -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ - OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) - -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ - OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) - -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ - OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) - -#define BOstraceFunctionEntry0( aTraceName ) \ - OstTraceFunctionEntry0( aTraceName ) - -#define BOstraceFunctionEntry1( aTraceName, aInstance ) \ - OstTraceFunctionEntry1( aTraceName, aInstance ) - -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ - OstTraceFunctionEntryExt(aTraceName, aInstance, aArg) - -#define BOstraceFunctionExit0( aTraceName ) \ - OstTraceFunctionExit0( aTraceName ) - -#define BOstraceFunctionExit1( aTraceName, aInstance ) \ - OstTraceFunctionExit1( aTraceName, aInstance ) - -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ - OstTraceFunctionExitExt(aTraceName, aInstance, aRetval) - -#define BOstraceEventStart0( aTraceName, aEventName ) \ - OstTraceEventStart0( aTraceName, aEventName ) - -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ - OstTraceEventStart1( aTraceName, aEventName, aParam ) - -#define BOstraceEventStop( aTraceName, aEventName ) \ - OstTraceEventStop( aTraceName, aEventName ) - -#define BOstraceState0( aTraceName, aStateName, aNewState ) \ - OstTraceState0( aTraceName, aStateName, aNewState ) - -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ - OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) - -#else // BLUETOOTHTRACE_MEDIA_OST - -#ifdef BLUETOOTHTRACE_MEDIA_FILE -#include -#else -#include -#endif - -/** - * When tracing compilation with OST is disabled, the TraceName in each OST trace line - * is ignored, that is, the Trace Names are not checked at compiling time, neither - * are they written into the specified trace output media. - */ - -/** - * Handlers below are used for tolerating overflow of formatting strings. - * to trucate rather than panic the caller. - */ -NONSHARABLE_CLASS( TBtTraceOflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TBtTraceOflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -/** - * internal tracing implementation, do not use it out of this file. - */ -inline void Trace(const TDesC &trGrp, const TDesC &trTxt) -{ - _LIT(Format, "%S%S%S"); - TBuf16<0x180> str; - TPtrC cp(KComponentName); - str.Format(Format, &cp, &trGrp, &trTxt); -#ifdef BLUETOOTHTRACE_MEDIA_FILE - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, str); -#else - RDebug::Print( str ); -#endif -} - -/* - * trace with no parameters - */ -#define BOstrace0( aGroupName, aTraceName, aTraceText ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - Trace( TrGrp, TrTxt ); \ -} - -/* - * trace with one 32-bit parameter - */ -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with more than 32 bits of data. Not supported - */ -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) - -/* - * trace with one parameter that is not 32-bit integer - */ -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \ - BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) - -/* - * trace with two parameters. - */ -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with three parameters. - */ -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with four parameters - */ -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with five parameters - */ -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace without extra parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntry0( aTraceName ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace with a parameter representing the instance identifier, e.g. - * "this" pointer. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntry1( aTraceName, aInstance ) \ -{\ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace, which traces function parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ -{ \ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \ - Trace( TrGrp, buf ); \ -} -/* - * Function exit trace without extra parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExit0( aTraceName ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function exit trace with a parameter representing the instance identifier - * for example "this" pointer. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExit1( aTraceName, aInstance ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function exit trace with parameters representing the instance identifier, - * for example "this" pointer, and return value. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ -{\ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event start trace without extra parameters. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStart0( aTraceName, aEventName ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event start trace with single 32-bit parameter. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] %S 0x%X(%d)"); \ - TPtrC evt(EvName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event end trace. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStop( aTraceName, aEventName ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Stop] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ -} - -/* - * State transition event. - * The trace is mapped to TRACE_STATE group. - */ -#define BOstraceState0( aTraceName, aStateName, aNewState ) \ -{\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \ - Trace( TrGrp, buf ); \ -} - -/* - * State transition event with instance identifier. - * The trace is mapped to TRACE_STATE group. - */ -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ -{\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ - Trace( TrGrp, buf ); \ -} - -#endif // BLUETOOTHTRACE_MEDIA_OST - -// Extended tracing macros facilitating domain specific tracing needs: - -/* - * A block of source code merely for tracing purpose. - */ -#define BtTraceBlock( exp ) {exp} - -/* - * trace macro for BT device address printing with an additional trace text. - * aParam must be TBTDevAddr type. - */ -#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) \ -{ \ - _LIT(TrTxt, aTraceText); TPtrC p(TrTxt); \ - TBuf<12> buf; \ - aParam.GetReadable( buf ); TPtrC p2(buf);\ - BOstraceExt2( aGroupName, aTraceName, "%S%S", &p, &p2 ); \ -} - -/* - * trace macro for BT device address printing with no additional trace text. - * aParam must be TBTDevAddr type. - */ -#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) \ -{ \ - TBuf<12> buf; aParam.GetReadable( buf ); TPtrC p(buf); \ - BOstraceExt1( aGroupName, aTraceName, "%S", &p ); \ -} - -#else // BLUETOOTHTRACE_ENABLED - -#define BOstrace0( aGroupName, aTraceName, aTraceText ) -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) - -#define BOstraceFunctionEntry0( aTraceName ) -#define BOstraceFunctionEntry1( aTraceName, aInstance ) -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) -#define BOstraceFunctionExit0( aTraceName ) -#define BOstraceFunctionExit1( aTraceName, aInstance ) -#define BOstraceEventStart0( aTraceName, aEventName ) -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) -#define BOstraceEventStop( aTraceName, aEventName ) -#define BOstraceState0( aTraceName, aStateName, aNewState ) -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) - -#define BtTraceBlock( exp ) -#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) -#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) - -#endif // BLUETOOTHTRACE_ENABLED - -/* - * Additional general purpose definition, a hook for defining a friend class - * for unit testing to get access to class internals. - */ -#ifndef BTUNITTEST -#define BTUNITTESTHOOK -#endif - -#endif // BLUETOOTHTRACE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btNotifDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btNotifDebug.h Wed Sep 01 12:20:04 2010 +0100 @@ -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: This file defines logging macros for BT Notifiers +* +*/ + + +#ifndef BTNOTIF_DEBUG_H +#define BTNOTIF_DEBUG_H + + +#ifdef _DEBUG + +#include +#include + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#define FLOG(a) { FPrint(a); } +#define FTRACE(a) { a; } + +#include +#include + +_LIT(KLogFile,"btnotiflog.txt"); +_LIT(KLogDirFullName,"c:\\logs\\bt\\"); +_LIT(KLogDir,"BT"); + +// 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 FPrint(TRefByValue aFmt, ...) + { + + VA_LIST list; + VA_START(list, aFmt); + TBuf8<256> buf8; + buf8.AppendFormatList(aFmt, list); + + TBuf16<256> buf16(buf8.Length()); + buf16.Copy(buf8); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, buf16); + } + +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +#define FLOG(a) { RDebug::Print(a); } +#define FTRACE(a) { a; } + +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); + } + +inline void FPrint(TRefByValue aFmt, ...) + { + + VA_LIST list; + VA_START(list, aFmt); + TBuf8<256> buf8; + buf8.AppendFormatList(aFmt, list); + + TBuf16<256> buf16(buf8.Length()); + buf16.Copy(buf8); + + TRefByValue tmpFmt(_L("%S")); + RDebug::Print(tmpFmt, &buf16); + } + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG(a) +#define FTRACE(a) + +#endif // _DEBUG + + +#endif // BTNOTIF_DEBUG_H + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnauthnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnauthnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,166 @@ +/* +* 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: Declares authorisation notifier class. +* +*/ + + +#ifndef BTNAUTHNOTIFIER_H +#define BTNAUTHNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class +#include "btnotiflock.h" +#include "btnotifactive.h" +#include +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +NONSHARABLE_CLASS(CBTAuthNotifier): public CBTNotifierBase, public MBTNotifActiveObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTAuthNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTAuthNotifier(); + + private: // Functions from base classes + + /** + * From CBTNotifierBase Called when a notifier is first loaded. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + TPtrC8 UpdateL(const TDesC8& aBuffer); + + /** + * From CBTNotifierBase The notifier has been deactivated + * so resources can be freed and outstanding messages completed. + * @param None. + * @return None. + */ + void Cancel(); + + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + /** + * From MBTNotifActiveObserver + * Gets called when P&S key notifies change. + */ + void RequestCompletedL( CBTNotifActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTNotifActiveObserver + */ + void HandleError( CBTNotifActive* aActive, TInt aId, TInt aError ); + + /** + * From MBTNotifActiveObserver + */ + void DoCancelRequest( CBTNotifActive* aActive, TInt aId ); + + private: + + /** Checks if the notifier should be replied automatically and not shown to user. + * + *@the device + *@ return TRUE if the notifier should be replied immediately yes or no, without showing query. + */ + TBool GetByPassAudioNotifier(const TBTDevAddr& aDevice,TBool& aAccept); + + /** + *@param aAccepted. ETrue if user accepted the incoming audio connection. EFalse if not. + *@param aDeviceAddress. The address of the device that attempted audio connection. + */ + void MemorizeCurrentAudioAttempt(const TBool aAccept,const TBTDevAddr& aDeviceAddress); + + /** + * C++ default constructor. + */ + CBTAuthNotifier(); + + /** + * Ask user's response for authorization query + */ + void ShowAuthoQueryL(); + + /** + * After user rejects authorization, provide user the chance to turn BT off + * if it is a within a threshold. Query block the device according to logic of + * "second time for the same paired device". + */ + void DoRejectAuthorizationL(); + + /** + * Subscribe to P&S Key and check its value + */ + void CheckAndSubscribeNotifLocks(); + + private: // Data definitions + + enum TBTAuthState + { + EBTNormalAuthorisation, // Normal authorisation + EBTAutoAuthorisation, // Automated Authorisation + EBTAutoAuthorisationNotAuthorisedOnPhone, + EBTObexAuthorisation, // Obex authorisation for non paired devices + EBTObexAuthForPairedDevice // Obex authorisation for paired devices + + }; + + private: // Data + + TBTAuthState iAuthState; // Authorisation state + TInt iStrResourceId; + TSecondaryDisplayBTnotifDialogs iCoverUiDlgId; + TUint iServiceUid; + TBool iSuspended; + RProperty iNotifLockProp; + CBTNotifActive* iLockActive; + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnenterpriseitsecurityinfonotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnenterpriseitsecurityinfonotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,83 @@ +/* +* 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: Declares generic information notifier class. +* +*/ + +#ifndef BTNENTERPRISEITSECURITYINFONNOTIFIER_H +#define BTNENTERPRISEITSECURITYINFONNOTIFIER_H + +// INCLUDES +#include "btnotifier.h" // Base class + +// CLASS DECLARATION +NONSHARABLE_CLASS(CBTEnterpriseItSecurityInfoNotifier) : public CBTNotifierBase + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CBTEnterpriseItSecurityInfoNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTEnterpriseItSecurityInfoNotifier(); + +private: // Functions from base classes + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** From CBTNotifierBase Synchronic notifier launch. + * @param aBuffer Received parameter data. + * @return A pointer to return value. + */ + TPtrC8 StartL(const TDesC8& aBuffer); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + +private: + /** + * C++ default constructor. + */ + CBTEnterpriseItSecurityInfoNotifier(); + + /** + * Show Information note and complete message. + */ + void ShowNoteAndCompleteL(); + }; + +#endif //BTNENTERPRISEITSECURITYINFONNOTIFIER_H + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btninqnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btninqnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,100 @@ +/* +* 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: Declares Bluetooth device inquiry notifier class. +* +*/ + + +#ifndef BTNINQNOTIFIER_H +#define BTNINQNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class +#include "btninqui.h" +#include // Bluetooth notifiers API + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +/** +* This class is used in Bluetooth device search. +*/ +NONSHARABLE_CLASS(CBTInqNotifier): public CBTNotifierBase, public MBTNDeviceSearchObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTInqNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTInqNotifier(); + + + private: // Functions from base classes + /** + * From CBTNotifierBase Called when a notifier is first loaded. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase The notifier has been deactivated + * so resources can be freed and outstanding messages completed. + * @param None. + * @return None. + */ + void Cancel(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From MBTNDeviceSearchObserver Called when device search and selection completes. + * @param aErr Error code + * @param aDevice Response parameters to caller + * defined in epoc32\include\btextnotifiers.h + */ + void NotifyDeviceSearchCompleted(TInt aErr, const TBTDeviceResponseParams& aDevice = TBTDeviceResponseParams()); + + private: + + /** + * C++ default constructor. + */ + CBTInqNotifier(); + + void LaunchInquiryL(const TBTDeviceClass& aDesiredDevice); + + private: // Data + + CBTInqUI* iUi; // User interface module + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btninqui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btninqui.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,383 @@ +/* +* 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: Declares Bluetooth device inquiry user interface class. +* +*/ + + +#ifndef BTNINQUI_H +#define BTNINQUI_H + +// INCLUDES + +#include // Bluetooth notifiers API +#include // For array handling +#include +#include "btnotifactive.h" // Active Object Helper class for inquiry +#include +#include +#include "btnotifier.h" + +const TInt KPeriodicTimerInterval4Sec(4000000); + + +// FORWARD DECLARATIONS + +class CAknStaticNoteDialog; +class CAknSingleGraphicPopupMenuStyleListBox; +class CAknPopupList; +class CAknQueryDialog; +class CBTInqNotifier; + +// CONSTANTS +enum TSearchFlowState + { + ESearchCompleted, // search completed for any reason, end of UI flow. + ESearchAgain, // no device found, user wants to search again. + ESearchFirstDeviceFound, // the first device is found, show found device list. + }; + +// CLASS DECLARATION +/** + * Class MBTNDeviceSearchObserver + * + * Callback class to notify device searching completed. + */ +class MBTNDeviceSearchObserver + { +public: + + /** + * Callback to notify that the device search request has completed. + * + * @since S60 5.1 + * @param aErr Error code + * @param aDevice Pckgbuf to retrieve the response from the device selection. + */ + virtual void NotifyDeviceSearchCompleted(TInt aErr, + const TBTDeviceResponseParams& aDevice = TBTDeviceResponseParams()) = 0; + }; + +/** +* A helper class used in Bluetooth device search. +* This class is responsible of the UI activity. +*/ +NONSHARABLE_CLASS(CBTInqUI) : public CBase, public MBTEngDevManObserver, public MBTNotifActiveObserver + { + public: // Constructor and destructor + /** + * C++ default constructor. + */ + CBTInqUI( MBTNDeviceSearchObserver* aObserver, + CBTNotifUIUtil* aUtil, const TBTDeviceClass& aDesiredDevClass); + + /** + * The 2nd phase constructor is required to do Asyncronous operations, + * So the readiness of the CBTInqUI is notified Asynchronously to the caller + */ + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CBTInqUI(); + + public: // New functions + + /** + * Cancels all inquiry activity. + */ + void Cancel(); + + /** + * Issues a device inquiry request. + * @param None. + * @return None. + */ + void IssueRequestL(); + + /** + * Check if Eir device name available. + * @param TNameEntry Decode it to get device name + * @param TBTDeviceName Device name returned + * @param TBool Is the name returned complete + * @return ETrue if Eir data contains name. + */ + static TBool CheckEirDeviceName( TNameEntry& aEntry, TBTDeviceName& aName, TBool& aIsComplete ); + + private: // Functions from base classes + + /** + * From MBTNotifActiveObserver + */ + void RequestCompletedL( CBTNotifActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTNotifActiveObserver + */ + void HandleError( CBTNotifActive* aActive, TInt aId, TInt aError ); + + /** + * From MBTNotifActiveObserver + */ + void DoCancelRequest( CBTNotifActive* aActive, TInt aId ); + + /** + * From MBTEngDevManObserver + */ + void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); + + /** + * From MBTEngDevManObserver + */ + void HandleDevManComplete(TInt aErr); + + + private: + + /** + * Create the device search active object and prepare for search. + */ + void CreateScannerL(); + + /** + * Removes the device search active object if it still exists. + * @param None. + * @return None. + */ + void RemoveScanner(); + + /** + * Retrieves paired devices from BT Registry + * Calls HandleGetDevicesComplete, when done + */ + void RetrievePairedDevices(); + + /** + * Retrieves used devices from BT Registry + * Calls HandleGetDevicesComplete, when done + * @return None. + */ + void RetrieveUsedDevices(); + + /** + * Searches given BT Device from device array. + * @param aDeviceArray The device array to search in + * @param aDevice The device to be searched. + * @return Index of the device if found. + */ + TInt LookupFromDevicesArray( const CBTDeviceArray* aDeviceArray, const CBTDevice* aDevice ) const; + + /** + * Constructs a device popup list from resources. + * @param aSoftkeysResourceId Resource id for softkeys of the list. + * @param aTitleResourceId Resource id for the title of the list. + * @return None. + */ + void CreatePopupListL(TInt aSoftkeysResourceId, TInt aTitleResourceId ); + + /** + * Generates a format string and adds it to iDeviceItems array. + * Updates friendly name of given device if one is found from registry. + * @param aDevice The device to be added to list. + * @param aSignalStrength The signal bar for RSSI + * @return None. + */ + void AddToDeviceListBoxL(CBTDevice* aDevice, const TInt aSignalStrength = 0 ); + + /** + * Creates and adds local bitmap to icon array. + * @param aID Item ID of the masked bitmap to be created. + * @param aFilename Filename to be used to construct the item. + * @param aBitmapId The ID if bitmap + * @param aMaskId The ID of bitmap's mask + * @param aIconList The icon list for BT devices listbox. + */ + void CreateAndAppendIconL( const TAknsItemID& aID, + const TDesC& aFileName, + const TInt aBitmapId, + const TInt aMaskId, + CAknIconArray* aIconList); + + /** + * Adjust array, leave 5 lastet used devices in the array and remove the rest, + * and then insert the paired device array to this array by used time order. + * In the adjusted array, the first item will be the most lately used device. + * @param aDevArray The bluetooth device arrary to be adjusted. + * @return None. + */ + void AdjustDeviceArrayL( CBTDeviceArray* aDevArray); + + /** + * Filter for searching device + * @param The desired device class user selects from the filter + * @return User's input select/cancel + */ + void SelectSearchCategoryL(); + + /** + * Add filtering items to search device filter + * @param aResourceId + * @return None + */ + void AddItemToSearchFilterL ( TInt aResourceId ); + + /** + * Show query to ask if unblock device + * @param aDevice Selected device + * @return Keypress value + */ + TInt QueryUnblockDeviceL(CBTDevice* aDevice); + + /** + * The callback function for CPeriodic + * to reset the inactivity time + */ + static TInt PeriodicTimerCallBack(TAny* /*aAny*/); + + void GetColorIconL( TFileName& aFilename, TAknsItemID aItemID, TInt aPic, TInt aPicmask, CAknIconArray* aIconList ); + + /** + * Check if VoIP call is ongoing via WLAN connection. + * @return true if it is; false otherwise. + */ + TBool IsActiveVoIPOverWLAN(); + + void DoDeviceFrontListSelection(); + + /** + * Displays previous inquiry results. + */ + void DisplayDevicesFrontListL(); + + /** + * Unblock device after unblock query. + * @param aIndex Parameter containing information about selected device. + * @return Symbian OS error code. + */ + TInt UnblockDevice(TInt aIndex); + + void DeviceSearchUiL(); + + /** + * the initiator of inquiry until the first device found, or no device found, or + * other reasons causing inquiry stopped. + * @param aReason the reason of the search completion + */ + TSearchFlowState InitInquiryL(TInt& aReason); + + void HandleDeviceSelectionL(CBTDevice* aDev); + + /** + * Adds found Bluetooth device into popup list. + * @param aInquiryResultRecord TNameEntry and flag, which indicates if Eir device. + */ + void DeviceAvailableL( const TNameRecord& aNameRecord, const TDesC& aDevName, TBool aIsNameComplete ); + + /** + * The inquiry has been completed. + * @param aError Status code of the operation. + * @return None. + */ + void InquiryComplete( TInt aError ); + + /** + * Inform the caller of the properties of found BTdevice, + * which passes the search filter. Its name will be retrived later + */ + void HandleInquiryDeviceL(); + + /** + * Name lookup complete for the current device in the unnamed devices queue. + */ + void HandleFoundNameL(); + + /** + * Name lookup complete for device aLastSeenIndex in the last seen array + * (this is done for devices with partial names returned by EIR). + */ + void HandleUpdatedNameL(TInt aLastSeenIndex); + + /** + * Allow/Disallow dialer and app key presses. + * @param aAllow ETrue to allow key press; EFalse to disallow. + */ + void AllowDialerAndAppKeyPress( TBool aAllow ); + + /** + * Update the inquiry list box with a new (complete) device name + * (this is done for devices with partial names returned by EIR). + */ + void DeviceNameUpdatedL(const TNameRecord& aNameRecord, TInt aLastSeenIndex); + void DeviceUpdatedL(TInt aSignalStrength, TInt aLastSeenIndex); + + /** + * React to page timeout on a device that's already in the inquiry list box + * (which can happen for devices with partial names returned by EIR). + */ + void PageTimeoutOnDeviceWithPartialNameL(TInt aLastSeenIndex); + + void FormatListBoxEntryL(CBTDevice& aDevice, const TInt aSignalStrength, TPtr aFormatString); + + TBool HaveDevsWithPartialName(TInt& aFirstFoundIndex); + + private: // Data + CBTNotifUIUtil* iUiUtil; + CBTDeviceArray* iLastSeenDevicesArray; // Last seen devices array from BTInqNotifier + RArray iLastSeenDevicesNameComplete; // Is the name in corresponding cell of iLastSeenDevicesArray complete ? + CBTDeviceArray* iLastUsedDevicesArray; // Used devices from BT registry + CBTDeviceArray* iPairedDevicesArray; // Paired devices from Bluetooth registry + CBTDeviceArray* iAdjustedUsedDeviceArray; // 5 Lately used devices + All the Paired devices + CBTEngDevMan* iDevMan; //Async deviceHandler + + CDesCArray* iDefaultDeviceNamesArray; // Default device names array + CEikonEnv& iEikonEnvRef; // Reference to eikonenv + + CAknPopupList* iDevicePopupList; // Popup list for devices + CDesCArrayFlat* iDeviceListRows; // Array for device list format string rows + CAknSingleGraphicPopupMenuStyleListBox* iDeviceListBox; // ListBox for bluetooth devices + CAknPopupList* iSearchFilterPopupList; + + CBTNotifActive* iScanner; + + TBool iDevicesFound; // Flag if any devices has been found + TBool iInquiryComplete; + TBool iBroughtForwards; // Flag for BringForwards + TInt iInquiryStatus; // Error code from inquiry result + + TBTRegistryQueryState iBTRegistryQueryState; // which registry query (if any) is in progress. + TBTDeviceClass iDesiredDeviceClass; // Device Class user selects from search filter + CPeriodic* iPeriodicTimer; // the timer for reseting the user inactivity time + TBool iSystemCancel; // Used for a trick to avoid final device list is still on show + // while taking out mmc during BT device discovery + TBTDeviceResponseParams iDevParams; + TInt iHighLightedItemIndex; + + RSocketServ iSocketServer; // Socket server object + RHostResolver iHostResolver; // Host resolver object + TInquirySockAddr iInquirySockAddr; // Socket address record + TNameEntry iEntry; // Inquiry results record + TBool iPageForName; // Flag for inquiry name + RArray iDevsWithoutName; // Devices without dev name + TInt iCurrentlyResolvingUnnamedDeviceIndex; // Current btdevice to inquiry its name + MBTNDeviceSearchObserver* iDevSearchObserver; + + TBool iExcludePairedDevices; + + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnobexpinnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnobexpinnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,84 @@ +/* +* 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: Declares OBEX PIN query notifier class. +* +*/ + + +#ifndef BTNOBEXPINNOTIFIER_H +#define BTNOBEXPINNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class + +// CLASS DECLARATION + +/** +* This class is used to ask OBEX passkey from user. +*/ +NONSHARABLE_CLASS(CBTObexPinNotifier): public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTObexPinNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTObexPinNotifier(); + + private: // Functions from base classes + /** + * From CBTNotifierBase Called when a notifier is first loaded. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + private: + + /** + * C++ default constructor. + */ + CBTObexPinNotifier(); + + /** + * Show notes to ask user's response and return to caller. + * @param None. + * @return None. + */ + void ShowNoteCompleteMessageL(); + + private: // Data + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotif.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotif.hrh Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,41 @@ +/* +* 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 declarations for resources of btnotif. +* +*/ + + +#ifndef BTNOTIF_HRH +#define BTNOTIF_HRH + +#include + +#define KBTPassKeyMaxLength 16 // Same as KHCIPINCodeSize. Not available here direct from BT +#define KBTUIMaxNameLength 30 // Series 60 local BT name + +#define btnotif_bitmap_file "Z:\\system\\data\\BTNotif.mbm" +#define btnotif_bitmap_file_data_caging "Z:\\resource\\apps\\BTNotif.mbm" + + +enum BTNotifNotes + { + EBTNotifSearchingDevicesNote = 1, + EBTNotifBtBusyNote, + EBTNotifEnterSapNote, + EBTNotifEnterSapSucceedNote, + EBTNotifEnterSapFailNote + }; + +#endif +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifactive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifactive.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,191 @@ +/* +* 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: Declares active object helper class. +* +*/ + +#ifndef BTNOTIFACTIVE_H +#define BTNOTIFACTIVE_H + + +#include + +class CBTNotifActive; + +/** + * Class MBTNotifActiveObserver + * + * Callback class for receiving a completed active object event. + * Users of CBTEngActive need to derive from this class. + */ +class MBTNotifActiveObserver + { + +public: + + /** + * Callback to notify that an outstanding request has completed. + * + * @since S60 5.1 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void RequestCompletedL( CBTNotifActive* aActive, TInt aId, + TInt aStatus ) = 0; + + /** + * Callback to notify that an error has occurred in RunL. + * + * @param aActive Pointer to the active object that had error. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void HandleError( CBTNotifActive* aActive, TInt aId, + TInt aError ) = 0; + + /** + * Callback to notify that request is canceled. + * Active object may add specified steps here. + * + * @param aActive Pointer to the active object that is canceled. + * @param aId The ID that identifies the outstanding request. + */ + virtual void DoCancelRequest( CBTNotifActive* aActive, TInt aId ) = 0; + }; +/** + * Class CBTNotifActive + */ +NONSHARABLE_CLASS( CBTNotifActive ) : public CActive + { + +public: + /** + * Two-phased constructor. + * @param aObserver Pointer to callback interface that receives notification + * that the request has been completed. + * @param aId Request ID to identify which request is completed. + * @return Pointer to the constructed CBTNotifActive object. + */ + static CBTNotifActive* NewL( MBTNotifActiveObserver* aObserver, TInt aId, TInt aPriority ); + + /** + * Destructor. + */ + virtual ~CBTNotifActive(); + + /** + * Get the request ID of this active object. + * + * @since S60 v5.1 + * @return The request ID of this active object. + */ + inline TInt RequestId(); + + /** + * Set a new request ID for this active object. + * + * @since S60 v5.1 + * @param The new request ID of this active object. + */ + inline void SetRequestId( TInt aId ); + + /** + * Activate the active object. + * + * @since S60 v5.1 + */ + inline void GoActive(); + + /** + * Cancel an outstanding request. + * + * @since S60 v5.1 + */ + inline void CancelRequest(); + + /** + * Get a reference to the active object request status. + * + * @since S60 v5.1 + * @return Reference to the active object request status. + */ + TRequestStatus& RequestStatus(); + +// from base class CActive + + /** + * From CActive. + * Called by the active scheduler when the request has been cancelled. + * + * @since S60 v5.1 + */ + void DoCancel(); + + /** + * From CActive. + * Called by the active scheduler when the request has been completed. + * + * @since S60 v5.1 + */ + void RunL(); + + /** + * From CActive. + * Called by the active scheduler when an error in RunL has occurred. + * + * @since S60 v5.1 + */ + TInt RunError( TInt aError ); + +private: + + /** + * C++ default constructor + * + * @since S60 v5.1 + * @param aObserver Pointer to callback interface that receives notification + * that the request has been completed. + * @param aId ID of the request (for the client to keep track of multiple + * active objects). + * @param aPriority Priority of + */ + CBTNotifActive( MBTNotifActiveObserver* aObserver, TInt aId, TInt aPriority ); + + /** + * Symbian 2nd-phase constructor + * + * @since S60 v5.1 + */ + void ConstructL(); + +private: // data + + /** + * ID of the request (used only by our client). + */ + TInt iRequestId; + + /** + * Our observer. + * Not own. + */ + MBTNotifActiveObserver* iObserver; + + }; + +#include "btnotifactive.inl" + + +#endif // BTNOTIFACTIVE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifactive.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifactive.inl Wed Sep 01 12:20:04 2010 +0100 @@ -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: Active object helper class inline function definitions. +* +*/ + +// ----------------------------------------------------------------------------- +// Get the identifier of this instance. +// ----------------------------------------------------------------------------- +// +inline TInt CBTNotifActive::RequestId() + { + return iRequestId; + } + + +// ----------------------------------------------------------------------------- +// Set the identifier of this instance. +// ----------------------------------------------------------------------------- +// +inline void CBTNotifActive::SetRequestId( TInt aId ) + { + iRequestId = aId; + } + + +// ----------------------------------------------------------------------------- +// Activate the active object. +// ----------------------------------------------------------------------------- +// +inline void CBTNotifActive::GoActive() + { + SetActive(); + } + + +// ----------------------------------------------------------------------------- +// Cancel an outstanding request. +// ----------------------------------------------------------------------------- +// +inline void CBTNotifActive::CancelRequest() + { + Cancel(); + } + + +// ----------------------------------------------------------------------------- +// Get a reference to the active object request status. +// ----------------------------------------------------------------------------- +// +inline TRequestStatus& CBTNotifActive::RequestStatus() + { + return iStatus; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifclientserver.h --- a/bluetoothengine/btnotif/inc/btnotifclientserver.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* ============================================================================ -* Name : btnotifclientserver.h -* Part of : bluetoothengine / btnotif -* Description : Definitions for the btnotif client-server interface. -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 -*/ - -#ifndef BTNOTIFCLIENTSERVER_H -#define BTNOTIFCLIENTSERVER_H - -/** BTNotif server name */ -_LIT( KBTNotifServerName, "btnotifsrv" ); - -/** btnotifsrv Uid3 for creating the server process */ -const TUid KBTNotifServerUid3 = { 0x20026FED }; - -/** - * BTNotif server version numbers; - * Major version number is 2 to distinguish - * from old btnotif architecture. - */ -const TInt KBTNotifServerVersionMajor = 2; -const TInt KBTNotifServerVersionMinor = 0; -const TInt KBTNotifServerVersionBuild = 0; - -/** - * Opcodes used in the client-server interface - * for identifying the requested command. - */ -enum TBTNotifServerRequest - { - EBTNotifMinValue = 9, - EBTNotifStartSyncNotifier, - EBTNotifStartAsyncNotifier, - EBTNotifCancelNotifier, - EBTNotifUpdateNotifier, - EBTNotifPrepareDiscovery = 43, - EBTNotifPairDevice, - EBTNotifCancelPairDevice, - }; - -/** - * Message slots Opcodes used in the client-server interface - * for identifying the requested command. - */ -enum TBTNotifServerRequestSlot - { - EBTNotifSrvUidSlot, - EBTNotifSrvParamSlot, - EBTNotifSrvReplySlot - }; - -#endif // T_BTNOTIFCLIENTSERVER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,307 @@ +/* +* 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: Declares Bluetooth notifiers base class. +* +*/ + + +#ifndef BTNOTIFIERBASE_H +#define BTNOTIFIERBASE_H + +// INCLUDES + +#include "btnotif.h" +#include "btnotifuiutil.h" +#include +#include +#include + +// CONSTANTS + +// Literals for resource and bitmap files ( drive, directory, filename(s) ) + +const TUid KBTInquiryChannel = {0x00000601}; // Channel for inquiry notifier +const TUid KBTAuthorisationChannel = {0x00000602}; // Channel for PIN query notifier +const TUid KBTAuthenticationChannel = {0x00000603}; // Channel for authorisation notifier +const TUid KBTBBEventChannel = {0x00000604}; // Channel for baseband event notifier +const TUid KBTObexPINChannel = {0x00000605}; // Channel for OBEX PIN notifier +const TUid KBTPowerModeChannel = {0x00000606}; // Channel for power mode notifier +const TUid KBTAudioAccessoryChannel = {0x00000607}; // Channel for audio accessory notifier +const TUid KBTLowMemoryChannel = {0x00000608}; // Channel for low memory notifier +const TUid KBTPairedDeviceSettingChannel = {0x00000610}; + +// FORWARD DECLARATIONS +class CBTEngSettings; + +enum TBTRegistryQueryState +{ + ENoQuery=0, + EQueryPaired=1, + EQueryUsed=2, + ESetDeviceAuthorizeState, + ESetDeviceBlocked, + ESetDeviceUnblocked, +}; + +// CLASS DECLARATION +/** +* This class is the base class for all notifiers. +*/ +NONSHARABLE_CLASS(CBTNotifierBase): public CBase, public MEikSrvNotifierBase2, MBTEngDevManObserver + { + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~CBTNotifierBase(); + + /** + * A utility function for checking whether autolock is on. + * @param None. + * @return A boolean according to autolock state. + */ + TBool AutoLockOnL(); + + protected: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBTNotifierBase(); + + protected: // New functions + + /** + * Symbian 2nd phase constructor. + */ + virtual void ConstructL(); + + /** + * Used in asynchronous notifier launch to store received parameters + * into members variables and make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + virtual void GetParamsL(const TDesC8& aBuffer, + TInt aReplySlot, + const RMessagePtr2& aMessage)=0; + + /** + * A utility function for setting the power status of Bluetooth. + * If the power is not on the user will be presented a query. + * @return ETrue if BT is turned on successfully; EFalse otherwise + */ + TBool CheckAndSetPowerOnL(); + + /** + * A function for setting BT name + * @return ETrue if BT name is set successfully; EFalse otherwise + */ + TBool AskLocalBTNameQueryL(); + + /** + * Check if there is any existing connection to audio profiles from + * the same device + * @return ETrue if the device is connected. + */ + TBool IsExistingConnectionToAudioL(const TBTDevAddr& aDevAddr); + + /** + * Complete Client/Server message and Nulled the reply slot. + * @param aErr Error code for client notification. + * @return None + */ + void CompleteMessage(TInt aErr); + + /** + * Complete Client/Server message and Nulled the reply slot. + * @param aErr Error code for client notification. + * @return None + */ + void CompleteMessage(TInt aValueToReplySlot, TInt aErr); + + /** + * Complete Client/Server message and Nulled the reply slot. + * @param aErr Error code for client notification. + * @return None + */ + void CompleteMessage(const TDesC8& aDesToReplySlot, TInt aErr); + + /** + * Checks from central repository whether the Bluetooth friendly name + * has been modified . + * @return ETure if the name has been modified. + */ + TBool IsLocalNameModifiedL(); + + /** + * Get the device information from BT Registry by the given address. + */ + void GetDeviceFromRegL(const TBTDevAddr& aAddr); + + /** + * virtual function to be ovewritten by sub-classes. + * Will be called when Getting Device by BTEng DevMan is completed. + * @param aDev the device from registry if it is not null. indicates either a failure + * or the device is not available in registry. + */ + virtual void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + /** + * Asks the user if s/he want's to block the device in question + * Does not block the device. That is left to the caller. + * NOTE: Cannot be called while iAuthQueryDlg is active. + */ + void QueryBlockDeviceL(); + + /** + * Set BTDevice's security setting to blocked and modify device + * @param None + * @return None + */ + void DoBlockDevice(); + + /** + * Set BTDevice's security setting to un/authorized and modify device + * @param aTrust Set authorized if ETrue; otherwise, unauthorized. + * @return None + */ + void ChangeAuthorizeState( TBool aTrust); + + /** + * Checks if the user is queried too often, and handle the result. + * @return None + */ + void CheckAndHandleQueryIntervalL(); + + private: + + void DoHandleGetDevicesCompleteL(TInt aErr, CBTDeviceArray* aDeviceArray ); + + protected: // Functions from base classes + + /** + * From MEikSrvNotifierBase2 Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + virtual TNotifierInfo RegisterL()=0; + + /** + * From MEikSrvNotifierBase2 The notifier has been deactivated + * so resources can be freed and outstanding messages completed. + * @param None. + * @return None. + */ + virtual void Cancel(); + +#ifdef __SERIES60_HELP + /** This is used to create TCallBack to help. + * @param TCoeHelpContext. Must be instance TCoeHelpContext, or NULL. + * If null this will open help about blocked devices., + * @return KErrNone + */ + static TInt LaunchHelp(TAny *TCoeHelpContext=NULL); +#endif + + private: // Functions from base classes + + /** + * From MEikSrvNotifierBase2 Called when all resources allocated + * by notifiers should be freed. + * @param None. + * @return None. + */ + virtual void Release(); + + /** + * From MEikSrvNotifierBase2 Return the priority a notifier takes + * and the channels it acts on. + * @param None. + * @return A structure containing priority and channel info. + */ + virtual TNotifierInfo Info() const; + + /** + * From MEikSrvNotifierBase2 Synchronic notifier launch. + * @param aBuffer Received parameter data. + * @return A pointer to return value. + */ + virtual TPtrC8 StartL(const TDesC8& aBuffer); + + /** + * From MEikSrvNotifierBase2 Asynchronic notifier launch. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return A pointer to return value. + */ + virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From MEikSrvNotifierBase2 Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + virtual TPtrC8 UpdateL(const TDesC8& aBuffer); + + /** + * From MBTEngDevManObserver + * Indicates to the caller that adding, deleting or modifying a device + * has completed. + */ + virtual void HandleDevManComplete(TInt aErr); + + /** + * From MBTEngDevManObserver + * Call back function when GetDevices() request is completed. + * @param aErr Status information, if there is an error. + * @param aDeviceArray Array of devices that match the given criteria + * (the array provided by the calller). + */ + void HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ); + + /** + * Checks the timestamp since last query. + * @return true if too often + */ + TBool CheckQueryInterval(); + + protected: // Data + + RMessagePtr2 iMessage; // Received message + TInt iReplySlot; // Reply slot + TNotifierInfo iInfo; // Notifier parameters structure + TBTRegistryQueryState iBTRegistryQueryState; + CBTDeviceArray* iDeviceArray; // for getting device from registry + CBTDevice* iDevice; // Current Bluetooth device + TBTDevAddr iBTAddr; // Gotten from PckBuffer, constant no matter how iDevice changes. + CBTNotifUIUtil* iNotifUiUtil; // Utility to show UI notes & queries + CBTEngSettings* iBTEngSettings; + TBool iIsCoverUI; + + private: + CBTEngDevMan* iDevMan; // for BT registry manipulation + + + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotiflock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotiflock.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,158 @@ +/* +* 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: Implements getting/setting notifier locks on BT devices +* from/to P&S KBTNotifierLocks from btengprivatepskeys.h. +* +*/ + +#ifndef BTNOTIFIERLOCK_H +#define BTNOTIFIERLOCK_H + +#include +#include + +/** + * BT Notifier lock identifiers + * @since S60 v5.1 + */ + +enum TBTNotifLockId + { + /** + * None + */ + EBTNotifierLockNone = 0x00, + + /** + * notifier is asking or going to ask if user wants to set device trusted. + */ + EBTNotiferLockPairedDeviceSetting = 0x01, + + /** + * notifer is asking or going to ask user if he wants to accept connection request + * from the device. + */ + EBTNotifierLockAuthorizeConnectRequest = 0x02, + }; + +/** + * the notifier lock status on a BT device. + * This lock mechanism uses by btui, bteng and btnotif to ensure the order of + * user interaction when a device is been paired. + */ +NONSHARABLE_CLASS( TBTNotifLock) + { +public: + + /** + * default constructor. iAddr is initialized to zero BT address and iLocks is set to 0 + */ + inline TBTNotifLock(); + + /** + * constructor to the specified value. + * @param aAddr the address of the BT device this object is for. + * @param aLocks one or more lock identifiers + */ + inline TBTNotifLock(const TBTDevAddr& aAddr, TInt aLocks); + + /** + * gets the target device address. + * @return the target device address + */ + inline const TBTDevAddr& Addr() const; + + /** + * Gets the locks on the device. + */ + inline TInt Locks() const; + + /** + * Gets the modifiable locks on the device + */ + inline TInt& Locks(); + +private: + + /** + * the BT device this object is for + */ + TBTDevAddr iAddr; + + /** + * the lock status, logical OR of one or more TBTNotifLockId values + */ + TInt iLocks; + }; + +NONSHARABLE_CLASS( TBTNotifLockPublish ) + { +public: + + /** + * gets from P&S KBTNotifierLocks the locks for a device. + * + * @param aLocks contains the locks for the device at return + * @param aAddr the address of the device which the locks are for + */ + inline static void GetNotifLocks( TInt& aLocks, const TBTDevAddr& aAddr ); + + /** + * gets from P&S KBTNotifierLocks the locks for a device. + * + * @aProperty the property instance which has been attached to key KBTNotifierLocks. + * @param aLocks contains the locks for the device at return + * @param aAddr the address of the device which the locks are for + */ + inline static void GetNotifLocks(RProperty& aProperty, TInt& aLocks, + const TBTDevAddr& aAddr ); + + /** + * Publishes locks to P&S KBTNotifierLocks. + * + * @param aLocks the locks to be published + * @param aAddr the address of the device which the locks are for + */ + inline static void AddNotifLocks( TInt aLocks, const TBTDevAddr& aAddr ); + + /** + * Publishes locks to P&S KBTNotifierLocks. + * @aProperty the property instance which has been attached to key KBTNotifierLocks. + * @param aLocks the locks to be published + * @param aAddr the address of the device which the locks are for + */ + inline static void AddNotifLocks(RProperty& aProperty, TInt aLocks, + const TBTDevAddr& aAddr ); + + /** + * Deletes locks from P&S KBTNotifierLocks. + * @param aLocks the locks to be deleted + * @param aAddr the address of the device which the locks are for + */ + inline static void DeleteNotifLocks( TInt aLocks, + const TBTDevAddr& aAddr ); + + /** + * Deletes locks from P&S KBTNotifierLocks. + * @aProperty the property instance which has been attached to key KBTNotifierLocks. + * @param aLocks the locks to be deleted + * @param aAddr the address of the device which the locks are for + */ + inline static void DeleteNotifLocks(RProperty& aProperty, TInt aLocks, + const TBTDevAddr& aAddr ); + }; + +#include "btnotiflock.inl" + +#endif // BTNOTIFIERLOCK_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotiflock.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotiflock.inl Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,234 @@ +/* +* 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: Implements getting/setting notifier locks on BT devices +* from/to P&S KBTNotifierLocks from btengprivatepskeys.h. +* +*/ + +#include "btengprivatepskeys.h" +#include + +// ---------------------------------------------------------- +// Initialize members to zero +// ---------------------------------------------------------- +// +inline TBTNotifLock::TBTNotifLock() + : iAddr(TBTDevAddr()), iLocks(EBTNotifierLockNone) + { + } + +// ---------------------------------------------------------- +// initialize members to the specified values +// ---------------------------------------------------------- +// +inline TBTNotifLock::TBTNotifLock(const TBTDevAddr& aAddr, TInt aLocks) + : iAddr( aAddr ), iLocks( aLocks ) + { + } + +// ---------------------------------------------------------- +// returns the address +// ---------------------------------------------------------- +// +inline const TBTDevAddr& TBTNotifLock::Addr() const + { + return iAddr; + } + +// ---------------------------------------------------------- +// returns the lock as value +// ---------------------------------------------------------- +// +inline TInt TBTNotifLock::Locks() const + { + return iLocks; + } + +// ---------------------------------------------------------- +// returns the lock as modifiable reference +// ---------------------------------------------------------- +// +inline TInt& TBTNotifLock::Locks() + { + return iLocks; + } + +// ---------------------------------------------------------- +// Locally instantiate a RProperty and invoke GetNotifLocks +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::GetNotifLocks( TInt& aLocks, const TBTDevAddr& aAddr ) + { + RProperty property; + TInt err = property.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); + if ( !err ) + { + GetNotifLocks( property, aLocks, aAddr ); + } + property.Close(); + } + +// ---------------------------------------------------------- +// Extracts from PS key and returns the lock value for +// the specified device +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::GetNotifLocks(RProperty& aProperty, + TInt& aLocks, const TBTDevAddr& aAddr ) + { + aLocks = EBTNotifierLockNone; + TInt infoSize( sizeof( TBTNotifLock ) ); + TBuf8 infoDes; + TInt err = aProperty.Get( infoDes ); + if ( err || infoDes.Length() < infoSize ) + { + // zero length of the PS content indicates no lock set at all. + return; + } + TInt infoCount = infoDes.Length() / infoSize; + + TPckgBuf tmpPckg; + for ( TInt i = 0; i < infoCount; i++ ) + { + tmpPckg.Copy(infoDes.Mid( i * infoSize, infoSize )); + if ( tmpPckg().Addr() == aAddr ) + { + // found the locks for the device, writes to client. + aLocks = tmpPckg().Locks(); + return; + } + } + } + +// ---------------------------------------------------------- +// Locally instantiate a RProperty and invoke AddNotifLocks +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::AddNotifLocks( TInt aLocks, const TBTDevAddr& aAddr ) + { + RProperty property; + TInt err = property.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); + if ( !err ) + { + AddNotifLocks( property, aLocks, aAddr ); + } + property.Close(); + } + +// ---------------------------------------------------------- +// Find the lock for the device from PS key and updates its value if +// needed. +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::AddNotifLocks( RProperty& aProperty, + TInt aLocks, const TBTDevAddr& aAddr ) + { + TBuf8 infoDes; + TInt infoSize( sizeof( TBTNotifLock ) ); + TInt err = aProperty.Get( infoDes ); + if ( err ) + { + return; + } + TInt infoCount = infoDes.Length() / infoSize; + TPckgBuf tmpPckg; + + for ( TInt i = 0; i < infoCount; i++ ) + { + tmpPckg.Copy(infoDes.Mid( i * infoSize, infoSize )); + if ( tmpPckg().Addr() == aAddr ) + { + TInt newOps = tmpPckg().Locks() | aLocks; + // update the value only if it is really changed: + if ( tmpPckg().Locks() != newOps ) + { + tmpPckg().Locks() = newOps; + infoDes.Replace( i * infoSize, infoSize, tmpPckg ); + (void) aProperty.Set( infoDes ); + } + return; + } + } + // no lock for the device so far, append it to the end: + tmpPckg() = TBTNotifLock( aAddr, aLocks ); + if ( infoCount ) + { + infoDes.Append( tmpPckg ); + (void) aProperty.Set( infoDes ); + } + (void) aProperty.Set( tmpPckg ); + } + +// ---------------------------------------------------------- +// Locally instantiate a RProperty and invoke DeleteNotifLocks +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::DeleteNotifLocks( TInt aLocks, const TBTDevAddr& aAddr ) + { + RProperty property; + TInt err = property.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); + if ( !err ) + { + DeleteNotifLocks( property, aLocks, aAddr ); + } + property.Close(); + } + +// ---------------------------------------------------------- +// Find the lock for the device from PS key and updates its value if +// needed. +// ---------------------------------------------------------- +// +inline void TBTNotifLockPublish::DeleteNotifLocks( RProperty& aProperty, + TInt aLocks, const TBTDevAddr& aAddr ) + { + TBuf8 infoDes; + TInt infoSize( sizeof( TBTNotifLock ) ); + TInt err = aProperty.Get( infoDes ); + if ( err || infoDes.Length() < infoSize ) + { + return; + } + TInt infoCount = infoDes.Length() / infoSize; + TPckgBuf tmpPckg; + for ( TInt i = 0; i < infoCount; i++ ) + { + tmpPckg.Copy( infoDes.Mid( i * infoSize, infoSize ) ); + if ( tmpPckg().Addr() == aAddr ) + { + TInt newOps = tmpPckg().Locks() & ~aLocks; + // update PS only if the value is changed: + if ( tmpPckg().Locks() != newOps ) + { + tmpPckg().Locks() = newOps; + if ( tmpPckg().Locks() == 0) + { + // no lock for this device anymore, remove from PS: + infoDes.Delete( i * infoSize, infoSize ); + } + else + { + // Update the lock value: + infoDes.Replace( i * infoSize, infoSize, tmpPckg ); + } + (void) aProperty.Set( infoDes ); + } + return; + } + } + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifnameutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifnameutils.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,34 @@ +/* + * 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: Declares Bluetooth notifiers base class. + * + */ + +#ifndef BTNOTIFNAMEUTILS_H +#define BTNOTIFNAMEUTILS_H + +#include + +class BtNotifNameUtils + { +public: + static void StripDeviceName(TBTDeviceName& aDeviceName); + static void GetDeviceDisplayName(TBTDeviceName& aName, const CBTDevice* aDev); + static void GetDeviceName(TBTDeviceName& aName, const CBTDevice* aDev); + static void SetDeviceNameL(const TBTDeviceName& aName, CBTDevice& aDev); + }; + +#endif // BTNOTIFNAMEUTILS_H + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifpanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifpanic.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,40 @@ +/* +* 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: Declares authorisation notifier class. +* +*/ + +#ifndef BTNOTIFPANIC_H +#define BTNOTIFPANIC_H + +_LIT(KBtNotifPanicName, "BtNotif Panic"); + +enum TBtNotifPanic + { + EiDeviceNullWhenCallingGetDeviceFromRegL = 0, + }; + +template +struct TBtNotifPanicCodeTypeChecker + { + inline static void Check(XAny) { } + }; + +#define BTNOTIF_PANIC(CODE) \ + TBtNotifPanicCodeTypeChecker::Check(CODE), \ + User::Panic(KBtNotifPanicName, CODE) + + +#endif // BTNOTIFPANIC_H + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnotifuiutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnotifuiutil.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,177 @@ +/* +* 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: Declares Bluetooth notifiers UI utility class. +* +*/ + +#ifndef BTNOTIFUIUTIL_H +#define BTNOTIFUIUTIL_H +#include // Eikon environment +#include +#include +#include +#include + +// CONSTANTS +// Literals for resource and bitmap files ( drive, directory, filename(s) ) +_LIT(KFileDrive,"z:"); +_LIT(KResourceFileName, "btnotif.rsc"); + +// FORWARD DECLARATIONS +class CEikonEnv; + +NONSHARABLE_CLASS( CBTNotifUIUtil ) : public CBase + { + public: // Constructors and destructor + + static CBTNotifUIUtil* NewL( TBool aCoverDisplayEnabled ); + + /** + * Destructor. + */ + virtual ~CBTNotifUIUtil(); + + private: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBTNotifUIUtil( TBool aCoverDisplayEnabled ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + public: + /** + * A utility function for requesting the activation of lights. + * @param None. + * @return None. + */ + void TurnLightsOn(); + + /** + * Get the local eikon environment. + * @return the reference of the local Eikon Environment + */ + CEikonEnv& LocalEikonEnv(); + + /** + * Common utility for user confirmation dialog. + * @return the keypress value + */ + TInt ShowQueryL(TInt aPromptResource, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone ); + + /** + * Common utility for user confirmation dialog. + * @return the keypress value + */ + TInt ShowQueryL(const TDesC& aPrompt, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + const TBTDeviceName& aDevNameInCoverUI, + CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone ); + + /** + * Common utility for user confirmation dialog. + * @return the keypress value + */ + TInt ShowMessageQueryL(TDesC& aMessage, const TDesC& aHeader, + TInt aResourceId, + CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone ); + /** + * Common utility for user confirmation dialog. + * @return the keypress value + */ + TInt ShowTextInputQueryL(TDes& aText, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone ); + + /** + * Common utility for user confirmation dialog. + * @return the keypress value + */ + TInt ShowTextInputQueryL(TDes& aText, const TDesC& aPrompt, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone ); + + /** + * Common utility for UI inforamtion note. + */ + void ShowInfoNoteL( TInt aResourceId, TSecondaryDisplayBTnotifDialogs aDialogId ); + + /** + * Common utility for UI inforamtion note. + */ + void ShowInfoNoteL( const TDesC& aResource, TSecondaryDisplayBTnotifDialogs aDialogId ); + + /** + * Common utility for Confirmation note. + */ + void ShowConfirmationNoteL( TBool aWaitingDlg, const TDesC& aResource, + TSecondaryDisplayBTnotifDialogs aDialogId, const TBTDeviceName& aDevNameInCoverUi ); + + /** + * Common utility for Error note. + */ + void ShowErrorNoteL( TBool aWaitingDlg, const TDesC& aResource, + TSecondaryDisplayBTnotifDialogs aDialogId, TBTDeviceName aDevNameInCoverUi ); + + /** + * Check if iYesNoDlg is NULL + */ + TBool IsQueryReleased(); + + /** + * Update the dialog when UpdateL() is called by client. + */ + void UpdateQueryDlgL( TDesC& aMessage ); + + /** + * Update the message dialog when UpdateL() is called by client. + */ + void UpdateMessageQueryDlgL( TDesC& aMessage ); + + /** + * It is used for Secondary display to update. + */ + void UpdateCoverUiL( const TDesC8& aMessage ); + + /** + * Delete the dialog, mostly used by UpdateL() + */ + void DismissDialog(); + + TInt ShowWaitDlgL( TInt aResourceId ); + + void CompleteWaitDlgL(); + + private: + + void CoverUIDisplayL( const MObjectProvider* aMop, const TBTDeviceName& aDevNameInCoverUi ); + + private: //DATA + CEikonEnv* iEikEnv; // Local eikonenv + TInt iResourceFileFlag; // Flag for eikon env. + CAknQueryDialog* iQueryDlg; // All kinds of query dialog + CAknWaitDialog* iWaitDlg; // WaitDialog + TBool iCoverDisplayEnabled; // Flag that indicate cover UI featur + TBool iSystemCancel; // Used to check if iEikEnv is valid. + TBool iAppKeyBlocked; // Apps key is deactivated. + }; +#endif //BTNOTIFUIUTIL_H + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnpaireddevsettnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnpaireddevsettnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,120 @@ +/* +* 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: Declares power mode setting notifier class. +* +*/ + + +#ifndef BTNPAIREDDEVSETTNOTIFIER_H +#define BTNPAIREDDEVSETTNOTIFIER_H + +// INCLUDES +#include "btnotifier.h" // Base class + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +NONSHARABLE_CLASS(CBTPairedDevSettNotifier) : public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTPairedDevSettNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTPairedDevSettNotifier(); + + private: // Functions from base classes + + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase The notifier has been deactivated + * so resources can be freed and outstanding messages completed. + * @param None. + * @return None. + */ + void Cancel(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + TPtrC8 UpdateL(const TDesC8& aBuffer); + + /** + * From CBTNotifierBase + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + private: + + /** + * Parse the data out of the message that is sent by the client of the notifier. + * @param aBuffer A package buffer containing received parameters. + * @return None. + */ + void ProcessParamBufferL(const TDesC8& aBuffer); + + /** + * Query to assign the friendly name when adding it into paired device list + * if the current device name is not unique in the paired devices view. + */ + void QueryRenameDeviceL(const CBTDevice& aDevice); + + /** + * C++ default constructor. + */ + CBTPairedDevSettNotifier(); + + /** + * Process pairing error code to show corresponding notes. + * @param aErr The pairing error code from HCI error. + * @return The resouce ID of notes + */ + TInt ProcessPairingErrorCode( const TInt aErr ); + + private: + + TSecondaryDisplayBTnotifDialogs iSecondaryDisplayCommand; + TBool iIsMessageQuery; + TInt iPairingStatus; + + }; + +#endif //BTNPAIREDDEVSETTNOTIFIER_H + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnpairnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnpairnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,111 @@ +/* +* 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: Declares pair base notifier. +* +*/ + +#ifndef BTNPAIRNOTIFIER_H_ +#define BTNPAIRNOTIFIER_H_ + +#include "btnotifier.h" // base class + +// CLASS DECLARATION +/** +* This class is used as base class for all pairing purpose notifiers +*/ +NONSHARABLE_CLASS(CBTNPairNotifierBase) : public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTNPairNotifierBase* NewL(); // Constructor (public) + + /** + * Destructor. + */ + virtual ~CBTNPairNotifierBase(); // Destructor + + protected: // From base class + + /** + * From CBTNotifierBase + */ + virtual TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + virtual void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + virtual void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + /** + * From CBTNotifierBase Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + virtual TPtrC8 UpdateL(const TDesC8& aBuffer); + + protected: // New functions + + void ProcessParamsGetDeviceL( const TBTDevAddr& aAddr, const TBTDeviceName& aName ); + + /** + * Check not to allow pairing attempt from banned devices, + */ + TBool CheckBlockedDeviceL(); + + /** + * Query user to accept/reject when the pairing request is initiated + * from remote device. + * @param None. + * @return ETrue if User accepted. + */ + TBool AuthoriseIncomingPairingL(); + + /** + * Generate prompt based on subclass's own needs. + * @param aRBuf the descriptor to which the prompt will be loaded. + */ + virtual void GenerateQueryPromptL( RBuf& aRBuf ); + + private: + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + //TNotifierInfo RegisterL(); + + protected: + /** + * C++ default constructor. + */ + CBTNPairNotifierBase(); + + protected: // Data + TBool iLocallyInitiated; + }; + +#endif /* BTNPAIRNOTIFIER_H */ + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnpbappinnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnpbappinnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -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: Declares PBAP PIN query notifier class. +* +*/ + + +#ifndef BTNPBAPNOTIFIER_H +#define BTNPBAPNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class + +// CLASS DECLARATION + +/** +* This class is used to ask PBAP passkey from user. +*/ +NONSHARABLE_CLASS(CBTPBAPPinNotifier): public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTPBAPPinNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTPBAPPinNotifier(); + + private: // Functions from base classes + /** + * From CBTNotifierBase Called when a notifier is first loaded. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + private: + + /** + * C++ default constructor. + */ + CBTPBAPPinNotifier(); + + /** + * Show UI note and complete message. + * Ask user response and return it to caller. + * @param None. + * @return None. + */ + void ShowNoteCompleteMessageL(); + + private: // Data + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnpinnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnpinnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,102 @@ +/* +* 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: Declares authentication (PIN query) notifier class. +* +*/ + + +#ifndef BTNPINNOTIFIER_H +#define BTNPINNOTIFIER_H + +// INCLUDES + +#include "btnpairnotifier.h" // Base class + +class MBTEngDevManObserver; + +// CLASS DECLARATION +/** +* This class is used to ask PIN code from user. +*/ +NONSHARABLE_CLASS(CBTPinNotifier): public CBTNPairNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTPinNotifier* NewL(); // Constructor (public) + + /** + * Destructor. + */ + virtual ~CBTPinNotifier(); // Destructor + + private: + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters + + /** + * From CBTNotifierBase + * Show queries to ask user response and return it to caller by completing message. + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + /** + * From CBTNPairNotifierBase + * Generate prompt in Pin query dialog. + * @param aRBuf the descriptor to which the prompt will be loaded. + */ + void GenerateQueryPromptL(RBuf& aRBuf); + + private: + + /** + * C++ default constructor. + */ + CBTPinNotifier(); // Default constructor + + /** + * Checks and sets iPinCode to '0000', used with automated pairing for headsets. + */ + TBool CheckAndSetAutomatedPairing(); + + private: // Data + TUint iPasskeyLength; + TBTPinCode iPinCode; + TBTRegistryQueryState iBTRegistryQueryState; + TBool iLocallyInitiated; + TBool iStrongPinRequired; + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnpwrnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnpwrnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -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: Declares power mode setting notifier class. +* +*/ + + +#ifndef BTNPWRNOTIFIER_H +#define BTNPWRNOTIFIER_H + +// INCLUDES + +#include "btnotifier.h" // Base class + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* This class is used to confirm Bluetooth power status change from user. +*/ +NONSHARABLE_CLASS(CBTPwrNotifier): public CBTNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTPwrNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~CBTPwrNotifier(); + + private: // Functions from base classes + + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); + + private: + + /** + * C++ default constructor. + */ + CBTPwrNotifier(); + + /** + * Show Information Note and complete message. + * @param None. + * @return None. + */ + void ShowNoteAndCompleteMessageL(); + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnssppasskeyentrynotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnssppasskeyentrynotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,97 @@ +/* +* 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: Declares authentication (PIN query) notifier class. +* +*/ + + +#ifndef BTNSSPPASSKEYENTRYNOTIFIER_H_ +#define BTNSSPPASSKEYENTRYNOTIFIER_H_ + + +// INCLUDES + +#include "btnpairnotifier.h" // Base class + +const TInt KPassKeylength = 6; +// CLASS DECLARATION +/** +* This class is used to confirm PIN code from remote input devices. such as bluetooth keyboard. +*/ +NONSHARABLE_CLASS(CBTSSPPasskeyEntryNotifier): public CBTNPairNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTSSPPasskeyEntryNotifier* NewL(); // Constructor (public) + + /** + * Destructor. + */ + virtual ~CBTSSPPasskeyEntryNotifier(); // Destructor + + private: + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + /** + * From CBTNotifierBase Updates a currently active notifier. + * @param aBuffer The updated data. + * @return A pointer to return value. + */ + TPtrC8 UpdateL(const TDesC8& aBuffer); + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters + + /** + * From CBTNotifierBase + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + /** + * Generate prompt for passkey entry query. + * @param aRBuf the descriptor to which the prompt will be loaded. + */ + void GenerateQueryPromptL( RBuf& aRBuf ); + + private: + + /** + * C++ default constructor. + */ + CBTSSPPasskeyEntryNotifier(); // Default constructor + + private: // Data + TInt iAnswer; + TBuf<100> iBuf; + TBuf<10> iPasskey; + }; +#endif +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btnumcmpnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btnumcmpnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,96 @@ +/* +* 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: Declares Numeric Comparison notifier for Secure Simle Pairing +* +*/ + + +#ifndef BTNUMCMPNOTIFIER_H +#define BTNUMCMPNOTIFIER_H + +// INCLUDES + +#include "btnpairnotifier.h" // Base class + +// CLASS DECLARATION +/** +* This class is used to ask user to compare passcode in two devices. +*/ +const TInt Klength = 6; +const TInt KMaxPassKeyLength = 20; +const TInt KBTDeviceShortNameLength = 7; + + +NONSHARABLE_CLASS(CBTNumCmpNotifier): public CBTNPairNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTNumCmpNotifier* NewL(); // Constructor (public) + + /** + * Destructor. + */ + virtual ~CBTNumCmpNotifier(); // Destructor + + private: + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters + + /** + * From CBTNotifierBase + * Show notes to ask user response and return to Notifier caller by completing message. + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + /** + * From CBTNPairNotifierBase + * @param aRBuf the descriptor to which the prompt will be loaded. + */ + void GenerateQueryPromptL( RBuf& aRBuf ); + + private: + + /** + * C++ default constructor. + */ + CBTNumCmpNotifier(); // Default constructor + + private: // Data + TBuf<20> iPasskeyToShow; + + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/btuserconfnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/btuserconfnotifier.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,119 @@ +/* +* 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: Declares User confirmation notifier for Secure Simle Pairing +* +*/ + + +#ifndef BTUSERCONFNOTIFIER_H +#define BTUSERCONFNOTIFIER_H + +// INCLUDES + +#include "btnpairnotifier.h" // Base class + +// These declarations are here temporarily so the submission of the notifiers and the stack do not have to be synchronised. +// Should be removed once all submissions are in. + +const TUid KBTUserConfirmationNotifierUidCopy={0x2002E224}; + +NONSHARABLE_CLASS(TBTNotifierParams2Copy) + { +public: + inline TBTDevAddr DeviceAddress() const { return iBDAddr; }; + inline TPtrC DeviceName() const { return iName; }; +private: + TBTDevAddr iBDAddr; + TBTDeviceName iName; + + // This data padding has been added to help prevent future binary compatibility breaks + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used + TUint32 iPadding1; + TUint32 iPadding2; + }; + +NONSHARABLE_CLASS(TBTUserConfirmationParamsCopy) + : public TBTNotifierParams2Copy + { +public: + inline TBool LocallyInitiated() const { return iLocallyInitiated; }; +private: + TBool iLocallyInitiated; + + // This data padding has been added to help prevent future binary compatibility breaks + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used + TUint32 iPadding1; + TUint32 iPadding2; + }; + +typedef TPckgBuf TBTUserConfirmationParamsPckgCopy; + +// CLASS DECLARATION +/** +* This class is used to ask user to compare passcode in two devices. +*/ + + +NONSHARABLE_CLASS(CBTUserConfNotifier): public CBTNPairNotifierBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTUserConfNotifier* NewL(); // Constructor (public) + + /** + * Destructor. + */ + virtual ~CBTUserConfNotifier(); // Destructor + + private: + /** + * From CBTNotifierBase Called when a notifier is first loaded + * to allow any initial construction that is required. + * @param None. + * @return A structure containing priority and channel info. + */ + TNotifierInfo RegisterL(); + + + /** + * From CBTNotifierBase Used in asynchronous notifier launch to + * store received parameters into members variables and + * make needed initializations. + * @param aBuffer A buffer containing received parameters + * @param aReturnVal The return value to be passed back. + * @param aMessage Should be completed when the notifier is deactivated. + * @return None. + */ + void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); // Get input parameters + + /** + * From CBTNotifierBase + * Show notes to ask user response and return to Notifier caller by completing message. + */ + void HandleGetDeviceCompletedL(const CBTDevice* aDev); + + private: + + /** + * C++ default constructor. + */ + CBTUserConfNotifier(); // Default constructor + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/inc/devui_const.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/inc/devui_const.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,132 @@ +/* +* 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 DEVUI_CONST_H_ +#define DEVUI_CONST_H_ + +#include +// Order must match the one in resources (R_BT_DEFAULT_DEVICE_NAMES) +// +enum TBTDefaultDevNameIndex + { + EBTDeviceNameIndexComputer = 0, + EBTDeviceNameIndexPhone, + EBTDeviceNameIndexAudio, + EBTDeviceNameIndexKeyboard, + EBTDeviceNameIndexMouse, + EBTDeviceNameIndexPrinter, + EBTDeviceNameIndexCarKit, + EBTDeviceNameIndexDefault + }; + +// Enum for items in search filter +enum TBTSearchFilterItem + { + EBTSearchForAll = 0, + EBTSearchForAudio, + EBTSearchForPhone, + EBTSearchForComputer, + EBTSearchForInput + }; + +// Order must match the one in resources (R_BTNOTIF_ICONS) +// +enum TDeviceIconIndex + { + EDeviceIconComputer = 0, + EDeviceIconPhone, + EDeviceIconAudio, + EDeviceIconDefault, + EDeviceIconBlank, + EDeviceIconKeyboard, + EDeviceIconMouse, + EDeviceIconPrinter, + EDeviceIconCarkit, + EDeviceIconPaired, + EDeviceIconBlocked, + EDeviceIconRssiLow, + EDeviceIconRssiMed, + EDeviceIconRssiGood, + }; + +struct TDeviceIconFormat + { + TDeviceIconIndex iIdx; + const TText* iFormat; + }; + +// Order must match the one in TDeviceIconIndex +// +const TDeviceIconFormat KDeviceIconFormatTable[] = + { + {EDeviceIconComputer, _S("0\t")}, //computer + {EDeviceIconPhone, _S("1\t")}, // phone + {EDeviceIconAudio, _S("2\t")}, // audio + {EDeviceIconDefault, _S("3\t")}, // default + {EDeviceIconBlank, _S("4\t")}, // blank + {EDeviceIconKeyboard, _S("5\t")}, // keyboard + {EDeviceIconMouse, _S("6\t")}, // mouse + {EDeviceIconPrinter, _S("7\t")}, // printer + {EDeviceIconCarkit, _S("8\t")}, // carkit + {EDeviceIconPaired, _S("\t9")}, // paired + {EDeviceIconBlocked, _S("\t10")}, // blocked + {EDeviceIconRssiLow, _S("\t11")}, // RssiLow + {EDeviceIconRssiMed, _S("\t12")}, // RssiMed + {EDeviceIconRssiGood, _S("\t13")} // RssiGood + }; + +// Total number of different device icons +const TInt KDeviceIconCount = + sizeof(KDeviceIconFormatTable) / sizeof(TDeviceIconFormat); + +/* + * The classification of a device's icon and default name + * corresponding to its major and minor device classes. + */ +struct TDeviceRowLayout + { + TInt iMajorDevClass; + TInt iMinorDevClass; + TDeviceIconIndex iIconIndex; + TBTDefaultDevNameIndex iDefaultNameIndex; + }; + +/* + * Device classification mapping table. + * + * Notice 1: Considering runtime searching efficiency, if certain major or minor + * device classes shall use the default icon and name, it is not recommended + * to present in this table. + * + * Notice 2: Regulated by searching algorithm, when devices carrying the same + * major device class may have different icons and names for different minor + * device classes, the unclassified minor device class must present at last + * among these belonging to the same major device class. + */ +const TDeviceRowLayout KDeviceRowLayoutTable[] = + { + {EMajorDeviceComputer, 0, EDeviceIconComputer, EBTDeviceNameIndexComputer }, + {EMajorDevicePhone, 0, EDeviceIconPhone, EBTDeviceNameIndexPhone }, + {EMajorDeviceAudioDevice, EMinorDeviceAVCarAudio, EDeviceIconCarkit, EBTDeviceNameIndexCarKit }, + {EMajorDeviceAudioDevice, 0, EDeviceIconAudio, EBTDeviceNameIndexAudio }, + {EMajorDeviceImaging, EMinorDeviceImagingPrinter, EDeviceIconPrinter, EBTDeviceNameIndexPrinter }, + {EMajorDevicePeripheral, EMinorDevicePeripheralKeyboard, EDeviceIconKeyboard, EBTDeviceNameIndexKeyboard }, + {EMajorDevicePeripheral, EMinorDevicePeripheralPointer, EDeviceIconMouse, EBTDeviceNameIndexMouse }, + }; + +const TInt KDeviceRowLayoutTableSize = (sizeof(KDeviceRowLayoutTable) / sizeof(TDeviceRowLayout)); + +#endif /*DEVUI_CONST_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/loc/btnotif.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/loc/btnotif.loc Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,432 @@ +/* +* 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 a localisation file for btnotif. +* +*/ + + +// LOCALISATION STRINGS + +// *** TITLES (FOR POPUP WINDOWS) *** + +// d: Header text of the popup window for already found Bluetooth devices +// d: while searching is still in progress. (List query) +// d: Note! There is also an icon at right edge of the title. +// l: heading_pane_t1/opt2 +// +#define qtn_bt_searching_found "Searching" + +// d: Header text of the popup window for already found Bluetooth devices. +// d: while searching has been completed. (List query) +// l: heading_pane_t1 +// +#define qtn_bt_devices_found "Devices found:" + +// d: Header text of the popup window for "last seen bluetooth devices". (List query) +// l: heading_pane_t1 +// +#define qtn_bt_last_seen_devices "Last seen devices" + +// d: Header text of the popup window for last used bluetooth devices. (List query) +// l: heading_pane_t1 +// +#define qtn_bt_last_used_devices "Bluetooth devices:" + +// d: List item text (with icon at left) of the popup window +// d: for "last seen bluetooth devices". (List query) +// l: list_single_graphic_pane_t1_cp2 +// +#define qtn_bt_more_devices "More devices" + +// Generic_BTUI +// d: Header text of the search device filer +// l: heading_pane_t1 +// r: 5.1 +#define qtn_bt_search_for "Search for:" + +// d: list item text for different class of devices in search filter +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_search_for_all "All devices" + +// d: list item text for different class of devices in search filter +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_search_for_audio "Audio devices" + +// d: list item text for different class of devices in search filter +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_search_for_phone "Phones" + +// d: list item text for different class of devices in search filter +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_search_for_computer "Computers" + +// d: list item text for different class of devices in search filter +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_search_for_input "Input devices" +//End Generic_BTUI + +// *** SOFTKEYS *** + +// d: Right softkey for device search popup menu list while searching is still in progress. +// l: control_pane_t1/opt7 +// +#define qtn_bt_softkey_stop "Stop" + + +// *** QUERIES *** + +// d: Confirmation query when Bluetooth needs to be activated. +// l: popup_note_window +// +#define qtn_bt_is_off "Bluetooth is currently switched off. Switch on?" + +// d: Confirmation query when Bluetooth needs to be activated in off-line mode. +// l: popup_note_window +// +#define qtn_bt_activate_in_offline "Do you want to activate bluetooth in off-line mode?" + +// d: Confirmation query when Bluetooth device search has met timeout and no devices has been found. +// l: popup_note_window +// +#define qtn_bt_no_devices_found "No Bluetooth devices found. Try again?" + +// d: Data query when pairing procedure is needed. Bluetooth passkey is entered. +// l: popup_query_data_window +// +#define qtn_bt_enter_pk_for_conn "Enter passkey for: %U" + +// d: Heading text for qtn_bt_enter_pk_for_conn -query +// l: popup_info_list_pane_t2/opt1 +// +#define qtn_bt_passkey_heading "Bluetooth" + +// d: Confirmation query when remote Bluetooth device want's connect to us. +// l: popup_note_window +// +#define qtn_bt_accept_conn_request "Accept connection request from:\n%U" + +// d: Confirmation query when remote Bluetooth (unpaired) device want's to send obex message to us. +// l: popup_note_window +// +#define qtn_bt_receive_message "Receive Bluetooth message from: %U" + +// d: Confirmation query when remote Bluetooth (paired) device want's to send obex message to us. +// l: popup_note_window +// +#define qtn_bt_receive_message_paired "Receive message via Bluetooth from paired device %U?" + +// d: Data query when obex file transfer needs it. OBEX passkey is entered. +// l: popup_query_data_window +// +#define qtn_bt_enter_obex_pcode "Passcode for data transfer:" + +// d: This is default prompt extension for queries, notes and lists that contain Bluetooth device name. +// d: The %U in queries are replaced with this text if no other Bluetooth device name is available. +// l: list_single_graphic_pane_t1_cp2 +// +#define qtn_bt_dialog_def_name "Bluetooth Device" + +// *** NOTES *** + +// d: Wait note while phone is performing Bluetooth device search/inquiry. +// l: popup_note_wait_window +// +#define qtn_bt_searching "Searching for devices" + +// d: Information note if there is maximum number of connections and new one could not be created. +// l: popup_note_window +// +#define qtn_bt_busy "Maximum amount of Bluetooth connections in use. Can't establish a new one." + +// d: Confirmation query when Bluetooth needs to be turned off when there os active BT connection. +// l: popup_note_window +// +#define qtn_bt_switch_off_anyway "Active Bluetooth connection.\nSwitch off anyway?" + + +// *** GLOBAL NOTES *** + +// d: Global Information note telling audio is routed to BT handsfree. +// l: popup_note_window +// +#define qtn_bt_audio_accessory "Audio routed to BT handsfree" + +// d: Global Information note telling audio is routed to handset. +// l: popup_note_window +// +#define qtn_bt_audio_handset "Audio routed to handset" + +// d: Global Information note for successful connection establishment. +// l: popup_note_window +// +#define qtn_bt_conf_connected "Connected to %U" + +// d: Global Information note for successful connection close. +// l: popup_note_window +// +#define qtn_bt_conf_disconnected "Disconnected from %U" + +// d: Global Information note telling BT connection was closed outside the phones menu. +// l: popup_note_window +// +#define qtn_bt_conn_closed "Bluetooth connection to %U closed" + +// d: An information note when Bluetooth needs to be activated and it's disallowed in off-line mode. +// l: popup_note_window +// +#define qtn_bt_offline_disabled "Bluetooth can't activated in off-line mode" + +// d: Global information note telling phone is entering SIM access profile mode +// l: popup_note_window +// +#define qtn_bt_wait_sap_entering "Phone entering SIM access profile mode" + +// d: Global information note telling phone entering SIM access profile mode is succeeded +// l: popup_note_window +// +#define qtn_bt_sap_entering_succeeded "Phone in SIM access profile mode" + +// d: Global information note telling phone entering SIM access profile mode is failed +// l: popup_note_window +// +#define qtn_bt_sap_entering_failed "Unable to enter SIM access profile mode" + +// d: Global information note telling phone has no sim card +// l: popup_note_window +// +#define qtn_bt_sap_no_sim "No SIM card in phone" + +// d: Global information note telling phone bt stays switched on +// l: popup_note_window +// +#define qtn_bt_permanently_on "Bluetooth switched permanently on" +// d: Global information note telling phone bt is switched on +// l: popup_note_window +// +#define qtn_bt_switched_on "Bluetooth switched on" + +// d: Global information note telling phone bt is switched off +// l: popup_note_window +// +#define qtn_bt_switched_off "Bluetooth switched off" + +// *** DEFAULT BLUETOOTH DEVICE CLASS NAMES *** + +// The icon of each Bluetooth device shown in the UI is based on +// Class of Device (CoD). These are defined in the "Bluetooth" UI specification. +// Device classes and their default names are: + +// d: Class of Device = Computer +// l: list_single_graphic_pane_t1_cp2 +// +#define qtn_bt_computer "Computer" + +// d: Class of Device = Phone +// l: list_single_graphic_pane_t1_cp2 +// +#define qtn_bt_phone "Phone" + +// d: Class of Device = Audio/Video +// l: list_single_graphic_pane_t1_cp2 +// +#define qtn_bt_audio "Audio/Video" + +// d: Class of Device = Audio +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_gen_audio "Audio" + +// d: Class of Device = Keyboard +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_keyboard "Keyboard" + +// d: Class of Device = Mouse +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_mouse "Mouse" + +// d: Class of Device = Printer +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_printer "Printer" + +// d: Class of Device = Car kit +// l: list_single_graphic_pane_t1_cp2 +// r: 5.1 +#define qtn_bt_carkit "Car kit" +// d: Data query when pairing procedure is needed. Bluetooth passkey is entered. +// l: popup_query_data_window +// w: +// r: 3.0 +#define qtn_bt_enter_pk_sap "Enter %0N digit passkey for %1U" + +// d: Data query when user has try to turn BT on for the first time and +// d: there is no local Bluetooth name defined yet (empty name). +// l: popup_query_data_window +// +#define qtn_enter_bt_name "My Bluetooth name:" + +// d: Information note shows the phone's visibility has changed to hidden. +// l: popup_note_window +// w: +// r: 3.1 +// +#define qtn_bt_hidden_from_others "Phone is not detectable in searches made by other devices" + +// d: Confirmation query when use refuse the incoming connection request and want to block connection +// l: popup_note_window +// w: +// r: 3.1 +#define qtn_bt_block_conn_request "Block connection request from %U?" + +// d: query if the bluetooth is off, when java needs it. +// l: popup_info_list_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_is_off_java "The application you are using will not be fully functional while Bluetooth is off. \n\nDo you want to turn Bluetooth on?" + +// d: query if the bluetooth is off, when java needs it. +// l: heading_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_is_off_java_header "Turn Bluetooth on?" + +// d: query if the bluetooth is hidden, when discoverabiliti is needed. +// l: popup_info_list_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_is_hidden_java "Do you want to change your Bluetooth visibility setting value to 'Shown to all'? \n\nThe application you are using will not be fully functional while your Bluetooth visibility is set as 'Hidden'." + +// d: query header if the bluetooth is hidden, when discoverabiliti is needed. +// l: heading_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_is_hidden_java_header "Change discoverability?" + +// d: When the Infrared feature is disabled in runtime, a global information note is shown to the user when Infrared reception is tried to be activated.. +// l: popup_note_window +// w: +// r: 3.2 +#define qtn_ir_not_supported "Infrared not supported" + +// d: Confirmation query when use refuse the incoming connection request and want to block connection >>> Isn't this a heading? +// l: heading_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_block_device_header "Block device?" + +// d: Confirmation query when use refuse the incoming connection request and want to block connection +// l: popup_info_list_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_block_all_conn_attempts "Do you want to block all future connection attempts from device %U?" + +// d: the link key to help in confirmation query when use refuse the incoming connection request and want to block connection from paired device +// l: popup_info_list_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_block_paired_device "Do you want to block all future connection attempts from paired device %U? \nThis will delete your pairing with the device." + +// d: Confirmation query when pairing is requested by the remote device +// l: popup_note_window +// w: +// r: 3.2 +#define qtn_bt_accept_pairing_request "Device '%U' is trying to pair with you. Allow pairing?" + +// d: When VoIP call is on going over WLAN, BT device search is not allowed, a global information note is shown to the user. +// l: popup_note_window +// w: +// r: 3.1 +#define qtn_bt_no_device_discovery_voip "While a VOIP call over WLAN is on-going, Bluetooth device discovery is not possible." + +// d: Query if the bluetooth is off, when java needs it. In this query %U will be substituted with requiring Java application's name. +// l: popup_info_list_pane_t1 +// w: +// r: 5.0 +#define qtn_bt_is_off_java_appname "The %U application you are using will not be fully functional while Bluetooth is off.\n\nDo you want to turn Bluetooth on?" + +// d: Query if the bluetooth is hidden, when discoverabiliti is needed. In this query %U will be substituted with requiring Java application's name. +// l: popup_info_list_pane_t1 +// w: +// r: 5.0 +#define qtn_bt_is_hidden_java_appname "The %U application you are using will not be fully functional when your visibility is set as ’Hidden? Do you want to change your Bluetooth visibility to ’Shown to all?" + +// d: If DOS attacked is detected, user is asked if bluetooth should be swtiched off. +// l: popup_note_window +// r: 5.0 +#define qtn_bt_dos_query "Switch Bluetooth off?" + +// d: If a blocked device is selected after searching devices starts, user is asked whether to unblock it. +// l: popup_note_window +// r: 5.0 +#define qtn_bt_unblock_device "%U is blocked. Do you want to unblock it?" + +// *** Information Notes for AVRCP1.3 *** + +// d: the battery level of AVRCP1.3-supported accessory drops below "low" treshold +// l: popup_note_window +// r: 5.1 +#define qtn_bt_accessory_low "%U battery level low" + +// d: the battery level of AVRCP1.3-supported accessory drops below "critical" treshold +// l: popup_note_window +// r: 5.1 +#define qtn_bt_accessory_critical "%U battery level critical" + +// *** Query for Simple Pairing *** + +// d: Confirmation query when simple pairing procedure is needed. Check if Bluetooth passkeys shown in two devices match. +// l: popup_note_window +// d: %U contains device name, %U1 contains passkey. +// r: 5.1 +#define qtn_bt_simple_passkey_comparison "Does this code match the one on %0U?\n\n%1U" + +// d: Query askes user to type the passkey code from remote input device. +// d: %U contains device name %U1 contains passkey. +// l: popup_note_window +// r: 5.1 +#define qtn_bt_simple_passkey_entry "Enter on %0U:\n\n%1U" + +// *** Error notes for SSP *** + +// d: Error note if a timeout is exceeded before the user accepts or denies the query. +// d: %U contains device name. +// l: popup_note_window +// r: 5.1 +#define qtn_bt_pairing_failed "Unable to pair with %U" + +// d: Warning note If the remote device is already in the process of pairing with another device. +// l: popup_note_window +// r: 5.1 +#define qtn_bt_simple_busy "Pairing failed. Remote device is pairing with another device." + +// *** Notes and query for incoming authorization *** +// d: Confirmation note shows pairing succeeded. +// d: %U contains device name. +// l: popup_note_window +// r: 5.1 +#define qtn_bt_succesfully_paired "Pairing with %U complete" + +// d: Confirmation query to set a Bluetooth device authorised after user has succesfully paired with the device. +// l: popup_note_window +// +#define qtn_bt_authorisation_query "Authorise this device to make connections automatically?" + +//End diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/rom/Btnotif.iby --- a/bluetoothengine/btnotif/rom/Btnotif.iby Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btnotif/rom/Btnotif.iby Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -11,21 +11,18 @@ * * Contributors: * -* Description: Image description file for project btnotif +* Description: * */ +#ifndef __BTNOTIF_IBY__ +#define __BTNOTIF_IBY__ -#ifndef BTNOTIF_IBY -#define BTNOTIF_IBY - -#include +REM Bluetooth notifiers library -#ifdef __BT +file=ABI_DIR\BUILD_DIR\btnotif.dll SHARED_LIB_DIR\btnotif.dll +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,btnotif) -file=ABI_DIR/BUILD_DIR/btnotifsrv.exe SHARED_LIB_DIR/btnotifsrv.exe -ECOM_PLUGIN( btnotifwrapper.dll, btnotifwrapper.rsc ) +ECOM_PLUGIN(btnotifwrapper.dll,101FD68F.rsc) -#endif // __BT - -#endif // BTNOTIF_IBY +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/rom/BtnotifResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/rom/BtnotifResources.iby Wed Sep 01 12:20:04 2010 +0100 @@ -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 __BTNOTIFRESOURCES_IBY__ +#define __BTNOTIFRESOURCES_IBY__ + +data=DATAZ_\RESOURCE_FILES_DIR\btnotif.rsc RESOURCE_FILES_DIR\btnotif.rsc + +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNAuthNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNAuthNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,634 @@ +/* +* 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: Implements authorisation notifier class. +* +*/ + + +// INCLUDE FILES +#include // Own resources +#include "btnauthnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include // Cover UI +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // Unicode character conversion utilities +#include +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif +#include +#include "btnotifnameutils.h" + + +// +// SDP UUID Constants - Short form +// Taken from Bluetooth Profile specification v1.1 +// These are used when registering the service to +// local SDP database and when searching the service +// information from remote device. +const TUint KBTSdpDun = 0x1103; +const TUint KBTSdpGenericTelephony = 0x1204; +const TUint KBTSdpFax = 0x1111; +const TUint KBTSdpObjectPush = 0x1105; +const TUint KBTSdpFileTransfer = 0x1106; +const TUint KBTSdpHeadSet = 0x1108; +const TUint KBTSdpGenericNetworking = 0x1201; +const TUint KBTSdpBasicImaging = 0x111b; + +/** Identification for active object */ +const TInt KBTNotifAuthNotifierLockReq = 10; + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTAuthNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTAuthNotifier* CBTAuthNotifier::NewL() + { + CBTAuthNotifier* self = new (ELeave) CBTAuthNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::CBTAuthNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTAuthNotifier::CBTAuthNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTAuthNotifier::~CBTAuthNotifier() + { + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::RegisterL +// ---------------------------------------------------------- +// +CBTAuthNotifier::TNotifierInfo CBTAuthNotifier::RegisterL() + { + iInfo.iUid=KBTManAuthNotifierUid; + iInfo.iChannel=KBTAuthorisationChannel; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::GetParamsL +// Initialize parameters and check if device is already +// in registry. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTAuthNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL()")); + + if( !iMessage.IsNull()) + { + User::Leave(KErrInUse); + } + + iMessage = aMessage; + iReplySlot = aReplySlot; + + if ( AutoLockOnL() ) + { + // The phone is locked, access denied. + // Write results back to caller and complete message. + CompleteMessage(EFalse, KErrNone); + return; + } + + TBTAuthorisationParams param; + TPckgC pckg(param); + pckg.Set(aBuffer); + + iServiceUid = pckg().iUid.iUid; // Pick up service uid from message + iBTAddr = pckg().iBDAddr; + if ( OtherOutgoPairing( iBTAddr ) ) + { + // We won't allow connection request from another device during outgoing pairing: + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier: outgoing pair in progress, reject request from other device")); + CompleteMessage(KErrCancel); + return; + } + + // create iDevice so that the name won't be lost if the device does + // not exist in registry. + iDevice = CBTDevice::NewL( iBTAddr ); + BtNotifNameUtils::SetDeviceNameL(pckg().iName, *iDevice); + + if ( !iNotifLockProp.Handle() ) + { + User::LeaveIfError( iNotifLockProp.Attach( + KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ) ); + } + + if(!iLockActive) + { + iLockActive = CBTNotifActive::NewL( this, KBTNotifAuthNotifierLockReq, CActive::EPriorityStandard ); + } + + CheckAndSubscribeNotifLocks(); + + if ( !iSuspended ) + { + // Check if device is in the registry, function of notifier base + GetDeviceFromRegL( iBTAddr ); + } + +#ifdef _DEBUG + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL() Executing authorisation...")); + TBuf<12> deviceAddressString; + pckg().iBDAddr.GetReadable(deviceAddressString); + FTRACE(FPrint(_L("[BTNOTIF]\t BT Address: %S"), &deviceAddressString)); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL Service Uid: %d = 0x%X"), iServiceUid, iServiceUid )); +#endif + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::UpdateL +// Notifier update. Stores the received bluetooth +// device name into registry and show it on screen. +// ---------------------------------------------------------- +// +TPtrC8 CBTAuthNotifier::UpdateL(const TDesC8& aBuffer) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::UpdateL()")); + + TBTNotifierUpdateParams params; // Contains iName and iResult (name request) + TPckgC pckg(params); + pckg.Set(aBuffer); + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::UpdateL - Name: '%S' length: %d"), &pckg().iName, pckg().iName.Length() )); + + + // If the device name request was successful and if new name is valid, show the new name. + if (pckg().iResult == KErrNone) + { + BtNotifNameUtils::SetDeviceNameL(pckg().iName, *iDevice); // Override possible previous device name + + // Show new prompt for dialog if it is still on the screen + if ( !iDevice->IsValidFriendlyName() && iDevice->IsValidDeviceName()) + { + // Create new prompt string with new device name + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, iStrResourceId, + BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()), 0 ); + iNotifUiUtil->UpdateQueryDlgL( stringholder ); + iNotifUiUtil->UpdateCoverUiL( iDevice->DeviceName() ); + CleanupStack::PopAndDestroy(); // stringholder + } + } + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::UpdateL() completed")); + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::RequestCompletedL +// Gets called when P&S key notifies change +// ---------------------------------------------------------- +void CBTAuthNotifier::RequestCompletedL( CBTNotifActive* aActive, TInt aId, TInt aStatus ) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::RequestCompletedL()")); + ASSERT( aId == KBTNotifAuthNotifierLockReq ); + (void) aActive; + (void) aId; + + if ( aStatus == KErrNone ) + { + TBool prevSuspend = iSuspended; + // check the latest lock status and subscribe to further lock event: + CheckAndSubscribeNotifLocks(); + if ( prevSuspend && !iSuspended ) + { + // Check if device is in the registry, function of notifier base + GetDeviceFromRegL( iBTAddr ); + } + else if ( iSuspended && !(iNotifUiUtil->IsQueryReleased()) ) + { + iNotifUiUtil->DismissDialog(); + } + } + else + { + HandleError( aActive, KBTNotifAuthNotifierLockReq, iLockActive->RequestStatus().Int() ); + } + + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::RequestCompletedL() completed")); + + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::HandleError +// ---------------------------------------------------------- +void CBTAuthNotifier::HandleError( CBTNotifActive* aActive, TInt aId, TInt aError ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::HandleError() error = %d"), aError )); + (void) aActive; + (void) aId; + (void) aError; + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::DoCancelRequest +// Root caller is CBTNotifActive::CancelRequest(), which calls +// CActive::Cancel that calls DoCancel() if request is active. +// ---------------------------------------------------------- +void CBTAuthNotifier::DoCancelRequest( CBTNotifActive* aActive, TInt aId ) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoCancel() >>")); + ASSERT( aId == KBTNotifAuthNotifierLockReq ); + (void) aActive; + (void) aId; + + iNotifLockProp.Cancel(); + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoCancel() <<")); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::Cancel +// Not Active Object's cancel, but notifier deactivation +// Release all own resources (member variables) +// ---------------------------------------------------------- +// +void CBTAuthNotifier::Cancel() + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::Cancel()")); + + if (iLockActive) + { + iLockActive->CancelRequest(); + delete iLockActive; + iLockActive = NULL; + } + + iNotifLockProp.Close(); + + CBTNotifierBase::Cancel(); + + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::Cancel() completed")); + } + +void CBTAuthNotifier::HandleGetDeviceCompletedL(const CBTDevice* aDev) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::HandleGetDeviceCompleted()")); + (void) aDev; + if ( iSuspended) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::HandleGetDeviceCompleted, still suspended, wait")); + return; + } + + TBool reqAllowed = IsJustWorksPaired( iDevice->AsNamelessDevice() ) ? + IsUserAwarePaired( iDevice->AsNamelessDevice() ) : ETrue ; + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier, reqAllowed %d" ), reqAllowed ) ); + if ( !reqAllowed ) + { + // Do not grant access to device that is not paired in Just Works mode without + // user awareness, e.g. pairing due to an incoming connection request from a + // headset. + CompleteMessage(KErrAccessDenied); + return; + } + + iStrResourceId = R_BT_AUTHORISATION_NAME; + + // Select authorisation state for further use (dialogue selection) + switch( iServiceUid ) + { + case KBTSdpObjectPush: + case KBTSdpBasicImaging: + iAuthState = EBTObexAuthorisation; + iStrResourceId = R_BT_RECEIVE_MESSAGE; + iCoverUiDlgId = ECmdShowReceiveMessageFromDeviceDlg; + + if( IsUserAwarePaired( iDevice->AsNamelessDevice() ) ) + { + iAuthState = EBTObexAuthForPairedDevice; + iStrResourceId = R_BT_RECEIVE_MESSAGE_PAIRED; + iCoverUiDlgId = ECmdShowReceiveMessageFromPairedDeviceDlg; + } + break; + case KBTSdpFax: + case KBTSdpDun: + case KBTSdpFileTransfer: + case KBTSdpHeadSet: + case KBTSdpGenericTelephony: + case KBTSdpGenericNetworking: + if ( iDevice->GlobalSecurity().NoAuthorise() ) + { + iAuthState = EBTAutoAuthorisation; + } + else + { + iAuthState = EBTNormalAuthorisation; + } + iCoverUiDlgId = ECmdShowAcceptConnRequestDlg; + break; + default: + { // check if device is authorized + if ( iDevice->GlobalSecurity().NoAuthorise() ) + { + iAuthState = EBTAutoAuthorisation; + } + else + { + iAuthState = EBTAutoAuthorisationNotAuthorisedOnPhone; + } + break; + } + } + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::HandleGetDeviceComplete() Complete. iAuthState = %d"), iAuthState )); + ShowAuthoQueryL(); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::GetByPassAudioNotifier +// is bypassing this audio connection query needed and if it is, will the +// query be automatically accepted or rejected. +// +// This is used for bypassing the notifiers of the 2nd audio connection, so +// the the user needs to reply to the incoming audio link only once. +// ---------------------------------------------------------- +// +TBool CBTAuthNotifier::GetByPassAudioNotifier(const TBTDevAddr& aDeviceAddress,TBool& aAccept) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::GetByPassAudioNotifier()")); + TBuf8<48> buf; + + RProperty::Define(KPSUidBluetoothEnginePrivateCategory,KBTAuthorInfoPerDevice, RProperty::EByteArray ); + RProperty::Get(KPSUidBluetoothEnginePrivateCategory,KBTAuthorInfoPerDevice,buf); + + if(buf.Length()>2) + { + // accept status of last attempt + aAccept= (buf[0]=='1'); + + // last address + TBuf<12> oldAddrString; + oldAddrString.Copy(buf.Mid(2,12)); + TBTDevAddr lastAddress; + lastAddress.SetReadable(oldAddrString); + + // last time + TInt64 num(0); + TLex8 lex; + lex=buf.Mid(15); + TBuf<32> tmp_debug; + tmp_debug.Copy(buf.Mid(15)); + + lex.Val( num ); + TTime lastConnectionTime( num ); + TTime now; + now.UniversalTime(); + + TBuf16<48> buf2; + buf2.Copy(buf); + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::GetByPassAudioNotifier() Complete same_address=%d Time_ok=%d last_reply=%d"),lastAddress==aDeviceAddress,now>=lastConnectionTime && now =lastConnectionTime && now buf; + buf.Zero(); + buf.AppendNum(aAccept!=EFalse);//now 0/1 only. + buf.Append(';'); + + TBuf<12> a; + aDeviceAddress.GetReadable(a); + for(TInt t=0;t<12;t++) + buf.Append(a[t]); + buf.Append(';'); + + TTime writeTime; + writeTime.UniversalTime(); + buf.AppendNum( writeTime.Int64() ); + + RProperty::Set(KPSUidBluetoothEnginePrivateCategory,KBTAuthorInfoPerDevice,buf); + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::MemorizeCurrentAudioAttempt() complete")); + } + + +// ---------------------------------------------------------- +// CBTAuthNotifier::ShowAuthoQueryL +// Ask user's response on authorization query +// ---------------------------------------------------------- +// +void CBTAuthNotifier::ShowAuthoQueryL() + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::ShowAuthoQueryL")); + + if ( iAuthState == EBTAutoAuthorisation ) + { + // device alreay set trusted now. allow connection automatically + CompleteMessage(ETrue, KErrNone); + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier, device authorized already, allow connection automatically" )); + return; + } + + TBool reply; + if ( GetByPassAudioNotifier(iDevice->BDAddr(),reply) ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier::ShowAuthoQueryL bypassing notifier with reply: %d"),reply)); + CompleteMessage(reply, KErrNone); + return; + } + + // Not asking user's response if auth request is for: profile HFP/HSP/A2DP/AVRCP, and + // there is already existing connection to one of those profiles from the same device. + // + TBool connectStatus = IsExistingConnectionToAudioL( iDevice->BDAddr() ); + // if iAuthState==EBTAutoAuthorisationNotAuthorised and device is connected it means it tries several connections + // so we just approve this. Also if connected & EBTAutoAuthorisation. + // + if(connectStatus && ( iAuthState==EBTAutoAuthorisationNotAuthorisedOnPhone)) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::Automatic authorisation ()")); + //Antomatic authorisation without asking user + CompleteMessage(ETrue, KErrNone); + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::ShowAuthoQueryL() completed-" )); + return; + } + + // check if we're showing bt off query + TInt queryValue=EBTQueryOff; + RProperty::Get(KPSUidBluetoothEnginePrivateCategory,KBTTurnBTOffQueryOn,queryValue); + if( queryValue == EBTQueryOn ) + { + CompleteMessage(KErrCancel); + return; + } + + TBTDeviceName tempDeviceName; + BtNotifNameUtils::GetDeviceDisplayName(tempDeviceName, iDevice); + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, iStrResourceId, tempDeviceName, 0); + TInt keypress = iNotifUiUtil->ShowQueryL( stringholder, R_BT_AUTHORISATION_QUERY, + iCoverUiDlgId, tempDeviceName, CAknQueryDialog::EConfirmationTone ); + CleanupStack::PopAndDestroy(); // stringholder + // If this notifier is cancelled by the caller, no need to perform the rest operation: + if ( iSuspended || iMessage.IsNull() ) + { + return; + } + + if( keypress ) // User has accepted the dialog + { + if( iDevice && !iDevice->IsValidLinkKey() ) + { + TTime now; + now.UniversalTime(); + TBuf8<32> buf; + buf.AppendNum( now.Int64() ); + RProperty::Set(KPSUidBluetoothEnginePrivateCategory,KBTConnectionTimeStamp,buf); + } + + MemorizeCurrentAudioAttempt(ETrue,iDevice->BDAddr() ); + CompleteMessage( ETrue, KErrNone ); + } + else // User has rejected the dialog. + { + iLockActive->CancelRequest(); + DoRejectAuthorizationL(); + } + } + + +// ---------------------------------------------------------- +// CBTAuthNotifier::DoRejectAuthorizationL +// Handle query threshold and block after user rejects authorization +// ---------------------------------------------------------- +// +void CBTAuthNotifier::DoRejectAuthorizationL() + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoRejectAuthorizationL()")); + + CheckAndHandleQueryIntervalL(); + if( iMessage.IsNull() ) + { + return; // No need to continue. + } + + MemorizeCurrentAudioAttempt(EFalse,iDevice->BDAddr()); + + //Logic: query block only at the second time for the same paired device + // query block everytime after rejection for non-paired device. + if( IsPaired( iDevice->AsNamelessDevice() ) ) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoRejectAuthorizationL() rejected a paired device.")); + + TBuf<2*KBTDevAddrSize> tmp; //2 hex digits per byte + RProperty::Get(KPSUidBluetoothEnginePrivateCategory, KBTBlockDevAddr, tmp); + TBTDevAddr priorDeviceaddress; + priorDeviceaddress.Reset(); + priorDeviceaddress.SetReadable(tmp); + + if(priorDeviceaddress != iDevice->BDAddr() ) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoRejectAuthorizationL() NOT the prior rejected device, no block query.")); + + // The last device was not current device, + // so the last device is updated to be current device. + iDevice->BDAddr().GetReadable(tmp); + RProperty::Set(KPSUidBluetoothEnginePrivateCategory, KBTBlockDevAddr, tmp ); + + // Complete message and free resources + CompleteMessage(EFalse, KErrNone); + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoRejectAuthorizationL() completed")); + return; + } + else + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier::DoRejectAuthorizationL() IS SAME as the prior rejected device.")); + + // this was 2nd time in row. Clear the key, so the question will not be made next time. + TBuf<2*KBTDevAddrSize> tmp; + TBTDevAddr emptyAddr; + emptyAddr.Reset(); + emptyAddr.GetReadable(tmp); + RProperty::Set(KPSUidBluetoothEnginePrivateCategory, KBTBlockDevAddr, tmp ); + } + } + + // Ask user to Block this device or not. + if( !iMessage.IsNull() ) + { + QueryBlockDeviceL(); + } + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::CheckAndSubscribeNotifLocks +// Subscribe to PS key and check key value. +// ---------------------------------------------------------- +// +void CBTAuthNotifier::CheckAndSubscribeNotifLocks() + { + if ( !iLockActive->IsActive() ) + { + FLOG(_L("[BTNOTIF]\t CBTAuthNotifier, Subscribe Device Operation Info")); + iNotifLockProp.Subscribe( iLockActive->RequestStatus() ); + iLockActive->GoActive(); + } + TInt ops; + TBTNotifLockPublish::GetNotifLocks( iNotifLockProp, + ops, iBTAddr ); + iSuspended = ops & EBTNotiferLockPairedDeviceSetting; + FTRACE(FPrint(_L("[BTNOTIF]\t CBTAuthNotifier suspended ? %d"), iSuspended )); + } + + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNGenericInfoNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,262 @@ +/* +* 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 visibility timeout notifier class. +* +*/ + + +// INCLUDE FILES + +#include // Localisation stringloader +#include // Own resources +#include "BTNGenericInfoNotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include +#include +#include "btnotifnameutils.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTGenericInfoNotifier* CBTGenericInfoNotifier::NewL() + { + CBTGenericInfoNotifier* self=new (ELeave) CBTGenericInfoNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::CBTGenericInfoNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTGenericInfoNotifier::CBTGenericInfoNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTGenericInfoNotifier::~CBTGenericInfoNotifier() + { + Cancel(); // Free own resources + iQueryMessage.Close(); + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTGenericInfoNotifier::TNotifierInfo CBTGenericInfoNotifier::RegisterL() + { + iInfo.iUid=KBTGenericInfoNotifierUid; + iInfo.iChannel=KBTGenericInfoNotifierUid; + iInfo.iPriority=ENotifierPriorityHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::StartL +// Synchronic notifier launch. Contructs and shows a global +// note when temp visibility expire, no parameters need here. +// ---------------------------------------------------------- +// +TPtrC8 CBTGenericInfoNotifier::StartL( const TDesC8& aBuffer ) + { + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::StartL()")); + if( !iNotifUiUtil ) + { + iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); + } + ProcessParamBufferL(aBuffer, ETrue); + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::StartL() completed")); + + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::GetParamsL +// Mandatory for BT Notifiers when using asynchronous launch. +// ---------------------------------------------------------- +// +void CBTGenericInfoNotifier::GetParamsL(const TDesC8& aBuffer, + TInt /*aReplySlot*/, + const RMessagePtr2& aMessage ) + { + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::GetParamsL")); + if (!iMessage.IsNull()) + { + aMessage.Complete(KErrInUse); + return; + } + iMessage = aMessage; + ProcessParamBufferL(aBuffer, EFalse); + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::ProcessParamBufferL +// Parse the data out of the message that is sent by the +// client of the notifier. +// ---------------------------------------------------------- +void CBTGenericInfoNotifier::ProcessParamBufferL(const TDesC8& aBuffer, TBool aSyncCall) + { + TBTGenericInfoNotifierParams bParams; + TPckgC bPckg(bParams); + + bPckg.Set( aBuffer ); + iSecondaryDisplayCommand = ECmdBTnotifUnavailable; + switch (bPckg().iMessageType) + { + case EBTConnected: + iMessageResourceId= R_BT_CONF_CONNECTED_PROMPT; + iSecondaryDisplayCommand=ECmdShowBtConnectedNote; + break; + case EBTDisconnected: + iMessageResourceId= R_BT_CONF_DISCONNECTED_PROMPT; + iSecondaryDisplayCommand=ECmdShowBtDisconnectedNote; + break; + case EBTAudioAccessory: + iMessageResourceId= R_BT_AUDIO_ACCESSORY_PROMPT; + iSecondaryDisplayCommand=ECmdShowBtAudioAccessoryNote; + break; + case EBTAudioHandset: + iMessageResourceId= R_BT_AUDIO_HANDSET_PROMPT; + iSecondaryDisplayCommand=ECmdShowBtAudioHandsetNote; + break; + case EBTClosed: + iMessageResourceId= R_BT_CONN_CLOSED_PROMPT; + iSecondaryDisplayCommand=ECmdShowBtDisconnectedNote; + break; + case EBTDeviceNotAvailable: + iMessageResourceId= R_BT_DEVICE_NOT_AVAIL; + iSecondaryDisplayCommand=ECmdShowBtDeviceNotAvailableNote; + break; + case EBTOfflineDisabled: + iMessageResourceId= R_BT_OFFLINE_DISABLED; + iSecondaryDisplayCommand=ECmdShowBtOfflineDisableNote; + break; + case EBTVisibilityTimeout: + iMessageResourceId= R_BT_HIDDEN_FROM_OTHERS_NOTE; + iSecondaryDisplayCommand=ECmdShowBtHiddenFromOthersNote; + break; + case EBTEnterSap: + iMessageResourceId= R_BT_ENTER_SAP_NOTE; + iSecondaryDisplayCommand=ECmdShowBtSapEnteringNote; + break; + case EBTSapOk: + iMessageResourceId= R_BT_ENTER_SAP_SUCCEED_NOTE; + iSecondaryDisplayCommand=ECmdShowBtSapEnteringSucceededNote; + break; + case EBTSapFailed: + iMessageResourceId= R_BT_ENTER_SAP_FAILED_NOTE; + iSecondaryDisplayCommand=ECmdShowBtSapEnteringFailedNote; + break; + case EBTSapNoSim: + iMessageResourceId= R_BT_SAP_NO_SIM_NOTE; + iSecondaryDisplayCommand=ECmdShowBtSapNoSimNote; + break; + case EBTDeviceBusy: + iMessageResourceId=R_BT_BUSY_TEXT; + iSecondaryDisplayCommand=ECmdShowBtBusyNote; + break; + case EIRNotSupported: + iMessageResourceId=R_IR_NOT_SUPPORTED; + iSecondaryDisplayCommand=ECmdShowIrNotSupportedNote; + break; + case ECmdShowBtBatteryLow: + iMessageResourceId= R_BT_ACCESSORY_LOW; + iSecondaryDisplayCommand= ECmdShowBtBatteryLowNote; + break; + case ECmdShowBtBatteryCritical: + iMessageResourceId= R_BT_ACCESSORY_CRITICAL; + iSecondaryDisplayCommand= ECmdShowBtBatteryCriticalNote; + break; + case EBTStayPowerOn: + iMessageResourceId= R_BT_PERMANENTLY_ON; + break; + case EBTSwitchedOn: + iMessageResourceId= R_BT_SWITCHED_ON; + break; + case EBTSwitchedOff: + iMessageResourceId= R_BT_SWITCHED_OFF; + break; + default: + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier:: Unkown messageType! ")); + User::Leave(KErrNotFound); + } + + // if the logic string contains substitute indicator "%U", replace it with device name: + HBufC* buf = StringLoader::LoadL( iMessageResourceId); + iQueryMessage.Assign( buf ); + + TInt keyLen; + TInt pos = BluetoothUiUtil::GetStringSubstringKeyPos( + iQueryMessage, 0, keyLen ); + if( pos > KErrNotFound) + { + iBTAddr = TBTDevAddr( bPckg().iRemoteAddr ); + if( !iDevice ) + { + iDevice = CBTDevice::NewL(iBTAddr); + } + GetDeviceFromRegL( iBTAddr ); + } + else + { + ShowNoteAndCompleteL(aSyncCall); + } + } + +// ---------------------------------------------------------- +// CBTGenericInfoNotifier::ShowNoteAndCompleteL +// Shows the notifier in backround +// ---------------------------------------------------------- +// +void CBTGenericInfoNotifier::ShowNoteAndCompleteL(TBool aSyncCall) + { + iNotifUiUtil->ShowInfoNoteL( iQueryMessage, iSecondaryDisplayCommand ); + if (!aSyncCall) + { + CompleteMessage(KErrNone); + } + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::ShowNoteAndComplete() complete")); + } + +void CBTGenericInfoNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::HandleGetDeviceCompleted()")); + + TBTDeviceName name; + BtNotifNameUtils::GetDeviceDisplayName(name, iDevice); + iQueryMessage.Zero(); + BluetoothUiUtil::LoadResourceAndSubstringL( + iQueryMessage, iMessageResourceId, name, 0); + + ShowNoteAndCompleteL(EFalse); + + FLOG(_L("[BTNOTIF]\t CBTGenericInfoNotifier::HandleGetDeviceComplete() Complete")); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNGenericQueryNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNGenericQueryNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,439 @@ +/* +* 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: Bluetooth visibility timeout notifier class. +* +*/ + + +// INCLUDE FILES + +#include // Localisation stringloader +#include +#include +#include // Own resources +#include +#include +#include "BTNGenericQueryNotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + +const TInt KBTNotifPhonePowerKeyWatcher = 30; + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTGenericQueryNotifier* CBTGenericQueryNotifier::NewL() + { + CBTGenericQueryNotifier* self=new (ELeave) CBTGenericQueryNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::CBTGenericQueryNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTGenericQueryNotifier::CBTGenericQueryNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTGenericQueryNotifier::~CBTGenericQueryNotifier() + { + Cancel(); // Free own resources + delete iName; + iQueryMessage.Close(); + delete iQueryHeader; + if (iPhonePowerKey.Handle()) + { + iPhonePowerKey.Cancel(); + } + delete iPhonePowerKeyWatcher; + iPhonePowerKey.Close(); + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::ConstructL +// Symbian 2nd phase constructor can leave. +// Attach to the P&S property and create +// ---------------------------------------------------------- +// +void CBTGenericQueryNotifier::ConstructL() + { + CBTNotifierBase::ConstructL(); + + /** + * SysAp notifies Alarm UI to hide alarm when powerkey is pressed. + * This is called from CSysApAppUi::HandleShortPowerKeyPressedL(), + * so it seems to be a better choice than the following keys: + * KPSUidAvkonDomain/KAknPowerMenuStatus + * KPSUidCoreApplicationUIs/KCoreAppUIsAutolockStatus + * KCoreAppUIsAutolockStatus would be ideal, but it comes too late. + */ + User::LeaveIfError(iPhonePowerKey.Attach(KPSUidCoreApplicationUIs, + KCoreAppUIsHideAlarm)); + iPhonePowerKeyWatcher = CBTNotifActive::NewL(this, + KBTNotifPhonePowerKeyWatcher, CActive::EPriorityStandard); + iPhonePowerKey.Subscribe(iPhonePowerKeyWatcher->RequestStatus()); + iPhonePowerKeyWatcher->GoActive(); + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTGenericQueryNotifier::TNotifierInfo CBTGenericQueryNotifier::RegisterL() + { + iInfo.iUid=KBTGenericQueryNotifierUid; + iInfo.iChannel=KBTGenericQueryNotifierUid; + iInfo.iPriority=ENotifierPriorityHigh; + return iInfo; + } + + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::StartL +// Synchronic notifier launch. Contructs and shows a global +// note, no parameters need here. +// ---------------------------------------------------------- +// +TPtrC8 CBTGenericQueryNotifier::StartL( const TDesC8& /*aBuffer*/ ) + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::StartL()")); + + TPtrC8 ret(KNullDesC8); + return (ret); + + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::GetParamsL +// Mandatory for BT Notifiers when using asynchronous launch. +// This notifier is synchronous so no implementation is needed. +// ---------------------------------------------------------- +// +void CBTGenericQueryNotifier::GetParamsL(const TDesC8& aBuffer, + TInt aReplySlot, + const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::GetParamsL")); + + if (iMessage.Handle()) + { + aMessage.Complete(KErrInUse); + return; + } + + ProcessParamBufferL(aBuffer); + + iMessage = aMessage; + iReplySlot = aReplySlot; + + ShowQueryAndCompleteL(); + + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::GetParamsL Complete")); + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::ProcessParamBufferL +// Parse the data out of the message that is sent by the +// client of the notifier. +// ---------------------------------------------------------- +void CBTGenericQueryNotifier::ProcessParamBufferL(const TDesC8& aBuffer) + { + + TBTGenericQueryNotifierParams bParams; + TPckgC bPckg(bParams); + bPckg.Set( aBuffer ); + + if( bPckg().iMessageType == EBTNameQuery ) + { + iIsNameQuery = ETrue; + return; + } + iSecondaryDisplayCommand = ECmdBTnotifUnavailable; + switch (bPckg().iMessageType) + { + case EBTReceiveMessageQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_RECEIVE_MESSAGE ; + iSecondaryDisplayCommand=ECmdShowReceiveMessageFromDeviceDlg; + break; + case EBTReceiveMessagePairedQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_RECEIVE_MESSAGE_PAIRED; + iSecondaryDisplayCommand= ECmdShowReceiveMessageFromPairedDeviceDlg; + break; + case EBTIsOffQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_POWER_IS_OFF ; + iSecondaryDisplayCommand=ECmdShowBtIsOffDlg; + break; + case EBTActivateOffLineQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_ACTIVATE_IN_OFFLINE; + iSecondaryDisplayCommand=ECmdShowBtActivateInOfflineDlg; + break; + case EBTNoDevicesFoundQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_NO_DEVICES_FOUND; + break; + case EBTAcceptRequestQuery: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_AUTHORISATION_NAME ; + iSecondaryDisplayCommand=ECmdShowAcceptConnRequestDlg; + break; + + case EBTIsOffJavaQuery: + iIsMessageQuery=ETrue; + if( bPckg().iNameExists ) + { + iMessageResourceId=R_BT_IS_OFF_JAVA_APPNAME; // when caller provide Java application name. + } + else + { + iMessageResourceId=R_BT_IS_OFF_JAVA; //r_bt_is_hidden_java + } + iSecondaryDisplayCommand=ECmdShowBtBtIsOffJavaDlg; + iQueryHeader=StringLoader::LoadL( R_BT_IS_OFF_JAVA_HEADER); + break; + + case EBTIsNotShownQuery: + iIsMessageQuery=ETrue; + if( bPckg().iNameExists ) + { + iMessageResourceId=R_BT_IS_HIDDEN_JAVA_APPNAME; // when caller provide Java application name. + } + else + { + iMessageResourceId=R_BT_IS_HIDDEN_JAVA; //r_bt_is_hidden_java + } + iSecondaryDisplayCommand=ECmdShowBtIsNotVisibleDlg; + iQueryHeader=StringLoader::LoadL( R_BT_IS_HIDDEN_JAVA_HEADER); + break; + + case EBTBlockConnectionQuery: + case EBTBlockPairedConnectionQuery: + iIsMessageQuery=ETrue; + if( bPckg().iMessageType == EBTBlockConnectionQuery ) + iMessageResourceId = R_BT_BLOCK_DEVICE_NOHELP; + else + iMessageResourceId = R_BT_BLOCK_PAIRED_DEVICE_NOHELP ; + + iQueryHeader= StringLoader::LoadL( R_BT_BLOCK_DEVICE_HEADER ); + break; + + case EBTSwitchOffAnyway: + iIsMessageQuery=EFalse; + iMessageResourceId=R_BT_SWITCH_OFF_ANYWAY; + break; + + default: + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier:: Unkown messageType! ")); + User::Leave(KErrNotFound); + } + + // if the logic string contains substitute indicator "%U", replace it with device name: + // + HBufC* buf = StringLoader::LoadL( iMessageResourceId); + iQueryMessage.Assign( buf ); + + TInt keyLen; + TInt pos = BluetoothUiUtil::GetStringSubstringKeyPos( + iQueryMessage, 0, keyLen ); + if( pos > KErrNotFound) + { + //if no device name provided, default name will be used: + if( !bPckg().iNameExists ) + iName=StringLoader::LoadL(R_BT_DIALOG_DEF_NAME); + else + { + iName=HBufC::NewL(bPckg().iName.Length() ); + iName->Des().Copy(bPckg().iName); + } + BluetoothUiUtil::LoadResourceAndSubstringL( + iQueryMessage, iMessageResourceId, *iName, 0); + } + else + { + iName=NULL; + } + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::UpdateL +// Update notifier according to new data +// ---------------------------------------------------------- +// +TPtrC8 CBTGenericQueryNotifier::UpdateL(const TDesC8& aBuffer) + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL")); + ProcessParamBufferL(aBuffer); + if( !iNotifUiUtil->IsQueryReleased() ) + { + if(iIsMessageQuery ) + { + iNotifUiUtil->UpdateMessageQueryDlgL(iQueryMessage); + } + else + { + iNotifUiUtil->UpdateQueryDlgL(iQueryMessage); + } + } + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::UpdateL complete")); + + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::ShowQueryAndCompleteL +// Shows the notifier in backround and complete message +// ---------------------------------------------------------- +// +void CBTGenericQueryNotifier::ShowQueryAndCompleteL() + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::ShowQueryAndCompleteL")); + + // Turn lights on and deactivate apps -key + // + iNotifUiUtil->TurnLightsOn(); + if( iIsNameQuery ) + { + TBool nameStatus = IsLocalNameModifiedL(); + if( !nameStatus ) + { + (void) AskLocalBTNameQueryL(); + } + // Check if Local name is set again before turn BT on. + // Turn BT on only when there is local name, since user still has chance + // to ignore the asking name query - like pressing End-key + // + TBTDeviceName localName; + localName.Zero(); + TInt err = iBTEngSettings->GetLocalName(localName); + + if (localName.Length() <= 0) + { + err = KErrCancel; + } + + CompleteMessage( (!err) ? ETrue : EFalse, KErrNone ); + + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::ShowQueryAndCompleteL iIsNameQuery complete")); + return; + } + + TInt keypress; + TBTDeviceName name(KNullDesC); + if( iName ) + { + name.Copy( *iName ); + } + if( iIsMessageQuery ) + { + + keypress = iNotifUiUtil->ShowMessageQueryL(iQueryMessage, *iQueryHeader, + R_BT_GENERIC_MESSAGE_QUERY, CAknQueryDialog::EConfirmationTone ); + } + else + { + keypress = iNotifUiUtil->ShowQueryL( iQueryMessage, R_BT_GENERIC_QUERY, + iSecondaryDisplayCommand, name, CAknQueryDialog::EConfirmationTone ); + } + + CompleteMessage( (keypress) ? ETrue: EFalse, KErrNone ); + + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::ShowQueryAndCompleteL complete")); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::RequestCompletedL +// Gets called when P&S key notifies the change +// ---------------------------------------------------------- +void CBTGenericQueryNotifier::RequestCompletedL(CBTNotifActive* aActive, + TInt aId, TInt aStatus) + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::RequestCompletedL()")); + switch (aId) + { + case KBTNotifPhonePowerKeyWatcher: + { + iPhonePowerKey.Subscribe(aActive->RequestStatus()); + aActive->GoActive(); + TInt val = 0; + // If the Power key is pressed it is likely that he user does not + // want to continue with existing query, so we dismiss it to avoid + // any clashes with subsequent popups (ie for setting Lock code). + // This is probably just a temporary solution to resolve immediate problem, + // and the issue is raised with UI Framework team. + if (!aStatus && !iPhonePowerKey.Get(val) && val == ECoreAppUIsHideAlarm) + { + // DismissDialog() internally checks that actual query dialog is NOT NULL, + // so it is safe to call it here. + iNotifUiUtil->DismissDialog(); + } + } + break; + } + + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::RequestCompletedL() completed")); + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::HandleError +// ---------------------------------------------------------- +void CBTGenericQueryNotifier::HandleError(CBTNotifActive* aActive, TInt aId, + TInt aError) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTGenericQueryNotifier::HandleError() error = %d"), aError )); + (void) aActive; + (void) aId; + (void) aError; + } + +// ---------------------------------------------------------- +// CBTAuthNotifier::DoCancelRequest +// Root caller is CBTNotifActive::CancelRequest(), which calls +// CActive::Cancel that calls DoCancel() if request is active. +// ---------------------------------------------------------- +void CBTGenericQueryNotifier::DoCancelRequest(CBTNotifActive* aActive, TInt aId) + { + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::DoCancel() >>")); + (void) aActive; + (void) aId; + + iPhonePowerKey.Cancel(); + + FLOG(_L("[BTNOTIF]\t CBTGenericQueryNotifier::DoCancel() <<")); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNInqNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNInqNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,166 @@ +/* +* 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: Declares Bluetooth device inquiry notifier class. +* +*/ + + +// INCLUDE FILES +#include // Eikon environment + +#include "btninqnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include // Localisation stringloader +#include // Own resources + + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTInqNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTInqNotifier* CBTInqNotifier::NewL() + { + CBTInqNotifier* self=new (ELeave) CBTInqNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTInqNotifier::CBTInqNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTInqNotifier::CBTInqNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTInqNotifier::~CBTInqNotifier() + { + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::~CBTInqNotifier()")); + delete iUi; + iUi = NULL; + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::~CBTInqNotifier() completed")); + } + +// ---------------------------------------------------------- +// CBTInqNotifier::RegisterL +// ---------------------------------------------------------- +// +CBTInqNotifier::TNotifierInfo CBTInqNotifier::RegisterL() + { + + iInfo.iUid=KDeviceSelectionNotifierUid; + iInfo.iChannel=KBTInquiryChannel; + iInfo.iPriority=ENotifierPriorityVHigh; // User input level + return iInfo; + } + +// ---------------------------------------------------------- +// CBTInqNotifier::GetParamsL +// Initialize parameters and launch device search. +// ---------------------------------------------------------- +// +void CBTInqNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::GetParamsL()")); + + if( !iMessage.IsNull() ) + { + aMessage.Complete(KErrInUse); + return; + } + + iMessage = aMessage; + iReplySlot = aReplySlot; + + TBTDeviceClass cod; + TBTDeviceSelectionParamsPckg pckg; + pckg.Copy(aBuffer); + + LaunchInquiryL(pckg().DeviceClass()); + + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::GetParamsL() completed ")); + } + +// ---------------------------------------------------------- +// CBTInqNotifier::NotifyDeviceSearchCompleted +// Notified by InquiryUI, return to caller by completing message +// ---------------------------------------------------------- +// +void CBTInqNotifier::NotifyDeviceSearchCompleted(TInt aErr, const TBTDeviceResponseParams& aDevice) + { + FTRACE(FPrint( _L("[BTNOTIF]\t CBTInqNotifier::NotifyDeviceSearchCompleted aErr %d"), aErr )); + CompleteMessage(TBTDeviceResponseParamsPckg( aDevice ), aErr); + } + +// ---------------------------------------------------------- +// CBTInqNotifier::Cancel +// Release all own resources (member variables) +// ---------------------------------------------------------- +// +void CBTInqNotifier::Cancel() + { + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::Cancel()")); + if( iUi ) + { + iUi->Cancel(); + delete iUi; + iUi = NULL; + } + CBTNotifierBase::Cancel(); + FLOG(_L("[BTNOTIF]\t CBTInqNotifier::Cancel() completed")); + } + +// ---------------------------------------------------------- +// Ensure BT is ON; there are not too many connections; InqUi +// is launched successfully. +// ---------------------------------------------------------- +// +void CBTInqNotifier::LaunchInquiryL(const TBTDeviceClass& aDesiredDevice) + { + // Turn BT on if it is not yet. + if ( !CheckAndSetPowerOnL() ) + { + CompleteMessage(KErrGeneral); + return; + } + + TInt linkCount; + User::LeaveIfError(RProperty::Get(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetPHYCount, linkCount)); + if ( linkCount > 6 ) //support only piconet + { + iNotifUiUtil->ShowInfoNoteL( R_BT_BUSY_NOTE, ECmdBTnotifUnavailable ); + User::Leave(KErrInUse); + } + + // launch Inquiry UI + + iUi = new (ELeave) CBTInqUI( this, iNotifUiUtil, aDesiredDevice); + + + iUi->ConstructL(); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNInqUI.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNInqUI.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,1434 @@ +/* +* 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: Declares Bluetooth device inquiry user interface class. +* +*/ + + +// INCLUDE FILES +#include // AVKON components +#include +#include +#include +#include +#include // For WLAN state checking +#include +#include +#include // Resource reader +#include // Own resources +#include +#include +#include // Borrow WLan signal strenth bar to show RSSI +#include +#include +#include +#include "btninqui.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include "btnotifnameutils.h" + + +const TInt KBTAllPurposeBufferLength = 266; +const TInt KBTNotifNonPairedUsedDevicesMaxNumber= 5; +// RSSI value range: -127dB ~ +20dB +const TInt KRssiRangeOffset = 127 + 1; // Offset for getting a non-zero positive value +const TInt KMinimumStrength = 1; +const TInt KMediumStrength = 53; +const TInt KHighStrength = 82; +const TUint32 ExcludePairedDeviceMask = 0x800000; +const TUint32 ResetExcludePairedDeviceMask = 0xFF7FFFFF; +_LIT(KBtnotifBmpFileName,"btnotif.mbm"); +_LIT(KWLanBmpFileName,"wlanplugin.mif"); + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTInqUI::CBTInqUI +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTInqUI::CBTInqUI( MBTNDeviceSearchObserver* aObserver, + CBTNotifUIUtil* aUtil, + const TBTDeviceClass& aDesiredDevClass): + iUiUtil (aUtil), + iEikonEnvRef( iUiUtil->LocalEikonEnv() ), + iDevicesFound (EFalse), + iBroughtForwards (EFalse), + iDesiredDeviceClass (aDesiredDevClass), + iSystemCancel (EFalse), + iPageForName ( EFalse ), + iCurrentlyResolvingUnnamedDeviceIndex (0), + iDevSearchObserver (aObserver) + { + iBTRegistryQueryState=ENoQuery; + } + +// ---------------------------------------------------------- +// CBTInqUI::ConstructL +// Symbian 2nd phase constructor can leave. +// Creates first device list (not shown yet) and initializes +// couple of member variables with default values. +// ---------------------------------------------------------- +// +void CBTInqUI::ConstructL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::ConstructL()")); + + // Read default device names to an array + iDefaultDeviceNamesArray = iEikonEnvRef.ReadDesCArrayResourceL( R_BT_DEFAULT_DEVICE_NAMES ); + + // create the timer + iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle); + + // Create device array + // + iDeviceListRows = new(ELeave) CDesCArrayFlat(1); + + iPairedDevicesArray = new (ELeave) CBTDeviceArray(1); + iLastUsedDevicesArray = new(ELeave) CBTDeviceArray(1); + iLastSeenDevicesArray = new(ELeave) CBTDeviceArray(1); + iAdjustedUsedDeviceArray = new(ELeave) CBTDeviceArray(1); + + iDevMan=CBTEngDevMan::NewL(this); + + iExcludePairedDevices = iDesiredDeviceClass.DeviceClass() & ExcludePairedDeviceMask ? + ETrue : EFalse; + if ( iExcludePairedDevices ) + { + FLOG (_L("[BTNOTIF]\t CBTInqUI::ConstrucL Excluding paired devices")); + iDesiredDeviceClass = iDesiredDeviceClass.DeviceClass() & ResetExcludePairedDeviceMask; + } + // Retrieve paired devices to a local array + RetrievePairedDevices(); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::ConstructL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::RetrieveUsedDevices- Substitute +// ---------------------------------------------------------- +// +void CBTInqUI::RetrieveUsedDevices() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RetrieveUsedDevicesL()")); + + TBTRegistrySearch searchPattern; + searchPattern.FindAll(); + + //Ignore this error. Continue device search. + TInt err=iDevMan->GetDevices( searchPattern, iLastUsedDevicesArray ); + if(err) + { + TRAP_IGNORE(AdjustDeviceArrayL(iAdjustedUsedDeviceArray)); + DoDeviceFrontListSelection(); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI: get useddevice err %d"), err)); + } + else + { + iBTRegistryQueryState=EQueryUsed; + } + FLOG(_L("[BTNOTIF]\t CBTInqUI::RetrieveUsedDevicesL() returned")); + } + +//--------------------------------------------------------------- +// CBTInqUI::RetrievePairedDevices +//--------------------------------------------------------------- +void CBTInqUI::RetrievePairedDevices() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RetrievePairedDevicesL()")); + + TBTRegistrySearch searchPattern; + searchPattern.FindBonded(); + + TInt err= iDevMan->GetDevices( searchPattern, iPairedDevicesArray ); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI: get paireddevice err %d"), err)); + if(err) + { + //Next: try to get used devices + RetrieveUsedDevices(); + } + else + { + iBTRegistryQueryState=EQueryPaired; + } + FLOG(_L("[BTNOTIF]\t CBTInqUI::RetrievePairedDevicesL() returned")); + } + +// ---------------------------------------------------------- +// CBTInqUI::HandleGetDevicesComplete +// ---------------------------------------------------------- +// +void CBTInqUI::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* /*aDeviceArray*/) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleGetDevicesComplete() err: %d"), aErr)); + (void) aErr; + switch(iBTRegistryQueryState) + { + case EQueryPaired: + // If a device is paired in Just Works model but without user awareness, + // This device won't be shown in UI paired view, so we have to + // remove it from this array so that it will be shown to user + // in the last used device list. + for (int i = iPairedDevicesArray->Count() - 1; i >= 0; --i ) + { + if ( !IsUserAwarePaired( iPairedDevicesArray->At( i )->AsNamelessDevice() ) ) + { + delete iPairedDevicesArray->At( i ); + iPairedDevicesArray->Delete( i ); + } + } + RetrieveUsedDevices(); + break; + case EQueryUsed: + // fill in the list of last seen devices, so it can be shown + TRAP_IGNORE(AdjustDeviceArrayL(iAdjustedUsedDeviceArray)); + DoDeviceFrontListSelection(); + break; + default: + break; + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::HandleGetDevicesComplete() Complete")); + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTInqUI::~CBTInqUI() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::~CBTInqUI()")); + + if( iBroughtForwards ) + { + iEikonEnvRef.BringForwards(EFalse); + iBroughtForwards = EFalse; + } + + if( iPairedDevicesArray ) + { + iPairedDevicesArray->ResetAndDestroy(); + delete iPairedDevicesArray; + } + if( iLastUsedDevicesArray ) + { + iLastUsedDevicesArray->ResetAndDestroy(); + delete iLastUsedDevicesArray; + } + if( iLastSeenDevicesArray ) + { + iLastSeenDevicesArray->ResetAndDestroy(); + delete iLastSeenDevicesArray; + } + + iLastSeenDevicesNameComplete.Close(); + + if( iAdjustedUsedDeviceArray ) + { + iAdjustedUsedDeviceArray->ResetAndDestroy(); + delete iAdjustedUsedDeviceArray; + } + if( iDefaultDeviceNamesArray ) + { + iDefaultDeviceNamesArray->Reset(); + delete iDefaultDeviceNamesArray; + } + + delete iDevMan; + delete iDeviceListBox; + delete iDeviceListRows; + delete iPeriodicTimer; + + FLOG(_L("[BTNOTIF]\t CBTInqUI::~CBTInqUI() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::Cancel +// ---------------------------------------------------------- +// +void CBTInqUI::Cancel() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::Cancel()")); + + iSystemCancel = ETrue; + if(iDevMan) + { + iDevMan->Cancel(); + } + + if( iSearchFilterPopupList ) + { + iSearchFilterPopupList->CancelPopup(); + } + + if(iPeriodicTimer) + { + iPeriodicTimer->Cancel(); + } + + RemoveScanner(); + InquiryComplete(KErrCancel); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::Cancel() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::DisplayDevicesFrontListL +// Display last seen devices popuplist +// ---------------------------------------------------------- +// +void CBTInqUI::DisplayDevicesFrontListL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::DisplayDevicesFrontListL()")); + + + if ( iAdjustedUsedDeviceArray->Count() <= 0 ) + { + SelectSearchCategoryL(); + return; + } + + if( !iBroughtForwards ) + { + iEikonEnvRef.BringForwards(ETrue); // Destructor will release this later on + iBroughtForwards = ETrue; + } + + // Create the devices popuplist + CreatePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT , R_BT_LAST_USED_DEVS_POPUP_TITLE ); + + // Add devices into device list. + for( TInt index = 0; index < iAdjustedUsedDeviceArray->Count(); index++ ) + { + AddToDeviceListBoxL ( iAdjustedUsedDeviceArray->At(index) ); + } + + // Add "more devices" command as first item of list + HBufC* formatString = HBufC::NewLC( KBTAllPurposeBufferLength ); + formatString->Des().Copy( TPtrC(KDeviceIconFormatTable[EDeviceIconBlank].iFormat ) ); + HBufC* moreDevicesString = iEikonEnvRef.AllocReadResourceLC( R_BT_MORE_DEVICES_ITEM ); + formatString->Des().Append( *moreDevicesString ); + CleanupStack::PopAndDestroy(); // moreDevicesString + iDeviceListRows->InsertL( 0, *formatString ); + CleanupStack::Pop(); // formatString + + // Launch popup list and wait for user input + AllowDialerAndAppKeyPress( EFalse ); + TInt popupRetVal = iDevicePopupList->ExecuteLD(); + iDevicePopupList = NULL; + AllowDialerAndAppKeyPress( ETrue ); + + if( !popupRetVal ) + { + // query cancelled by user or system, complete device search: + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrCancel); + return; + } + TInt currentDeviceIndex = iDeviceListBox->CurrentItemIndex(); + + // Delete device list box and reset device items array + delete iDeviceListBox; + iDeviceListBox = NULL; + iDeviceListRows->Reset(); + + if( currentDeviceIndex > 0 ) // User selected "a used device" + { + HandleDeviceSelectionL( iAdjustedUsedDeviceArray->At( currentDeviceIndex - 1 ) ); + return; + } + + // user selected more devices. + SelectSearchCategoryL(); + FLOG(_L("[BTNOTIF]\t CBTInqUI::DisplayDevicesFrontListL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::DeviceSearchUiL +// Execute bluetooth device search/inquiry. +// Parameters: +// OUT: aDevice - selected device after inquiry +// IN: aObexOnly - flag if OBEX capable devices is requested +// ---------------------------------------------------------- +// +void CBTInqUI::DeviceSearchUiL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceSearchUiL()")); + + TSearchFlowState searchFlow; + TInt err; + AllowDialerAndAppKeyPress( EFalse ); + do + { + searchFlow = InitInquiryL(err); + } while (searchFlow == ESearchAgain); + + if (searchFlow == ESearchCompleted) + { + // search completed caused by either user cancel or failure + iDevSearchObserver->NotifyDeviceSearchCompleted(err); + AllowDialerAndAppKeyPress( ETrue ); + return; + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI, Displaying devices already found")); + + TInt keypress(0); + // Show devices popup list for received devices while + // inquiry is still active and list may be updated. + if( !iInquiryComplete ) + { + CreatePopupListL( R_BT_SOFTKEYS_SELECT_STOP, R_BT_SEARCH_DEVS_POPUP_TITLE ); + + // Set animation + iDevicePopupList->Heading()->SetHeaderAnimationL( R_BT_ANIMATION_FOR_POPUPLIST ); + + // Launch popup list and wait for user input + keypress = iDevicePopupList->ExecuteLD(); + iDevicePopupList = NULL; + } + + // If Cancel() is called while DoInquery() is still running, + // such as taking out MMC while bt devices discovery or user pressed redkey. + // In such cases, We need to dismiss anything and function returns immediately. + // + if (iSystemCancel ) + { + FLOG(_L("[BTNOTIF]\t inquiry was canncelled by the system!")); + iSystemCancel = EFalse; + AllowDialerAndAppKeyPress( ETrue ); + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrCancel); + return; + } + + // Cancel inquiry + RemoveScanner(); + + // Store the highlighted device index and destroy list box + iHighLightedItemIndex = 0; + if( iDeviceListBox ) + { + iHighLightedItemIndex = iDeviceListBox->CurrentItemIndex(); + delete iDeviceListBox; + iDeviceListBox = NULL; + } + + // user selected a device during active inquiry + if (keypress) + { + AllowDialerAndAppKeyPress( ETrue ); + HandleDeviceSelectionL( iLastSeenDevicesArray->At( iHighLightedItemIndex ) ); + return; + } + + // Error encountered in inquiry + if (iInquiryStatus) + { + AllowDialerAndAppKeyPress( ETrue ); + iDevSearchObserver->NotifyDeviceSearchCompleted(iInquiryStatus); + return; + } + + // Inquiry completed, show final device list + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceSearchUiL Displaying final devicelist")); + CreatePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, R_BT_FOUND_DEVS_POPUP_TITLE ); + + //cancel iPeriodicTimer after the final list is shown + iPeriodicTimer->Cancel(); + User::ResetInactivityTime(); + // Set highlight on top of same device as it was in previous popuplist + if( iHighLightedItemIndex >= 0 ) + { + iDeviceListBox->HandleItemAdditionL(); + iDeviceListBox->SetCurrentItemIndex(iHighLightedItemIndex); + } + + // Launch popup list and wait for user input + keypress = iDevicePopupList->ExecuteLD(); + iDevicePopupList = NULL; + AllowDialerAndAppKeyPress( ETrue ); + // If dialog is cancelled by system: + if( !keypress) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrCancel); + return; + } + + // Get user selection + TInt index = iDeviceListBox->CurrentItemIndex(); + delete iDeviceListBox; + iDeviceListBox = NULL; + + HandleDeviceSelectionL( iLastSeenDevicesArray->At( index ) ); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceSearchUiL() complete")); + } + +TSearchFlowState CBTInqUI::InitInquiryL(TInt& aReason) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::InitInquiryL")); + if (IsActiveVoIPOverWLAN()) + { + iUiUtil->ShowInfoNoteL( R_BT_NO_DEVICE_DISCOVERY_VOIP, ECmdBTnotifUnavailable ); + aReason = KErrInUse; + return ESearchCompleted; + } + + // starting the timer + iPeriodicTimer->Cancel(); + iPeriodicTimer->Start(KPeriodicTimerInterval4Sec, KPeriodicTimerInterval4Sec, + TCallBack(PeriodicTimerCallBack, this)); + + // Prepare for using hostresolver to search devices + CreateScannerL(); + + iInquiryStatus = KErrCancel; // Give a initial value (for end key handling) + iDevicesFound = EFalse; + iInquiryComplete = EFalse; + iSystemCancel = EFalse; + + // Show wait note until dialog is dismissed by inquirey result callbacks or user cancel + TInt ret = iUiUtil->ShowWaitDlgL( R_BT_SEARCHING_DEVICES_NOTE ); + + // If user cancels searching, ret will be KerrNone. + // According to Description of Eikdialog, ShowWaitDlgL() returns zero + // if it was the cancel button (@c EEikBidCancel). + if( ret == KErrNone || iSystemCancel ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI, User cancelled waiting note")); + RemoveScanner(); + aReason = KErrCancel; + return ESearchCompleted; + } + + if( !iDevicesFound ) // No devices found at all + { + FLOG(_L("[BTNOTIF]\t CBTInqUI no devices found at all")); + RemoveScanner(); // Cancel inquiry + + if( iInquiryStatus != KErrNone ) + { + aReason = iInquiryStatus; + return ESearchCompleted; + } + + // Show try again query + TBool keypress(0); + keypress = iUiUtil->ShowQueryL( KErrNone, R_BT_TRY_AGAIN_QUERY, ECmdBTnotifUnavailable ); + if( !keypress ) // User has not requested new inquiry + { + aReason = KErrCancel; + return ESearchCompleted; + } + else + { + FLOG(_L("[BTNOTIF]\t CBTInqUI user wanted to try again")); + return ESearchAgain; + } + } + return ESearchFirstDeviceFound; + } + +// ---------------------------------------------------------- +// CBTInqUI::DeviceAvailableL +// Bluetooth device has been received. +// ---------------------------------------------------------- +// +void CBTInqUI::DeviceAvailableL( const TNameRecord& aNameRecord, const TDesC& aDevName, TBool aIsNameComplete ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceAvailableL()")); + + if( !iDevicesFound ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceAvailableL() first found, clear last seen devices array")); + iLastSeenDevicesArray->ResetAndDestroy(); // Remove previous inquiry results + iDevicesFound = ETrue; + iInquiryStatus = KErrNone; + } + + iUiUtil->CompleteWaitDlgL(); + + TInquirySockAddr& sa = TInquirySockAddr::Cast( aNameRecord.iAddr ); + + // Create device object with received CoD information + CBTDevice* newDevice = CBTDevice::NewLC( sa.BTAddr() ); + TBTDeviceClass cod( sa.MajorServiceClass(), sa.MajorClassOfDevice(), sa.MinorClassOfDevice() ); + newDevice->SetDeviceClass( cod ); + FTRACE(FPrint(_L("[BTNOTIF]\t CoD %b"), cod.DeviceClass() )); + TInt rssi = 0; + if( sa.ResultFlags() & TInquirySockAddr::ERssiValid ) + { + rssi = sa.Rssi() + KRssiRangeOffset; + } + + TBTDeviceName name(aDevName); + if (!aIsNameComplete) + { + // Append a little "..." to partial names. + _LIT(KToBeContd, "..."); + if (name.MaxLength() - name.Length() >= KToBeContd().Length()) + { + name.Append(KToBeContd); + } + } + BtNotifNameUtils::SetDeviceNameL(name, *newDevice); + + // Append newDevice in the bottom of the "last seen" device array. + iLastSeenDevicesArray->AppendL(newDevice); + iLastSeenDevicesNameComplete.AppendL(aIsNameComplete); + CleanupStack::Pop(); // new device is under iLastSeenDevicesArray control now + + __ASSERT_DEBUG(iLastSeenDevicesArray->Count() == iLastSeenDevicesNameComplete.Count(), + User::Panic(_L("BTNotifInqUI - device array and name resolution status array out of sync"), KErrCorrupt)); + + // Update device popup list with newDevice + AddToDeviceListBoxL( newDevice, rssi ); + + __ASSERT_DEBUG(iLastSeenDevicesArray->Count() == iDeviceListRows->Count(), + User::Panic(_L("BTNotifInqUI - device array and UI list out of sync"), KErrCorrupt)); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceAvailableL() completed")); + } + +void CBTInqUI::DeviceNameUpdatedL(const TNameRecord& aNameRecord, TInt aLastSeenIndex) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::DeviceUpdatedL() Name found: %S"), &(aNameRecord.iName) )); + + TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr ); + + TInt rssi = 0; + if( sa.ResultFlags() & TInquirySockAddr::ERssiValid ) + { + rssi = sa.Rssi() + KRssiRangeOffset; + } + + BtNotifNameUtils::SetDeviceNameL(aNameRecord.iName, *iLastSeenDevicesArray->At(aLastSeenIndex)); + DeviceUpdatedL(rssi, aLastSeenIndex); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceUpdatedL() completed")); + } + +void CBTInqUI::PageTimeoutOnDeviceWithPartialNameL(TInt aLastSeenIndex) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::PageTimeoutOnDeviceWithPartialNameL()")); + DeviceUpdatedL(KMinimumStrength, aLastSeenIndex); + FLOG(_L("[BTNOTIF]\t CBTInqUI::PageTimeoutOnDeviceWithPartialNameL() completed")); + } + + +void CBTInqUI::DeviceUpdatedL(TInt aSignalStrength, TInt aLastSeenIndex) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceUpdatedL()")); + + HBufC* formatString = HBufC::NewLC( KBTAllPurposeBufferLength ); + FormatListBoxEntryL(*iLastSeenDevicesArray->At(aLastSeenIndex), aSignalStrength, formatString->Des()); + + // The assumption here is that iLastSeenDevicesArray is always accurately reflected + // in iDeviceListRows so device indexes match. + __ASSERT_DEBUG(iLastSeenDevicesArray->Count() == iDeviceListRows->Count(), + User::Panic(_L("BTNotifInqUI - device array and UI dev list out of sync not created"), KErrCorrupt)); + + iDeviceListRows->Delete(aLastSeenIndex); + iDeviceListRows->InsertL(aLastSeenIndex, *formatString); + CleanupStack::PopAndDestroy(); // formatString + + __ASSERT_DEBUG(iDeviceListBox, + User::Panic(_L("BTNotifInqUI - UI list non-existant on name update"), KErrCorrupt)); + iDeviceListBox->HandleItemAdditionL(); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::DeviceUpdatedL()")); + } + +void CBTInqUI::FormatListBoxEntryL(CBTDevice& aDevice, const TInt aSignalStrength, TPtr aFormatString) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::FormatListBoxEntryL()")); + + TInt iconIndex (EDeviceIconDefault); + TInt defNameIndex (EBTDeviceNameIndexDefault); + + // Check whether the device is already in registry. + TInt index = LookupFromDevicesArray(iPairedDevicesArray, &aDevice ); + if( index >= 0 ) + { + // Update device's link key and friendly name + // with those found from registry. + aDevice.UpdateL( *( iPairedDevicesArray->At( index ) ) ); + } + + for (TInt i = 0; i < KDeviceRowLayoutTableSize; i++) + { + if ( ( aDevice.DeviceClass().MajorDeviceClass() == KDeviceRowLayoutTable[i].iMajorDevClass ) && + ( (aDevice.DeviceClass().MinorDeviceClass() == KDeviceRowLayoutTable[i].iMinorDevClass ) || + KDeviceRowLayoutTable[i].iMinorDevClass == 0 ) ) + { + iconIndex = KDeviceRowLayoutTable[i].iIconIndex; + defNameIndex = KDeviceRowLayoutTable[i].iDefaultNameIndex; + break; + } + } + + if ( !aDevice.IsValidFriendlyName() && !aDevice.IsValidDeviceName() ) + { + BtNotifNameUtils::SetDeviceNameL(iDefaultDeviceNamesArray->MdcaPoint(defNameIndex), aDevice); + } + + //Convert device name to Unocode for display + if ( aDevice.IsValidFriendlyName() ) + { + aFormatString.Copy( aDevice.FriendlyName() ); + } + else + { + aFormatString.Copy( BTDeviceNameConverter::ToUnicodeL(aDevice.DeviceName())); + } + + TPtrC iconFormat (KDeviceIconFormatTable[iconIndex].iFormat); + + aFormatString.Insert( 0, iconFormat ); + + if( aSignalStrength > 0) + { + if( aSignalStrength <= KMediumStrength ) + { + aFormatString.Append( TPtrC(KDeviceIconFormatTable[EDeviceIconRssiLow].iFormat ) ); + } + else if( aSignalStrength <= KHighStrength ) + { + aFormatString.Append( TPtrC(KDeviceIconFormatTable[EDeviceIconRssiMed].iFormat ) ); + } + else + { + aFormatString.Append( TPtrC(KDeviceIconFormatTable[EDeviceIconRssiGood].iFormat ) ); + } + } + + // If the device is paired, add paired icon to format list + // Paired device using JustWork file transfering mode is not shown as paired here. + if( index >= 0 && IsUserAwarePaired ( aDevice.AsNamelessDevice() ) ) + { + aFormatString.Append( TPtrC(KDeviceIconFormatTable[EDeviceIconPaired].iFormat ) ); + } + else + { + // if device is blocked, add blocked icon to format list + + TInt indexB = LookupFromDevicesArray(iLastUsedDevicesArray, &aDevice ); + + if ( indexB>=0 && iLastUsedDevicesArray->At( indexB )->GlobalSecurity().Banned()) + { + aFormatString.Append( TPtrC(KDeviceIconFormatTable[EDeviceIconBlocked].iFormat ) ); + } + } + FLOG(_L("[BTNOTIF]\t CBTInqUI::FormatListBoxEntryL() completed")); + } + + +// ---------------------------------------------------------- +// CBTInqUI::InquiryComplete +// Inquiry has been completed. +// ---------------------------------------------------------- +// +void CBTInqUI::InquiryComplete( TInt aError ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::InquiryComplete() status = %d: %d devices found"), aError, iLastSeenDevicesArray->Count() )); + iInquiryComplete = ETrue; + // Remove popup list if any devices exists + if( iDevicePopupList ) + { + iDevicePopupList->CancelPopup(); + iDevicePopupList = NULL; + } + + TRAP_IGNORE( iUiUtil->CompleteWaitDlgL() ); + + if ( aError == KErrNone || aError == KErrCancel || aError == KErrEof ) + { + iInquiryStatus = (aError == KErrEof ) ? KErrNone : aError; + } + else + { + iLastSeenDevicesArray->ResetAndDestroy(); // Remove previous inquiry results + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::InquiryComplete() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::PeriodicTimerCallBack(TAny* aAny) +// The call back function +// ---------------------------------------------------------- +// +TInt CBTInqUI::PeriodicTimerCallBack(TAny* /*aAny*/) + { + User::ResetInactivityTime(); + return KErrNone; // Return value ignored by CPeriodic + } + +// ---------------------------------------------------------- +// CBTInqUI::RemoveScanner +// Remove scanner active object if still exists. +// ---------------------------------------------------------- +// +void CBTInqUI::RemoveScanner() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RemoveScanner()")); + if( iScanner ) + { + iScanner->CancelRequest(); + iHostResolver.Close(); + iSocketServer.Close(); + delete iScanner; + iScanner = NULL; + } + iDevsWithoutName.Close(); + FLOG(_L("[BTNOTIF]\t CBTInqUI::RemoveScanner() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::CreatePopupListL +// ---------------------------------------------------------- +// +void CBTInqUI::CreatePopupListL(TInt aSoftkeysResourceId, TInt aTitleResourceId ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::CreatePopupListL()")); + + __ASSERT_DEBUG( !iDeviceListBox, User::Panic(_L("BTNotifInqUI - iDeviceListBox not released!" ), KErrAlreadyExists)); + __ASSERT_DEBUG( !iDevicePopupList, User::Panic(_L("BTNotifInqUI - iDevicePopupList not released!"),KErrAlreadyExists)); + + // Create listbox for devices + iDeviceListBox = new(ELeave) CAknSingleGraphicPopupMenuStyleListBox; + + // Create popup list + iDevicePopupList = CAknPopupList::NewL( iDeviceListBox, aSoftkeysResourceId, AknPopupLayouts::EDynMenuWindow ); + + iDeviceListBox->ConstructL(iDevicePopupList, EAknListBoxMenuList ); + iDeviceListBox->CreateScrollBarFrameL(ETrue); + iDeviceListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + + // Read title from resources + HBufC* popupListTitle = iEikonEnvRef.AllocReadResourceLC( aTitleResourceId ); + iDevicePopupList->SetTitleL(*popupListTitle); + CleanupStack::PopAndDestroy(); // popupListTitle + + // Create list box model for devices + CTextListBoxModel* model = iDeviceListBox->Model(); + model->SetItemTextArray(iDeviceListRows); + model->SetOwnershipType(ELbmDoesNotOwnItemArray); // Do not destroy items + + // Set up filename for Avkon bitmap + TFileName avkonbmpFilename = AknIconUtils::AvkonIconFileName(); + + // Setup graphic items list for BT devices listbox + CAknIconArray* iconList = new(ELeave) CAknIconArray(KDeviceIconCount); + CleanupStack::PushL( iconList ); + + CreateAndAppendIconL( KAknsIIDQgnPropBtComputer, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_computer, + EMbmAvkonQgn_prop_bt_computer_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtPhone, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_phone, + EMbmAvkonQgn_prop_bt_phone_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtAudio, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_audio, + EMbmAvkonQgn_prop_bt_audio_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtMisc, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_misc, + EMbmAvkonQgn_prop_bt_misc_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnStatBtBlank, avkonbmpFilename, + EMbmAvkonQgn_stat_bt_blank, + EMbmAvkonQgn_stat_bt_blank, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtKeyboard, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_keyboard, + EMbmAvkonQgn_prop_bt_keyboard_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtMouse, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_mouse, + EMbmAvkonQgn_prop_bt_mouse_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtPrinter, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_printer, + EMbmAvkonQgn_prop_bt_printer_mask, iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtCarKit, avkonbmpFilename, + EMbmAvkonQgn_prop_bt_carkit, + EMbmAvkonQgn_prop_bt_carkit_mask, iconList); + + GetColorIconL( avkonbmpFilename, KAknsIIDQgnIndiBtPairedAdd, + EMbmAvkonQgn_indi_bt_paired_add, + EMbmAvkonQgn_indi_bt_paired_add_mask, iconList ); + + + TFileName bmpFilename; + bmpFilename += KFileDrive; + bmpFilename += KDC_BITMAP_DIR; + bmpFilename += KBtnotifBmpFileName; + + GetColorIconL( bmpFilename, KAknsIIDQgnIndiBtBlocked, + EMbmBtnotifQgn_indi_bt_blocked, + EMbmBtnotifQgn_indi_bt_blocked_mask, iconList ); + + bmpFilename.Zero(); + bmpFilename.Append( KFileDrive ); + bmpFilename.Append( KDC_APP_BITMAP_DIR ); + bmpFilename.Append( KWLanBmpFileName ); + + GetColorIconL( bmpFilename, KAknsIIDQgnIndiWlanSignalLowAdd, + EMbmWlanpluginQgn_indi_wlan_signal_low_add, + EMbmWlanpluginQgn_indi_wlan_signal_low_add_mask, iconList); + + GetColorIconL( bmpFilename, KAknsIIDQgnIndiWlanSignalMedAdd, + EMbmWlanpluginQgn_indi_wlan_signal_med_add, + EMbmWlanpluginQgn_indi_wlan_signal_med_add_mask, iconList ); + + GetColorIconL( bmpFilename, KAknsIIDQgnIndiWlanSignalGoodAdd, + EMbmWlanpluginQgn_indi_wlan_signal_good_add, + EMbmWlanpluginQgn_indi_wlan_signal_good_add_mask, iconList ); + + // Transfer iconlist ownership to the listbox + // + iDeviceListBox->ItemDrawer()->ColumnData()->SetIconArray(iconList); + CleanupStack::Pop(); // iconList + + FLOG(_L("[BTNOTIF]\t CBTInqUI::CreatePopupListL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::UpdateDeviceListL +// ---------------------------------------------------------- +// +void CBTInqUI::AddToDeviceListBoxL( CBTDevice* aDevice, const TInt aSignalStrength ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::AddToDeviceListBoxL()")); + + HBufC* formatString = HBufC::NewLC( KBTAllPurposeBufferLength ); + FormatListBoxEntryL(*aDevice, aSignalStrength, formatString->Des()); + + // Add device format string into device items + // + TInt deviceCount = iDeviceListRows->Count(); + iDeviceListRows->InsertL( deviceCount, *formatString ); + CleanupStack::PopAndDestroy(); // formatString + + TInt currentItemIndex = 0; + if(deviceCount != 0 && iDeviceListBox) + { + // Store temporarily the highlighted device and destroy list box + // + currentItemIndex = iDeviceListBox->CurrentItemIndex(); + } + + if( iDeviceListBox ) + { + iDeviceListBox->HandleItemAdditionL(); + + if(deviceCount != 0 ) + { + //set highligh back to user selected one. + iDeviceListBox->SetCurrentItemIndex(currentItemIndex); + } + + // Adjust top item index in order to "scroll up" the list. + // If current highlight device is not the top one and the listbox's visible slots are full(at least 5 devices are listed), + // to make the newly discovered device visible, the list needs to be scrolled up. + // + TInt topIndex = iDeviceListBox->TopItemIndex(); + deviceCount = iDeviceListRows->Count(); + + if( (currentItemIndex != topIndex && deviceCount > 5 ) && (currentItemIndex+1 < deviceCount ) ) + { + iDeviceListBox->SetTopItemIndex( topIndex+1 ); //scroll up + } + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::AddToDeviceListBoxL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::LookupFromDevicesArrayL +// Check if the BT device is paired devices array +// ---------------------------------------------------------- +// +TInt CBTInqUI::LookupFromDevicesArray(const CBTDeviceArray* aDeviceArray, const CBTDevice* aDevice ) const + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::LookupFromDevicesArray()")); + + __ASSERT_DEBUG( aDeviceArray, User::Panic(_L("BTNotifInqUI - aDeviceArray not created"), KErrNotFound )); + + for( TInt index = 0; index < aDeviceArray->Count(); index++ ) + { + // Try to find device by its address. + if ( aDeviceArray->At( index )->BDAddr() == aDevice->BDAddr() ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::LookupFromDevicesArrayL()idx %d"), index)); + return index; // Return index to the device at array + } + } + return KErrNotFound; + } + +// ---------------------------------------------------- +// CBTInqUI::CreateAndAppendIconL +// ---------------------------------------------------- +void CBTInqUI::CreateAndAppendIconL( const TAknsItemID& aID, + const TDesC& aFileName, + const TInt aBitmapId, + const TInt aMaskId, + CAknIconArray* aIconList) + { + CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), aID, aFileName, aBitmapId, aMaskId); + + CleanupStack::PushL(icon); + aIconList->AppendL( icon ); + CleanupStack::Pop(); // icon + } + +// --------------------------------------------------------- +// CBTInqUI::AdjustDeviceArrayL +// Applend max 5 lately used non-paird devices plus all the +// paired devices to the input parameter by the order of +// the last used time stamp. +// --------------------------------------------------------- +// +void CBTInqUI::AdjustDeviceArrayL(CBTDeviceArray* aDeviceArray) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::AdjustDeviceArrayL()")); + + TInt lSize = iLastUsedDevicesArray->Count(); + + if (lSize <= 0) + { + return; + } + + TInt pSize = iPairedDevicesArray->Count(); + TInt nonPairedUsedDevicesNumber = lSize - pSize; + + // Pickup 5 latest used devices (paired devices are excluded) + // + TInt count(0); + + if (nonPairedUsedDevicesNumber <= KBTNotifNonPairedUsedDevicesMaxNumber) + count = nonPairedUsedDevicesNumber; + else + count = KBTNotifNonPairedUsedDevicesMaxNumber; + + for(TInt i=0; i < count; i++ ) + { + TInt targetDeviceIndex = 0; + + //go through iLastUsedDevicesArray, compare each device's time stamp and, find the latest used one. + for(TInt k=0; k < lSize; k++) + { + if(iLastUsedDevicesArray->At(targetDeviceIndex)->Used() < iLastUsedDevicesArray->At(k)->Used()) + { + targetDeviceIndex = k; + } + } + + //if result is not a paired device, add it to the adjuested device array. + if( LookupFromDevicesArray(iPairedDevicesArray, iLastUsedDevicesArray->At(targetDeviceIndex)) == KErrNotFound ) + { + aDeviceArray->AppendL(iLastUsedDevicesArray->At(targetDeviceIndex)->CopyL()); + } + //if result is a paired device, ignore this search round and step-back counter i to make sure this + //search round won't be count. + else + { + i--; + } + + //set the time stamp to -1, in order to ignore this device during next search round. + iLastUsedDevicesArray->At(targetDeviceIndex)->SetUsed(-1); + } + + // Add paired devices to the adjusted list(if paired device exist), + // by the order of last used time. + // + if(pSize > 0) + { + for( TInt i = 0; i < pSize; i++ ) + { + //count size in the beginning of each loop, since the size could grow, + //if new item has been appended in last loop round. + TInt sSize = aDeviceArray->Count(); + + TInt j = 0; + for (; j < sSize ; j++) + { + //check if this paired device alreay on the list jump out this loop + if (iPairedDevicesArray->At(i)->BDAddr() == aDeviceArray->At(j)->BDAddr()) + { + break; + } + + // We do not add device still valid paired into list if iExcludePairedDevices is set. + if ( IsUserAwarePaired( iPairedDevicesArray->At(i)->AsNamelessDevice() ) && + iExcludePairedDevices ) + { + break; + } + + //if this device is not on the list and it is used later then current comparing + //device, insert the paired device to aDeviceArray at suitable position. + TTime pTime = iPairedDevicesArray->At(i)->Used(); + TTime sTime = aDeviceArray->At(j)->Used(); + + if ( pTime > sTime) + { + aDeviceArray->InsertL(j, iPairedDevicesArray->At(i)->CopyL()); + break; + } + } + + //if this paired device is not on the sorted list(it is older then all the devices on the list), + //append it to the end of the list. + if (j == sSize) + { + if ( iExcludePairedDevices ) + { + // Add device to list if device is not paired and iExcludePairedDevices is not set. + if ( !IsUserAwarePaired( iPairedDevicesArray->At(i)->AsNamelessDevice() ) ) + { + aDeviceArray->AppendL(iPairedDevicesArray->At(i)->CopyL()); + } + } + else + { + aDeviceArray->AppendL(iPairedDevicesArray->At(i)->CopyL()); + } + } + } + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::AdjustDeviceArrayL() Complete.")); + } + +//---------------------------------------------------------- +// CBTInqUI::QueryUnblockDeviceL +//---------------------------------------------------------- +TInt CBTInqUI::QueryUnblockDeviceL(CBTDevice* aDevice) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::QueryUnblockDeviceL()")); + RBuf stringholder; + stringholder.CleanupClosePushL(); + TBTDeviceName name; + BtNotifNameUtils::GetDeviceDisplayName( name, aDevice ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, R_BT_UNBLOCK_DEVICE, name, 0 ); + TInt keypress(0); + keypress = iUiUtil->ShowQueryL( stringholder, R_BT_UNBLOCK_QUERY, + ECmdBTnotifUnavailable, name, CAknQueryDialog::EConfirmationTone ); + CleanupStack::PopAndDestroy(); // stringholder + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::QueryUnblockDeviceL() keypress= %d"),keypress)); + + return keypress; + } + +// ---------------------------------------------------------- +// CBTInqUI::UnblockDevice +// Unblock device by modifying registry +//----------------------------------------------------------- +// +TInt CBTInqUI::UnblockDevice(TInt aIndex) + { + TInt returnValue = KErrNone; + TBTDeviceSecurity deviceSecuritySettings = iLastUsedDevicesArray->At(aIndex)->GlobalSecurity(); + deviceSecuritySettings.SetBanned(EFalse); + iLastUsedDevicesArray->At(aIndex)->DeleteLinkKey(); + //DeleteLinkKey() invalidates the LinkKey and IsPaired entries in Lisbon, so... + iLastUsedDevicesArray->At(aIndex)->SetGlobalSecurity(deviceSecuritySettings); + returnValue = iDevMan->ModifyDevice(*iLastUsedDevicesArray->At(aIndex)); + if (!returnValue) + { + iBTRegistryQueryState = ESetDeviceUnblocked; + } + return returnValue; + } + +// --------------------------------------------------------- +// CBTInqUI::HandleDevManComplete +// CBTEngDevMan callback +// --------------------------------------------------------- +// +void CBTInqUI::HandleDevManComplete(TInt aErr) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleDevManComplete() aErr= %d"),aErr)); + + switch(iBTRegistryQueryState) + { + case ESetDeviceUnblocked: + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleDevManComplete() EModifyDevice"))); + iDevSearchObserver->NotifyDeviceSearchCompleted(aErr, iDevParams); + break; + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleDevManComplete() complete"))); + } + +//---------------------------------------------------------------- +// CBTInqUI: DeviceSearchFilter +//---------------------------------------------------------------- +void CBTInqUI::SelectSearchCategoryL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::SelectSearchCategoryL()")); + + if( !(iDesiredDeviceClass == TBTDeviceClass(0)) ) + { + // Notifier caller passed specified COD to search device, not need to show filter query. + DeviceSearchUiL(); + FLOG(_L("[BTNOTIF]\t CBTInqUI::SelectSearchCategoryL() complete: not show filter query")); + return; + } + // Create listbox for devices + // + CEikTextListBox* searchFilterListBox = new(ELeave) CAknSinglePopupMenuStyleListBox; + CleanupStack::PushL(searchFilterListBox); + + // Create popup list + // + iSearchFilterPopupList = CAknPopupList::NewL( + searchFilterListBox, + R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, + AknPopupLayouts::EDynMenuWindow ); + + searchFilterListBox->ConstructL(iSearchFilterPopupList, EAknListBoxMenuList ); + searchFilterListBox->CreateScrollBarFrameL(ETrue); + searchFilterListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + + // Read title from resources + // + HBufC* popupListTitle = iEikonEnvRef.AllocReadResourceLC( R_BT_SEARCH_FILTER_POPUP_TITLE ); + iSearchFilterPopupList->SetTitleL(*popupListTitle); + CleanupStack::PopAndDestroy(); // popupListTitle + + // reuse iDeviceListRows for serch filter items + iDeviceListRows->Reset(); + + // Create list box model for devices + // + + CTextListBoxModel* model = searchFilterListBox->Model(); + model->SetItemTextArray(iDeviceListRows); + model->SetOwnershipType(ELbmDoesNotOwnItemArray); // Do not destroy items + + + // Add itms of filter to popuplist + // Order must be same as in enum EBTSerchFilterItem + // + + AddItemToSearchFilterL(R_BT_SEARCH_FOR_ALL); + AddItemToSearchFilterL(R_BT_SEARCH_FOR_AUDIO); + AddItemToSearchFilterL(R_BT_SEARCH_FOR_PHONE); + AddItemToSearchFilterL(R_BT_SEARCH_FOR_COMPUTER); + AddItemToSearchFilterL(R_BT_SEARCH_FOR_INPUT); + + // Launch popup list and wait for user input, disable other Ui key presses first: + AllowDialerAndAppKeyPress( EFalse ); + // After input, destroy popup list + // + TInt popupRetVal = iSearchFilterPopupList->ExecuteLD(); + iSearchFilterPopupList = NULL; + AllowDialerAndAppKeyPress( ETrue ); + + if( popupRetVal ) + { + TInt currentDeviceIndex = searchFilterListBox->CurrentItemIndex(); + switch(currentDeviceIndex) + { + case EBTSearchForAll: + iDesiredDeviceClass = TBTDeviceClass(0,0,0); + break; + case EBTSearchForAudio: + iDesiredDeviceClass = TBTDeviceClass(0,EMajorDeviceAV,0); + break; + + case EBTSearchForPhone: + iDesiredDeviceClass = TBTDeviceClass(0,EMajorDevicePhone,0); + break; + + case EBTSearchForComputer: + iDesiredDeviceClass = TBTDeviceClass(0,EMajorDeviceComputer,0); + break; + + case EBTSearchForInput: + iDesiredDeviceClass = TBTDeviceClass(0,EMajorDevicePeripheral,0); + break; + + default: + break; + } + } + + CleanupStack::PopAndDestroy(); //searchFilterListBox + iDeviceListRows->Reset(); + + if( !popupRetVal ) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrCancel); + } + else + { + DeviceSearchUiL(); + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::SelectSearchCategoryL() complete")); + } + +//------------------------------------------------------------------------------ +// CBTInqUI: AddItemToSearchFilterL +//------------------------------------------------------------------------------ +void CBTInqUI::AddItemToSearchFilterL ( TInt aResourceId ) + { + HBufC* formatString = HBufC::NewLC( KBTAllPurposeBufferLength ); + HBufC* string = iEikonEnvRef.AllocReadResourceLC( aResourceId ); + formatString->Des().Append( *string ); + CleanupStack::PopAndDestroy(); // string + iDeviceListRows->AppendL( *formatString ); + CleanupStack::Pop(); // formatString + } + +void CBTInqUI::GetColorIconL( TFileName& aFilename, TAknsItemID aItemID, + TInt aPic, TInt aPicmask, CAknIconArray* aIconList ) + { + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + + AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), aItemID, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + bitmap, mask, aFilename, aPic, aPicmask, KRgbBlack); + + CGulIcon* icon = CGulIcon::NewL(bitmap, mask); + CleanupStack::Pop(2); // bitmap, mask; + CleanupStack::PushL(icon); + aIconList->AppendL( icon ); + CleanupStack::Pop(); // icon + } + +TBool CBTInqUI::IsActiveVoIPOverWLAN() + { + TInt error = KErrNone; + + // check VoIP over WLAN is on going or not: + // + TInt wlanStatus = 0; + error = RProperty::Get(KPSUidWlan, KPSWlanIndicator, wlanStatus); + FTRACE( FPrint( _L( "CBTInqNotifier::CheckActivationOfVoIPOverWLAN() WLAN state: %d (error %d)" ), wlanStatus, error ) ); + if (error) + { + return EFalse; + } + + TInt callState = 0; + error = RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callState ); + FTRACE( FPrint( _L( "CBTInqNotifier::CheckActivationOfVoIPOverWLAN() call state: %d (error %d)" ), callState, error ) ); + if( error == KErrNone && + (wlanStatus == EPSWlanIndicatorActive || wlanStatus == EPSWlanIndicatorActiveSecure)&& + callState == EPSCTsyCallTypeVoIP ) + { + FTRACE( FPrint( _L( " VoIP call ongoing, do not allow inquiry!" ) ) ); + return ETrue; + } + return EFalse; + } + +void CBTInqUI::DoDeviceFrontListSelection() + { + TRAPD(err, DisplayDevicesFrontListL()); + if (err) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(err); + } + } + +void CBTInqUI::HandleDeviceSelectionL(CBTDevice* aDev) + { + iDevParams = TBTDeviceResponseParams(); + iDevParams.SetDeviceAddress( aDev->BDAddr()); + iDevParams.SetDeviceClass( aDev->DeviceClass()); + if( aDev->IsValidFriendlyName()) + { + iDevParams.SetDeviceName( aDev->FriendlyName()); + } + else if( aDev->IsValidDeviceName()) + { + iDevParams.SetDeviceName( BTDeviceNameConverter::ToUnicodeL( aDev->DeviceName() ) ); + } + //check if this device is blocked + TInt index = LookupFromDevicesArray(iLastUsedDevicesArray, aDev); + TBool blocked = ( index >= 0 && iLastUsedDevicesArray->At( index )->GlobalSecurity().Banned() ); + if (!blocked) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrNone, iDevParams); + return; + } + + TInt toUnblk = QueryUnblockDeviceL(aDev); + if (!toUnblk) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(KErrCancel); + return; + } + TInt err = UnblockDevice( index ); + if (err) + { + iDevSearchObserver->NotifyDeviceSearchCompleted(err); + } + // otherwise NotifyDeviceSearchCompleted will be called after unblock is really done. + } + +void CBTInqUI::AllowDialerAndAppKeyPress( TBool aAllow ) + { + CEikAppUi* const eikAppUi = CEikonEnv::Static()->EikAppUi(); + if ( aAllow) + { + // Enable dialer + static_cast( eikAppUi )->SetKeyEventFlags( 0x00 ); + // Activate apps key. + // Ignore the return error code as we can do nothing if this operation fails + (void) static_cast(eikAppUi)->SuppressAppSwitching(EFalse); + } + else + { + // Disable dialer + static_cast( eikAppUi )->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | + CAknAppUiBase::EDisableSendKeyLong); + // Deactivate apps key + (void) static_cast(eikAppUi)->SuppressAppSwitching(ETrue); + } + FTRACE( FPrint( _L( "CBTInqUI::AllowDialerAndAppKeyPress : %d" ), aAllow ) ); + } + +TBool CBTInqUI::HaveDevsWithPartialName(TInt& aFirstFoundIndex ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::HaveDevsWithPartialName().")); + for (TInt i = 0; i < iLastSeenDevicesNameComplete.Count(); i++) + { + if (!iLastSeenDevicesNameComplete[i]) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HaveDevsWithPartialName() index %d is partial."), i)); + + aFirstFoundIndex = i; + return ETrue; + } + } + return EFalse; + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNInquiAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNInquiAO.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,301 @@ +/* +* 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: Part of CBTInqUI class: use Active object to search BT devices. +* +*/ +#include "btninqui.h" +#include "btNotifDebug.h" + +/** Identification for active object request */ +const TInt KBTNotifInquiryNotifierReq = 20; + +// ---------------------------------------------------------- +// CBTInqUI::PrepareScannerL +// ---------------------------------------------------------- +// +void CBTInqUI::CreateScannerL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::CreateScannerL()")); + + __ASSERT_DEBUG( iScanner == NULL, User::Panic(_L("BTNotifInqUI - iScanner not released!"),KErrAlreadyExists)); + + // Create scanner object which will do the actual search + iScanner = CBTNotifActive::NewL( this, KBTNotifInquiryNotifierReq, CActive::EPriorityStandard ); + User::LeaveIfError( iSocketServer.Connect() ); + TProtocolDesc pInfo; + User::LeaveIfError( iSocketServer.FindProtocol( _L("BTLinkManager"), pInfo)); + User::LeaveIfError( iHostResolver.Open(iSocketServer, pInfo.iAddrFamily, pInfo.iProtocol)); + IssueRequestL(); + + FLOG(_L("[BTNOTIF]\t CBTInqUI::CreateScannerL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::IssueRequestL +// Issue Bluetooth device inquiry/search itself. +// Reads also inquiry mode from shared data. +// ---------------------------------------------------------- +// +void CBTInqUI::IssueRequestL() + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::IssueRequestL()")); + + if (reinterpret_cast(iDevSearchObserver)->AutoLockOnL()) + { + // Cancel bt inquiry immediately if device is locked. + FLOG(_L("[BTNOTIF]\t CBTInqUI::IssueRequestL() Device is locked")); + Cancel(); + return; + } + + TUint action = 0; + if( !iPageForName ) + { + action = KHostResInquiry + KHostResEir + KHostResIgnoreCache; + } + else + { + TInt firstPartialNameDevIndex; + if (HaveDevsWithPartialName(firstPartialNameDevIndex)) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::IssueRequestL() looking up device index %d (have partial name already)"), firstPartialNameDevIndex)); + + action = KHostResName + KHostResIgnoreCache; + TInquirySockAddr sa; + sa.SetBTAddr(iLastSeenDevicesArray->At(firstPartialNameDevIndex)->BDAddr()); + iInquirySockAddr.SetBTAddr( sa.BTAddr() ); + } + else if( iCurrentlyResolvingUnnamedDeviceIndex < iDevsWithoutName.Count() ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::IssueRequestL() looking up device index %d (currently anonymous)"), iCurrentlyResolvingUnnamedDeviceIndex)); + + action = KHostResName + KHostResIgnoreCache; + TInquirySockAddr& sa = TInquirySockAddr::Cast( iDevsWithoutName[iCurrentlyResolvingUnnamedDeviceIndex].iAddr ); + iInquirySockAddr.SetBTAddr( sa.BTAddr() ); + } + } + if (action) + { + iInquirySockAddr.SetAction( action ); + iInquirySockAddr.SetIAC(KGIAC); + iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iScanner->RequestStatus() ); + iScanner->GoActive(); + } + else + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RunL() All name inquiries complete .")); + iPageForName = EFalse; + iCurrentlyResolvingUnnamedDeviceIndex = 0; + InquiryComplete( KErrNone ); + } + FLOG(_L("[BTNOTIF]\t CBTInqUI::IssueRequestL() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::RequestCompletedL +// BT-device or timeout has been received. Inform caller for +// received device and issue next EIR/Name request. +// ---------------------------------------------------------- +// +void CBTInqUI::RequestCompletedL( CBTNotifActive* aActive, TInt aId, TInt aStatus ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() status: %d >>"), aStatus )); + ASSERT( aId == KBTNotifInquiryNotifierReq); + (void) aActive; + + TInt firstPartialNameDevIndex = -1; + const TBool haveDevsWithPartialName = HaveDevsWithPartialName(firstPartialNameDevIndex); + + if( aStatus == KErrNone ) + { + if( iPageForName ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() in name request state.")); + + if (haveDevsWithPartialName) + { + // We resolve names in chronological order so it must be the first device + // with an incomplete name we can find on the last seen list. + HandleUpdatedNameL(firstPartialNameDevIndex); + } + else + { + // Must be the current index in iDevsWithoutName. + HandleFoundNameL(); + iCurrentlyResolvingUnnamedDeviceIndex++; + } + IssueRequestL(); + } + else + { + HandleInquiryDeviceL(); + iHostResolver.Next( iEntry, iScanner->RequestStatus() ); + iScanner->GoActive(); + } + } + else if( aStatus == (KHCIErrorBase - EPageTimedOut) && iPageForName ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() HCI:EPageTimeOut, page next one.")); + if (haveDevsWithPartialName) + { + // A device with incomplete name has probably gone out of range. Just removing + // it from the UI may be a bit confusing, so let's just update its RSSI indicator + // to minimum. + PageTimeoutOnDeviceWithPartialNameL(firstPartialNameDevIndex); + } + else + { + iCurrentlyResolvingUnnamedDeviceIndex++; + } + IssueRequestL(); + } + else + { + if( !iPageForName && (iDevsWithoutName.Count() > 0 || haveDevsWithPartialName) ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() have devs with incomplete name = %d, nameless devices %d, paging for name."), + haveDevsWithPartialName, iDevsWithoutName.Count() )); + iCurrentlyResolvingUnnamedDeviceIndex = 0; + iPageForName = ETrue; + IssueRequestL(); + } + else + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() NameInquiryComplete with error or no device found.")); + HandleError( aActive, aId, aStatus ); + } + } + FLOG(_L("[BTNOTIF]\t CBTInqUI::RequestCompletedL() <<")); + } + +// ---------------------------------------------------------- +// CBTInqUI::HandleError +// Inform UI from error occured. +// ---------------------------------------------------------- +// +void CBTInqUI::HandleError( CBTNotifActive* aActive, TInt aId, TInt aError ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::HandleError()")); + (void) aActive; + (void) aId; + iPageForName = EFalse; + InquiryComplete( aError ); + FLOG(_L("[BTNOTIF]\t CBTInqUI::HandleError() completed")); + } + +// ---------------------------------------------------------- +// CBTInqUI::DoCancelRequest +// ---------------------------------------------------------- +// +void CBTInqUI::DoCancelRequest( CBTNotifActive* aActive, TInt aId ) + { + (void) aActive; + (void) aId; + iHostResolver.Cancel(); + } + +// ---------------------------------------------------------- +// CBTInqUI::HandleInquiryDeviceL +// Inform of properties of the found BTdevice, +// which passes the search filter. Its name would be retrived +// later if not contained by the first round of inquiry. +// ---------------------------------------------------------- +// +void CBTInqUI::HandleInquiryDeviceL() + { + TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr ); + + if ( iDesiredDeviceClass.DeviceClass() == 0 || sa.MajorClassOfDevice() == iDesiredDeviceClass.MajorDeviceClass() ) + { + FLOG(_L("[BTNOTIF]\t CBTInqUI::HandleInquiryDeviceL() The found device passes the search filter.")); +#ifdef _DEBUG + TBuf<12> devAddrString; + sa.BTAddr().GetReadable(devAddrString); + FTRACE(FPrint(_L("[BTNOTIF]\t BT Address: %S"), &devAddrString)); +#endif + TBTDeviceName devName; + TBool isNameComplete(EFalse); + TBool nameGotten = CheckEirDeviceName( iEntry, devName, isNameComplete ); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleInquiryDeviceL() EIR device name? %d, %S, complete = %d"), nameGotten, &devName, isNameComplete )); + if( nameGotten ) + { + DeviceAvailableL( iEntry(), devName, isNameComplete ); + } + else + { + iDevsWithoutName.AppendL( iEntry() ); + } + } + } + +// ---------------------------------------------------------- +// CBTInqUI::HandleFoundNameL +// Inform of retrieved device name after 2nd inquiry. +// ---------------------------------------------------------- +// +void CBTInqUI::HandleFoundNameL() + { +#ifdef _DEBUG + TBuf<12> devAddrString; + TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr ); + sa.BTAddr().GetReadable(devAddrString); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleFoundNameL() BT Address: %S"), &devAddrString)); +#endif + if( iEntry().iName != KNullDesC ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleFoundNameL() Name found: %S"), &(iEntry().iName) )); + DeviceAvailableL( iDevsWithoutName[iCurrentlyResolvingUnnamedDeviceIndex], iEntry().iName, ETrue ); + } + + FLOG(_L("[BTNOTIF]\t CBTInqUI::HandleFoundNameL() Complete")); + } + +void CBTInqUI::HandleUpdatedNameL(TInt aLastSeenIndex) + { +#ifdef _DEBUG + TBuf<12> devAddrString; + TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr ); + sa.BTAddr().GetReadable(devAddrString); + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleUpdatedNameL() BT Address: %S"), &devAddrString)); +#endif + iLastSeenDevicesNameComplete[aLastSeenIndex] = ETrue; + if( iEntry().iName != KNullDesC ) + { + DeviceNameUpdatedL(iEntry(), aLastSeenIndex); + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTInqUI::HandleUpdatedNameL() Complete"))); + } + + +// ---------------------------------------------------------- +// CBTInqUI::CheckEirDeviceName +// Check if the retrieved the device info contains device name. +// ---------------------------------------------------------- +// +TBool CBTInqUI::CheckEirDeviceName( TNameEntry& aEntry, TBTDeviceName& aName, TBool& aIsComplete ) + { + TBluetoothNameRecordWrapper eir( aEntry() ); + TInt length = eir.GetDeviceNameLength(); + + TInt err( KErrNone ); + + if( length > 0 ) + { + err = eir.GetDeviceName( aName, aIsComplete); + return (!err); + } + return EFalse; + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNMain.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,159 @@ +/* +* 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: Methods for BT notifier +* +*/ + + +// INCLUDE FILES + +#include + +#include "btnauthnotifier.h" // All notifiers +#include "btnpinnotifier.h" +#include "btninqnotifier.h" +#include "btnobexpinnotifier.h" +#include "btnpwrnotifier.h" +#include "btNotifDebug.h" +#include "BTNGenericInfoNotifier.h" +#include "BTNGenericQueryNotifier.h" +#include "btnpbappinnotifier.h" +#include "btnpaireddevsettnotifier.h" +#include "btnssppasskeyentrynotifier.h" +#include "btnumcmpnotifier.h" +#include "btuserconfnotifier.h" +#include "btnenterpriseitsecurityinfonotifier.h" + +// CONSTANTS +const TInt KBTNotifierArrayIncrement = 8; + + +// ================= EXPORTED FUNCTIONS ==================== + +// --------------------------------------------------------- +// +// Instantiate notifiers +// +// --------------------------------------------------------- + +LOCAL_C void CreateBTNotifiersL( CArrayPtrFlat* aNotifiers ) + { + FLOG(_L("[BTNOTIF]\t CreateBTNotifiersL")); + + CBTInqNotifier* inquiryNotifier = CBTInqNotifier::NewL(); + CleanupStack::PushL( inquiryNotifier ); + aNotifiers->AppendL( inquiryNotifier ); + CleanupStack::Pop( inquiryNotifier ); + + CBTPinNotifier* pinNotifier = CBTPinNotifier::NewL(); + CleanupStack::PushL( pinNotifier ); + aNotifiers->AppendL( pinNotifier ); + CleanupStack::Pop( pinNotifier ); + + CBTAuthNotifier* authNotifier = CBTAuthNotifier::NewL(); + CleanupStack::PushL( authNotifier ); + aNotifiers->AppendL( authNotifier ); + CleanupStack::Pop( authNotifier ); + + CBTObexPinNotifier* obexNotifier = CBTObexPinNotifier::NewL(); + CleanupStack::PushL( obexNotifier ); + aNotifiers->AppendL( obexNotifier ); + CleanupStack::Pop( obexNotifier ); + + CBTPwrNotifier* pwrNotifier = CBTPwrNotifier::NewL(); + CleanupStack::PushL( pwrNotifier ); + aNotifiers->AppendL( pwrNotifier ); + CleanupStack::Pop( pwrNotifier ); + + CBTGenericInfoNotifier* infoNotifier = CBTGenericInfoNotifier::NewL(); + CleanupStack::PushL( infoNotifier ); + aNotifiers->AppendL( infoNotifier ); + CleanupStack::Pop( infoNotifier ); + + CBTGenericQueryNotifier* queryNotifier = CBTGenericQueryNotifier::NewL(); + CleanupStack::PushL( queryNotifier ); + aNotifiers->AppendL( queryNotifier ); + CleanupStack::Pop( queryNotifier ); + + CBTPBAPPinNotifier* pbapNotifier = CBTPBAPPinNotifier::NewL(); + CleanupStack::PushL( pbapNotifier ); + aNotifiers->AppendL( pbapNotifier ); + CleanupStack::Pop( pbapNotifier ); + + CBTPairedDevSettNotifier* pdsNotifier = CBTPairedDevSettNotifier::NewL(); + CleanupStack::PushL( pdsNotifier ); + aNotifiers->AppendL( pdsNotifier ); + CleanupStack::Pop( pdsNotifier ); + + CBTSSPPasskeyEntryNotifier* sspPinNotifier = CBTSSPPasskeyEntryNotifier::NewL(); + CleanupStack::PushL( sspPinNotifier ); + aNotifiers->AppendL( sspPinNotifier ); + CleanupStack::Pop( sspPinNotifier ); + + CBTNumCmpNotifier* numCmpNotifier = CBTNumCmpNotifier::NewL(); + CleanupStack::PushL(numCmpNotifier); + aNotifiers->AppendL( numCmpNotifier ); + CleanupStack::Pop( numCmpNotifier ); + + CBTUserConfNotifier* userConfNotifier = CBTUserConfNotifier::NewL(); + CleanupStack::PushL(userConfNotifier); + aNotifiers->AppendL( userConfNotifier ); + CleanupStack::Pop( userConfNotifier ); + + + CBTEnterpriseItSecurityInfoNotifier* enterpriseItSecurityNotifier = CBTEnterpriseItSecurityInfoNotifier::NewL(); + CleanupStack::PushL(enterpriseItSecurityNotifier); + aNotifiers->AppendL(enterpriseItSecurityNotifier); + CleanupStack::Pop(enterpriseItSecurityNotifier); + + FLOG(_L("[BTNOTIF]\t CreateBTNotifiersL completed")); + } + +// --------------------------------------------------------- +// +// Lib main entry point: Creates a notifiers array. +// +// --------------------------------------------------------- + +EXPORT_C CArrayPtr* NotifierArray() + { + FLOG(_L("[BTNOTIF]\t NotifierArray")); + + CArrayPtrFlat* notifiers = NULL; + + notifiers = + new CArrayPtrFlat( KBTNotifierArrayIncrement ); + if( notifiers ) + { + TRAPD( err, CreateBTNotifiersL( notifiers )); + if( err ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t Notifier creation failure! Error code: %d"), err)); + TInt count = notifiers->Count(); + while(count--) + (*notifiers)[count]->Release(); + delete notifiers; + notifiers = NULL; + } + + FLOG(_L("[BTNOTIF]\t NotifierArray completed")); + } + return notifiers; + } + + +// End of File + + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNObexPinNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNObexPinNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -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: Declares OBEX PIN query notifier class. +* +*/ + + +// INCLUDE FILES +#include // Unicode character conversion utilities + +#include // Own resources +#include "btnobexpinnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros + +#include + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTObexPinNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTObexPinNotifier* CBTObexPinNotifier::NewL() + { + CBTObexPinNotifier* self=new (ELeave) CBTObexPinNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTObexPinNotifier::CBTObexPinNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTObexPinNotifier::CBTObexPinNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTObexPinNotifier::~CBTObexPinNotifier() + { + } + +// ---------------------------------------------------------- +// CBTObexPinNotifier::RegisterL +// ---------------------------------------------------------- +// +CBTObexPinNotifier::TNotifierInfo CBTObexPinNotifier::RegisterL() + { + iInfo.iUid=KBTObexPasskeyQueryNotifierUid; + iInfo.iChannel=KBTObexPINChannel; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTObexPinNotifier::GetParamsL +// Initialize parameters. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTObexPinNotifier::GetParamsL(const TDesC8& /* aBuffer */, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::GetParamsL()")); + + if( !iMessage.IsNull()) + { + User::Leave(KErrInUse); + } + + iMessage = aMessage; + iReplySlot = aReplySlot; + + if ( AutoLockOnL() ) + { + // The phone is locked, access denied. + // + CompleteMessage(KErrCancel); + return; + } + + ShowNoteCompleteMessageL(); + + FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTObexPinNotifier::ShowNoteCompleteMessageL +// Ask user response and return it to caller. +// ---------------------------------------------------------- +// +void CBTObexPinNotifier::ShowNoteCompleteMessageL() + { + FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::ShowNoteCompleteMessageL()")); + + TBuf tempPasskeyBuffer; // Unicode buffer + + TInt keypress = iNotifUiUtil->ShowTextInputQueryL( tempPasskeyBuffer, + R_BT_OBEX_PASSKEY_QUERY, ECmdShowBtOpenCoverNote ); + + if( keypress ) // OK pressed + { + // Convert data from unicode to 8 bit and write it back to caller + // + TBTObexPasskey obexPasskey; + obexPasskey.Zero(); + CnvUtfConverter::ConvertFromUnicodeToUtf8(obexPasskey, tempPasskeyBuffer); + CompleteMessage(TPckgBuf(obexPasskey), KErrNone); + } + else // Cancel pressed + { + CompleteMessage(KErrCancel); + } + + FLOG(_L("[BTNOTIF]\t CBTObexPinNotifier::ShowNoteCompleteMessageL() completed")); + } + + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,140 @@ +/* +* 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: Declares PBAP PIN query notifier class. +* +*/ + + +// INCLUDE FILES +#include // Localisation stringloader +#include // Unicode character conversion utilities + +#include // own resources +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif + +#include "btnpbappinnotifier.h" // own class definition +#include "btNotifDebug.h" // debugging macros + +#include + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTObexPinNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTPBAPPinNotifier* CBTPBAPPinNotifier::NewL() + { + CBTPBAPPinNotifier* self=new (ELeave) CBTPBAPPinNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTObexPinNotifier::CBTObexPinNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTPBAPPinNotifier::CBTPBAPPinNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTPBAPPinNotifier::~CBTPBAPPinNotifier() + { + } + +// ---------------------------------------------------------- +// CBTPBAPPinNotifier::RegisterL +// ---------------------------------------------------------- +// +CBTPBAPPinNotifier::TNotifierInfo CBTPBAPPinNotifier::RegisterL() + { + iInfo.iUid=KPbapAuthNotifierUid; + iInfo.iChannel=KBTObexPINChannel; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTPBAPPinNotifier::GetParamsL +// Initialize parameters. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTPBAPPinNotifier::GetParamsL(const TDesC8& /* aBuffer */, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL()")); + + if( !iMessage.IsNull()) + { + User::Leave(KErrInUse); + } + + iMessage = aMessage; + iReplySlot = aReplySlot; + + if ( AutoLockOnL() ) + { + // The phone is locked, access denied. + // + CompleteMessage(KErrCancel); + return; + } + + ShowNoteCompleteMessageL(); + + FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTPBAPPinNotifier::ShowNoteCompleteMessageL +// Ask user response and return it to caller. +// ---------------------------------------------------------- +// +void CBTPBAPPinNotifier::ShowNoteCompleteMessageL() + { + FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL()")); + + TBuf pbapPasskey; // Unicode buffer + + TInt keypress = iNotifUiUtil->ShowTextInputQueryL( pbapPasskey, + R_BT_OBEX_PASSKEY_QUERY, ECmdShowBtOpenCoverNote ); + + if( keypress ) // OK pressed + { + TPbapAuthNotifierResponsePckg pbapPasskeyResponse; + pbapPasskeyResponse().SetPassword(pbapPasskey); + CompleteMessage(pbapPasskeyResponse, KErrNone); + } + else // Cancel pressed + { + CompleteMessage(KErrCancel); + } + + FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL() completed")); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNPinNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNPinNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,281 @@ +/* +* 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: Declares authentication (PIN query) notifier class. +* +*/ + + +// INCLUDE FILES +#include // Localisation stringloader +#include // Unicode character conversion utilities +#include +#include +#include +#include +#include // Own resources +#include +#include "btnotif.hrh" // Own resource header +#include "btnpinnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include "btnotifnameutils.h" + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif + +#include + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif +const TInt KDefaultPinCodeLength=4; +const TUint8 KZeroPinValue = '0'; + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTPinNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTPinNotifier* CBTPinNotifier::NewL() + { + CBTPinNotifier* self=new (ELeave) CBTPinNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------- +// CBTPinNotifier::CBTPinNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTPinNotifier::CBTPinNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTPinNotifier::~CBTPinNotifier() + { + } + +// ---------------------------------------------------------- +// CBTPinNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTPinNotifier::TNotifierInfo CBTPinNotifier::RegisterL() + { + iInfo.iUid=KBTPinCodeEntryNotifierUid; + iInfo.iChannel=KBTAuthenticationChannel; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTPinNotifier::GetParamsL +// Initialize parameters and check if device is already +// in registry. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTPinNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GetParamsL() >>")); + + CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage ); + + TBTPinCodeEntryNotifierParams param; + TPckgC pckg(param); + pckg.Set(aBuffer); + + iBTAddr = pckg().DeviceAddress(); + if ( OtherOutgoPairing(iBTAddr) ) + { + // We won't allow incoming pairing during outgoing pairing: + FLOG(_L("[BTNOTIF]\t CBTPinNotifier: outgoing pair in progress, reject incoming pair")); + CompleteMessage(KErrCancel); + return; + } + + iLocallyInitiated = pckg().LocallyInitiated(); + iPasskeyLength = pckg().PinCodeMinLength(); + iStrongPinRequired = pckg().StrongPinCodeRequired(); + ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() ); + + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GetParamsL() <<")); + } + +// ---------------------------------------------------------- +// CBTPinNotifier::HandleGetDeviceCompletedL +// Ask user response and return it to caller. +// Store device into registry if user has accepted pairing. +// ---------------------------------------------------------- +// +void CBTPinNotifier::HandleGetDeviceCompletedL(const CBTDevice* aDev) + { + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::HandleGetDeviceCompletedL() >>")); + (void) aDev; + + // Check if blocked device + if( CheckBlockedDeviceL() ) + return; + + // Turn lights on and deactivate apps -key + iNotifUiUtil->TurnLightsOn(); + + if( CheckAndSetAutomatedPairing() ) + { + CompleteMessage(iPinCode, KErrNone); + return; + } + + // For incoming pairing request + if(!iLocallyInitiated) + { + TBool userAnswer = AuthoriseIncomingPairingL(); + if( !userAnswer ) + { + //User rejects the incoming pairing, complete message in QueryBlockDevice. + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::HandleGetDeviceCompletedL() <<")); + return; + } + } + + // Use a forever loop here to show query dialog again of ínput pin code does't fulfill the + // minimum length requirement + // + FOREVER + { + TBuf tempResultBuffer; + RBuf prompt; + prompt.CleanupClosePushL(); + GenerateQueryPromptL( prompt ); + TInt keypress = iNotifUiUtil->ShowTextInputQueryL(tempResultBuffer, prompt, R_BT_ENTER_PASSKEY_QUERY, + ECmdShowBtOpenCoverNote, CAknQueryDialog::EConfirmationTone ); + CleanupStack::PopAndDestroy( &prompt ); + + if( keypress ) // OK pressed + { + // Convert data from buf to pin + TBuf8 buf8; + buf8.Zero(); + CnvUtfConverter::ConvertFromUnicodeToUtf8(buf8, tempResultBuffer); + + //check if the length of pin less that minimum required pin code length + if ((iPasskeyLength == 0) || ( buf8.Length() >= iPasskeyLength)) + { + iPinCode().iLength = STATIC_CAST(TUint8, buf8.Length()); + for (TInt index=0; index do automated pairing with 0000. + if ( iDevice && + OutgoPairingMode( iBTAddr ) == EBTOutgoingHeadsetAutoPairing && + iPasskeyLength <= KDefaultPinCodeLength ) + { + FLOG( _L( "[BTNOTIF]\t CBTPinNotifier::CheckAndSetAutomatedPairing - automated pairing on" ) ); + FLOG(_L("[BTNOTIF]\t Setting default PIN code")); + iPinCode().iLength = KDefaultPinCodeLength; + for( TInt i=0; i < KDefaultPinCodeLength; ++i) + { + iPinCode().iPIN[i] = KZeroPinValue; + } + ret = ETrue; + } + return ret; + } + +// ---------------------------------------------------------- +// CBTPinNotifier::GenerateQueryPromptL +// ---------------------------------------------------------- +void CBTPinNotifier::GenerateQueryPromptL( RBuf& aRBuf ) + { + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromptLC() >>")); + TBTDeviceName devName; + BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); + if (iPasskeyLength > 0) //Minimum length passkey is defined + { + BluetoothUiUtil::LoadResourceAndSubstringL( + aRBuf, R_BT_MIN_PASSKEY_PROMPT, devName, 1 ); + + RBuf tmpBuf; + tmpBuf.CleanupClosePushL(); + tmpBuf.Swap( aRBuf ); + aRBuf.ReAllocL( aRBuf.MaxLength() + sizeof(TUint)); + aRBuf.Zero(); + // Passkey length should be localized, hope StringLoader can make it: + StringLoader::Format( aRBuf, tmpBuf, 0, iPasskeyLength ); + CleanupStack::PopAndDestroy( &tmpBuf ); + } + else + { + BluetoothUiUtil::LoadResourceAndSubstringL( + aRBuf, R_BT_PASSKEY_PROMPT, devName, 0 ); + } + FLOG(_L("[BTNOTIF]\t CBTPinNotifier::GenerateQueryPromptLC() <<")); + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNPwrNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNPwrNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,120 @@ +/* +* 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: Declares power mode setting notifier class. +* +*/ + + +// INCLUDE FILES +#include // Own resources +#include "btnpwrnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTPwrNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTPwrNotifier* CBTPwrNotifier::NewL() + { + CBTPwrNotifier* self=new (ELeave) CBTPwrNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTPwrNotifier::CBTPwrNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTPwrNotifier::CBTPwrNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTPwrNotifier::~CBTPwrNotifier() + { + } + +// ---------------------------------------------------------- +// CBTPwrNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTPwrNotifier::TNotifierInfo CBTPwrNotifier::RegisterL() + { + iInfo.iUid=KPowerModeSettingNotifierUid; + iInfo.iChannel=KBTPowerModeChannel; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTPwrNotifier::GetParamsL +// Initialize parameters. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTPwrNotifier::GetParamsL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL()")); + + if( iReplySlot!=NULL || !iMessage.IsNull() ) + User::Leave(KErrInUse); + + iMessage = aMessage; + iReplySlot = aReplySlot; + + ShowNoteAndCompleteMessageL(); + FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTPwrNotifier::RunL +// Ask user response and return it to caller. +// ---------------------------------------------------------- +// +void CBTPwrNotifier::ShowNoteAndCompleteMessageL() + { + FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ShowNoteAndCompleteMessageL()")); + + if ( !CheckAndSetPowerOnL() ) + { + CompleteMessage(KErrGeneral); + return; + } + // TODO: Why do we show BT BUSY note from BT power notifier? + //get connection amount + TInt linkCount = 0; + RProperty::Get(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetPHYCount, linkCount); + + if (linkCount > 6) //support only piconet + { + iNotifUiUtil->ShowInfoNoteL( R_BT_BUSY_NOTE, ECmdShowBtBusyNote ); + } + CompleteMessage(ETrue, KErrNone ); + FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ShowNoteAndCompleteMessageL() completed")); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/BTNotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/BTNotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,772 @@ +/* +* 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: Declares Bluetooth notifiers base class. +* +*/ + + +// INCLUDE FILES +#include +#include + +#include +#include + +#include +#include +#include +#include +#include // Localisation stringloader +#include // Own resources +#include // Feature Manager API +#include // CnvUtfConverter +#include +#include "btnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include "btnotiflock.h" +#include "btnotif.hrh" // define MaxNameLength +#include "btnotifpanic.h" +#include "btnotifnameutils.h" + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + +// CONSTANTS +const TInt KBTNAutolockEnabled = 1; + +// The following definitions are used to implement checking of connection/pairing +// request frequency + +// if a new connection is made quicker than CONNECT_ADD_TIME after the old one, +// then the saved time is added with CONNECT_ADD_TIME. +#define CONNECT_ADD_TIME TTimeIntervalSeconds(10) + +// if the saved time is later than now+DENY_THRESHOLD, start rejecting incoming connections +// from unpaired devices. +#define DENY_THRESHOLD TTimeIntervalSeconds(30) + +// if the user denies incoming connection the saved time goes this much in the future. +#define REJECT_ADD_TIME TTimeIntervalSeconds(31) + + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTNotifierBase::CBTNotifierBase +// C++ default constructor can NOT contain any code, that +// might leave. Sets the AOs priority and puts +// itself to the active scheduler stack. +// ---------------------------------------------------------- +// +CBTNotifierBase::CBTNotifierBase() + { + } + +// ---------------------------------------------------------- +// CBTNotifierBase::ConstructL +// Symbian 2nd phase constructor can leave. +// Create registry object and open resource file. +// ---------------------------------------------------------- +// +void CBTNotifierBase::ConstructL() + { + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + iIsCoverUI = ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) + ? ETrue : EFalse; + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + + iBTEngSettings = CBTEngSettings::NewL(); + iDevMan = CBTEngDevMan::NewL( this ); + iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); + } + +// ---------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------- +// +CBTNotifierBase::~CBTNotifierBase() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase()")); + Cancel(); + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::~CBTNotifierBase() -- Done")); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::Release +// Release itself. Call to destructor. +// ---------------------------------------------------------- +// +void CBTNotifierBase::Release() + { + delete this; + } + + +// ---------------------------------------------------------- +// CBTNotifierBase::Info +// Return registered information. +// ---------------------------------------------------------- +// +CBTNotifierBase::TNotifierInfo CBTNotifierBase::Info() const + { + return iInfo; + } + +// ---------------------------------------------------------- +// CBTNotifierBase::StartL +// Synchronic notifier launch. Does nothing here. +// ---------------------------------------------------------- +// +TPtrC8 CBTNotifierBase::StartL(const TDesC8& /*aBuffer*/) + { + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::StartL +// Asynchronic notifier launch. +// ---------------------------------------------------------- +// +void CBTNotifierBase::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + if( !iNotifUiUtil ) + { + iNotifUiUtil = CBTNotifUIUtil::NewL( iIsCoverUI ); + } + + TRAPD(err, GetParamsL(aBuffer, aReplySlot, aMessage)); + if (err) + { + CompleteMessage(err); + } + } + +// ---------------------------------------------------------- +// CBTNotifierBase::Cancel +// Cancelling method. +// ---------------------------------------------------------- +// +void CBTNotifierBase::Cancel() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::Cancel()")); + + delete iNotifUiUtil; + iNotifUiUtil = NULL; + + delete iBTEngSettings; + iBTEngSettings = NULL; + + delete iDevMan; + iDevMan = NULL; + + delete iDevice; + iDevice = NULL; + + if (iDeviceArray) + { + iDeviceArray->ResetAndDestroy(); + delete iDeviceArray; + iDeviceArray = NULL; + } + + CompleteMessage(KErrCancel); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::UpdateL +// Notifier update. Not supported. +// ---------------------------------------------------------- +// +TPtrC8 CBTNotifierBase::UpdateL(const TDesC8& /*aBuffer*/) + { + TPtrC8 ret(KNullDesC8); + return (ret); + } + + +// ---------------------------------------------------------- +// CBTNotifierBase::AutoLockOnL +// ---------------------------------------------------------- +// +TBool CBTNotifierBase::AutoLockOnL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::AutoLockOnL()")); + + TBool result = EFalse; + TInt status = KBTNAutolockEnabled; + + // Connecting and initialization: + CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); + + repository->Get(KSettingsAutolockStatus, status); + + // Closing connection: + delete repository; + + if ( status == KBTNAutolockEnabled ) + { + result = ETrue; + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::AutoLockOnL() completed with %d"), result )); + + return result; + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CheckAndSetPowerOnL +// The note or query to be shown depends on two SharedData flags +// ---------------------------------------------------------- +// +TBool CBTNotifierBase::CheckAndSetPowerOnL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::CheckAndSetPowerOnL()")); + + TBTPowerStateValue powerState( EBTPowerOff ); + // Get current power status + // + User::LeaveIfError( iBTEngSettings->GetPowerState( powerState ) ); + + // If power is off, turn it on + // + if ( powerState == EBTPowerOff ) + { + TInt offlineModeOff( 1 ); // possible values are 0 and 1 + TInt activationEnabled( 0 ); // possible values are 0 and 1 + + // Offline mode on? + CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs); + repository->Get(KCoreAppUIsNetworkConnectionAllowed, offlineModeOff); + delete repository; + + // BT Activation enabled? + repository = CRepository::NewL(KCRUidBluetoothEngine); + repository->Get(KBTEnabledInOffline, activationEnabled); + delete repository; + + // Choose user interaction + // + if ( !offlineModeOff && !activationEnabled ) + { + // Show user that feature is disabled: + iNotifUiUtil->ShowInfoNoteL( R_BT_OFFLINE_DISABLED, ECmdShowBtOfflineDisableNote ); + return EFalse; // Bluetooth can't be set on. + } + else + { + // Choose query + // + TInt keypress( 0 ); + if ( offlineModeOff ) + { + keypress = iNotifUiUtil->ShowQueryL( KErrNone, R_BT_POWER_IS_OFF_QUERY, ECmdShowBtIsOffDlg ); + } + else + { + keypress = iNotifUiUtil->ShowQueryL( KErrNone, R_BT_ACTIVATE_IN_OFFLINE_QUERY, + ECmdShowBtActivateInOfflineDlg ); + } + + if( keypress ) // User answered YES + { + //Check if the local name has been set. If not ask user to set name + + TBool ok = IsLocalNameModifiedL(); + if( !ok ) + { + ok = AskLocalBTNameQueryL(); + } + if ( ok ) + { + ok = ( iBTEngSettings->SetPowerState( EBTPowerOn ) ) ? EFalse : ETrue; + } + return ok; + } + else // User has cancelled the dialog + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::CheckAndSetPowerOnL(), dialog canceled")); + return EFalse; + } + } + } + return ETrue; + } + +// ---------------------------------------------------------- +// CBTNotifierBase::AskLocalBTNameQueryL() +// ---------------------------------------------------------- +// +TBool CBTNotifierBase::AskLocalBTNameQueryL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::AskLocalBTNameQueryL() >>")); + + TBTDeviceName tempNameBuffer; + // Cut the excess part of the name away. The query can handle only + // KBTUIMaxNameLength characters. + // + if( tempNameBuffer.Length() > KBTUIMaxNameLength ) + { + tempNameBuffer.SetLength( KBTUIMaxNameLength ); + } + + //Get default name if given by e.g. phone product + (void) RProperty::Get( KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetDeviceName, tempNameBuffer ); + + if( !tempNameBuffer.Length() ) + { + (void) RProperty::Get( KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetDeviceName, tempNameBuffer ); + } + + if( !tempNameBuffer.Length() ) + { + RBTRegServ btRegServ; + RBTLocalDevice btReg; + TBTLocalDevice localDev; + + TInt err = btRegServ.Connect(); + if( !err ) + { + err = btReg.Open( btRegServ ); + } + if( !err ) + { + // Read the BT local name from BT Registry. + err = btReg.Get( localDev ); + } + if( !err ) + { + // The error can be > 0 if there are unconverted characters. + err = CnvUtfConverter::ConvertToUnicodeFromUtf8( tempNameBuffer, localDev.DeviceName() ); + } + btReg.Close(); + btRegServ.Close(); + } + + TInt keypress = iNotifUiUtil->ShowTextInputQueryL( tempNameBuffer, + R_BT_ENTER_LOCAL_NAME_QUERY, ECmdBTnotifUnavailable ); + + if( keypress ) // User has accepted the dialog + { + AknTextUtils::StripCharacters(tempNameBuffer, KAknStripListControlChars); + tempNameBuffer.TrimAll(); // Remove extra spaces + // If name was full of invalid chars, it becomes empty after above cleanup. + if( tempNameBuffer.Length() ) + { + TInt err = iBTEngSettings->SetLocalName( tempNameBuffer ); + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::AskLocalBTNameQueryL() <<")); + return (err) ? EFalse : ETrue; + } + else + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::AskLocalBTNameQueryL() << failed")); + return EFalse; + } + } + else + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::AskLocalBTNameQueryL() << cancelled")); + return EFalse; + } + } + +// --------------------------------------------------------------------------------- +// CBTNotifierBase::IsExistingConnectionToAudioL +// Check if there is any existing connection to audio profiles from the same device +// --------------------------------------------------------------------------------- +TBool CBTNotifierBase::IsExistingConnectionToAudioL( const TBTDevAddr& aDevAddr ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::IsExistingConnectionToAudioL()")); + CBTEngConnMan* connMan = CBTEngConnMan::NewL(); + TBTEngConnectionStatus conntatus( EBTEngNotConnected ); + (void) connMan->IsConnected(aDevAddr,conntatus); + delete connMan; + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::IsExistingConnectionToAudioL() complete")); + return ( conntatus==EBTEngConnected || conntatus==EBTEngConnecting ); + } + +// --------------------------------------------------------------------------- +// CBTNotifierBase::IsLocalNameModified +// Checks from central repository whether the Bluetooth friendly name +// has been modified . +// --------------------------------------------------------------------------- +// +TBool CBTNotifierBase::IsLocalNameModifiedL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::IsLocalNameModified()")); + CRepository* cenRep = CRepository::NewL( KCRUidBTEngPrivateSettings ); + TInt val( EBTLocalNameDefault ); + (void) cenRep->Get( KBTLocalNameChanged, val ); + delete cenRep; + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::IsLocalNameModified() complete")); + return val == EBTLocalNameSet; + } + + +void CBTNotifierBase::GetDeviceFromRegL(const TBTDevAddr& aAddr) + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::GetDeviceFromRegL")); + __ASSERT_DEBUG(iDevice, BTNOTIF_PANIC(EiDeviceNullWhenCallingGetDeviceFromRegL)); + + TBTRegistrySearch mySearch; + mySearch.FindAddress( aAddr ); + iDeviceArray = new (ELeave) CBTDeviceArray(1); + if( !iDevMan ) + { + iDevMan = CBTEngDevMan::NewL( this ); + } + TInt err = iDevMan->GetDevices( mySearch, iDeviceArray ); + if(err) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::GetDeviceFromRegL iDevMan->GetDevices error = %d"), err)); + DoHandleGetDevicesCompleteL(err, NULL); + } + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::GetDeviceFromRegL done")); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::QueryBlockDeviceL +// Opens a query that returns wether or not user wants the device blocked +// ---------------------------------------------------------- +void CBTNotifierBase::QueryBlockDeviceL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::QueryBlockDeviceL()")); + __ASSERT_DEBUG( iNotifUiUtil->IsQueryReleased(), User::Panic( _L("CBTNotifierBase - iYesNoDlg not released!"), KErrAlreadyExists ) ); + + TBTDeviceName bName; + BtNotifNameUtils::GetDeviceDisplayName(bName, iDevice); + + HBufC* header= StringLoader::LoadLC( R_BT_BLOCK_DEVICE_HEADER ); + + TInt resId = IsUserAwarePaired( iDevice->AsNamelessDevice() ) ? + R_BT_BLOCK_PAIRED_DEVICE_NOHELP : R_BT_BLOCK_DEVICE_NOHELP; + + RBuf stringholder; + stringholder.CleanupClosePushL(); + BluetoothUiUtil::LoadResourceAndSubstringL( stringholder, resId, bName, 0 ); + + TInt keypress = iNotifUiUtil->ShowMessageQueryL( stringholder, *header, + R_BT_GENERIC_MESSAGE_QUERY, CAknQueryDialog::EConfirmationTone ); + + CleanupStack::PopAndDestroy(&stringholder); + CleanupStack::PopAndDestroy(header); + + if( keypress )// user replied "Yes" + { + DoBlockDevice(); + } + else // user replied "No" + { + CompleteMessage(KErrCancel); + } + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::QueryBlockDeviceL() complete")); + } + +void CBTNotifierBase::DoBlockDevice() + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::DoBlockDevice()")); + TBTDeviceSecurity deviceSecurity = iDevice->GlobalSecurity(); + deviceSecurity.SetBanned(ETrue); + deviceSecurity.SetNoAuthenticate(EFalse); + deviceSecurity.SetNoAuthorise(EFalse); + iDevice->SetGlobalSecurity(deviceSecurity); + iDevice->DeleteLinkKey(); + + iBTRegistryQueryState = ESetDeviceBlocked; + TInt err = KErrNone; + if( !iDevMan ) + { + TRAP(err, iDevMan = CBTEngDevMan::NewL( this )); + } + if( !err ) + { + err = iDevMan->ModifyDevice( *iDevice ); + } + if( err ) + { + // if error, complete message, otherwise waiting for devman callback + CompleteMessage(err); + } + } + +void CBTNotifierBase::ChangeAuthorizeState( TBool aTrust ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::ChangeAuthorizeState()")); + TBTDeviceSecurity sec = iDevice->GlobalSecurity(); + sec.SetBanned(EFalse); + sec.SetNoAuthorise( ( aTrust ) ? ETrue : EFalse ) ; + iDevice->SetGlobalSecurity(sec); + + iBTRegistryQueryState = ESetDeviceAuthorizeState; + TInt err = KErrNone; + if( !iDevMan ) + { + TRAP(err, iDevMan = CBTEngDevMan::NewL( this )); + } + if( !err ) + { + err = iDevMan->ModifyDevice( *iDevice ); + } + if( err ) + { + // if error, complete message, otherwise waiting for devman callback + CompleteMessage(err); + TBTNotifLockPublish::DeleteNotifLocks( + EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() ); + } + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CheckAndHandleQueryIntervalL +// ---------------------------------------------------------- +// +void CBTNotifierBase::CheckAndHandleQueryIntervalL() + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval start." ) ); + TBool res = CheckQueryInterval(); + if( res ) + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval check on/off query status." ) ); + // Check if we're already showing Turn BT off query + TInt queryValue=EBTQueryOff; + RProperty::Get( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn, queryValue ); + if( queryValue==EBTQueryOff ) + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval asking to turn BT off." ) ); + RProperty::Set( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn, EBTQueryOn ); + TInt keypress = iNotifUiUtil->ShowQueryL( KErrNone, R_BT_TURN_BT_OFF_NOTE, ECmdBTnotifUnavailable ); + RProperty::Set( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn, EBTQueryOff ); + if( keypress ) // User has accepted the dialog + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval turning BT off." ) ); + (void) iBTEngSettings->SetPowerState( EBTPowerOff ); + CompleteMessage( KErrAccessDenied ); + } + } + } + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckAndHandleQueryIntervalL done." ) ); + } + +void CBTNotifierBase::DoHandleGetDevicesCompleteL( TInt aErr, CBTDeviceArray* aDeviceArray) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::DoHandleGetDevicesCompleteL(%d)"), aErr )); + TBTDeviceName devName; + if (!aErr && aDeviceArray && aDeviceArray->Count()) + { + // Reassign so that we won't lose the device name as it is + // needed if registry doesn't have the name for this device yet: + CBTDevice* temp = iDevice; + CleanupStack::PushL(temp); + // Taking the object returned by registry so that iDevice have + // all the up-to-date information except device name. + iDevice = aDeviceArray->At(0); + aDeviceArray->Delete( 0 ); + // we show user the device name from registry if it is available; + // Otherwise, the name passed in by the notifier request shall be + // used. + if( ( !iDevice->IsValidDeviceName() || + !iDevice->DeviceName().Length() ) && + temp->IsValidDeviceName() ) + { + // We are using a stored device name, which will + // already have been processed + iDevice->SetDeviceNameL( temp->DeviceName() ); + } + CleanupStack::PopAndDestroy(temp); + } + BtNotifNameUtils::GetDeviceName(devName, iDevice); + + // It is possible that iDevice hasn't got a name so far. Use the default BT name + // got from GetDeviceName(). + if ( !iDevice->IsValidDeviceName() || !iDevice->DeviceName().Length() ) + { + BtNotifNameUtils::SetDeviceNameL(devName, *iDevice); + } + HandleGetDeviceCompletedL( iDevice ); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CompleteMessage +// ---------------------------------------------------------- +// +void CBTNotifierBase::CompleteMessage(TInt aErr) + { + if( !iMessage.IsNull() ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::CompleteMessage(%d)"), aErr )); + iMessage.Complete( aErr ); + } + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CompleteMessage +// ---------------------------------------------------------- +// +void CBTNotifierBase::CompleteMessage(TInt aValueToReplySlot, TInt aErr) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::CompleteMessage(%d, %d)"), + aValueToReplySlot, aErr ) ); + CompleteMessage(TPckgBuf( aValueToReplySlot ), aErr); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CompleteMessage +// ---------------------------------------------------------- +// +void CBTNotifierBase::CompleteMessage(const TDesC8& aDesToReplySlot, TInt aErr) + { + if( !iMessage.IsNull() ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::CompleteMessage(TDesC8&, %d)"), aErr ) ); + if ( !aErr ) + { + aErr = iMessage.Write( iReplySlot, aDesToReplySlot ); + } + iMessage.Complete( aErr ); + } + } + +#ifdef __SERIES60_HELP +//------------------------------------------------------------- +// CBTNotifierBase::LaunchHelp +//-------------------------------------------------------------- +TInt CBTNotifierBase::LaunchHelp(TAny * tCoeHelpContext ) + { + TCoeHelpContext hc; + + if( tCoeHelpContext==NULL) + hc = TCoeHelpContext(KUidBTUI,KBT_HLP_BLOCKED); + else + hc = *static_cast(tCoeHelpContext); + + CArrayFix< TCoeHelpContext >* array = new CArrayFixFlat< TCoeHelpContext >(1); + TRAPD(err, + { + CleanupStack::PushL(array); + array->AppendL(hc); + HlpLauncher::LaunchHelpApplicationL( CCoeEnv::Static()->WsSession() , array ); + CleanupStack::Pop(array); + }); + + // the array is not deleted, since deleting it will result + // to E32User-CBase 3. It is assumed that HlpLancher is taking care of it. + // however this has not been documented. + return err; + } +#endif + +void CBTNotifierBase::HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray) + { + TRAP_IGNORE(DoHandleGetDevicesCompleteL(aErr, aDeviceArray)); + } + +void CBTNotifierBase::HandleDevManComplete(TInt aErr) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::HandleDevManComplete() aErr = %d"), aErr )); + + switch (iBTRegistryQueryState) + { + case ESetDeviceBlocked: + { + // Blocking device was demanded by user after the user + // rejected incoming pairing or connect request. The message + // to be completed here is the original pair or authorization request + // which has been rejected by the user. + CompleteMessage(KErrCancel); + } + case ESetDeviceAuthorizeState: + { + TBTNotifLockPublish::DeleteNotifLocks( + EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() ); + CompleteMessage(aErr); + break; + } + } + FLOG(_L("[BTNOTIF]\t CBTNotifierBase::HandleDevManComplete() Complete")); + } + +void CBTNotifierBase::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + } + +// ---------------------------------------------------------- +// CBTNotifierBase::CheckQueryInterval +// ---------------------------------------------------------- +// +TBool CBTNotifierBase::CheckQueryInterval() + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval()" ) ); + TBool result = EFalse; + // Check if the user gets too many queries within a certain time interval from unpaired devices + if( iDevice && !iDevice->IsValidLinkKey() ) + { + TBuf8<32> buf; + TTime now; + now.UniversalTime(); // Get current time + TInt64 writeTime = ( now + REJECT_ADD_TIME ).Int64(); + + // get last connection time + TInt err = RProperty::Get( KPSUidBluetoothEnginePrivateCategory, KBTConnectionTimeStamp, buf ); + if( !err ) + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval Checking query interval." ) ); + // Parse recorded time stamp + TInt64 num(0); + TLex8 lex; + lex = buf; + lex.Val( num ); + TTime lastTime( num ); + + // detection of clock adjusment + TInt timetravel = 2 * REJECT_ADD_TIME.Int(); + if( lastTime > now + TTimeIntervalSeconds(timetravel) ) + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval time travel detection." ) ); + lastTime = now; + } + // new request too quickly, move booked time + if( lastTime + CONNECT_ADD_TIME > now ) + { + FLOG( _L( "[BTNOTIF]\t CBTAuthNotifier::IsDosAttack CONNECT_ADD_TIME added." ) ); + writeTime = ( lastTime + CONNECT_ADD_TIME ).Int64(); + } + + FTRACE( FPrint( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval() lastTime = %d" ), lastTime.Int64() ) ); + FTRACE( FPrint( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval now + treshold: %d" ), (now + DENY_THRESHOLD).Int64() ) ); + // If threshold is exceeded, ask user to turn Bluetooth OFF + if( lastTime > now + DENY_THRESHOLD ) + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval threshold exceeded!." ) ); + result = ETrue; + } + } + else + { + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval setting connection timestamp first time." ) ); + } + // Write back the timestamp + buf.Num( writeTime ); + FTRACE( FPrint( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval updating timestamp: %d." ), writeTime ) ); + RProperty::Set( KPSUidBluetoothEnginePrivateCategory,KBTConnectionTimeStamp, buf ); + } // end of query interval check + FLOG( _L( "[BTNOTIF]\t CBTNotifierBase::CheckQueryInterval() complete" ) ); + return result; + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnenterpriseitsecurityinfonotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnenterpriseitsecurityinfonotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,172 @@ +/* +* 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 visibility timeout notifier class. +* +*/ + +// INCLUDE FILES +#include // Own resources +#include "btnenterpriseitsecurityinfonotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include +#include + +_LIT(KDcmoResourceFileName, "z:dcmo.rsc"); +_LIT(KNewLine, "\n"); + +//"Bluetooth" is 9 characters long +const TInt KDefaultBluetoothStringLength = 9; + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTEnterpriseItSecurityInfoNotifier* CBTEnterpriseItSecurityInfoNotifier::NewL() + { + CBTEnterpriseItSecurityInfoNotifier* self=new (ELeave) CBTEnterpriseItSecurityInfoNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::CBTEnterpriseItSecurityInfoNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTEnterpriseItSecurityInfoNotifier::CBTEnterpriseItSecurityInfoNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTEnterpriseItSecurityInfoNotifier::~CBTEnterpriseItSecurityInfoNotifier() + { + Cancel(); + } + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTEnterpriseItSecurityInfoNotifier::TNotifierInfo CBTEnterpriseItSecurityInfoNotifier::RegisterL() + { + iInfo.iUid = KBTEnterpriseItSecurityInfoNotifierUid; + iInfo.iChannel = KBTEnterpriseItSecurityInfoNotifierUid; + iInfo.iPriority = ENotifierPriorityHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::StartL +// Synchronic notifier launch. Contructs and shows a global +// note when temp visibility expire, no parameters need here. +// ---------------------------------------------------------- +// +TPtrC8 CBTEnterpriseItSecurityInfoNotifier::StartL(const TDesC8& /*aBuffer*/) + { + FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::StartL()")); + + ShowNoteAndCompleteL(); + + FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::StartL() completed")); + return TPtrC8(KNullDesC8); + } + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::GetParamsL +// Mandatory for BT Notifiers when using asynchronous launch. +// ---------------------------------------------------------- +// +void CBTEnterpriseItSecurityInfoNotifier::GetParamsL(const TDesC8& /*aBuffer*/, + TInt /*aReplySlot*/, + const RMessagePtr2& /*aMessage*/) + { + //nothing to do here + } + +// ---------------------------------------------------------- +// CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL +// Shows the notifier in backround +// ---------------------------------------------------------- +// +void CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndCompleteL() + { + FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete()")); + + //get full path to the DCMO resource file + TParse* parser = new (ELeave) TParse; + parser->Set(KDcmoResourceFileName(), &KDC_RESOURCE_FILES_DIR, NULL); + CleanupStack::PushL(parser); + TFileName* fileName = new (ELeave) TFileName; + *fileName = parser->FullName(); + CleanupStack::PopAndDestroy(parser); + CleanupStack::PushL(fileName); + + //create the resource reader object that we need to use several times + CTulStringResourceReader* reader = CTulStringResourceReader::NewL(*fileName); + CleanupStack::PushL(reader); + + //get pointer to the message part of the notifier + TPtrC resourceString; + resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_DISABLE)); + + //create descriptor with a max length to fit the localised "disabled" text + new line + "Bluetooth" + RBuf content; + content.CreateL(resourceString.Length() + KNewLine().Length() + KDefaultBluetoothStringLength); + CleanupClosePushL(content); + + //add resource string and new line character to the content descriptor + content.Append(resourceString); + content.Append(KNewLine()); + + //get pointer to the Bluetooth name part of the notifier (can't assume this is actually "Bluetooth" in all languages) + resourceString.Set(reader->ReadResourceString(R_DM_RUN_TIME_VAR_BLUETOOTH)); + + //check that the resource string will fit into the content descriptor + TInt requiredLength = content.Length() + resourceString.Length(); + if (requiredLength > content.MaxLength()) + { + //allocate more space in the content descriptor + content.ReAllocL(requiredLength); + } + + //add resource string to the content descriptor + content.Append(resourceString); + + //display the notifier and complete + iNotifUiUtil->ShowInfoNoteL(content, ECmdBTnotifUnavailable); + CompleteMessage(KErrNone); + + //pop and destroy the content descriptor, resource reader and file name + CleanupStack::PopAndDestroy(3, fileName); + + FLOG(_L("[BTNOTIF]\t CBTEnterpriseItSecurityInfoNotifier::ShowNoteAndComplete() complete")); + } + +void CBTEnterpriseItSecurityInfoNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + //nothing to do here + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnotifactive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnotifactive.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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: Active object helper class. +* +*/ + +#include "btnotifactive.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTNotifActive::CBTNotifActive( MBTNotifActiveObserver* aObserver, + TInt aId, TInt aPriority ) +: CActive( aPriority ), iRequestId( aId ), iObserver( aObserver ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTNotifActive::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTNotifActive* CBTNotifActive::NewL( MBTNotifActiveObserver* aObserver, + TInt aId, TInt aPriority ) + { + CBTNotifActive* self = new (ELeave) CBTNotifActive( aObserver, aId, aPriority ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTNotifActive::~CBTNotifActive() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been cancelled. +// --------------------------------------------------------------------------- +// +void CBTNotifActive::DoCancel() + { + iObserver->DoCancelRequest( this, iRequestId ); + } + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been completed. +// --------------------------------------------------------------------------- +// +void CBTNotifActive::RunL() + { + iObserver->RequestCompletedL( this, iRequestId, iStatus.Int() ); + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when an error in RunL has occurred. +// --------------------------------------------------------------------------- +// +TInt CBTNotifActive::RunError( TInt aError ) + { + iObserver->HandleError( this, iRequestId, aError ); + return KErrNone; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnotifnameutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnotifnameutils.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,106 @@ +/* + * 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: Declares Bluetooth notifiers base class. + * + */ + +#include +#include +#include + +#include + +#include "btNotifDebug.h" +#include "btnotifnameutils.h" + +/** + * A function for strip dangerous chars out of BT name + * @param a device name. After return, it contains the stripped name. + * @return void + */ +void BtNotifNameUtils::StripDeviceName(TBTDeviceName& aDeviceNameForStrip) + { + aDeviceNameForStrip.Trim(); + // Filter out listbox non-friendly control chars. + // + AknTextUtils::StripCharacters(aDeviceNameForStrip, KAknStripListControlChars); + + // Filter out sub-string-separator to pretend unexpected text layout. + // + TChar subStringSeparator = TChar(0x0001); + TBuf<1> tempCharBuf; + tempCharBuf.Append(subStringSeparator); + AknTextUtils::StripCharacters(aDeviceNameForStrip, tempCharBuf); + } + +/** + * Gets the device name to be displayed in note or dialog. + * @param aName contains the name to be displayed + * @param aDev the device that may have a friendly or device name, or no name at all. + */ +void BtNotifNameUtils::GetDeviceDisplayName(TBTDeviceName& aName, const CBTDevice* aDev) + { + if(aDev && aDev->IsValidFriendlyName() ) + { + aName.Copy( aDev->FriendlyName() ); + } + else + { + GetDeviceName(aName, aDev); + } + } + +/** + * Gets the device name from aDev if its friendly name or device name is valid; otherwise + * the predefined default BT name. + * @param aName contains the device name as the result + * @param aDev the device that may have a device name, or no name at all. + */ +void BtNotifNameUtils::GetDeviceName(TBTDeviceName& aName, const CBTDevice* aDev) + { + aName.Zero(); + TInt err (CnvUtfConverter::EErrorIllFormedInput); + if(aDev && aDev->IsValidDeviceName()) + { + err = CnvUtfConverter::ConvertToUnicodeFromUtf8(aName, aDev->DeviceName()); + } + // if there are illformated chars in the device name, default name should be used for display. + if (err == CnvUtfConverter::EErrorIllFormedInput || aName.Length() == 0) + { + StringLoader::Load(aName, R_BT_DIALOG_DEF_NAME); + } + StripDeviceName(aName); + } + +/** + * Sets the device name. This handles the conversion from unicode + * to UTF8. + * @param aDev the device that the name should be set for + * @param aName the name to set + */ +void BtNotifNameUtils::SetDeviceNameL(const TBTDeviceName& aName, CBTDevice& aDev) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifierBase::SetDeviceNameL - Name: '%S' length: %d"), &aName, aName.Length() )); + + // Rationalise the name to remove whitespace and control characters + // then set the name if there's anything left + TBTDeviceName devName(aName); + StripDeviceName(devName); + if (aName.Length()) + { + aDev.SetDeviceNameL(BTDeviceNameConverter::ToUTF8L(devName)); + } + } + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnotifuiutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnotifuiutil.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,412 @@ +/* +* 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: Declares Utility to show UI notes and queries. +* +*/ + +#include // BAFL utils (for language file) +#include "btnotifuiutil.h" +#include "btNotifDebug.h" // Debugging macros +#include // Localisation stringloader +#include // Information note +#include // for the blocking query +#include // CoverUI +#include // Backlight control +#include // Application Key enable/disable + +CBTNotifUIUtil* CBTNotifUIUtil::NewL( TBool aCoverDisplayEnabled ) + { + CBTNotifUIUtil* self = new (ELeave) CBTNotifUIUtil( aCoverDisplayEnabled ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CBTNotifUIUtil::CBTNotifUIUtil( TBool aCoverDisplayEnabled ) : + iCoverDisplayEnabled( aCoverDisplayEnabled ), + iSystemCancel( EFalse ), + iAppKeyBlocked( EFalse ) + { + } + +void CBTNotifUIUtil::ConstructL() + { + iEikEnv = CEikonEnv::Static(); + + TFileName filename; + filename += KFileDrive; + filename += KDC_RESOURCE_FILES_DIR; + filename += KResourceFileName; + BaflUtils::NearestLanguageFile(iEikEnv->FsSession(),filename); + iResourceFileFlag=iEikEnv->AddResourceFileL(filename); + } + +CBTNotifUIUtil::~CBTNotifUIUtil() + { + iSystemCancel = ETrue; + delete iQueryDlg; + delete iWaitDlg; + // Activate apps key again before exit, in case any interruption happens before activation + if( iAppKeyBlocked ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil destructor Activate apps key before exiting. ")); + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); + } + iEikEnv->DeleteResourceFile(iResourceFileFlag); + } +// ---------------------------------------------------------- +// CBTNotifierBase::TurnLightsOn +// ---------------------------------------------------------- +// +void CBTNotifUIUtil::TurnLightsOn() + { + // Change the bit on and off. SysAp will detect that + // the lights should be switched on for the specified time. + // + TInt err = KErrNone; + + err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn); + err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff); + + if ( err != KErrNone ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifUIUtil::TurnLightsOn() RProperty::Set return error %d"), err )); + } + + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::TurnLightsOn() <<")); + } + +// ---------------------------------------------------------- +// CBTNotifierBase::LocalEikonEnv +// ---------------------------------------------------------- +// +CEikonEnv& CBTNotifUIUtil::LocalEikonEnv() + { + return *iEikEnv; + } + +// ---------------------------------------------------------- +// CBTNotifierBase::ShowQueryL +// ---------------------------------------------------------- +// +TInt CBTNotifUIUtil::ShowQueryL(TInt aPromptResource, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, CAknQueryDialog::TTone aTone ) + { + TInt ret; + TBTDeviceName name( KNullDesC ); + if ( aPromptResource ) + { + HBufC* prompt = StringLoader::LoadLC( aPromptResource ); + ret = ShowQueryL(*prompt, aExecuteResource, aDialogId, name, aTone ); + CleanupStack::PopAndDestroy( prompt ); + } + else + { + ret = ShowQueryL(KNullDesC, aExecuteResource, aDialogId, name, aTone ); + } + return ret; + } + +TInt CBTNotifUIUtil::ShowQueryL(const TDesC& aPrompt, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, const TBTDeviceName& aDevNameInCoverUi, CAknQueryDialog::TTone aTone ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowQueryL >>")); + __ASSERT_DEBUG( iQueryDlg == NULL, + User::Panic(_L("CBTNotifier iQueryDlg not released!"),KErrAlreadyExists)); + + iQueryDlg = CAknQueryDialog::NewL(aTone); + if( iCoverDisplayEnabled && aDialogId != ECmdBTnotifUnavailable) + { + // initializes cover support + iQueryDlg->PublishDialogL(aDialogId, KUidCoverUiCategoryBTnotif ); + CoverUIDisplayL( iQueryDlg, aDevNameInCoverUi ); + } + + // Deactivate apps key + // we can do nothing if this operation fails + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); + iAppKeyBlocked = ETrue; + TurnLightsOn(); + iQueryDlg->SetFocus( ETrue ); + + TInt keypress; + if ( aPrompt.Length() ) + { + keypress = iQueryDlg->ExecuteLD(aExecuteResource, aPrompt ); + } + else + { + keypress = iQueryDlg->ExecuteLD( aExecuteResource ); + } + + iQueryDlg = NULL; + if( !iSystemCancel ) + { // Activate apps key when no external cancellation happens + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); + iAppKeyBlocked = EFalse; + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowQueryL keypress %d <<"), keypress ) ); + return keypress; + } + +TInt CBTNotifUIUtil::ShowMessageQueryL(TDesC& aMessage, const TDesC& aHeader, + TInt aResourceId, CAknQueryDialog::TTone aTone ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowMessageQueryL >>")); + __ASSERT_DEBUG( iQueryDlg == NULL, + User::Panic(_L("CBTNotifier iQueryDlg not released!"),KErrAlreadyExists)); + + iQueryDlg = CAknMessageQueryDialog::NewL( aMessage, aTone ); + iQueryDlg->PrepareLC( aResourceId ); + if( aHeader.Length() ) + { + static_cast(iQueryDlg)->Heading()->SetTextL( aHeader ); + } + + // Deactivate apps key + // we can do nothing if this operation fails + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); + iAppKeyBlocked = ETrue; + TurnLightsOn(); + iQueryDlg->SetFocus( ETrue ); + TInt keypress = iQueryDlg->RunLD(); + iQueryDlg = NULL; + + if( !iSystemCancel ) + { // Activate apps key when no external cancellation happens + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); + iAppKeyBlocked = EFalse; + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowMessageQueryL keypress %d <<"), keypress ) ); + return keypress; + } + + +TInt CBTNotifUIUtil::ShowTextInputQueryL(TDes& aText, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + CAknQueryDialog::TTone aTone ) + { + return ShowTextInputQueryL(aText, KNullDesC, aExecuteResource, aDialogId, aTone); + } + +TInt CBTNotifUIUtil::ShowTextInputQueryL(TDes& aText, const TDesC& aPrompt, TInt aExecuteResource, + TSecondaryDisplayBTnotifDialogs aDialogId, + CAknQueryDialog::TTone aTone ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowTextInputQueryL >>")); + + __ASSERT_DEBUG( iQueryDlg == NULL, + User::Panic(_L("CBTNotifier iQueryDlg not released!"),KErrAlreadyExists)); + + iQueryDlg = CAknTextQueryDialog::NewL( aText, aTone ); + if( iCoverDisplayEnabled && aDialogId != ECmdBTnotifUnavailable) + { + // initializes cover support + iQueryDlg->PublishDialogL(aDialogId, KUidCoverUiCategoryBTnotif ); + } + if ( aPrompt.Length() ) + { + iQueryDlg->SetPromptL( aPrompt ); + } + + // Deactivate apps key + // we can do nothing if this operation fails + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); + iAppKeyBlocked = ETrue; + TurnLightsOn(); + iQueryDlg->SetFocus( ETrue ); + TInt keypress = iQueryDlg->ExecuteLD( aExecuteResource ); + iQueryDlg = NULL; + + if( !iSystemCancel ) + { // Activate apps key when no external cancellation happens + (void) ((CAknNotifierAppServerAppUi*)iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse); + iAppKeyBlocked = EFalse; + } + + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowTextInputQueryL txt '%S' keypress %d <<"), + &aText, keypress ) ); + return keypress; + } + +void CBTNotifUIUtil::ShowInfoNoteL( + TInt aResourceId, TSecondaryDisplayBTnotifDialogs aDialogId ) + { + // Load a string, create and show a note + HBufC* stringHolder = StringLoader::LoadLC( aResourceId ); + ShowInfoNoteL( *stringHolder, aDialogId ); + CleanupStack::PopAndDestroy(); //stringHolder + } + + +void CBTNotifUIUtil::ShowInfoNoteL( + const TDesC& aResource, TSecondaryDisplayBTnotifDialogs aDialogId ) + { + FTRACE(FPrint(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowInfoNoteL '%S' >> "), + &aResource ) ); + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + if(iCoverDisplayEnabled && aDialogId != ECmdBTnotifUnavailable) + { + CleanupStack::PushL( note ); + // initializes cover support + note->PublishDialogL(aDialogId, KUidCoverUiCategoryBTnotif ); + CleanupStack::Pop(note); + } + note->ExecuteLD( aResource ); + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowInfoNoteL done <<")); + } + +void CBTNotifUIUtil::ShowConfirmationNoteL( TBool aWaitingDlg, const TDesC& aResource, + TSecondaryDisplayBTnotifDialogs aDialogId, const TBTDeviceName& aDevNameInCoverUi ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowConfirmationNoteL >>")); + CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote( aWaitingDlg ); + + if(iCoverDisplayEnabled && aDialogId != ECmdBTnotifUnavailable) + { + CleanupStack::PushL( note ); + // initializes cover support + note->PublishDialogL(aDialogId, KUidCoverUiCategoryBTnotif ); + CoverUIDisplayL( note, aDevNameInCoverUi ); + CleanupStack::Pop(note); + } + TurnLightsOn(); + note->ExecuteLD( aResource ); + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowConfirmationNoteL done <<")); + } + +void CBTNotifUIUtil::ShowErrorNoteL( TBool aWaitingDlg, const TDesC& aResource, + TSecondaryDisplayBTnotifDialogs aDialogId, TBTDeviceName aDevNameInCoverUi ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowErrorNoteL >>")); + CAknErrorNote* note = new (ELeave) CAknErrorNote( aWaitingDlg ); + if(iCoverDisplayEnabled && aDialogId != ECmdBTnotifUnavailable) + { + CleanupStack::PushL( note ); + // initializes cover support + note->PublishDialogL(aDialogId, KUidCoverUiCategoryBTnotif ); + CoverUIDisplayL( note, aDevNameInCoverUi ); + CleanupStack::Pop(note); + } + TurnLightsOn(); + note->ExecuteLD( aResource ); + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowErrorNoteL done <<")); + } + +// ---------------------------------------------------------- +// CBTNotifUIUtil::IsQueryReleased +// Check if iQueryDlg is NULL +// ---------------------------------------------------------- +// +TBool CBTNotifUIUtil::IsQueryReleased() + { + return ( iQueryDlg ) ? EFalse : ETrue; + } + +// ---------------------------------------------------------- +// CBTNotifUIUtil::UpdateQueryDlgL +// Update Query with specified info, called by UpdateL() +// ---------------------------------------------------------- +// +void CBTNotifUIUtil::UpdateQueryDlgL( TDesC& aMessage ) + { + __ASSERT_DEBUG( iQueryDlg != NULL, + User::Panic(_L("CBTNotifier iQueryDlg not exist to update!"),KErrNotFound)); + iQueryDlg->SetPromptL( aMessage ); + iQueryDlg->DrawDeferred(); + } + +// ---------------------------------------------------------- +// CBTNotifUIUtil::UpdateMessageQueryDlgL +// Update message query when RNotifier::UpdateL() is called +// ---------------------------------------------------------- +// +void CBTNotifUIUtil::UpdateMessageQueryDlgL( TDesC& aMessage ) + { + __ASSERT_DEBUG( iQueryDlg != NULL, + User::Panic(_L("CBTNotifier CAknTextQueryDialog iQueryDlg not exist to update!"),KErrNotFound)); + static_cast(iQueryDlg)->SetMessageTextL( aMessage ); + iQueryDlg->DrawDeferred(); + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::UpdateMessageQueryDlg ")); + } + +// ---------------------------------------------------------- +// CBTNotifUIUtil::UpdateCoverUiL +// Update secondary display +// ---------------------------------------------------------- +// +void CBTNotifUIUtil::UpdateCoverUiL( const TDesC8& aMessage ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::UpdateCoverUiL >>")); + __ASSERT_DEBUG( iQueryDlg != NULL, + User::Panic(_L("CBTNotifier iQueryDlg not exist to update!"),KErrNotFound)); + if(iCoverDisplayEnabled ) + { + CAknMediatorFacade* coverData = AknMediatorFacade(iQueryDlg); + if(coverData) + { + coverData->ResetBuffer(); + coverData->BufStream() << aMessage; // insert your buffer here + coverData->BufStream().CommitL(); + coverData->PostUpdatedDataL(); + } + } + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::UpdateCoverUiL done <<")); + } + +void CBTNotifUIUtil::DismissDialog() + { + if( !IsQueryReleased() ) + { + delete iQueryDlg; + iQueryDlg = NULL; + } + } + +void CBTNotifUIUtil::CoverUIDisplayL( const MObjectProvider* aMop, + const TBTDeviceName& aDevNameInCoverUi ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::CoverUIDisplayL() >>")); + + CAknMediatorFacade* covercl = AknMediatorFacade( aMop ); + if( covercl && aDevNameInCoverUi.Length() ) + { + covercl->BufStream() << aDevNameInCoverUi; + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::CoverUIDisplayL() <<")); + } + +TInt CBTNotifUIUtil::ShowWaitDlgL( TInt aResourceId ) + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowWaitDlgL() >>")); + iWaitDlg = new(ELeave) CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDlg)), ETrue ); + TInt ret = iWaitDlg->ExecuteLD(aResourceId); + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::ShowWaitDlgL() <<")); + return ret; + } + +void CBTNotifUIUtil::CompleteWaitDlgL() + { + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::CompleteWaitDlgL() >>")); + if(iWaitDlg) + { + iWaitDlg->ProcessFinishedL(); + } + FLOG(_L("[BTNOTIF]\t CBTNotifUIUtil::CompleteWaitDlgL() <<")); + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnpaireddevsettnotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,241 @@ +/* +* 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: Show pairing status and set authorized, unique devicename of paired device. +* +*/ + + +// INCLUDE FILES + +#include // Own resources +#include +#include +#include "btnotiflock.h" +#include "btnpaireddevsettnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include "btnotifnameutils.h" + +#include + +#include +#include // CoverUI + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTPairedDevSettNotifier* CBTPairedDevSettNotifier::NewL() + { + CBTPairedDevSettNotifier* self=new (ELeave) CBTPairedDevSettNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::CBTPairedDevSettNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTPairedDevSettNotifier::CBTPairedDevSettNotifier() + { + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTPairedDevSettNotifier::~CBTPairedDevSettNotifier() + { + } + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTPairedDevSettNotifier::TNotifierInfo CBTPairedDevSettNotifier::RegisterL() + { + iInfo.iUid = KBTPairedDeviceSettingNotifierUid; + iInfo.iChannel = KBTPairedDeviceSettingChannel; + iInfo.iPriority = ENotifierPriorityVHigh; + return iInfo; + } + + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::GetParamsL +// Mandatory for BT Notifiers when using asynchronous launch. +// This notifier is synchronous so no implementation is needed. +// ---------------------------------------------------------- +// +void CBTPairedDevSettNotifier::GetParamsL(const TDesC8& aBuffer, + TInt aReplySlot, + const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::GetParamsL")); + + if( iReplySlot != NULL || !iMessage.IsNull()) + { + User::Leave(KErrInUse); + } + + iMessage = aMessage; + iReplySlot = aReplySlot; + ProcessParamBufferL(aBuffer); + + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::GetParamsL Complete")); + } + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::UpdateL +// Update notifier according to new data +// ---------------------------------------------------------- +// +TPtrC8 CBTPairedDevSettNotifier::UpdateL(const TDesC8& /*aBuffer*/) + { + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::UpdateL")); + TPtrC8 ret(KNullDesC8); + return (ret); + } + +void CBTPairedDevSettNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::HandleGetDeviceCompletedL >>")); + TBTDeviceName name; + BtNotifNameUtils::GetDeviceDisplayName(name, iDevice); + + RBuf stringholder; + stringholder.CleanupClosePushL(); + + // 1. Show pairing status note + FTRACE(FPrint(_L("[BTNOTIF]\t CBTPairedDevSettNotifier iPairingStatus: %d"), iPairingStatus)); + TInt resourceId = ProcessPairingErrorCode( iPairingStatus ); + BluetoothUiUtil::LoadResourceAndSubstringL( stringholder, resourceId, name, 0 ); + + if (!iPairingStatus) + { + iNotifUiUtil->ShowConfirmationNoteL( ETrue, stringholder, iSecondaryDisplayCommand, name ); + } + else + { + iNotifUiUtil->ShowErrorNoteL( EFalse, stringholder, iSecondaryDisplayCommand, name ); + } + CleanupStack::PopAndDestroy( &stringholder ); + + if( iPairingStatus || (iDevice && iDevice->GlobalSecurity().Banned() ) ) + { + TBTNotifLockPublish::DeleteNotifLocks( + EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() ); + CompleteMessage(KErrNone); + return; + } + + // 2. Show Authorization query + // + TInt keypress = iNotifUiUtil->ShowQueryL( R_BT_AUTHORIZATION_PROMPT, R_BT_AUTHORISATION_QUERY, + iSecondaryDisplayCommand, CAknQueryDialog::EConfirmationTone); + + if (!iMessage.IsNull()) + { + // this notifier is not cancelled, continue the task: + ChangeAuthorizeState(keypress); + } + } + +// ---------------------------------------------------------- +// CBTGenericQueryNotifier::ProcessParamBufferL +// Parse the data out of the message that is sent by the +// client of the notifier. +// ---------------------------------------------------------- +void CBTPairedDevSettNotifier::ProcessParamBufferL(const TDesC8& aBuffer) + { + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::ProcessParamBufferL()")); + + TBTPairedDeviceSettingParamsPckg pckg; + pckg.Copy( aBuffer ); + + iPairingStatus = pckg().iPairingStatus; + if( iPairingStatus <= KHCIErrorBase ) + { + // Pairing status could be KErrNone, or the Symbian error code + // used for indicating HCI error codes. + iPairingStatus -= KHCIErrorBase; + } + if ( !iPairingStatus ) + { + TBTNotifLockPublish::AddNotifLocks( + EBTNotiferLockPairedDeviceSetting, pckg().iRemoteAddr ); + } + + iDevice = CBTDevice::NewL(pckg().iRemoteAddr); + GetDeviceFromRegL( pckg().iRemoteAddr ); + + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::ProcessParamBufferL() end")); + } + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::Cancel +// Release all own resources (member variables) +// ---------------------------------------------------------- +// +void CBTPairedDevSettNotifier::Cancel() + { + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::Cancel()")); + + TBTNotifLockPublish::DeleteNotifLocks( + EBTNotiferLockPairedDeviceSetting, iDevice->BDAddr() ); + CBTNotifierBase::Cancel(); + + FLOG(_L("[BTNOTIF]\t CBTPairedDevSettNotifier::Cancel() completed")); + } + +// ---------------------------------------------------------- +// CBTPairedDevSettNotifier::ProcessPairingErrorCode +// ---------------------------------------------------------- +// +TInt CBTPairedDevSettNotifier::ProcessPairingErrorCode( const TInt aErr ) + { + if( !aErr ) + { + return R_BT_SUCCESFULLY_PAIRED_PROMPT; + } + else if( aErr == -EHostBusyPairing ) + { + return R_BT_SSP_BUSY; + } + else + { + return R_BT_PAIRING_FAILED_PROMPT; + } + } + + +void CBTPairedDevSettNotifier::QueryRenameDeviceL(const CBTDevice& /*aDevice*/) + { + // No implementation for now. + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnpairnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnpairnotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,253 @@ +/* +* 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: Base class for all notifiers for pairing purpose. +* +*/ + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include // new file introduced by xSymbian +#endif + +#include // Unicode character conversion utilities +#include +#include // Own resources +#include +#include "btnpairnotifier.h" +#include "btNotifDebug.h" +#include "btnotifnameutils.h" + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::NewL +// ---------------------------------------------------------- +// +CBTNPairNotifierBase* CBTNPairNotifierBase::NewL() + { + CBTNPairNotifierBase* self = new (ELeave) CBTNPairNotifierBase(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase Destructor +// ---------------------------------------------------------- +// +CBTNPairNotifierBase::~CBTNPairNotifierBase() + { + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase default construct +// ---------------------------------------------------------- +// +CBTNPairNotifierBase::CBTNPairNotifierBase() + :iLocallyInitiated(EFalse) + { + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::RegisterL +// ---------------------------------------------------------- +// +CBTNPairNotifierBase::TNotifierInfo CBTNPairNotifierBase::RegisterL() + { + return iInfo; + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::GetParamsL +// ---------------------------------------------------------- +// +void CBTNPairNotifierBase::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + (void)aBuffer; + if( !iMessage.IsNull() ) + { + User::Leave(KErrInUse); + } + + iMessage = (RMessage2)aMessage; + iReplySlot = aReplySlot; + + if ( AutoLockOnL() ) + { + // The phone is locked, access denied. + // + CompleteMessage(KErrCancel); + } + + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::UpdateL +// ---------------------------------------------------------- +// +void CBTNPairNotifierBase::UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + (void) aReplySlot; + UpdateL(aBuffer); + aMessage.Complete(KErrNone); + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::UpdateL +// ---------------------------------------------------------- +// +TPtrC8 CBTNPairNotifierBase::UpdateL( const TDesC8& aBuffer ) + { + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::UpdateL()")); + + TBTDeviceNameUpdateParamsPckg pckg; + pckg.Copy( aBuffer ); + if (pckg().Type() != TBTNotifierUpdateParams2::EDeviceName) + { + TPtrC8 ret(KNullDesC8); + return (ret); + } + + if (pckg().Result() == KErrNone) + { + BtNotifNameUtils::SetDeviceNameL(pckg().DeviceName(), *iDevice); + + // Finally show new prompt for dialog if it is still on the screen + // and user has not given a alias for device. + if( !iNotifUiUtil->IsQueryReleased() && !iDevice->IsValidFriendlyName() ) + { + RBuf prompt; + prompt.CleanupClosePushL(); + GenerateQueryPromptL( prompt ); + iNotifUiUtil->UpdateQueryDlgL( prompt ); + CleanupStack::PopAndDestroy( &prompt ); + } + } + + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::UpdateL() completed")); + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::ProcessParamsGetDeviceL +// Get device from registry based on notifier's param +// ---------------------------------------------------------- +// +void CBTNPairNotifierBase::ProcessParamsGetDeviceL( const TBTDevAddr& aAddr, const TBTDeviceName& aName ) + { + iDevice = CBTDevice::NewL(aAddr); + BtNotifNameUtils::SetDeviceNameL(aName, *iDevice); + + // Get all properties of device from registry. + GetDeviceFromRegL( aAddr ); + +#ifdef _DEBUG + FTRACE(FPrint(_L("[BTNOTIF]\t Executing authentication... Parameters:"))); + TBuf<12> deviceAddressString; + aAddr.GetReadable(deviceAddressString); + FTRACE(FPrint(_L("[BTNOTIF]\t BT Address: %S"), &deviceAddressString)); +#endif + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::CheckBlockedDeviceL +// Forbid pairing from remote banned devices +// ---------------------------------------------------------- +// +TBool CBTNPairNotifierBase::CheckBlockedDeviceL() + { + if ( !iDevice ) + { + User::Leave( KErrGeneral ); + } + + // Do not allow pairing attempt from banned devices + if( iDevice->GlobalSecurity().Banned() && !iLocallyInitiated ) + { + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::CheckBlockedDeviceL() Pairing attempt from banned device is denied.")); + CompleteMessage(KErrCancel); + return ETrue; + } + return EFalse; + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::AuthoriseIncomingPairingL +// Query user to authorise imcoming pair request or not. +// If reject, query whether to block the remot device. +// ---------------------------------------------------------- +// +TBool CBTNPairNotifierBase::AuthoriseIncomingPairingL() + { + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::AuthoriseIncomingPairingL() >>")); + + // Start pairing observer so that user will be informed about the result: + TInt err = CBTEngConnMan::StartPairingObserver( iBTAddr ); + if ( err ) + { + // Failed to start observer because of other ongoing pairing, + // reject this request: + CompleteMessage( err ); + return EFalse; + } + + TBTDeviceName devName; + BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); + RBuf prompt; + prompt.CleanupClosePushL(); + BluetoothUiUtil::LoadResourceAndSubstringL( + prompt, R_BT_ACCEPT_PAIRING_REQUEST, devName, 0 ); + + devName.Zero(); + // Show query for use to accept/reject incoming pairing request + TInt keypress = iNotifUiUtil->ShowQueryL( prompt, R_BT_GENERIC_QUERY, + ECmdBTnotifUnavailable, devName, CAknQueryDialog::EConfirmationTone ); + CleanupStack::PopAndDestroy( &prompt ); + + if( iMessage.IsNull() ) // cancelled by the stack + { + return EFalse; + } + else if( !keypress ) // User rejected pairing + { + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase: user rejected incoming pairing")); + // stop observer to omit pairing failure note. + CBTEngConnMan::StopPairingObserver( iDevice->BDAddr() ); + iDevice->SetPaired(EFalse); + CheckAndHandleQueryIntervalL(); + if( !iMessage.IsNull() ) + { + // Ask user does he/she wishes to block this device (if not canceled because the + // frequency is too high). + QueryBlockDeviceL(); + } + return EFalse; + } + + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::AuthoriseIncomingPairingL() << ")); + return ETrue; + } + +// ---------------------------------------------------------- +// CBTNPairNotifierBase::GenerateQueryPromptL +// To be implemented in derived classes. +// ---------------------------------------------------------- +// +void CBTNPairNotifierBase::GenerateQueryPromptL( RBuf& aRBuf ) + { + FLOG(_L("[BTNOTIF]\t CBTNPairNotifierBase::GenerateQueryPromptL WARNING ")); + (void) aRBuf; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnssppasskeyentrynotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,282 @@ +/* +* 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: Declares authentication (PIN query) notifier class. +* +*/ + + +// INCLUDE FILES +#include // Localisation stringloader +#include // Unicode character conversion utilities +#include +#include +#include +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif +#include // Own resources +#include +#include +#include "btnotif.hrh" // Own resource header +#include "btnssppasskeyentrynotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include "btnotifnameutils.h" + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTSSPPasskeyEntryNotifier* CBTSSPPasskeyEntryNotifier::NewL() + { + CBTSSPPasskeyEntryNotifier* self=new (ELeave) CBTSSPPasskeyEntryNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::CBTSSPPasskeyEntryNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTSSPPasskeyEntryNotifier::CBTSSPPasskeyEntryNotifier() + { + iPasskey.Zero(); + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTSSPPasskeyEntryNotifier::~CBTSSPPasskeyEntryNotifier() + { + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTSSPPasskeyEntryNotifier::TNotifierInfo CBTSSPPasskeyEntryNotifier::RegisterL() + { + iInfo.iUid = KBTPasskeyDisplayNotifierUid; + iInfo.iChannel = KBTPasskeyDisplayNotifierUid; + iInfo.iPriority = ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::GetParamsL +// Initialize parameters and check if device is already +// in registry. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTSSPPasskeyEntryNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL()")); + + CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage ); + + TBTPasskeyDisplayParamsPckg pckg; + pckg.Copy(aBuffer); + iBTAddr = pckg().DeviceAddress(); + if ( OtherOutgoPairing(iBTAddr) ) + { + // We won't allow incoming pairing during outgoing pairing: + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier: outgoing pair in progress, reject incoming pair")); + CompleteMessage(KErrCancel); + return; + } + + iLocallyInitiated = pckg().LocallyInitiated(); + iPasskey.AppendNumFixedWidth(pckg().NumericalValue(), EDecimal, KPassKeylength); + iPasskey.Insert(3,_L(" ")); + + ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() ); + + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::UpdateL +// Notifier update. Stores the received bluetooth +// device name into registry and show it on screen. +// ---------------------------------------------------------- +// +TPtrC8 CBTSSPPasskeyEntryNotifier::UpdateL(const TDesC8& aBuffer) + { + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::UpdateL()")); + + TBTPasskeyDisplayUpdateParamsPckg pckg; + pckg.Copy(aBuffer); + + if(pckg().Type() != TBTNotifierUpdateParams2::EPasskeyDisplay) + { + TPtrC8 ret(KNullDesC8); + return (ret); + } + + switch (pckg().KeypressNotification()) + { + case EPasskeyEntryStarted: + { + iBuf.Zero(); + iBuf.Append(iPasskey); + iBuf.Append(_L(" ")); + break; + } + case EPasskeyDigitEntered: + { + // show an '*' + iBuf.Append(_L("*")); + break; + } + case EPasskeyDigitDeleted: + { + // remove an '*' from the tail of iBuf + iBuf.Delete(iBuf.Length()-1, 1); + break; + } + case EPasskeyCleared: + { + // remove all '*' + iBuf.Zero(); + iBuf.Append(iPasskey); + iBuf.Append(_L(" ")); + break; + } + case EPasskeyEntryCompleted: + { + // complete passkey entry + // Set iAnswer to 1 , + // Continue pairing in Run() + iAnswer = 1; + //iPasskeyDlg->DismissQueryL(); + iNotifUiUtil->DismissDialog(); + break; + } + } + if ( !iNotifUiUtil->IsQueryReleased() ) + { + RBuf prompt; + prompt.CleanupClosePushL(); + GenerateQueryPromptL( prompt ); + iNotifUiUtil->UpdateQueryDlgL( prompt ); + CleanupStack::PopAndDestroy( &prompt ); + } + + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::UpdateL() completed")); + TPtrC8 ret(KNullDesC8); + return (ret); + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::HandleGetDeviceCompletedL +// Ask user response and return it to caller. +// Store device into registry if user rejects the incoming pairing. +// ---------------------------------------------------------- +// +void CBTSSPPasskeyEntryNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::HandleGetDeviceCompletedL()")); + iAnswer = 0; + + // Check if blocked device. + if( CheckBlockedDeviceL() ) + return; + + // For pairing request from remote device + if ( !iLocallyInitiated ) + { + TBool keypress = AuthoriseIncomingPairingL(); + if( !keypress ) + { + //User rejects the incoming pairing, complete message in QueryBlockDevice. + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::HandleGetDeviceCompletedL() <<")); + return; + } + } + + TBTDeviceName nameCoverUi( KNullDesC ); + + iBuf.Zero(); + iBuf.Append(iPasskey); + iBuf.Append(_L(" ")); + + RBuf prompt; + prompt.CleanupClosePushL(); + GenerateQueryPromptL( prompt ); + + TInt answer = iNotifUiUtil->ShowQueryL( prompt, R_BT_PASSKEY_QUERY, + ECmdBTnotifUnavailable, nameCoverUi ); + CleanupStack::PopAndDestroy( &prompt ); + + if( iAnswer ) // user pressed entry key from remote keyboard. + { + CompleteMessage(KErrNone); + } + else + { + // If the outgoing pairing mode is set, then this is bonding initiated by the user. + TBool incomingConn = ( OutgoPairingMode( iBTAddr ) == EBTOutgoingPairNone ); + if( !iMessage.IsNull() ) + { + // No need to inform the user of the pairing result if the user cancelled it. + // If user doesn't answer anything but stack cancels, pairing result is needed + // to show for outgoing pairing. In this case, don't stop pairng observer. + (void) CBTEngConnMan::StopPairingObserver( iBTAddr ); + } + // We may be asking for pairing (locally initiated), because a remote device is requesting + // accesss to a service for which we require authentication. + if( iLocallyInitiated && incomingConn ) + { + CheckAndHandleQueryIntervalL(); + } + CompleteMessage(KErrCancel); + } + + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::HandleGetDeviceCompletedL() completed")); + } + +// ---------------------------------------------------------- +// CBTSSPPasskeyEntryNotifier::GenerateQueryPromptL +// ---------------------------------------------------------- +// +void CBTSSPPasskeyEntryNotifier::GenerateQueryPromptL( RBuf& aRBuf ) + { + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GenerateQueryPromptL()")); + TBTDeviceName devName; + BtNotifNameUtils::GetDeviceDisplayName(devName, iDevice); + BluetoothUiUtil::LoadResourceAndSubstringL( + aRBuf, R_BT_SSP_PASSKEY_ENTRY, devName, 0 ); + BluetoothUiUtil::AddSubstringL( aRBuf, iBuf, 1 ); + FLOG(_L("[BTNOTIF]\t CBTSSPPasskeyEntryNotifier::GenerateQueryPromptL() << ")); + + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btnumcmpnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btnumcmpnotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,235 @@ +/* +* 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: Declares Numeric Comparison notifier for Secure Simle Pairing +* +*/ + + +// INCLUDE FILES +#include // Localisation stringloader +#include // Unicode character conversion utilities +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif +#include // Own resources +#include "btnotif.hrh" // Own resource header +#include "btnumcmpnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include +#include +#include +#include "btnotifnameutils.h" + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTNumCmpNotifier* CBTNumCmpNotifier::NewL() + { + CBTNumCmpNotifier* self=new (ELeave) CBTNumCmpNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::CBTNumCmpNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTNumCmpNotifier::CBTNumCmpNotifier() + { + iPasskeyToShow.Zero(); + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTNumCmpNotifier::~CBTNumCmpNotifier() + { + } + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTNumCmpNotifier::TNotifierInfo CBTNumCmpNotifier::RegisterL() + { + iInfo.iUid = KBTNumericComparisonNotifierUid; + iInfo.iChannel = KBTNumericComparisonNotifierUid; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::GetParamsL +// Initialize parameters and check if device is already +// in registry. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTNumCmpNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GetParamsL()")); + + CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage ); + + TBTNumericComparisonParamsPckg pckg; + pckg.Copy(aBuffer); + iBTAddr = pckg().DeviceAddress(); + if ( OtherOutgoPairing( iBTAddr) ) + { + // We won't allow incoming pairing during outgoing pairing: + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier: outgoing pair in progress, reject incoming pair")); + CompleteMessage(KErrCancel); + return; + } + + TUint32 passkey = pckg().NumericalValue(); + iLocallyInitiated = pckg().LocallyInitiated(); + iPasskeyToShow.AppendNumFixedWidth(passkey, EDecimal, Klength); + iPasskeyToShow.Insert(3,_L(" ")); + + // base class + ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() ); + + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::HandleGetDeviceCompletedL +// Ask user response and return it to caller. +// Store device into registry if user has accepted pairing. +// ---------------------------------------------------------- +// +void CBTNumCmpNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::HandleGetDeviceCompletedL()")); + + // Check if blocked device. + if( CheckBlockedDeviceL() ) + return; + + // Turn lights on and deactivate apps -key + iNotifUiUtil->TurnLightsOn(); + + // For incoming pairing request + if(!iLocallyInitiated) + { + TBool keypress = AuthoriseIncomingPairingL(); + if( !keypress ) + { + //User rejects the incoming pairing, complete message in QueryBlockDevice. + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::HandleGetDeviceCompletedL() <<")); + return; + } + } + + // For outgoing pairing request or accepted incoming pairing request, + // ask user to compare the pincodes in two devices. + TBTDeviceName nameCoverUi( KNullDesC ); + RBuf prompt; + prompt.CleanupClosePushL(); + GenerateQueryPromptL( prompt ); + TInt answer = iNotifUiUtil->ShowQueryL( prompt, R_BT_GENERIC_QUERY, ECmdShowBtOpenCoverNote, nameCoverUi ); + CleanupStack::PopAndDestroy( &prompt ); + + if( answer ) + { + CompleteMessage(answer, KErrNone); + } + else + { + // If the outgoing pairing mode is set, then this is bonding initiated by the user. + TBool incomingConn = ( OutgoPairingMode( iBTAddr ) == EBTOutgoingPairNone ); + + if( !iMessage.IsNull() ) + { + // No need to inform the user of the pairing result if the user cancelled it. + // If user doesn't answer anything but stack cancels, pairing result is needed + // to show for outgoing pairing. In this case, don't stop pairng observer. + CBTEngConnMan::StopPairingObserver( iBTAddr ); + } + // We may be asking for pairing (locally initiated), because a remote device is requesting + // accesss to a service for which we require authentication. + if( iLocallyInitiated && incomingConn ) + { + CheckAndHandleQueryIntervalL(); + } + CompleteMessage(KErrCancel); + } + + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::HandleGetDeviceCompletedL() completed")); + } + +// ---------------------------------------------------------- +// CBTNumCmpNotifier::GenerateQueryPromptL +// Generate prompt for Numeric Comparison query and return. +// ---------------------------------------------------------- +// +void CBTNumCmpNotifier::GenerateQueryPromptL( RBuf& aRBuf ) + { + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromptL()")); + TBTDeviceName devName; + BtNotifNameUtils::GetDeviceDisplayName( devName, iDevice ); + TBuf shortName; + + TPtrC namePtr; + // Cut the name and put ellipsis in the middle if necessary + // By example "SampleSymbianDevice" after this operation will be shown in + // the dialog as "Sam...ice"(for 7 chars device name limit) + // This need to be done, because if name of the device is too long, the PIN + // codes aren't visible and user can't compare it with PIN code taken from + // other phone + if ( devName.Length() > KBTDeviceShortNameLength ) + { + shortName.Copy( devName.Left( KBTDeviceShortNameLength/2 ) ); + //adding ellipsis ("...") char in the middle of the string + shortName.Append( TChar( KEllipsis) ); + //adding only end of the name to the final string + shortName.Append( devName.Right( shortName.MaxLength() - + shortName.Length() ) ); + namePtr.Set( shortName ); + } + else + { + namePtr.Set( devName ); + } + + BluetoothUiUtil::LoadResourceAndSubstringL( + aRBuf, R_BT_SSP_PASSKEY_COMPARISON_PROMPT, namePtr, 0 ); + // Numeric comparison key shall not be localized either, use our own + // string loading: + BluetoothUiUtil::AddSubstringL( aRBuf, iPasskeyToShow, 1); + FLOG(_L("[BTNOTIF]\t CBTNumCmpNotifier::GenerateQueryPromptL() <<")); + + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/src/btuserconfnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/src/btuserconfnotifier.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,153 @@ +/* +* 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: Declares User confirmation notifier for Secure Simle Pairing +* +*/ + + +// INCLUDE FILES +#include // Localisation stringloader +#include // Unicode character conversion utilities +#include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif +#include // Own resources +#include "btnotif.hrh" // Own resource header +#include "btuserconfnotifier.h" // Own class definition +#include "btNotifDebug.h" // Debugging macros +#include +#include +#include +#include +#include "btnotifnameutils.h" + +#ifdef __SERIES60_HELP +#include +#include // The bt hrh info is needed, for help launching +#endif + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTUserConfNotifier::NewL +// Two-phased constructor. +// ---------------------------------------------------------- +// +CBTUserConfNotifier* CBTUserConfNotifier::NewL() + { + CBTUserConfNotifier* self=new (ELeave) CBTUserConfNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------- +// CBTUserConfNotifier::CBTUserConfNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------- +// +CBTUserConfNotifier::CBTUserConfNotifier() + { + + } + +// ---------------------------------------------------------- +// Destructor +// ---------------------------------------------------------- +// +CBTUserConfNotifier::~CBTUserConfNotifier() + { + } + +// ---------------------------------------------------------- +// CBTUserConfNotifier::RegisterL +// Register notifier. +// ---------------------------------------------------------- +// +CBTUserConfNotifier::TNotifierInfo CBTUserConfNotifier::RegisterL() + { + iInfo.iUid = KBTUserConfirmationNotifierUidCopy; + iInfo.iChannel = KBTUserConfirmationNotifierUidCopy; + iInfo.iPriority=ENotifierPriorityVHigh; + return iInfo; + } + +// ---------------------------------------------------------- +// CBTUserConfNotifier::GetParamsL +// Initialize parameters and check if device is already +// in registry. Jump to RunL as soon as possible. +// ---------------------------------------------------------- +// +void CBTUserConfNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) + { + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::GetParamsL()")); + + CBTNPairNotifierBase::GetParamsL( aBuffer, aReplySlot, aMessage ); + + TBTUserConfirmationParamsPckgCopy pckg; + pckg.Copy(aBuffer); + iBTAddr = pckg().DeviceAddress(); + if ( OtherOutgoPairing( iBTAddr) ) + { + // We won't allow incoming pairing during outgoing pairing: + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier: outgoing pair in progress, reject incoming pair")); + CompleteMessage(KErrCancel); + return; + } + + iLocallyInitiated = pckg().LocallyInitiated(); + + // base class + ProcessParamsGetDeviceL( iBTAddr, pckg().DeviceName() ); + + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::GetParamsL() completed")); + } + +// ---------------------------------------------------------- +// CBTUserConfNotifier::HandleGetDeviceCompletedL +// Ask user response and return it to caller. +// Store device into registry if user has accepted pairing. +// ---------------------------------------------------------- +// +void CBTUserConfNotifier::HandleGetDeviceCompletedL(const CBTDevice* /*aDev*/) + { + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::HandleGetDeviceCompletedL()")); + + // Check if blocked device. + if( CheckBlockedDeviceL() ) + return; + + // Turn lights on and deactivate apps -key + iNotifUiUtil->TurnLightsOn(); + + // For incoming pairing request + TBool answer = AuthoriseIncomingPairingL(); + if( !answer ) + { + //User rejects the incoming pairing, complete message in QueryBlockDevice. + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::HandleGetDeviceCompletedL() <<")); + return; + } + CompleteMessage(answer, KErrNone); + + FLOG(_L("[BTNOTIF]\t CBTUserConfNotifier::HandleGetDeviceCompletedL() completed")); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/Bmarm/BtNotifApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/Bmarm/BtNotifApiTestU.DEF Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/Bwins/BtNotifApiTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/Bwins/BtNotifApiTestU.DEF Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/EABI/BtNotifApiTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/EABI/BtNotifApiTestU.def Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/conf/ui_BtNotifApiTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/conf/ui_BtNotifApiTest.cfg Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,834 @@ +// BT notif tests - 74 tc + + +// Paired device setting notifier tests + + + +// PBAP authorization query notifier tests (2) + +[Test] +title BT Correct Passkey Entered (PBAP Auth Query Notifier Test) +create BtNotifApiTest tester +tester PbapAuthNotifierTest +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishPbapAuthQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT PBAP Auth Query Cancelled (PBAP Auth Query Notifier Test) +create BtNotifApiTest tester +tester PbapAuthNotifierTest +pause 1000 +presskey global EKeyDevice1 +tester FinishPbapAuthQuery CANCEL +delete tester +[Endtest] + +// Passkey display notifier tests (4) + +[Test] +title BT Remote Connection/Pairing Discarded/Device Blocked (Passkey Display Notifier Test) +create BtNotifApiTest tester +tester PasskeyDisplayNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice0 +tester FinishPasskeyDisplayQuery BLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Discarded/Device Not Blocked (Passkey Display Notifier Test) +create BtNotifApiTest tester +tester PasskeyDisplayNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice1 +tester FinishPasskeyDisplayQuery NONBLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed (Passkey Display Notifier Test) +create BtNotifApiTest tester +tester PasskeyDisplayNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishPasskeyDisplayQuery +delete tester +[Endtest] + +[Test] +title BT Local Connection/Pairing Allowed (Passkey Display Notifier Test) +create BtNotifApiTest tester +tester PasskeyDisplayNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice1 +tester FinishPasskeyDisplayQuery +delete tester +[Endtest] + +// Numeric comparison query notifier tests (6) + +[Test] +title BT Remote Connection/Pairing Discarded/Device Blocked (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice0 +tester FinishNumericComparisonQuery CANCEL BLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Discarded/Device Not Blocked (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice1 +tester FinishNumericComparisonQuery CANCEL NONBLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Code Mismatch (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishNumericComparisonQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Code Match (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice0 +tester FinishNumericComparisonQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Local Connection/Code Mismatch (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice1 +tester FinishNumericComparisonQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Local Connection/Code Match (Numeric Comparison Query Notifier Test) +create BtNotifApiTest tester +tester NumericComparisonQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice0 +tester FinishNumericComparisonQuery ACCEPT +delete tester +[Endtest] + +// Authorization query notifier tests (3) + +[Test] +title BT Authorization Query Discarded - Accept Blocking (Authorization Query Notifier Test) +create BtNotifApiTest tester +tester AuthQueryNotifierTest +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice0 +tester FinishAuthQuery DISCARD BLOCK +delete tester +[Endtest] + +[Test] +title BT Authorization Query Discarded - Discard Blocking (Authorization Query Notifier Test) +create BtNotifApiTest tester +tester AuthQueryNotifierTest +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice1 +tester FinishAuthQuery DISCARD NONBLOCK +delete tester +[Endtest] + +[Test] +title BT Authorization Query Accepted (Authorization Query Notifier Test) +create BtNotifApiTest tester +tester AuthQueryNotifierTest +pause 1000 +presskey global EKeyDevice0 +tester FinishAuthQuery ACCEPT +delete tester +[Endtest] + +// PIN query notifier tests (10) + +[Test] +title BT Remote Connection/Pairing Discarded/Device Blocked (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice0 +tester FinishPinPasskeyQuery CANCEL DISCARDCONN BLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Discarded/Device Not Blocked (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice1 +pause 1000 +presskey global EKeyDevice1 +tester FinishPinPasskeyQuery CANCEL DISCARDCONN NONBLOCK +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Correct Pin Entered (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishPinPasskeyQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Too Short Pin Entered (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishPinPasskeyQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Pin Query Cancelled (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishPinPasskeyQuery CANCEL ACCEPTCONN +delete tester +[Endtest] + +[Test] +title BT Remote Connection/Pairing Allowed/Too Short Pin Entered/Pin Query Cancelled (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest REMOTE +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishPinPasskeyQuery CANCEL ACCEPTCONN +delete tester +[Endtest] + +[Test] +title BT Local Connection/Correct Pin Entered (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishPinPasskeyQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT Local Connection/Too Short Pin Entered (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishPinPasskeyQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT Local Connection/Pin Query Cancelled (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishPinPasskeyQuery CANCEL +delete tester +[Endtest] + +[Test] +title BT Local Connection/Too Short Pin Entered/Pin Query Cancelled (Pin Query Notifier Test) +create BtNotifApiTest tester +tester PinPasskeyQueryNotifierTest LOCAL +pause 1000 +presskey global EKeyDevice0 +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +pause 1000 +presskey global EKeyDevice1 +tester FinishPinPasskeyQuery CANCEL +delete tester +[Endtest] + +// Inquiry notifier tests (8) + +[Test] +title BT Not Switched On (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest BTOFF +presskey global EKeyDevice1 +tester FinishInquiry CANCEL +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Test Device Paired/Cancel Search (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest PAIRED +presskey global EKeyEnter +pause 1000 +presskey global EKeyUpArrow +pause 1000 +presskey global EKeyEnter +presskey global EKeyDevice1 +tester FinishInquiry CANCEL +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Test Device Paired/Switch BT Off (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest PAIRED +presskey global EKeyEnter +pause 1000 +presskey global EKeyUpArrow +pause 1000 +presskey global EKeyEnter +tester FinishInquiry CANCEL BTOFF +delete tester +[Endtest] + +[Test] +title BT Select Paired Test Device (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest PAIRED +presskey global EKeyDownArrow +pause 1000 +presskey global EKeyEnter +tester FinishInquiry ACCEPT +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Test Device Paired/Inquiry Timeout (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest PAIRED +presskey global EKeyEnter +pause 1000 +presskey global EKeyEnter +pause 60000 +tester TurnLightsOn +pause 10000 +presskey global EKeyDevice1 +tester FinishInquiry CANCEL +tester TurnLightsOn +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Cancel Search (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest NONPAIRED +presskey global EKeyUpArrow +pause 1000 +presskey global EKeyEnter +presskey global EKeyDevice1 +tester FinishInquiry CANCEL +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Switch BT Off (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest NONPAIRED +presskey global EKeyUpArrow +pause 1000 +presskey global EKeyEnter +tester FinishInquiry CANCEL BTOFF +delete tester +[Endtest] + +[Test] +title BT Launch Inquiry/Inquiry Timeout (Inquiry Notifier Test) +create BtNotifApiTest tester +tester InquiryNotifierTest NONPAIRED +presskey global EKeyEnter +pause 60000 +tester TurnLightsOn +pause 10000 +presskey global EKeyDevice1 +tester FinishInquiry CANCEL +tester TurnLightsOn +delete tester +[Endtest] + +// OBEX PIN query notifier tests (2) + +[Test] +title BT Correct Passkey (OBEX PIN Query Notifier Test) +create BtNotifApiTest tester +tester ObexPasskeyQueryNotifierTest +pause 1000 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global 0 +presskey global EKeyDevice0 +tester FinishObexPasskeyQuery PASSKEY +delete tester +[Endtest] + +[Test] +title BT Query Canceled (OBEX PIN Query Notifier Test) +create BtNotifApiTest tester +tester ObexPasskeyQueryNotifierTest +pause 1000 +presskey global EKeyDevice1 +tester FinishObexPasskeyQuery CANCEL +delete tester +[Endtest] + +// Power mode notifier tests (2) + +[Test] +title BT Power Mode Query Discarded (Power Mode Notifier Test) +create BtNotifApiTest tester +tester PowerModeQueryNotifierTest +pause 1000 +presskey global EKeyDevice1 +tester FinishPowerModeQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Power Mode Query Accepted (Power Mode Notifier Test) +create BtNotifApiTest tester +tester PowerModeQueryNotifierTest +pause 1000 +presskey global EKeyDevice0 +tester FinishPowerModeQuery ACCEPT +delete tester +[Endtest] + +// Generic info notifier tests (17) + +[Test] +title BT Connected (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTConnected +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Disconnected (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTDisconnected +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Audio Accessory (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTAudioAccessory +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Audio Handset (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTAudioHandset +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Closed (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTClosed +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Device Not Available (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTDeviceNotAvailable +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Offline Disabled (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTOfflineDisabled +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Visibility Timeout (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTVisibilityTimeout +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Enter SAP (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTEnterSap +delete tester +pause 6000 +[Endtest] + +[Test] +title BT SAP Ok (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTSapOk +delete tester +pause 6000 +[Endtest] + +[Test] +title BT SAP Failed (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTSapFailed +delete tester +pause 6000 +[Endtest] + +[Test] +title BT SAP No SIM (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTSapNoSim +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Device Busy (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTDeviceBusy +delete tester +pause 6000 +[Endtest] + +[Test] +title IR Not Supported (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EIRNotSupported +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Cmd Show BT Battery Low (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest ECmdShowBtBatteryLow +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Cmd Show BT Battery Critical (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest ECmdShowBtBatteryCritical +delete tester +pause 6000 +[Endtest] + +[Test] +title BT Stay Power On (Generic Info Notifier Test) +create BtNotifApiTest tester +tester GenericInfoNotifierTest EBTStayPowerOn +delete tester +pause 6000 +[Endtest] + +// Generic query notifier tests (20) + +[Test] +title BT Receive Message Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTReceiveMessageQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Receive Message Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTReceiveMessageQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Receive Message Paired Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTReceiveMessagePairedQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Receive Message Paired Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTReceiveMessagePairedQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Is Off Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsOffQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Is Off Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsOffQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Activate Offline Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTActivateOffLineQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Activate Offline Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTActivateOffLineQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT No Devices Found Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTNoDevicesFoundQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT No Devices Found Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTNoDevicesFoundQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Accept Request Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTAcceptRequestQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Accept Request Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTAcceptRequestQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Block Connection Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTBlockConnectionQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Block Connection Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTBlockConnectionQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Block Paired Connection Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTBlockPairedConnectionQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Block Paired Connection Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTBlockPairedConnectionQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Is Not Shown Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsNotShownQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Is Not Shown Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsNotShownQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] + +[Test] +title BT Is Off Java Discarded (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsOffJavaQuery +pause 1000 +presskey global EKeyDevice1 +tester FinishGenericQuery DISCARD +delete tester +[Endtest] + +[Test] +title BT Is Off Java Accepted (Generic Query Notifier Test) +create BtNotifApiTest tester +tester GenericQueryNotifierTest EBTIsOffJavaQuery +pause 1000 +presskey global EKeyDevice0 +tester FinishGenericQuery ACCEPT +delete tester +[Endtest] \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -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: +* +*/ + + +#if defined(__S60_) + // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET BtNotifApiTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +DEFFILE BtNotifApiTest.def + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +SOURCEPATH ../src +SOURCE BtNotifApiTest.cpp +SOURCE BtNotifApiTestBlocks.cpp BtSettingsObserver.cpp BtEngDevManObserver.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY btengsettings.lib +LIBRARY bluetooth.lib +LIBRARY btextnotifiers.lib +LIBRARY btmanclient.lib +LIBRARY btdevice.lib +LIBRARY BTEngDevMan.lib + + +LANG SC + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest.pkg Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,60 @@ +; +; 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: +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x1028315F], 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\BtNotifApiTest.dll"-"c:\Sys\Bin\BtNotifApiTest.dll" +"..\init\BtNotifApiTest.ini"-"e:\testing\init\BtNotifApiTest.ini" +"..\conf\ui_BtNotifApiTest.cfg"-"e:\testing\conf\ui_BtNotifApiTest.cfg" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest_phone.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/BtNotifApiTest_phone.pkg Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,60 @@ +; +; 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: +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x1028315F], 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\BtNotifApiTest.dll"-"c:\Sys\Bin\BtNotifApiTest.dll" +"..\init\BtNotifApiTest_phone.ini"-"c:\testframework\testframework.ini" +"..\conf\ui_BtNotifApiTest.cfg"-"c:\testframework\ui_BtNotifApiTest.cfg" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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 +DEFAULT + +PRJ_TESTEXPORTS + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +BtNotifApiTest.mmp + +PRJ_MMPFILES + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/build_sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/build_sis.bat Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,19 @@ +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 "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +call abld test build armv5 +call makesis BtNotifApiTest.pkg +call signsis BtNotifApiTest.sis BtNotifApiTest.sisx rd.cer rd-key.pem diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/build_sis_phone.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/group/build_sis_phone.bat Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,19 @@ +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 "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +call abld test build armv5 +call makesis BtNotifApiTest_phone.pkg +call signsis BtNotifApiTest_phone.sis BtNotifApiTest_phone.sisx rd.cer rd-key.pem diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtEngDevManObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtEngDevManObserver.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef BTENGDEVMANOBSERVER_H_ +#define BTENGDEVMANOBSERVER_H_ + +#include "BTEngDevMan.h" + +NONSHARABLE_CLASS( CBtEngDevManObserver ) : public MBTEngDevManObserver +{ +public: + static CBtEngDevManObserver* NewL(); + static CBtEngDevManObserver* NewLC(); + + TInt GetDevices( const TBTRegistrySearch& aCriteria, + CBTDeviceArray* aResultArray ); + TInt AddDevice( const CBTDevice& aDevice ); + TInt DeleteDevices( const TBTRegistrySearch& aCriteria ); + + virtual ~CBtEngDevManObserver(); + void HandleDevManComplete( TInt aErr ); + void HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ); + +private: + CBtEngDevManObserver(); + void ConstructL(); + +private: + CActiveSchedulerWait* iWait; + CBTEngDevMan* iDevMan; + +}; + +#endif /*BTENGDEVMANOBSERVER_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtNotifApiTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtNotifApiTest.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,260 @@ +/* +* 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 BTNOTIFAPITEST_H +#define BTNOTIFAPITEST_H + +// INCLUDES +#include +#include +#include +#include +#include + +#include "btnotif.h" +#include "btmanclient.h" +#include "btnotifierapi.h" +#include "btextnotifiers.h" +#include "coreapplicationuisdomainpskeys.h" + +#include "BtEngDevManObserver.h" +#include "BtSettingsObserver.h" + + +// 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( KBtNotifApiTestLogPath, "\\logs\\testframework\\bt\\" ); +_LIT( KBtNotifApiTestLogPath, "e:\\testing\\stiflogs\\" ); +// Log file +_LIT( KBtNotifApiTestLogFile, "BtNotifApiTest.txt" ); +_LIT( KBtNotifApiTestLogFileWithTitle, "BtNotifApiTest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CBtNotifApiTest; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +enum TTestOption + { + EQueryDiscarded = 0, + EQueryAccepted, + ECheckPasskey, + EQueryCanceled + }; + +// CLASS DECLARATION + +/** +* CBtNotifApiTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CBtNotifApiTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBtNotifApiTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CBtNotifApiTest(); + + 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. + */ + CBtNotifApiTest( 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 PairedDeviceSettingNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishPairedDeviceSettingQuery( CStifItemParser& aItem ); + + virtual TInt PbapAuthNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishPbapAuthQuery( CStifItemParser& aItem ); + + virtual TInt PasskeyDisplayNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishPasskeyDisplayQuery( CStifItemParser& aItem ); + + virtual TInt NumericComparisonQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishNumericComparisonQuery( CStifItemParser& aItem ); + + virtual TInt AuthQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishAuthQuery( CStifItemParser& aItem ); + + virtual TInt PinPasskeyQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishPinPasskeyQuery( CStifItemParser& aItem ); + + virtual TInt InquiryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishInquiry( CStifItemParser& aItem ); + + virtual TInt ObexPasskeyQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishObexPasskeyQuery( CStifItemParser& aItem ); + + virtual TInt PowerModeQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishPowerModeQuery( CStifItemParser& aItem ); + + virtual TInt GenericInfoNotifierTest( CStifItemParser& aItem ); + + virtual TInt GenericQueryNotifierTest( CStifItemParser& aItem ); + virtual TInt FinishGenericQuery( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + TInt GetGenericInfoNoteType( TPtrC aTypeString, TBTGenericInfoNoteType& aGenericInfoNoteType ); + TInt GetGenericQueryNoteType( TPtrC aTypeString, TBTGenericQueryNoteType& aGenericQueryNoteType ); + + TInt GetTestOption( TPtrC optionString, TTestOption& aOption ); + TInt TurnLightsOn( CStifItemParser& aItem ); + + //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 + + RNotifier* iNotifier; + + TPbapAuthNotifierResponsePckg iPbapAuthNotifierResponsePckg; + TBTDeviceResponseParamsPckg iBtDeviceResponseParamsPckg; + TPckgBuf iNumericComparisonQueryReply; + TBTPinCode iEnteredPinPasskey; + TBTPinCode iPinPasskey; + TObexPasskeyBuf iObexPasskeyBuf; + TObexPasskeyBuf iEnteredPasskeyBuf; + TPckgBuf iAuthQueryReply; + TPckgBuf iPowerModeQueryReply; + TPckgBuf iGenericQueryReply; + + + TRequestStatus iReqStatus; + TBuf iLocalDeviceName; + + CBtSettingsObserver* iBtSettings; + CBtEngDevManObserver* iBtEngDevManObserver; + CBTDeviceArray* iBtDeviceArray; + CBTDevice* iTestDevice; + + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // BTNOTIFAPITEST_H + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtSettingsObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/inc/BtSettingsObserver.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,69 @@ +/* +* 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 BTSETTINGSOBSERVER_H_ +#define BTSETTINGSOBSERVER_H_ + +#include +#include +#include + +NONSHARABLE_CLASS( CBtSettingsObserver ) : public CBase, + public MBTEngSettingsObserver + { +public: + /** + * Destructor. + */ + ~CBtSettingsObserver(); + + /** + * Two-phased constructor. + */ + static CBtSettingsObserver* NewL(); + + /** + * Two-phased constructor. + */ + static CBtSettingsObserver* NewLC(); + + TInt GetPowerState( TBTPowerStateValue& aState ); + TInt SetPowerState( TBTPowerStateValue aState ); + TInt GetVisibilityMode( TBTVisibilityMode& aMode ); + TInt SetVisibilityMode( TBTVisibilityMode aMode, TInt aTime = 0 ); + TInt GetLocalName( TDes& aName ); + TInt SetLocalName( const TDes& aName ); + +private: + + // From MBTEngSettingsObserver + void PowerStateChanged( TBTPowerStateValue aState ); + void VisibilityModeChanged( TBTVisibilityMode aState ); + + + CBtSettingsObserver(); + void ConstructL(); + + +private: //Data + + CBTEngSettings* iSettings; // Own. + CActiveSchedulerWait* iWaiter; //Own. + TInt iError; + }; + +#endif /*BTSETTINGSOBSERVER_H_*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/init/BtNotifApiTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/init/BtNotifApiTest.ini Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,218 @@ +# +# 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'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - 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= BtNotifApiTest + +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\ui_BtNotifApiTest.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 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/init/BtNotifApiTest_phone.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/init/BtNotifApiTest_phone.ini Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,218 @@ +# +# 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'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - 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= c:\logs\testframework\ +TestReportFileName= BtNotifApiTest + +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= c:\testframework\ui_BtNotifApiTest.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 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtEngDevManObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtEngDevManObserver.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "BtEngDevManObserver.h" + +CBtEngDevManObserver::CBtEngDevManObserver() + { + + } + +CBtEngDevManObserver::~CBtEngDevManObserver() + { + if( iWait->IsStarted() ) + { + iWait->AsyncStop(); + } + delete iWait; + iWait = NULL; + delete iDevMan; + iDevMan = NULL; + } + +CBtEngDevManObserver* CBtEngDevManObserver::NewLC() + { + CBtEngDevManObserver* self = new ( ELeave ) CBtEngDevManObserver(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CBtEngDevManObserver* CBtEngDevManObserver::NewL() + { + CBtEngDevManObserver* self = CBtEngDevManObserver::NewLC(); + CleanupStack::Pop(); // self; + return self; + } + +void CBtEngDevManObserver::ConstructL() + { + iWait = new ( ELeave ) CActiveSchedulerWait(); + iDevMan = CBTEngDevMan::NewL( this ); + } + +TInt CBtEngDevManObserver::GetDevices( const TBTRegistrySearch& aCriteria, + CBTDeviceArray* aResultArray ) + { + TInt res; + res = iDevMan -> GetDevices( aCriteria, aResultArray ); + if ( res != KErrNone ) + { + return res; + } + + iWait -> Start(); + + return KErrNone; + } + +TInt CBtEngDevManObserver::AddDevice( const CBTDevice& aDevice ) + { + TInt res; + res = iDevMan -> AddDevice( aDevice ); + if ( res != KErrNone ) + { + return res; + } + + iWait -> Start(); + + return KErrNone; + } + +TInt CBtEngDevManObserver::DeleteDevices( const TBTRegistrySearch& aCriteria ) + { + TInt res; + res = iDevMan -> DeleteDevices( aCriteria ); + if ( res != KErrNone ) + { + return res; + } + + iWait -> Start(); + + return KErrNone; + } + +void CBtEngDevManObserver::HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ) + { + iWait -> AsyncStop(); + } + +void CBtEngDevManObserver::HandleDevManComplete( TInt aErr ) + { + iWait -> AsyncStop(); + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtNotifApiTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtNotifApiTest.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,209 @@ +/* +* 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 "BtNotifApiTest.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 =============================== + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::CBtNotifApiTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBtNotifApiTest::CBtNotifApiTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBtNotifApiTest::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(KBtNotifApiTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KBtNotifApiTestLogFile); + } + + iLog = CStifLogger::NewL( KBtNotifApiTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + iNotifier = new ( ELeave ) RNotifier(); + iBtSettings = CBtSettingsObserver::NewL(); + iBtEngDevManObserver = CBtEngDevManObserver::NewL(); + iBtDeviceArray = new ( ELeave ) CBTDeviceArray( 1 ); + + iTestDevice = CBTDevice::NewL(); + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBtNotifApiTest* CBtNotifApiTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CBtNotifApiTest* self = new (ELeave) CBtNotifApiTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CBtNotifApiTest::~CBtNotifApiTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// CBtNotifApiTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CBtNotifApiTest::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("BtNotifApiTest.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* ) CBtNotifApiTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtNotifApiTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtNotifApiTestBlocks.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,1632 @@ +/* +* 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] - do not remove +#include +#include +#include +#include "BtNotifApiTest.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 =============================== + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CBtNotifApiTest::Delete() + { + delete iNotifier; + iNotifier = NULL; + delete iBtSettings; + iBtSettings = NULL; + delete iBtEngDevManObserver; + iBtEngDevManObserver = NULL; + delete iBtDeviceArray; + iBtDeviceArray = NULL; + delete iTestDevice; + iTestDevice = NULL; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CBtNotifApiTest::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( "PairedDeviceSettingNotifierTest", CBtNotifApiTest::PairedDeviceSettingNotifierTest ), + ENTRY( "FinishPairedDeviceSettingQuery", CBtNotifApiTest::FinishPairedDeviceSettingQuery ), + + ENTRY( "PbapAuthNotifierTest", CBtNotifApiTest::PbapAuthNotifierTest ), + ENTRY( "FinishPbapAuthQuery", CBtNotifApiTest::FinishPbapAuthQuery ), + + ENTRY( "PasskeyDisplayNotifierTest", CBtNotifApiTest::PasskeyDisplayNotifierTest ), + ENTRY( "FinishPasskeyDisplayQuery", CBtNotifApiTest::FinishPasskeyDisplayQuery ), + + ENTRY( "NumericComparisonQueryNotifierTest", CBtNotifApiTest::NumericComparisonQueryNotifierTest ), + ENTRY( "FinishNumericComparisonQuery", CBtNotifApiTest::FinishNumericComparisonQuery ), + + ENTRY( "AuthQueryNotifierTest", CBtNotifApiTest::AuthQueryNotifierTest ), + ENTRY( "FinishAuthQuery", CBtNotifApiTest::FinishAuthQuery ), + + ENTRY( "PinPasskeyQueryNotifierTest", CBtNotifApiTest::PinPasskeyQueryNotifierTest ), + ENTRY( "FinishPinPasskeyQuery", CBtNotifApiTest::FinishPinPasskeyQuery ), + + ENTRY( "InquiryNotifierTest", CBtNotifApiTest::InquiryNotifierTest ), + ENTRY( "FinishInquiry", CBtNotifApiTest::FinishInquiry ), + + ENTRY( "ObexPasskeyQueryNotifierTest", CBtNotifApiTest::ObexPasskeyQueryNotifierTest ), + ENTRY( "FinishObexPasskeyQuery", CBtNotifApiTest::FinishObexPasskeyQuery ), + + ENTRY( "PowerModeQueryNotifierTest", CBtNotifApiTest::PowerModeQueryNotifierTest ), + ENTRY( "FinishPowerModeQuery", CBtNotifApiTest::FinishPowerModeQuery ), + + ENTRY( "GenericInfoNotifierTest", CBtNotifApiTest::GenericInfoNotifierTest ), + + ENTRY( "GenericQueryNotifierTest", CBtNotifApiTest::GenericQueryNotifierTest ), + ENTRY( "FinishGenericQuery", CBtNotifApiTest::FinishGenericQuery ), + + ENTRY( "TurnLightsOn", CBtNotifApiTest::TurnLightsOn ), + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::PairedDeviceSettingNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::PairedDeviceSettingNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TBTRegistrySearch regSearch; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + regSearch.FindAll(); + res = iBtEngDevManObserver -> GetDevices( regSearch, iBtDeviceArray ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Getting devices from register failed with value: %d"), res ); + return res; + } + + if ( iBtDeviceArray -> Count() > 0 ) + { + iBtDeviceArray -> Reset(); + res = iBtEngDevManObserver -> DeleteDevices( regSearch ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Deleting devices from register failed with value: %d"), res ); + return res; + } + } + + TBTDevAddr addr( 0x12345678 ); + CBTDevice *testDevice = CBTDevice::NewL( addr ); + CleanupStack::PushL( testDevice ); + testDevice -> SetPaired( ELinkKeyAuthenticated ); + TTime time; + time.UniversalTime(); + testDevice -> SetUsed( time ); + testDevice -> SetDeviceNameL( _L8( "TestedDevice" ) ); + CleanupStack::Pop( testDevice ); + + res = iBtEngDevManObserver -> AddDevice( *testDevice ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Adding device to register failed with value: %d"), res ); + delete testDevice; + return res; + } + + TInt paramStatus = KErrNone; + TBTPairedDeviceSettingParams notifierParams; + notifierParams.iPairingStatus = paramStatus; + notifierParams.iRemoteAddr = testDevice -> BDAddr(); + TBTPairedDeviceSettingParamsPckg notifierParamsPckg( notifierParams ); + + TPckgBuf notifierResponsePckg; + + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTPairedDeviceSettingNotifierUid, notifierParamsPckg, notifierResponsePckg ); + iLog -> Log( _L("Notifier started") ); + + User::WaitForRequest( iReqStatus ); + + iLog -> Log( _L("Request status value: %d"), iReqStatus.Int() ); + iLog -> Log( _L("Input status value: %d"), notifierParams.iPairingStatus ); + iLog -> Log( _L("Pairing status value: %d"), notifierResponsePckg() ); + + delete testDevice; + iNotifier -> Close(); + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishPairedDeviceSettingQuery( CStifItemParser& aItem ) + { + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::PbapAuthNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::PbapAuthNotifierTest( CStifItemParser& aItem ) + { + TInt res; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + TPbapAuthNotifierParams notifierParams = TPbapAuthNotifierParams(); + TPbapAuthNotifierParamsPckg notifierParamsPckg( notifierParams ); + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KPbapAuthNotifierUid, notifierParamsPckg, iPbapAuthNotifierResponsePckg ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishPbapAuthQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TTestOption option; + TPbapAuthNotifierResponse expectedData; + + if ( !expectedData.SetPassword( _L( "0000" ) ) ) + { + iLog -> Log( _L("SetPassword failed") ); + iNotifier -> Close(); + return KErrGeneral; + } + + res = aItem.GetString( _L( "FinishPbapAuthQuery" ), optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + if ( iReqStatus.Int()!= KErrNone && iReqStatus.Int()!= KErrCancel ) + { + iLog -> Log( _L("Failed to get notifier's response: %d"), iReqStatus.Int() ); + iNotifier -> Close(); + return iReqStatus.Int(); + } + iLog -> Log( _L("Notifier responded") ); + + switch ( option ) + { + case ECheckPasskey: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Equal passkeys expected") ); + STIF_ASSERT_EQUALS( expectedData.Password(), iPbapAuthNotifierResponsePckg().Password() ); + break; + case EQueryCanceled: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::PasskeyDisplayNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::PasskeyDisplayNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TBTRegistrySearch regSearch; + TPtrC initOptionName( KNullDesC ); + TUint32 numericalValue = 999; + TBTPasskeyDisplayParams notifierParams; + TBTPasskeyDisplayParamsPckg emptyReplyPckg; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + regSearch.FindAll(); + res = iBtEngDevManObserver -> GetDevices( regSearch, iBtDeviceArray ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Getting devices from register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( iBtDeviceArray -> Count() > 0 ) + { + iBtDeviceArray -> Reset(); + res = iBtEngDevManObserver -> DeleteDevices( regSearch ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Deleting devices from register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + iTestDevice -> SetDeviceAddress( 0x12345678 ); + iTestDevice -> SetDeviceNameL( _L8( "Tested_Device" ) ); + iTestDevice -> SetFriendlyNameL( _L( "TestedDevice" ) ); + + res = iBtEngDevManObserver -> AddDevice( *iTestDevice ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Adding device to register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = aItem.GetString( _L( "PasskeyDisplayNotifierTest" ), initOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( !initOptionName.Compare( _L( "LOCAL" ) ) ) + { + iLog -> Log( _L("Locally initiated connection") ); + notifierParams = TBTPasskeyDisplayParams( iTestDevice -> BDAddr(), iTestDevice -> FriendlyName(), numericalValue, ETrue ); + } + else if ( !initOptionName.Compare( _L( "REMOTE" ) ) ) + { + iLog -> Log( _L("Remote side initiated connection") ); + notifierParams = TBTPasskeyDisplayParams( iTestDevice -> BDAddr(), iTestDevice -> FriendlyName(), numericalValue, EFalse ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + TBTPasskeyDisplayParamsPckg notifierParamsPckg( notifierParams ); + + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTPasskeyDisplayNotifierUid, notifierParamsPckg, emptyReplyPckg ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + +TInt CBtNotifApiTest::FinishPasskeyDisplayQuery( CStifItemParser& aItem ) + { + TInt res; + TBTRegistrySearch regSearch; + TPtrC deviceBlockOptionName( KNullDesC ); + + res = aItem.GetString( _L( "FinishPasskeyDisplayQuery" ), deviceBlockOptionName ); + + User::WaitForRequest( iReqStatus ); + + if ( !deviceBlockOptionName.Compare( _L( "BLOCK" ) ) ) + { + iLog -> Log( _L("Block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrAccessDenied ); + STIF_ASSERT_EQUALS( KErrAccessDenied, iReqStatus.Int() ); + } + else if ( !deviceBlockOptionName.Compare( _L( "NONBLOCK" ) ) ) + { + iLog -> Log( _L("Don't block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + else + { + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + + iBtDeviceArray -> Reset(); + res = iBtEngDevManObserver -> DeleteDevices( regSearch ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Deleting devices from register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::NumericComparisonQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::NumericComparisonQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TPtrC initOptionName( KNullDesC ); + TUint32 numericalValue = 999999; + TBTNumericComparisonParams notifierParams; + + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + res = aItem.GetString( _L( "NumericComparisonQueryNotifierTest" ), initOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( !initOptionName.Compare( _L( "LOCAL" ) ) ) + { + iLog -> Log( _L("Locally initiated connection") ); + notifierParams = TBTNumericComparisonParams( TBTDevAddr(), _L( "Test Device" ), numericalValue, TBTNumericComparisonParams::ERemoteCannotConfirm, ETrue ); + } + else if ( !initOptionName.Compare( _L( "REMOTE" ) ) ) + { + iLog -> Log( _L("Remote side initiated connection") ); + notifierParams = TBTNumericComparisonParams( TBTDevAddr(), _L( "Test Device" ), numericalValue, TBTNumericComparisonParams::ERemoteCannotConfirm, EFalse ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + TBTNumericComparisonParamsPckg notifierParamsPckg( notifierParams ); + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTNumericComparisonNotifierUid, notifierParamsPckg, iNumericComparisonQueryReply ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishNumericComparisonQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TPtrC deviceBlockOptionName( KNullDesC ); + TTestOption option; + + res = aItem.GetString( _L( "FinishNumericComparisonQuery" ), optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + if ( iReqStatus.Int()!= KErrNone && iReqStatus.Int()!= KErrCancel && iReqStatus.Int()!= KErrAccessDenied ) + { + iLog -> Log( _L("Failed to get notifier's response: %d"), iReqStatus.Int() ); + iNotifier -> Close(); + return iReqStatus.Int(); + } + iLog -> Log( _L("Notifier responded") ); + + switch ( option ) + { + case EQueryDiscarded: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %d, expected: %b"), iNumericComparisonQueryReply(), EFalse ); + STIF_ASSERT_FALSE( iNumericComparisonQueryReply() ); + break; + case EQueryAccepted: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %d, expected: %b"), iNumericComparisonQueryReply(), ETrue ); + STIF_ASSERT_TRUE( iNumericComparisonQueryReply() ); + break; + case EQueryCanceled: + res = aItem.GetNextString( deviceBlockOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( !deviceBlockOptionName.Compare( _L( "BLOCK" ) ) ) + { + iLog -> Log( _L("Block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrAccessDenied ); + STIF_ASSERT_EQUALS( KErrAccessDenied, iReqStatus.Int() ); + } + else if ( !deviceBlockOptionName.Compare( _L( "NONBLOCK" ) ) ) + { + iLog -> Log( _L("Don't block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::AuthQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::AuthQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + TBTAuthorisationParams notifierParams; + notifierParams.iName = _L( "Test Device" ); + TBTAuthorisationParamsPckg notifierParamsPckg( notifierParams ); + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTManAuthNotifierUid, notifierParamsPckg, iAuthQueryReply ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishAuthQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TPtrC deviceBlockOptionName( KNullDesC ); + TTestOption option; + + res = aItem.GetString( _L("FinishAuthQuery"), optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = aItem.GetNextString( deviceBlockOptionName ); + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + if ( iReqStatus.Int()!= KErrNone && iReqStatus.Int()!= KErrCancel && iReqStatus.Int()!= KErrAccessDenied ) + { + iLog -> Log( _L("Failed to get notifier's response: %d"), iReqStatus.Int() ); + iNotifier -> Close(); + return iReqStatus.Int(); + } + iLog -> Log( _L("Notifier responded") ); + + switch ( option ) + { + case EQueryDiscarded: + if ( !deviceBlockOptionName.Compare( _L( "BLOCK" ) ) ) + { + iLog -> Log( _L("Block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrAccessDenied ); + STIF_ASSERT_EQUALS( KErrAccessDenied, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iAuthQueryReply(), EFalse ); + STIF_ASSERT_FALSE( iAuthQueryReply() ); + } + else if ( !deviceBlockOptionName.Compare( _L( "NONBLOCK" ) ) ) + { + iLog -> Log( _L("Don't block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iAuthQueryReply(), EFalse ); + STIF_ASSERT_FALSE( iAuthQueryReply() ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + break; + case EQueryAccepted: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iAuthQueryReply(), ETrue ); + STIF_ASSERT_TRUE( iAuthQueryReply() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::PinPasskeyQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::PinPasskeyQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TPtrC initOptionName( KNullDesC ); + TUint pinCodeMinLength = 4; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + res = aItem.GetString( _L( "PinPasskeyQueryNotifierTest" ), initOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + TBTPinCodeEntryNotifierParams notifierParams; + + if ( !initOptionName.Compare( _L( "LOCAL" ) ) ) + { + iLog -> Log( _L("Locally initiated connection") ); + notifierParams = TBTPinCodeEntryNotifierParams( TBTDevAddr(), _L( "Test Device" ), pinCodeMinLength, ETrue, EFalse, pinCodeMinLength ); + } + else if ( !initOptionName.Compare( _L( "REMOTE" ) ) ) + { + iLog -> Log( _L("Remote side initiated connection") ); + notifierParams = TBTPinCodeEntryNotifierParams( TBTDevAddr(), _L( "Test Device" ), pinCodeMinLength, EFalse, EFalse, pinCodeMinLength ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + TBTPinCodeEntryNotifierParamsPckg notifierParamsPckg( notifierParams ); + + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTPinCodeEntryNotifierUid, notifierParamsPckg, iEnteredPinPasskey ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishPinPasskeyQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TPtrC connectionOptionName( KNullDesC ); + TPtrC deviceBlockOptionName( KNullDesC ); + TTestOption option; + TPINCodeV10 pinKey; + + pinKey.iLength = 4; + pinKey.iPIN[0] = '0'; + pinKey.iPIN[1] = '0'; + pinKey.iPIN[2] = '0'; + pinKey.iPIN[3] = '0'; + + for ( int i = pinKey.iLength; i< KHCIPINCodeSize; i++ ) + { + pinKey.iPIN[i] = NULL; + } + iPinPasskey = pinKey; + + res = aItem.GetString( _L( "FinishPinPasskeyQuery" ), optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + + switch( option ) + { + case ECheckPasskey: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Equal passkeys expected") ); + STIF_ASSERT_EQUALS( iPinPasskey, iEnteredPinPasskey ); + break; + case EQueryCanceled: + res = aItem.GetNextString( connectionOptionName ); + if ( res == KErrNone ) + { + if ( !connectionOptionName.Compare( _L( "DISCARDCONN" ) ) ) + { + res = aItem.GetNextString( deviceBlockOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( !deviceBlockOptionName.Compare( _L( "BLOCK" ) ) ) + { + iLog -> Log( _L("Block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrAccessDenied ); + STIF_ASSERT_EQUALS( KErrAccessDenied, iReqStatus.Int() ); + } + else if ( !deviceBlockOptionName.Compare( _L( "NONBLOCK" ) ) ) + { + iLog -> Log( _L("Don't block test device") ); + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + else + { + iLog -> Log( _L("Block connection option unavailable") ); + return KErrNotFound; + } + } + else if ( !connectionOptionName.Compare( _L( "ACCEPTCONN" ) ) ) + { + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + else + { + iLog -> Log( _L("Connection option unavailable") ); + return KErrNotFound; + } + } + else if ( res == KErrNotFound ) + { + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + } + else + return res; + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::InquiryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::InquiryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TPtrC initOptionName( KNullDesC ); + TBTRegistrySearch regSearch; + TBTPowerStateValue btPowerState; + TBTDeviceSelectionParamsPckg emptyNotifierParamsPckg; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + res = iBtSettings -> GetPowerState( btPowerState ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to get BT power state with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( btPowerState == EBTPowerOn ) + { + res = iBtSettings -> SetPowerState( EBTPowerOff ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set BT off with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + regSearch.FindAll(); + res = iBtEngDevManObserver -> GetDevices( regSearch, iBtDeviceArray ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Getting devices from register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( iBtDeviceArray -> Count() > 0 ) + { + iBtDeviceArray -> Reset(); + res = iBtEngDevManObserver -> DeleteDevices( regSearch ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Deleting devices from register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + res = aItem.GetString( _L( "InquiryNotifierTest" ), initOptionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( !initOptionName.Compare( _L( "BTOFF" ) ) ) + { + iLog -> Log( _L("Init test option: bt off") ); + } + else if ( !initOptionName.Compare( _L( "PAIRED" ) ) ) + { + iLog -> Log( _L("Init test option: paired test device") ); + iTestDevice -> SetDeviceAddress( 0x12345678 ); + iTestDevice -> SetPaired( ELinkKeyAuthenticated ); + TBTDeviceClass testDeviceClass( EMajorServiceLimitedDiscoverableMode, EMajorDeviceComputer, EMinorDeviceComputerUnclassified ); + iTestDevice -> SetDeviceClass( testDeviceClass ); + iTestDevice -> SetDeviceNameL( _L8( "TestedDevice" ) ); + + res = iBtEngDevManObserver -> AddDevice( *iTestDevice ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Adding device to register failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + else if ( !initOptionName.Compare( _L( "NONPAIRED" ) ) ) + { + iLog -> Log( _L("Init test option: test device not paired") ); + } + else + { + iLog -> Log( _L("Option unavailable") ); + iNotifier -> Close(); + return KErrNotFound; + } + + if ( initOptionName.Compare( _L( "BTOFF" ) ) ) + { + res = iBtSettings -> SetPowerState( EBTPowerOn ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set BT on with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KDeviceSelectionNotifierUid, emptyNotifierParamsPckg, iBtDeviceResponseParamsPckg ); + iLog -> Log( _L("Notifier started") ); + + User::After( 5000000 ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishInquiry( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TPtrC subOptionName( KNullDesC ); + TBTPowerStateValue btPowerState; + TTestOption option; + + res = aItem.GetString( _L( "FinishInquiry" ), optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = aItem.GetNextString( subOptionName ); + iLog -> Log( _L("GetString value: %d"), res ); + + if ( !subOptionName.Compare( _L( "BTOFF" ) ) ) + { + iLog -> Log( _L("Test suboption: set bt off") ); + iBtSettings -> SetPowerState( EBTPowerOff ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set BT off with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + + switch( option ) + { + case EQueryAccepted: + { + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + + HBufC16* inputDeviceNameBuf = HBufC16::New( iTestDevice -> DeviceName().Length() ); + TPtr16 inputDeviceName = inputDeviceNameBuf -> Des(); + inputDeviceName.Copy( iTestDevice -> DeviceName() ); + + HBufC16* outputDeviceNameBuf = HBufC16::New( iBtDeviceResponseParamsPckg().DeviceName().Length() ); + TPtr16 outputDeviceName = outputDeviceNameBuf -> Des(); + outputDeviceName.Copy( iBtDeviceResponseParamsPckg().DeviceName() ); + + iLog -> Log( _L( "Equal device addresses expected" ) ); + STIF_ASSERT_EQUALS( iTestDevice -> BDAddr(), iBtDeviceResponseParamsPckg().BDAddr() ); + iLog -> Log( _L( "Equal device names expected" ) ); + STIF_ASSERT_EQUALS( inputDeviceName, outputDeviceName ); + iLog -> Log( _L( "Equal device classes expected" ) ); + STIF_ASSERT_EQUALS( iTestDevice -> DeviceClass(), iBtDeviceResponseParamsPckg().DeviceClass() ); + + delete inputDeviceNameBuf; + delete outputDeviceNameBuf; + } + break; + case EQueryCanceled: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + res = iBtSettings -> GetPowerState( btPowerState ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to get BT power state with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + if ( btPowerState == EBTPowerOn ) + { + res = iBtSettings -> SetPowerState( EBTPowerOff ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set BT off with value: %d"), res ); + iNotifier -> Close(); + return res; + } + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::ObexPasskeyQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::ObexPasskeyQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TUint8 passCode[] = { "0000" }; + TBTObexPasskey passKey = passCode; + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + iObexPasskeyBuf = passKey; + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTObexPasskeyQueryNotifierUid, iObexPasskeyBuf, iEnteredPasskeyBuf ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishObexPasskeyQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TTestOption option; + + res = aItem.GetNextString( optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + switch( option ) + { + case ECheckPasskey: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Equal passkeys expected") ); + STIF_ASSERT_EQUALS( iObexPasskeyBuf(), iEnteredPasskeyBuf() ); + break; + case EQueryCanceled: + iLog -> Log( _L("Request status value: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::PowerModeQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::PowerModeQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TBTPowerStateValue state; + TBuf testDeviceName = _L( "Device Test Name" ); + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + + res = iBtSettings -> GetPowerState( state ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to get bt power state with value: %d"), res ); + return res; + } + + if ( state != EBTPowerOff ) + { + res = iBtSettings -> SetPowerState( EBTPowerOff ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set bt power state with value: %d"), res ); + return res; + } + } + + res = iBtSettings -> GetLocalName( iLocalDeviceName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed backup device name: %d"), res ); + return res; + } + + res = iBtSettings -> SetLocalName( testDeviceName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed set device name: %d"), res ); + return res; + } + + TPckgBuf emptyInput; + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KPowerModeSettingNotifierUid, emptyInput, iPowerModeQueryReply ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishPowerModeQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TTestOption option; + + res = aItem.GetNextString( optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + + if ( iReqStatus.Int()!= KErrNone && iReqStatus.Int()!= KErrCancel ) + { + iLog -> Log( _L("Failed to get notifier's response: %d"), iReqStatus.Int() ); + iNotifier -> Close(); + return iReqStatus.Int(); + } + iLog -> Log( _L("Notifier responded") ); + + iBtSettings -> SetLocalName( iLocalDeviceName ); + + switch ( option ) + { + case EQueryDiscarded: + iLog -> Log( _L("Returned request status: %d, expected: %d"), iReqStatus.Int(), KErrCancel ); + STIF_ASSERT_EQUALS( KErrCancel, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iPowerModeQueryReply(), EFalse ); + STIF_ASSERT_FALSE( iPowerModeQueryReply() ); + break; + case EQueryAccepted: + res = iBtSettings -> SetPowerState( EBTPowerOff ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to set bt power state off with value: %d"), res ); + return res; + } + iLog -> Log( _L("Returned request status: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iPowerModeQueryReply(), ETrue ); + STIF_ASSERT_TRUE( iPowerModeQueryReply() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::GenericInfoNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::GenericInfoNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TBTGenericInfoNotifierParams notifierParams; + TBTGenericInfoNoteType genericInfoNoteType; + TPtrC genericInfoNoteTypeString( KNullDesC ); + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + res = aItem.GetNextString( genericInfoNoteTypeString ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetGenericInfoNoteType( genericInfoNoteTypeString, genericInfoNoteType ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Generic info note type not found") ); + iNotifier -> Close(); + return res; + } + + notifierParams.iMessageType = genericInfoNoteType; + notifierParams.iRemoteAddr = _L8( "012345" ); + TBTGenericInfoNotiferParamsPckg messageInfo( notifierParams ); + TPckgBuf emptyReply; + + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTGenericInfoNotifierUid, messageInfo, emptyReply ); + iLog -> Log( _L("Notifier started") ); + User::WaitForRequest( iReqStatus ); + iLog -> Log( _L("Returned request status: %d, expected: %d"), iReqStatus.Int(), KErrNone ); + STIF_ASSERT_EQUALS( KErrNone, iReqStatus.Int() ); + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + + return KErrNone; + } + +TInt CBtNotifApiTest::GetGenericInfoNoteType( TPtrC aTypeString, TBTGenericInfoNoteType& aGenericInfoNoteType ) + { + if ( !aTypeString.Compare( _L( "EBTConnected" ) ) ) + { + aGenericInfoNoteType = EBTConnected; + iLog -> Log( _L("Generic info message type: EBTConnected") ); + } + else if ( !aTypeString.Compare( _L( "EBTDisconnected" ) ) ) + { + aGenericInfoNoteType = EBTDisconnected; + iLog -> Log( _L("Generic info message type: EBTDisconnected") ); + } + else if ( !aTypeString.Compare( _L( "EBTAudioAccessory" ) ) ) + { + aGenericInfoNoteType = EBTAudioAccessory; + iLog -> Log( _L("Generic info message type: EBTAudioAccessory") ); + } + else if ( !aTypeString.Compare( _L( "EBTAudioHandset" ) ) ) + { + aGenericInfoNoteType = EBTAudioHandset; + iLog -> Log( _L("Generic info message type: EBTAudioHandset") ); + } + else if ( !aTypeString.Compare( _L( "EBTClosed" ) ) ) + { + aGenericInfoNoteType = EBTClosed; + iLog -> Log( _L("Generic info message type: EBTClosed") ); + } + else if ( !aTypeString.Compare( _L( "EBTDeviceNotAvailable" ) ) ) + { + aGenericInfoNoteType = EBTDeviceNotAvailable; + iLog -> Log( _L("Generic info message type: EBTDeviceNotAvailable") ); + } + else if ( !aTypeString.Compare( _L( "EBTOfflineDisabled" ) ) ) + { + aGenericInfoNoteType = EBTOfflineDisabled; + iLog -> Log( _L("Generic info message type: EBTOfflineDisabled") ); + } + else if ( !aTypeString.Compare( _L( "EBTVisibilityTimeout" ) ) ) + { + aGenericInfoNoteType = EBTVisibilityTimeout; + iLog -> Log( _L("Generic info message type: EBTVisibilityTimeout") ); + } + else if ( !aTypeString.Compare( _L( "EBTEnterSap" ) ) ) + { + aGenericInfoNoteType = EBTEnterSap; + iLog -> Log( _L("Generic info message type: EBTEnterSap") ); + } + else if ( !aTypeString.Compare( _L( "EBTSapOk" ) ) ) + { + aGenericInfoNoteType = EBTSapOk; + iLog -> Log( _L("Generic info message type: EBTSapOk") ); + } + else if ( !aTypeString.Compare( _L( "EBTSapFailed" ) ) ) + { + aGenericInfoNoteType = EBTSapFailed; + iLog -> Log( _L("Generic info message type: EBTSapFailed") ); + } + else if ( !aTypeString.Compare( _L( "EBTSapNoSim" ) ) ) + { + aGenericInfoNoteType = EBTSapNoSim; + iLog -> Log( _L("Generic info message type: EBTSapNoSim") ); + } + else if ( !aTypeString.Compare( _L( "EBTDeviceBusy" ) ) ) + { + aGenericInfoNoteType = EBTDeviceBusy; + iLog -> Log( _L("Generic info message type: EBTDeviceBusy") ); + } + else if ( !aTypeString.Compare( _L( "EIRNotSupported" ) ) ) + { + aGenericInfoNoteType = EIRNotSupported; + iLog -> Log( _L("Generic info message type: EIRNotSupported") ); + } + else if ( !aTypeString.Compare( _L( "ECmdShowBtBatteryLow" ) ) ) + { + aGenericInfoNoteType = ECmdShowBtBatteryLow; + iLog -> Log( _L("Generic info message type: ECmdShowBtBatteryLow") ); + } + else if ( !aTypeString.Compare( _L( "ECmdShowBtBatteryCritical" ) ) ) + { + aGenericInfoNoteType = ECmdShowBtBatteryCritical; + iLog -> Log( _L("Generic info message type: ECmdShowBtBatteryCritical") ); + } + else if ( !aTypeString.Compare( _L( "EBTStayPowerOn" ) ) ) + { + aGenericInfoNoteType = EBTStayPowerOn; + iLog -> Log( _L("Generic info message type: EBTStayPowerOn") ); + } + else + { + iLog -> Log( _L("Generic info message type: No type matched") ); + return KErrNotFound; + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::GenericQueryNotifierTests +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::GenericQueryNotifierTest( CStifItemParser& aItem ) + { + TInt res; + TBTGenericQueryNotifierParams notifierParams; + TBTGenericQueryNoteType genericQueryNoteType; + TPtrC genericQueryNoteTypeString( KNullDesC ); + + res = iNotifier -> Connect(); + if ( res != KErrNone ) + { + iLog -> Log( _L("Failed to connect RNotifier with value: %d"), res ); + return res; + } + iLog -> Log( _L("RNotifier connected") ); + + res = aItem.GetNextString( genericQueryNoteTypeString ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetGenericQueryNoteType( genericQueryNoteTypeString, genericQueryNoteType ); + if ( res != KErrNone ) + { + iLog -> Log( _L("Generic query note type not found") ); + iNotifier -> Close(); + return res; + } + + notifierParams.iMessageType = genericQueryNoteType; + notifierParams.iNameExists = EFalse; + TBTGenericQueryNotiferParamsPckg messageInfo( notifierParams ); + iNotifier -> StartNotifierAndGetResponse( iReqStatus, KBTGenericQueryNotifierUid, messageInfo, iGenericQueryReply ); + iLog -> Log( _L("Notifier started") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::FinishGenericQuery( CStifItemParser& aItem ) + { + TInt res; + TPtrC optionName( KNullDesC ); + TTestOption option; + + res = aItem.GetNextString( optionName ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetNextString failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + res = GetTestOption( optionName, option ); + if ( res != KErrNone ) + { + iLog -> Log( _L("GetTestOption failed with value: %d"), res ); + iNotifier -> Close(); + return res; + } + + User::WaitForRequest( iReqStatus ); + if ( iReqStatus.Int()!= KErrNone ) + { + iLog -> Log( _L("Failed to get notifier's response: %d"), iReqStatus.Int() ); + iNotifier -> Close(); + return iReqStatus.Int(); + } + iLog -> Log( _L("Notifier responded") ); + + switch ( option ) + { + case EQueryDiscarded: + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iGenericQueryReply(), EFalse ); + STIF_ASSERT_FALSE( iGenericQueryReply() ); + break; + case EQueryAccepted: + iLog -> Log( _L("Notifier's response value: %b, expected: %b"), iGenericQueryReply(), ETrue ); + STIF_ASSERT_TRUE( iGenericQueryReply() ); + break; + default: + iLog -> Log( _L("Option unavailable") ); + return KErrNotFound; + } + + iNotifier -> Close(); + iLog -> Log( _L("Test case passed") ); + + return KErrNone; + } + + +TInt CBtNotifApiTest::GetGenericQueryNoteType( TPtrC aTypeString, TBTGenericQueryNoteType& aGenericQueryNoteType ) + { + if ( !aTypeString.Compare( _L( "EBTReceiveMessageQuery" ) ) ) + { + aGenericQueryNoteType = EBTReceiveMessageQuery; + iLog -> Log( _L("Generic query message type: EBTReceiveMessageQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTReceiveMessagePairedQuery" ) ) ) + { + aGenericQueryNoteType = EBTReceiveMessagePairedQuery; + iLog -> Log( _L("Generic query message type: EBTReceiveMessagePairedQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTIsOffQuery" ) ) ) + { + aGenericQueryNoteType = EBTIsOffQuery; + iLog -> Log( _L("Generic query message type: EBTIsOffQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTActivateOffLineQuery" ) ) ) + { + aGenericQueryNoteType = EBTActivateOffLineQuery; + iLog -> Log( _L("Generic query message type: EBTActivateOffLineQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTNoDevicesFoundQuery" ) ) ) + { + aGenericQueryNoteType = EBTNoDevicesFoundQuery; + iLog -> Log( _L("Generic query message type: EBTNoDevicesFoundQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTAcceptRequestQuery" ) ) ) + { + aGenericQueryNoteType = EBTAcceptRequestQuery; + iLog -> Log( _L("Generic query message type: EBTAcceptRequestQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTBlockConnectionQuery" ) ) ) + { + aGenericQueryNoteType = EBTBlockConnectionQuery; + iLog -> Log( _L("Generic query message type: EBTBlockConnectionQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTBlockPairedConnectionQuery" ) ) ) + { + aGenericQueryNoteType = EBTBlockPairedConnectionQuery; + iLog -> Log( _L("Generic query message type: EBTBlockPairedConnectionQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTIsNotShownQuery" ) ) ) + { + aGenericQueryNoteType = EBTIsNotShownQuery; + iLog -> Log( _L("Generic query message type: EBTIsNotShownQuery") ); + } + else if ( !aTypeString.Compare( _L( "EBTIsOffJavaQuery" ) ) ) + { + aGenericQueryNoteType = EBTIsOffJavaQuery; + iLog -> Log( _L("Generic query message type: EBTIsOffJavaQuery") ); + } + else + { + iLog -> Log( _L("Generic query message type: No type matched") ); + return KErrNotFound; + } + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CBtNotifApiTest::GetTestOption +// ----------------------------------------------------------------------------- +// + +TInt CBtNotifApiTest::GetTestOption( TPtrC aOptionString, TTestOption& aOption ) + { + if ( !aOptionString.Compare( _L( "DISCARD" ) ) ) + { + aOption = EQueryDiscarded; + iLog -> Log( _L("Test type: EQueryDiscarded") ); + } + else if ( !aOptionString.Compare( _L( "ACCEPT" ) ) ) + { + aOption = EQueryAccepted; + iLog -> Log( _L("Test type: EQueryAccepted") ); + } + else if ( !aOptionString.Compare( _L( "PASSKEY" ) ) ) + { + aOption = ECheckPasskey; + iLog -> Log( _L("Test type: ECheckPasskey") ); + } + else if ( !aOptionString.Compare( _L( "CANCEL" ) ) ) + { + aOption = EQueryCanceled; + iLog -> Log( _L("Test type: EQueryCanceled") ); + } + else + return KErrNotFound; + + return KErrNone; + } + +TInt CBtNotifApiTest::TurnLightsOn( CStifItemParser& aItem ) + { + TInt res; + res = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn); + return res; + } + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtSettingsObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/tsrc/BtNotifApiTest/src/BtSettingsObserver.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,133 @@ +/* +* 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 "BtSettingsObserver.h" + +CBtSettingsObserver::CBtSettingsObserver() + { + } + +CBtSettingsObserver::~CBtSettingsObserver() + { + delete iSettings; + if( iWaiter->IsStarted() ) + { + iWaiter->AsyncStop(); + } + delete iWaiter; + } + +CBtSettingsObserver* CBtSettingsObserver::NewLC() + { + CBtSettingsObserver* self = new ( ELeave ) CBtSettingsObserver(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CBtSettingsObserver* CBtSettingsObserver::NewL() + { + CBtSettingsObserver* self = CBtSettingsObserver::NewLC(); + CleanupStack::Pop(); // self; + return self; + } + +void CBtSettingsObserver::ConstructL() + { + iWaiter = new ( ELeave ) CActiveSchedulerWait(); + iSettings = CBTEngSettings::NewL( this ); + iError = KErrNone; + } + +void CBtSettingsObserver::PowerStateChanged( TBTPowerStateValue /*aState*/ ) + { + if( iWaiter->IsStarted() ) + { + iWaiter->AsyncStop(); + } + } + +void CBtSettingsObserver::VisibilityModeChanged( TBTVisibilityMode /*aState*/ ) + { + if( iWaiter->IsStarted() ) + { + iWaiter->AsyncStop(); + } + } + +TInt CBtSettingsObserver::GetPowerState( TBTPowerStateValue& aState ) + { + iError = iSettings->GetPowerState( aState ); + return iError; + } + +TInt CBtSettingsObserver::SetPowerState( TBTPowerStateValue aState ) + { + TBTPowerStateValue state; + + iError = iSettings->GetPowerState( state ); + if( iError ) + { + return iError; + } + else if( state != aState ) + { + if( state == EBTPowerOff ) + { + iError = iSettings->SetPowerState( EBTPowerOn ); + } + else + { + iError = iSettings->SetPowerState( EBTPowerOff ); + } + + if( iError ) + { + return iError; + } + else + { + if ( !iWaiter->IsStarted() ) + { + iWaiter->Start(); + } + } + } + return iError; + } + +TInt CBtSettingsObserver::GetVisibilityMode( TBTVisibilityMode& /*aMode*/ ) + { + return KErrNone; + } + +TInt CBtSettingsObserver::SetVisibilityMode( TBTVisibilityMode /*aMode*/, TInt /*aTime*/ ) + { + return KErrNone; + } + +TInt CBtSettingsObserver::GetLocalName( TDes& aName ) + { + iError = iSettings -> GetLocalName( aName ); + return iError; + } + +TInt CBtSettingsObserver::SetLocalName( const TDes& aName ) + { + iError = iSettings -> SetLocalName( aName ); + return iError; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btsap/src/BTSapSniffHandler.cpp --- a/bluetoothengine/btsap/src/BTSapSniffHandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btsap/src/BTSapSniffHandler.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -98,7 +98,7 @@ if(iIsLinkAdapterOpen) { // Start the sniffer timer - BTSAP_TRACE_OPT(KBTSAP_TRACE_INFO, BTSapPrintTrace(_L("[BTSap] CBTSapSniffHandler::Enable: Starting the sniff timer %d microseconds"), KSniffInterval)); + BTSAP_TRACE_OPT(KBTSAP_TRACE_INFO, BTSapPrintTrace(_L("[BTSap] CBTSapSniffHandler::Enable: Starting the sniff timer %d µsec"), KSniffInterval)); Cancel(); After(KSniffInterval); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/bwins/btserviceutilu.def --- a/bluetoothengine/btserviceutil/bwins/btserviceutilu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -EXPORTS - ?CopyL@CBtDevExtension@@QAEPAV1@XZ @ 1 NONAME ; class CBtDevExtension * CBtDevExtension::CopyL(void) - ?GoActive@CBtSimpleActive@@QAEXXZ @ 2 NONAME ; void CBtSimpleActive::GoActive(void) - ?IsUserAwareBonded@CBtDevExtension@@QBEHXZ @ 3 NONAME ; int CBtDevExtension::IsUserAwareBonded(void) const - ?IsUserAwareBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 4 NONAME ; int CBtDevExtension::IsUserAwareBonded(class TBTNamelessDevice const &) - ?NewL@CBtSimpleActive@@SAPAV1@AAVMBtSimpleActiveObserver@@HH@Z @ 5 NONAME ; class CBtSimpleActive * CBtSimpleActive::NewL(class MBtSimpleActiveObserver &, int, int) - ?AllDevices@CBtDevRepository@@QBEABV?$RPointerArray@VCBtDevExtension@@@@XZ @ 6 NONAME ; class RPointerArray const & CBtDevRepository::AllDevices(void) const - ?IsBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 7 NONAME ; int CBtDevExtension::IsBonded(class TBTNamelessDevice const &) - ?RemoveObserver@CBtDevRepository@@QAEXPAVMBtDevRepositoryObserver@@@Z @ 8 NONAME ; void CBtDevRepository::RemoveObserver(class MBtDevRepositoryObserver *) - ?AddObserverL@CBtDevRepository@@QAEXPAVMBtDevRepositoryObserver@@@Z @ 9 NONAME ; void CBtDevRepository::AddObserverL(class MBtDevRepositoryObserver *) - ?SetRequestId@CBtSimpleActive@@QAEXH@Z @ 10 NONAME ; void CBtSimpleActive::SetRequestId(int) - ?SetDeviceL@CBtDevExtension@@QAEXPAVCBTDevice@@@Z @ 11 NONAME ; void CBtDevExtension::SetDeviceL(class CBTDevice *) - ??1CBtDevRepository@@UAE@XZ @ 12 NONAME ; CBtDevRepository::~CBtDevRepository(void) - ?SetObserver@CAdvanceDevDiscoverer@@QAEXAAVMDevDiscoveryObserver@@@Z @ 13 NONAME ; void CAdvanceDevDiscoverer::SetObserver(class MDevDiscoveryObserver &) - ?RequestStatus@CBtSimpleActive@@QAEAAVTRequestStatus@@XZ @ 14 NONAME ; class TRequestStatus & CBtSimpleActive::RequestStatus(void) - ??1CAdvanceDevDiscoverer@@UAE@XZ @ 15 NONAME ; CAdvanceDevDiscoverer::~CAdvanceDevDiscoverer(void) - ?Alias@CBtDevExtension@@QBEABVTDesC16@@XZ @ 16 NONAME ; class TDesC16 const & CBtDevExtension::Alias(void) const - ?NewL@CAdvanceDevDiscoverer@@SAPAV1@AAVCBtDevRepository@@AAVMDevDiscoveryObserver@@@Z @ 17 NONAME ; class CAdvanceDevDiscoverer * CAdvanceDevDiscoverer::NewL(class CBtDevRepository &, class MDevDiscoveryObserver &) - ?ServiceConnectionStatus@CBtDevExtension@@QBE?AW4TBTEngConnectionStatus@@XZ @ 18 NONAME ; enum TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus(void) const - ?NewLC@CBtDevExtension@@SAPAV1@ABVTInquirySockAddr@@ABVTDesC16@@W4TDefaultDevNameOption@@@Z @ 19 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class TInquirySockAddr const &, class TDesC16 const &, enum TDefaultDevNameOption) - ??1CBtDevExtension@@UAE@XZ @ 20 NONAME ; CBtDevExtension::~CBtDevExtension(void) - ?DiscoverDeviceL@CAdvanceDevDiscoverer@@QAEXW4TDevDiscoveryFilter@1@W4TBTMajorDeviceClass@@@Z @ 21 NONAME ; void CAdvanceDevDiscoverer::DiscoverDeviceL(enum CAdvanceDevDiscoverer::TDevDiscoveryFilter, enum TBTMajorDeviceClass) - ?NewLC@CBtDevExtension@@SAPAV1@PAVCBTDevice@@W4TDefaultDevNameOption@@@Z @ 22 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class CBTDevice *, enum TDefaultDevNameOption) - ?IsJustWorksBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 23 NONAME ; int CBtDevExtension::IsJustWorksBonded(class TBTNamelessDevice const &) - ?Device@CBtDevExtension@@QBEABVCBTDevice@@XZ @ 24 NONAME ; class CBTDevice const & CBtDevExtension::Device(void) const - ?RequestId@CBtSimpleActive@@QAEHXZ @ 25 NONAME ; int CBtSimpleActive::RequestId(void) - ?IsInitialized@CBtDevRepository@@QBEHXZ @ 26 NONAME ; int CBtDevRepository::IsInitialized(void) const - ?Addr@CBtDevExtension@@QBEABVTBTDevAddr@@XZ @ 27 NONAME ; class TBTDevAddr const & CBtDevExtension::Addr(void) const - ?CancelDiscovery@CAdvanceDevDiscoverer@@QAEXXZ @ 28 NONAME ; void CAdvanceDevDiscoverer::CancelDiscovery(void) - ?NewL@CBtDevRepository@@SAPAV1@XZ @ 29 NONAME ; class CBtDevRepository * CBtDevRepository::NewL(void) - ??1CBtSimpleActive@@UAE@XZ @ 30 NONAME ; CBtSimpleActive::~CBtSimpleActive(void) - ?Device@CBtDevRepository@@QBEPBVCBtDevExtension@@ABVTBTDevAddr@@@Z @ 31 NONAME ; class CBtDevExtension const * CBtDevRepository::Device(class TBTDevAddr const &) const - ?ReInitialize@CBtDevRepository@@QAEXXZ @ 32 NONAME ; void CBtDevRepository::ReInitialize(void) - ?IsHeadset@CBtDevExtension@@SAHABVTBTDeviceClass@@@Z @ 33 NONAME ; int CBtDevExtension::IsHeadset(class TBTDeviceClass const &) - ?NewLC@CBtDevExtension@@SAPAV1@ABVTBTDevAddr@@ABVTDesC16@@W4TDefaultDevNameOption@@@Z @ 34 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class TBTDevAddr const &, class TDesC16 const &, enum TDefaultDevNameOption) - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/eabi/btserviceutilu.def --- a/bluetoothengine/btserviceutil/eabi/btserviceutilu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -EXPORTS - _ZN15CBtDevExtension10SetDeviceLEP9CBTDevice @ 1 NONAME - _ZN15CBtDevExtension5CopyLEv @ 2 NONAME - _ZN15CBtDevExtension5NewLCEP9CBTDevice21TDefaultDevNameOption @ 3 NONAME - _ZN15CBtDevExtension5NewLCERK16TInquirySockAddrRK7TDesC1621TDefaultDevNameOption @ 4 NONAME - _ZN15CBtDevExtensionD0Ev @ 5 NONAME - _ZN15CBtDevExtensionD1Ev @ 6 NONAME - _ZN15CBtDevExtensionD2Ev @ 7 NONAME - _ZN15CBtSimpleActive12SetRequestIdEi @ 8 NONAME - _ZN15CBtSimpleActive13RequestStatusEv @ 9 NONAME - _ZN15CBtSimpleActive4NewLER23MBtSimpleActiveObserverii @ 10 NONAME - _ZN15CBtSimpleActive8GoActiveEv @ 11 NONAME - _ZN15CBtSimpleActive9RequestIdEv @ 12 NONAME - _ZN15CBtSimpleActiveD0Ev @ 13 NONAME - _ZN15CBtSimpleActiveD1Ev @ 14 NONAME - _ZN15CBtSimpleActiveD2Ev @ 15 NONAME - _ZN16CBtDevRepository12AddObserverLEP24MBtDevRepositoryObserver @ 16 NONAME - _ZN16CBtDevRepository14RemoveObserverEP24MBtDevRepositoryObserver @ 17 NONAME - _ZN16CBtDevRepository4NewLEv @ 18 NONAME - _ZN16CBtDevRepositoryD0Ev @ 19 NONAME - _ZN16CBtDevRepositoryD1Ev @ 20 NONAME - _ZN16CBtDevRepositoryD2Ev @ 21 NONAME - _ZN21CAdvanceDevDiscoverer11SetObserverER21MDevDiscoveryObserver @ 22 NONAME - _ZN21CAdvanceDevDiscoverer15CancelDiscoveryEv @ 23 NONAME - _ZN21CAdvanceDevDiscoverer15DiscoverDeviceLENS_19TDevDiscoveryFilterE19TBTMajorDeviceClass @ 24 NONAME - _ZN21CAdvanceDevDiscoverer4NewLER16CBtDevRepositoryR21MDevDiscoveryObserver @ 25 NONAME - _ZN21CAdvanceDevDiscovererD0Ev @ 26 NONAME - _ZN21CAdvanceDevDiscovererD1Ev @ 27 NONAME - _ZN21CAdvanceDevDiscovererD2Ev @ 28 NONAME - _ZNK15CBtDevExtension17IsUserAwareBondedEv @ 29 NONAME - _ZNK15CBtDevExtension4AddrEv @ 30 NONAME - _ZNK15CBtDevExtension5AliasEv @ 31 NONAME - _ZNK15CBtDevExtension6DeviceEv @ 32 NONAME - _ZNK16CBtDevRepository10AllDevicesEv @ 33 NONAME - _ZNK16CBtDevRepository13IsInitializedEv @ 34 NONAME - _ZNK16CBtDevRepository6DeviceERK10TBTDevAddr @ 35 NONAME - _ZNK15CBtDevExtension23ServiceConnectionStatusEv @ 36 NONAME - _ZN16CBtDevRepository12ReInitializeEv @ 37 NONAME - _ZN15CBtDevExtension17IsJustWorksBondedERK17TBTNamelessDevice @ 38 NONAME - _ZN15CBtDevExtension17IsUserAwareBondedERK17TBTNamelessDevice @ 39 NONAME - _ZN15CBtDevExtension8IsBondedERK17TBTNamelessDevice @ 40 NONAME - _ZN15CBtDevExtension9IsHeadsetERK14TBTDeviceClass @ 41 NONAME - _ZN15CBtDevExtension5NewLCERK10TBTDevAddrRK7TDesC1621TDefaultDevNameOption @ 42 NONAME - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/export/advancedevdiscoverer.h --- a/bluetoothengine/btserviceutil/export/advancedevdiscoverer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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: Declares Bluetooth device inquiry helper class. -* -*/ - -#ifndef ADVANCEBTDEVDISCOVERER_H -#define ADVANCEBTDEVDISCOVERER_H - -#include -#include -#include -#include - -class CAdvanceDevDiscovererImpl; - -/** - * APIs from this class offer functionalities that are common in mw and app - * components of Bluetooth packages. They do not serve as domain APIs. - * - * Using these from external components is risky, due to possible source - * and binary breaks in future. - * - */ - -/** -* The interface of discovering in-range Bluetooth devices via Host Resolver. -* This class offers some options to search certain devices by CoD and other -* filters e.g., bonded and blocked. -* -* It requires the client to supply a CBtDevRepository instance for filtering -* devices. -*/ -NONSHARABLE_CLASS( CAdvanceDevDiscoverer ) : public CBase - { - -public: // Constructor and destructor - - /** - * Options for clients to specify criteria on discovered devices. - */ - enum TDevDiscoveryFilter - { - // do not filter in-range devices - ENoFilter = 0, - - // Excludes an in-range device if its device name is not available - ExcludeIfNoDevName = 0x01, - - // Excludes an in-range device if it is user-aware bonded with phone. - ExcludeUserAwareBonded = 0x02, - - // Excludes an in-range device if it is banned by phone. - ExcludeBanned = 0x04, - }; - - IMPORT_C static CAdvanceDevDiscoverer* NewL( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CAdvanceDevDiscoverer(); - - /** - * sets the discovery result receiver. - * - * @param aObserver the new observer to receive inquiry results - */ - IMPORT_C void SetObserver( MDevDiscoveryObserver& aObserver ); - - /** - * Discover currently in-range devices that matches the given major - * device class type. - - * Found devices will be informed by - * MBtDevDiscoveryObserver::HandleNextDiscoveryResult(). - * - * When no more device can be found, - * MBtDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued. - * - * @param aFilter the filter that shall be applied when a device - * is discovered. If this is specified, only a device passing - * the filter will be informed to client. - * By default, no filter is applied. - * - * @param aDeviceClass the major device class which a found device - * must match. - * By default, it includes any device types. - */ - IMPORT_C void DiscoverDeviceL( - TDevDiscoveryFilter aFilter = CAdvanceDevDiscoverer::ENoFilter, - TBTMajorDeviceClass aDeviceClass = EMajorDeviceMisc ); - - /** - * Cancels any outstanding discovery request. - */ - IMPORT_C void CancelDiscovery(); - -private: - - /** - * C++ default constructor. - */ - CAdvanceDevDiscoverer(); - - /** - * The 2nd phase constructor - */ - void ConstructL( CBtDevRepository& aDevRep, MDevDiscoveryObserver& aObserver ); - -private: // Data - - CAdvanceDevDiscovererImpl* iImpl; -}; - -#endif - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/export/btdevextension.h --- a/bluetoothengine/btserviceutil/export/btdevextension.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +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: an extended BT device offering properties of -* a Bluetooth device that may be needed by Bluetooth UIs -* -*/ - -#ifndef BTDEVEXTENSION_H -#define BTDEVEXTENSION_H - -#include -#include -#include -#include - -/** - * APIs from this class offer functionalities that are common in mw and app - * components of Bluetooth packages. They do not serve as domain APIs. - * - * Using these from external components is risky, due to possible source - * and binary breaks in future. - * - */ - -/** - * The option for specify the default name for a BT device in - * case the device has neither a device name nor a friendly name. - */ -enum TDefaultDevNameOption - { - ENoDefaultName, - EColonSeperatedBDAddr, // device name will be formated - EPlainBDAddr, - }; - -/** - * Class CBtDevExtension - * - * This class provides the access to the properties of devices from BT registry. - * In addition, it provides other dynamic properties such as the connection - * and proximity statuses. Note that client should not store the dynamic - * properties for future use since they may change frequently. - * - */ -NONSHARABLE_CLASS( CBtDevExtension ) : public CBase - { - -public: - // placeholder for providing more properties of a device - enum TBtDevStatus - { - EUndefinedStatus, - EInRangUnknown = 0x01, - EInRange = 0x02, - EPermanentInRegistry = 0x04, - }; - - /** - * Two-phase constructor - * @param aDev a CBTDevice instance. The ownership is transferred. - * @param aNameOption the option for formating the default device - * name when the given aDev instance has no valid name. - */ - IMPORT_C static CBtDevExtension* NewLC( CBTDevice* aDev, - TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr ); - - /** - * Two-phase constructor - * @param aAddr the inquiry socket address of the device. - * @param aName the device-name of the device. - * @param aNameOption the option for formating the default device - * name when the given name is empty. - */ - IMPORT_C static CBtDevExtension* NewLC( - const TInquirySockAddr& aAddr, - const TDesC& aName = KNullDesC, - TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr ); - - /** - * Two-phase constructor - * @param aAddr the bd_addr of the device. - * @param aName the device-name of the device. - * @param aNameOption the option for formating the default device - * name when the given name is empty. - */ - IMPORT_C static CBtDevExtension* NewLC( - const TBTDevAddr& aAddr, - const TDesC& aName = KNullDesC, - TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr ); - - /** - * Destructor - */ - IMPORT_C virtual ~CBtDevExtension(); - - /** - * Tells if the given device is bonded regardless of whether the pairing was - * performed under user awareness. - * - * @return ETrue if it is bonded. - */ - IMPORT_C static TBool IsBonded( const TBTNamelessDevice &dev ); - - /** - * Tells if the given device is bonded with the Just Works pairing model. - * - * @return ETrue if it is bonded and the pairing was performed with Just Works. - */ - IMPORT_C static TBool IsJustWorksBonded( const TBTNamelessDevice &dev ); - - /** - * Tells if the given device has been bonded under user awareness. - * User awareness refers that the user interacted or was informed during or - * immediately after the pairing completed. - * - * @return ETrue if the user is aware of the bonding. - */ - IMPORT_C static TBool IsUserAwareBonded( const TBTNamelessDevice &dev ); - - /** - * Guesses if the given device is a headset. - * - * @param the Class of Device of the device of which the type is - * determined. - * @return ETrue if it is probably a headset. EFalse otherwise. - */ - IMPORT_C static TBool IsHeadset( const TBTDeviceClass &aCod ); - - /** - * Returns the display name of this device for end users. - * @return the friendly name of the device if it is available; else, the device - * name if it is available; otherwise, the BDADDR seperated with ":". - */ - IMPORT_C const TDesC& Alias() const; - - /** - * Gets the device address. - * @return the device. - */ - IMPORT_C const TBTDevAddr& Addr() const; - - /** - * Gets the CBTDevice instance. - * @return the device. - */ - IMPORT_C const CBTDevice& Device() const; - - /** - * Checks if this device was bonded under user awareness. - * @return ETrue if it is user-aware bonded. - */ - IMPORT_C TBool IsUserAwareBonded() const; - - /** - * - * Returns the service (limited to services managed in bteng scope) - * level connection status of the specified device. - * - * @param aAddr the address of the device - * @return one of TBTEngConnectionStatus enums - */ - IMPORT_C TBTEngConnectionStatus ServiceConnectionStatus() const; - - /** - * Sets a device. The ownership is transferred. - * - * @param aDev the device to be set. - */ - IMPORT_C void SetDeviceL( CBTDevice* aDev ); - - /** - * Make a copy of this evice. - * - * @return a new device instance. - */ - IMPORT_C CBtDevExtension* CopyL(); - -public: - - /** - * Internally invoked in this module, not a DLL level API. - * - * Sets the service connection status of this device. - */ - void SetServiceConnectionStatus( TBTEngConnectionStatus aStatus ); - -private: - - /** - * C++ default constructor - */ - CBtDevExtension( TDefaultDevNameOption aNameOption ); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL( CBTDevice* aDev ); - - /** - * Update device properties due to setDeviceL or other events. - */ - void UpdateNameL(); - - /** - * Update the service connection status for this device: - */ - //void UpdateServiceStatusL(); - - /** - * formats the BD_Addr as the device name. - */ - void FormatAddressAsNameL(); - -private: - - RBuf iAlias; // contains: - // friendly name, if it is not empty; else - // device name, if it is not empty; else - // the assignment depending on the option chosen by client. - - // The Device instance ( in most case it is given by registry) - CBTDevice* iDev; - - // The bits of dynamic status - TInt iDynamicStatus; - - // Indicates the service connection status of this device - TBTEngConnectionStatus iServiceStatus; - - // The option chosen by the client to deal with default BT name assignment. - TDefaultDevNameOption iNameOption; - }; - -typedef RPointerArray RDevExtensionArray; - -#endif /*BTDEVEXTENSION_H*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/export/btdevrepository.h --- a/bluetoothengine/btserviceutil/export/btdevrepository.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +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: The repository of remote devices from BT registry -* -*/ - -#ifndef BTDEVICEREPOSITORY_H -#define BTDEVICEREPOSITORY_H - -#include -#include -#include - -class CBtDevRepositoryImpl; - -/** - * APIs from this class offer functionalities that are common in mw and app - * components of Bluetooth packages. They do not serve as domain APIs. - * - * Using these from external components is risky, due to possible source - * and binary breaks in future. - * - */ - -/** - * Class MBtDevRepositoryObserver - * - * Callback class to notify changes in BT registry. - */ -class MBtDevRepositoryObserver - { -public: - - /** - * Callback to notify that the repository has finished initialization. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - * - */ - virtual void RepositoryInitialized() = 0; - - /** - * Callback to notify that a device has been deleted from BT registry. - * - * - * @param aAddr the bd_addr of the deleted device - */ - virtual void DeletedFromRegistry( const TBTDevAddr& aAddr ) = 0; - - /** - * Callback to notify that the device has been added to BT registry. - * - * @param aDevice the device that has been added to registry - */ - virtual void AddedToRegistry( const CBtDevExtension& aDevice ) = 0; - - /** - * Callback to notify that the property of a device in BT registry has been - * changed. - * - * @param aDevice the device that possesses the latest properties. - * @param aSimilarity the similarity of the properties comparing to the ones - * prior to this change. - * Refer CBTDevice::TBTDeviceNameSelector and - * TBTNamelessDevice::TBTDeviceSet for the meanings of the bits - * in this parameter. - */ - virtual void ChangedInRegistry( - const CBtDevExtension& aDevice, TUint aSimilarity ) = 0; - - /** - * Callback to notify that the status of service (limited to - * services maintained in btengsrv scope) connections with - * a device has changed. - * - * @param aDevice the device to which the status change refers - * @param aConnected ETrue if at least one service is currently connected. - * EFalse if no service is currently connected. - */ - virtual void ServiceConnectionChanged( - const CBtDevExtension& aDevice, TBool aConnected ) = 0; - }; - -/** - * Class CBtDevRepository - * - * This class provides the full access to remote devices in BT registry, - * and informs client when the properties of remote devices are changed. - * - */ -NONSHARABLE_CLASS( CBtDevRepository ) : public CBase - { -public: - - /** - * Two-phase constructor - */ - IMPORT_C static CBtDevRepository* NewL(); - - /** - * Destructor - */ - IMPORT_C virtual ~CBtDevRepository(); - - /** - * Add an observer to this reposity for receivng repository update - * events. - * @param aObserver the observer to be added. - */ - IMPORT_C void AddObserverL( MBtDevRepositoryObserver* aObserver ); - - /** - * Remove an observer from this repository. - * @param aObserver the observer to be removed. - */ - IMPORT_C void RemoveObserver( MBtDevRepositoryObserver* aObserver ); - - /** - * Tells if this repository has finished the initialization. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - */ - IMPORT_C TBool IsInitialized() const; - - /** - * Get all devices in this repository. - * @return the device list - */ - IMPORT_C const RDevExtensionArray& AllDevices() const; - - /** - * Get a specific device by the given address. - * @param aAddr the address of the device to be retrieved - * @return the device pointer, NULL if the device is unavailable. - */ - IMPORT_C const CBtDevExtension* Device( const TBTDevAddr& aAddr ) const; - - /** - * Forces the repository to initialize its data store. - * At Initialization completion, corresponding callback will be invoked. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - * - */ - IMPORT_C void ReInitialize(); - -private: - - /** - * C++ default constructor - */ - CBtDevRepository(); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - -private: - - CBtDevRepositoryImpl* iImpl; - }; - -#endif /*BTDEVICEREPOSITORY_H*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/export/btsimpleactive.h --- a/bluetoothengine/btserviceutil/export/btsimpleactive.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +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: Active object helper class. -* -*/ - -#ifndef BTSIMPLEACTIVE_H -#define BTSIMPLEACTIVE_H - -#include - -class CBtSimpleActive; - -/** - * APIs from this class offer functionalities that are common in mw and app - * components of Bluetooth packages. They do not serve as domain APIs. - * - * Using these from external components is risky, due to possible source - * and binary breaks in future. - * - */ - - -/** - * Class MBtSimpleActiveObserver - * - * Callback class for receiving a completed active object event. - * Users of CBtSimpleActive need to derive from this class. - * - * @lib bteng*.lib - * @since S60 v3.2 - */ -class MBtSimpleActiveObserver - { -public: - - /** - * Callback from RunL() to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aStatus The status of the completed request. - */ - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) = 0; - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - virtual void CancelRequest( TInt aRequestId ) = 0; - - /** - * Callback from RunError() to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. - */ - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ) = 0; - }; - -/** - * Class CBtSimpleActive. - * - * This Active Object provides its client a TRequestStatus for performing - * asynchronous requests. It does not know the detail of the asynch operation. - * All of AO callbacks, such as RunL, will be delegated to the client - * for processing, via interface MBtSimpleActiveObserver. - * - */ -NONSHARABLE_CLASS ( CBtSimpleActive ): public CActive - { - -public: - - /** - * Two-phase constructor - * - * @since Symbian^4 - * @param aObserver Pointer to callback interface that receives notification - * that the request has been completed. - * @param aId Identifier for the CBtSimpleActive instance. - * @param aPriority The priority of the active object. - * @return Pointer to the constructed CBtSimpleActive object. - */ - IMPORT_C static CBtSimpleActive* NewL( MBtSimpleActiveObserver& aObserver, TInt aId, - TInt aPriority = CActive::EPriorityStandard ); - - /** - * Destructor - */ - IMPORT_C virtual ~CBtSimpleActive(); - - /** - * Get the request ID of this active object. - * - * @since Symbian^4 - * @return The request ID of this active object. - */ - IMPORT_C TInt RequestId(); - - /** - * Set a new request ID for this active object. - * - * @since Symbian^4 - * @param The new request ID of this active object. - */ - IMPORT_C void SetRequestId( TInt aId ); - - /** - * Activate the active object. - * - * @since Symbian^4 - */ - IMPORT_C void GoActive(); - - /** - * Get a reference to the active object request status. - * - * @since Symbian^4 - * @return Reference to the active object request status. - */ - IMPORT_C TRequestStatus& RequestStatus(); - -private: -// from base class CActive - - /** - * 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 - * - * @since S60 v3.2 - * @param aObserver Pointer to callback interface that receives notification - * that the request has been completed. - * @param aId ID of the request (for the client to keep track of multiple - * active objects). - * @param aPriority Priority of - */ - CBtSimpleActive( MBtSimpleActiveObserver& aObserver, TInt aId, TInt aPriority ); - -private: // data - - /** - * ID of the request (used only by our client). - */ - TInt iRequestId; - - /** - * Our observer. - * Not own. - */ - MBtSimpleActiveObserver& iObserver; - - }; - -#endif // BTSIMPLEACTIVE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/export/devdiscoveryobserver.h --- a/bluetoothengine/btserviceutil/export/devdiscoveryobserver.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +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 DEVDISCOVEREYOBSERVER_H -#define DEVDISCOVEREYOBSERVER_H - -#include -#include - -/** - * Class MDevDiscoveryObserver - * - * Callback class to notify the completion of device discovery. - */ -class MDevDiscoveryObserver - { -public: - - /** - * Callback to notify that a device has been found. - * - * @param aAddr the inquiry address that contains the inquiry information - * of the found device. - * @param aName the Bluetooth device name of the found device - */ - virtual void HandleNextDiscoveryResultL( - const TInquirySockAddr& aAddr, const TDesC& aName ) = 0; - - /** - * Callback to notify that the device search has completed. - * - * @param aErr the error code of device search result. - */ - virtual void HandleDiscoveryCompleted( TInt aErr ) = 0; - }; - -#endif - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/group/bld.inf --- a/bluetoothengine/btserviceutil/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* ============================================================================ -* Name : bld.inf -* Part of : bluetoothengine / bluetoothengine -* Description : Build information file for bluetoothengine subsystem -* -* Copyright © 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: -* Nokia Corporation -* ============================================================================ -* Template version: 4.1.1 -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../export/btsimpleactive.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btsimpleactive.h) -../export/btdevextension.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btdevextension.h) -../export/advancedevdiscoverer.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/advancedevdiscoverer.h) -../export/devdiscoveryobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/devdiscoveryobserver.h) -../export/btdevrepository.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btdevrepository.h) -../rom/btserviceutil.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btserviceutil.iby) - -PRJ_MMPFILES -btserviceutil.mmp - -PRJ_TESTMMPFILES -../tsrc/btserviceutiltest/group/btserviceutiltest.mmp - -PRJ_TESTEXPORTS diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/group/btserviceutil.mmp --- a/bluetoothengine/btserviceutil/group/btserviceutil.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: Project definition file for project btservice utility -* -*/ - - -#include -#include - -TARGET btserviceutil.dll -TARGETTYPE dll -UID 0x1000008d 0x2002E6E0 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -SOURCEPATH ../src - -SOURCE btsimpleactive.cpp -SOURCE btdevextension.cpp -SOURCE btdevrepository.cpp -SOURCE btdevrepositoryimpl.cpp - -SOURCE basicdevdiscoverer.cpp -SOURCE advancebtdevdiscoverer.cpp -SOURCE advancedevdiscovererimpl.cpp - -USERINCLUDE ../inc -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY btdevice.lib -LIBRARY btmanclient.lib -LIBRARY bluetooth.lib -LIBRARY esock.lib -LIBRARY btengconnman.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/inc/advancedevdiscovererimpl.h --- a/bluetoothengine/btserviceutil/inc/advancedevdiscovererimpl.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +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: Declares Bluetooth device inquiry helper class. -* -*/ - -#ifndef ADVANCEDEVDISCOVERERIMPL_H -#define ADVANCEDEVDISCOVERERIMPL_H - -#include - -#include -#include - -class CBasicDevDiscoverer; -class CBtDevRepository; -class CBtDevExtension; - -/** -* A helper class for searching nearby Bluetooth devices. -*/ -NONSHARABLE_CLASS(CAdvanceDevDiscovererImpl) : public CBase, - public MDevDiscoveryObserver, - public MBtSimpleActiveObserver - { -public: - /** - * instantiator - */ - static CAdvanceDevDiscovererImpl* NewL( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ); - - /** - * Destructor. - */ - virtual ~CAdvanceDevDiscovererImpl(); - - /** - * sets the inquiry result observer. - * - * @param aObserver the new observer to receive inquiry results - */ - void SetObserver( MDevDiscoveryObserver& aObserver ); - - /** - * Cancels all inquiry activity. - */ - void Cancel(); - - /** - * Discover currently in-range devices that matches the given major device class type. - * Found devices will be informed by - * MBtAdvanceDevDiscoveryObserver::HandleNextDiscoveryResult(). - * - * When no more device can be found, - * MBtAdvanceDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued. - * - * @param aFilter the filter that shall be applied when a device - * is discovered. If this is specified, only a device passing - * the filter will be informed to client. - * - * @param aDeviceClass the major device class which a found device - * must match. - */ - void DiscoverDeviceL( - CAdvanceDevDiscoverer::TDevDiscoveryFilter aFilter, - TBTMajorDeviceClass aDeviceClass ); - - /** - * Discover currently in-range devices that match the given major device class. - * The devices in the given priority list have higher priority to - * be discovered, i.e., inquiry on these devices will take place first. - * - * Found devices will be informed by - * MDevDiscoveryObserver::HandleNextDiscoveryResult(). - * - * When no more device can be found, - * MDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued. - * - * @param aPriorityList contains the devices to be discovered first - */ - void DiscoverDeviceL( - const RBTDevAddrArray& aPriorityList ); - -private: - - // from MDevDiscoveryObserver - - /** - * Callback to notify that a device has been found. - * - * @param aAddr the inquiry address that contains the inquiry information - * of the found device. - * @param aName the Bluetooth device name of the found device - */ - void HandleNextDiscoveryResultL( - const TInquirySockAddr& aAddr, const TDesC& aName ); - - /** - * Callback to notify that the device search has completed. - * - * @param aErr the error code of device search result. - */ - void HandleDiscoveryCompleted( TInt aErr ); - - // from MBtSimpleActiveObserver - - /** - * Callback to notify that an outstanding request has completed. - * - * @param aActive Pointer to the active object that completed. - * @param aStatus The status of the completed request. - */ - void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - void CancelRequest( TInt aId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. - */ - void HandleError( CBtSimpleActive* aActive, TInt aError ); - -private: - - /** - * C++ default constructor. - */ - CAdvanceDevDiscovererImpl( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ); - - /** - * The 2nd phase constructor - */ - void ConstructL(); - -private: // Data - - // for retrieving device properties - // Not own - CBtDevRepository& iDevRep; - - // our client - // Not own - MDevDiscoveryObserver& iObserver; - - // The class doing actual inquirying - CBasicDevDiscoverer* iBasicDiscoverer; - - // filters from CAdvanceDevDiscoverer::TDevDiscoveryFilter - TInt iFilter; - }; - -#endif - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/inc/basicdevdiscoverer.h --- a/bluetoothengine/btserviceutil/inc/basicdevdiscoverer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +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: Declares Bluetooth device inquiry helper class. -* -*/ - -#ifndef BASICDEVDISCOVERER_H -#define BASICDEVDISCOVERER_H - -#include -#include -#include - -class MDevDiscoveryObserver; - -class CDeviceSearchRecord : public CBase - { -public: - TInquirySockAddr iAddr; - TBTDeviceName iName; - }; - -/** -* A basic implementation for searching nearby Bluetooth devices. -*/ -NONSHARABLE_CLASS(CBasicDevDiscoverer) : public CBase, public MBtSimpleActiveObserver - { -public: - - /** - * factory method - */ - static CBasicDevDiscoverer* NewL( MDevDiscoveryObserver& aObserver ); - - /** - * Destructor. - */ - virtual ~CBasicDevDiscoverer(); - - /** - * sets the inquiry result observer. - * - * @param aObserver the new observer to receive inquiry results - */ - void SetObserver( MDevDiscoveryObserver& aObserver ); - - /** - * Cancels all inquiry activity. - */ - void Cancel(); - - /** - * Discover currently in-range devices that matches the given major device class type. - * Found devices will be informed by - * MDevDiscoveryObserver::HandleNextDiscoveryResult(). - * - * When no device can be found any more, - * MDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued. - * - * @param aDeviceClass the major device class device must match. - */ - void DiscoverDeviceL( TBTMajorDeviceClass aDeviceClass = EMajorDeviceMisc ); - -private: // from MBtSimpleActiveObserver - - /** - * Callback to notify that an outstanding request has completed. - * - * @param aActive Pointer to the active object that completed. - * @param aStatus The status of the completed request. - */ - void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback for handling cancelation of an outstanding request. - * - * @param aId The ID that identifies the outstanding request. - */ - void CancelRequest( TInt aId ); - - /** - * Callback to notify that an error has occurred in RunL. - * - * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. - */ - void HandleError( CBtSimpleActive* aActive, TInt aError ); - -private: - - /** - * C++ default constructor. - */ - CBasicDevDiscoverer( MDevDiscoveryObserver& aObserver ); - - /** - * The 2nd phase constructor - */ - void ConstructL(); - - /* - * retrieves the device name of the device pointed by - * iPagingNamePos to local array. - */ - void PageNextDeviceName(); - - /** - * Performs the result from an inquiry operation. - */ - TInt HandleInquiryResultL(); - - /** - * Create a heap object of CDeviceSearchRecord. - */ - CDeviceSearchRecord* NewInstanceL( - const TInquirySockAddr& aAddr, const TDesC& aName = KNullDesC ); - - /** - * resets the state and memory caused by a client request. - */ - void Reset(); - -private: // Data - - // Not own - MDevDiscoveryObserver& iObserver; - - // The major device class filter from the client. - TBTMajorDeviceClass iMajorDeviceClassFilter; - - // For inquiry and paging names: - CBtSimpleActive* iActive; - - RSocketServ iSocketServer; - RHostResolver iHostResolver; - TInquirySockAddr iInquirySockAddr; - TNameEntry iEntry; // Inquiry result record - - // Devices found so far - RPointerArray iDevices; - - // position in array iDevices: the item the current name paging operation is for - TInt iPagingNamePos; - - }; - -#endif - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/inc/btdevrepositoryimpl.h --- a/bluetoothengine/btserviceutil/inc/btdevrepositoryimpl.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +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: The repository of remote devices from BT registry -* -*/ - -#ifndef BTDEVICEREPOSITORYIMPL_H -#define BTDEVICEREPOSITORYIMPL_H - -#include -#include -#include -#include -#include -#include -#include - -class MBtDevRepositoryObserver; - -/** - * Class CBtDevRepositoryImpl - * - * This class keep a storage of remote device information. - * - */ -NONSHARABLE_CLASS( CBtDevRepositoryImpl ) : - public CBase, - public MBtSimpleActiveObserver, - public MBTEngConnObserver - { -public: - - /** - * Two-phase constructor - */ - static CBtDevRepositoryImpl* NewL(); - - /** - * Destructor - */ - ~CBtDevRepositoryImpl(); - - /** - * Add an observer to this reposity for receivng repository update - * events. - * @param aObserver the observer to be added. - */ - void AddObserverL( MBtDevRepositoryObserver* aObserver ); - - /** - * Remove an observer from this repository. - * @param aObserver the observer to be removed. - */ - void RemoveObserver( MBtDevRepositoryObserver* aObserver ); - - /** - * Tells if this repository has finished the initialization. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - */ - TBool IsInitialized() const; - - /** - * Gets all devices in this repository. - * @return the device list. - */ - const RDevExtensionArray& AllDevices() const; - - /** - * Get a specific device by the given address. - * @param aAddr the address of the device to be retrieved - * @return the device pointer, NULL if the device is unavailable. - */ - const CBtDevExtension* Device( const TBTDevAddr& aAddr ) const; - - /** - * Forces the repository to initialize its data store. - * At Initialization completion, corresponding callback will be invoked. - * Initialization completion means the repository has retieved all - * Bluetooth devices from BT registry, and it is subscribing to - * registry update events. - * - */ - void ReInitialize(); - - /** - * Returns the service (limited to services managed in bteng scope) - * level connection status of the specified device. - * - * @param aAddr the address of the device - * @return one of TBTEngConnectionStatus enums - */ - //TBTEngConnectionStatus IsDeviceConnected( const TBTDevAddr& aAddr ); - -private: - - // from MBtSimpleActiveObserver - - /** - * Callback from RunL() to notify that an outstanding request has completed. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aStatus The status of the completed request. - */ - void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - /** - * Callback from Docancel() for handling cancelation of an outstanding request. - * - * @since Symbian^4 - * @param aId The ID that identifies the outstanding request. - */ - void CancelRequest( TInt aRequestId ); - - /** - * Callback from RunError() to notify that an error has occurred in RunL. - * - * @since Symbian^4 - * @param aActive Pointer to the active object that completed. - * @param aError The error occurred in RunL. - */ - void HandleError( CBtSimpleActive* aActive, TInt aError ); - - // From MBTEngConnObserver - - /** - * Indicates to the caller that a service-level connection has completed. - * This function is called for both incoming and outgoing connections. - * This function is also called when an outgoing connection request fails, - * e.g. with error code KErrCouldNotConnect. - * When this function is called, new commands can be issued to the - * CBTEngConnMan API immediately. - * @param aAddr The address of the remote device. - * @param aErr Status information of the connection. KErrNone if the - * connection succeeded, otherwise the error code with - * which the outgoing connection failed. KErrAlreadyExists - * is returned if there already is an existing connection - * for the selected profile(s), or otherwise e.g. - * KErrCouldNotConnect or KErrDisconnected for indicating - * connection problems. - * @param aConflicts If there already is a connection for the selected - * profile(s) of an outgoing connection request (the - * selection is performed by BTEng), then this array - * contains the bluetooth device addresses of the - * remote devices for those connections. - */ - void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts = NULL ); - - /** - * Indicates to the caller that a service-level connection has disconnected. - * When this function is called, new commands can be issued to the - * CBTEngConnMan API immediately. - * - * @param aAddr The address of the remote device. - * @param aErr The error code with which the disconnection occured. - * KErrNone for a normal disconnection, - * or e.g. KErrDisconnected if the connection was lost. - */ - void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - -private: - - /** - * C++ default constructor - */ - CBtDevRepositoryImpl(); - - /** - * Symbian 2nd-phase constructor - */ - void ConstructL(); - - /** - * Creates a registry view which shall contain all remote devices. - */ - void CreateRemoteDeviceView(); - - /** - * retrieves remote devices from registry. - */ - void GetRemoteDevicesL(); - - /** - * handles the completion of paired device view creation - */ - void HandleCreateRemoteDeviceViewCompletedL( TInt aStatus); - - /** - * handles the completion of getting paired devices - */ - void HandleGetRemoteDevicesCompletedL( TInt aStatus ); - - /** - * Copy the remote devices to internal array storage. - */ - void UpdateRemoteDeviceRepositoryL(); - -private: - - /** - * The observers - * do not own them. - */ - RPointerArray iObservers; - - /** - * Registry sub session for remote device db. - * not own - */ - RBTRegistry iBTRegistry; - - // own. - RBTRegServ iBTRegServ; - - /** - * AO for registry operations - * own. - */ - CBtSimpleActive* iRegistryActive; - - /** - * the counter of not handled registry events. - */ - TInt iNotHandledRegEventCounter; - - /** - * temporary instance to retrieve paired devices. - * own. - */ - CBTRegistryResponse* iRegRespRemoteDevices; - - /** - * Property containing the BT registry change monitoring key - * own. - */ - RProperty iBtRegistryKey; - - /** - * AO for subscribing registry PubSub key - * own. - */ - CBtSimpleActive* iRegistryKeyActive; - - /** - * For connection status - */ - CBTEngConnMan* iBtengConn; - - /** - * contains the list of all devices. - * own. - */ - RDevExtensionArray iDevices; - - TInt iInitialized; - - }; - -#endif /*BTDEVICEREPOSITORYIMPL_H*/ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/inc/btserviceutilconsts.h --- a/bluetoothengine/btserviceutil/inc/btserviceutilconsts.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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: Internal symbolic constants of this component -* -*/ - -#ifndef BTSERVICEUTILCONSTS_H -#define BTSERVICEUTILCONSTS_H - -#include - -namespace BtServiceUtil { - -const TInt KServiceRequestIdBase = 0x100; - -enum TRequestIdentifier - { - // Inquiry with Host Resolver - EBluetoothInquiry = KServiceRequestIdBase, - // Get the name of a device - EBluetoothPageDeviceName, - // Schedule the notification of search completion - EAsyncNotifyDeviceSearchCompleted, - // Create view table of remote devices from BT registry - ECreateRemoteDeviceViewRequest, - // Retrieves remote devices from BT registry - EGetRemoteDevicesRequest, - // Subsribes the PubSub key for BT registry update events - ERegistryPubSubWatcher - }; -} - -#endif - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/rom/btserviceutil.iby --- a/bluetoothengine/btserviceutil/rom/btserviceutil.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 btserviceutil -* -*/ - - -#ifndef BTSERVICEUTIL_IBY -#define BTSERVICEUTIL_IBY - -#include - -#ifdef __BT -file=ABI_DIR\BUILD_DIR\btserviceutil.dll SHARED_LIB_DIR\btserviceutil.dll - -#endif // __BT - -#endif // BTSERVICEUTIL_IBY diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/advancebtdevdiscoverer.cpp --- a/bluetoothengine/btserviceutil/src/advancebtdevdiscoverer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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: CAdvanceDevDiscoverer class: the interface class for -* searching in-range Bluetooth devices using Host Resolver. -* -*/ - -#include -#include "advancedevdiscovererimpl.h" - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::CAdvanceDevDiscoverer -// ---------------------------------------------------------- -// -CAdvanceDevDiscoverer::CAdvanceDevDiscoverer() - { - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::CAdvanceDevDiscoverer -// ---------------------------------------------------------- -// -void CAdvanceDevDiscoverer::ConstructL( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ) - { - iImpl = CAdvanceDevDiscovererImpl::NewL( aDevRep, aObserver ); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::NewL -// ---------------------------------------------------------- -// -EXPORT_C CAdvanceDevDiscoverer* CAdvanceDevDiscoverer::NewL( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ) - { - CAdvanceDevDiscoverer* self = new (ELeave) CAdvanceDevDiscoverer(); - CleanupStack::PushL( self ); - self->ConstructL( aDevRep, aObserver ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------- -// Destructor -// ---------------------------------------------------------- -// -EXPORT_C CAdvanceDevDiscoverer::~CAdvanceDevDiscoverer() - { - delete iImpl; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::SetObserver -// ---------------------------------------------------------- -// -EXPORT_C void CAdvanceDevDiscoverer::SetObserver( - MDevDiscoveryObserver& aObserver ) - { - iImpl->SetObserver( aObserver ); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::DiscoverDeviceL -// ---------------------------------------------------------- -// -EXPORT_C void CAdvanceDevDiscoverer::DiscoverDeviceL( - TDevDiscoveryFilter aFilter, - TBTMajorDeviceClass aDeviceClass ) - { - iImpl->DiscoverDeviceL( aFilter, aDeviceClass ); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscoverer::CancelDiscovery -// ---------------------------------------------------------- -// -EXPORT_C void CAdvanceDevDiscoverer::CancelDiscovery() - { - iImpl->Cancel(); - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/advancedevdiscovererimpl.cpp --- a/bluetoothengine/btserviceutil/src/advancedevdiscovererimpl.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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: class for searching BT devices -* -*/ -#include "advancedevdiscovererimpl.h" -#include "basicdevdiscoverer.h" - - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::CAdvanceDevDiscovererImpl -// ---------------------------------------------------------- -// -CAdvanceDevDiscovererImpl::CAdvanceDevDiscovererImpl( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ) - :iDevRep( aDevRep ), iObserver( aObserver ) - { - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::ConstructL -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::ConstructL() - { - iBasicDiscoverer = CBasicDevDiscoverer::NewL( *this ); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::NewL -// ---------------------------------------------------------- -// -CAdvanceDevDiscovererImpl* CAdvanceDevDiscovererImpl::NewL( - CBtDevRepository& aDevRep, - MDevDiscoveryObserver& aObserver ) - { - CAdvanceDevDiscovererImpl* self = - new (ELeave) CAdvanceDevDiscovererImpl( aDevRep, aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl:: -// ---------------------------------------------------------- -// -CAdvanceDevDiscovererImpl::~CAdvanceDevDiscovererImpl() - { - delete iBasicDiscoverer; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::SetObserver -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::SetObserver( MDevDiscoveryObserver& aObserver ) - { - iObserver = aObserver; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl:: -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::Cancel() - { - iBasicDiscoverer->Cancel(); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl:: -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::DiscoverDeviceL( - CAdvanceDevDiscoverer::TDevDiscoveryFilter aFilter, - TBTMajorDeviceClass aDeviceClass ) - { - iBasicDiscoverer->DiscoverDeviceL( aDeviceClass ); - iFilter = aFilter; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::DiscoverDeviceL -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::DiscoverDeviceL( - const RBTDevAddrArray& aPriorityList ) - { - // to be implemented when BTUI requires this feature. - ( void ) aPriorityList; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::HandleNextDiscoveryResult -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::HandleNextDiscoveryResultL( - const TInquirySockAddr& aAddr, const TDesC& aName ) - { - TBool filtered = EFalse; - if ( iFilter ) - { - // For filtering, we need to examine the properties of - // this device from repository. - const CBtDevExtension* devExt = iDevRep.Device( aAddr.BTAddr() ); - // No filter is needed if this device is not in registry. - if ( devExt ) - { - if ( iFilter & CAdvanceDevDiscoverer::ExcludeUserAwareBonded) - { - // client does not want to discover devices that have been - // bonded already. - if ( devExt->IsUserAwareBonded() ) - { - filtered = ETrue; - } - } - } - } - if ( !filtered ) - { - iObserver.HandleNextDiscoveryResultL( aAddr, aName ); - } - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::HandleDiscoveryCompleted -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::HandleDiscoveryCompleted( TInt aErr ) - { - iObserver.HandleDiscoveryCompleted( aErr ); - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::RequestCompletedL -// Inform caller for received device and issue next EIR/Name request -// if the request was successful. -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - (void) aActive; - (void) aStatus; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::CancelRequest -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::CancelRequest( TInt aId ) - { - (void) aId; - } - -// ---------------------------------------------------------- -// CAdvanceDevDiscovererImpl::HandleError -// ---------------------------------------------------------- -// -void CAdvanceDevDiscovererImpl::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - (void) aActive; - (void) aError; - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/basicdevdiscoverer.cpp --- a/bluetoothengine/btserviceutil/src/basicdevdiscoverer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,318 +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: class for searching BT devices -* -*/ -#include "basicdevdiscoverer.h" -#include -#include "btserviceutilconsts.h" - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::CBasicDevDiscoverer -// ---------------------------------------------------------- -// -CBasicDevDiscoverer::CBasicDevDiscoverer( MDevDiscoveryObserver& aObserver ) - : iObserver( aObserver ) - { - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::ConstructL -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::ConstructL() - { - User::LeaveIfError( iSocketServer.Connect() ); - iActive = CBtSimpleActive::NewL( *this, BtServiceUtil::EBluetoothInquiry ); - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::NewL -// ---------------------------------------------------------- -// -CBasicDevDiscoverer* CBasicDevDiscoverer::NewL( MDevDiscoveryObserver& aObserver ) - { - CBasicDevDiscoverer* self = new (ELeave) - CBasicDevDiscoverer( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer:: -// ---------------------------------------------------------- -// -CBasicDevDiscoverer::~CBasicDevDiscoverer() - { - delete iActive; - Reset(); - iSocketServer.Close(); - iDevices.Close(); - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::SetObserver -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::SetObserver( MDevDiscoveryObserver& aObserver ) - { - iObserver = aObserver; - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer:: -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::Cancel() - { - iActive->Cancel(); - iHostResolver.Close(); - iDevices.ResetAndDestroy(); - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer:: -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::DiscoverDeviceL(TBTMajorDeviceClass aDeviceClass ) - { - // This class supports only one request at the time: - if ( iActive->IsActive() ) - { - User::Leave( KErrInUse ); - } - Reset(); - iMajorDeviceClassFilter = aDeviceClass; - _LIT( KLinkMgrDes, "BTLinkManager" ); - // Associate with bluetooth Link Manager. - TProtocolName protocol( KLinkMgrDes ); - TProtocolDesc pInfo; - User::LeaveIfError( iSocketServer.FindProtocol( protocol, pInfo)); - User::LeaveIfError( iHostResolver.Open(iSocketServer, - pInfo.iAddrFamily, pInfo.iProtocol)); - iActive->SetRequestId( BtServiceUtil::EBluetoothInquiry ); - iInquirySockAddr.SetAction( KHostResInquiry + KHostResEir + KHostResIgnoreCache ); - // We always do Generic Inquiry. - // Limited Inquiry could be added here in future on business need. - iInquirySockAddr.SetIAC(KGIAC); - iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iActive->RequestStatus() ); - iActive->GoActive(); - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::RequestCompletedL -// Inform caller for received device and issue next EIR/Name request -// if the request was successful. -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - TInt errToObserver( aStatus ); - // position in array iDevices: the device item the observer will be notified of. - TInt devToNotify ( KErrNotFound ); - - if ( aActive->RequestId() == BtServiceUtil::EBluetoothInquiry ) - { - if ( aStatus == KErrNone ) - { - TInt pos = HandleInquiryResultL(); - // continue to inquiry for more devices in range - iHostResolver.Next( iEntry, iActive->RequestStatus() ); - iActive->GoActive(); - if ( pos > KErrNotFound && iDevices[pos]->iName.Length() > 0 ) - { - devToNotify = pos; - } - } - else if( iDevices.Count() > 0 ) - { - // an error from inquiry operation. - // we move to next step to get device names if some devices have been - // found but without a name. - iPagingNamePos = iDevices.Count() - 1; - aActive->SetRequestId( BtServiceUtil::EBluetoothPageDeviceName ); - PageNextDeviceName(); - } - } - else if ( aActive->RequestId() == BtServiceUtil::EBluetoothPageDeviceName ) - { - errToObserver = KErrNone; - devToNotify = iPagingNamePos; - // the name in iEntry was reset before paging operation, so we - // can rely on this length() at this time: - if ( aStatus == KErrNone && iEntry().iName.Length() > 0 ) - { - iDevices[iPagingNamePos]->iName = iEntry().iName; - } - // the return error is not checked here. We continue to page the rest - // device names. - --iPagingNamePos; - PageNextDeviceName(); - } - // request ID is BtServiceUtil::EAsyncNotifyDeviceSearchCompleted - else - { - iObserver.HandleDiscoveryCompleted( errToObserver ); - return; - } - - // AO not active means that this is neither inquiring nor paging name. - // Schedule an operation completion callback: - if ( !iActive->IsActive() && - aActive->RequestId() != BtServiceUtil::EAsyncNotifyDeviceSearchCompleted ) - { - // We inform the client of operation completion asynchronously, so that - // we will not end up with problems, e.g., invalid memory, - // if the client issues more request in the callback context. - aActive->SetRequestId( BtServiceUtil::EAsyncNotifyDeviceSearchCompleted ); - aActive->RequestStatus() = KRequestPending; - TRequestStatus* sta = &aActive->RequestStatus(); - User::RequestComplete( sta, errToObserver ); - aActive->GoActive(); - } - - // This could be possible in both inquiry and paging operations. - if ( devToNotify > KErrNotFound ) - { - // This device record is not used any more after we have informed client. - // Extract it and push to cleanup for detroy. - // This is to prevent peak memory usage in case of a great number of - // devices being in range. - CDeviceSearchRecord* rec = iDevices[devToNotify]; - iDevices.Remove( devToNotify ); - CleanupStack::PushL( rec ); - iObserver.HandleNextDiscoveryResultL( rec->iAddr, rec->iName ); - CleanupStack::PopAndDestroy( rec ); - } - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::DoCancelRequest -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::CancelRequest( TInt aId ) - { - // host resolver needs to be cancelled. - // For request BtServiceUtil::EAsyncNotifyDeviceSearchCompleted, we - // are doing self-completing. Thus, nothing is needed now. - if ( aId == BtServiceUtil::EBluetoothInquiry || - aId == BtServiceUtil::EBluetoothPageDeviceName ) - { - iHostResolver.Cancel(); - } - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::HandleError -// Inform UI from error occured. -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - // We might have issued an request to Host Resolver in RequestCompleted(). - // Cancel AO just in case: - aActive->Cancel(); - Reset(); - // We cannot proceed more. Inform client: - iObserver.HandleDiscoveryCompleted( aError ); - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer:: -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::PageNextDeviceName() - { - // reset the name in entry so that previous result will - // not propogate if the next paging operation fails. - iEntry().iName.Zero(); - for (; iPagingNamePos > -1; --iPagingNamePos ) - { - // Get the next in-range device that has no device name yet - // This is practically meaning that the device would be - // < v2.1 - if( iDevices[iPagingNamePos]->iName.Length() == 0 ) - { - iInquirySockAddr.SetAction( KHostResName + KHostResIgnoreCache ); - TBTDevAddr btaddr = iDevices[iPagingNamePos]->iAddr.BTAddr(); - iInquirySockAddr.SetBTAddr( iDevices[iPagingNamePos]->iAddr.BTAddr() ); - iInquirySockAddr.SetIAC(KGIAC); - iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iActive->RequestStatus() ); - iActive->GoActive(); - break; - } - } - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::HandleInquiryResultL -// Inform of properties of the found BTdevice, -// which passes the search filter. Its name would be retrived -// later if not contained by the first round of inquiry. -// ---------------------------------------------------------- -// -TInt CBasicDevDiscoverer::HandleInquiryResultL() - { - TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr ); - // parse the inquiry result if this device passes the filters: - if ( iMajorDeviceClassFilter == EMajorDeviceMisc - || sa.MajorClassOfDevice() == iMajorDeviceClassFilter ) - { - CDeviceSearchRecord* record = NewInstanceL( sa ); - CleanupStack::PushL( record ); - iDevices.InsertL(record, 0 ); - CleanupStack::Pop( record ); - - TBTDeviceName devName; - TBluetoothNameRecordWrapper eir( iEntry() ); - TInt length = eir.GetDeviceNameLength(); - TBool isComplete( EFalse ); - if( length > 0 ) - { - User::LeaveIfError( eir.GetDeviceName( record->iName, isComplete) ); - } - return 0; - } - return KErrNotFound; - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::CompleteDiscovery -// ---------------------------------------------------------- -// -CDeviceSearchRecord* CBasicDevDiscoverer::NewInstanceL( - const TInquirySockAddr& aAddr, const TDesC& aName ) - { - CDeviceSearchRecord* record = new (ELeave) CDeviceSearchRecord(); - record->iAddr = aAddr; - record->iName = aName; - return record; - } - -// ---------------------------------------------------------- -// CBasicDevDiscoverer::Reset -// ---------------------------------------------------------- -// -void CBasicDevDiscoverer::Reset() - { - // Free the cache of host Resolver. - iHostResolver.Close(); - // Clean previous in-range devices whose proximity status - // may have been changed. - iDevices.ResetAndDestroy(); - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/btdevextension.cpp --- a/bluetoothengine/btserviceutil/src/btdevextension.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +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: an extended BT device offering properties of -* a Bluetooth device that may be needed by Bluetooth UIs -* -*/ - -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBtDevExtension::CBtDevExtension( TDefaultDevNameOption aNameOption ) -: iNameOption( aNameOption ) - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBtDevExtension::ConstructL( CBTDevice* aDev ) - { - SetDeviceL( aDev ); - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevExtension* CBtDevExtension::NewLC( - CBTDevice* aDev, TDefaultDevNameOption aNameOption ) - { - CBtDevExtension* self = NULL; - self = new (ELeave) CBtDevExtension( aNameOption ); - CleanupStack::PushL( self ); - self->ConstructL( aDev ); - return self; - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevExtension* CBtDevExtension::NewLC( - const TInquirySockAddr& aAddr, - const TDesC& aName, - TDefaultDevNameOption aNameOption ) - { - CBtDevExtension* self = new (ELeave) CBtDevExtension( aNameOption ); - CleanupStack::PushL( self ); - CBTDevice* dev = CBTDevice::NewLC( aAddr.BTAddr() ); - TBTDeviceClass cod( aAddr.MajorServiceClass(), - aAddr.MajorClassOfDevice(), aAddr.MinorClassOfDevice() ); - dev->SetDeviceClass( cod ); - if ( aName.Length() ) - { - dev->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( aName ) ); - } - self->ConstructL( dev ); - CleanupStack::Pop( dev ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevExtension* CBtDevExtension::NewLC( - const TBTDevAddr& aAddr, - const TDesC& aName, - TDefaultDevNameOption aNameOption ) - { - CBtDevExtension* self = new (ELeave) CBtDevExtension( aNameOption ); - CleanupStack::PushL( self ); - CBTDevice* dev = CBTDevice::NewLC( aAddr ); - if ( aName.Length() ) - { - dev->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( aName ) ); - } - self->ConstructL( dev ); - CleanupStack::Pop( dev ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevExtension::~CBtDevExtension() - { - iAlias.Close(); - delete iDev; - } - -// --------------------------------------------------------------------------- -// IsBonded -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevExtension::IsBonded( const TBTNamelessDevice &dev ) - { - // IsValidPaired tells if the paired bit of dev is valid - // and IsPaired tells if the device is paired or not: - return dev.IsValidPaired() && - dev.IsPaired() && - // Authentication due to OBEX cases e.g. file transfer, is not - // considered as bonded in Bluetooth UI: - dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable; - } - -// --------------------------------------------------------------------------- -// IsJustWorksBonded -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevExtension::IsJustWorksBonded( const TBTNamelessDevice &dev ) - { - return IsBonded( dev ) && - dev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable; - } - -// --------------------------------------------------------------------------- -// IsUserAwareBonded -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevExtension::IsUserAwareBonded( const TBTNamelessDevice &dev ) - { - if ( IsJustWorksBonded( dev ) ) - { - // Just Works bonded devices can happen without user awareness. - // For example, authentication due to an incoming service connection request - // from a device without IO. - // We use cookies to identify if this JW pairing is user aware or not: - TInt32 cookie = dev.IsValidUiCookie() ? dev.UiCookie() : EBTUiCookieUndefined; - return (cookie & EBTUiCookieJustWorksPaired ); - } - // Pairing in other mode than Just Works are always user-aware: - return IsBonded( dev ); - } - -// --------------------------------------------------------------------------- -// IsHeadset -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevExtension::IsHeadset( const TBTDeviceClass &aCod ) - { - if ( ( aCod.MajorServiceClass() & EMajorServiceAudioService ) && - ( aCod.MajorDeviceClass() & EMajorDeviceAudioDevice ) ) - { - if (aCod.MinorDeviceClass() == EMinorDeviceAVHandsfree || - aCod.MinorDeviceClass() == EMinorDeviceAVCarAudio) - { - // This is the typical CoD setting used by carkits: - return false; - } - return true; - } - return false; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C const TDesC& CBtDevExtension::Alias() const - { - return iAlias; - } - -// --------------------------------------------------------------------------- -// Addr() -// --------------------------------------------------------------------------- -// -EXPORT_C const TBTDevAddr& CBtDevExtension::Addr() const - { - return iDev->BDAddr(); - } - -// --------------------------------------------------------------------------- -// Device -// --------------------------------------------------------------------------- -// -EXPORT_C const CBTDevice& CBtDevExtension::Device() const - { - return *iDev; - } - - - -// --------------------------------------------------------------------------- -// IsUserAwareBonded -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevExtension::IsUserAwareBonded() const - { - return IsUserAwareBonded( iDev->AsNamelessDevice() ); - } - -// --------------------------------------------------------------------------- -// ServiceConnectionStatus() -// --------------------------------------------------------------------------- -// -EXPORT_C TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus() const - { - return iServiceStatus; - } - -// --------------------------------------------------------------------------- -// SetDeviceL -// --------------------------------------------------------------------------- -// -EXPORT_C void CBtDevExtension::SetDeviceL( CBTDevice* aDev ) - { - delete iDev; - iDev = aDev; - // It is possible that the client set a NULL object to us. - if ( !iDev ) - { - iDev = CBTDevice::NewL(); - } - // No optimization here. If client sets an identical device instance - // We will still execute these steps: - UpdateNameL(); - //UpdateServiceStatusL(); - } - -EXPORT_C CBtDevExtension* CBtDevExtension::CopyL() - { - CBtDevExtension* newDev = CBtDevExtension::NewLC( NULL ); - CBTDevice* dev = iDev->CopyL(); - CleanupStack::PushL( dev ); - newDev->SetDeviceL( dev ); - CleanupStack::Pop( dev); - newDev->SetServiceConnectionStatus( ServiceConnectionStatus() ); - CleanupStack::Pop( newDev ); - return newDev; - } - -// --------------------------------------------------------------------------- -// ServiceConnectionStatus() -// --------------------------------------------------------------------------- -// -void CBtDevExtension::SetServiceConnectionStatus( - TBTEngConnectionStatus aStatus ) - { - iServiceStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// UpdateL() -// --------------------------------------------------------------------------- -// -void CBtDevExtension::UpdateNameL() - { - // UI takes friendly name for displaying if it is available - iAlias.Zero(); - if ( iDev->IsValidFriendlyName() && iDev->FriendlyName().Length() != 0 ) - { - iAlias.ReAllocL(iDev->FriendlyName().Length()); - iAlias.Append(iDev->FriendlyName()); - } - // otherwise, device name, if it is available, will be displayed - else if ( iDev->IsValidDeviceName() && iDev->DeviceName().Length() != 0 ) - { - TBTDeviceName name = BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName()); - iAlias.ReAllocL(name.Length()); - iAlias.Append(name); - } - if ( iAlias.Length() == 0 && - ( iNameOption == EColonSeperatedBDAddr || iNameOption == EPlainBDAddr ) ) - { - // Name for display is still missing. We need to make one for user to - // identify it. - FormatAddressAsNameL(); - } - } - -// --------------------------------------------------------------------------- -// FormatAddressAsNameL() -// --------------------------------------------------------------------------- -// -void CBtDevExtension::FormatAddressAsNameL() - { - // readable format of BD_ADDR is double size of BD ADDR size, - // and plus the seperators. - iAlias.ReAllocL( KBTDevAddrSize * 3 ); - _LIT(KColon, ":"); - if ( iNameOption == EColonSeperatedBDAddr ) - { - iDev->BDAddr().GetReadable( iAlias, KNullDesC, KColon, KNullDesC ); - } - else - { - iDev->BDAddr().GetReadable( iAlias ); - } - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/btdevrepository.cpp --- a/bluetoothengine/btserviceutil/src/btdevrepository.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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: Repository of remote Bluetooth devices -* -*/ - -#include -#include "btdevrepositoryimpl.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBtDevRepository::CBtDevRepository() - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBtDevRepository::ConstructL() - { - iImpl = CBtDevRepositoryImpl::NewL(); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevRepository* CBtDevRepository::NewL() - { - CBtDevRepository* self = NULL; - self = new (ELeave) CBtDevRepository(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CBtDevRepository::~CBtDevRepository() - { - delete iImpl; - } - -// --------------------------------------------------------------------------- -// AddObserverL. -// Delegate to the implementor -// --------------------------------------------------------------------------- -// -EXPORT_C void CBtDevRepository::AddObserverL( MBtDevRepositoryObserver* aObserver ) - { - iImpl->AddObserverL( aObserver ); - } - -// --------------------------------------------------------------------------- -// RemoveObserver. -// Delegate to the implementor -// --------------------------------------------------------------------------- -// -EXPORT_C void CBtDevRepository::RemoveObserver( MBtDevRepositoryObserver* aObserver ) - { - iImpl->RemoveObserver( aObserver ); - } - -// --------------------------------------------------------------------------- -// AllDevices -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CBtDevRepository::IsInitialized() const - { - return iImpl->IsInitialized(); - } - -// --------------------------------------------------------------------------- -// AllDevices -// --------------------------------------------------------------------------- -// -EXPORT_C const RDevExtensionArray& CBtDevRepository::AllDevices() const - { - return iImpl->AllDevices(); - } - -// --------------------------------------------------------------------------- -// Device -// --------------------------------------------------------------------------- -// -EXPORT_C const CBtDevExtension* CBtDevRepository::Device( - const TBTDevAddr& aAddr ) const - { - return iImpl->Device( aAddr ); - } - -// --------------------------------------------------------------------------- -// Device -// --------------------------------------------------------------------------- -// -EXPORT_C void CBtDevRepository::ReInitialize() - { - return iImpl->ReInitialize(); - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/btdevrepositoryimpl.cpp --- a/bluetoothengine/btserviceutil/src/btdevrepositoryimpl.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,470 +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: respository of remote Bluetooth devices. -* -*/ - -#include "btdevrepositoryimpl.h" -#include -#include -#include -#include "btserviceutilconsts.h" - -// --------------------------------------------------------------------------- -// Tells if two CBTDevice instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool CompareDeviceByAddress( const CBTDevice& aDevA, const CBTDevice& aDevB ) - { - return aDevA.BDAddr() == aDevB.BDAddr(); - } - -// --------------------------------------------------------------------------- -// Tells if these two instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBTDevice& aDev) - { - return *aAddr == aDev.BDAddr(); - } - -// --------------------------------------------------------------------------- -// Tells if these two instances are for the same remote device -// --------------------------------------------------------------------------- -// -TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBtDevExtension& aDev) - { - return *aAddr == aDev.Device().BDAddr(); - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBtDevRepositoryImpl::CBtDevRepositoryImpl() - { - } - -// --------------------------------------------------------------------------- -// Symbian 2nd-phase constructor -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::ConstructL() - { - // connect to registry - User::LeaveIfError( iBTRegServ.Connect() ); - User::LeaveIfError( iBTRegistry.Open( iBTRegServ ) ); - iRegistryActive = CBtSimpleActive::NewL( - *this, BtServiceUtil::ECreateRemoteDeviceViewRequest ); - // Start to get the list of devices from registry. - CreateRemoteDeviceView(); - - User::LeaveIfError( iBtRegistryKey.Attach( - KPropertyUidBluetoothCategory, - KPropertyKeyBluetoothGetRegistryTableChange ) ); - - iRegistryKeyActive = CBtSimpleActive::NewL( *this, BtServiceUtil::ERegistryPubSubWatcher ); - iBtRegistryKey.Subscribe( iRegistryKeyActive->RequestStatus() ); - iRegistryKeyActive->GoActive(); - iBtengConn = CBTEngConnMan::NewL( this ); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CBtDevRepositoryImpl* CBtDevRepositoryImpl::NewL() - { - CBtDevRepositoryImpl* self = NULL; - self = new (ELeave) CBtDevRepositoryImpl(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CBtDevRepositoryImpl::~CBtDevRepositoryImpl() - { - iObservers.Close(); - delete iBtengConn; - delete iRegistryActive; - delete iRegRespRemoteDevices; - iDevices.ResetAndDestroy(); - iDevices.Close(); - iBTRegistry.Close(); - iBTRegServ.Close(); - delete iRegistryKeyActive; - iBtRegistryKey.Close(); - } - -// --------------------------------------------------------------------------- -// AddObserverL -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::AddObserverL( MBtDevRepositoryObserver* aObserver ) - { - // Do not allow null pointer. - if ( aObserver ) - { - iObservers.AppendL( aObserver ); - } - } - -// --------------------------------------------------------------------------- -// RemoveObserver -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::RemoveObserver( MBtDevRepositoryObserver* aObserver ) - { - TInt i = iObservers.Find( aObserver ); - if ( i >= 0 ) - { - iObservers.Remove( i ); - } - } - -// --------------------------------------------------------------------------- -// IsInitialized -// --------------------------------------------------------------------------- -// -TBool CBtDevRepositoryImpl::IsInitialized() const - { - return iInitialized; - } - -// --------------------------------------------------------------------------- -// AllDevices -// --------------------------------------------------------------------------- -// -const RDevExtensionArray& CBtDevRepositoryImpl::AllDevices() const - { - return iDevices; - } - -// --------------------------------------------------------------------------- -// Device -// --------------------------------------------------------------------------- -// -const CBtDevExtension* CBtDevRepositoryImpl::Device( - const TBTDevAddr& aAddr ) const - { - TInt pos = iDevices.Find( aAddr, MatchDeviceAddress); - if ( pos > -1 ) - { - return iDevices[pos]; - } - return NULL; - } - -// --------------------------------------------------------------------------- -// ReInitialize -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::ReInitialize() - { - iInitialized = EFalse; - if ( !iRegistryActive->IsActive() ) - { - CreateRemoteDeviceView(); - } - else - { - // This counter-increasing - // will force to re-create a registry view later. - ++iNotHandledRegEventCounter; - } - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// Checks if there is an authentication result. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) - { - if ( aActive->RequestId() == BtServiceUtil::ECreateRemoteDeviceViewRequest ) - { - HandleCreateRemoteDeviceViewCompletedL( aStatus ); - } - else if ( aActive->RequestId() == BtServiceUtil::EGetRemoteDevicesRequest ) - { - HandleGetRemoteDevicesCompletedL( aStatus ); - } - else if ( aActive->RequestId() == BtServiceUtil::ERegistryPubSubWatcher ) - { - TInt myChangedTable; - iBtRegistryKey.Subscribe( aActive->RequestStatus() ); - aActive->GoActive(); - TInt err = iBtRegistryKey.Get( myChangedTable ); - if( !err && myChangedTable == KRegistryChangeRemoteTable ) - { - if ( !iRegistryActive->IsActive() ) - { - CreateRemoteDeviceView(); - } - else - { - iNotHandledRegEventCounter++; - } - } - } - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// Checks if there is an authentication result. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::CancelRequest( TInt aRequestId ) - { - if ( aRequestId == BtServiceUtil::ECreateRemoteDeviceViewRequest ) - { - iBTRegistry.CancelRequest(iRegistryActive->RequestStatus()); - } - else if ( aRequestId == BtServiceUtil::EGetRemoteDevicesRequest ) - { - iRegRespRemoteDevices->Cancel(); - } - else if ( aRequestId == BtServiceUtil::ERegistryPubSubWatcher ) - { - iBtRegistryKey.Cancel(); - } - } - -// --------------------------------------------------------------------------- -// From class MBtSimpleActiveObserver. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::HandleError( CBtSimpleActive* aActive, TInt aError ) - { - (void) aError; - if ( aActive->RequestId() == BtServiceUtil::ECreateRemoteDeviceViewRequest || - aActive->RequestId() == BtServiceUtil::EGetRemoteDevicesRequest ) - {// leave happened in registry operation, delete registry response: - delete iRegRespRemoteDevices; - iRegRespRemoteDevices = NULL; - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngConnObserver. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts) - { - // connection is single profile based, to make sure getting the correct status, - // we always retrieve it from btengconnman: - (void)aConflicts; - (void) aErr; - TInt pos = iDevices.Find( aAddr, MatchDeviceAddress ); - if ( pos > -1 ) - { - TBTEngConnectionStatus old = iDevices[pos]->ServiceConnectionStatus(); - TBTEngConnectionStatus status = EBTEngNotConnected; - // error returned from the call is treated as not connected. - (void) iBtengConn->IsConnected( aAddr, status ); - iDevices[pos]->SetServiceConnectionStatus( status ); - - if ( old != status && - ( status == EBTEngConnected || - status == EBTEngNotConnected ) ) - { - for ( TInt i = 0; i < iObservers.Count(); ++i ) - { - iObservers[i]->ServiceConnectionChanged( - *(iDevices[pos]), status == EBTEngConnected ); - } - } - } - } - -// --------------------------------------------------------------------------- -// From class MBTEngConnObserver. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) - { - // unified handling for connections status events: - ConnectComplete( aAddr, aErr, NULL); - } - -// --------------------------------------------------------------------------- -// issue creating a remote device view from the registry -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::CreateRemoteDeviceView() - { - iNotHandledRegEventCounter = 0; - (void) iBTRegistry.CloseView(); - TBTRegistrySearch searchPattern; - searchPattern.FindAll(); - iRegistryActive->SetRequestId( BtServiceUtil::ECreateRemoteDeviceViewRequest ); - iBTRegistry.CreateView( searchPattern, iRegistryActive->iStatus ); - iRegistryActive->GoActive(); - } - -// --------------------------------------------------------------------------- -// gets the paired devices from the view created by CreatePairedDevicesView -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::GetRemoteDevicesL() - { - delete iRegRespRemoteDevices; - iRegRespRemoteDevices = NULL; - iRegRespRemoteDevices = CBTRegistryResponse::NewL( iBTRegistry ); - iRegistryActive->SetRequestId( BtServiceUtil::EGetRemoteDevicesRequest ); - iRegRespRemoteDevices->Start( iRegistryActive->iStatus ); - iRegistryActive->GoActive(); - } - -// --------------------------------------------------------------------------- -// re-create a paired device view if registry was changed during the previous -// operation. otherwise if the view is not empty, get the remote devices. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::HandleCreateRemoteDeviceViewCompletedL( TInt aStatus ) - { - // aStatus may indicate the number of devices from registry. - // However, our algorithm does not rely on this return error - // for implementation simplicity. - (void) aStatus; - if (iNotHandledRegEventCounter) - { // more registry change detected, create paired device view again: - CreateRemoteDeviceView( ); - } - else - { - GetRemoteDevicesL( ); - } - } - -// --------------------------------------------------------------------------- -// update remote device list. if registry was changed, create a new view. -// otherwise inform client for any changes. -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::HandleGetRemoteDevicesCompletedL( TInt aStatus ) - { - // aStatus may indicate the number of devices from registry. - // However, our algorithm does not rely on this return error. - (void) aStatus; - if (iNotHandledRegEventCounter) - { // more registry change detected, create paired device view again: - CreateRemoteDeviceView( ); - return; - } - - UpdateRemoteDeviceRepositoryL(); - if ( !iInitialized ) - { - iInitialized = ETrue; - // The first time we have got the device lists from registry, - // Get the connections statuses of these devices from bteng. - for ( TInt i = iDevices.Count() - 1; i > -1; --i ) - { - TBTEngConnectionStatus status = EBTEngNotConnected; - // error returned from the call is treated as not connected. - (void) iBtengConn->IsConnected( iDevices[i]->Addr(), status ); - iDevices[i]->SetServiceConnectionStatus( status ); - } - for ( TInt i = 0; i < iObservers.Count(); ++i ) - { - iObservers[i]->RepositoryInitialized(); - } - } - } - -// --------------------------------------------------------------------------- -// update remote devices in local array with the latest data -// --------------------------------------------------------------------------- -// -void CBtDevRepositoryImpl::UpdateRemoteDeviceRepositoryL() - { - TIdentityRelation addrComp( CompareDeviceByAddress ); - RBTDeviceArray& devsFromReg = iRegRespRemoteDevices->Results(); - for ( TInt i = iDevices.Count() - 1; i > -1; --i ) - { - TInt pos = devsFromReg.Find( &(iDevices[i]->Device()), addrComp ); - if ( pos > KErrNotFound ) - { - // Device is found in registry, check if its properties have been changed - TUint similarity = devsFromReg[pos]->CompareTo( iDevices[i]->Device() ); - TBool changed = EFalse; - if ( similarity != - ( CBTDevice::EAllNameProperties | - TBTNamelessDevice::EAllNamelessProperties) ) - { - // This device was updated in registry. - // move its ownership to local store - iDevices[i]->SetDeviceL( devsFromReg[pos] ); - changed = ETrue; - } - else - { - // This device has no update: - delete devsFromReg[pos]; - } - // either the instance at pos has been moved or deleted. - devsFromReg.Remove( pos ); - if ( iInitialized && changed ) - { - for ( TInt counter = 0; counter < iObservers.Count(); ++counter ) - { - iObservers[counter]->ChangedInRegistry( *iDevices[i], similarity ); - } - } - } - else - { - // This device was deleted from registry. - // Free it from the local store before informing client. - TBTDevAddr addr = iDevices[i]->Addr(); - delete iDevices[i]; - iDevices.Remove( i ); - if ( iInitialized ) - { - for ( TInt counter = 0; counter < iObservers.Count(); ++counter ) - { - iObservers[counter]->DeletedFromRegistry( addr ); - } - } - } - } - - // Remaining devices in iRegRespRemoteDevices are new devices: - for ( TInt i = devsFromReg.Count()- 1; i > -1 ; --i ) - { - CBtDevExtension* devExt = CBtDevExtension::NewLC( devsFromReg[i] ); - iDevices.AppendL( devExt ); - CleanupStack::Pop( devExt ); - devsFromReg.Remove( i ); - if ( iInitialized ) - { - for ( TInt counter = 0; counter < iObservers.Count(); ++counter ) - { - iObservers[counter]->AddedToRegistry( *devExt ); - } - } - } - // the devices in devsFromReg was either deleted, or moved. - delete iRegRespRemoteDevices; - iRegRespRemoteDevices = NULL; - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btserviceutil/src/btsimpleactive.cpp --- a/bluetoothengine/btserviceutil/src/btsimpleactive.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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: Active object helper class. -* -*/ - -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CBtSimpleActive::CBtSimpleActive( MBtSimpleActiveObserver& aObserver, TInt aId, - TInt aPriority ) -: CActive( aPriority ), - iRequestId( aId ), - iObserver( aObserver ) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CBtSimpleActive* CBtSimpleActive::NewL( MBtSimpleActiveObserver& aObserver, - TInt aId, TInt aPriority ) - { - CBtSimpleActive* self = new( ELeave ) CBtSimpleActive( aObserver, aId, aPriority ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CBtSimpleActive::~CBtSimpleActive() - { - Cancel(); - } - -// ----------------------------------------------------------------------------- -// Get the identifier of this instance. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CBtSimpleActive::RequestId() - { - return iRequestId; - } - -// ----------------------------------------------------------------------------- -// Set the identifier of this instance. -// ----------------------------------------------------------------------------- -// -EXPORT_C void CBtSimpleActive::SetRequestId( TInt aId ) - { - iRequestId = aId; - } - -// ----------------------------------------------------------------------------- -// Activate the active object. -// ----------------------------------------------------------------------------- -// -EXPORT_C void CBtSimpleActive::GoActive() - { - SetActive(); - } - -// ----------------------------------------------------------------------------- -// Get a reference to the active object request status. -// ----------------------------------------------------------------------------- -// -EXPORT_C TRequestStatus& CBtSimpleActive::RequestStatus() - { - return iStatus; - } - -// --------------------------------------------------------------------------- -// From class CActive. -// Called by the active scheduler when the request has been cancelled. -// --------------------------------------------------------------------------- -// -void CBtSimpleActive::DoCancel() - { - iObserver.CancelRequest( iRequestId ); - } - -// --------------------------------------------------------------------------- -// From class CActive. -// Called by the active scheduler when the request has been completed. -// --------------------------------------------------------------------------- -// -void CBtSimpleActive::RunL() - { - iObserver.RequestCompletedL( this, iStatus.Int() ); - } - -// --------------------------------------------------------------------------- -// From class CActive. -// Called by the active scheduler when an error in RunL has occurred. -// --------------------------------------------------------------------------- -// -TInt CBtSimpleActive::RunError( TInt aError ) - { - iObserver.HandleError( this, aError ); - return KErrNone; - } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/data/1020742B.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/data/1020742B.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,75 @@ +/* +* 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: +* ECOM plugin resource file for BTUI plugin. +* +* +*/ + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x1020742B; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10207236; // UID for CGSPluginInterface + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x1020742C; + version_no = 1; + display_name = "GS Btui Plugin"; // Plugin debug name + default_data = "0x10207250"; // Parent UID (BTUI is under "Connection" folder of General Setting Application) + opaque_data = "30"; // Order number + } + }; + }, + + INTERFACE_INFO + { + interface_uid = 0x1020745F; // UID for CBtuiPluginInterface + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x1020745C; // implementation UID + version_no = 1; + display_name = "Btui Application Plugin for MainView"; // Plugin debug name + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x1020745D; // implementation UID + version_no = 1; + display_name = "Btui Application Plugin for PairedDevicesView"; // Plugin debug name + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x20002780; // implementation UID + version_no = 1; + display_name = "Btui Application Plugin for BlockedDevicesView"; // Plugin debug name + } + + }; + + } + + }; + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/data/BtuiViewResources.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/data/BtuiViewResources.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,1440 @@ +/* +* 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 BTUI. +* +*/ + + +#include + +// RESOURCE IDENTIFIER + +NAME BVIE // 4 letter ID + +// INCLUDES +#include +#include "btui.hrh" // Enums for these resources +#include // Localisation file +#include // Icon indexes created by abld +#include "eikon.rsg" +#include +#include +#include +#include +#include + +// MACROS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf=""; } + +//---------------------------------------------------- +// +// Hotkeys for BTUI +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_btui_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + +// == MAIN VIEW ============================================================== + +RESOURCE CBA r_btui_softkeys_options_back__change + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EBTUICmdMSK ; + txt = qtn_msk_change; + } + + }; + } + + + + +//---------------------------------------------------- +// +// The main view of the BTUI application +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_btui_main_view + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_main_view; + cba = r_btui_softkeys_options_exit__change; + } + +//---------------------------------------------------- +// +// The main view's menu bar +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_btui_menubar_main_view + { + titles = + { + MENU_TITLE { menu_pane = r_btui_app_menu; txt=""; }, + MENU_TITLE { menu_pane = r_btui_main_view_menu; txt=""; } + }; + } + +//---------------------------------------------------- +// +// The main view options +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_btui_main_view_menu + { + items = + { + MENU_ITEM { command = EBTUICmdChangePowerStateMenu; txt = qtn_bt_change_value; }, + MENU_ITEM { command = EBTUICmdChangeVisibilityMenu; txt = qtn_bt_change_value; }, + MENU_ITEM { command = EBTUICmdChangeBTNameMenu; txt = qtn_bt_change_value; } + #ifdef __BT_SAP + , + MENU_ITEM { command = EBTUICmdChangeSapStateMenu; txt = qtn_bt_change_value; } + #endif + }; + } + +//---------------------------------------------------- +// +// Editor for entering all settings +// +//---------------------------------------------------- +// +RESOURCE LISTBOX r_bt_setting_editor + { + flags = EEikListBoxMultipleSelection; + } + +//---------------------------------------------------- +// +// The input dialog for entering power mode +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_bt_power_setting_page + { + label = qtn_bt_sett_module; + hint_text = " "; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknSetListBox; + editor_resource_id = r_bt_setting_editor; + } + +//---------------------------------------------------- +// +// Bluetooth power modes +// +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_power_modes + { + items = + { + LBUF { txt = qtn_bt_sett_on; }, + LBUF { txt = qtn_bt_sett_off; } + }; + } + +//---------------------------------------------------- +// +// The input dialog for bluetooth visibility setting +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_bt_visibility_setting_page + { + label = qtn_bt_sett_phone_visibility; + hint_text = " "; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknSetListBox; + editor_resource_id = r_bt_setting_editor; + } + +//---------------------------------------------------- +// +// Bluetooth visibility modes +// +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_visibility_modes + { + items = + { + LBUF { txt = qtn_bt_det_sett_general; }, + LBUF { txt = qtn_bt_set_visibility_time; }, + LBUF { txt = qtn_bt_hidden; } + }; + } + +//---------------------------------------------------- +// +// The input dialog for bluetooth local name setting +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_bt_name_setting_page + { + label = qtn_bt_sett_bt_name; + type = EEikCtEdwin; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + editor_resource_id = r_bt_name_setting_editor; + } + +//---------------------------------------------------- +// +// Editor for entering BT's local name +// +//---------------------------------------------------- +// +RESOURCE EDWIN r_bt_name_setting_editor + { + lines = 0; // Expanding to multiple rows + maxlength = KBTUIMaxNameLength; + flags = EEikEdwinNoLineOrParaBreaks; + } + + +// === PAIRED DEVICES VIEW =================================================== + +//---------------------------------------------------- +// +// This view shows all paired Bluetooth devices. +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_btui_other_devices_view + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_other_devices_view; + cba = r_btui_softkeys_options_exit__conoptions; + } + + +RESOURCE CBA r_btui_softkeys_options_exit__conoptions + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyExit; + txt = text_softkey_exit; + }, + CBA_BUTTON + { + id = EAknSoftkeyContextOptions;//EAknSoftkeyOptions; + txt = text_softkey_option; + } + + }; + } + +RESOURCE AVKON_VIEW r_btui_other_devices_view_gs + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_other_devices_view; + cba = r_btui_softkeys_options_back__conoptions; + } +// menubar_context = r_btui_menubar_other_devices_view__context; +// this is defined in CBTUIOtherDevicesView::DoActivate, since I did not +// find a way to do this by resources + +RESOURCE CBA r_btui_softkeys_options_back__conoptions + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknSoftkeyContextOptions;//EAknSoftkeyOptions; + txt = text_softkey_option; + } + + }; + } + +//---------------------------------------------------- +// +// The menubar for other paired devices view +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_btui_menubar_other_devices_view + { + titles = + { + MENU_TITLE { menu_pane = r_btui_app_menu; txt = ""; }, + MENU_TITLE { menu_pane = r_btui_other_devices_view_menu; txt = ""; } + }; + } + + +RESOURCE MENU_BAR r_btui_menubar_other_devices_view_context + { + titles = + { + MENU_TITLE { menu_pane = r_btui_other_devices_view_menu_context; txt = ""; } + }; + } + +//---------------------------------------------------- +// +// The other devices view options +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_btui_other_devices_view_menu + { + items = + { + MENU_ITEM { command = EBTUICmdNewPairedDevice; txt = qtn_bt_new_paired_device; }, + MENU_ITEM { command = EBTUICmdConnect; txt = qtn_bt_gen_connect; flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EBTUICmdConnectAudio; txt = qtn_bt_connect; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdDisconnect; txt = qtn_bt_disconnect; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdGiveNickname; txt = qtn_bt_give_nickname; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdSetTrusted; txt = qtn_bt_set_as_trusted; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdSetUnTrusted; txt = qtn_bt_set_as_untrusted; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdSetBlocked; txt = qtn_bt_block; flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EBTUICmdDelete; txt = qtn_bt_delete; flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EBTUICmdSettings; txt = qtn_bt_settings; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdDeleteAll; txt = qtn_bt_delete_all; } + }; + } + +RESOURCE MENU_PANE r_btui_other_devices_view_menu_context + { + items = + { + MENU_ITEM { command = EBTUICmdNewPairedDevice; txt = qtn_bt_new_paired_device; }, + MENU_ITEM { command = EBTUICmdConnect; txt = qtn_bt_gen_connect; }, + MENU_ITEM { command = EBTUICmdConnectAudio; txt = qtn_bt_connect; }, + MENU_ITEM { command = EBTUICmdDisconnect; txt = qtn_bt_disconnect; }, + MENU_ITEM { command = EBTUICmdGiveNickname; txt = qtn_bt_give_nickname; }, + MENU_ITEM { command = EBTUICmdSetTrusted; txt = qtn_bt_set_as_trusted; }, + MENU_ITEM { command = EBTUICmdSetUnTrusted; txt = qtn_bt_set_as_untrusted; }, + MENU_ITEM { command = EBTUICmdSetBlocked; txt = qtn_bt_block; }, + MENU_ITEM { command = EBTUICmdDelete; txt = qtn_bt_delete; }, + MENU_ITEM { command = EBTUICmdSettings; txt = qtn_bt_settings; } + }; + } + + +// == APPLICATION ============================================================ + +//---------------------------------------------------- +// +// The BTUI application level menu +// Common for all views +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_btui_app_menu + { + items = + { +#ifdef __SERIES60_HELP + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, +#endif + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + + + +// === QUERIES =============================================================== + +//---------------------------------------------------- +// Data query "Enter Bluetooth name for your phone" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_enter_local_name_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_enter_bt_name; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable | EEikEdwinNoLineOrParaBreaks; + maxlength = KBTUIMaxNameLength; + }; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "You have active Bluetooth +// connections on. Switch off anyway?" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_switch_off_anyway_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_switch_off_anyway; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "Bluetooth is currently off. +// Do you want to switch it on?" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_is_off_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_is_off; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "Do you want to activate bluetooth in off-line mode?" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_activate_in_offline_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = qtn_bt_activate_in_offline; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "Cancel pairing with: %U" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_warn_erase_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_warn_erase { buf = qtn_bt_warn_erase; } +RESOURCE TBUF r_bt_warn_erase_connected { buf = qtn_bt_warn_erase_connected; } + +//---------------------------------------------------- +// Confirmation query "Cancel all pairings" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_warn_erase_all_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_warn_erase_all; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "Delete all pairings? Some devices may be disconnected." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_warn_erase_all_connected_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_warn_erase_all_connected; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Data query "Enter alias" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_enter_nickname_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_bt_enter_nickname; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; + maxlength = KBTUIMaxAliasLength; + }; + }; + } + }; + } + +//---------------------------------------------------- +// Confirmation query "Set this device as trusted" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_set_trusted_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_bt_conf_aut; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_set_as_trusted_prompt { buf = qtn_bt_conf_aut; } + +//---------------------------------------------------- +// Confirmation query "Disconnect from: %U" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_disconnect_from_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_disconnect_from { buf = qtn_bt_disconn_from; } + + +// === NOTES ================================================================= + +//---------------------------------------------------- +// Information note "Phone is visible to other +// Bluetooth devices." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_phone_visib_to_oth_note + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIPhoneVisibleToOthers; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_phone_visib_to_oth; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note "Phone is hidden from others" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_hidden_from_others + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIHiddenFromOthersNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_hidden_from_others; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Error note "Alias exists in Paired devices list." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_name_exists_note + { + flags = EAknErrorNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUINameAlreadyExists; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_name_exists; + animation = R_QGN_NOTE_ERROR_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Error note "Invalid name entered, try again." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_invalid_local_name_note + { + //removed + //Leave the name here to keep binary compatibility + } + +//---------------------------------------------------- +// Confirmation note "Device set as untrusted." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_device_untrusted_note + { + flags = EAknConfirmationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIDeviceSetAsUntrusted; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_dev_set_as_untrust; + animation = R_QGN_NOTE_OK_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Wait note "Waiting for response from %U" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_waiting + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIWaitingForPairing; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_bt_waiting; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_waiting_prompt { buf = qtn_bt_waiting; } + +//---------------------------------------------------- +// Error note "Cannot execute Bluetooth operation +// successfully!" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_general_error_note + { + flags = EAknErrorNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIGeneralError; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_general_error; + animation = R_QGN_NOTE_ERROR_ANIM; + }; + } + }; + } + + +//---------------------------------------------------- +// Wait note "Connecting to %U" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_connecting_to_wait_note + { + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIConnectingTo; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_connecting_to { buf = qtn_bt_wait_connecting_to;} + +//---------------------------------------------------- +// Information note "Disconnect wired accessory" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_disconnect_wired_note + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIDisconnectWired; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_disconnect_wired; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note "Cannot establish Bluetooth connection" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_not_incall_note + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUINotIncall; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_not_incall; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note "Disconnect %U first" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_disconnect_first_prompt { buf = qtn_bt_disconnect_first; } + +//---------------------------------------------------- +// Information note "Maximum amount of Bluetooth conn..." +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_busy + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIBtBusy; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_busy; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + +//---------------------------------------------------- +// Information note "Bluetooth can't activated in off-line mode" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_offline_disabled { buf = qtn_bt_offline_disabled; } + +//---------------------------------------------------- +// Default value for "My Bluetooth name" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_default_local_name { buf = qtn_bt_default_local_name; } + + +// === GLOBAL QUERIES AND NOTES ============================================== + +//---------------------------------------------------- +// Global Information note "Audio routed to BT handsfree" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_audios_accessory_prompt { buf = qtn_bt_audio_accessory; } + +//---------------------------------------------------- +// Global Information note "Connected to %U" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_conf_connected_prompt { buf = qtn_bt_conf_connected; } + +//---------------------------------------------------- +// Global Information note "Disconnected from %U" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_conf_disconnected_prompt { buf = qtn_bt_conf_disconnected; } + +//---------------------------------------------------- +// Global Information note "Cannot establish Bluetooth connection" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_device_not_avail_note { buf = qtn_bt_device_not_avail; } + +//---------------------------------------------------- +// Global Information note "Hands-Free Profile not supported by %U" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_hfp_not_supported { buf = qtn_bt_hfp_not_supported; } + +//---------------------------------------------------- +// Global Information note "Unsupported device: %U" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_device_not_supported { buf = qtn_bt_device_not_supported; } + +// =========================================================================== + +//---------------------------------------------------- +// Titles for views +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_title_bluetooth { buf = qtn_bt_title_bluetooth; } +RESOURCE TBUF r_bt_title_paired_dev { buf = qtn_bt_title_paired_dev; } + +//---------------------------------------------------- +// Empty list text +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_no_paired_devices { buf = qtn_bt_no_paired_devices; } + +//---------------------------------------------------- +// Popup commands for paired devices view when +// there are no devices +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_no_paired_devices_popup_commands + { + items = { + LBUF { txt = qtn_bt_new_paired_device; } + }; + } + +//---------------------------------------------------- +// Standard popup commands for paired devices view +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_paired_devices_popup_commands + { + items = { + LBUF { txt = qtn_bt_give_nickname; }, + LBUF { txt = qtn_bt_delete; } + }; + } + +//---------------------------------------------------- +// Optional popup commands for paired devices view +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_set_untrusted_command { buf = qtn_bt_set_as_untrusted; } + +RESOURCE TBUF r_bt_set_trusted_command { buf = qtn_bt_set_as_trusted; } + +RESOURCE TBUF r_bt_connect_command { buf = qtn_bt_connect; } + +RESOURCE TBUF r_bt_disconnect_command { buf = qtn_bt_disconnect; } + + +//---------------------------------------------------- +// Format/label strings for main view +// There is also TBTUIMainViewSettingFormatStrings enum +// in the BTUI.hrh which must reflect EXACTLY this resource ! +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_label_strings + { + items = { + LBUF { txt=" \t"qtn_bt_sett_module"\t\t"qtn_bt_sett_on; }, + LBUF { txt=" \t"qtn_bt_sett_module"\t\t"qtn_bt_sett_off; }, + LBUF { txt=" \t"qtn_bt_sett_phone_visibility"\t\t"qtn_bt_det_sett_general; }, + LBUF { txt=" \t"qtn_bt_sett_phone_visibility"\t\t"qtn_bt_hidden; }, + + //temp visible mode + LBUF { txt=" \t"qtn_bt_sett_phone_visibility"\t\t" qtn_bt_temp_visible; }, + + LBUF { txt=" \t"qtn_bt_sett_bt_name"\t\t"; } + #ifdef __BT_SAP + , + LBUF { txt=" \t"qtn_bt_sap"\t\t"qtn_bt_sap_enabled; }, + LBUF { txt=" \t"qtn_bt_sap"\t\t"qtn_bt_sap_disabled; } + #endif + }; + } + + +#ifdef __BT_SAP +//---------------------------------------------------- +// +// The input dialog for SIM access profile setting +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_bt_sap_setting_page + { + label = qtn_bt_sap; + hint_text = " "; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + type = EAknSetListBox; + editor_resource_id = r_bt_setting_editor; + } + +//---------------------------------------------------- +// +// Bluetooth sap modes +// +//---------------------------------------------------- +// +RESOURCE ARRAY r_bt_sap_modes + { + items = + { + LBUF { txt = qtn_bt_sap_enabled; }, + LBUF { txt = qtn_bt_sap_disabled; } + }; + } + +//---------------------------------------------------- +// Information Note "Enabling SIM Access Profile +// connection Bluetooth must be ON" +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_sap_enable_note + { + flags = EAknInformationNoteFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EBTUIBtSapEnableNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = qtn_bt_sap_enable_info; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } +#endif //__BT_SAP + +// Visibility TIMEOUT +//---------------------------------------------------- +// +// r_setting_visibility_time_slider +// visibility timeout setting slider +// +//---------------------------------------------------- +// +RESOURCE SLIDER r_setting_visibility_time_slider + { + layout = EAknSettingsItemSliderLayout; + minvalue = 1; + maxvalue = 60; + step = 1; + valuetype = EAknSliderValueBareFigure; + singular_valuelabel = qtn_bt_slider_singular; + + minlabel = qtn_bt_slider_min; + maxlabel = qtn_bt_slider_max; + valuelabel = qtn_bt_slider_plural; + } + +//---------------------------------------------------- +// +// r_visibility_time_setting_page +// visibility timeout setting page. +// +//---------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_visibility_time_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + label = qtn_bt_slider_visibility_time; + type = EAknCtSlider; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + editor_resource_id = r_setting_visibility_time_slider; + } + + +//---------------------------------------------------- +// r_gs_btui_view_caption +// +// Btui view caption for GS plugin +//---------------------------------------------------- +// +RESOURCE TBUF r_gs_btui_view_caption + { + buf = qtn_set_folder_bluetooth; + } + +//---------------------------------------------------- +// +// The main view of the BTUI as GS plugin +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_btui_main_view_gs_plugin + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_main_view; + cba = r_btui_softkeys_options_back__change; + } + +RESOURCE CBA r_btui_softkeys_options_exit__change + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyExit; + txt = text_softkey_exit; + }, + CBA_BUTTON + { + id = EBTUICmdMSK ; + txt = qtn_msk_change; + } + + }; + } + +//---------------------------------------------------- +// Audio connection confirmation query +//---------------------------------------------------- +// +RESOURCE DIALOG r_bt_connect_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +// === BLOCKED DEVICES VIEW =================================================== + +//---------------------------------------------------- +// +// This view shows all blocked Bluetooth devices.(for GS) +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_btui_block_devices_view_gs + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_block_devices_view; + cba = r_btui_softkeys_options_back__unblock ; + } + +//---------------------------------------------------- +// +// The menubar buttons for blocked devices view +// MSK is dimmed when needed. +// +//---------------------------------------------------- +// + + +RESOURCE CBA r_btui_softkeys_options_back__unblock + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EBTUICmdUnblock ; + txt = qtn_msk_delete ; + } + + }; + } + +//---------------------------------------------------- +// +// This view shows all blocked Bluetooth devices.(bt application) +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_btui_block_devices_view + { + hotkeys = r_btui_hotkeys; + menubar = r_btui_menubar_block_devices_view; + cba = r_btui_softkeys_options_exit__unblock ; + } + +//---------------------------------------------------- +// +// The menubar buttons for blocked devices view +// MSK is dimmed when needed. +// +//---------------------------------------------------- +// + + +RESOURCE CBA r_btui_softkeys_options_exit__unblock + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyExit; + txt = text_softkey_exit; + }, + CBA_BUTTON + { + id = EBTUICmdUnblock ; + txt = qtn_msk_delete ; + } + + }; + } + +//---------------------------------------------------- +// +// The menubar for other blocked devices view +// +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_btui_menubar_block_devices_view + { + titles = + { + MENU_TITLE { menu_pane = r_btui_app_menu; txt = ""; }, + MENU_TITLE { menu_pane = r_btui_block_devices_view_menu; txt = ""; } + }; + } + + +//---------------------------------------------------- +// +// The blocked devices view options +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_btui_block_devices_view_menu + { + items = + { + MENU_ITEM { command = EBTUICmdUnblock; txt = qtn_bt_delete; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EBTUICmdUnblockAll; txt = qtn_bt_delete_all; } + }; + } + +//----------------------------------------------- +//Title for blocked device view +//------------------------------------------------ +// +RESOURCE TBUF r_bt_title_blocked_dev { buf = qtn_bt_title_blocked_devices; } +// empty listy +RESOURCE TBUF r_bt_no_blocked_devices { buf = qtn_bt_no_blocked_devices; } +// Information note "Disconnect %0U device and %1U device first" +//---------------------------------------------------- +// +RESOURCE TBUF r_bt_disconnect_first_stereo_prompt { buf = qtn_bt_disconnect_first_stereo; } + + +RESOURCE TBUF r_bt_warn_erase_blocked +{ + buf=qtn_bt_warn_erase_blocked; +} +RESOURCE TBUF r_bt_warn_erase_all_blocked +{ + buf=qtn_bt_warn_erase_all_blocked; +} + +RESOURCE DIALOG r_bt_generic_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE TBUF r_bt_option_block_device_header +{ + buf=qtn_bt_block_device_header ; +} +RESOURCE TBUF r_bt_option_block_paired_device_help +{ + buf= qtn_bt_block_paired_device "\n\n" qtn_bt_block_device_link; +} + +RESOURCE TBUF r_bt_option_block_paired_device_nohelp +{ + buf=qtn_bt_block_paired_device; +} + +RESOURCE TBUF r_bt_option_block_connected_paired_devices_help +{ + buf= qtn_bt_block_connected_paired_devices "\n\n" qtn_bt_block_device_link; +} + +RESOURCE TBUF r_bt_option_block_connected_paired_devices_nohelp +{ + buf= qtn_bt_block_connected_paired_devices ; +} +RESOURCE TBUF r_bt_block_device_link + { + buf=qtn_bt_block_device_link; + } + +RESOURCE DIALOG r_bt_message_query + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_YES_NO__YES; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = header_not_defined; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; + } + +RESOURCE TBUF r_cp_detail_bt_off { buf= qtn_cp_detail_bt_off; } +RESOURCE TBUF r_cp_detail_bt_on_shown { buf= qtn_cp_detail_bt_on_shown; } +RESOURCE TBUF r_cp_detail_bt_on_hidden { buf= qtn_cp_detail_bt_on_hidden; } +RESOURCE TBUF r_cp_detail_bt_conn_shown { buf= qtn_cp_detail_bt_conn_shown; } +RESOURCE TBUF r_cp_detail_bt_conn_hidden { buf= qtn_cp_detail_bt_conn_hidden; } + +RESOURCE TBUF r_bt_ssp_incorrect_passcode { buf = qtn_bt_simple_incorrect_passcode;} +RESOURCE TBUF r_bt_ssp_passcode_retry { buf = qtn_bt_simple_passcode_retry; } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/group/BtuiPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/group/BtuiPlugin.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,134 @@ +/* +* 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 module contains the views of BTUI. +* +*/ + + +#include +#include +#include + + +CAPABILITY CAP_ECOM_PLUGIN NetworkControl +TARGET BtuiPlugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x1020742B // UPDATE THIS +VENDORID VID_DEFAULT + +//********* UIDs ************* +//0x1020742B //DLL UID +//0x1020742C //Impl1. UID +//0x1020745C //impl2. UID +//0x1020745D //impl3. UID +//**************************** + +SOURCEPATH ../src +SOURCE BTUIMainContainer.cpp +SOURCE BTUIMainView.cpp +SOURCE BTUIViewsCommonUtils.cpp +SOURCE BTUIKeyWatcher.cpp +SOURCE BTUIActive.cpp + +#ifdef __BT_SAP +SOURCE BTUISap.cpp +#else +SOURCE BTUINonSap.cpp +#endif + +SOURCE BTUIBlockedDevicesView.cpp +SOURCE BTUIPairedDevicesView.cpp +SOURCE BTUIDeviceContainer.cpp +SOURCE BtuiPluginImplementationTable.cpp +SOURCE btuipluginman.cpp + +//BTUI plugin resource definition +START RESOURCE ../data/BtuiViewResources.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + + +//***********ECOM resource definition****************** +//--Ecom resource TARGET name must be same as DLL name, +//--otherwise Ecom won't recognise it. +//***************************************************** +START RESOURCE ../data/1020742B.rss +TARGET BtuiPlugin.rsc +END + + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../data //for documents + + +SYSTEMINCLUDE ../../inc //for private API headers (BluetoothEngine subsystem) +SYSTEMINCLUDE ../../../inc //for internal API headers (localconnectivity) +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom + +#ifdef __SERIES60_HELP +SYSTEMINCLUDE /epoc32/include/cshelp +#endif +LIBRARY btdevmodel.lib // Model of BTUI +LIBRARY btengdiscovery.lib // device search +LIBRARY btengsettings.lib // main settings view +LIBRARY btengdevman.lib // sap name,PairedDevicesView,Blocked devices view +LIBRARY btengconnman.lib // sap address, connect/disconnect device +LIBRARY btmanclient.lib // TBTRegistrySearch for sap address +LIBRARY euser.lib apparc.lib cone.lib // Symbian OS framework libraries +LIBRARY eikcore.lib eikcoctl.lib eikctl.lib // UIKON libraries +LIBRARY avkon.lib // Series 60 UI library +LIBRARY bafl.lib // Basic Application Framework Library +LIBRARY btdevice.lib // Bluetooth device handling routines +LIBRARY bluetooth.lib // Bluetooth device address handling routines +LIBRARY commonengine.lib // Series 60 common components library publish & subsribe and string loader +LIBRARY aknnotify.lib // Avkon global notes +LIBRARY AknSkins.lib // Skinned icons +LIBRARY aknicon.lib +LIBRARY centralrepository.lib // Central Repository +LIBRARY FeatMgr.lib +LIBRARY ecom.lib +LIBRARY charconv.lib +LIBRARY esock.lib + +LIBRARY GSEcomPlugin.lib +LIBRARY GSFramework.lib + +// For cover display support: +LIBRARY eikdlg.lib +LIBRARY estor.lib + + +#ifdef __BT_SAP +//LIBRARY BTSap.lib +#endif + +DEBUGLIBRARY flogger.lib // File logging services + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // Help library +#endif + +LIBRARY egul.lib +LIBRARY btfeatures.lib + +// This is optional - used only by Codewarrior IDE for .RSS file editing. +//DOCUMENT ../data/1020742B.rss +//DOCUMENT ../data/BtuiViewResources.rss + +//**** End of .mmp ***** diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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: This file provides project information required for BTUI/ECOM. +* +*/ + + +#include + +PRJ_PLATFORMS + +PRJ_EXPORTS + +PRJ_MMPFILES +./BtuiPlugin.mmp + + +//---End of File--- diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIActive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIActive.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,199 @@ +/* +* 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: Active object helper class. +* +*/ + + + +#ifndef BTUIACTIVE_H +#define BTUIACTIVE_H + + +#include + +class CBTUIActive; + +/** + * Class MBTUIActiveObserver + * + * Callback class for receiving a completed active object event. + * Users of CBTUIActive need to derive from this class. + * + * @since S60 v5.0 + */ +class MBTUIActiveObserver + { + +public: + + /** + * Callback to notify that an outstanding request has completed. + * + * @since S60 v5.0 + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void RequestCompletedL( CBTUIActive* aActive, TInt aId, + TInt aStatus ) = 0; + + /** + * Callback to notify that an error has occurred in RunL. + * + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + virtual void HandleError( CBTUIActive* aActive, TInt aId, + TInt aError ) = 0; + + }; + + +/** + * Class CBTUIActive + * + * Base clase for active objects used in BTUI + * + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CBTUIActive ) : public CActive + { + +public: + + /** + * Two-phase constructor + * + * @since S60 v5.0 + * @param aObserver Pointer to callback interface that receives notification + * that the request has been completed. + * @param aId The request ID + * @param aPriority Active Object Priority + * @return Pointer to the constructed CBTUIActive object. + */ + static CBTUIActive* NewL( MBTUIActiveObserver* aObserver, + TInt aId, TInt aPriority ); + + /** + * Destructor + */ + virtual ~CBTUIActive(); + + /** + * Get the request ID of this active object. + * + * @since S60 v5.0 + * @return The request ID of this active object. + */ + TInt RequestId(); + + /** + * Set a new request ID for this active object. + * + * @since S60 v5.0 + * @param The new request ID of this active object. + */ + void SetRequestId( TInt aId ); + + /** + * Activate the active object. + * + * @since S60 v5.0 + */ + void GoActive(); + + /** + * Cancel an outstanding request. + * + * @since S60 v5.0 + */ + void CancelRequest(); + + /** + * Get a reference to the active object request status. + * + * @since S60 v5.0 + * @return Reference to the active object request status. + */ + TRequestStatus& RequestStatus(); + +// from base class CActive + + /** + * From CActive. + * Called by the active scheduler when the request has been cancelled. + * + * @since S60 v5.0 + */ + void DoCancel(); + + /** + * From CActive. + * Called by the active scheduler when the request has been completed. + * + * @since S60 v5.0 + */ + void RunL(); + + /** + * From CActive. + * Called by the active scheduler when an error in RunL has occurred. + * Error handling is really done by callback in HandleError(). + * + * @since S60 v5.0 + * @param aError Error occured in Active Object's RunL(). + * @return KErrNone. + */ + TInt RunError( TInt aError ); + +private: + + /** + * C++ default constructor + * + * @since S60 v5.0 + * @param aObserver Pointer to callback interface that receives notification + * that the request has been completed. + * @param aId ID of the request (for the client to keep track of multiple + * active objects). + * @param aPriority Priority of + */ + CBTUIActive( MBTUIActiveObserver* aObserver, TInt aId, TInt aPriority ); + + /** + * Symbian 2nd-phase constructor + * + * @since S60 v5.0 + */ + void ConstructL(); + +private: // data + + /** + * ID of the request (used only by our client). + */ + TInt iRequestId; + + /** + * Our observer. + * Not own. + */ + MBTUIActiveObserver* iObserver; + + }; + + +#endif // BTUIACTIVE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIBlockedDevicesView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIBlockedDevicesView.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,176 @@ +/* +* 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: The view that handles paired devices. +* +*/ + +#ifndef BTUIBLOCKEDDEVICESVIEW_H +#define BTUIBLOCKEDDEVICESVIEW_H + +#include +#include // Menu pane definitions +#include +#include "BtuiPluginInterface.h" +#include "BTUIListedDevicesView.h" +#include + + +class CGSTabHelper; +class CBTUIMainView; //base view +class CBTUiDeviceContainer; +class CBTDevModel; + +/** +* Blocked devicew view of the pluetooth application. +* +* This view handles lists of blocked devices and the abolity to unblock them. +* +*@lib BTUIPlugin.dll +*@since S60 v3.2 +*/ +class CBTUIBlockedDevicesView : public CBTUIListedDevicesView, + public MGSTabbedView + + { + public: // New functions + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( ); + + /** + * Symbian 2nd phase constructor when serve as GS plugin. + * @param aBaseView, GS base view pointer. + * @param aTabViewArray, the array which contains all the tabed views' pointer. + * @return None. + */ + void ConstructL( CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray ); + + /* + * ECOM implementation instantiation factory function of + * interface "CBtuiPluginInterface", to be used by BTUI Application. + */ + static CBTUIBlockedDevicesView* NewL(MBtuiPluginViewActivationObserver* aObserver = NULL); + + /** + * Symbian 2 phase constructor used by base view when serve as GS plugin. + * @param aBaseView, GS base view pointer. + * @param aTabViewArray, the array which contains all the tabed views' pointer. + * @return None. + */ + static CBTUIBlockedDevicesView* NewLC(CBTUIMainView* aBaseView, + CArrayPtrFlat* aTabViewArray); + + /** + * Destructor. + */ + virtual ~CBTUIBlockedDevicesView(); + + + /** + * From MGSTabbedView: + * Creates new icon for tab. Ownership is transferred to client. + * @since 3.1 + */ + CGulIcon* CreateTabIconL(); + + public: // Functions from base classes + + /** + * From CAknView Returns view id. + * @param None. + * @return View id. + */ + TUid Id() const; + + /** + * From CAknView Handles user commands. + * @param aCommand A command id. + * @return None. + */ + void HandleCommandL(TInt aCommand); + + /** Dim/unDim middleSoftkey. + * This function is called by CBTUiDeviceContainer + * durings screen refreshes based on if there are devices or not. + * + * @param aDimmed. If this is true the middleSoftKey is invisible. + */ + void DimMskL(TBool aDimmed); + + /** + * From CAknView Dynamically initialises options menu. + * @param aResourceId Id identifying the menu pane to initialise. + * @param aMenuPane The in-memory representation of the menu pane. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + public: + /** + * Informs the observer that adevice has been changes or a new device added. + * @param aErr Symbian error code + * @param aDevice the device which is changed. If iAddr == 0, it's for notifiying "GetAllDevices()", + * @param aEnable True: pair/authorize/block/connect; False: unpair/unauthorize/unblock/disconnect + * @param aDevNameArray hold conflicting devices' short names if "AlreadyExist" error happened during "connect" + * @return None. + */ + void NotifyChangeDeviceComplete(const TInt aErr, const TBTDevice& aDevice, + const RBTDevNameArray* aDevNameArray = NULL); + + /** Updates the shown device list. This module will send this list forward + * to container that takes care of the actual display of those devices + * + *@param aDevices all the devices to be shown + *@param aSelectedItemIndex currently selected item after refresh. + */ + void RefreshDeviceList(const RDeviceArray* aDevices,TInt aSelectedItemIndex); + + protected: + /** + * C++ default constructor. + */ + CBTUIBlockedDevicesView (MBtuiPluginViewActivationObserver* aObserver= NULL); + + private: // Functions from base classes + + /** + * From CAknView Activates view. + * @param aPrevViewId Id of previous view. + * @param aCustomMessageId Custom message id. + * @param aCustomMessage Custom message. + * @return None. + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView Deactivates view. + * @param None. + * @return None. + */ + void DoDeactivate(); + + private: // Data + + CGSTabHelper* iTabHelper; + CBTUIMainView* iBaseView; + TBool iConstructAsGsPlugin; // Flag that indicate this obj is served as GS plugin not BTUI app's plugin. + MBtuiPluginViewActivationObserver* iActivationObserver; // view activation observer + }; + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIDeviceContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIDeviceContainer.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,206 @@ +/* +* 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: The view that handles paired devices. +* +*/ +#ifndef BTUIDEVICECONTAINER_H +#define BTUIDEVICECONTAINER_H + +#include // AVKON components +#include +#include // Commands popup window +#include // For column listbox access +#include + +#include "btdevmodel.h" +#include "btui.hrh" + +class CBTEngConnMan; +class CAknView; +class CBTDevModel; +class CBTUIListedDevicesView; + +/** +* This class displays lists of bluetooth devices. +* +* This class is used by blocked devices view and paired devices view to show +* lists of blocked or paired devices. +* +*@lib BTUIPlugin.dll +*@since S60 v3.2 +*/ +NONSHARABLE_CLASS(CBTUiDeviceContainer) : public CCoeControl, + public MCoeControlObserver, + public MEikListBoxObserver + { + public: // Constructors and destructor + + /** Create new instance + * @param aView PairedDevicesView or BlockedDevicesView. + * @param aStorage The handler of + * @param aContainerMode are we serving as blocked or paired device list + * @param aParent used by SetMopParent + */ + static CBTUiDeviceContainer* NewL(const TRect& aRect, + CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup, MObjectProvider* aParent); + + /** + * Destructor. + */ + virtual ~CBTUiDeviceContainer(); + + public: // Methods ralated devicelist upkeep. + + /** Refreshes this container to show these devices. + * Note: This container will not refresh screen if the listed + * devices have not changed. + *@param aDeviceArray The items to be displayed + *@param aSelectedItem which one of the items is selected after the refresh. + *Must be between 0 and aDeviceArray.Count()-1 or -1 if the list is empty. + */ + void RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt aSelectedItem); + + /** Counts how many devices this container displays. + * @return the amount of items in this container + */ + TInt CountItems(); + + /** + * Return the currently selected item index. KErrNotFound found if + * this container has no items and therefore no selected item. + * + * @return index of currently selected item, or KErrNotFund if none. + */ + TInt CurrentItemIndex() ; + + private: + /** 2nd phase constructor + * @param aView PairedDevicesView or BlockedDevicesView. + * @param aStorage The handler of + * @param aContainerMode are we serving as blocked or paired device list + * @param aParent used by SetMopParent + */ + void ConstructL(const TRect& aRect, CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup); + + /** + * From CoeControl Responds to size changes. + * Sets the size and position of the contents of this control. + * @param None. + * @return None. + */ + void SizeChanged(); + + /** + * From CoeControl Gets the number of controls contained + * in a compound control. + * @param None. + * @return The number of component controls contained by this control. + */ + TInt CountComponentControls() const; + + /** + * From CoeControl Gets the specified component of a compound control. + * @param aIndex The index of the control to get. + * @return Reference to the component control. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + /** + * From CoeControl Draws the control. + * @param aRect The region of the control to be redrawn. + * @return None. + */ + void Draw(const TRect& aRect) const; + + /** + * From CoeControl Handles key events. + * @param aKeyEvent The key event that occurred. + * @param aType The event type. + * @return Response to the key event. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * From MCoeControlObserver Handles an event from an observed control. + * @param aControl The control that sent the event. + * @param aEventType The event type. + * @return None. + */ + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + /** returns help context or empty context, if help is not supported + */ + void GetHelpContext(TCoeHelpContext& aContext) const; + + /** + * From CCoeControl + * + * Handles a change to the control's resources. + */ + void HandleResourceChange( TInt aType ); + + /** + * From CCoeControl + * + * Responds to a change in focus. + */ + void FocusChanged(TDrawNow aDrawNow); + + /** + * From MEikListBoxObserver Handles list box events. + * + * This is used to handle touch screen double click. + * + * @param aListBox The originating list box. + * @param aEventType The event type. + * @return None. + */ + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + + /** Create descriptor representation of given device + * @param aDevice The device to be represented + * @param aListItem where the representation will be written. + */ + void CreateListItemL(const TBTDevice& aDevice, TBTDeviceName& alistItem); + + /** + * Creates and adds local bitmap to icon array. + * @param aID Item ID of the masked bitmap to be created. + * @param aFilename Filename to be used to construct the item. + * @param aBitmapId The ID if bitmap + * @param aMaskId The ID of bitmap's mask + * @param aIconList The icon list for BT devices listbox. + */ + void CreateAndAppendIconL( const TAknsItemID& aID, + const TDesC& aFileName, + const TInt aBitmapId, + const TInt aMaskId, + CAknIconArray* aIconList); + /** + * Internal leave function called by HandleResourceChange() + * @param aType Type of resource change + */ + void HandleResourceChangeL( TInt aType ); + + private: + CAknSingleGraphicStyleListBox* iDeviceList; // Other paired BT-devices list + CBTUIListedDevicesView* iView; // The reference to PairedDevicesView or BlockedDevicesView + TBTDeviceGroup iGroup; // are we operating blocked or paired devices container + + }; + +#endif + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIKeyWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIKeyWatcher.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,114 @@ +/* +* 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: Watcher for PubSub and CenRep keys. +* +*/ + + +#ifndef CBTUIKEYWATCHER_H +#define CBTUIKEYWATCHER_H + +#include +#include +#include "BTUIActive.h" + +// Identification for key and active object to be watched +const TInt KBTUIPHYCountWatcher = 0x01; + +/** + * Class CBTUIKeyWatcher + * + * Notify and handle the key values' change. + * + * @since S60 v5.0 + */ +class CBTUIKeyWatcher : public CBase, public MBTUIActiveObserver + { + +public: + + /** + * Two-phase constructor + * + * @param aCaller The one calls this class. + * @param aServiceID Identify which key to be listened to. + * It can be a logical AND value when listening to multiple keys. + */ + static CBTUIKeyWatcher* NewL( TAny* aCaller, TInt aServiceID); + + /** + * Destructor + */ + virtual ~CBTUIKeyWatcher(); + + /** + * From MBTUIActiveObserver. + * Notification that a key value has changed. + * + * @since S60 v5.0 + * @param aActive Active object for the key which value changed. + * @param aId Identification for key, defined in this file. + * @param aStatus Request status + */ + void RequestCompletedL( CBTUIActive* aActive, TInt aId, TInt aStatus ); + + /** + * From MBTUIActiveObserver. + * Notification that a key value has changed. + * + * @since S60 v5.0 + * @param aActive Active object for the key which value changed. + * @param aId Identification for key, defined in this file. + * @param aError Error occured in Active Object's RunL(). + */ + void HandleError( CBTUIActive* aActive, TInt aId, TInt aError ); + +private: + + /** + * C++ default constructor + * @param aCaller The one calls this class. + */ + CBTUIKeyWatcher( TAny* aCaller ); + + /** + * Symbian 2nd-phase constructor + * @param aServiceID Identify which key to be listened to. It can + * be a logical AND value when listening to multiple keys. + */ + void ConstructL( TInt aServiceID ); + +private: // data + + /** + * Property containing count of physical BT connections. + * When physical connections exists, specific BT UI indicator is shown. + */ + RProperty iPHYCountKey; + + /** + * Active object for listening to above keys' change. + * Own. + */ + CBTUIActive* iPHYCountWatcher; + + /** + * Our caller view. + * Not own. + */ + TAny* iCaller; + + }; + +#endif // CBTUIKEYWATCHER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIListedDevicesView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIListedDevicesView.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,71 @@ +/* +* 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: The view that handles paired devices. +* +*/ + +#ifndef BTUILISTEDDEVICESVIEW_H +#define BTUILISTEDDEVICESVIEW_H + +#include "BtuiPluginInterface.h" +#include "BTUIDeviceContainer.h" +#include "btdevmodel.h" +#include "BTUIViewsCommonUtils.h" + +/** +* SuperClass of PairedDevicesView and BlockedDevicesview. +* +* This defines functionality common to PairedDevicesView and BlockedDevicesview. +* +*@lib BTUIPlugin.dll +*@since S60 v3.2 +*/ +class CBTUIListedDevicesView : public CBtuiPluginInterface, + public MBTDeviceObserver, + public TBTUIViewsCommonUtils + + { + public: + + /** Checks if there a device change operation + * ongoing. + * @return ETrue if there is. EFalse otherwise + */ + TBool DeviceChangeInProgress() + { + return iModel && iModel->DeviceChangeInProgress(); + } + + /** The index of currently selected item. + * This function delegates the question to BTUIDevicesContainer. + * @return the index, or KErrNotFound in the list is empty + * or if iContainer is not yet initialized; + */ + TInt CurrentItemIndex() + { + if(iContainer) + return iContainer->CurrentItemIndex(); + else + return KErrNotFound; + } + protected: + CBTUiDeviceContainer* iContainer; + CBTDevModel* iModel; + TBool iCoverDisplayEnabled; + MBtuiPluginViewActivationObserver* iActivationObserver; + }; + +#endif + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIMainContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIMainContainer.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,205 @@ +/* +* 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: Declares container control for application. +* +*/ + +#ifndef BTUIMAINCONTAINER_H +#define BTUIMAINCONTAINER_H + +#include // AVKON components +#include +#include "btui.hrh" +#include "BTUIMainView.h" +#include "btengsettings.h" + +/** +* This class handles main view dependent requests from user and +* contains listbox for main view items. +* +*@lib BTUIPlugin.dll +*@since S60 v3.0 +*/ +class CBTUIMainContainer : public CCoeControl, + public MCoeControlObserver, + public MEikListBoxObserver + { + public: // Constructors and destructor + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( const TRect& aRect, CBTUIMainView* aMainView ); + + /** + * Destructor. + */ + virtual ~CBTUIMainContainer(); + + + public: // New functions + + /** + * Returns the current item index (highlight position) + * for main setting list. + * @param None. + * @return Current item index. + */ + TInt CurrentItemIndex(); + + /** + * From MBTUISettingsObserver Handles setting changes. + * @param aListItem The changed setting item. + * @return None. + */ + void SettingChanged( TBTMainListItemIndexes aListItem ); + + private: // Functions from base classes + + /** + * From CoeControl Responds to size changes. + * Sets the size and position of the contents of this control. + * @param None. + * @return None. + */ + void SizeChanged(); + + /** + * From CoeControl Gets the number of controls contained + * in a compound control. + * @param None. + * @return The number of component controls contained by this control. + */ + TInt CountComponentControls() const; + + /** + * From CoeControl Gets the specified component of a compound control. + * @param aIndex The index of the control to get. + * @return Reference to the component control. + */ + CCoeControl* ComponentControl(TInt aIndex) const; + + /** + * From CoeControl Draws the control. + * @param aRect The region of the control to be redrawn. + * @return None. + */ + void Draw(const TRect& aRect) const; + + /** + * From CoeControl Handles key events. + * @param aKeyEvent The key event that occurred. + * @param aType The event type. + * @return Response to the key event. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * From MEikListBoxObserver Handles list box events. + * @param aListBox The originating list box. + * @param aEventType The event type. + * @return None. + */ + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + /** + * From MCoeControlObserver Handles an event from an observed control. + * @param aControl The control that sent the event. + * @param aEventType The event type. + * @return None. + */ + void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); + + + /** + * From CoeControl Gets the control's help context. + * @param aContext The control's help context + * @return None. + */ + void GetHelpContext(TCoeHelpContext& aContext) const; + + /** + * From CCoeControl + */ + void HandleResourceChange( TInt aType ); + + /** + * From CCoeControl + */ + void FocusChanged(TDrawNow /*aDrawNow*/); + + + private: // Data + + /** + * Friend class for generating format string for main list. + */ + class TMainListItemArray : public MDesCArray + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + TMainListItemArray( CDesCArray* aBtAllItemsArray, CBTUIMainView* aMainView, + CBTEngSettings* aBtEngSettings ); + + public: // New functions + + /** + * Returns number of items in array / main list. + * @param None. + * @return Number of items. + */ + TInt MdcaCount() const; + + /** + * Returns the current format string for the given item. + * @param aIndex Index of the item. + * @return Pointer to the format string. + */ + TPtrC MdcaPoint(TInt aIndex) const; + private: + static void GetSapStatusL( TInt& aStatus ); + + private: // Data + + // Local BT name format string + __MUTABLE TBuf iItemText; + + // No ownership (reference) + CDesCArray& iArray; + CBTUIMainView* iMainView; + CBTEngSettings* iBtEngSettingsRef; + + }; + + CAknSettingStyleListBox* iBtMainListBox; // The setting items list (scrollable) + CDesCArray* iBtAllItemsArray; // All format string combinations (ownership) + TMainListItemArray* iBtListItemArray; // Format strings for list items + TInt iCurrentItemIndex; // Current highlighted main list item + CBTUIMainView* iMainView; + CBTEngSettings* iBtEngSettingsRef; + + + + private: // Friend classes + + friend class TMainListItemArray; + + + +}; + +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIMainView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIMainView.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,427 @@ +/* +* 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: Declares the settings view for BTUI application. +* +*/ + + +#ifndef BTUIMAINVIEW_H +#define BTUIMAINVIEW_H + +#include "BtuiPluginInterface.h" +#include "BTUIViewsCommonUtils.h" +#include "btui.hrh" + +#include // AVKON components +#include // for disconnect type and connection observer +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class CBTUIMainContainer; +class CBTDevModel; +class TBTUIViewsCommonUtils; +class CGSTabHelper; +class CBTUIKeyWatcher; +class CAknViewAppUi; +class MGSTabbedView; + +/** +* Main view of the application. +* +* This view handles option activation, +* deactivation, commands and dynamic options menus. +* +*@lib BTUIPlugin.dll +*@since S60 v3.0 +*/ +class CBTUIMainView : public CBtuiPluginInterface, + public MBTEngSettingsObserver, + public TBTUIViewsCommonUtils, + public MGSTabbedView + { + public: // Constructors and destructor + + + /** + * ECOM implementation instantiation function of + * interface "CBtuiPluginInterface", to be used by BTUI Application. + */ + static CBTUIMainView* NewL(MBtuiPluginViewActivationObserver* aObserver= NULL); + /** + * ECOM implementation instantiation function of + * interface "CGSPluginInterface", to be used by GS application. + */ + static CBTUIMainView* NewGsPluginL(); + + /** + * Destructor. + */ + virtual ~CBTUIMainView(); + + /** + * From MGSTabbedView: + * Creates new icon for tab. Ownership is transferred to client. + * @since 3.1 + */ + CGulIcon* CreateTabIconL(); + + /** + * From MBTEngSettingsObserver - Called when powerstate is changed + * @param TBTPowerStateValue power state + * @return None + */ + void PowerStateChanged( TBTPowerStateValue aState ); + + /** + * From MBTEngSettingsObserver - Called when visibility is changed + * @param TBTPowerStateValue state of visibility mode + * @return None + */ + void VisibilityModeChanged( TBTVisibilityMode aState ); + + protected: + + /** + * C++ default constructor. + */ + CBTUIMainView (MBtuiPluginViewActivationObserver* aObserver= NULL); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + + public: // Functions from base classes + + /** + * From CAknView Returns view id. + * @param None. + * @return View id. + */ + TUid Id() const; + + /** + * Calls possibly leaving HandleCommandL function + * @param aCommand A command id. + * @return None. + */ + void HandleCommand(TInt aCommand); + + /** + * From CAknView Handles user commands. + * @param aCommand A command id. + * @return None. + */ + void HandleCommandL(TInt aCommand); + + /** + * Used by BTUIAppUI to Redraw BT name + * field. + * @param aListItem The changed setting item. + * @return None. + */ + void SettingChangedL( TBTMainListItemIndexes aListItem ); + + private: // Functions from base classes + + /** + * From CAknView Activates view. + * @param aPrevViewId Id of previous view. + * @param aCustomMessageId Custom message id. + * @param aCustomMessage Custom message. + * @return None. + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView Deactivates view. + * @param None. + * @return None. + */ + void DoDeactivate(); + + /** + * From CAknView Dynamically initialises options menu. + * @param aResourceId Id identifying the menu pane to initialise. + * @param aMenuPane The in-memory representation of the menu pane. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + /** + * From MProgressDialogCallback Get's called when a dialog is dismissed. + * @param aButtonId Id of the pressed button. + * @return None. + */ + void DialogDismissedL( TInt aButtonId ); + + public: // New functions + + /** + * Set the power status of Bluetooth. + * + * @param aValue The new power status. + * @return Symbian OS error code. + */ + TInt SetPowerStatusL( TBool aValue ); + + /** + * Set the visibility mode of Bluetooth. + * + * @param aMode The new visibility mode. + * @return None. + */ + void SetVisibilityStatusL( TBTVisibilityMode aMode ); + + + /** + * Returns the local name of BT Device. + * + * @param None. + * @return The local name. + */ + TDesC* GetBTLocalName(); + + /** + * Returns a reference to class CBTEngSettings. + * + * @param None. + * @return A reference to class CBTEngSettings. + */ + CBTEngSettings* GetBtSettingsReference(); + + /** + * Set the SIM Access Profile status . + * + * @param aValue The new SAP status. + */ + void SetSapStatusL( TBTSapMode aValue ); + + /** + * Update its parent's view + * @param None. + * @return None. + */ + void UpdateParentView(); + + private: + /** takes care of middle softkey press. + */ + void HandleMiddleSoftkey(); + + /** + * Asks new power mode from user via selection buttons. + * + * @param None. + * @return None. + */ + void AskPowerModeDlgL(); + + /** + * Asks new visibility mode from user via selection buttons. + * + * @param None. + * @return None. + */ + void AskVisibilityDlgL(); + + /** + * Asks new local BT Device name from user. + * + * @param None. + * @return None. + */ + void AskNewBtNameDlgL(); + + /** + * A callback for launching local BT Device name query. + * + * @param aAppUi A reference to self. + * @return Symbian OS error code. + */ + static TInt LaunchBTLocalNameQueryL(TAny* aAppUi); + + /** + * Asks local BT Device name from user at startup. + * + * @param None. + * @return Symbian OS error code. + */ + TInt AskBTLocalNameQueryL(); + + /** + * Initiates BT local name query after Symbian OS has entered idle state. + * + * @param None. + * @return None. + */ + void InitiateBTLocalNameQueryL(); + + /** + * blaa blaa + * + * @param aNum count of connectionsions. + * @return None. + */ + TInt GetConnectionNumber(TInt& aNum); + + /** + * Asks new SAP mode from user via selection buttons. + * + * @param None. + * @return None. + */ + void AskSapModeDlgL(); + + /** + * Connected sap name + * + * @param aName + * @return TInt. + */ + TInt GetConnectedSapNameL( TDes& aName ); + + /** + * Get settings' values including power state, discovery mode and connection state + * Then set member varient iBtState. + */ + void RefreshSettingsStatusL(); + + /** + * Internal leave function used by GetValue(). + */ + void GetValueL( const TGSPluginValueKeys aKey, TDes& aValue ); + + /** + * Checks from central repository whether the Bluetooth friendly name + * has been modified . + * @param aStatus + * @return error code + */ + + TInt IsLocalNameModifiedL( TBool& aStatus ); + + public: // Enumerations + + enum TBTStateSummary + { + EBTOff = 0, + EBTOnShown, + EBTOnHidden, + EBTConnectedShown, + EBTConnectedHidden + }; + + private: // from CGSBaseView + + /** + * Handles OK key press. + * @since 3.1 + */ + void HandleListBoxSelectionL(); + + /** + * Creates new container. + * @since 3.1 + */ + void NewContainerL(); + + + public: //Functions from CGSPluginInterface + + /** + * Method for checking plugin's Uid. Uid identifies this GS plugin. Use + * same Uid as the ECOM plugin implementation Uid. + * + * @return PluginUid + */ + TUid PluginUid() const; + + /** + * Method for getting caption of this plugin. This should be the + * localized name of the settings view to be shown in parent view. + * + * @param aCaption pointer to Caption variable + */ + void GetCaptionL( TDes& aCaption ) const; + + + /** + * Creates a new icon of desired type. + * @param aIconType UID Icon type UID of the icon to be created. + * @return Pointer of the icon. NOTE: Ownership of this icon is + * transferred to the caller. + */ + CGulIcon* CreateIconL( const TUid aIconType ); + + /** + * Function for getting plugin's value for a certain key. + * Override to provide own functionality. + * + * @param aKey Key for the value to be retrieved. + * @parem aValue Value for the given gey in TDes format. + */ + void GetValue( const TGSPluginValueKeys aKey, TDes& aValue ); + + /** + * Returns sap status + * + * @param None + * @return TInt. + */ + TInt GetSapStatusL(); + + TVwsViewId GetParentView(); + + /** + * From MGSTabbedView + * @return Reference to owned tabbed views which should be included in + * the sub-view's tab group. + * @since 3.1 + */ + CArrayPtrFlat* TabbedViews(); + + private: // Data + CBTUIMainContainer* iContainer; // Main container + CBTEngSettings* iBtEngSettings; // Settings class + CIdle* iIdle; // Idle time class (for doing operation delayed) + TBTDeviceName iTempNameBuffer; // Temporary storage for BT name + CEikonEnv* iEikEnv; // Local eikonenv + TInt iResourceFileFlag; // Flag for eikon env. + TBool iConstructAsGsPlugin; // Flag that indicate who constrct this obj + TBool iCoverDisplayEnabled; // Flag that indicate cover UI feature + + CGSTabHelper* iTabHelper; + TBool iParentViewNotSetYet; + CArrayPtrFlat* iViewArray; + TVwsViewId iParentView; + TBTStateSummary iBtState; + CBTUIKeyWatcher* iKeyWatcher; + MBtuiPluginViewActivationObserver* iActivationObserver; // view activation observer + }; + +#endif + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIPairedDevicesView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIPairedDevicesView.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,498 @@ +/* +* 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: The view that handles paired devices. +* +*/ + +#ifndef BTUIPAIREDDEVICESVIEW_H +#define BTUIPAIREDDEVICESVIEW_H + +#include +#include // Menu pane definitions +#include +#include +#include +#include +#include "BtuiPluginInterface.h" +#include "btdevmodel.h" +#include "BTUIListedDevicesView.h" +#include "btuipluginman.h" +#include "BTUIActive.h" +#include +#include + +class CAknNavigationControlContainer; +class CBTUiDeviceContainer; +class CGSTabHelper; +class CBTEngSettings; +class CBTUIMainView; + +// if there are more connection that this, it is disallowed to +// connect to any device +const TInt KBtUiMaxConnections = 6; + +/** +* Paired devicew view of the pluetooth application. +* +* This view handles lists of paired device and pairing new devices, unpairing devices +* and setting previously paired devices as blocked. Also connecting and disconnecting +* are done by using this view. +* +*@lib BTUIPlugin.dll +*@since S60 v3.0 +*/ +class CBTUIPairedDevicesView : public CBTUIListedDevicesView, + public MBTEngSettingsObserver, + public MProgressDialogCallback, + public MBTEngSdpResultReceiver, // for bt discovery. SDP is not used + public MGSTabbedView, + public MBTUIActiveObserver +{ + public: + + /** + * ECOM implementation instantiation function of + * interface "CBtuiPluginInterface", to be used by BTUI Application. + */ + static CBTUIPairedDevicesView* NewL(MBtuiPluginViewActivationObserver* aObserver = NULL); + + static CBTUIPairedDevicesView* NewLC(CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + void ConstructL( CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray ); + + /** + * Destructor. + */ + virtual ~CBTUIPairedDevicesView(); + + /** + * From MGSTabbedView: + * Creates new icon for tab. Ownership is transferred to client. + * @since 3.1 + */ + CGulIcon* CreateTabIconL(); + + public: // Functions from base classes + + /** + * From CAknView Returns view id. + * @param None. + * @return View id. + */ + TUid Id() const; + + /** + * From CAknView Handles user commands. + * @param aCommand A command id. + * @return None. + */ + void HandleCommandL(TInt aCommand); + + protected: + /** + * C++ default constructor. + */ + CBTUIPairedDevicesView (MBtuiPluginViewActivationObserver* aObserver= NULL); + + private: // Functions from base classes + + /** + * From CAknView Activates view. + * @param aPrevViewId Id of previous view. + * @param aCustomMessageId Custom message id. + * @param aCustomMessage Custom message. + * @return None. + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView Deactivates view. + * @param None. + * @return None. + */ + void DoDeactivate(); + + /** + * From CAknView Dynamically initialises options menu. + * @param aResourceId Id identifying the menu pane to initialise. + * @param aMenuPane The in-memory representation of the menu pane. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + // implemented from MProgressDialogCallback + /** This is used to cancel connecting and pairing, if user presses the Cancel-button. + * From MProgressDialogCallback Get's called when a dialog is dismissed. + * @param aButtonId Id of the pressed button. + * @return None. + */ + void DialogDismissedL( TInt aButtonId ); + + public: // from MBTDeviceObserver + /** + * Informs the observer that an error happened in changing device status or a new device added. + * @param aErr Symbian error code + * @param aDevice the device which is changed. + * @param aDevNameArray hold conflicting devices' short names if "AlreadyExist" error happened during "connect" + * @return None. + */ + void NotifyChangeDeviceComplete(const TInt aErr, const TBTDevice& aDevice, + const RBTDevNameArray* /*aDevNameArray*/ ) ; + /** + * Leaving version of NotifyChangeDeviceComplete + * @param aErr Symbian error code + * @param aDevice the device which is changed. + * @param aDevNameArray hold conflicting devices' short names if "AlreadyExist" error happened during "connect" + * @return None. + */ + void NotifyChangeDeviceCompleteL(const TInt aErr, const TBTDevice& aDevice, + const RBTDevNameArray* /*aDevNameArray*/ ) ; + + /** Updates the shown device list. This module will send this list forward + * to container that takes care of the actual display of those devices + * + *@param aDevices all the devices to be shown + *@param aSelectedItemIndex currently selected item after refresh. + */ + void RefreshDeviceList(const RDeviceArray* aDevices,TInt aSelectedItemIndex); + + private: // From MBTUIActiveObserver + + /** + * Callback to notify that an outstanding request has completed. + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + void RequestCompletedL( CBTUIActive* aActive, TInt aId, + TInt aStatus ); + + /** + * Callback to notify that an error has occurred in RunL. + * + * @param aActive Pointer to the active object that completed. + * @param aId The ID that identifies the outstanding request. + * @param aStatus The status of the completed request. + */ + void HandleError( CBTUIActive* aActive, TInt aId, + TInt aError ); + + public: // Operations to devices not containing confirmation queries + /** + * Sets the current security setting of the device. + * Does not ask user about it. + * + * @param aTrusted ETrue when trusted, EFalse if untrusted. + * @return None. + */ + void ChangeDeviceSecurityL( TBool aTrusted ); + + /** + * Issues prompts to connects to specified accessory. + * Connects to it if user andswers yes. + * + * @param TBTDevice connect to this device + * @return None. + */ + void ConnectL( const TBTDevice& aDevice, TBool aNewWaitNote ); + + /** + * Disconnects from the selected BT Accessory. + * + * @param None. + * @return None. + */ + void DisconnectL(); + + /** + * Removes iDisconnectQueryDlg created in DisconnectL + * + * @param None. + * @return None. + */ + void CancelDisconnectQueryDlg(); + + /** + * Disconnects from the selected BT Accessory without query. + * + * @param None. + * @return None. + */ + void DisconnectWithoutQuery(); + + /** Checks if there is an active phonecall. + *@return ETrue if there is, EFalse otherwise + */ + TBool CallOnGoing(); + + + /** This is used to create TCallBack to help. This is static, since TCallBack does not + * allow instance methods. This is used by BlockDeviceDlgL to add help callback to the query. + * + * @param aTCoeHelpContext. Must be instance TCoeHelpContext, or NULL. + * If this is not specified this will open help about blocked devices. + * This is not an instance of TCoeHelpContext, since TCallback does not allow + * parameters of other type that TAny*. + * @return allways KErrNone. TCallBack does not allow void functions + */ + static TInt LaunchHelp(TAny *aTCoeHelpContext=NULL); + + private: //These handle command given by user + /** + * Asks new nick name for the BT Device from user and + * attempt to rename the device. Failures are handled by NotifyChangeDeviceComplete. + * + * @param None. + * @return None. + */ + void RenameDeviceDlgL(); + + /** + * Asks confirmation for deleting a BT Device from user. + * Delete the current device if yes replied yes. + * + * @param None. + * @return None. + */ + void DeleteDeviceDlgL(); + + /** + * Asks confirmation for deleting all BT devices from user. + * Delete the devices if yes replied yes. + * + * @param None. + * @return None. + */ + void DeleteAllDevicesDlgL(); + + /** + * Initiates the pairing procedure to get a new paired device. + * DeviceSearchComplete is called after the dialog is done. + * + * @param None. + * @return None. + */ + void NewPairedDeviceDlgL(); + + /** + * Asks confirmation for Blocking the selected BT Device. + * Blocks the current device if yes replied yes. + * + * @param None. + * @return None. + */ + void BlockDeviceDlgL(); + + /**Opens a wait note. + * + *@param dialog. The dialog object to be used for displaying this note. + *@param aNoteResource The resource of the note, not including the text. + *@param aNoteTextResource The text resource. The %U if this note is filled up with aDevName. + *@param aSec SecondaryDisplaycommand + *@param aDevName The dev name filled in aNoteTextResource + */ + void OpenWaitNoteL(CAknWaitDialog *&dialog,TUint aNoteResource,TUint aNoteTextResource, + TSecondaryDisplayBtuiDialogs aSec,const TDesC& aDevName); + + /** Open Setting view for peripheral devices + * + * @param None. + * @return None. + */ + void LaunchSettingViewL(); + + /** Setup device specific menu options + * + * @param None. + * @return None. + */ + void SetupMenuCmd(TInt aIndex, CEikMenuPane* aMenu); + + + public: // Inherited from MBTEngSdpResultReceiver + + + /** Inherited from MBTEngSdpResultReceiver and implemented as empty, + * since this class will not do service searches, only device searches. + */ + void ServiceSearchComplete( const RSdpRecHandleArray& aResult, + TUint aTotalRecordsCount, TInt aErr ) ; + /** Inherited from MBTEngSdpResultReceiver and implemented as empty, + * since this class will not do attributes seaches, only device searches. + */ + void AttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr,TInt aErr ) ; + /** Inherited from MBTEngSdpResultReceiver and implemented as empty, + * since this class will not do service attribute seaches, only device searches. + */ + void ServiceAttributeSearchComplete( TSdpServRecordHandle aHandle, + const RSdpResultArray& aAttr,TInt aErr ); + + /** + * Provides notification of the result of the discovery of nearby + * Bluetooth devices. If a device is selected this class will try to pair it. + * + * @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. + * This is not TBTDevice that is normally used inside the UI. + * @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 ); + + /** + * Provides notification of the result of the discovery of nearby + * Bluetooth devices and EIR data. If a device is selected this class will try to pair it. + * + * @since S60 v5.1 + * @param aDevice The data structure encapsulates information + * about the selected device. + * Ownership of the data structure has not been transfered and + * is still with the API client. + * @param aEirWrapper Contains the EIR data of the remote 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, + TNameEntry* aNameEntry, + TInt aErr ); + +private: + /** Leaving version of DeviceSearchComplete. + * + * @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. + * This is not TBTDevice that is normally used inside the UI. + * @param aEirWrapper Contains the EIR data of the remote 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 DeviceSearchCompleteL( CBTDevice* aDevice, + TNameEntry* aNameEntry, TInt aErr ); + + /** Shows 'Disonnect first' note + * + * @param aDevice + */ + void ShowDisconnecNoteL(TBTDevice *aDevice); + + /** + * Auto connect to headset after pairing succeeded. + * @param aCount the counter of connecting request issuing staring from 0. + */ + void ConnectIfNeededAfterPairL( TInt aCount ); + + public: // internal methods for informing operation completes + /** + * Informs that pairing attempt of a device has been completed. + * Dismisses wait note and displays questions about authorizing and + * connecting, if the device is connectable. + * + * This method is called by ModifyDeviceChangeL. This method will not inform + * iContainer about the pairing since that is done by ModifyDeviceChangeL. + * + * @param aError Status code of the operation. + * @param aDeviceIndex the new place of the device in UI + * @return None. + */ + void BondingCompleteL( TInt aError,const TBTDevice& aDevice); + + /** Informs that attempt to connect to a device is completed. Closes wait + * note and if there was an error shows the error notice. + * + * This method is called by ModifyDeviceChangeL. This method will not inform + * iContainer about the pairing since that is done by ModifyDeviceChangeL. + * + * @param aError KErrNone or system wide error code + * @param aDeviceIndex The index of the new device + * @param aConflictingDeviceName this is filled only when + */ + void ConnectCompleteL(TInt aError,const TBTDevice& aDevice, + const RBTDevNameArray* aConflictingDeviceNames=NULL); + + + /** + * From MBTEngSettingsObserver - Called when powerstate is changed + * @param TBTPowerStateValue power state + * @return None + */ + void PowerStateChanged( TBTPowerStateValue aState ); + + /** + * From MBTEngSettingsObserver - Called when visibility is changed + * @param TBTPowerStateValue state of visibility mode + * @return None + */ + void VisibilityModeChanged( TBTVisibilityMode aState ); + + + private: // Data + + CAknWaitDialog* iWaitForPairingDlg; // Wait note for pairing + CAknWaitDialog* iWaitForConnectDlg; // Wait note for connecting to BT Accessory + CAknQueryDialog* iDisconnectQueryDlg; // Question dialog for disconnecting BT Accessory + TBool iHelpEnabled; // Flag for the Help feature + + // these are needed so these are owened by someone + // and can be cleaned up, in case the operations are interrupted by the user. + CBTDevice* iPairingDevice; + TNameEntry iPairingDevNameEntry; + TBTDevice* iConnectDevice; //device we are trying to connect to + TBTDevice iDisconnectQueryDevice; //device we are trying to disconnect + + CBTEngDiscovery* iDeviceSearcher; // used only for searching devices, not for device discovery + CBTEngSettings* iBtEngSettings; // used only for turning on bluetooth, + CBTUIPluginMan* iBTPluginMan; + CGSTabHelper* iTabHelper; + CBTUIMainView* iBaseView; + TBool iConstructAsGsPlugin; // Flag that indicate this obj is served as GS plugin not BTUI app's plugin. + TInt iExpectedCallBack; // In case of DeleteAll, counter for expected callback NotifyChangeDeviceCompleteL() + TBool iSearchOngoing; + TBool iIsConnectDevice; + MBtuiPluginViewActivationObserver* iActivationObserver; // view activation observer + TBool iIsAlreadyConnected; // used only for showing "Connected to" note once for Stereo device + TBTDevice iMenuDevice; + CEikMenuPane* iActiveMenuPane; + CBTUIActive* iActive; // used for subscribing notifier lock status + TBTDevAddr iPairConnectAddr; // the address of the just paired device + // with which a connection establishment is pending + TBool iIsPairConnect; // if we are doing auto-connecting after pairing or not + +}; + +#endif + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIRegistryWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIRegistryWatcher.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,120 @@ +/* +* 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: Declares Registry watcher class for BTUI. +* +*/ + + +#ifndef CBTUIREGISTRYWATCHERAO_H +#define CBTUIREGISTRYWATCHERAO_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** +* A callback interface for informing content change of BT Registry. +*/ +class MBTUIRegistryObserver + { + public: // New functions + + /** + * Informs the observer that contents of Registry has been changed. + * @param None. + * @return None. + */ + virtual void RegistryContentChangedL()=0; + }; + + +// CLASS DECLARATION + +/** +* An active object based class which can used to listen +* Registry changes +*/ +class CBTUIRegistryWatcherAO : public CActive + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBTUIRegistryWatcherAO( MBTUIRegistryObserver* aParent ); + + /** + * Destructor. + */ + virtual ~CBTUIRegistryWatcherAO(); + + public: // New functions + + /** + * Starts / continues Registry watching + * + * @param None. + * @return None. + */ + void WatchL(); + + /** + * Starts / continues Registry watching + * + * @param None. + * @return None. + */ + void StopWatching(); + + private: // Functions from base classes + + /** + * From CActive Gets called when CActive::Cancel is called, + * cancels Registry watching. + * + * @param None. + * @return None. + */ + void DoCancel(); + + /** + * From CActive Gets called when content of Registry is changed, + * calls MBTUIRegistryObserver::RegistryContentChangedL. + * + * @param None. + * @return None. + */ + void RunL(); + + /** + * From CActive Handles a leave occurring in the request completion event. + * + * @param aError The leave code. + * @return Symbian OS error code. + */ + TInt RunError(TInt aError); + + private: // Data + + // Reference to observer + MBTUIRegistryObserver* iParent; + // Database handle + RProperty iProperty; + }; + +#endif + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/BTUIViewsCommonUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/BTUIViewsCommonUtils.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,53 @@ +/* +* 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: +* +*/ + +#ifndef BTUIVIEWSCOMMONUTILS_H +#define BTUIVIEWSCOMMONUTILS_H + +#include + +class CBTEngSettings; +/** +* Utils class which offer common functions that were used by all BTUI views +*/ +class TBTUIViewsCommonUtils + { + public: + + /** + * Displays a general error note. + * + * @param None. + * @return None. + */ + static void ShowGeneralErrorNoteL(); // Display general error note + + /** Check if there are any bluetooth connections. + *@param None + *@return ETrue if there is one or more connections. + */ + static TBool IsAnyDeviceConnectedL(); + + /** Asks user to turn on bluetooth is it it not on. + * @param aBtEngSettings settings object used to turn on the bt. + * @param aCoverDisplayEnabled. True if cover display is enabled. + * @return KErrNone, if bluetooth is on, or has turned on. KErrCancel if user said no. System wide errorcode otherwise. + */ + static TInt TurnBTOnIfNeededL(CBTEngSettings* aBtEngSettings,TBool aCoverDisplayEnabled ); + }; + +#endif \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/bluetoothuiutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/bluetoothuiutil.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,92 @@ +/* +* 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: This provides utility for loading a BT device name without +* localised to a string to be shown in GUI. +* +*/ +#include + +class BluetoothUiUtil + { +public: + +/* + * Gets the starting position of a key whose pattern matches + * '%'{(0)*|} where 0 and is the decimal value + * of the specified position and is the symbol of the key, + * either 'U' or 'N'. + * + * For example, if the specified position of a number key + * is 0, both "%N" and "%0N" match, + * but "%1N" doesn't. If the position n is greater than 0, + * only "%N" matches. + * @param aDes the descriptor where a key parameter will be searched. + * @param aKey the specified key, 'U' or 'N' + * @param aKeyPos the position of the key. position starts from 0. + * @param aKeyLength the length of the key at return if the key exists. + * @return the start position of the key in aDes. KErrNotFound if the key + * is not available. + */ +inline static TInt GetSubstringKeyPos( const TDes& aDes, const TDesC& aKey, + TInt aKeyPos, TInt& aKeyLength ); + +/* + * Gets the starting position of a string key whose pattern matches + * '%'{(0)*|}'U' where 0 and is the decimal value + * of the specified position. + * + * For example, if the specified position is 0, both "%U" and "%0U" match, + * but "%1U" doesn't. If the position n is greater than 0, + * only "%U" matches. + * @param aDes the descriptor in which a string key will be searched. + * @param aKeyPos the position of the string key. position starts from 0. + * @param aKeyLength the length of the string key at return if the key exists. + * @return the start position of the string key in aDes. KErrNotFound if the key + * is not available. + */ +inline static TInt GetStringSubstringKeyPos( const TDes& aDes, TInt aKeyPos, TInt& aKeyLength ); + +/* + * Add a substring to the specified RBuf descriptor. + * ( Replace "%U" at the specified position withe the given string. + * @param aBuf the RBuf descriptor in which a "%U" will be replaced. + * @param aSub the substring that will replace a "%U". + * @param aSubPos the position of the "%U" to be replaced. Position starts from 0. + */ +inline static void AddSubstringL( RBuf& aBuf, const TDesC& aSub, TInt aSubPos); + +/* + * Load a string specified by the given resource ID, + * remove substrings that match "[" and ends with "]" and finally + * replace the "%U" or "%U" at the specified position with the + * given substring. + * + * This function is intended for adding a Bluetooth device name to a UI + * string but without localizing this name. + * + * (Using StringLoader will get the device name localized in some variants. + * This is a workaround to tackle the unwanted localization.) + * + * @param aBuf the RBuf descriptor in which a "%U" will be replaced. + * @param aSub the substring that will replace a "%U". + * @param aSubPos the position of the "%U" to be replaced. Position starts from 0. + */ +inline static void LoadResourceAndSubstringL(RBuf& aBuf, + TInt aResourceId, const TDesC& aSub, TInt aSubPos ); + }; + +#include "bluetoothuiutil.inl" + +// End of File + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/bluetoothuiutil.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/bluetoothuiutil.inl Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,103 @@ +/* +* 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: This provides utility for loading a BT device name without +* localised to a string to be shown in GUI. +* +*/ + +inline TInt BluetoothUiUtil::GetSubstringKeyPos( + const TDes& aDes, const TDesC& aKey, + TInt aKeyPos, TInt& aKeyLength ) + { + ASSERT( aKeyPos > KErrNotFound ); + _LIT(KPercentSymbol, "%" ); + // 32 would be to fit any key substring in practice: + TBuf<32> key; + TInt pos( KErrNotFound ); + // if the specified position is 0, check if "%" (%U or %N) exists. + if ( aKeyPos == 0 ) + { + key.Copy( KPercentSymbol ); + key.Append(aKey); + pos = aDes.Find( key ); + } + // Either the key is not found, or aKeyPos is not 0. + if ( pos == KErrNotFound ) + { + key.Copy( KPercentSymbol ); + key.AppendNum( aKeyPos ); + key.Append( aKey ); + pos = aDes.Find( key ); + } + if ( pos > KErrNotFound ) + { + aKeyLength = key.Length(); + } + return pos; + } + +inline TInt BluetoothUiUtil::GetStringSubstringKeyPos( + const TDes& aDes, TInt aKeyPos, TInt& aKeyLength ) + { + _LIT(KStringKeyword,"U"); + TPtrC ptr( KStringKeyword ); + return GetSubstringKeyPos(aDes, ptr, aKeyPos, aKeyLength ); + } + +inline void BluetoothUiUtil::AddSubstringL( + RBuf& aBuf, const TDesC& aSub, TInt aSubPos) + { + // Find the position of the specified "%U" or %[0-9]U in aBuf. + TInt keyLength; + TInt pos = GetStringSubstringKeyPos( aBuf, aSubPos, keyLength ); + if ( pos == KErrNotFound ) + { + User::Leave( pos ); + } + // Enlarge the max length of aBuf if needed: + TInt reqedLen = aBuf.Length() - keyLength + aSub.Length(); + if ( aBuf.MaxLength() < reqedLen ) + { + aBuf.ReAllocL( reqedLen ); + } + aBuf.Replace( pos, keyLength, aSub ); + } + +inline void BluetoothUiUtil::LoadResourceAndSubstringL(RBuf& aBuf, + TInt aResourceId, const TDesC& aSub, TInt aSubPos ) + { + HBufC* string = StringLoader::LoadL( aResourceId ); + aBuf.Assign( string ); + // Logical loc strings may contain redundant "[]" for some reason. + // This sub-string should be removed in our ad hoc parameter loading method. + _LIT( KLeftSquareBracket,"[" ); + _LIT( KRightSquareBracket,"]" ); + while ( 1 ) + { + TInt lpos = aBuf.Find( KLeftSquareBracket ); + TInt rpos = aBuf.Find( KRightSquareBracket ); + if ( lpos > KErrNotFound && rpos > KErrNotFound && ( rpos > lpos ) ) + { + aBuf.Delete(lpos, rpos - lpos + 1 ); + continue; + } + // No sub-strings that match "[" and ends with "]". Done + break; + } + // Add the substring to this string loaded from resource: + AddSubstringL( aBuf, aSub, aSubPos ); + } + +// End of File + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/inc/btuipluginman.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/inc/btuipluginman.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,111 @@ +/* +* 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: Plugin loader +* +*/ + + + +#ifndef BTUIPLUGINMAN_H +#define BTUIPLUGINMAN_H + +#include +#include +#include "BtuiPluginInterface.h" +#include "btdevmodel.h" + +typedef RPointerArray RImplInfoPtrArray; +typedef RPointerArray RPluginPtrArray; + +/** + * Class CBTUIPluginMan + * + * Load plugins of CBtuiPluginInterface + * + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CBTUIPluginMan ) + { + +public: + + /** + * Two-phase constructor + * + * @since S60 v5.0 + */ + static CBTUIPluginMan* NewL( CAknViewAppUi* aAppUi ); + + /** + * Destructor + */ + virtual ~CBTUIPluginMan(); + + /** + * Get the setting view. + * @param TBTDevice Get this device's view + * @return CAknView the view of the specified plugin + */ + CAknView* GetSettingViewL(TBTDevice& aDevice); + + /** + * Check if the plug-in for specified HID device exists. + * @param TBTDeviceClass Use ClassOfDevice as the property to search + * @return ETrue if exist, otherwise EFalse. + */ + TBool IsPluginAvaiable(TBTDeviceClass aDeviceClassInfo); + +private: + + /** + * C++ default constructor + * + * @since S60 v5.0 + */ + CBTUIPluginMan( CAknViewAppUi* aAppUi ); + + /** + * Symbian 2nd-phase constructor + * + * @since S60 v5.0 + */ + void ConstructL(); + + /** + * Load plugins which are for HID devices. + * @param None + * @return None + */ + void LoadPluginsL(); + +private: // data + + /** + * Array of pointers to ECom plug-in information objects. + */ + RImplInfoPtrArray iPluginInfoArray; + + /** + * Array of pointers to the BtuiPluginInterface ECom plug-ins loaded by PairedView. + */ + RPluginPtrArray iPluginArray; + + /** + * Current Application process + */ + CAknViewAppUi* iAppUi; + }; + + +#endif // BTUIPLUGINMAN_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIActive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIActive.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,151 @@ +/* +* 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: Active object helper class. +* +*/ + + +#include "BTUIActive.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTUIActive::CBTUIActive( MBTUIActiveObserver* aObserver, TInt aId, + TInt aPriority ) +: CActive( aPriority ), + iRequestId( aId ), + iObserver( aObserver ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTUIActive::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTUIActive* CBTUIActive::NewL( MBTUIActiveObserver* aObserver, + TInt aId, TInt aPriority ) + { + CBTUIActive* self = new( ELeave ) CBTUIActive( aObserver, aId, aPriority ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTUIActive::~CBTUIActive() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// RequestId() +// Return the request ID of this active object. +// --------------------------------------------------------------------------- +// +TInt CBTUIActive::RequestId() + { + return iRequestId; + } + +// --------------------------------------------------------------------------- +// SetRequestId() +// Set a new request ID for this active object. +// --------------------------------------------------------------------------- +// +void CBTUIActive::SetRequestId( TInt aId ) + { + iRequestId = aId; + } + +// --------------------------------------------------------------------------- +// GoActive() +// Set active. +// --------------------------------------------------------------------------- +// +void CBTUIActive::GoActive() + { + SetActive(); + } + +// --------------------------------------------------------------------------- +// CancelRequest() +// Cancel an outstanding request. +// --------------------------------------------------------------------------- +// +void CBTUIActive::CancelRequest() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// RequestStatus() +// Get a reference to the active object request status. +// --------------------------------------------------------------------------- +// +TRequestStatus& CBTUIActive::RequestStatus() + { + return iStatus; + } + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been cancelled. +// --------------------------------------------------------------------------- +// +void CBTUIActive::DoCancel() + { + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when the request has been completed. +// --------------------------------------------------------------------------- +// +void CBTUIActive::RunL() + { + iObserver->RequestCompletedL( this, iRequestId, iStatus.Int() ); + } + + +// --------------------------------------------------------------------------- +// From class CActive. +// Called by the active scheduler when an error in RunL has occurred. +// --------------------------------------------------------------------------- +// +TInt CBTUIActive::RunError( TInt aError ) + { + iObserver->HandleError( this, iRequestId, aError ); + return KErrNone; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIBlockedDevicesView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIBlockedDevicesView.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,439 @@ +/* +* 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: This is view that handles listing and +* unblocking blocked devices view. +* +*/ + +#include // AVKON components +#include +#include +#include // Compiled resource ids +#include // Feature Manager +#include +#include +#include +#include // Series 60 localisation stringloader +#include +#include // Help launcher +#include + +#include "BTUIBlockedDevicesView.h" +#include "BTUIDeviceContainer.h" +#include "debug.h" +#include "btui.h" + +#include +#include // Tab icon for General Setting +#include +#include "BTUIMainView.h" // base View. + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::ConstructL() + { + TRACE_FUNC_ENTRY + + BaseConstructL(R_BTUI_BLOCK_DEVICES_VIEW); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::ConstructL +// Symbian 2nd phase constructor when served as GS plugin. +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::ConstructL( CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray ) + { + iBaseView = aBaseView, + iTabHelper = CGSTabHelper::NewL(); + aTabViewArray->AppendL(this); + + BaseConstructL(R_BTUI_BLOCK_DEVICES_VIEW_GS); + + TRACE_INFO(_L("CBtuiGSPlugin* aBaseView, CArrayPtrFlat* aTabViewArray")) + } + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::NewL +// Two phased constructor +// --------------------------------------------------------- +// +CBTUIBlockedDevicesView* CBTUIBlockedDevicesView::NewL(MBtuiPluginViewActivationObserver* aObserver) + { + //TRACE_FUNC_ENTRY + CBTUIBlockedDevicesView* self = new (ELeave) CBTUIBlockedDevicesView(aObserver); + CleanupStack::PushL(self); + self->iConstructAsGsPlugin = EFalse; + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::NewL +// Two phased constructor +// --------------------------------------------------------- +// +CBTUIBlockedDevicesView* CBTUIBlockedDevicesView::NewLC(CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray) + { + CBTUIBlockedDevicesView* self = new (ELeave) CBTUIBlockedDevicesView(); + CleanupStack::PushL( self ); + + self->iConstructAsGsPlugin = ETrue; + self->ConstructL( aBaseView, aTabViewArray ); + + return self; + } + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::CBTUIBlockedDevicesView +// --------------------------------------------------------- + +CBTUIBlockedDevicesView::CBTUIBlockedDevicesView(MBtuiPluginViewActivationObserver* aObserver ) + :iActivationObserver(aObserver) + { + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CBTUIBlockedDevicesView::~CBTUIBlockedDevicesView() + { + TRACE_FUNC_ENTRY + if (iContainer) + { + AppUi()->RemoveFromViewStack(*this, iContainer); + } + + delete iContainer; + delete iModel; + + if(iConstructAsGsPlugin) + delete iTabHelper; + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIBlockedDevicesView::Id +// --------------------------------------------------------- +// +TUid CBTUIBlockedDevicesView::Id() const + { + TRACE_FUNC_ENTRY + return KBtuiPluginUidBlockedDevicesView;//KBTBlockDevicesViewId; + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIBlockedDevicesView::HandleCommandL +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::HandleCommandL(TInt aCommand) + { + TRACE_FUNC_ENTRY + TInt bItemIndex; + switch (aCommand) + { + case EAknSoftkeyBack: + // do not exit if devicechange is in progress. + if(iModel->DeviceChangeInProgress() ) + return; + AppUi()->ActivateLocalViewL(iBaseView->GetParentView().iViewUid ); + break; + + case EAknSoftkeyExit: + // do not exit if devicechange is in progress. + if(iModel->DeviceChangeInProgress() ) + return; + AppUi()->ProcessCommandL(EEikCmdExit); + break; + + case EBTUICmdDelete: + case EBTUICmdUnblock: + { + + bItemIndex = iContainer->CurrentItemIndex(); + if(bItemIndex < 0) + break; + + TBTDevice device; + device.iIndex = bItemIndex; + iModel->GetDevice(device); + + RBuf s; + CleanupClosePushL( s ); + BluetoothUiUtil::LoadResourceAndSubstringL( + s, R_BT_WARN_ERASE_BLOCKED, device.iName, 0); + + CAknQueryDialog* dialog = CAknQueryDialog::NewL(CAknQueryDialog::EConfirmationTone); + TInt keypress = dialog->ExecuteLD(R_BT_GENERIC_QUERY, s); + + CleanupStack::PopAndDestroy(&s); + + if(keypress) // User has accepted the dialog + { + device.iOperation = EOpUnblock; + iModel->ChangeDevice(device); + } + + break; + + } + case EBTUICmdDeleteAll: + case EBTUICmdUnblockAll: + { + CAknQueryDialog* dialog = CAknQueryDialog::NewL(CAknQueryDialog::EConfirmationTone); + HBufC* s=iCoeEnv->AllocReadResourceLC(R_BT_WARN_ERASE_ALL_BLOCKED); + TInt keypress=dialog->ExecuteLD(R_BT_GENERIC_QUERY, *s); + CleanupStack::PopAndDestroy(s); + + if(keypress) + { + iModel->ChangeAllDevices(EOpUnblock); + } + + break; + } + + case EAknCmdHelp: + { + #ifdef __SERIES60_HELP + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL()); + #endif + break; + } + + default: + { + AppUi()->HandleCommandL(aCommand); + break; + } + } + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------- +// From CAknView +// CBTUIBlockedDevicesView::DoActivateL +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + TRACE_FUNC_ENTRY + // Setup title + // + iModel = CBTDevModel::NewL(EGroupBlocked, this); + iContainer = CBTUiDeviceContainer::NewL(ClientRect(), this, EGroupBlocked, this); + + HBufC* btBlockDevices = iCoeEnv->AllocReadResourceLC(R_BT_TITLE_BLOCKED_DEV); + CEikStatusPane* statusPane = StatusPane(); + CAknTitlePane* titlePane; + titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); + titlePane->SetTextL(*btBlockDevices); + CleanupStack::PopAndDestroy(btBlockDevices); + AppUi()->AddToStackL(*this, iContainer); + DimMskL(ETrue ); + // the MSK will be undimmed, if there are blocked devices when + // the deviceList will be refreshed + + if( iBaseView && iConstructAsGsPlugin) + { + iTabHelper->CreateTabGroupL( Id(), + static_cast*> + (iBaseView->TabbedViews()) ); + } + + + MenuBar()->SetContextMenuTitleResourceId( + R_BTUI_MENUBAR_BLOCK_DEVICES_VIEW); + + // notify observer + if( iActivationObserver && iConstructAsGsPlugin == EFalse) + { + iActivationObserver->PluginViewActivated(EBlockedDevicesViewId); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIBlockedDevicesView::DoDeactivate +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::DoDeactivate() + { + TRACE_FUNC_ENTRY + if (iContainer) + { + AppUi()->RemoveFromStack(iContainer); + delete iContainer; + iContainer = NULL; + } + + delete iModel; + iModel=NULL; + if(iConstructAsGsPlugin) + iTabHelper->RemoveTabGroup(); + + TRACE_FUNC_EXIT + } +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::DimMskL +// This will dim/Undim MSK. +// However the command is sent when the key is pressed +// regardless wether the MSK command is visible and +// the view must be able to receive it anyway. +// --------------------------------------------------------- +void CBTUIBlockedDevicesView::DimMskL(TBool aDimmed) + { + TRACE_FUNC_ENTRY + if(aDimmed) + { + Cba()->SetCommandL (EBTUICmdUnblock,KNullDesC); + } + else + { + if(iConstructAsGsPlugin) + { + Cba()->SetCommandSetL(R_BTUI_SOFTKEYS_OPTIONS_BACK__UNBLOCK); + } + else + { + Cba()->SetCommandSetL(R_BTUI_SOFTKEYS_OPTIONS_EXIT__UNBLOCK); + } + } + + Cba()->DrawDeferred(); + + // NOTE: these will only hide the MSK label. + // The command is still being sent if button is pressed. + // HandleCommanL will take care + // of the situation that there may be no devices to unblock + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIBlockedDevicesView::DynInitMenuPaneL +// Shows selected item's context sensitive options menu. +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::DynInitMenuPaneL(TInt aResId, CEikMenuPane* aMenu) + { + TRACE_FUNC_ENTRY + // dim help if it exists and is not supported + TInt tmp; + if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) ) + { + aMenu->SetItemDimmed(EAknCmdHelp, + !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); + } + + // do not "unblock all" commands + // if there is nothing to unblock + if (aResId == R_BTUI_BLOCK_DEVICES_VIEW_MENU) + { + if( iContainer->CountItems() == 0) + { + aMenu->SetItemDimmed(EBTUICmdUnblockAll, ETrue); + } + else + { + aMenu->SetItemDimmed(EBTUICmdUnblockAll, EFalse); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From MBTDeviceObserver +// CBTUIBlockedDevicesView::NotifyChangeDeviceComplete +// --------------------------------------------------------- +// +void CBTUIBlockedDevicesView::NotifyChangeDeviceComplete(const TInt aErr, + const TBTDevice&, const RBTDevNameArray* ) + { + TRACE_FUNC_ENTRY + // we do not show any note, when blocked devices are unblocked, + // and that is the only command available. + + if(aErr!= KErrNone) + { + TRAP_IGNORE(TBTUIViewsCommonUtils::ShowGeneralErrorNoteL();); + } + TRACE_FUNC_EXIT + } + + +// ----------------------------------------------- +// From MBTDeviceObserver +// CBTUIBlockedDevicesView::RefreshDeviceList +// ----------------------------------------------- +void CBTUIBlockedDevicesView::RefreshDeviceList(const RDeviceArray* aDevices, + TInt aSelectedItemIndex) + { + TRACE_FUNC_ENTRY + + TRAPD(err, + if(iContainer) + { + iContainer->RefreshDeviceListL(aDevices,aSelectedItemIndex ); + } + // dim the MSK if there are no devices to unblock + DimMskL(aDevices->Count()==0); + + ); + if(err!= KErrNone) + { + TRAP_IGNORE( TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); ); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// CBTUIBlockedDevicesView::CreateTabIconL() +// Creates icon for tab. +// --------------------------------------------------------------------------- +// +CGulIcon* CBTUIBlockedDevicesView::CreateTabIconL() + { + TFileName bmpFilename; + bmpFilename += KBitmapFileDrive; + bmpFilename += KDC_APP_BITMAP_DIR; + bmpFilename += KBtuiBmpFileName; + + CGulIcon* icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropBtBlockedTab3, + bmpFilename, + EMbmBtuiQgn_prop_bt_blocked_tab3, + EMbmBtuiQgn_prop_bt_blocked_tab3_mask ); + + return icon; + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIDeviceContainer.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,673 @@ +/* +* 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: This is the implementation of device list container. It contains +* all necessary AVKON components and handles user inputs +* for paired and blocked devices view. +* +*/ + + +#include // Compiled resource ids +#include +#include // For Extended skinning icons +#include +#include // For char filter +#include +#include // AVKON icons +#include // Help IDs + +#include "BTUIDeviceContainer.h" +#include "BTUIListedDevicesView.h" +#include "debug.h" +#include "btui.h" // Global declarations + +const TInt KBTNumberOfIcons = 14; // Number of class of device icons + extra one DEV_STATUS_AUTHORIZED + +_LIT( DEV_TYPE_COMPUTER,"0\t"); +_LIT( DEV_TYPE_PHONE,"1\t"); +_LIT( DEV_TYPE_AUDIO,"2\t"); +_LIT( DEV_TYPE_DEFAULT,"3\t"); +_LIT( DEV_TYPE_KEYBOARD,"4\t"); +_LIT( DEV_TYPE_MOUSE,"5\t"); +_LIT( DEV_TYPE_PRINTER,"6\t"); +_LIT( DEV_TYPE_CARKIT,"7\t"); +_LIT( DEV_TYPE_AUDIO_CONNECT,"8\t"); +_LIT( DEV_TYPE_COMPUTER_CONNECT,"9\t"); +_LIT( DEV_TYPE_KEYBOARD_CONNECT,"10\t"); +_LIT( DEV_TYPE_CARKIT_CONNECT,"11\t"); +_LIT( DEV_TYPE_MOUSE_CONNECT,"12\t"); + +_LIT(DEV_STATUS_NORMAL, "\t" ); // blocked in blocked devices view, paired in pairred devices view +_LIT(DEV_STATUS_AUTHORIZED, "\t13" ); // autorized in paired devices view + + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBTUiDeviceContainer::ConstructL +// --------------------------------------------------------- +void CBTUiDeviceContainer::ConstructL(const TRect& aRect, + CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup) + { + TRACE_FUNC_ENTRY + + CreateWindowL(); + + iView = aView; + iGroup = aGroup; + // Create new list for other paired bt-devices + // + iDeviceList = new (ELeave) CAknSingleGraphicStyleListBox; + iDeviceList->SetContainerWindowL(*this); + iDeviceList->ConstructL(this, EAknListBoxSelectionList); + + iDeviceList->SetListBoxObserver( this ); + + // Set the empty text at basis of the list + iDeviceList->View()->SetListEmptyTextL( KNullDesC ); + + // Set up filenames for Btui and Avkon bitmaps + TFileName bmpFilename; + bmpFilename += KBitmapFileDrive; + bmpFilename += KDC_APP_BITMAP_DIR; + bmpFilename += KBtuiBmpFileName; + + // The avkon bitmap we will get from AknIconUtils::AvkonIconFileName() + TFileName avkonbmpFilename = AknIconUtils::AvkonIconFileName(); + + // Setup graphic items list for BT devices listbox + CAknIconArray* iconList = new(ELeave) CAknIconArray(KBTNumberOfIcons); + CleanupStack::PushL( iconList ); + + + CreateAndAppendIconL( KAknsIIDQgnPropBtComputer, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_computer, + EMbmAvkonQgn_prop_bt_computer_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtPhone, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_phone, + EMbmAvkonQgn_prop_bt_phone_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtAudio, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_audio, + EMbmAvkonQgn_prop_bt_audio_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtMisc, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_misc, + EMbmAvkonQgn_prop_bt_misc_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtKeyboard, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_keyboard, + EMbmAvkonQgn_prop_bt_keyboard_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtMouse, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_mouse, + EMbmAvkonQgn_prop_bt_mouse_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtPrinter, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_printer, + EMbmAvkonQgn_prop_bt_printer_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtCarKit, + avkonbmpFilename, + EMbmAvkonQgn_prop_bt_carkit, + EMbmAvkonQgn_prop_bt_carkit_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtAudioConnect, + bmpFilename, + EMbmBtuiQgn_prop_bt_audio_connect, + EMbmBtuiQgn_prop_bt_audio_connect_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtComputerConnect, + bmpFilename, + EMbmBtuiQgn_prop_bt_computer_connect, + EMbmBtuiQgn_prop_bt_computer_connect_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtKeyboardConnect, + bmpFilename, + EMbmBtuiQgn_prop_bt_keyboard_connect, + EMbmBtuiQgn_prop_bt_keyboard_connect_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtCarKitConnect, + bmpFilename, + EMbmBtuiQgn_prop_bt_car_kit_connect, + EMbmBtuiQgn_prop_bt_car_kit_connect_mask, + iconList); + + CreateAndAppendIconL( KAknsIIDQgnPropBtMouseConnect, + bmpFilename, + EMbmBtuiQgn_prop_bt_mouse_connect, + EMbmBtuiQgn_prop_bt_mouse_connect_mask, + iconList); + + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), + KAknsIIDQgnIndiBtTrustedAdd, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + bitmap, mask, + avkonbmpFilename, + EMbmAvkonQgn_indi_bt_trusted_add, + EMbmAvkonQgn_indi_bt_trusted_add_mask, + KRgbBlack); + CGulIcon* icon = CGulIcon::NewL(bitmap, mask); + + CleanupStack::Pop(mask); + CleanupStack::Pop(bitmap); + + CleanupStack::PushL(icon); + iconList->AppendL( icon ); + CleanupStack::Pop(icon); + + + // Transfer iconlist ownership to the listbox + iDeviceList->ItemDrawer()->ColumnData()->SetIconArray(iconList); + CleanupStack::Pop(iconList); + + // Create scrollbars + iDeviceList->CreateScrollBarFrameL(ETrue); + iDeviceList->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto); + + SetRect(aRect); + ActivateL(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUiDeviceContainer::NewL +// --------------------------------------------------------- +CBTUiDeviceContainer* CBTUiDeviceContainer::NewL(const TRect& aRect, + CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup, MObjectProvider* aParent) + { + CBTUiDeviceContainer* self = new (ELeave) CBTUiDeviceContainer(); + self->SetMopParent(aParent); + CleanupStack::PushL(self); + self->ConstructL(aRect, aView, aGroup); + CleanupStack::Pop(self); + return self; + } +// --------------------------------------------------------- +// destructor +// --------------------------------------------------------- + +CBTUiDeviceContainer::~CBTUiDeviceContainer() + { + TRACE_FUNC_ENTRY + delete iDeviceList; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUiDeviceContainer::RefreshDeviceListL +// This function will refresh only the changed parts of the +// screen, if any. +// --------------------------------------------------------- +void CBTUiDeviceContainer::RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt selectedItem) + { + TRACE_FUNC_ENTRY + + MDesCArray* itemTextArray = iDeviceList->Model()->ItemTextArray(); + CDesCArray* itemArray = (CDesCArray*) itemTextArray; + TBool removal=EFalse; + TBool addition=EFalse; + TInt previouslySelected=CurrentItemIndex(); + TBTDeviceName listItem; + TInt deviceCount = aDeviceArray->Count(); + TInt i = 0; + for( ; i < deviceCount; i++) + { + TBTDevice device = *(*aDeviceArray)[i]; + CreateListItemL(device, listItem); + if(itemArray->Count()<=i) + { + itemArray->AppendL(listItem); + addition=ETrue; + } + else + if(listItem != (*itemArray)[i] ) + { + itemArray->Delete(i); + itemArray->InsertL(i,listItem); + + removal=ETrue; + addition=ETrue; + } + + } + if(itemArray->Count()-i>=0) + { + itemArray->Delete(i,itemArray->Count()-i); + removal=ETrue; + } + + + if(removal) + iDeviceList->HandleItemRemovalL(); + if(addition) + iDeviceList->HandleItemAdditionL(); + + if(deviceCount >0 ) + iDeviceList->SetCurrentItemIndex( Max(selectedItem,0 )) ; + else + { + HBufC* devEmptyText = NULL; + if(iGroup ==EGroupPaired) + { + devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_PAIRED_DEVICES); + } + else + { + devEmptyText=iCoeEnv->AllocReadResourceLC( R_BT_NO_BLOCKED_DEVICES); + } + iDeviceList->View()->SetListEmptyTextL(*devEmptyText ); + CleanupStack::PopAndDestroy(devEmptyText); + } + + if(addition | removal | previouslySelected!=selectedItem) + iDeviceList->DrawDeferred(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUiDeviceContainer::CountItems +// --------------------------------------------------------- +TInt CBTUiDeviceContainer::CountItems() + { + return iDeviceList->Model()->ItemTextArray()->MdcaCount(); + } + +// --------------------------------------------------------- +// CBTUiDeviceContainer::CreateListItemL +// --------------------------------------------------------- +void CBTUiDeviceContainer::CreateListItemL(const TBTDevice& aDevice, TBTDeviceName& aListItem) + { + TRACE_FUNC_ENTRY + aListItem.Zero(); // may not needed + + TInt iconIndex = (TInt)(aDevice.iType); + + switch( iconIndex) + { + case EDeviceComputer: + if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + aListItem.Append(DEV_TYPE_COMPUTER_CONNECT); + } + else + { + aListItem.Append(DEV_TYPE_COMPUTER); + } + break; + + case EDevicePhone: + aListItem.Append(DEV_TYPE_PHONE); + break; + + case EDeviceAudio: + if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + aListItem.Append(DEV_TYPE_AUDIO_CONNECT); + } + else + { + aListItem.Append(DEV_TYPE_AUDIO); + } + break ; + case EDeviceCarkit: + if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + aListItem.Append(DEV_TYPE_CARKIT_CONNECT); + } + else + { + aListItem.Append(DEV_TYPE_CARKIT); + } + break ; + + case EDevicePrinter: + aListItem.Append(DEV_TYPE_PRINTER); + break; + + case EDeviceKeyboard: + + if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + aListItem.Append(DEV_TYPE_KEYBOARD_CONNECT); + } + else + { + aListItem.Append(DEV_TYPE_KEYBOARD); + } + break ; + + case EDeviceMice: + + if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + aListItem.Append(DEV_TYPE_MOUSE_CONNECT); + } + else + { + aListItem.Append(DEV_TYPE_MOUSE); + } + break; + + case EDeviceDefault: + aListItem.Append(DEV_TYPE_DEFAULT); + break; + + default: + aListItem.Append('\t'); + break; + } + + aListItem.Append(aDevice.iName); + + if((aDevice.iStatus & EStatusTrusted) == EStatusTrusted && iGroup ==EGroupPaired ) + { + aListItem.Append(DEV_STATUS_AUTHORIZED); + } + else + { + aListItem.Append( DEV_STATUS_NORMAL ); + } + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::OfferKeyEventL +// --------------------------------------------------------- +TKeyResponse CBTUiDeviceContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TRACE_FUNC_ENTRY + // Inform model where we are now + TInt bItemIndex = CurrentItemIndex(); + + // Shortcut for deleting a device + if ((aKeyEvent.iCode == EKeyBackspace) && (bItemIndex >= 0)) + { + iView->HandleCommandL( EBTUICmdDelete ); + return EKeyWasConsumed; + } + + // Show popup commands window if selection or enter key is pressed. + // It should not go to here, unless | EAknEnableMSK is not set + if ((aKeyEvent.iCode == EKeyDevice3) || (aKeyEvent.iCode == EKeyEnter)) + { + iView->ProcessCommandL(EAknSoftkeyContextOptions); + return EKeyWasConsumed; + } + + if ((aKeyEvent.iCode != EKeyLeftArrow) && + (aKeyEvent.iCode != EKeyRightArrow)) + { + TRACE_FUNC_EXIT + return iDeviceList->OfferKeyEventL(aKeyEvent, aType); + } + else + { + // BTRegistry operations are not done in atomic way + // so we cannot allow them to be interrupted + if(iView->DeviceChangeInProgress()) + return EKeyWasConsumed; + + TRACE_FUNC_EXIT + return EKeyWasNotConsumed; + } + } + +// ---------------------------------------------------- +// CBTUiDeviceContainer::CreateAndAppendIconL +// ---------------------------------------------------- +void CBTUiDeviceContainer::CreateAndAppendIconL( + const TAknsItemID& aID, + const TDesC& aFileName, + const TInt aBitmapId, + const TInt aMaskId, + CAknIconArray* aIconList) + { + TRACE_FUNC_ENTRY + + CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), + aID, aFileName, aBitmapId, aMaskId); + + CleanupStack::PushL(icon); + aIconList->AppendL(icon); + CleanupStack::Pop(icon); + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::GetHelpContext +// --------------------------------------------------------- +void CBTUiDeviceContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + TRACE_FUNC_ENTRY +#ifdef __SERIES60_HELP + + aContext.iMajor = KBtuiUid3; + if( iGroup ==EGroupPaired) + aContext.iContext = KBT_HLP_PAIRED; + else + aContext.iContext = KBT_HLP_BLOCKED ; +#else +#endif + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::SizeChanged +// Called by framework when the view size is changed +// --------------------------------------------------------- +void CBTUiDeviceContainer::SizeChanged() + { + TRACE_FUNC_ENTRY + iDeviceList->SetRect(Rect()); // Mandatory, otherwise not drawn + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::CountComponentControls +// --------------------------------------------------------- +TInt CBTUiDeviceContainer::CountComponentControls() const + { + TRACE_FUNC_ENTRY + // return number of controls inside this container + return 1; + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::ComponentControl +// --------------------------------------------------------- +CCoeControl* CBTUiDeviceContainer::ComponentControl(TInt aIndex) const + { + TRACE_FUNC_ENTRY + if(aIndex == 0) + { + return iDeviceList ; + } + else + { + return NULL; + } + } + +// ---------------------------------------------------- +// CBTUiDeviceContainer::CurrentItemIndex +// ---------------------------------------------------- +TInt CBTUiDeviceContainer::CurrentItemIndex() + { + TRACE_FUNC_ENTRY + + return iDeviceList->CurrentItemIndex(); + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::Draw +// --------------------------------------------------------- +void CBTUiDeviceContainer::Draw( const TRect& /* aRect */ ) const + { + } + +// --------------------------------------------------------- +// From MCoeControlObserver +// CBTUiDeviceContainer::HandleControlEventL +// --------------------------------------------------------- +void CBTUiDeviceContainer::HandleControlEventL( CCoeControl* /* aControl */, TCoeEvent /* aEventType */ ) + { + TRACE_FUNC_ENTRY + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::HandleResourceChange +// --------------------------------------------------------- +void CBTUiDeviceContainer::HandleResourceChange( TInt aType ) + { + TRACE_FUNC_ENTRY + CCoeControl::HandleResourceChange(aType); + TRAP_IGNORE(HandleResourceChangeL(aType)); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// Internal Leave function +// CBTUiDeviceContainer::HandleResourceChangeL +// --------------------------------------------------------- +void CBTUiDeviceContainer::HandleResourceChangeL( TInt aType ) + { + TRACE_FUNC_ENTRY + + //Handle change in layout orientation + if (aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + + // Because the trailing icons are not changed properly after theme is changed. + // we refresh those icons in the iconlist from iDeviceList manually. + + // Get iconlist from listbox + CAknIconArray* iconList = static_cast(iDeviceList->ItemDrawer()->ColumnData()->IconArray()); + + CleanupStack::PushL( iconList ); + // remove the last two icons which will not be updated properly by theme changing. + iconList->Delete(KBTNumberOfIcons-1); + + // The avkon bitmap we will get from AknIconUtils::AvkonIconFileName() + TFileName avkonbmpFilename = AknIconUtils::AvkonIconFileName(); + + + + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), + KAknsIIDQgnIndiBtTrustedAdd, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + bitmap, mask, + avkonbmpFilename, + EMbmAvkonQgn_indi_bt_trusted_add, + EMbmAvkonQgn_indi_bt_trusted_add_mask, + KRgbBlack); + + + CGulIcon* icon = CGulIcon::NewL(bitmap, mask); + + CleanupStack::Pop(2); // bitmap, mask; + + CleanupStack::PushL(icon); + + iconList->AppendL( icon ); + CleanupStack::Pop(icon); + + + // Transfer iconlist ownership back to the listbox + iDeviceList->ItemDrawer()->ColumnData()->SetIconArray(iconList); + CleanupStack::Pop(iconList); + + SetRect(mainPaneRect); + DrawDeferred(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::FocusChanged +// --------------------------------------------------------- +void CBTUiDeviceContainer::FocusChanged(TDrawNow /*aDrawNow*/) + { + TRACE_FUNC_ENTRY + iDeviceList->SetFocus(IsFocused()); + TRACE_FUNC_EXIT + } +// --------------------------------------------------------- +// From CCoeControl +// CBTUiDeviceContainer::HandleListBoxEventL +// +// Handle touch screen singleclick as MSK devent to paired view or +// as delete key event to blocked devices view. +// --------------------------------------------------------- +// +void CBTUiDeviceContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + TRACE_FUNC_ENTRY + // this is no longer called, unless MSK is disabled. + // if msk is not disabled, then + // BTMainView::HandleCommand(EBTUICmdMSK) is called instead + if( aEventType == EEventEnterKeyPressed + || aEventType == EEventItemSingleClicked) // Selection key pressed, or item clicked + { + // msk open context options in paired devices view. + // it will unblock the selected blocked device in blocked devices view. + if(iGroup==EGroupPaired) + { + iView->ProcessCommandL( EAknSoftkeyContextOptions); + } + else + { + iView->ProcessCommandL( EBTUICmdUnblock); + } + + } + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIKeyWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIKeyWatcher.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,151 @@ +/* +* 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: Listen to CenRep and PubSub Keys +* +*/ + + +#include +#include +#include +#include +#include "BTUIKeyWatcher.h" +#include "BTUIMainView.h" +#include "debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTUIKeyWatcher* CBTUIKeyWatcher::NewL( TAny* aCaller, TInt aServiceID ) + { + CBTUIKeyWatcher* self = new( ELeave ) CBTUIKeyWatcher( aCaller ); + CleanupStack::PushL( self ); + self->ConstructL( aServiceID ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTUIKeyWatcher::CBTUIKeyWatcher( TAny* aCaller ) +: iCaller( aCaller ) + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTUIKeyWatcher::ConstructL( TInt aServiceID ) + { + TRACE_FUNC_ENTRY + + if( aServiceID & KBTUIPHYCountWatcher ) + { + TInt err = iPHYCountKey.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount ); + if( !err ) + { + iPHYCountWatcher = CBTUIActive::NewL( this, KBTUIPHYCountWatcher, CActive::EPriorityStandard ); + if( iPHYCountWatcher != NULL ) + { + iPHYCountKey.Subscribe( iPHYCountWatcher->RequestStatus() ); + iPHYCountWatcher->GoActive(); + } + else + { + TRACE_INFO(_L("new iPHYCountWatcher failed")); + } + } + else + { + TRACE_INFO((_L("Attach failed %d"), err)) + } + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTUIKeyWatcher::~CBTUIKeyWatcher() + { + TRACE_FUNC_ENTRY + + if( iPHYCountKey.Handle() ) + { + iPHYCountKey.Cancel(); + } + if( iPHYCountWatcher ) + { + delete iPHYCountWatcher; + iPHYCountWatcher = NULL; + } + iPHYCountKey.Close(); + + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Processes a changed key value. +// --------------------------------------------------------------------------- +// +void CBTUIKeyWatcher::RequestCompletedL( CBTUIActive* aActive, TInt aId, TInt /*aStatus*/ ) + { + switch( aId ) + { + case KBTUIPHYCountWatcher: + iPHYCountKey.Subscribe( aActive->RequestStatus() ); + aActive->GoActive(); + static_cast(iCaller)->UpdateParentView(); + break; + default: + TRACE_INFO((_L("wrong key notification! id=%d"), aId)) + break; + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// From class MBTEngActiveObserver. +// Handles a leave in RunL/RequestCompletedL by checking that all +// the subscriptions are active. +// --------------------------------------------------------------------------- +// +void CBTUIKeyWatcher::HandleError( CBTUIActive* aActive, TInt aId, TInt aError ) + { + TRACE_INFO((_L("status = %d"), aError)) + (void) aError; + if( !aActive->IsActive() ) + { + switch( aId ) + { + case KBTUIPHYCountWatcher: + iPHYCountKey.Subscribe( aActive->RequestStatus() ); + aActive->GoActive(); + break; + default: + TRACE_INFO((_L("wrong key notification! id=%d"), aId)) + break; + } + } + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIMainContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIMainContainer.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,466 @@ +/* +* 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: This is the implementation of main container. It contains +* all necessary AVKON components and handles user inputs. +* +*/ + +#include +#include +#include // Resource reader +#include // Compiled resource ids +#include // For EnterpriseEnablementL() +#include "BTUIMainContainer.h" +#include "debug.h" // Global declarations +#include "btui.h" +#ifdef __SERIES60_HELP +#include // Help ids +#endif + +// --------------------------------------------------------- +// CBTUIMainContainer::ConstructL +// Symbian OS 2nd phase constructor can leave +// --------------------------------------------------------- +// +void CBTUIMainContainer::ConstructL(const TRect& aRect, CBTUIMainView* aMainView ) + { + TRACE_FUNC_ENTRY + + CreateWindowL(); + + iMainView = aMainView; + + // Check if listbox is empty + __ASSERT_DEBUG(iBtMainListBox==0, PANIC( EBTMainListNotEmpty )); + __ASSERT_DEBUG(iBtAllItemsArray==0, PANIC( EBTAllFormatStingsArrayNotEmpty )); + __ASSERT_DEBUG(iBtListItemArray==0, PANIC( EBTFormatStingsArrayNotEmpty )); + + // Create main itemlist + iBtMainListBox = new (ELeave) CAknSettingStyleListBox; + iBtMainListBox->SetContainerWindowL( *this ); + iBtMainListBox->ConstructL( this, EAknListBoxMarkableList ); + + + // Update settings from original sources via model + iBtEngSettingsRef = iMainView->GetBtSettingsReference(); + + __ASSERT_DEBUG(iBtEngSettingsRef!=0, PANIC(EBTPanicIllegalValue)); + + // Read all format strings from resources and create array for them + iBtAllItemsArray = iCoeEnv->ReadDesCArrayResourceL( R_BT_LABEL_STRINGS ); + iBtListItemArray = new (ELeave) TMainListItemArray( + iBtAllItemsArray, aMainView, iBtEngSettingsRef ); + + // Set up/down arrows at bottom of the screen (scrollbar) + iBtMainListBox->CreateScrollBarFrameL( ETrue ); + iBtMainListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); + + // Set text labels for list items again (overwriting resource definitions) + iBtMainListBox->Model()->SetItemTextArray( iBtListItemArray ); + iBtMainListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Does not delete items array + + // Set up the observer (events listener) + iBtMainListBox->SetListBoxObserver( this ); + + + + SetRect(aRect); + ActivateL(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CBTUIMainContainer::~CBTUIMainContainer() + { + TRACE_FUNC_ENTRY + delete iBtMainListBox; + delete iBtAllItemsArray; + delete iBtListItemArray; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIMainContainer::SizeChanged() +// From CCoeControl +// Called by framework when the view size is changed +// --------------------------------------------------------- +// +void CBTUIMainContainer::SizeChanged() + { + TRACE_FUNC_ENTRY + iBtMainListBox->SetRect(Rect()); // Mandatory, otherwise not drawn + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::CountComponentControls() const +// --------------------------------------------------------- +// +TInt CBTUIMainContainer::CountComponentControls() const + { + TRACE_FUNC_ENTRY + if(iBtMainListBox ) + return 1; + else + return 0; // return nbr of controls inside this container + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::ComponentControl(TInt aIndex) const +// --------------------------------------------------------- +// +CCoeControl* CBTUIMainContainer::ComponentControl(TInt aIndex) const + { + TRACE_FUNC_ENTRY + if( aIndex ==0 ) + { + return iBtMainListBox; + } + return NULL; + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::Draw +// --------------------------------------------------------- +// +void CBTUIMainContainer::Draw(const TRect& /* aRect */) const + { + } + +// --------------------------------------------------------- +// From CoeControl +// CBTUIMainContainer::HandleControlEventL +// --------------------------------------------------------- +// +void CBTUIMainContainer::HandleControlEventL( CCoeControl* /* aControl */, TCoeEvent /* aEventType */) + { + } + +// --------------------------------------------------------- +// From CoeControl +// CBTUIMainContainer::OfferKeyEventL +// Redirect keypresses to the listbox +// --------------------------------------------------------- +// +TKeyResponse CBTUIMainContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + TRACE_FUNC_ENTRY + if(( iBtMainListBox ) && ( aKeyEvent.iCode != EKeyLeftArrow ) + && (aKeyEvent.iCode != EKeyRightArrow )) + { + TKeyResponse res = iBtMainListBox->OfferKeyEventL( aKeyEvent, aType ); + + // Store current item index for options list usage later + // + iCurrentItemIndex = iBtMainListBox->CurrentItemIndex(); + return res; + } + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------- +// From MEikListBoxObserver +// CBTUIMainContainer::HandleListBoxEventL +// --------------------------------------------------------- +// +void CBTUIMainContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) + { + TRACE_FUNC_ENTRY + + __ASSERT_DEBUG(iMainView!=0, PANIC(EBTPanicIllegalValue)); + + // this is no longer called, unless MSK is disabled. + // if msk is not disabled, then + // BTMainView::HandleCommand(EBTUICmdMSK) is called instead + if( aEventType == EEventEnterKeyPressed + || aEventType == EEventItemSingleClicked ) // Selection key pressed, or item clicked + { + TInt currentHighLightPosition = aListBox->CurrentItemIndex(); + switch(currentHighLightPosition) + { + case EBTMainListItemPowerMode: + iMainView->HandleCommandL( EBTUICmdChangePowerStateSelect ); + break; + case EBTMainListItemVisibilityMode: + iMainView->HandleCommandL( EBTUICmdChangeVisibilitySelect ); + break; + case EBTMainListItemNameSetting: + iMainView->HandleCommandL( EBTUICmdChangeBTNameSelect ); + break; + + // For Bluetooth SIM Access Profile feature + // + case EBTMainListItemSapMode: + iMainView->HandleCommandL( EBTUICmdChangeSapStateSelect ); + break; + default: + break; + } + aListBox->DrawItem(currentHighLightPosition); // Redraw item only to the screen + } + } + +// ---------------------------------------------------- +// From CEikListBox +// CBTUIMainContainer::CurrentItemIndex +// ---------------------------------------------------- +// +TInt CBTUIMainContainer::CurrentItemIndex() + { + TRACE_FUNC_ENTRY + + return iBtMainListBox->CurrentItemIndex(); + } + +// ---------------------------------------------------- +// CBTUIMainContainer::SettingChangedL +// ---------------------------------------------------- +// +void CBTUIMainContainer::SettingChanged( TBTMainListItemIndexes /* aListItem */ ) + { + TRACE_FUNC_ENTRY + + iBtMainListBox->DrawDeferred(); + } + +#ifdef __SERIES60_HELP + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::GetHelpContext +// --------------------------------------------------------- +// +void CBTUIMainContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + TRACE_FUNC_ENTRY + + aContext.iMajor = KBtuiUid3; + aContext.iContext = KBT_HLP_MAIN; + } + +#else + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::GetHelpContext +// --------------------------------------------------------- +// +void CBTUIMainContainer::GetHelpContext(TCoeHelpContext& /*aContext*/) const + { + TRACE_FUNC_ENTRY + } + +#endif + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::HandleResourceChange +// --------------------------------------------------------- +// +void CBTUIMainContainer::HandleResourceChange( TInt aType ) + { + TRACE_FUNC_ENTRY + //Pass the event to base class, so whenever resource changing happened, + //this control will be considered to be re-drawed by base class, therefore + //no specific DrawNow() function call is needed here. + CCoeControl::HandleResourceChange(aType); + + //Handle change in layout orientation + //aType == KAknsMessageSkinChange is handled by base class. + if (aType == KEikDynamicLayoutVariantSwitch) + { + //"TRect rect = iAvkonAppUi->ClientRect();" + // The line above provides to big rectangle in the bottom causing cba's overdrawn by by blank area. + // Correct way to do this is below. + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + } + } + +// --------------------------------------------------------- +// From CCoeControl +// CBTUIMainContainer::FocusChanged +// --------------------------------------------------------- +// +void CBTUIMainContainer::FocusChanged(TDrawNow /*aDrawNow*/) + { + TRACE_FUNC_ENTRY + if( iBtMainListBox) + { + iBtMainListBox->SetFocus( IsFocused() ); + } + } + + +// ******************************************* +// Nested class function implemenations: +// ******************************************* + +// ---------------------------------------------------- +// CBTUIMainContainer::TMainListItemArray::TMainListItemArray +// Initialize friend class +// ---------------------------------------------------- +CBTUIMainContainer::TMainListItemArray::TMainListItemArray( CDesCArray* aBtAllItemsArray, + CBTUIMainView* aMainView, CBTEngSettings* aBtEngSettings) + + : iArray( *aBtAllItemsArray ), // Store references + iMainView( aMainView ), + iBtEngSettingsRef( aBtEngSettings ) + + { + TRACE_FUNC_ENTRY + } + +// ---------------------------------------------------- +// CBTUIMainContainer::TMainListItemArray::MdcaCount() +// ---------------------------------------------------- +// +TInt CBTUIMainContainer::TMainListItemArray::MdcaCount() const + { + TRACE_FUNC_ENTRY + return KNumberOfMainViewItems; + } + +// ---------------------------------------------------- +// CBTUIMainContainer::TMainListItemArray::MdcaPointL +// Main view listbox item formatter: +// Returns the current format string depending value +// of the item concerned. +// ---------------------------------------------------- +// +TPtrC CBTUIMainContainer::TMainListItemArray::MdcaPoint( TInt aIndex ) const + { + TRACE_FUNC_ENTRY + _LIT(KBTUIEmptyFormatString, " \t \t\t "); // Empty format string if illegal indexing + TPtrC chosen; + + switch ( aIndex ) + { + case EBTMainListItemPowerMode: + { + TBTPowerStateValue powerState; + iBtEngSettingsRef->GetPowerState(powerState); + if( powerState==EBTPowerOn ) + chosen.Set( iArray.MdcaPoint( EBTUISettModulePowerOn )); + else + chosen.Set( iArray.MdcaPoint( EBTUISettModulePowerOff )); + break; + } + + case EBTMainListItemVisibilityMode: + { + TBTVisibilityMode mode; + iBtEngSettingsRef->GetVisibilityMode(mode); + + switch(mode) + { + case EBTVisibilityModeGeneral: + chosen.Set( iArray.MdcaPoint( EBTUISettVisibilityModeGeneral )); + break; + + case EBTVisibilityModeHidden: + chosen.Set( iArray.MdcaPoint( EBTUISettVisibilityModeHidden )); + break; + + case EBTVisibilityModeTemporary: + chosen.Set( iArray.MdcaPoint( EBTUISettVisibilityModeTemp )); + break; + + default: + break; + } + break; + } + + case EBTMainListItemNameSetting: + { + TDes &buf = MUTABLE_CAST(TBuf&,iItemText); + buf.Zero(); + buf.Append( iArray.MdcaPoint( EBTUISettBTNameHeader ) ); + buf.Append( *iMainView->GetBTLocalName() ); + chosen.Set( iItemText ); + break; + } + + // For Bluetooth SIM Access Profile feature + case EBTMainListItemSapMode: + { + BluetoothFeatures::TEnterpriseEnablementMode mode = BluetoothFeatures::EEnabled; + TRAPD(err, mode = BluetoothFeatures::EnterpriseEnablementL()); + if ( err == KErrNone ) + { + if ( mode == BluetoothFeatures::EDataProfilesDisabled ) + { + chosen.Set( iArray.MdcaPoint( EBTUISettSapDisabled )); + break; + } + } + + TInt sapStatus; + TRAP_IGNORE(GetSapStatusL(sapStatus);); + + if(sapStatus==EBTSapEnabled) + { + chosen.Set( iArray.MdcaPoint( EBTUISettSapEnabled )); + } + else + { + chosen.Set( iArray.MdcaPoint( EBTUISettSapDisabled )); + } + + TInt sapMode = KErrNone; + TRAP_IGNORE(sapMode = iMainView->GetSapStatusL()); + + + if(sapMode==EBTSapEnabled) + { + if ( sapMode ) + { + chosen.Set( iArray.MdcaPoint( EBTUISettSapEnabled )); + } + else + { + chosen.Set( iArray.MdcaPoint( EBTUISettSapDisabled )); + } + } + + break; + } + default: + chosen.Set( KBTUIEmptyFormatString ); + break; + } + + return chosen; + } + +// ---------------------------------------------------------------------- +// CBTUIMainContainer::TMainListItemArray::GetSapStatusL(TInt& aStatus) +// ---------------------------------------------------------------------- +// +void CBTUIMainContainer::TMainListItemArray::GetSapStatusL( TInt& aStatus ) +{ + CRepository* repository = CRepository::NewL(KCRUidBTEngPrivateSettings); + CleanupStack::PushL(repository); + repository->Get(KBTSapEnabled, aStatus); + CleanupStack::PopAndDestroy(repository); +} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIMainView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIMainView.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,1402 @@ +/* +* 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 is the settings view of btui. +* +*/ + +#include // AVKON components +#include +#include +#include // Feature Manager API + +#include "btui.hrh" // Menu commands +#include "btui.h" +#include "BTUIMainView.h" +#include "BTUIMainContainer.h" +#include "debug.h" +#include "BTUIKeyWatcher.h" +#include "BTUIPairedDevicesView.h" +#include "BTUIBlockedDevicesView.h" + +#include // Compiled resource ids +#include +#include +#include +#include +#include // Series 60 localisation stringloader +#include //visibility time setting page +#include +#include // BAFL utils (for language file) +#include // application icon for General Setting +#include +#include // For char filter +#include +#include // Help launcher +#include +#include +#include +#include +#include +#include // CnvUtfConverter +#include // For EnterpriseEnablementL() +#include + +// --------------------------------------------------------- +// CBTUIMainView::NewL +// Two phased constructor +// --------------------------------------------------------- +// +CBTUIMainView* CBTUIMainView::NewL(MBtuiPluginViewActivationObserver* aObserver) + { + //TRACE_FUNC_ENTRY + + CBTUIMainView* self = new (ELeave) CBTUIMainView(aObserver); + + // Set construction type, before ConstructL(). + self->iConstructAsGsPlugin = EFalse; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + + //TRACE_FUNC_EXIT + return self; + } + + +// --------------------------------------------------------- +// CBTUIMainView::NewL +// Two phased constructor +// --------------------------------------------------------- +// +CBTUIMainView* CBTUIMainView::NewGsPluginL() + { + //TRACE_FUNC_ENTRY + + CBTUIMainView* self = new (ELeave) CBTUIMainView(NULL); + + // Set construction type, before ConstructL(). + self->iConstructAsGsPlugin = ETrue; + + CleanupStack::PushL( self ); + self->ConstructL(); + + CleanupStack::Pop( self ); + + //TRACE_FUNC_EXIT + return self; + } + + +// --------------------------------------------------------- +// CBTUIMainView::CBTUIMainView +// --------------------------------------------------------- + +CBTUIMainView::CBTUIMainView(MBtuiPluginViewActivationObserver* aObserver ) + :iConstructAsGsPlugin(EFalse), iActivationObserver(aObserver) + { + } +// --------------------------------------------------------- +// CBTUIMainView::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------- +// +void CBTUIMainView::ConstructL() + { + TRACE_FUNC_ENTRY + + // Plugin load resource manually. + // These resources are needed by BaseConstructL + + iEikEnv = CEikonEnv::Static(); + + TFileName filename; + filename += KFileDrive; + filename += KDC_RESOURCE_FILES_DIR; + filename += KResourceFileName; + + BaflUtils::NearestLanguageFile(iEikEnv->FsSession(),filename); + iResourceFileFlag=iEikEnv->AddResourceFileL(filename); + + // According to Construction type, different softkey resource will be used. + // + if(iConstructAsGsPlugin) + { + iViewArray = new CArrayPtrFlat( 3 ); + iTabHelper = CGSTabHelper::NewL(); + iViewArray->AppendL(this); + iParentViewNotSetYet = ETrue; + + iKeyWatcher = CBTUIKeyWatcher::NewL(this, KBTUIPHYCountWatcher); + + // Construct OtherDeviceView + // + CAknView* pairedDeviceView = CBTUIPairedDevicesView::NewLC( this, iViewArray ); + iAppUi->AddViewL( pairedDeviceView ); // Transfer ownership to CAknViewAppUi + CleanupStack::Pop(pairedDeviceView ); + + // Construct BlockDeviceView + // + CAknView* blockedDeviceView = CBTUIBlockedDevicesView::NewLC( this, iViewArray ); + iAppUi->AddViewL( blockedDeviceView ); // Transfer ownership to CAknViewAppUi + CleanupStack::Pop(blockedDeviceView ); + + BaseConstructL( R_BTUI_MAIN_VIEW_GS_PLUGIN ); + } + else + { + BaseConstructL( R_BTUI_MAIN_VIEW ); + } + + iBtEngSettings = CBTEngSettings::NewL(this); + + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + iCoverDisplayEnabled = FeatureManager::FeatureSupported(KFeatureIdCoverDisplay); + + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +// +CBTUIMainView::~CBTUIMainView() + { + TRACE_FUNC_ENTRY + + iEikEnv->DeleteResourceFile(iResourceFileFlag); + + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + delete iBtEngSettings; + delete iContainer; + delete iIdle; + + if(iConstructAsGsPlugin) + { + if ( iViewArray ) + { + iViewArray->Reset(); + delete iViewArray; + } + + delete iTabHelper; + delete iKeyWatcher; + } + + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + + + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------- +// CBTUIMainView::PowerStateChanged +// ---------------------------------------------------- +// +void CBTUIMainView::PowerStateChanged( TBTPowerStateValue ) + { + TRACE_FUNC_ENTRY + if(iContainer) + { + iContainer->SettingChanged(EBTMainListItemPowerMode); + } + + if( iConstructAsGsPlugin ) + { + UpdateParentView(); + } + TRACE_FUNC_EXIT + } +// ---------------------------------------------------- +// CBTUIMainView::VisibilityModeChanged +// ---------------------------------------------------- +// +void CBTUIMainView::VisibilityModeChanged( TBTVisibilityMode ) + { + TRACE_FUNC_ENTRY + if(iContainer) + { + iContainer->SettingChanged(EBTMainListItemVisibilityMode); + } + + if( iConstructAsGsPlugin ) + { + UpdateParentView(); + } + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIMainView::Id +// --------------------------------------------------------- +// +TUid CBTUIMainView::Id() const + { + TRACE_FUNC_ENTRY + if(iConstructAsGsPlugin) + { + return KGsBtuiPluginUid; //same as ecom impl UID, required by GS interface. + } + else + { + return KBtuiPluginUidMainView; //view id + } + } +// --------------------------------------------------------- +// CBTUIMainView::HandleMiddleSoftkey +// Handles middle soft key +// --------------------------------------------------------- +// +void CBTUIMainView::HandleMiddleSoftkey() + { + TRACE_FUNC_ENTRY + if( iContainer == NULL ) return; + + TInt currentHighLightPosition= iContainer->CurrentItemIndex(); + switch(currentHighLightPosition) + { + case EBTMainListItemPowerMode: + HandleCommand( EBTUICmdChangePowerStateSelect ); + break; + case EBTMainListItemVisibilityMode: + HandleCommand( EBTUICmdChangeVisibilitySelect ); + break; + case EBTMainListItemNameSetting: + HandleCommand( EBTUICmdChangeBTNameSelect ); + break; + + // For Bluetooth SIM Access Profile feature + // + case EBTMainListItemSapMode: + HandleCommand( EBTUICmdChangeSapStateSelect ); + break; + default: + break; + } + TRACE_FUNC_EXIT + } +// --------------------------------------------------------- +// TUid CBTUIMainView::HandleCommand +// --------------------------------------------------------- +// +void CBTUIMainView::HandleCommand(TInt aCommand) +{ + TRAP_IGNORE(HandleCommandL(aCommand)); +} +// --------------------------------------------------------- +// CBTUIMainView::HandleCommandL +// Redirects commands to the appui class. +// --------------------------------------------------------- +// +void CBTUIMainView::HandleCommandL(TInt aCommand) + { + TRACE_INFO((_L(">> CBTUIMainView::HandleCommandL: %d"), aCommand)) + switch ( aCommand ) + { + //middle soft key is handled here + case EBTUICmdMSK: + HandleMiddleSoftkey(); + break; + case EAknSoftkeyBack: + AppUi()->ActivateLocalViewL(iParentView.iViewUid); + break; + + case EAknSoftkeyExit: + { + AppUi()->ProcessCommandL(EEikCmdExit); + break; + } + +#ifdef __SERIES60_HELP + case EAknCmdHelp: + { + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), AppUi()->AppHelpContextL()); + break; + } +#endif + case EBTUICmdChangePowerStateMenu: + { + AskPowerModeDlgL(); + break; + } + + case EBTUICmdChangePowerStateSelect: + { + TBTPowerStateValue powerState; + iBtEngSettings->GetPowerState(powerState); + if(powerState==EBTPowerOn) + { + SetPowerStatusL( EFalse ); + } + else + { + SetPowerStatusL( ETrue ); + } + break; + } + + case EBTUICmdChangeVisibilitySelect: // now both select key and menu command will triger the setting page. + case EBTUICmdChangeVisibilityMenu: + { + AskVisibilityDlgL(); + break; + } + + case EBTUICmdChangeBTNameMenu: + case EBTUICmdChangeBTNameSelect: + { + AskNewBtNameDlgL(); + iContainer->SettingChanged(TBTMainListItemIndexes(iContainer->CurrentItemIndex())); + break; + } + + // For Bluetooth SIM Access Profile feature + case EBTUICmdChangeSapStateSelect: + { + + if ( BluetoothFeatures::EnterpriseEnablementL() == BluetoothFeatures::EDataProfilesDisabled ) + { + RNotifier notifier; + User::LeaveIfError(notifier.Connect()); + CleanupClosePushL(notifier); + User::LeaveIfError(notifier.StartNotifier(KBTEnterpriseItSecurityInfoNotifierUid, KNullDesC8 )); + CleanupStack::PopAndDestroy(¬ifier); + } + else + { + TInt sapStatus; + CRepository* repository = CRepository::NewL(KCRUidBTEngPrivateSettings); + CleanupStack::PushL(repository); + repository->Get(KBTSapEnabled, sapStatus); + CleanupStack::PopAndDestroy(repository); + + if(sapStatus==EBTSapEnabled) + { + SetSapStatusL( EBTSapDisabled ); + } + else + { + SetSapStatusL( EBTSapEnabled ); + } + iContainer->SettingChanged( + TBTMainListItemIndexes(iContainer->CurrentItemIndex())); + } + break; + } + + // For Bluetooth SIM Access Profile feature + case EBTUICmdChangeSapStateMenu: + { + AskSapModeDlgL(); + iContainer->SettingChanged( + TBTMainListItemIndexes(iContainer->CurrentItemIndex())); + break; + } + + default: + { + AppUi()->HandleCommandL( aCommand ); + iContainer->SettingChanged( + TBTMainListItemIndexes(iContainer->CurrentItemIndex())); + break; + } + } + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------- +// From CAknView +// CBTUIMainView::DoActivateL +// --------------------------------------------------------- +// +void CBTUIMainView::DoActivateL( const TVwsViewId& aPrevViewId, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + TRACE_FUNC_ENTRY + + + if ( BluetoothFeatures::EnterpriseEnablementL() == BluetoothFeatures::EDisabled ) + { + RNotifier notifier; + User::LeaveIfError(notifier.Connect()); + CleanupClosePushL(notifier); + User::LeaveIfError(notifier.StartNotifier(KBTEnterpriseItSecurityInfoNotifierUid, KNullDesC8 )); + CleanupStack::PopAndDestroy(¬ifier); + + AppUi()->ActivateLocalViewL(aPrevViewId.iViewUid); //go back straight away + return; + } + + + if( iConstructAsGsPlugin ) + { + // Only set parent view when entering BT GS setting. + // since tab change chould make aPrevViewId assign to non-parent views. e.g. paired or blocked view. + if(iParentViewNotSetYet) + { + iParentView = aPrevViewId; + iParentViewNotSetYet = EFalse; + } + + // Setup tab group + iTabHelper->CreateTabGroupL( Id(), iViewArray ); + } + + iContainer = new (ELeave) CBTUIMainContainer; + iContainer->SetMopParent(this); // MObjectProvider + iContainer->ConstructL( ClientRect(), this ); + + // Setup the title + // + HBufC* btTitleMain = iCoeEnv->AllocReadResourceLC(R_BT_TITLE_BLUETOOTH); + CEikStatusPane* statusPane = StatusPane(); + CAknTitlePane* titlePane; + titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); + titlePane->SetTextL(btTitleMain->Des()); + CleanupStack::PopAndDestroy(btTitleMain); // btTitleMain + btTitleMain = NULL; + + AppUi()->AddToStackL( *this, iContainer ); + + //Check if the local name has been set. If not ask user to set name + + TBool nameStatus = EFalse; + TInt err = IsLocalNameModifiedL( nameStatus ); + + if( err || nameStatus == EBTLocalNameDefault ) + { + InitiateBTLocalNameQueryL(); // Ask local Bluetooth name if not given yet. + } + + // notify observer + if( iActivationObserver && iConstructAsGsPlugin == EFalse) + { + iActivationObserver->PluginViewActivated(EMainViewId); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIMainView::DoDeactivate +// --------------------------------------------------------- +// +void CBTUIMainView::DoDeactivate() + { + TRACE_FUNC_ENTRY + + if ( iContainer ) + { + AppUi()->RemoveFromStack( iContainer ); + } + + delete iContainer; + iContainer = NULL; + + if(iConstructAsGsPlugin) + { + iTabHelper->RemoveTabGroup(); + CGSBaseView::DoDeactivate(); + } + TRACE_FUNC_EXIT + + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIMainView::DynInitMenuPaneL +// Shows selected item's context sensitive options menu. +// --------------------------------------------------------- +// +void CBTUIMainView::DynInitMenuPaneL( TInt aResId, CEikMenuPane* aMenu ) + { + TRACE_FUNC_ENTRY + + // dim help if it exists and is not supported + TInt tmp; + if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) ) + { + aMenu->SetItemDimmed(EAknCmdHelp, + !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); + } + + if ( aResId == R_BTUI_MAIN_VIEW_MENU ) + { + // Set all menus dimmed at first(hide them all) + // + aMenu->SetItemDimmed(EBTUICmdChangePowerStateMenu, ETrue); + aMenu->SetItemDimmed(EBTUICmdChangeVisibilityMenu, ETrue); + aMenu->SetItemDimmed(EBTUICmdChangeBTNameMenu, ETrue); + if ( FeatureManager::FeatureSupported( KFeatureIdBtSap ) ) + aMenu->SetItemDimmed(EBTUICmdChangeSapStateMenu, ETrue); + + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIMainView::SettingChangedL +// Redraws the BT Name field. +// --------------------------------------------------------- +// +void CBTUIMainView::SettingChangedL( TBTMainListItemIndexes aListItem ) + { + TRACE_FUNC_ENTRY + if(iContainer) + { + iContainer->SettingChanged(aListItem); + } + + } + +// ---------------------------------------------------- +// CBTUIMainView::SetPowerStatusL +// ---------------------------------------------------- +// +TInt CBTUIMainView::SetPowerStatusL( TBool aValue ) + { + TRACE_FUNC_ENTRY + + TInt errorCode = KErrNone; + TBTPowerStateValue previousPowerMode; + errorCode=iBtEngSettings->GetPowerState(previousPowerMode); + if(errorCode) + return errorCode; + + TBool legalToChange = ETrue; + + if ( ( previousPowerMode==EBTPowerOn ) && ( !aValue )) // power ON -> OFF + { + TRACE_INFO(_L("power ON -> OFF")) + + // Check active connections before query + if( TBTUIViewsCommonUtils::IsAnyDeviceConnectedL()) + { + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtSwitchOffAnywayQuery, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + TInt keypress = dlg->ExecuteLD( R_BT_SWITCH_OFF_ANYWAY_QUERY ); + if( !keypress ) // User has not accepted the dialog + { + legalToChange = EFalse; + } + } + TRACE_INFO((_L("power ON -> OFF, legalToChange = %d"), legalToChange)) + + } + else if ( ( !previousPowerMode ) && ( aValue ) ) // power OFF -> ON + { + TRACE_INFO(_L("power OFF -> ON")) + + TInt offlineModeOff = 0; // possible values are 0 and 1 + TInt activationEnabled = 0; // possible values are 0 and 1 + + CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs); + CleanupStack::PushL(repository); + repository->Get(KCoreAppUIsNetworkConnectionAllowed, offlineModeOff); + // Closing connection: + CleanupStack::PopAndDestroy(repository); + repository =NULL; + repository = CRepository::NewL(KCRUidBluetoothEngine); + // Check activation enabled + CleanupStack::PushL(repository); + repository->Get(KBTEnabledInOffline, activationEnabled); + // Closing connection: + CleanupStack::PopAndDestroy(repository); + + + TRACE_INFO((_L("power OFF -> ON, offlineModeOff = %d"), offlineModeOff )) + TRACE_INFO((_L("power OFF -> ON, activationEnabled = %d"), activationEnabled )) + + // Is offline mode on + // + if ( !offlineModeOff ) + { + // Choose user interaction + // + if ( activationEnabled ) + { + // Create and show query + // + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtActivateInOfflineQuery, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + TInt keypress = dlg->ExecuteLD( R_BT_ACTIVATE_IN_OFFLINE_QUERY ); + if( !keypress ) // User has not accepted the dialog + { + legalToChange = EFalse; + } + } + else + { + legalToChange = EFalse; + + // Load a string, create and show a note + // + HBufC* stringHolder = StringLoader::LoadLC( R_BT_OFFLINE_DISABLED ); + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdShowBtOfflineDisabledNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(note); + } + + note->ExecuteLD( *stringHolder ); + CleanupStack::PopAndDestroy(stringHolder); //stringHolder + } + } + } + + TRACE_INFO((_L("legalToChange = %d"), legalToChange)) + + // Switch powermode + // + if ( legalToChange ) + { + + TInt errorCode = KErrNone; + TBTPowerStateValue powerMode; + if(aValue) + { + powerMode=EBTPowerOn; + } + else + { + powerMode=EBTPowerOff; + } + + errorCode=iBtEngSettings->SetPowerState(powerMode); + + if( (errorCode == KErrNone ) && (aValue)) + + { + //Check the visibility mode + TBTVisibilityMode visiMode; + errorCode=iBtEngSettings->GetVisibilityMode(visiMode); + if(errorCode==KErrNone) + { + if (visiMode == EBTVisibilityModeHidden) + { + //Show note + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ELongTimeout ); + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdBtuiShowBtHiddenFromOthersNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + dlg->ExecuteLD( R_BT_HIDDEN_FROM_OTHERS ); + } + } + } + if ( errorCode != KErrNone && errorCode != KErrAlreadyExists ) + { + TRAP_IGNORE(TBTUIViewsCommonUtils::ShowGeneralErrorNoteL()); + } + + } + + TRACE_INFO((_L("SetPowerStatusL() complete. errorCode = %d"), errorCode)) + return errorCode; + } + +// ---------------------------------------------------------- +// CBTUIMainView::SetVisibilityStatusL +// ---------------------------------------------------------- +// +void CBTUIMainView::SetVisibilityStatusL( TBTVisibilityMode aMode ) + { + TRACE_FUNC_ENTRY + + TInt errorCode = KErrNone; + + switch( aMode ) + { + case EBTVisibilityModeGeneral: + { + errorCode = iBtEngSettings->SetVisibilityMode(aMode); + + if(errorCode == KErrNone) + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ELongTimeout ); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtPhoneVisibToAllNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + dlg->ExecuteLD( R_BT_PHONE_VISIB_TO_OTH_NOTE ); + } + } + break; + + case EBTVisibilityModeHidden: + { + errorCode = iBtEngSettings->SetVisibilityMode(aMode); + + if(errorCode == KErrNone) + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ELongTimeout ); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdBtuiShowBtHiddenFromOthersNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + dlg->ExecuteLD( R_BT_HIDDEN_FROM_OTHERS ); + } + } + break; + + case EBTVisibilityModeTemporary: + { + // Asks user to turn on Bluetooth, if temporary visibility is chosen. + if( TBTUIViewsCommonUtils::TurnBTOnIfNeededL(iBtEngSettings,iCoverDisplayEnabled) != KErrNone) + { + return; + } + TInt sliderValue = 1; + CAknSettingPage* dlg = + new(ELeave) CAknSliderSettingPage(R_VISIBILITY_TIME_SETTING_PAGE, + sliderValue); + + if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) + { + errorCode = iBtEngSettings->SetVisibilityMode( aMode, sliderValue ); + } + } + break; + + default: + break; + } + + if((errorCode != KErrNone) && (errorCode != KErrAlreadyExists)) + { + TRAP_IGNORE(TBTUIViewsCommonUtils::ShowGeneralErrorNoteL()); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIMainView::GetBTLocalName +// ---------------------------------------------------------- +// +TDesC* CBTUIMainView::GetBTLocalName() + { + TRACE_FUNC_ENTRY + + iTempNameBuffer.Zero(); // Empty Local BT device name + TInt err=iBtEngSettings->GetLocalName( iTempNameBuffer );// Store name into member variable + if(err!=KErrNone) + TRAP_IGNORE(TBTUIViewsCommonUtils::ShowGeneralErrorNoteL()); + + // Cut the excess part of the name away. The query can handle only + // KBTUIMaxNameLength characters. + // + if( iTempNameBuffer.Length() > KBTUIMaxNameLength ) + { + iTempNameBuffer.SetLength( KBTUIMaxNameLength ); + } + TRACE_FUNC_EXIT + return &iTempNameBuffer; // And return reference for it + } + +// ---------------------------------------------------------- +// CBTUIMainView::AskNewBtNameDlgL +// ---------------------------------------------------------- +// +void CBTUIMainView::AskNewBtNameDlgL() + { + TRACE_FUNC_ENTRY + + // Cut the excess part of the name away. The query can handle only + // KBTUIMaxNameLength characters. + // + if( iTempNameBuffer.Length() > KBTUIMaxNameLength ) + { + iTempNameBuffer.SetLength( KBTUIMaxNameLength ); + } + + FOREVER + { + CAknTextSettingPage* dlg = new( ELeave )CAknTextSettingPage( R_BT_NAME_SETTING_PAGE, + iTempNameBuffer ); + if( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )) + { + // Remove trouble making control chars + AknTextUtils::StripCharacters(iTempNameBuffer, KAknStripListControlChars); + + iTempNameBuffer.TrimAll(); // Remove spaces and check what is left.. + if( iTempNameBuffer.Length() > 0 ) + { + + if(iBtEngSettings->SetLocalName(iTempNameBuffer) != KErrNone) + { + TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); + } + TRACE_FUNC_EXIT + return; + } + } + else + { + TRACE_FUNC_EXIT + return; // User has cancelled this operation + } + } + + } + +// ---------------------------------------------------------- +// CBTUIMainView::AskPowerModeDlgL +// ---------------------------------------------------------- +// +void CBTUIMainView::AskPowerModeDlgL() + { + TRACE_FUNC_ENTRY + + CDesCArrayFlat* items = iCoeEnv->ReadDesCArrayResourceL( R_BT_POWER_MODES ); + CleanupStack::PushL(items); + TBTPowerStateValue powerState; + iBtEngSettings->GetPowerState(powerState); + TInt currentItem = !powerState; // Implicit cast from Not-TBool to int (inverted) + + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_BT_POWER_SETTING_PAGE, currentItem, items ); + if( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )) + { + SetPowerStatusL( static_cast( !currentItem )); // Cast it back (invert again) + } + CleanupStack::PopAndDestroy(items); // items + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIMainView::AskVisibilityDlgL +// ---------------------------------------------------------- +// +void CBTUIMainView::AskVisibilityDlgL() + { + TRACE_FUNC_ENTRY + + CDesCArrayFlat* items = iCoeEnv->ReadDesCArrayResourceL( R_BT_VISIBILITY_MODES ); + CleanupStack::PushL(items); + + TInt currentItem = 0; // Current position at radio button setting page + TBTVisibilityMode currentMode; + TInt errorCode(iBtEngSettings->GetVisibilityMode(currentMode)); + if(errorCode==KErrNone) + { + + switch( currentMode ) // Map from mode to radio button position at setting page + { + case EBTVisibilityModeGeneral: + currentItem = 0; + break; + case EBTVisibilityModeTemporary: // temp visible + currentItem = 1; + break; + case EBTVisibilityModeHidden: + currentItem = 1+1; + break; + default: + break; + } + + // Ask new mode from user + + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_BT_VISIBILITY_SETTING_PAGE, currentItem, items ); + if( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )) + { + switch( currentItem ) // Map it back from radio button position to mode at setting page + { + case 0: + SetVisibilityStatusL( EBTVisibilityModeGeneral ); + break; + + case 1: + SetVisibilityStatusL( EBTVisibilityModeTemporary ); + break; + + case 1+1: + SetVisibilityStatusL( EBTVisibilityModeHidden ); + break; + + default: + break; + } + } + } + else + TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); + + + CleanupStack::PopAndDestroy(items); // items + } + + +// ---------------------------------------------------- +// CBTUIMainView::GetBtSettingsReference +// +// This method returns the reference to the settings class +// ---------------------------------------------------- +// +CBTEngSettings* CBTUIMainView::GetBtSettingsReference() + { + TRACE_FUNC + return iBtEngSettings; + } + +// ---------------------------------------------------- +// CBTUIMainView::InitiateBTLocalNameQueryL +// +// Initiate BT local name query after Symbian OS has entered +// idle state. +// ---------------------------------------------------- +// +void CBTUIMainView::InitiateBTLocalNameQueryL() + { + TRACE_FUNC + + + __ASSERT_DEBUG( !iIdle, PANIC(EBTPanicClassMemberVariableNotNull) ); + + // Launch idle time regognition and execute local BT name query when ready + iIdle = CIdle::NewL(CActive::EPriorityIdle); + iIdle->Start(TCallBack(LaunchBTLocalNameQueryL, this)); + } + +// ---------------------------------------------------- +// CBTUIMainView::LaunchBTLocalNameQueryL +// +// Execute BT local name query. Symbian OS has entered +// idle state now. +// ---------------------------------------------------- +// +TInt CBTUIMainView::LaunchBTLocalNameQueryL(TAny* aMainView) + { + //TRACE_FUNC + + TInt errorCode = static_cast(aMainView)->AskBTLocalNameQueryL(); + if( errorCode != KErrNone ) + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( CAknNoteDialog::EErrorTone, + CAknNoteDialog::ELongTimeout ); + if(static_cast(aMainView)->iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtGeneralErrorNote, KUidCoverUiCategoryBtui); // initializes cover support} + CleanupStack::Pop(dlg); + } + dlg->ExecuteLD( R_BT_GENERAL_ERROR_NOTE ); + } + return KErrNone; + } + +// ---------------------------------------------------- +// CBTUIMainView::AskBTLocalNameQueryL +// ---------------------------------------------------- +// +TInt CBTUIMainView::AskBTLocalNameQueryL() + { + TRACE_FUNC_ENTRY + + TInt errorCode = KErrNone; + iTempNameBuffer.Zero(); // Empty Local BT device name + + //Get default name if given by e.g. phone product + errorCode = RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothSetDeviceName, iTempNameBuffer ); + + if( errorCode || !iTempNameBuffer.Length() ) + { + errorCode = RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetDeviceName, iTempNameBuffer ); + + if( errorCode || !iTempNameBuffer.Length() ) + { + RBTRegServ btRegServ; + RBTLocalDevice btReg; + TBTLocalDevice localDev; + + errorCode = btRegServ.Connect(); + + if( !errorCode ) + { + errorCode = btReg.Open( btRegServ ); + + if( !errorCode ) + { + // Read the BT local name from BT Registry. + errorCode = btReg.Get( localDev ); + + if( !errorCode ) + { + // The error can be > 0 if there are unconverted characters. + errorCode = CnvUtfConverter::ConvertToUnicodeFromUtf8( iTempNameBuffer, localDev.DeviceName() ); + } + } + } + + btReg.Close(); + btRegServ.Close(); + } + } + + if(errorCode==KErrNone) + { + + // Cut the excess part of the name away. The query can handle only + // KBTUIMaxNameLength characters. + // + if( iTempNameBuffer.Length() > KBTUIMaxNameLength ) + { + iTempNameBuffer.SetLength( KBTUIMaxNameLength ); + } + + CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( iTempNameBuffer ); + TInt keypress = dlg->ExecuteLD( R_BT_ENTER_LOCAL_NAME_QUERY ); + + if( keypress ) // User has accepted the dialog + { + // Remove trouble making control chars + AknTextUtils::StripCharacters(iTempNameBuffer, KAknStripListControlChars); + + iTempNameBuffer.TrimAll(); // Remove extra spaces + errorCode = iBtEngSettings->SetLocalName(iTempNameBuffer); + + this->SettingChangedL(EBTMainListItemNameSetting); // Redraw BT name + } + } + + delete iIdle; iIdle = NULL; + TRACE_FUNC_EXIT + return errorCode; + } + +//--------------------------------------------------------------------- +// CBTUIMainView::GetCaption +//---------------------------------------------------------------------- +// +void CBTUIMainView::GetCaptionL( TDes& aCaption ) const + { + TRACE_FUNC + + // the resource file is already opened. + HBufC* result = StringLoader::LoadL( R_GS_BTUI_VIEW_CAPTION ); + aCaption.Copy( *result ); + delete result; + } + + +//--------------------------------------------------------------------- +// CBTUIMainView::CreateIconL +//---------------------------------------------------------------------- +// +CGulIcon* CBTUIMainView::CreateIconL( const TUid aIconType ) + { + TRACE_FUNC_ENTRY + + RefreshSettingsStatusL(); + CGulIcon* icon = NULL; + TFileName bmpFilename; + bmpFilename += KBitmapFileDrive; + bmpFilename += KDC_APP_BITMAP_DIR; + bmpFilename += KBtuiBmpFileName; + + if(aIconType == KGSIconTypeLbxItem) + { + + switch(iBtState) + { + case EBTOff: + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsBtOff, + bmpFilename, + EMbmBtuiQgn_prop_set_apps_bt_off, + EMbmBtuiQgn_prop_set_apps_bt_off_mask ); + break; + case EBTOnShown: + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsBtOnShown, + bmpFilename, + EMbmBtuiQgn_prop_set_apps_bt_on_shown, + EMbmBtuiQgn_prop_set_apps_bt_on_shown_mask ); + break; + case EBTOnHidden: + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsBtOnHidden, + bmpFilename, + EMbmBtuiQgn_prop_set_apps_bt_on_hidden, + EMbmBtuiQgn_prop_set_apps_bt_on_hidden_mask ); + break; + case EBTConnectedShown: + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsBtConnShown, + bmpFilename, + EMbmBtuiQgn_prop_set_apps_bt_conn_shown, + EMbmBtuiQgn_prop_set_apps_bt_conn_shown_mask ); + break; + case EBTConnectedHidden: + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsBtConnHidden, + bmpFilename, + EMbmBtuiQgn_prop_set_apps_bt_conn_hidden, + EMbmBtuiQgn_prop_set_apps_bt_conn_hidden_mask ); + break; + } + } + else + { + icon = CGSPluginInterface::CreateIconL( aIconType ); + } + + return icon; + } + + +// --------------------------------------------------------------------------- +// CBTUIMainView::GetValue() +// Get 2nd row text for parent Connectivity View. +// --------------------------------------------------------------------------- +// +void CBTUIMainView::GetValue( const TGSPluginValueKeys aKey, TDes& aValue ) + { + TRACE_FUNC_ENTRY + + TRAP_IGNORE( GetValueL(aKey, aValue) ); + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::GetValueL() +// --------------------------------------------------------------------------- +// +void CBTUIMainView::GetValueL( const TGSPluginValueKeys aKey, TDes& aValue ) + { + if(aKey == EGSPluginKeySettingsItemValueString) + { + HBufC* secondary = NULL; + RefreshSettingsStatusL(); + switch(iBtState) + { + case EBTOff: + secondary = StringLoader::LoadL( R_CP_DETAIL_BT_OFF ); + break; + case EBTOnShown: + secondary = StringLoader::LoadL( R_CP_DETAIL_BT_ON_SHOWN ); + break; + case EBTOnHidden: + secondary = StringLoader::LoadL( R_CP_DETAIL_BT_ON_HIDDEN ); + break; + case EBTConnectedShown: + secondary = StringLoader::LoadL( R_CP_DETAIL_BT_CONN_SHOWN ); + break; + case EBTConnectedHidden: + secondary = StringLoader::LoadL( R_CP_DETAIL_BT_CONN_HIDDEN ); + break; + } + aValue.Copy( *secondary ); + delete secondary; + } + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::CreateTabIconL() +// Creates icon for tab. +// --------------------------------------------------------------------------- +// +CGulIcon* CBTUIMainView::CreateTabIconL() + { + TFileName bmpFilename; + bmpFilename += KBitmapFileDrive; + bmpFilename += KDC_APP_BITMAP_DIR; + bmpFilename += KBtuiBmpFileName; + + CGulIcon* icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropBtSetTab3, + bmpFilename, + EMbmBtuiQgn_prop_bt_set_tab3, + EMbmBtuiQgn_prop_bt_set_tab3_mask ); + + return icon; + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::RefreshSettingsStatusL() +// Get the current BT settings: power, visibility and connection. +// --------------------------------------------------------------------------- +// +void CBTUIMainView::RefreshSettingsStatusL() + { + + if ( BluetoothFeatures::EnterpriseEnablementL() == BluetoothFeatures::EDisabled ) + { + iBtState = EBTOff; + } + else + { + TBTPowerStateValue powerState; + iBtEngSettings->GetPowerState(powerState); + + TBTVisibilityMode currentMode; + iBtEngSettings->GetVisibilityMode(currentMode); + + TBool connected = TBTUIViewsCommonUtils::IsAnyDeviceConnectedL(); + + if(powerState == EBTPowerOff) + iBtState = EBTOff; + else + { + if( !connected && (currentMode == EBTVisibilityModeGeneral || + currentMode == EBTVisibilityModeTemporary)) + iBtState = EBTOnShown; + + else if(!connected && currentMode == EBTVisibilityModeHidden) + iBtState = EBTOnHidden; + + else if(connected && (currentMode == EBTVisibilityModeGeneral || + currentMode == EBTVisibilityModeTemporary)) + iBtState = EBTConnectedShown; + + else if(connected && currentMode == EBTVisibilityModeHidden) + iBtState = EBTConnectedHidden; + } + } + } + +// ---------------------------------------------------- +// CBTUIMainView::UpdateParentView +// +// Update Connectivity View when it's the current +// active view and the key watched is changed. +// ---------------------------------------------------- +void CBTUIMainView::UpdateParentView() + { + if(iConstructAsGsPlugin) + { + CGSParentPlugin* parent = static_cast(AppUi()->View( KGSConPluginUid )); + if( parent ) + { + parent->UpdateView(); + } + } + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::NewContainerL +// Creates new iContainer. +// --------------------------------------------------------------------------- +// +void CBTUIMainView::NewContainerL() + { + //As a transparent view, do nothing here. + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::HandleListBoxSelectionL +// Handle any user actions while in the list view. +// --------------------------------------------------------------------------- +// +void CBTUIMainView::HandleListBoxSelectionL() + { + //As a base-view, it's transparent, so do nothing here. + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::GetParentView +// --------------------------------------------------------------------------- +// +TVwsViewId CBTUIMainView::GetParentView() + { + return iParentView; + } + +// --------------------------------------------------------------------------- +// CBTUIMainView::TabbedViews() +// Returns pointer to tabbed views of application. +// --------------------------------------------------------------------------- +// +CArrayPtrFlat* CBTUIMainView::TabbedViews() + { + return iViewArray; + } + + +// --------------------------------------------------------------------------- +// CBTUIMainView::IsLocalNameModified +// Checks from central repository whether the Bluetooth friendly name +// has been modified . +// --------------------------------------------------------------------------- +// +TInt CBTUIMainView::IsLocalNameModifiedL( TBool& aStatus ) + { + TRACE_FUNC_ENTRY + + aStatus = (TBool) EBTLocalNameDefault; + + TInt val = 0; + CRepository* cenRep = NULL; + TInt err = KErrNone; + TRAP_IGNORE(cenRep = CRepository::NewL( KCRUidBTEngPrivateSettings )); + + err = cenRep->Get( KBTLocalNameChanged, val ); + + if ( val != 0 ) + { + aStatus = (TBool) EBTLocalNameSet; + } + delete cenRep; + cenRep = NULL; + TRACE_FUNC_EXIT + return err; + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUINonSap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUINonSap.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -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: This module is created for variant that doesn't support +* Bluetooth SIM Access Profile. +* +*/ + + +#include "BTUIMainView.h" +//#include "BTUIModel.h" + +// ---------------------------------------------------- +// CBTUIMainView::SetSapStatusL +// ---------------------------------------------------- +// +void CBTUIMainView::SetSapStatusL( TBTSapMode /*aValue*/ ) + { + + } + +// ---------------------------------------------------------- +// CBTUIMainView::AskSapModeDlgL +// ---------------------------------------------------------- +// +void CBTUIMainView::AskSapModeDlgL() + { + + } +// ---------------------------------------------------------- +// CBTUIMainView::GetSapStatusL +// ---------------------------------------------------------- + +TInt CBTUIMainView::GetSapStatusL() + { + return EBTSapDisabled; + } + +// End of File + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIPairedDevicesView.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,1904 @@ +/* +* 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 is view that handles listing and + * unblocking blocked devices view. + * +*/ + +#include // AVKON components +#include +#include +#include // Compiled resource ids +#include // Feature Manager + +#include +#include +#include // Series 60 localisation stringloader +#include +#include +#include +#include +#include // Help launcher +#include // for device search + +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include "btui.h" // Global declarations +#include "BTUIPairedDevicesView.h" +#include "BTUIDeviceContainer.h" +#include +#include // Help IDs + +#include +#include // Tab icon for General Setting +#include +#include "BTUIMainView.h" // base View. + + +const TInt KAutoConnect2ndTry = 1; +const TUint32 SetExcludePairedDeviceMask = 0x800000; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBTUIPairedDevicesView::NewL +// Two phased constructor called by BT AppUI when serve as part of btui.exe +// --------------------------------------------------------- +// +CBTUIPairedDevicesView* CBTUIPairedDevicesView::NewL(MBtuiPluginViewActivationObserver* aObserver) + { + CBTUIPairedDevicesView* self = new (ELeave) CBTUIPairedDevicesView(aObserver); + CleanupStack::PushL(self); + + self->iConstructAsGsPlugin = EFalse; + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CBTUIPairedDevicesView::NewLC +// Two phased constructor called by mainView when serve as GS Plugin. +// --------------------------------------------------------- +// +CBTUIPairedDevicesView* CBTUIPairedDevicesView::NewLC(CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray) + { + CBTUIPairedDevicesView* self = new (ELeave) CBTUIPairedDevicesView(); + CleanupStack::PushL( self ); + + self->iConstructAsGsPlugin = ETrue; + self->ConstructL( aBaseView, aTabViewArray ); + + return self; + } + + +// --------------------------------------------------------- +// CBTUIPairedDevicesView::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::ConstructL() + { + TRACE_FUNC_ENTRY + + BaseConstructL(R_BTUI_OTHER_DEVICES_VIEW); + + iCoverDisplayEnabled = FeatureManager::FeatureSupported(KFeatureIdCoverDisplay); + iHelpEnabled = FeatureManager::FeatureSupported(KFeatureIdHelp); + + iDeviceSearcher = CBTEngDiscovery::NewL(this); + iBtEngSettings = CBTEngSettings::NewL(this); + iBTPluginMan = CBTUIPluginMan::NewL( AppUi() ); + iIsAlreadyConnected = EFalse; + iExpectedCallBack = 0; + TRACE_INFO(_L("Initial iIsAlreadyConnected -> False")) + TRACE_FUNC_EXIT + } + +void CBTUIPairedDevicesView::ConstructL( CBTUIMainView* aBaseView, CArrayPtrFlat* aTabViewArray ) + { + TRACE_FUNC_ENTRY + + iBaseView = aBaseView, + iTabHelper = CGSTabHelper::NewL(); + aTabViewArray->AppendL(this); + + BaseConstructL(R_BTUI_OTHER_DEVICES_VIEW_GS); + iCoverDisplayEnabled = FeatureManager::FeatureSupported(KFeatureIdCoverDisplay); + iHelpEnabled = FeatureManager::FeatureSupported(KFeatureIdHelp); + + iDeviceSearcher = CBTEngDiscovery::NewL(this); + iBtEngSettings=CBTEngSettings::NewL(this); + iBTPluginMan = CBTUIPluginMan::NewL( AppUi() ); + iIsAlreadyConnected = EFalse; + TRACE_INFO(_L("Initial iIsAlreadyConnected = False")) + iExpectedCallBack = 0; + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIBlockedDevicesView::CBTUIBlockedDevicesView +// --------------------------------------------------------- + +CBTUIPairedDevicesView::CBTUIPairedDevicesView( MBtuiPluginViewActivationObserver* aObserver ) + : iActivationObserver(aObserver) + { + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CBTUIPairedDevicesView::~CBTUIPairedDevicesView() + { + TRACE_FUNC_ENTRY + + //close dialogs if any + TRAP_IGNORE( + DialogDismissedL(EAknSoftkeyCancel); + ); + + delete iActive; + + if (iContainer) + { + AppUi()->RemoveFromViewStack(*this, iContainer); + delete iContainer; + iContainer = NULL; + } + + if(iDeviceSearcher) + { + // Canceling devicesearches is done by DialogDismissedL(), + // so it is not done here + delete iDeviceSearcher; + iDeviceSearcher = NULL ; + } + delete iConnectDevice; + iConnectDevice=NULL; + + delete iPairingDevice; + delete iBtEngSettings; + delete iBTPluginMan; + + if(iConstructAsGsPlugin) + delete iTabHelper; + + CancelDisconnectQueryDlg(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIPairedDevicesView::Id +// --------------------------------------------------------- +// +TUid CBTUIPairedDevicesView::Id() const + { + TRACE_FUNC_ENTRY + return KBtuiPluginUidPairedDevicesView;//KBTOtherDevicesViewId; + } + + + + +// --------------------------------------------------------- +// From CAknView +// CBTUIPairedDevicesView::HandleCommandL +// Redirects commands to the appui class. +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::HandleCommandL(TInt aCommand) + { + TRACE_FUNC_ENTRY + + switch (aCommand) + { + + case EAknSoftkeyBack: + // do not exit if devicechange is in progress. + if(iModel->DeviceChangeInProgress() ) + return; + AppUi()->ActivateLocalViewL(iBaseView->GetParentView().iViewUid ); + break; + + case EAknSoftkeyExit: + { + TRACE_INFO(_L("EAknSoftkeyExit")) + // do not exit if devicechange or bt discovery is in progress. + if(iModel->DeviceChangeInProgress() + || iSearchOngoing ) + { + TRACE_INFO(_L("exit denied, due to operation")) + return; + } + + TRACE_INFO(_L("exit in progress")) + AppUi()->ProcessCommandL(EEikCmdExit); + break; + } + + case EAknCmdHelp: + { + #ifdef __SERIES60_HELP + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(),AppUi()->AppHelpContextL()); + #endif + break; + } + + case EBTUICmdNewPairedDevice: + { + iSearchOngoing=ETrue; + NewPairedDeviceDlgL(); + break; + } + + case EBTUICmdDelete: + { + DeleteDeviceDlgL(); + break; + } + + case EBTUICmdDeleteAll: + { + DeleteAllDevicesDlgL(); + break; + } + + case EBTUICmdGiveNickname: + { + RenameDeviceDlgL(); + break; + } + + case EBTUICmdSetTrusted: + { + ChangeDeviceSecurityL(ETrue); + break; + } + + case EBTUICmdSetUnTrusted: + { + ChangeDeviceSecurityL(EFalse); + break; + } + + case EBTUICmdConnect: + case EBTUICmdConnectAudio: + { + TBTDevice device; + device.iIndex = iContainer->CurrentItemIndex(); + iModel->GetDevice(device); + if ( device.iStatus & EStatusBtuiConnected ) + { + // If device is already connected, we do nothing here. + break; + } + device.iOperation = EOpConnect; + ConnectL( device, ETrue ); + break; + } + + case EBTUICmdDisconnect: + { + DisconnectL(); + break; + } + + case EBTUICmdSetBlocked: + { + BlockDeviceDlgL(); + break; + } + + case EBTUICmdSettings: + { + LaunchSettingViewL(); + break; + } + + default: + { + AppUi()->HandleCommandL(aCommand); + break; + } + } + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------- +// From CAknView +// CBTUIPairedDevicesView::DoActivateL +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + TRACE_FUNC_ENTRY + + iModel = CBTDevModel::NewL(EGroupPaired, this); + iContainer = CBTUiDeviceContainer::NewL(ClientRect(), this, EGroupPaired, this); + iContainer->SetMopParent(this); // MObjectProvider + + // Setup title + HBufC* btTitlePairedDevices = + iCoeEnv->AllocReadResourceLC(R_BT_TITLE_PAIRED_DEV); + CEikStatusPane* statusPane = StatusPane(); + CAknTitlePane* titlePane; + titlePane = (CAknTitlePane*) statusPane->ControlL( + TUid::Uid(EEikStatusPaneUidTitle)); + titlePane->SetTextL(btTitlePairedDevices->Des()); + CleanupStack::PopAndDestroy(btTitlePairedDevices); // btTitlePairedDevices + btTitlePairedDevices = NULL; + + AppUi()->AddToStackL(*this, iContainer); + + if( iBaseView && iConstructAsGsPlugin) + { + iTabHelper->CreateTabGroupL( Id(), + static_cast*> + (iBaseView->TabbedViews()) ); + } + + // MSK menu is added here. + // the left key menu is added by resources. + MenuBar()->SetContextMenuTitleResourceId( + R_BTUI_MENUBAR_OTHER_DEVICES_VIEW_CONTEXT); + // notify observer + if( iActivationObserver && iConstructAsGsPlugin == EFalse) + { + iActivationObserver->PluginViewActivated(EPairedDevicesViewId); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIPairedDevicesView::DoDeactivate +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::DoDeactivate() + { + TRACE_FUNC_ENTRY + + if (iContainer) + { + AppUi()->RemoveFromStack(iContainer); + delete iContainer; + iContainer = NULL; + } + if ( iDeviceSearcher ) + { + iDeviceSearcher->CancelSearchRemoteDevice(); + } + delete iModel; + iModel=NULL; + if(iConstructAsGsPlugin) + iTabHelper->RemoveTabGroup(); + delete iActive; + iActive = NULL; + iIsPairConnect = EFalse; + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// From CAknView +// CBTUIPairedDevicesView::DynInitMenuPaneL +// Shows only options supported for selected device, if any. +// If not show only options supported regardless of selected +// device +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::DynInitMenuPaneL(TInt aResId, CEikMenuPane* aMenu) + { + TRACE_FUNC_ENTRY + + // dim help if it exists and is not supported + TInt tmp; + if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) ) + { + aMenu->SetItemDimmed(EAknCmdHelp, + !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); + } + + if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU ) + { + + TInt index = iContainer->CurrentItemIndex(); + + if ( index < 0 ) // No devices at list. Hide all device related commands. + { + aMenu->SetItemDimmed(EBTUICmdDeleteAll, ETrue); + } + else + { + SetupMenuCmd(index, aMenu); + } + } + + if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU_CONTEXT ) + { + iActiveMenuPane = aMenu; + TInt index = iContainer->CurrentItemIndex(); + + // If user is fast enough to click the RSK option between + // bt discovery view and device found view, bt ui will crash. + // Therefore, we disable commands if bt discovery is onging. + // + if(iSearchOngoing) + { + aMenu->SetItemDimmed(EBTUICmdGiveNickname, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetTrusted, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetBlocked, ETrue); + aMenu->SetItemDimmed(EBTUICmdDelete, ETrue); + aMenu->SetItemDimmed(EBTUICmdConnect, ETrue); + aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue); + aMenu->SetItemDimmed(EBTUICmdDisconnect, ETrue); + aMenu->SetItemDimmed(EBTUICmdNewPairedDevice, ETrue); + return; + } + + if(index < 0) // No devices at list. Hide all device related commands. + { + TRACE_INFO(_L("no devices in list")) + + aMenu->SetItemDimmed(EBTUICmdGiveNickname, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetTrusted, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, ETrue); + aMenu->SetItemDimmed(EBTUICmdSetBlocked, ETrue); + aMenu->SetItemDimmed(EBTUICmdDelete, ETrue); + aMenu->SetItemDimmed(EBTUICmdConnect, ETrue); + aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue); + aMenu->SetItemDimmed(EBTUICmdDisconnect, ETrue); + aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); + } + else // There are devices at list + { + SetupMenuCmd(index, aMenu); + //Hide New pair device in context menu + aMenu->SetItemDimmed(EBTUICmdNewPairedDevice, ETrue); + } + } + TRACE_FUNC_EXIT + } + + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::RenameDeviceDlgL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::RenameDeviceDlgL() + { + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + TBTDeviceName name = device.iName; + + CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL(device.iName); + TInt keypress = dlg->ExecuteLD(R_BT_ENTER_NICKNAME_QUERY); + + if(keypress) // User has accepted the dialog + { + if(device.iName != name) // Check if the user really changed the name + { + device.iOperation = EOpChangeName; + // Remove trouble making control chars + AknTextUtils::StripCharacters(device.iName, KAknStripListControlChars); + device.iName.TrimAll(); // Remove extra spaces + iModel->ChangeDevice(device); + } + } + TRACE_FUNC_EXIT + } + + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::NewPairedDeviceDlgL +// +// Initiate bonding (pairing) by opening the search dialog. +// DeviceSearchComplete is called after that. +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::NewPairedDeviceDlgL() + { + TRACE_FUNC_ENTRY + // we must not have other pairing in progress. + // we maight issue an error, but none is defined by + // ui spec. Anyhow this should be possible + // only by pressing everything roo rapidly. + if(iPairingDevice!=NULL) + return; + iPairingDevice = CBTDevice::NewL(); + + // Here we use last bit in device class to inform bt inquiry notifier + // not to display the device which is already paired and in the paired + // device list. + + // We use DeviceClass to tell btnotif not to show paired device in + // bt discovery notifier through bteng. + // Set bit 24 to 1 ( bit 24 is not used for any other purpose currently ) + iPairingDevice->SetDeviceClass(iPairingDevice->DeviceClass().DeviceClass() | SetExcludePairedDeviceMask ); + TInt err = iDeviceSearcher->SearchRemoteDevice(iPairingDevice, + &iPairingDevNameEntry, + iPairingDevice->DeviceClass().DeviceClass()); + + + if(err != KErrNone) + { + delete iPairingDevice; + iPairingDevice=NULL; + TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::DeleteDeviceDlgL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::DeleteDeviceDlgL() + { + TRACE_FUNC_ENTRY + + iExpectedCallBack = 0; + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + + RBuf stringholder; + CleanupClosePushL( stringholder ); + + TInt tmp=EStatusBtuiConnected|EStatusPhysicallyConnected; + // Choose confirmation phrase + TInt resourceId = ( device.iStatus & tmp ) ? R_BT_WARN_ERASE_CONNECTED : + R_BT_WARN_ERASE; + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, resourceId, device.iName, 0 ); + + // Create confirmation query + // + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtWarnEraseNote, KUidCoverUiCategoryBtui); + // initializes cover support + CleanupStack::Pop(dlg); + + CAknMediatorFacade* covercl = AknMediatorFacade(dlg); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(device.iName) ;// takes copy so consts are ok too + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + TInt keypress = dlg->ExecuteLD(R_BT_WARN_ERASE_QUERY, stringholder); + + CleanupStack::PopAndDestroy(&stringholder); // stringholder + + if(keypress) // User has accepted the dialog + { + // If device is connected we need to first to disconnect + // then unpair, otherwise unpairing does not succeed. + if((device.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + iExpectedCallBack++; + DisconnectWithoutQuery(); + return; + } + device.iOperation = EOpUnpair; + iModel->ChangeDevice(device); + } + + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::DeleteAllDevicesDlgL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::DeleteAllDevicesDlgL() + { + TRACE_FUNC_ENTRY + + iExpectedCallBack = 0; + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt keypress = KErrNone; + + CleanupStack::PushL(dlg); + + // Choose and execute confirmation query + // + if (iModel->IsAnyDeviceConnected()) + { + if(iCoverDisplayEnabled) + { + dlg->PublishDialogL(ECmdShowBtWarnEraseAllConnectedQuery, KUidCoverUiCategoryBtui); // initializes cover support + } + + keypress = dlg->ExecuteLD(R_BT_WARN_ERASE_ALL_CONNECTED_QUERY); + } + else + { + if(iCoverDisplayEnabled) + { + dlg->PublishDialogL(ECmdShowBtWarnEraseAllQuery, KUidCoverUiCategoryBtui); // initializes cover support + } + + keypress = dlg->ExecuteLD(R_BT_WARN_ERASE_ALL_QUERY); + } + CleanupStack::Pop(dlg); + + if(keypress) // User has accepted the dialog + { + TInt count = iContainer->CountItems(); + for (TInt i = 0; i < count; i++) + { + // If device is connected we need to first to disconnect + // then unpair, otherwise unpairing does not succeed. + TBTDevice device; + device.iIndex = i; + iModel->GetDevice(device); + if((device.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + iExpectedCallBack++; + } + } + TRACE_INFO((_L("iExpectedCallBack %d"), iExpectedCallBack )) + + for (TInt i = 0; i < count; i++) + { + // If device is connected we need to first to disconnect + // then unpair, otherwise unpairing does not succeed. + TBTDevice device; + device.iIndex = i; + iModel->GetDevice(device); + + if((device.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) + { + //disconnect it first, removal will be done in + //callback NotifyChangeDeviceCompleteL for ChangeDevice() below + TRACE_INFO((_L("EOpDisconnect issued for %d"), i )) + device.iOperation = EOpDisconnect; + iModel->ChangeDevice(device); + } + else + { + //otherwise, just remove it from the paired view + device.iOperation = EOpUnpair; + iModel->ChangeDevice(device); + } + } + } + + TRACE_FUNC_EXIT + } +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::BlockDeviceDlgL +// ---------------------------------------------------------- +void CBTUIPairedDevicesView::BlockDeviceDlgL() + { + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + + //check if this is connected device + + HBufC* header= iCoeEnv->AllocReadResourceLC(R_BT_OPTION_BLOCK_DEVICE_HEADER); + + RBuf stringHolder; + CleanupClosePushL( stringHolder ); + TInt resouseId; + if (device.iStatus & (EStatusBtuiConnected|EStatusPhysicallyConnected) ) + { + resouseId = iHelpEnabled? R_BT_OPTION_BLOCK_PAIRED_DEVICE_HELP : + R_BT_OPTION_BLOCK_PAIRED_DEVICE_NOHELP; + } + else + { + resouseId = iHelpEnabled ? R_BT_OPTION_BLOCK_PAIRED_DEVICE_HELP : + R_BT_OPTION_BLOCK_PAIRED_DEVICE_NOHELP; + } + BluetoothUiUtil::LoadResourceAndSubstringL( + stringHolder, resouseId, device.iName, 0 ); + + CAknMessageQueryDialog *queryDialog = CAknMessageQueryDialog::NewL (stringHolder, + CAknQueryDialog::EConfirmationTone); + queryDialog->PrepareLC(R_BT_MESSAGE_QUERY); + + (queryDialog)->Heading()->SetTextL(*header); + queryDialog->SetFocus(ETrue); + + TInt keypress=EFalse; +#ifdef __SERIES60_HELP + if (iHelpEnabled) + { + HBufC* queryLink = StringLoader::LoadL(R_BT_BLOCK_DEVICE_LINK); + TCoeHelpContext hc(KBtuiUid3,KBT_HLP_BLOCKED); + TCallBack helpCallBack(CBTUIPairedDevicesView::LaunchHelp , &hc); + + TRAPD(err, + static_cast(queryDialog)->SetLinkTextL(*queryLink); + static_cast(queryDialog)->SetLink(helpCallBack);); + if(err==KErrNone) + { + keypress = queryDialog->RunLD(); + } + + delete queryLink; + queryLink = NULL; + } + else +#endif + { + keypress = queryDialog->RunLD(); + } + + CleanupStack::PopAndDestroy(&stringHolder); + CleanupStack::PopAndDestroy(header); + + if(keypress) + { + device.iOperation = EOpBlock; + iModel->ChangeDevice(device); + } + TRACE_FUNC_EXIT + } +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::ChangeDeviceSecurityL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::ChangeDeviceSecurityL(TBool aTrusted) + { + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + + if(aTrusted) + { + // set to trusted + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtAuthConfirmQuery, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + TInt keypress = dlg->ExecuteLD(R_BT_SET_TRUSTED_QUERY); + + if(keypress) // User has accepted the dialog + { + device.iOperation = EOpTrust; + iModel->ChangeDevice(device); + } + } + else + { + device.iOperation = EOpUntrust; + iModel->ChangeDevice(device); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------- +// CBTUIMainView::VisibilityModeChanged +// ---------------------------------------------------- +// +void CBTUIPairedDevicesView::VisibilityModeChanged( TBTVisibilityMode ) + { + TRACE_FUNC_ENTRY + + + TRACE_FUNC_EXIT + } + + +// ---------------------------------------------------- +// CBTUIMainView::PowerStateChanged +// ---------------------------------------------------- +// +void CBTUIPairedDevicesView::PowerStateChanged( TBTPowerStateValue ) + { + TRACE_FUNC_ENTRY + + if ( iIsConnectDevice ) + { + iModel->ChangeDevice(*iConnectDevice); + iIsConnectDevice = EFalse; // reset flag + } + + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::ConnectL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::ConnectL( + const TBTDevice& aDevice, TBool aNewWaitNote ) + { + TRACE_FUNC_ENTRY + + iIsAlreadyConnected = EFalse; + TRACE_INFO(_L("Set iIsAlreadyConnected -> False")) + //Check that there is not more than max amount of connections allready. + TInt connNum = 0; + RProperty::Get(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount, connNum); + if(connNum > KBtUiMaxConnections) + { + ConnectCompleteL(KErrServerBusy, aDevice); + } + else if(CallOnGoing()&& connNum > 1) + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::ENoTone, + CAknNoteDialog::ELongTimeout); + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtImpossibleIncallNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + dlg->ExecuteLD(R_BT_NOT_INCALL_NOTE); + } + else + { + if(TBTUIViewsCommonUtils::TurnBTOnIfNeededL(iBtEngSettings,iCoverDisplayEnabled)!= KErrNone) + return; + + TInt errorCode = KErrNone; + TBTPowerStateValue currentPowerMode; + errorCode=iBtEngSettings->GetPowerState(currentPowerMode); + + if(errorCode) + { + // handle the error code + return; + } + if ( aNewWaitNote ) + { + // Launch wait note + OpenWaitNoteL(iWaitForConnectDlg,R_BT_CONNECTING_TO_WAIT_NOTE,R_BT_CONNECTING_TO , + ECmdShowBtWaitConnectingToNote,aDevice.iName); + } + iConnectDevice=new(ELeave) TBTDevice(aDevice); + iConnectDevice->iOperation=EOpConnect; + + if( currentPowerMode == EBTPowerOff ) + { + // turn on the flag IsConnectDevice + // + iIsConnectDevice = ETrue; + } + else + { + // connect device + // + iModel->ChangeDevice(*iConnectDevice); + + // reset IsConnectDevice flag + iIsConnectDevice = EFalse; + } + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::OpenWaitNoteL +// ---------------------------------------------------------- +void CBTUIPairedDevicesView::OpenWaitNoteL(CAknWaitDialog*& aWaitDialog,TUint aNoteResource,TUint aNoteTextResource, + TSecondaryDisplayBtuiDialogs aSec,const TDesC& aDevName) + { + TRAPD(err, + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, aNoteTextResource, aDevName, 0 ); + aWaitDialog = new (ELeave) CAknWaitDialog( + reinterpret_cast(&aWaitDialog), ETrue); + aWaitDialog->PrepareLC(aNoteResource); + aWaitDialog->SetTextL(stringholder); + + if(iCoverDisplayEnabled) + { + aWaitDialog->PublishDialogL( + aSec, KUidCoverUiCategoryBtui); // initializes cover support + CAknMediatorFacade* covercl = AknMediatorFacade(aWaitDialog); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(aDevName);// takes copy so consts are ok too + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + aWaitDialog->SetCallback(this); // for capturing Cancel keypress + aWaitDialog->RunLD(); + + CleanupStack::PopAndDestroy(&stringholder); // stringholder + ); + // if the above functions leaves the iWaitNote is deleted, but + // not set to NULL. This will cause a problem, when + // the items may be deleted again, since it has to + // be a member variable, in order to be closed + // programmatically. + if(err!=KErrNone) + { + // that is why we set it to NULL here and + // continue leaving further. + aWaitDialog=NULL; + User::Leave(err); + } + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::LaunchSettingViewL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::LaunchSettingViewL() + { + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + + CAknView* settingView = iBTPluginMan->GetSettingViewL(device); + if(settingView != NULL) + { + TUid viewId = settingView->Id(); + if(( device.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected ) + { + TBuf8 DeviceName; + DeviceName.Copy(device.iName); + AppUi()->ActivateLocalViewL( viewId, KNullUid, DeviceName); + } + else + { + AppUi()->ActivateLocalViewL( viewId ); + } + } + else + { + User::Leave(KErrNotFound); + } + + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::DisconnectL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::DisconnectL() + { + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + + if ( !( device.iStatus & EStatusBtuiConnected) ) + { + // If device is already disconnected, return immediately. + return; + } + + iDisconnectQueryDevice = device;//remember device related with query dialog + + // Create confirmation query + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, R_BT_DISCONNECT_FROM, device.iName, 0 ); + if ( !iDisconnectQueryDlg ) + { + iDisconnectQueryDlg = CAknQueryDialog::NewL(); + } + + if(iCoverDisplayEnabled) + { + iDisconnectQueryDlg->PublishDialogL(ECmdShowDisconnectQuery, KUidCoverUiCategoryBtui); // initializes cover support + + CAknMediatorFacade* covercl = AknMediatorFacade(iDisconnectQueryDlg); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(device.iName);// takes copy so consts are ok too + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + + TInt keypress = iDisconnectQueryDlg->ExecuteLD(R_BT_DISCONNECT_FROM_QUERY, stringholder); + + CleanupStack::PopAndDestroy(&stringholder); // stringholder + + iDisconnectQueryDlg = NULL; + if(keypress) // User has accepted the dialog + { + device.iOperation = EOpDisconnect; + iModel->ChangeDevice(device); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::CancelDisconnectQueryDlgL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::CancelDisconnectQueryDlg() +{ + TRACE_FUNC_ENTRY + + if(iDisconnectQueryDlg) + { + delete iDisconnectQueryDlg; + iDisconnectQueryDlg = NULL; + } + + TRACE_FUNC_EXIT +} + +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::DisconnectWithoutQuery +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::DisconnectWithoutQuery() +{ + TRACE_FUNC_ENTRY + + TInt index = iContainer->CurrentItemIndex(); + if(index == KErrNotFound) return; + + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + device.iOperation = EOpDisconnect; + iModel->ChangeDevice(device); +} +// ---------------------------------------------------------- +// CBTUIPairedDevicesView::ConnectCompleteL +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::ConnectCompleteL(TInt aError,const TBTDevice& aDevice, + const RBTDevNameArray* aConflictingDeviceNames) + { + TRACE_FUNC_ENTRY + + // Dismiss wait note + // + if(iConnectDevice) + { + delete iConnectDevice; + iConnectDevice=NULL; + } + + if ( iIsPairConnect ) + { + iIsPairConnect = EFalse; + if ( aError != KErrNone && + aError != KErrCancel && + aError != KErrNotSupported && + aError != KErrAlreadyExists && + aError != KErrServerBusy ) + { + // It is possible that we started connecting too soon before the + // device moves to conntable mode from pairing mode. Let's try + // once more: + if ( !iActive ) + { + iActive = CBTUIActive::NewL( + this, KAutoConnect2ndTry, CActive::EPriorityStandard ); + } + iActive->RequestStatus() = KRequestPending; + iActive->GoActive(); + TRequestStatus* stptr = &( iActive->RequestStatus() ); + User::RequestComplete( stptr, KErrNone ); + TRACE_INFO( _L("CBTUIPairedDevicesView, sceadule auto connect 2nd try") ) + return; + } + } + + if(iWaitForConnectDlg) + { + TRACE_INFO(_L("waiting dialog is active, dismiss it")) + iWaitForConnectDlg->ProcessFinishedL(); + } + + switch (aError) + { + case KErrCancel: + TRACE_INFO(_L("aError = KErrCancel")) + break; + case KErrAlreadyExists: // connection exists allready + { + RBuf stringholder; + CleanupClosePushL( stringholder ); + if(aConflictingDeviceNames && aConflictingDeviceNames->Count()> 0) + { + if(aConflictingDeviceNames->Count() == 1) + { + BluetoothUiUtil::LoadResourceAndSubstringL( stringholder, + R_BT_DISCONNECT_FIRST_PROMPT, + *(*aConflictingDeviceNames)[0], 0 ); + } + else + { + BluetoothUiUtil::LoadResourceAndSubstringL( stringholder, + R_BT_DISCONNECT_FIRST_STEREO_PROMPT, + *(*aConflictingDeviceNames)[0], 0 ); + BluetoothUiUtil::AddSubstringL( stringholder, *(*aConflictingDeviceNames)[1], 1 ); + } + TRACE_INFO(_L("KErrAllreadyExists")) + } + else + { + // Showing a note in this case would always show a note with "%U" in it + // so the note is not shown at all + TRACE_INFO(_L("KErrAlreadyExists, but no device given, not showing a notification")) + CleanupStack::PopAndDestroy(&stringholder); + break; + } + + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdShowBtDisconnectFirstNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(note); + + CAknMediatorFacade* covercl = AknMediatorFacade(note); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + if(aConflictingDeviceNames && aConflictingDeviceNames->Count()> 0) + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(*(*aConflictingDeviceNames)[0]); + } + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + + note->ExecuteLD(stringholder); + CleanupStack::PopAndDestroy(&stringholder); + } + break; + case KErrServerBusy: + { + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( + CAknNoteDialog::ENoTone,CAknNoteDialog::ELongTimeout); + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdBtuiShowBtBusyNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + dlg->ExecuteLD(R_BT_BUSY); + } + break; + case KErrNone: + { + + TRACE_INFO(_L("aError = KErrNone")) + // Create note + // + CAknInformationNote* notePtr = new (ELeave) CAknInformationNote(); + + RBuf stringHolder; + CleanupClosePushL( stringHolder ); + + BluetoothUiUtil::LoadResourceAndSubstringL( stringHolder, + R_BT_CONF_CONNECTED_PROMPT, aDevice.iName, 0 ); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(notePtr); + notePtr->PublishDialogL(ECmdBtuiShowBtConfConnected, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(notePtr); + + CAknMediatorFacade* covercl = AknMediatorFacade(notePtr); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(aDevice.iName); + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + + notePtr->ExecuteLD(stringHolder); + CleanupStack::PopAndDestroy(&stringHolder); + } + + TRAP_IGNORE(LaunchSettingViewL();) + break; + + case KErrNotSupported: + { + TRACE_INFO(_L("error = KErrNotSupported")) + + RBuf stringHolder; + CleanupClosePushL( stringHolder ); + + BluetoothUiUtil::LoadResourceAndSubstringL( stringHolder, + R_BT_DEVICE_NOT_SUPPORTED, aDevice.iName, 0 ); + + // create note + // + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdBtuiShowBtDeviceNotSupported, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(note); + + CAknMediatorFacade* covercl = AknMediatorFacade(note); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(aDevice.iName); + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + } + note->ExecuteLD(stringHolder); + CleanupStack::PopAndDestroy(&stringHolder); + } + break; + + default: + { + // Create note + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + HBufC* stringHolder=StringLoader::LoadLC(R_BT_DEVICE_NOT_AVAIL_NOTE ); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdBtuiShowBtDeviceNotAvail, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(note); + + } + + note->ExecuteLD(*stringHolder); + CleanupStack::PopAndDestroy(stringHolder); + TRACE_INFO(_L("default error note BT-not-available")) + } + break; + } + TRACE_FUNC_EXIT + } + +// ------------------------------------------------------ +// CBTUIPairedDevicesView::LaunchHelp +// static help launching function for TCallback +// ------------------------------------------------------ +TInt CBTUIPairedDevicesView::LaunchHelp(TAny* aCoeHelpContext) + { +#ifdef __SERIES60_HELP + //TRACE_FUNC_ENTRY + TCoeHelpContext hc; + + if(aCoeHelpContext==NULL) + hc = TCoeHelpContext(KBtuiUid3,KBT_HLP_BLOCKED); + else + hc = *static_cast(aCoeHelpContext); + TRAPD(err, + CArrayFix< TCoeHelpContext >* array=new (ELeave) CArrayFixFlat< TCoeHelpContext >(1); + array->AppendL(hc); + CleanupStack::PushL(array); + // codescan will complain about CCoeEnv::Static(), however it is not reasonable + // avoidable, since this is static funtion. + HlpLauncher::LaunchHelpApplicationL(CCoeEnv::Static()->WsSession() , array); + CleanupStack::Pop(array); + ); + + // the array is not deleted, since deleting it will result + // to E32User-CBase 3. It is assumed that HlpLancher is taking care of it. + // however this has not been documented. + //TRACE_FUNC_EXIT + return err; +#else + return KErrNone; +#endif + } + +// ------------------------------------------------------ +// CBTUIPairedDevicesView::CallOnGoing +// ------------------------------------------------------ +TBool CBTUIPairedDevicesView::CallOnGoing() + { + TRACE_FUNC_ENTRY + TInt callState; + // Try to get the call state property + + TInt err = RProperty::Get(KPSUidCtsyCallInformation, + KCTsyCallState, callState); //KPSUidTelephonyCallInformation should be used // Check also,if retrieving the property value succeeded + return (err == KErrNone) ? + (callState != EPSCTsyCallStateNone && + callState != EPSCTsyCallStateUninitialized) : + EFalse; + } +// ---------------------------------------------------------- +// From MProgressDialogCallback +// CBTUIPairedDevicesView::DialogDismissedL +// +// Cancels pairing/connection operation if user has pressed Cancel softkey. +// Does nothing if the dialog has been dismissed by this program. +// ---------------------------------------------------------- +// +void CBTUIPairedDevicesView::DialogDismissedL(TInt aButtonId ) + { + TRACE_FUNC_ENTRY + + // it was not canceled, but dialog was closed + // because it ended normally, so there is nothing to clean up. + if( aButtonId != EAknSoftkeyCancel ) + return; + + // Cancel ongoing operations if any + // + if ( iWaitForConnectDlg) + { + if( iConnectDevice ) + { + iModel->CancelChange(*iConnectDevice); + delete iConnectDevice; + iConnectDevice=NULL; + iIsPairConnect = EFalse; + } + iWaitForConnectDlg = NULL; + } + if ( iWaitForPairingDlg ) + { + if( iPairingDevice ) + { + TBTDevice device; + device.iAddr = iPairingDevice->BDAddr(); + device.iOperation = EOpPair; + + iDeviceSearcher->CancelSearchRemoteDevice(); + + iModel->CancelChange(device); + + delete iPairingDevice; + iPairingDevice=NULL; + } + // The dialog has already been deleted by UI framework and + // must not be deleted manually. + iWaitForPairingDlg = NULL; + } + + TRACE_FUNC_EXIT + } +// ------------------------------------------------------ +// From MBTEngSdpResultReceiver +// CBTUIPairedDevicesView::ServiceSearchComplete +// not used and implemented as empty +// ------------------------------------------------------ +void CBTUIPairedDevicesView::ServiceSearchComplete(const RSdpRecHandleArray& , TUint , TInt) + { + TRACE_FUNC_ENTRY + } +// ------------------------------------------------------ +// From MBTEngSdpResultReceiver +// CBTUIPairedDevicesView::AttributeSearchComplete +// not used and implemented as empty +// ------------------------------------------------------ +void CBTUIPairedDevicesView::AttributeSearchComplete(TSdpServRecordHandle, + const RSdpResultArray& ,TInt) + { + TRACE_FUNC_ENTRY + } +// ------------------------------------------------------ +// From MBTEngSdpResultReceiver +// CBTUIPairedDevicesView::AttributeSearchComplete +// not used and implemented as empty +// ------------------------------------------------------ +void CBTUIPairedDevicesView::ServiceAttributeSearchComplete(TSdpServRecordHandle , + const RSdpResultArray& ,TInt ) + { + TRACE_FUNC_ENTRY + } +// ------------------------------------------------------ +// From MBTEngSdpResultReceiver +// CBTUIPairedDevicesView::DeviceSearchComplete +// ------------------------------------------------------ +void CBTUIPairedDevicesView::DeviceSearchComplete(CBTDevice* aDevice, TInt aErr) + { + TRACE_FUNC_ENTRY + + TRAPD(err, DeviceSearchCompleteL(aDevice, NULL, aErr); + ); + // something went wrong. + if(err != KErrNone) + { + TRAP_IGNORE( TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); ); + } + iSearchOngoing=EFalse; + TRACE_FUNC_EXIT + } + +// ------------------------------------------------------ +// From MBTEngSdpResultReceiver +// CBTUIPairedDevicesView::DeviceSearchComplete +// ------------------------------------------------------ +void CBTUIPairedDevicesView::DeviceSearchComplete( CBTDevice* aDevice, + TNameEntry* aNameEntry, TInt aErr ) + { + TRACE_FUNC_ENTRY + + TRAPD(err, DeviceSearchCompleteL(aDevice, aNameEntry, aErr); + ); + // something went wrong. + if(err != KErrNone) + { + TRAP_IGNORE( TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); ); + } + iSearchOngoing=EFalse; + TRACE_FUNC_EXIT + } + +// ------------------------------------------------------ +// CBTUIPairedDevicesView::DeviceSearchCompleteL +// Leaving version of DeviceSearchComplete +// ------------------------------------------------------ + +void CBTUIPairedDevicesView::DeviceSearchCompleteL(CBTDevice* aDevice, + TNameEntry* aNameEntry, TInt aErr) + { + TRACE_FUNC_ENTRY + iSearchOngoing=EFalse; + if ( !iPairingDevice ) + { + delete iModel; + iModel = NULL; + return; + } + // we must not have multiple pairings at the same time + __ASSERT_DEBUG(aDevice->BDAddr() == iPairingDevice->BDAddr(), + PANIC(EBTPanicTwoPairingAttemptsAtTheSameTime) ); + + // other error condition, most likely dialog cancel. + if(aErr != KErrNone && (aErr != KErrAlreadyExists)) + { + delete iPairingDevice; + iPairingDevice=NULL; + return; + } + + // In case user switches the view fast enough before searching starts, + // It crashes the whole btui by iModel is null value. + // We add an extra check here + // + if ( !iModel ) + { + delete iPairingDevice; + iPairingDevice=NULL; + return; + } + + TBTDevice *tmpDevice=iModel->CreateDeviceL(aDevice, aNameEntry); + CleanupStack::PushL(tmpDevice); + if(tmpDevice->iStatus & (EStatusPhysicallyConnected|EStatusBtuiConnected|EStatusPaired)) + { + ShowDisconnecNoteL(tmpDevice); + CleanupStack::PopAndDestroy(tmpDevice); + delete iPairingDevice; + iPairingDevice=NULL; + return; + } + else + { + // Launch wait note + OpenWaitNoteL(iWaitForPairingDlg,R_BT_WAITING,R_BT_WAITING_PROMPT, + ECmdShowBtWaitingNote,tmpDevice->iName); + + CleanupStack::PopAndDestroy(tmpDevice); + tmpDevice=NULL; + // and start the pairing + iModel->ChangeDevice(aDevice, aNameEntry, EOpPair); + // aDevice is not deleted, since it points to iPairingDevice and it is still used + // after this + } + TRACE_FUNC_EXIT + } + + +// ------------------------------------------------------ +// CBTUIPairedDevicesView::ShowDisconnecNote +// ------------------------------------------------------ +void CBTUIPairedDevicesView::ShowDisconnecNoteL(TBTDevice *aDevice) + { + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( + stringholder, R_BT_DISCONNECT_FIRST_PROMPT, aDevice->iName, 0 ); + // Launch a waiting confirmation note + // + CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote(ETrue); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdShowBtSuccesfullyPairedNote, + KUidCoverUiCategoryBtui); // initializes cover support + CAknMediatorFacade* covercl = AknMediatorFacade(note); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(aDevice->iName);// takes copy so consts are ok too + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + CleanupStack::Pop(note); + } + + note->ExecuteLD(stringholder); + + CleanupStack::PopAndDestroy(&stringholder); // stringholder + + } + +void CBTUIPairedDevicesView::ConnectIfNeededAfterPairL( TInt aCount ) + { + TRACE_FUNC_ENTRY + TBTDevice device; + device.iAddr = iPairConnectAddr; + iModel->GetDevice(device); + device.iOperation = EOpConnect; + ConnectL( device, ( aCount ) ? EFalse : ETrue ); + TRACE_FUNC_EXIT + } + +// ------------------------------------------------------ +// CBTUIPairedDevicesView::BondingCompleted +// called by NotifyChangeDeviceComplete +// ------------------------------------------------------ +void CBTUIPairedDevicesView::BondingCompleteL(TInt aError, const TBTDevice& aDevice) + { + TRACE_INFO((_L("aError=%d"), aError)) + // We need to make a copy of the device, since it may be cleaned up + // by device refresh. + TBTDevice bDevice= aDevice; + + // this may look useless, however if the device has a given shortName it is listed with it + // all the time. If you omnit this line it will be shown with its original deviceName, + // dispite it will be listed with the given name + iModel->GetDevice(bDevice); + + delete iPairingDevice; + iPairingDevice=NULL; + + // Dismiss wait note + if(iWaitForPairingDlg) + { + iWaitForPairingDlg->ProcessFinishedL(); + iWaitForPairingDlg = NULL; + } + + // Error handling + switch(aError) + { + case KErrCancel: + break; + case KErrAlreadyExists: // This is a legal return value + case KErrNone: + case KHCIErrorBase: + { + if( (bDevice.iStatus & EStatusConnectable) + && (bDevice.iDeviceClass.MajorDeviceClass() != EMajorDeviceComputer)) + // Only automatically query for a connectable device but not a computer + { + iPairConnectAddr = aDevice.iAddr; + iIsPairConnect = ETrue; + ConnectIfNeededAfterPairL( 0 ); + } + break; + } + default: + { + break; + } + } + TRACE_FUNC_EXIT + } + +// ----------------------------------------------- +// From MBTDeviceObserver +// CBTUIPairedDevicesView::RefreshDeviceList +// calls the container to refresh the deviceList +// ----------------------------------------------- +void CBTUIPairedDevicesView::RefreshDeviceList(const RDeviceArray* aDevices, + TInt aSelectedItemIndex) + { + TRACE_FUNC_ENTRY + TRAPD(err, + if(iContainer) + { + iContainer->RefreshDeviceListL(aDevices,aSelectedItemIndex); + } + ); + if (iActiveMenuPane && iActiveMenuPane->NumberOfItemsInPane()>0 ) + { + TInt index = iContainer->CurrentItemIndex(); + if ( index >=0 ) + { + TBTDevice device; + device.iIndex = index; + iModel->GetDevice(device); + if ( iMenuDevice.iAddr == device.iAddr && + ( ( iMenuDevice.iStatus & EStatusBtuiConnected ) != ( device.iStatus & EStatusBtuiConnected ) ) ) + { + TRACE_INFO(_L("Device status changed, update menupane")); + iMenuDevice = device; + iActiveMenuPane->Close(); + TRAP_IGNORE( this->ProcessCommandL(EAknSoftkeyContextOptions) ); + } + } + } + if(err!= KErrNone) + { + TRAP_IGNORE( TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); ); + } + TRACE_FUNC_EXIT + } + + +// ----------------------------------------------- +// +// ----------------------------------------------- +void CBTUIPairedDevicesView::RequestCompletedL( CBTUIActive* aActive, TInt aId, + TInt aStatus ) + { + TRACE_INFO( ( _L("CBTUIPairedDevicesView::RequestCompletedL err %d"), aStatus ) ) + (void) aActive; + (void) aId; + (void) aStatus; + TRACE_INFO( _L("CBTUIPairedDevicesView, auto connect 2nd try ... ") ) + ConnectIfNeededAfterPairL( 1 ); + } + +// ----------------------------------------------- +// +// ----------------------------------------------- +void CBTUIPairedDevicesView::HandleError( CBTUIActive* aActive, TInt aId, + TInt aError ) + { + (void) aActive; + (void) aId; + (void) aError; + iIsPairConnect = EFalse; + } + +// --------------------------------------------------------- +// From MBTDeviceObserver +// CBTUIPairedDevicesView::NotifyChangeDeviceComplete +// This function implement the functionality of command complete. +// The lists of shown devices are refreshed by RefreshDeviceList, +// not by this function +// --------------------------------------------------------- +// +void CBTUIPairedDevicesView::NotifyChangeDeviceComplete(const TInt aErr, + const TBTDevice& aDevice, const RBTDevNameArray* aDevNameArray) + { + TRACE_FUNC_ENTRY + TBTDevice tmpDevice=aDevice; + TRAPD(err,NotifyChangeDeviceCompleteL(aErr,tmpDevice,aDevNameArray + );); + if(err!= KErrNone) + { + TRAP_IGNORE( TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); ); + } + TRACE_FUNC_EXIT + } +// --------------------------------------------------------- +// CBTUIPairedDevicesView::NotifyChangeDeviceCompleteL +// Leaving version of notifyChangeDevice +// --------------------------------------------------------- + +void CBTUIPairedDevicesView::NotifyChangeDeviceCompleteL(const TInt aErr, + const TBTDevice& aDevice, const RBTDevNameArray* aDevNameArray) + { + TRACE_FUNC_ENTRY + if(iContainer == NULL) return; + + TRACE_INFO((_L("aErr=%d"), aErr)) + TRACE_INFO((_L("aDevice.iOperation=%d"), aDevice.iOperation)) + TRACE_INFO((_L("aDevice.iStatus=%d"), aDevice.iStatus)) + TRACE_INFO((_L("iIsAlreadyConnected=%d"), iIsAlreadyConnected)) + + if (aDevice.iOperation == EOpDisconnect && iExpectedCallBack>0 ) + { + TBTDevice device; + device.iIndex = aDevice.iIndex; + iModel->GetDevice(device); + device.iOperation = EOpUnpair; + iModel->ChangeDevice(device); + iExpectedCallBack--; + } + + if( aDevice.iOperation == EOpConnect ) + { + if( aErr == KErrNone && iIsAlreadyConnected ) + { + TRACE_INFO(_L("Don't show notes several times for the same device with different profile connections")) + return; + } + ConnectCompleteL(aErr, aDevice, aDevNameArray ); + iIsAlreadyConnected = ETrue; + TRACE_INFO(_L("iIsAlreadyConnected False -> True")) + return; + } + if(aDevice.iOperation == EOpPair) + { + BondingCompleteL(aErr, aDevice); + } + if(aErr != KErrNone) + { + // The user tried to rename to a name that allready exists. + if(aDevice.iOperation == EOpChangeName && aErr == KErrAlreadyExists) + { + CAknNoteDialog* dlg2 = new (ELeave) CAknNoteDialog(CAknNoteDialog::EErrorTone, + CAknNoteDialog::ELongTimeout); + dlg2->ExecuteLD(R_BT_NAME_EXISTS_NOTE); + + RenameDeviceDlgL(); + return; + } + // Need to properly handle situation when "Disconnect from xxx" query + // has been shown and paired device has been turned off simultaneously. + // CancelDisconnectQuery dialog need to be closed. + if(aErr == KErrDisconnected) + { + if(iDisconnectQueryDlg && aDevice.iAddr == iDisconnectQueryDevice.iAddr) + CancelDisconnectQueryDlg(); + + TRACE_FUNC_EXIT + return; + } + // show general error if any of these failed + if( aDevice.iOperation== EOpTrust || + aDevice.iOperation== EOpUntrust || + aDevice.iOperation== EOpBlock || + aDevice.iOperation== EOpChangeName) + { + TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); + } + return; + } + + if(aDevice.iOperation == EOpUntrust) + { + // Unauthorise ok note, + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ELongTimeout); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtDevSetAsUntrustNote, KUidCoverUiCategoryBtui); + // initializes cover support + CleanupStack::Pop(dlg); + } + dlg->ExecuteLD( R_BT_DEVICE_UNTRUSTED_NOTE ); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// CBTUIPairedDevicesView::CreateTabIconL() +// Creates icon for tab. +// --------------------------------------------------------------------------- +// +CGulIcon* CBTUIPairedDevicesView::CreateTabIconL() + { + TFileName bmpFilename; + bmpFilename += KBitmapFileDrive; + bmpFilename += KDC_APP_BITMAP_DIR; + bmpFilename += KBtuiBmpFileName; + + CGulIcon* icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropBtDevicesTab3, + bmpFilename, + EMbmBtuiQgn_prop_bt_devices_tab3, + EMbmBtuiQgn_prop_bt_devices_tab3_mask ); + + return icon; + } + + +void CBTUIPairedDevicesView::SetupMenuCmd(TInt aIndex, CEikMenuPane* aMenu) + { + TBTDevice device; + device.iIndex = aIndex; + iModel->GetDevice(device); + iMenuDevice = device; + + TRACE_INFO(_L("there are device in list")) + + TBool dim = (device.iStatus & EStatusTrusted) == EStatusTrusted; + + aMenu->SetItemDimmed(EBTUICmdSetTrusted, dim); + aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, !dim); + + // Check if device can be connected or disconnected + dim = (! (device.iStatus & EStatusConnectable) + || device.iStatus & EStatusBtuiConnected); + + if (dim) + { + aMenu->SetItemDimmed(EBTUICmdConnect, dim); + aMenu->SetItemDimmed(EBTUICmdConnectAudio, dim); + } + else + { + if ( device.iDeviceClass.MajorDeviceClass() == EMajorDeviceComputer) + { + aMenu->SetItemDimmed(EBTUICmdConnect, ETrue); + } + else + { + aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue); + } + } + dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; + aMenu->SetItemDimmed(EBTUICmdDisconnect, dim); + + if ( !iBTPluginMan->IsPluginAvaiable(device.iDeviceClass) ) + { + aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); + } + else + { + dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; + aMenu->SetItemDimmed(EBTUICmdSettings, dim); + } + } + + +// End of File + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIRegistryWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIRegistryWatcher.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,138 @@ +/* +* 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: Declares Registry watcher class for BTUI. +* +*/ + + +// INCLUDE FILES + +#include "BTUI.h" +#include "BTUIRegistryWatcher.h" +#include + +#include "BTDevModel.h" //for Log printing Macro + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::CBTUIRegistryWatcherAO +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------- +// +CBTUIRegistryWatcherAO::CBTUIRegistryWatcherAO( MBTUIRegistryObserver* aParent ) + : CActive(EPriorityNormal), iParent ( aParent ) + { + TRACE_FUNC_ENTRY + + CActiveScheduler::Add(this); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +// +CBTUIRegistryWatcherAO::~CBTUIRegistryWatcherAO() + { + TRACE_FUNC_ENTRY + + Cancel(); + iProperty.Close(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::WatchL +// --------------------------------------------------------- +// +void CBTUIRegistryWatcherAO::WatchL() + { + TRACE_FUNC_ENTRY + + if( !iProperty.Handle() ) + { + User::LeaveIfError( iProperty.Attach( KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothRegistryTableChange ) ); + } + + if( !IsActive() ) + { + iProperty.Subscribe(iStatus); + SetActive(); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::DoCancel +// --------------------------------------------------------- +// +void CBTUIRegistryWatcherAO::DoCancel() + { + TRACE_FUNC + + iProperty.Cancel(); + } + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::RunL +// --------------------------------------------------------- +// +void CBTUIRegistryWatcherAO::RunL() + { + TRACE_FUNC_ENTRY + + if( iStatus.Int()==KErrNone ) + { + __ASSERT_DEBUG(iParent, PANIC(EBTPanicClassMemberVariableIsNull)); + + // Inform observer + // + iParent->RegistryContentChangedL(); + + // Continue watching + // + WatchL(); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::RunError +// --------------------------------------------------------- +// +TInt CBTUIRegistryWatcherAO::RunError( TInt aError ) + { + TRACE_INFO((_L("RunError: %d"), aError)) + + return aError; + } + +// --------------------------------------------------------- +// CBTUIRegistryWatcherAO::StopWatching +// --------------------------------------------------------- +// +void CBTUIRegistryWatcherAO::StopWatching() + { + TRACE_FUNC + + Cancel(); + } + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUISap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUISap.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,249 @@ +/* +* 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 module is created for Bluetooth SIM Access Profile +* feature variant. +* +*/ + +#include +#include +#include // Compiled resource ids +#include +#include +#include +#include // for disconnect type and connection observer +#include +#include +#include +#include // For EnterpriseEnablementL() +#include +#include +#include +#include "btdevmodel.h" + +#include "debug.h" +#include "BTUIMainView.h" + +// ---------------------------------------------------- +// CBTUIMainView::SetSapStatusL +// ---------------------------------------------------- +// +void CBTUIMainView::SetSapStatusL( TBTSapMode aValue ) + { + TRACE_FUNC_ENTRY + + TInt previousSapMode = GetSapStatusL(); + + if(previousSapMode==EBTSapEnabled) + previousSapMode=ETrue; + + TBool legalToChange = ETrue; + + if ( ( previousSapMode ) && ( !aValue ) ) // SAP Enabled -> Disabled + { + // Check active SAP connections before query + TInt connStatus = EBTSapNotConnected; + RProperty::Get(KPSUidBluetoothSapConnectionState, KBTSapConnectionState, connStatus); + + if(connStatus == EBTSapConnected) + { + //Get name of the currently connected SAP device + + TBTDeviceName connectedSap; + TInt error = GetConnectedSapNameL( connectedSap ); + + if ( error ) + { + TBTUIViewsCommonUtils::ShowGeneralErrorNoteL(); + } + else + { + + // Create confirmation query + RBuf stringholder; + CleanupClosePushL( stringholder ); + BluetoothUiUtil::LoadResourceAndSubstringL( stringholder, + R_BT_DISCONNECT_FROM, connectedSap, 0 ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowDisconnectQuery, KUidCoverUiCategoryBtui); // initializes cover support + CAknMediatorFacade* covercl = AknMediatorFacade(dlg); // uses MOP, so control provided + if (covercl) // returns null if __COVER_DISPLAY is not defined + { + covercl->BufStream() << BTDeviceNameConverter::ToUTF8L(connectedSap);// takes copy so consts are ok too + covercl->BufStream().CommitL(); // no more data to send so commit buf + } + CleanupStack::Pop(dlg); + } + + TInt keypress = dlg->ExecuteLD( R_BT_DISCONNECT_FROM_QUERY, stringholder ); + + CleanupStack::PopAndDestroy(&stringholder); // stringholder + + if( keypress ) // User has accepted the dialog + { + legalToChange = ETrue; + } + else + { + legalToChange = EFalse; + } + } + } + } + + else if ( ( !previousSapMode ) && ( aValue ) ) // SAP Disabled -> Enabled + { + + //if Bluetooth is off + TBTPowerStateValue powerState; + iBtEngSettings->GetPowerState(powerState); + if(powerState!=EBTPowerOn) + { + CAknNoteDialog* dlg2 = new (ELeave) CAknNoteDialog( CAknNoteDialog::EConfirmationTone, + CAknNoteDialog::ENoTimeout/*ELongTimeout*/ ); + if(iCoverDisplayEnabled) + { + CleanupStack::PushL(dlg2); + dlg2->PublishDialogL(ECmdShowBtSapEnableNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg2); + } + + dlg2->ExecuteLD( R_BT_SAP_ENABLE_NOTE ); + } + + } + + // Switch sapmode + // + if ( legalToChange ) + { + CRepository* cenRep = NULL; + cenRep = CRepository::NewL( KCRUidBTEngPrivateSettings ); + CleanupStack::PushL(cenRep); + TInt err = cenRep->Set( KBTSapEnabled, aValue ); + CleanupStack::PopAndDestroy(cenRep); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIMainView::AskSapModeDlgL +// ---------------------------------------------------------- +// +void CBTUIMainView::AskSapModeDlgL() + { + TRACE_FUNC_ENTRY + + if ( BluetoothFeatures::EnterpriseEnablementL() == BluetoothFeatures::EDataProfilesDisabled ) + { + RNotifier notifier; + User::LeaveIfError(notifier.Connect()); + CleanupClosePushL(notifier); + User::LeaveIfError(notifier.StartNotifier(KBTEnterpriseItSecurityInfoNotifierUid, KNullDesC8 )); + CleanupStack::PopAndDestroy(¬ifier); + } + else + { + CDesCArrayFlat* items = iCoeEnv->ReadDesCArrayResourceL( R_BT_SAP_MODES ); + CleanupStack::PushL(items); + + TInt currentItem = KErrNotFound; + if(GetSapStatusL() == EBTSapEnabled ) + { + currentItem=0; + } + else + { + currentItem=1; + + } + CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( + R_BT_SAP_SETTING_PAGE, currentItem, items ); + if( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )) + { + if(currentItem == 1) + { + SetSapStatusL( static_cast( EBTSapDisabled ) ); + // Cast it back (invert again) + } + else + { + SetSapStatusL( static_cast( EBTSapEnabled ) ); + // Cast it back (invert again) + } + } + CleanupStack::PopAndDestroy(items); + } + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// CBTUIMainView::GetSapStatusL +// ---------------------------------------------------------- +// +TInt CBTUIMainView::GetSapStatusL() + { + TRACE_FUNC_ENTRY + TInt sapStatus; + CRepository* repository = CRepository::NewL(KCRUidBTEngPrivateSettings); + CleanupStack::PushL(repository); + repository->Get(KBTSapEnabled, sapStatus); + CleanupStack::PopAndDestroy(repository); + TRACE_FUNC_EXIT + return sapStatus; + } + +// ---------------------------------------------------------- +// CBTUIModel::GetConnectedSapNameL +// ---------------------------------------------------------- +// + +TInt CBTUIMainView::GetConnectedSapNameL( TDes& aName ) + { + TRACE_FUNC_ENTRY + + + CBTEngConnMan* cm = CBTEngConnMan::NewL(NULL); + CleanupStack::PushL(cm); + + RBTDevAddrArray devAddrArray; + cm->GetConnectedAddresses(devAddrArray, EBTProfileSAP); + if(devAddrArray.Count()>0) + { + CBTEngDevMan* devMan = CBTEngDevMan::NewL(NULL); + + TBTRegistrySearch search; + search.FindAddress(devAddrArray[0]); + + CBTDeviceArray* deviceArray= new (ELeave) CBTDeviceArray(devAddrArray.Count()); + //the name is in first CBTDevice in returned CBTDeviceArray. + devMan->GetDevices(search, deviceArray); + + aName = *(CnvUtfConverter::ConvertToUnicodeFromUtf8L(deviceArray->At(0)->DeviceName())); + + deviceArray->ResetAndDestroy(); + delete deviceArray; + + delete devMan; + } + + devAddrArray.Close(); + CleanupStack::PopAndDestroy(cm); + TRACE_FUNC_EXIT + return KErrNone; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BTUIViewsCommonUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BTUIViewsCommonUtils.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,194 @@ +/* +* 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: Utility function for the views. +* +*/ + +#include // Compiled resource ids +#include +#include // Series 60 localisation stringloader +#include +#include +#include // Feature Manager API +#include +#include +#include +#include +#include + +#include "BTUIViewsCommonUtils.h" +#include "debug.h" + + +// ---------------------------------------------------------- +// TBTUIViewsCommonUtils::ShowGeneralErrorNoteL +// ---------------------------------------------------------- +// +void TBTUIViewsCommonUtils::ShowGeneralErrorNoteL() + { + //TRACE_FUNC_ENTRY + + CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( CAknNoteDialog::EErrorTone, + CAknNoteDialog::ELongTimeout ); + if(FeatureManager::FeatureSupported( KFeatureIdCoverDisplay )) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(ECmdShowBtGeneralErrorNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + TRACE_INFO(_L("ShowGeneralErrorNoteL ")) + dlg->ExecuteLD( R_BT_GENERAL_ERROR_NOTE ); + + //TRACE_FUNC_EXIT + } + +// ---------------------------------------------------------- +// TBTUIViewsCommonUtils::IsAnyDeviceConnectedL() +// ---------------------------------------------------------- +TBool TBTUIViewsCommonUtils::IsAnyDeviceConnectedL() + { + //TRACE_FUNC_ENTRY + + TInt connNum = 0; + TInt retVal = RProperty::Get(KPropertyUidBluetoothCategory, + KPropertyKeyBluetoothGetPHYCount, connNum); + TRACE_INFO((_L("GetConnectionNumber(): %d"), connNum)) + //TRACE_FUNC_EXIT + return (connNum > 0); + } + +// ----------------------------------------------- +// CBTUIPairedDevicesView::TurnBTOnIfNeededL +// ----------------------------------------------- +TInt TBTUIViewsCommonUtils::TurnBTOnIfNeededL(CBTEngSettings* aBtEngSettings,TBool aCoverDisplayEnabled ) + { + //TRACE_FUNC + + TInt errorCode = KErrNone; + TBTPowerStateValue previousPowerMode; + + errorCode=aBtEngSettings->GetPowerState(previousPowerMode); + if(errorCode) + return errorCode; + + if( previousPowerMode==EBTPowerOn ) + return KErrNone; + + if ( previousPowerMode==EBTPowerOff ) // power OFF -> ON + { + TRACE_INFO(_L("[BTUI]\t power OFF -> ON")) + + TInt offlineModeOff = 0; // possible values are 0 and 1 + TInt activationEnabled = 0; // possible values are 0 and 1 + + CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs); + CleanupStack::PushL(repository); + repository->Get(KCoreAppUIsNetworkConnectionAllowed, offlineModeOff); + // Closing connection: + CleanupStack::PopAndDestroy(repository); + repository=NULL; + + repository = CRepository::NewL(KCRUidBluetoothEngine); + // Check activation enabled + CleanupStack::PushL(repository); + repository->Get(KBTEnabledInOffline, activationEnabled); + // Closing connection: + CleanupStack::PopAndDestroy(repository); + + + TRACE_INFO((_L("power OFF -> ON, offlineModeOff = %d"), offlineModeOff)) + TRACE_INFO((_L("power OFF -> ON, activationEnabled = %d"), activationEnabled)) + + // Choose user interaction + // + if ( !offlineModeOff && !activationEnabled ) + { + // Load a string, create and show a note + // + HBufC* stringHolder = StringLoader::LoadLC( R_BT_OFFLINE_DISABLED ); + CAknInformationNote* note = new (ELeave) CAknInformationNote(); + + if(aCoverDisplayEnabled) + { + CleanupStack::PushL(note); + note->PublishDialogL(ECmdBtuiShowBtOfflineDisableNote, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(note); + } + + note->ExecuteLD( *stringHolder ); + CleanupStack::PopAndDestroy(stringHolder); //stringHolder + } + else + { + // Choose query + // + TInt resource = 0; + + TInt coverUiDlgId = 0; + + if ( offlineModeOff ) + { + resource = R_BT_IS_OFF_QUERY; + if(aCoverDisplayEnabled) + { + coverUiDlgId = ECmdBtuiShowBtIsOffDlg; + } + } + else + { + resource = R_BT_ACTIVATE_IN_OFFLINE_QUERY; + if(aCoverDisplayEnabled) + { + coverUiDlgId = ECmdBtuiShowBtActivateInOfflineDlg; + } + } + + // Create and show query + // + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + + if(aCoverDisplayEnabled) + { + CleanupStack::PushL(dlg); + dlg->PublishDialogL(coverUiDlgId, KUidCoverUiCategoryBtui); // initializes cover support + CleanupStack::Pop(dlg); + } + + TInt keypress = dlg->ExecuteLD( resource ); + + if( keypress ) + { + // Switch BT ON + // + errorCode=aBtEngSettings->SetPowerState(EBTPowerOn ) ; + if (errorCode) + { + ShowGeneralErrorNoteL(); + } + } else + { + errorCode=KErrCancel; + } + + + } + + } + + return errorCode; + } + + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/BtuiPluginImplementationTable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/BtuiPluginImplementationTable.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: ECOM proxy table for this plugin +* +*/ + +#include +#include + +#include "BTUIMainView.h" +#include "BTUIPairedDevicesView.h" +#include "BTUIBlockedDevicesView.h" + + +const TImplementationProxy KBtuiPluginImplementationTable[] = + { + // UPDATE THIS - Uid for plugin implementation: + //This impl is for GS FW, in this case mainView will construct BTUI Model. + IMPLEMENTATION_PROXY_ENTRY( 0x1020742C, CBTUIMainView::NewGsPluginL ), + + //Following two are for BTUI App, in this case mainView won't construct BTUI Model, + //BTUI's AppUi will do it and pass the pointer of Model to both views. + IMPLEMENTATION_PROXY_ENTRY( 0x1020745C, CBTUIMainView::NewL ), + IMPLEMENTATION_PROXY_ENTRY( 0x1020745D, CBTUIPairedDevicesView::NewL ), + IMPLEMENTATION_PROXY_ENTRY( 0x20002780, CBTUIBlockedDevicesView::NewL ) + }; + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// Gate/factory function +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KBtuiPluginImplementationTable) + / sizeof(TImplementationProxy); + return KBtuiPluginImplementationTable; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/Ecom/src/btuipluginman.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/Ecom/src/btuipluginman.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,156 @@ +/* +* 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: Find and load plugin +* +*/ + + +#include +#include "btuipluginman.h" +#include "debug.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CBTUIPluginMan* CBTUIPluginMan::NewL( CAknViewAppUi* aAppUi ) + { + CBTUIPluginMan* self = new( ELeave ) CBTUIPluginMan( aAppUi ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBTUIPluginMan::~CBTUIPluginMan() + { + TRACE_FUNC_ENTRY + + iPluginInfoArray.ResetAndDestroy(); + iPluginInfoArray.Close(); + iPluginArray.Reset();//Do not destroy - Plugins are owned by iAppUi + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------------- +// Check if availability of some plug-in +// --------------------------------------------------------------------------- +// +TBool CBTUIPluginMan::IsPluginAvaiable(TBTDeviceClass aDeviceClassInfo) + { + for( TInt i=0; iGetCOD(); + if( devClass.MajorDeviceClass() == aDeviceClassInfo.MajorDeviceClass() && + devClass.MinorDeviceClass() == aDeviceClassInfo.MinorDeviceClass() ) + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// Get the setting view from PluginArrary based on the COD +// --------------------------------------------------------------------------- +// +CAknView* CBTUIPluginMan::GetSettingViewL(TBTDevice& aDevice) + { + for (TInt ii = 0; ii < iPluginArray.Count(); ii++ ) + { + TBTDeviceClass tmpCOD = iPluginArray[ii]->GetCOD(); + //Currently one device - one view - one plugin, + //in future maybe other device properties will decide on getting the view. + if(aDevice.iDeviceClass.MajorDeviceClass() == tmpCOD.MajorDeviceClass() && + aDevice.iDeviceClass.MinorDeviceClass() == tmpCOD.MinorDeviceClass()) + { + return (CAknView*)iPluginArray[ii]; + } + } + + return NULL; + } + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CBTUIPluginMan::CBTUIPluginMan( CAknViewAppUi* aAppUi ) + : iAppUi(aAppUi) + { + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd-phase constructor +// --------------------------------------------------------------------------- +// +void CBTUIPluginMan::ConstructL() + { + LoadPluginsL(); + } + +// --------------------------------------------------------------------------- +// Load ECom plug-ins +// --------------------------------------------------------------------------- +// +void CBTUIPluginMan::LoadPluginsL() + { + TRACE_FUNC_ENTRY + + REComSession::ListImplementationsL( KCBtuiPluginInterfaceUid, iPluginInfoArray ); + TInt count = iPluginInfoArray.Count(); + TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() PluginArray count=%d" ), count) ) + + iPluginArray.Reset(); + for ( TUint ii = 0 ; ii < count; ++ii ) + { + CImplementationInformation* impl = iPluginInfoArray[ii]; + //Only append the plugins which datatype() is for HID devices. + if(impl->DataType().Length()) + { + TLex8 lex( impl->DataType() ); + TUint major = 0, minor = 0; + TInt err1 = lex.Val(major, EHex); + lex.SkipSpace(); + TInt err2 = lex.Val(minor, EHex); + if( !err1 && !err2) + { + TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() MajorCOD=%d MinorCOD=%d" ), major, minor) ) + TBTDeviceClass cod(0x00, major, minor); + + CBtuiPluginInterface* plugin = NULL; + TRAPD( ret, plugin = CBtuiPluginInterface::NewL( impl->ImplementationUid() ) ); + if( !ret ) + { + CleanupStack::PushL(plugin); + + // Transfer the ownership to AppUi + iAppUi->AddViewL( (CAknView*)plugin ); + plugin->SetCOD(cod); + iPluginArray.AppendL(plugin); + CleanupStack::Pop(plugin); + } + } + } + } + + TRACE_FUNC_EXIT + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/aif/BTUI_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/aif/BTUI_caption.rss Wed Sep 01 12:20:04 2010 +0100 @@ -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: Caption RSS file for creating the aif file for BTUI. +* +*/ + + +#include "btui.loc" +#include + +RESOURCE CAPTION_DATA + { + caption = qtn_apps_bluetooth_list; + shortcaption = qtn_apps_bluetooth_grid; + } + + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/aif/BTUIaif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/aif/BTUIaif.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,28 @@ +/* +* 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: +* RSS for creating the aif file for BTUI. +* +*/ + + +#include + +RESOURCE AIF_DATA +{ + app_uid=0x10005951; // Application UID + num_icons=2; // Grid and list icons with masks +} + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpplugin.cpp --- a/bluetoothengine/btui/btcpplugin/btcpplugin.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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 "btcpplugin.h" -#include -#include "btcpuisettingitem.h" - -/*! - BtCpPlugin::BtCpPlugin - */ -BtCpPlugin::BtCpPlugin() -{ -} - -/*! - BtCpPlugin::~BtCpPlugin - */ -BtCpPlugin::~BtCpPlugin() -{ -} - -/*! - BtCpPlugin::createSettingFormItemData - */ -QList BtCpPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const -{ - - return QList () << new BtCpUiSettingItem( - itemDataHelper); - -} - -Q_EXPORT_PLUGIN2(BtCpPlugin, BtCpPlugin); diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpplugin.h --- a/bluetoothengine/btui/btcpplugin/btcpplugin.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 BTCPPLUGIN_H -#define BTCPPLUGIN_H - -#include -#include - -class BtCpPlugin : public QObject, public CpPluginInterface -{ - Q_OBJECT - Q_INTERFACES(CpPluginInterface) - -public: - - BtCpPlugin(); - ~BtCpPlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; -}; - -#endif /* BTCPPLUGIN_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpplugin.pro --- a/bluetoothengine/btui/btcpplugin/btcpplugin.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = lib -TARGET = btcpplugin -DEPENDPATH += . -INCLUDEPATH += . ../inc/ - -CONFIG += qt hb plugin -LIBS += -lcpframework -lbtuimodel -lbtuidelegate - -MOC_DIR = moc -OBJECTS_DIR = obj - -TRANSLATIONS += btviews.ts \ - btdialogs.ts \ - btindimenu.ts -RESOURCES += btcpplugin.qrc - -# Input -HEADERS += btcpuidevicedetailsview.h\ - btcpuimainlistviewitem.h \ - btcpuisearchlistviewitem.h \ - btcpplugin.h \ - btcpuibaseview.h \ - btcpuimainview.h \ - btcpuisearchview.h \ - btcpuideviceview.h \ - btcpuisettingitem.h \ - btuiviewutil.h \ - btcpuidevicedetail.h -SOURCES += btcpuidevicedetailsview.cpp \ - btcpuimainlistviewitem.cpp \ - btcpuisearchlistviewitem.cpp \ - btcpplugin.cpp \ - btcpuibaseview.cpp \ - btcpuimainview.cpp \ - btcpuisearchview.cpp \ - btcpuideviceview.cpp \ - btcpuisettingitem.cpp \ - btcpuidevicedetail.cpp -symbian: { - DEFINES += PLUGINUID3=0x2002434E - TARGET.UID3 = 0x2002434E - TARGET.CAPABILITY = ALL -TCB - - TARGET.EPOCALLOWDLLDATA = 1 - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - - LIBS += -lbtdevice \ - -lbtdevsettingframework - - PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel - - deploy.path = C: - pluginstub.sources = $${TARGET}.dll - pluginstub.path = $$PLUGIN_STUB_PATH - DEPLOYMENT += pluginstub - - qtplugins.path = $$PLUGIN_STUB_PATH - qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin - - for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpplugin.qrc --- a/bluetoothengine/btui/btcpplugin/btcpplugin.qrc Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - - - icons/qgn_graf_blid_det_circle.svg - icons/qgn_graf_blid_time.svg - icons/qgn_indi_bt_blocked.svg - icons/qgn_indi_bt_paired_add.svg - icons/qgn_indi_bt_trusted_add.svg - icons/qgn_prop_bt_audio.svg - icons/qgn_prop_bt_blocked_tab3.svg - icons/qgn_prop_bt_car_kit.svg - icons/qgn_prop_bt_carkit.svg - icons/qgn_prop_bt_computer.svg - icons/qgn_prop_bt_headset.svg - icons/qgn_prop_bt_keyboard.svg - icons/qgn_prop_bt_misc.svg - icons/qgn_prop_bt_mouse.svg - icons/qgn_prop_bt_phone.svg - icons/qgn_prop_bt_printer.svg - icons/qgn_prop_bt_unknown.svg - icons/qgn_frwidget_add_friend_photo.svg - docml/bt-main-view.docml - docml/bt-search-view.docml - docml/bt-device-view.docml - docml/bt-device-details-view.docml - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 "btcpuibaseview.h" -#include - -/*! - This constructor constructs new setting and device models. - */ -BtCpUiBaseView::BtCpUiBaseView(QGraphicsItem *parent ) - :CpBaseSettingView( 0 , parent ) -{ - mSettingModel = new BtSettingModel(this); - mDeviceModel = new BtDeviceModel(this); -} - -/*! - This constructor constructs models from the given setting and device models. - This implies the model impl and data structure is shared. - */ -BtCpUiBaseView::BtCpUiBaseView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent ) - :CpBaseSettingView( 0 , parent ) -{ - mSettingModel = new BtSettingModel(settingModel, this); - mDeviceModel = new BtDeviceModel(deviceModel, this); -} - -/*! - Destructor. - */ -BtCpUiBaseView::~BtCpUiBaseView() -{ - -} - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuibaseview.h --- a/bluetoothengine/btui/btcpplugin/btcpuibaseview.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 BTCPUIBASEVIEW_H -#define BTCPUIBASEVIEW_H - -#include -#include -#include -#include -#include - -/*! - \class BtUiBaseView - \brief the class is the base class for all views in btapplication. - - */ -class BtCpUiBaseView : public CpBaseSettingView -{ - Q_OBJECT - -public: - - virtual ~BtCpUiBaseView(); - virtual void activateView( const QVariant& value, bool fromBackButton ) = 0; - virtual void deactivateView() = 0; - virtual void switchToPreviousView() = 0; - -signals: - -protected: - explicit BtCpUiBaseView(QGraphicsItem *parent = 0); - - explicit BtCpUiBaseView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent = 0); - - virtual void setSoftkeyBack() = 0; - - BtSettingModel &getSettingModel(); - BtDeviceModel &getDeviceModel(); - -protected: - - // owned - BtSettingModel *mSettingModel; - - // owned - BtDeviceModel *mDeviceModel; - - QGraphicsItem *mParent; - int mPreviousViewId; - - Q_DISABLE_COPY(BtCpUiBaseView) -}; - -#endif // BTCPUIBASEVIEW_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +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 "btcpuidevicedetail.h" -#include "btcpuideviceview.h" -#include "btcpuidevicedetailsview.h" - -#include -#include -#include - - -BtCpUiDeviceDetail::BtCpUiDeviceDetail(QObject *parent) : - QObject(parent), mDeviceDetailView(0) -{ - mMainWindow = hbInstance->allMainWindows().first(); -} - -BtCpUiDeviceDetail::~BtCpUiDeviceDetail() -{ - clearDeviceDetailList(); - delete mDeviceDetailView; -} - -void BtCpUiDeviceDetail::loadDeviceDetailPlugins(QString deviceAddress, QString deviceName) -{ - QList interfaces; - BtAbstractDevSetting *devSetting; - - clearDeviceDetailList(); - interfaces = BtDevSettingPluginLoader::loadDevSettingInterfaces(); - QList::const_iterator i; - - for (i = interfaces.constBegin(); i != interfaces.constEnd(); ++i) { - devSetting = 0; - devSetting = (*i)->createDevSetting( deviceAddress ); - if(devSetting) { - appendDeviceToList(devSetting); - } - } - - for (int i = interfaces.count() - 1; i >= 0; --i ) { - delete interfaces.at(i); - } - - createDeviceDetailsView(deviceName); - notifyDeviceDetailStatus(); - -} - -void BtCpUiDeviceDetail::appendDeviceToList(BtAbstractDevSetting *devSetting) -{ - bool ret = false; - BtDeviceDetails devicedetails; - devicedetails.mSetting = 0; - devicedetails.mSettingForm = 0; - devicedetails.mSettingAvailable = false; - - devicedetails.mSetting = devSetting; - devicedetails.mSettingAvailable = devSetting->isSettingAvailable(); - devicedetails.mSettingForm = devSetting->getSettingWidget(); - - mDeviceDetailList.append(devicedetails); - - ret = connect(devicedetails.mSetting, SIGNAL(settingAvailabilityChanged(BtAbstractDevSetting *, bool)), - this, SLOT(handleSettingChange(BtAbstractDevSetting *, bool))); - BTUI_ASSERT_X( ret, "BtCpUiDeviceDetail::appendDeviceToList", "connect settingAvailabilityChanged() failed"); - -} - -void BtCpUiDeviceDetail::handleSettingChange(BtAbstractDevSetting *setting, bool available) -{ - QList::iterator i; - - for (i = mDeviceDetailList.begin(); i != mDeviceDetailList.end(); ++i) { - if((setting == (*i).mSetting) && mDeviceDetailView) { - (*i).mSettingAvailable = available; - if(available) { - if(((*i).mSettingForm)) { - //If item already exists, remove it first. - mDeviceDetailView->removeItem((*i).mSettingForm); - } - (*i).mSettingForm = setting->getSettingWidget(); - //add widget - mDeviceDetailView->addItem((*i).mSettingForm); - } - else { - if((*i).mSettingForm) { - //remove widget - mDeviceDetailView->removeItem((*i).mSettingForm); - (*i).mSettingForm = 0; - checkDeviceDetailSettings(); - } - } - notifyDeviceDetailStatus(); - } - } -} - - -void BtCpUiDeviceDetail::checkDeviceDetailSettings() -{ - QList::const_iterator i; - bool devicedetail = false; - - for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) { - if((*i).mSettingForm) { - devicedetail = true; - break; - } - } - //If no setting is available and current view is device detail - //view move to previous view. - if((!devicedetail) && (mMainWindow->currentView() == mDeviceDetailView)) { - mMainWindow->removeView(mDeviceDetailView); - mMainWindow->setCurrentView( mPreviousView ); - } -} - -void BtCpUiDeviceDetail::notifyDeviceDetailStatus() -{ - QList::const_iterator i; - bool devicedetail = false; - - for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) { - if(((*i).mSettingAvailable == true) && ((*i).mSettingForm) ) { - devicedetail = true; - break; - } - } - emit deviceSettingsChanged(devicedetail); -} - -void BtCpUiDeviceDetail::clearDeviceDetailList() -{ - QList::const_iterator i; - - for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) { - if((*i).mSetting ) { - disconnect((*i).mSetting); - delete (*i).mSetting; - } - } - mDeviceDetailList.clear(); -} - -void BtCpUiDeviceDetail::createDeviceDetailsView(QString deviceName) -{ - bool ret = false; - //Launch Device Detail View. - mDeviceDetailView = new BtCpUiDeviceDetailsView(); - mDeviceDetailView->setDeviceName(deviceName); - - ret = connect(mDeviceDetailView, SIGNAL(aboutToClose()), this, - SLOT(handleDeviceDetailViewClose())); - BTUI_ASSERT_X( ret, "BtCpUiDeviceDetail::loadDeviceDetailsView", "connect deviceDetailViewClosed() failed"); - - QList::const_iterator i; - - for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) { - if((*i).mSettingForm) { - mDeviceDetailView->addItem((*i).mSettingForm); - } - } -} - -void BtCpUiDeviceDetail::loadDeviceDetailsView() -{ - - mPreviousView = mMainWindow->currentView(); - mMainWindow->addView(mDeviceDetailView); - - notifyViewStatusToPlugins(AboutToShow); - - mMainWindow->setCurrentView( mDeviceDetailView ); -} - -void BtCpUiDeviceDetail::handleDeviceDetailViewClose() -{ - notifyViewStatusToPlugins(AboutToHide); - - mMainWindow->removeView(mDeviceDetailView); - - mMainWindow->setCurrentView( mPreviousView ); - -} - -void BtCpUiDeviceDetail::notifyViewStatusToPlugins(BtCpUiDeviceDetail::NotifyType type) -{ - QList::const_iterator i; - BtAbstractDevSetting *deviceSetting = 0; - for (i = mDeviceDetailList.constBegin(); i != mDeviceDetailList.constEnd(); ++i) { - deviceSetting = (*i).mSetting; - if(deviceSetting) { - switch(type) { - case AboutToShow: - deviceSetting->aboutToForeground(); - break; - case AboutToHide: - deviceSetting->aboutToBackground(); - break; - case AboutToClose: - deviceSetting->aboutToClose(); - break; - } - } - } - -} - -void BtCpUiDeviceDetail::sendCloseEvent() -{ - notifyViewStatusToPlugins(AboutToClose); -} - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h --- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetail.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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 BTCPUIDEVICEDETAIL_H -#define BTCPUIDEVICEDETAIL_H - -#include -#include -#include - -class BtCpUiDeviceView; -class BtCpUiDeviceDetailsView; - -class BtDeviceDetails -{ -public: - BtAbstractDevSetting *mSetting; - bool mSettingAvailable; - HbDataForm *mSettingForm; -}; - - -class BtCpUiDeviceDetail : public QObject -{ - Q_OBJECT - -public: - explicit BtCpUiDeviceDetail( QObject *parent = 0 ); - - virtual ~BtCpUiDeviceDetail(); - - void loadDeviceDetailPlugins(QString deviceAddress, QString deviceName); - - void loadDeviceDetailsView(); - - void sendCloseEvent(); - -signals: - void deviceSettingsChanged(bool settingAvailable); - -public slots: - void handleSettingChange(BtAbstractDevSetting *setting, bool available); - void handleDeviceDetailViewClose(); - -private: - enum NotifyType { - AboutToShow, - AboutToHide, - AboutToClose, - }; - - void appendDeviceToList(BtAbstractDevSetting *devSetting); - void clearDeviceDetailList(); - void notifyDeviceDetailStatus(); - void createDeviceDetailsView(QString deviceName); - void notifyViewStatusToPlugins(BtCpUiDeviceDetail::NotifyType type); - void checkDeviceDetailSettings(); - -private: - - HbMainWindow* mMainWindow; - QList mDeviceDetailList; - BtCpUiDeviceDetailsView* mDeviceDetailView; - HbView *mPreviousView; - -}; - - -#endif /* BTCPUIDEVICEDETAIL_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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: BtCpUiDeviceDetailsView implementation -* -*/ -#include "btcpuidevicedetailsview.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// docml to load -const char* BTUI_DEVICEDETAILSVIEW_DOCML = ":/docml/bt-device-details-view.docml"; - -BtCpUiDeviceDetailsView::BtCpUiDeviceDetailsView(QGraphicsItem *parent) - :CpBaseSettingView( 0 , parent ) -{ - - mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); - BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action"); - - // Create view for the application. - // Set the name for the view. The name should be same as the view's - // name in docml. - setObjectName("bt_device_details_view"); - - mLoader = new HbDocumentLoader(); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - QObjectList objectList; - objectList.append(this); - mLoader->setObjectTree(objectList); - - // read view info from docml file - bool ok = false; - mLoader->load( BTUI_DEVICEDETAILSVIEW_DOCML, &ok ); - // Exit if the file format is invalid - BTUI_ASSERT_X( ok, "bt-device-details-view", "Invalid docml file" ); - - mLayout = new QGraphicsLinearLayout(Qt::Vertical, this); - mGroupBox = new HbGroupBox(); - mLayout->addItem(mGroupBox); - - setLayout( mLayout ); - -} - -BtCpUiDeviceDetailsView::~BtCpUiDeviceDetailsView() -{ - -} - -void BtCpUiDeviceDetailsView::setDeviceName(const QString &deviceName) -{ - //todo: use Localised string Id. - QString heading(hbTrId("%1 details")); - - if(mGroupBox) { - mGroupBox->setHeading(heading.arg(deviceName)); - } -} - -void BtCpUiDeviceDetailsView::addItem(HbDataForm *item) -{ - if (item && mLayout) { - mLayout->addItem(item); - } -} - -void BtCpUiDeviceDetailsView::removeItem(HbDataForm *item) -{ - if (item && mLayout) { - //todo: with out this item is not removed from the view. - item->setVisible(false); - mLayout->removeItem(item); - } -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h --- a/bluetoothengine/btui/btcpplugin/btcpuidevicedetailsview.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +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: BtCpUiDeviceDetailsView declaration -*/ - -#ifndef BTCPUIDEVICEDETAILSVIEW_H -#define BTCPUIDEVICEDETAILSVIEW_H - -#include -#include -#include -#include -#include -#include -#include - -class BtCpUiDeviceDetailsView : public CpBaseSettingView -{ - Q_OBJECT - -public: - - explicit BtCpUiDeviceDetailsView(QGraphicsItem *parent = 0); - - virtual ~BtCpUiDeviceDetailsView(); - - void setDeviceName(const QString &deviceName); - void addItem(HbDataForm *item); - void removeItem(HbDataForm *item); - - -protected: - HbDocumentLoader *mLoader; - HbAction *mSoftKeyBackAction; - - QGraphicsLinearLayout *mLayout; - HbGroupBox *mGroupBox; - - Q_DISABLE_COPY(BtCpUiDeviceDetailsView) -}; - -#endif /* BTCPUIDEVICEDETAILSVIEW_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,672 +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 "btcpuideviceview.h" -#include "btuiviewutil.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "btcpuimainview.h" -#include -#include -#include -#include "btuiiconutil.h" -#include "btuidevtypemap.h" - -#include "btcpuidevicedetail.h" - -// docml to load -const char* BTUI_DEVICEVIEW_DOCML = ":/docml/bt-device-view.docml"; - - -BtCpUiDeviceView::BtCpUiDeviceView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent) : - BtCpUiBaseView(settingModel,deviceModel,parent), - mPairedStatus(false), mConnectedStatus(false),mPreviousConnectedStatus(false), mTrustedStatus(false), - mBlockedStatus(false), mConnectable(false), mAbstractDelegate(0), mDeviceDetail(0) -{ - mDeviceIndex = QModelIndex();//is it needed to initialize mIndex??? - - mMainView = (BtCpUiMainView *) parent; - - mMainWindow = hbInstance->allMainWindows().first(); - - mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); - BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action"); - - // read view info from docml file - - // Create view for the application. - // Set the name for the view. The name should be same as the view's - // name in docml. - setObjectName("bt_device_view"); - - mLoader = new HbDocumentLoader(); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - QObjectList objectList; - objectList.append(this); - mLoader->setObjectTree(objectList); - - bool ret = false; - - bool ok = false; - mLoader->load( BTUI_DEVICEVIEW_DOCML, &ok ); - // Exit if the file format is invalid - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file" ); - - mOrientation = mMainWindow->orientation(); - - if (mOrientation == Qt::Horizontal) { - mLoader->load(BTUI_DEVICEVIEW_DOCML, "landscape", &ok); - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); - } - else { - mLoader->load(BTUI_DEVICEVIEW_DOCML, "portrait", &ok); - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); - } - - // listen for orientation changes - ret = connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), - this, SLOT(changeOrientation(Qt::Orientation))); - BTUI_ASSERT_X( ret, "BtCpUiDeviceView::BtCpUiDeviceView()", "connect orientationChanged() failed"); - - - // assign automatically created widgets to local variables - /* - mGroupBox = 0; - mGroupBox = qobject_cast( mLoader->findWidget( "groupBox_deviceView" ) ); - BTUI_ASSERT_X( mGroupBox != 0, "bt-device-view", "Device groupbox not found" ); - */ - mDeviceIcon=0; - //can't use qobject_cast since HbIcon is not derived from QObject! - mDeviceIcon = qobject_cast( mLoader->findWidget( "deviceIcon" ) ); - BTUI_ASSERT_X( mDeviceIcon != 0, "bt-device-view", "Device Icon not found" ); - - mDeviceName=0; - mDeviceName = qobject_cast( mLoader->findWidget( "deviceName" ) ); - BTUI_ASSERT_X( mDeviceName != 0, "bt-device-view", "Device Name not found" ); - ret = connect(mDeviceName, SIGNAL(editingFinished ()), this, SLOT(changeBtDeviceName())); - - mDeviceCategory=0; - mDeviceCategory = qobject_cast( mLoader->findWidget( "deviceCategory" ) ); - BTUI_ASSERT_X( mDeviceCategory != 0, "bt-device-view", "Device Category not found" ); - - mDeviceStatus=0; - mDeviceStatus = qobject_cast( mLoader->findWidget( "deviceStatus" ) ); - BTUI_ASSERT_X( mDeviceStatus != 0, "bt-device-view", "Device status not found" ); - - - mConnectionCombobox = 0; - mConnectionCombobox = qobject_cast( mLoader->findWidget( "connectionCombobox" ) ); - BTUI_ASSERT_X( mConnectionCombobox != 0, "bt-device-view", "connection combobox not found" ); - - mConnectionComboboxModel = new HbDataFormModel(); - - mPair_Unpair=0; - mPair_Unpair = qobject_cast( mLoader->findWidget( "pushButton_0" ) ); - BTUI_ASSERT_X( mPair_Unpair != 0, "bt-device-view", "pair/unpair button not found" ); - ret = connect(mPair_Unpair, SIGNAL(clicked()), this, SLOT(pairUnpair())); - BTUI_ASSERT_X( ret, "BtCpUiDeviceView::BtCpUiDeviceView", "can't connect pair button" ); - - mConnect_Disconnect=0; - mConnect_Disconnect = qobject_cast( mLoader->findWidget( "pushButton_1" ) ); - BTUI_ASSERT_X( mConnect_Disconnect != 0, "bt-device-view", "connect/disconnect button not found" ); - ret = connect(mConnect_Disconnect, SIGNAL(clicked()), this, SLOT(connectDisconnect())); - BTUI_ASSERT_X( ret, "BtCpUiDeviceView::BtCpUiDeviceView", "can't connect disconnect button" ); - - mDeviceSetting = 0; - mDeviceSetting = qobject_cast( mLoader->findWidget( "pushButton_2" ) ); - BTUI_ASSERT_X( mDeviceSetting != 0, "bt-device-view", "settings button not found" ); - - - ret = connect(mDeviceSetting, SIGNAL(clicked()), this, - SLOT(handleDeviceSetting())); - BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::BtCpUiDeviceView", "clicked() connect failed"); - - setConnectionCombobox(); - -} - -BtCpUiDeviceView::~BtCpUiDeviceView() -{ - delete mLoader; // Also deletes all widgets that it constructed. - - delete mConnectionComboboxModel; - - setNavigationAction(0); - delete mSoftKeyBackAction; - if(mAbstractDelegate) - { - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - -} - - -void BtCpUiDeviceView::setSoftkeyBack() -{ - if (navigationAction() != mSoftKeyBackAction) { - setNavigationAction(mSoftKeyBackAction); - connect( mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(switchToPreviousView()) ); - } -} - -void BtCpUiDeviceView::switchToPreviousView() -{ - BTUI_ASSERT_X(mMainView, "BtCpUiSearchView::switchToPreviousView", "invalid mMainView"); - mMainView->switchToPreviousView(); - - if(mDeviceDetail) { - mDeviceDetail->sendCloseEvent(); - } - unloadDeviceDetails(); -} - -void BtCpUiDeviceView::loadDeviceDetails() -{ - bool ret(false); - - unloadDeviceDetails(); - - mDeviceDetail = new BtCpUiDeviceDetail(); - - ret=connect(mDeviceDetail, SIGNAL(deviceSettingsChanged(bool)), - this, SLOT(handleDeviceSettingsChange(bool))); - BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::loadDeviceDetails", "deviceSettingsChanged() connect failed"); - - mDeviceDetail->loadDeviceDetailPlugins(mDeviceBdAddr.toString(), mDeviceName->text()); -} - -void BtCpUiDeviceView::unloadDeviceDetails() -{ - if(mDeviceDetail) { - disconnect(mDeviceDetail); - delete mDeviceDetail; - mDeviceDetail = 0; - } -} - -void BtCpUiDeviceView::activateView( const QVariant& value, bool fromBackButton ) -{ - - Q_UNUSED( fromBackButton ); - - mConnectedStatus = false; - setSoftkeyBack(); - - - QModelIndex index = value.value(); - mDeviceBdAddr = (mDeviceModel->data(index, BtDeviceModel::ReadableBdaddrRole)); - - //activate view is called when device is selected - //clearViewData(); - updateDeviceData(); - - mDeviceSetting->setVisible(false); - - bool ret(false); - ret=connect(mDeviceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(updateDeviceData())); - BTUI_ASSERT_X( ret, "Btui, BtCpUiDeviceView::activateView", "dataChanged() connect failed"); - -} - -void BtCpUiDeviceView::handleDeviceSettingsChange(bool status) -{ - mDeviceSetting->setVisible(status); -} - -void BtCpUiDeviceView::handleDeviceSetting() -{ - if(mDeviceDetail) { - mDeviceDetail->loadDeviceDetailsView(); - } -} - -void BtCpUiDeviceView::deactivateView() -{ -} - -// called due to real orientation change event coming from main window -void BtCpUiDeviceView::changeOrientation( Qt::Orientation orientation ) -{ - bool ok = false; - mOrientation = orientation; - if( orientation == Qt::Vertical ) { - // load "portrait" section - mLoader->load( BTUI_DEVICEVIEW_DOCML, "portrait", &ok ); - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: portrait section problem" ); - } else { - // load "landscape" section - mLoader->load( BTUI_DEVICEVIEW_DOCML, "landscape", &ok ); - BTUI_ASSERT_X( ok, "bt-device-view", "Invalid docml file: landscape section problem" ); - } -} - -void BtCpUiDeviceView::clearViewData() -{ - mDeviceIcon->clear(); - mDeviceCategory->clear(); - mDeviceStatus->clear(); - mConnectable = false; - /* - mPairedStatus = false; - mConnectedStatus = false; - mTrustedStatus = false; - mBlockedStatus = false; - - mConnectable = false; - */ -} - -void BtCpUiDeviceView::updateDeviceData() -{ - clearViewData(); - //Get the QModelIndex of the device using the device BDAddres - QModelIndex start = mDeviceModel->index(0,0); - QModelIndexList indexList = mDeviceModel->match(start,BtDeviceModel::ReadableBdaddrRole, mDeviceBdAddr); - mDeviceIndex = indexList.at(0); - - //populate device view with device data fetched from UiModel - QString deviceName = (mDeviceModel->data(mDeviceIndex, - BtDeviceModel::NameAliasRole)).toString(); - mDeviceName->setText(deviceName); - - int cod = (mDeviceModel->data(mDeviceIndex,BtDeviceModel::CoDRole)).toInt(); - - int majorRole = (mDeviceModel->data(mDeviceIndex,BtDeviceModel::MajorPropertyRole)).toInt(); - - setDeviceCategory(cod, majorRole); - setDeviceStatus(majorRole); - setTextAndVisibilityOfButtons(); -} - -void BtCpUiDeviceView::setDeviceCategory(int cod,int majorRole) -{ - mDeviceCategory->setPlainText( getDeviceTypeString( cod )); - HbIcon icon = - getBadgedDeviceTypeIcon(cod, majorRole, - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); - mDeviceIcon->setIcon(icon); - - if (majorRole & BtuiDevProperty::Connectable ) { - mConnectable = true; - } -} - -void BtCpUiDeviceView::setDeviceStatus(int majorRole) -{ - QString deviceStatus; - - updateStatusVariables(majorRole); // should we use bitmap instead?? - - if (majorRole & BtuiDevProperty::Bonded && - majorRole & BtuiDevProperty::Trusted && - majorRole & BtuiDevProperty::Connected ) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trused_connected")); - } - else if (majorRole & BtuiDevProperty::Bonded && - majorRole & BtuiDevProperty::Connected ) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_connected")); - } - else if (majorRole & BtuiDevProperty::Bonded && - majorRole & BtuiDevProperty::Trusted ) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trusted")); - } - else if (majorRole & BtuiDevProperty::Bonded) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired")); - } - else if (majorRole & BtuiDevProperty::Connected) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_connected")); - } - else if (majorRole & BtuiDevProperty::Blocked) { - mDeviceStatus->setPlainText(hbTrId("txt_bt_info_blocked")); - } - else { - // device not paired, connected, trusted or blocked. is this ok? - } - -} - -void BtCpUiDeviceView::setConnectionCombobox(){ - - //create a model class - - mConnectionComboboxModel->appendDataFormItem( - HbDataFormModelItem::ComboBoxItem, QString("Connection"), mConnectionComboboxModel->invisibleRootItem()); - - //set the model to the view, once model and data class are created - mConnectionCombobox->setModel(mConnectionComboboxModel); - - - -} - - -/*! - * instead of using separate boolean variables we could use bitmap in single variable - */ -void BtCpUiDeviceView::updateStatusVariables(int majorRole) -{ - mPreviousConnectedStatus = mConnectedStatus; - - if (majorRole & BtuiDevProperty::Trusted ) { - mTrustedStatus = true; - } - else { - mTrustedStatus = false; - } - if (majorRole & BtuiDevProperty::Bonded) { - mPairedStatus = true; - } - else { - mPairedStatus = false; - } - if (majorRole & BtuiDevProperty::Connected) { - mConnectedStatus = true; - if (!mPreviousConnectedStatus){ - //Loading device detail plugins after successfull connection. - loadDeviceDetails(); - } - } - else { - mConnectedStatus = false; - } - if (majorRole & BtuiDevProperty::Blocked) { - mBlockedStatus = true; - } - else { - mBlockedStatus = false; - } -} - -void BtCpUiDeviceView::setTextAndVisibilityOfButtons() -{ - mPair_Unpair->setStretched(true); - if (mPairedStatus) - { - HbIcon icon("qtg_mono_bt_unpair"); - icon.setIconName("qtg_mono_bt_unpair"); - mPair_Unpair->setIcon(icon); - mPair_Unpair->setText(hbTrId("txt_bt_button_unpair")); - - } - else - { - HbIcon icon("qtg_mono_bt_pair"); - icon.setIconName("qtg_mono_bt_pair"); - mPair_Unpair->setIcon(icon); - mPair_Unpair->setText(hbTrId("txt_bt_button_pair")); - } - - if (mConnectable) - { - mConnect_Disconnect->setVisible(true); - mConnect_Disconnect->setStretched(true); - if (mConnectedStatus) - { - HbIcon icon("qtg_mono_speaker_off"); - icon.setIconName("qtg_mono_speaker_off"); - mConnect_Disconnect->setIcon(icon); - mConnect_Disconnect->setText(hbTrId("txt_bt_button_disconnect")); - } - else - { - HbIcon icon("qtg_mono_speaker"); - icon.setIconName("qtg_mono_speaker"); - mConnect_Disconnect->setIcon(icon); - mConnect_Disconnect->setText(hbTrId("txt_bt_button_connect")); - } - - } - else - { - //it is not possible to connect, set the button invisible - mConnect_Disconnect->setVisible(false); - } - -} - - -void BtCpUiDeviceView::pairUnpair() -{ - if (mPairedStatus) - { - //if the device is paired, call unpairDevice() when the button is tabbed - unpairDevice(); - } - else - { - //if the device is unpaired, call pairDevice() when the button is tabbed - pairDevice(); - - } - - -} - -void BtCpUiDeviceView::connectDisconnect() -{ - if (mConnectedStatus) - { - //if the device is connected, call disconnectDevice() when the button is tabbed - disconnectDevice(); - } - else - { - //if the device is disconnected, call connectDevice() when the button is tabbed - connectDevice(); - - } -} - -void BtCpUiDeviceView::pairDevice() -{ - if (!mAbstractDelegate)//if there is no other delegate running - { - QVariant params; - params.setValue(mDeviceIndex); - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Pair, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(pairDelegateCompleted(int)) ); - mAbstractDelegate->exec(params); - } - -} - -void BtCpUiDeviceView::pairDelegateCompleted(int status) -{ - Q_UNUSED(status); - //TODO: handle the error here - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } -} - -void BtCpUiDeviceView::unpairDevice() -{ - if (!mAbstractDelegate)//if there is no other delegate running - { - QVariant params; - params.setValue(mDeviceIndex); - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Unpair, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(unpairDelegateCompleted(int)) ); - mAbstractDelegate->exec(params); - } - - -} - -void BtCpUiDeviceView::unpairDelegateCompleted(int status) -{ - Q_UNUSED(status); - //TODO: handle the error here - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } -} - -void BtCpUiDeviceView::connectDevice() -{ - - - if (!mAbstractDelegate)//if there is no other delegate running - { - QVariant params; - params.setValue(mDeviceIndex); - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Connect, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(connectDelegateCompleted(int)) ); - mAbstractDelegate->exec(params); - } - - -} - -void BtCpUiDeviceView::connectDelegateCompleted(int status) -{ - Q_UNUSED(status); - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } -} - -void BtCpUiDeviceView::disconnectDevice() -{ - if (!mAbstractDelegate)//if there is no other delegate running - { - - - DisconnectOption discoOpt = ServiceLevel; - - QListlist; - QVariant paramFirst; - paramFirst.setValue(mDeviceIndex); - - QVariant paramSecond; - paramSecond.setValue((int)discoOpt); - - list.append(paramFirst); - list.append(paramSecond); - - QVariant params; - params.setValue(list); - - - //params.setValue(mDeviceIndex); - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Disconnect, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); - mAbstractDelegate->exec(params); - } - -} - -void BtCpUiDeviceView::disconnectDelegateCompleted(int status) -{ - Q_UNUSED(status); - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } -} - -void BtCpUiDeviceView::setPrevBtDeviceName() -{ - QString deviceName = (mDeviceModel->data(mDeviceIndex, - BtDeviceModel::NameAliasRole)).toString(); - mDeviceName->setText(deviceName); -} - -void BtCpUiDeviceView::changeBtDeviceName(){ - if (!mAbstractDelegate)//if there is no other delegate running - { - QListlist; - - QVariant index; - index.setValue(mDeviceIndex); - - QVariant name; - name.setValue(mDeviceName->text()); - - list.append(index); - list.append(name); - - QVariant params; - params.setValue(list); - - mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::RemoteDevName, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int, QVariant)), this, SLOT(changeDevNameDelegateCompleted(int, QVariant)) ); - mAbstractDelegate->exec(params); - } - else { - setPrevBtDeviceName(); - } - -} - -void BtCpUiDeviceView::changeDevNameDelegateCompleted(int status, QVariant param) -{ - - - if(KErrNone == status) { - mDeviceName->setText(param.toString()); - } - else { - setPrevBtDeviceName(); - } - //TODO:Error handling has to be done. - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - - -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuideviceview.h --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +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 BTCPUIDEVICEVIEW_H -#define BTCPUIDEVICEVIEW_H - -#include -#include -#include -#include "btcpuibaseview.h" - -class HbGroupBox; -class HbLabel; -class HbLineEdit; -class HbPushButton; -class HbIcon; -class HbDocumentLoader; -class HbDataForm; - -class HbDataFormModel; -//class HbDataFormModelItem; -class CpSettingFormItemData; -class BtAbstractDelegate; -class BtCpUiDeviceDetail; - -class BtCpUiDeviceView : public BtCpUiBaseView -{ - Q_OBJECT - -public: - explicit BtCpUiDeviceView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent = 0); - virtual ~BtCpUiDeviceView(); - virtual void activateView( const QVariant& value, bool fromBackButton ); - virtual void deactivateView(); - virtual void setSoftkeyBack(); - -public slots: - - virtual void switchToPreviousView(); - void changeOrientation( Qt::Orientation orientation ); - void updateDeviceData(); - void changeBtDeviceName(); - void pairUnpair(); - void connectDisconnect(); - void pairDelegateCompleted(int status); - void unpairDelegateCompleted(int status); - void connectDelegateCompleted(int status); - void disconnectDelegateCompleted(int status); - void changeDevNameDelegateCompleted(int status, QVariant param); - void handleDeviceSetting(); - void handleDeviceSettingsChange(bool status); - -private: - void clearViewData(); - void pairDevice(); - void unpairDevice(); - void connectDevice(); - void disconnectDevice(); - void setDeviceCategory(int cod, int majorRole);//cod:class of device - void setDeviceStatus(int majorRole); - void setConnectionCombobox(); - void setTextAndVisibilityOfButtons(); - void updateStatusVariables(int majorRole); - void loadDeviceDetails(); - void unloadDeviceDetails(); - void setPrevBtDeviceName(); - -private: - HbDocumentLoader *mLoader; - //HbGroupBox *mGroupBox; - HbLabel *mDeviceIcon; - HbLineEdit *mDeviceName; - HbLabel *mDeviceCategory; - HbLabel *mDeviceStatus; - - HbDataForm *mConnectionCombobox; - HbDataFormModel *mConnectionComboboxModel; - - HbPushButton *mPair_Unpair; - HbPushButton *mConnect_Disconnect; - HbPushButton *mDeviceSetting; - - - // data structures for switching between views - bool mEventFilterInstalled; - int mAutoCmdId; - Qt::Orientation mOrientation; - - HbMainWindow* mMainWindow; - BtCpUiBaseView* mMainView; - //BtCpUiBaseView* mDeviceView; - HbAction *mSoftKeyBackAction; - - QModelIndex mDeviceIndex; - QVariant mDeviceBdAddr; - - //true -> device is paired; false -> device is unpaired - bool mPairedStatus; - - //true-> device is connected; false -> device is disconnected - bool mConnectedStatus; - bool mPreviousConnectedStatus; - bool mTrustedStatus; - bool mBlockedStatus; - - //true -> device is connectable - //e.g. not possible to connect to a phone, but possible to connect to a headset - bool mConnectable; - - BtAbstractDelegate* mAbstractDelegate; - - BtCpUiDeviceDetail* mDeviceDetail; - -}; - -#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2008-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: BTUISearchListViewItem implementation -* -*/ - - -#include "btcpuimainlistviewitem.h" -#include "btdevicemodel.h" -#include "btuiiconutil.h" -#include - -BtCpUiMainListViewItem::BtCpUiMainListViewItem(QGraphicsItem * parent) : - HbListViewItem(parent), mParent(parent) -{ - mDeviceNameLabel = 0; - mDevTypeIconLabel = 0; - mDevTypeTextLabel = 0; - mBtuiModelSortFilter = ((BtCpUiMainListViewItem *)parent)->mBtuiModelSortFilter; - - mRow = 0; -} - -BtCpUiMainListViewItem::~BtCpUiMainListViewItem() -{ -// delete mDeviceNameLabel; -// delete mDevTypeIconLabel; -// delete mDevTypeTextLabel; -} - -/* - * This method is called by the HbListView when it needs a new - * view item element. - * - */ -HbAbstractViewItem * BtCpUiMainListViewItem::createItem() -{ - return new BtCpUiMainListViewItem(*this); -} - -/*! - UpdateChildItem updates the item graphics. - Screen elements are created once if not already done. This may increase the overall memory - consumption of the application, however, this is deemed inconsequential. There might be a small - performance improvement with current style. - */ -void BtCpUiMainListViewItem::updateChildItems() -{ - QModelIndex index; - - // Get device name from model - if (mBtuiModelSortFilter) - index = mBtuiModelSortFilter->mapToSource(modelIndex()); - else - index = modelIndex(); - - // create new icon label if needed - if (!mDevTypeIconLabel) { - mDevTypeIconLabel = new HbLabel(); - mDevTypeIconLabel->setPreferredSize(53.5260, 53.5260); //8un x 8un - mDevTypeIconLabel->setMinimumWidth(53.5260); - } - // create new label if needed - if (!mDeviceNameLabel) { - mDeviceNameLabel = new HbLabel(); - mDeviceNameLabel->setPreferredSize(250, 26.763); - } - // create new label if needed - if (!mDevTypeTextLabel) { - mDevTypeTextLabel = new HbLabel(); - mDevTypeTextLabel->setPreferredSize(250, 26.763); - } - // create layout if needed - if ( !mRow ) { - // Still need to create the actual layout - mRow = new QGraphicsGridLayout(); - mRow->addItem(mDevTypeIconLabel,0,0,2,1); - mRow->addItem(mDeviceNameLabel,0,1,1,1); - mRow->addItem(mDevTypeTextLabel,1,1,1,1); - setLayout(mRow); - } - - QString data = index.data(Qt::DisplayRole).toString(); - int cod = (index.data(BtDeviceModel::CoDRole)).toInt(); - int majorProperty = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); - - // ToDo: remove clear() once Orbit bug is fixed - mDeviceNameLabel->clear(); - mDeviceNameLabel->setPlainText(data); - mDevTypeIconLabel->clear(); - mDevTypeTextLabel->clear(); - mDevTypeTextLabel->setPlainText( getDeviceTypeString( cod )); - HbIcon icon = - getBadgedDeviceTypeIcon( cod, majorProperty, - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); - mDevTypeIconLabel->setIcon(icon); -} - - -void BtCpUiMainListViewItem::setModelSortFilter(BtuiModelSortFilter *filter) -{ - mBtuiModelSortFilter = filter; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.h --- a/bluetoothengine/btui/btcpplugin/btcpuimainlistviewitem.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2008-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: device view item -* -*/ - - -#ifndef BTCPUIMAINLISTVIEWITEM_H -#define BTCPUIMAINLISTVIEWITEM_H - -#include -#include -#include -#include -#include "btuimodelsortfilter.h" - -class BtCpUiMainListViewItem : public HbListViewItem -{ - Q_OBJECT - -public: - BtCpUiMainListViewItem(QGraphicsItem * parent = 0); - ~BtCpUiMainListViewItem(); - - HbAbstractViewItem * createItem(); - void updateChildItems(); - - void setModelSortFilter(BtuiModelSortFilter *filter); - -private: - QGraphicsItem *mParent; - HbLabel *mDevTypeIconLabel; - HbLabel *mDeviceNameLabel; - HbLabel *mDevTypeTextLabel; - BtuiModelSortFilter* mBtuiModelSortFilter; - - QGraphicsGridLayout *mRow; -}; - -#endif /* BTCPUIMAINLISTVIEWITEM_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuimainview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,624 +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: BtCpUiMainView implementation -* -*/ - -#include "btcpuimainview.h" -#include "btuiviewutil.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "btcpuisearchview.h" -#include "btcpuideviceview.h" -#include -#include -#include -#include "btqtconstants.h" -#include "btcpuimainlistviewitem.h" -#include "btuidevtypemap.h" - -// docml to load -const char* BTUI_MAINVIEW_DOCML = ":/docml/bt-main-view.docml"; - -/*! - Constructs a new BtUiMainView using HBDocumentLoader. Docml (basically xml) file - has been generated using Application Designer. - - */ -BtCpUiMainView::BtCpUiMainView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent ) - : BtCpUiBaseView( settingModel, deviceModel, parent ), - mAbstractDelegate(0), mMainFilterModel(0) -{ - bool ret(false); - - mMainWindow = hbInstance->allMainWindows().first(); - mMainView = this; - - // Create view for the application. - // Set the name for the view. The name should be same as the view's - // name in docml. - setObjectName("view"); - - mLoader = new HbDocumentLoader(); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - QObjectList objectList; - objectList.append(this); - mLoader->setObjectTree(objectList); - - bool ok = false; - mLoader->load( BTUI_MAINVIEW_DOCML, &ok ); - // Exit if the file format is invalid - BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file" ); - - mOrientation = mMainWindow->orientation(); - - if (mOrientation == Qt::Horizontal) { - mLoader->load(BTUI_MAINVIEW_DOCML, "landscape", &ok); - BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" ); - } - else { - mLoader->load(BTUI_MAINVIEW_DOCML, "portrait", &ok); - BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" ); - } - - mDeviceNameEdit=0; - mDeviceNameEdit = qobject_cast( mLoader->findWidget( "lineEdit" ) ); - BTUI_ASSERT_X( mDeviceNameEdit != 0, "bt-main-view", "Device Name not found" ); - ret = connect(mDeviceNameEdit, SIGNAL(editingFinished ()), this, SLOT(changeBtLocalName())); - - mPowerButton=0; - mPowerButton = qobject_cast( mLoader->findWidget( "pushButton" ) ); - BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" ); - ret = connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState())); - BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView", "can't connect power button" ); - - mVisibilityMode=0; - mVisibilityMode = qobject_cast( mLoader->findWidget( "combobox" ) ); - BTUI_ASSERT_X( mVisibilityMode != 0, "bt-main-view", "visibility combobox not found" ); - // add new item for temporary visibility - // NOTE: translation (at least default english) gives string "(p)Visible for 5 min", - // if setting 1 min --> "(s)Visible for 1 min", ie p=plural, s=singular, but these should - // not be shown to the user! - // ToDo: change this to use translation once it starts working - QString tempVis(hbTrId("txt_bt_setlabel_visibility_val_visible_for_l1_min", 5)); - //QString tempVis(hbTrId("Visible for 5 min")); - mVisibilityMode->addItem(tempVis, Qt::DisplayRole); - - mDeviceList=0; - mDeviceList = qobject_cast( mLoader->findWidget( "listView" ) ); - BTUI_ASSERT_X( mDeviceList != 0, "bt-main-view", "Device List (grid view) not found" ); - - ret = connect(mDeviceList, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - BTUI_ASSERT_X( ret, "bt-search-view", "deviceSelected can't connect" ); - - // listen for orientation changes - ret = connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), - this, SLOT(changeOrientation(Qt::Orientation))); - BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView()", "connect orientationChanged() failed"); - - // load tool bar actions - HbAction *discoverAction = static_cast( mLoader->findObject( "discoverAction" ) ); - BTUI_ASSERT_X( discoverAction, "bt-main-view", "discover action missing" ); - ret = connect(discoverAction, SIGNAL(triggered()), this, SLOT(goToDiscoveryView())); - BTUI_ASSERT_X( ret, "bt-main-view", "discover action can't connect" ); - - // load tool bar actions - mAllAction = static_cast( mLoader->findObject( "allAction" ) ); - BTUI_ASSERT_X( mAllAction, "bt-main-view", "All action missing" ); - ret = connect(mAllAction, SIGNAL(triggered()), this, SLOT(allActionTriggered())); - BTUI_ASSERT_X( ret, "bt-main-view", "all action can't connect" ); - - // load tool bar actions - mPairAction = static_cast( mLoader->findObject( "pairedAction" ) ); - BTUI_ASSERT_X( mPairAction, "bt-main-view", "Pair action missing" ); - ret = connect(mPairAction, SIGNAL(triggered()), this, SLOT(pairActionTriggered())); - BTUI_ASSERT_X( ret, "bt-main-view", "pair action can't connect" ); - - mDataForm = qobject_cast( mLoader->findWidget( "dataForm" ) ); - BTUI_ASSERT_X( mDataForm != 0, "bt-main-view", "dataForm not found" ); - - - // load menu - HbMenu *optionsMenu = qobject_cast(mLoader->findWidget("viewMenu")); - BTUI_ASSERT_X( optionsMenu != 0, "bt-main-view", "Options menu not found" ); - this->setMenu(optionsMenu); - - HbMenu *menu = this->menu(); - mRemovePairedDevices = menu->addAction(hbTrId("txt_bt_opt_remove_paired_devices")); - - mSubMenu = new HbMenu(hbTrId("txt_bt_opt_remove")); - mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_all_devices")); - mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_paired_devices")); - mSubMenu->addAction(hbTrId("txt_bt_opt_remove_sub_blocked_devices")); - - // update display when setting data changed - ret = connect(mSettingModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(updateSettingItems(QModelIndex,QModelIndex))); - BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView", "can't connect dataChanged" ); - - QModelIndex top = mSettingModel->index( BtSettingModel::LocalBtNameRow, 0 ); - QModelIndex bottom = mSettingModel->index( BtSettingModel::AllowedInOfflineRow, 0 ); - // update name, power and visibility rows - updateSettingItems( top, bottom ); - - //Handle Visibility Change User Interaction - ret = connect(mVisibilityMode, SIGNAL(currentIndexChanged (int)), - this, SLOT(visibilityChanged (int))); - // create other views - createViews(); - mCurrentView = this; - mCurrentViewId = MainView; - - mMainFilterModel = new BtuiModelSortFilter(this); - - mMainFilterModel->setSourceModel( mDeviceModel ); - mDeviceList->setModel(mMainFilterModel); - updateDeviceListFilter(BtuiPaired); - // List view item - BtCpUiMainListViewItem *prototype = new BtCpUiMainListViewItem(mDeviceList); - prototype->setModelSortFilter(mMainFilterModel); - mDeviceList->setItemPrototype(prototype); - -} - -/*! - Destructs the BtCpUiMainView. - */ -BtCpUiMainView::~BtCpUiMainView() -{ - delete mLoader; // Also deletes all widgets that it constructed. - mMainWindow->removeView(mSearchView); - mMainWindow->removeView(mDeviceView); - if (mAbstractDelegate) { - delete mAbstractDelegate; - } - -} - -/*! - from base class, initialize the view - */ -void BtCpUiMainView::activateView(const QVariant& value, bool fromBackButton ) -{ - Q_UNUSED(value); - Q_UNUSED(fromBackButton); - - //Reset the device list when returning to the view, as it may have been invalidated by the device view - mMainFilterModel->setSourceModel( mDeviceModel ); - mDeviceList->setModel(mMainFilterModel); -} - -/*! - From base class. Handle resource before the current view is deactivated. - */ -void BtCpUiMainView::deactivateView() -{ - -} - -void BtCpUiMainView::goToDiscoveryView() -{ - changeView( SearchView, false ); -} - -void BtCpUiMainView::goToDeviceView(const QModelIndex& modelIndex) -{ - //the QModelIndex of the selected device should be given as parameter here - QVariant params; - params.setValue(modelIndex); - changeView( DeviceView, false, params ); -} - -Qt::Orientation BtCpUiMainView::orientation() -{ - return mOrientation; -} - -void BtCpUiMainView::changeBtLocalName() -{ - //Error handling has to be done. - if (!mAbstractDelegate) { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::DeviceName, - mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int,QVariant)), this, SLOT(btNameDelegateCompleted(int,QVariant)) ); - mAbstractDelegate->exec(mDeviceNameEdit->text ()); - } - else { - setPrevBtLocalName(); - } -} - -void BtCpUiMainView::setPrevBtLocalName() -{ - //ToDo: Should we notify user this as Error...? - //HbNotificationDialog::launchDialog(hbTrId("Error")); - QModelIndex index = mSettingModel->index( BtSettingModel::LocalBtNameRow,0 ); - - mDeviceNameEdit->setText( mSettingModel->data( - index,BtSettingModel::settingDisplayRole).toString() ); -} - - -void BtCpUiMainView::btNameDelegateCompleted(int status, QVariant param) -{ - if(KErrNone == status) { - mDeviceNameEdit->setText(param.toString()); - } - else { - setPrevBtLocalName(); - } - //Error handling has to be done. - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - -} - -void BtCpUiMainView::visibilityChanged (int index) -{ - QList list; - - VisibilityMode mode = indexToVisibilityMode(index); - list.append(QVariant((int)mode)); - if( BtTemporary == VisibilityMode(mode) ) { - //Right now hardcoded to 5 Mins. - list.append(QVariant(5)); - } - //Error handling has to be done. - if ( !mAbstractDelegate ) { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Visibility, - mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(visibilityDelegateCompleted(int)) ); - mAbstractDelegate->exec(list); - } - else { - setPrevVisibilityMode(); - } - -} - -void BtCpUiMainView::setPrevVisibilityMode() -{ - - QModelIndex index = mSettingModel->index( BtSettingModel::VisibilityRow, 0 ); - - mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode) - mSettingModel->data(index,BtSettingModel::SettingValueRole).toInt()) ); - -} - - -void BtCpUiMainView::allActionTriggered() -{ - HbMenu *menu = this->menu(); - menu->removeAction(mRemovePairedDevices); - mRemoveDevices = menu->addMenu( mSubMenu ); - - updateDeviceListFilter(BtuiAll); -} - -void BtCpUiMainView::pairActionTriggered() -{ - HbMenu *menu = this->menu(); - menu->removeAction(mRemoveDevices); - mRemovePairedDevices = menu->addAction(hbTrId("txt_bt_opt_remove_paired_devices")); - updateDeviceListFilter(BtuiPaired); -} - -void BtCpUiMainView::updateDeviceListFilter(BtCpUiMainView::filterType filter) -{ - mMainFilterModel->clearDeviceMajorFilters(); - - switch (filter) { - case BtuiAll: - mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_all_devices")); - mPairAction->setEnabled(true); - mAllAction->setEnabled(false); - mMainFilterModel->addDeviceMajorFilter( - BtuiDevProperty::InRegistry, - BtuiModelSortFilter::AtLeastMatch); - - break; - case BtuiPaired: - mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_paired_devices")); - mPairAction->setEnabled(false); - mAllAction->setEnabled(true); - mMainFilterModel->addDeviceMajorFilter( - BtuiDevProperty::InRegistry | BtuiDevProperty::Bonded, - BtuiModelSortFilter::AtLeastMatch); - - break; - } -} - - -void BtCpUiMainView::visibilityDelegateCompleted(int status) -{ - - //This should be mapped to Qt error - if(KErrNone != status) { - setPrevVisibilityMode(); - } - - //Error handling has to be done. - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - -} - - -// called due to real orientation change event coming from main window -void BtCpUiMainView::changeOrientation( Qt::Orientation orientation ) -{ - bool ok = false; - mOrientation = orientation; - if( orientation == Qt::Vertical ) { - // load "portrait" section - mLoader->load( BTUI_MAINVIEW_DOCML, "portrait", &ok ); - BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: portrait section problem" ); - } else { - // load "landscape" section - mLoader->load( BTUI_MAINVIEW_DOCML, "landscape", &ok ); - BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" ); - } -} - -/*! - Slot for receiving notification of local setting changes from the model. - Identify the setting changed and update the corresponding UI item. - */ -void BtCpUiMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight) -{ - bool val(false); - - // update only the part of the view specified by the model's row(s) - for (int i=topLeft.row(); i <= bottomRight.row(); i++) { - QModelIndex index = mSettingModel->index( i, 0); - // Distinguish which setting value is changed. - switch ( i ) { - case BtSettingModel::LocalBtNameRow : - mDeviceNameEdit->setText( - mSettingModel->data(index,BtSettingModel::settingDisplayRole).toString() ); - break; - case BtSettingModel::PowerStateRow: - val = mSettingModel->data(index, BtSettingModel::SettingValueRole).toBool(); - if (val) { - HbIcon icon("qtg_mono_bluetooth"); - icon.setIconName("qtg_mono_bluetooth"); - mPowerButton->setIcon(icon); - } - else { - HbIcon icon("qtg_mono_bluetooth_off"); - icon.setIconName("qtg_mono_bluetooth_off"); - mPowerButton->setIcon(icon); - } - break; - case BtSettingModel::VisibilityRow: - mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode) - mSettingModel->data(index,BtSettingModel::SettingValueRole).toInt()) ); - break; - } - } -} - -/*! - Slot for receiving notification for user interaction on power state. - Manually update model data since HbPushButton is not linked to model directly. - */ -void BtCpUiMainView::changePowerState() -{ - QModelIndex index = mSettingModel->index(BtSettingModel::PowerStateRow, 0); - PowerStateQtValue powerState = (PowerStateQtValue)mSettingModel->data(index, Qt::EditRole).toInt(); - BTUI_ASSERT_X(((powerState == BtPowerOn) || (powerState == BtPowerOff)), - "BtCpUiMainView::changePowerState()", "incorrect qt power state"); - - if (powerState == BtPowerOff) { - powerState = BtPowerOn; - } - else { - powerState = BtPowerOff; - } - - if (!mAbstractDelegate)//if there is no other delegate running - { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, - mSettingModel, mDeviceModel ); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); - mAbstractDelegate->exec(QVariant((int)powerState)); - } - -} - -void BtCpUiMainView::powerDelegateCompleted(int status) -{ - Q_UNUSED(status); - //ToDo: Error handling here - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - //BTUI_ASSERT_X( status, "bt-main-view", "error in delegate complete" ); -} - -/*! - * Mapping from visibility mode UI row to VisibilityMode - */ -VisibilityMode BtCpUiMainView::indexToVisibilityMode(int index) -{ - VisibilityMode mode = BtVisibilityUnknown; - switch(index) { - case UiRowBtHidden: - mode = BtHidden; - break; - case UiRowBtVisible: - mode = BtVisible; - break; - case UiRowBtTemporary: - mode = BtTemporary; - break; - default: - BTUI_ASSERT_X(false, "BtCpUiMainView::indexToVisibilityMode", "invalid mode"); - } - return mode; -} - -/*! - * Mapping from VisibilityMode to visibility mode UI row - */ -int BtCpUiMainView::visibilityModeToIndex(VisibilityMode mode) -{ - int uiRow = UiRowBtUnknown; - switch(mode) { - case BtHidden: - uiRow = UiRowBtHidden; - break; - case BtVisible: - uiRow = UiRowBtVisible; - break; - case BtTemporary: - uiRow = UiRowBtTemporary; - break; - default: - BTUI_ASSERT_X(false, "BtCpUiMainView::visibilityModeToIndex", "invalid mode"); - } - return uiRow; -} - - - -/*! - Create views(main view, device view and search view). - Add them to MainWindow. All views are long-lived and are deleted only when exiting the application - (or when main view is deleted). - */ -void BtCpUiMainView::createViews() -{ - Qt::Orientation orientation = mMainWindow->orientation(); - // Create other views - mSearchView = new BtCpUiSearchView( *mSettingModel, *mDeviceModel, this ); - mMainWindow->addView(mSearchView); - - mDeviceView = new BtCpUiDeviceView( *mSettingModel, *mDeviceModel, this ); - mMainWindow->addView(mDeviceView); - - mCurrentView = this; - mCurrentViewId = MainView; - - - // QList stores the previous view ids for each view. - for( int i=0; i < LastView; i++ ) { - mPreviousViewIds.append( 0 ); - } -} - -/*! - Switch between the views. - Parameter "value" is optional except for GadgetView, - which needs the QModelIndex of device - */ -void BtCpUiMainView::changeView(int targetViewId, bool fromBackButton, - const QVariant& value ) -{ - mCurrentView->deactivateView(); - - // update the previous view Id in QList - // If launching the target view from back softkey, - // the previous viewId of target view should not be changed. - // Otherwise, loop happens between two views. - if(!fromBackButton) { - // normal case: return to previous view - mPreviousViewIds[ targetViewId ] = mCurrentViewId; - } - - // set the new current view - mCurrentView = idToView(targetViewId); - mCurrentViewId = targetViewId; - mMainWindow->setCurrentView( mCurrentView ); - - // do preparation or some actions when new view is activated - mCurrentView->activateView( value, fromBackButton ); -} - - -void BtCpUiMainView::deviceSelected(const QModelIndex& modelIndex) -{ - QModelIndex index = mMainFilterModel->mapToSource(modelIndex); - - QVariant params; - params.setValue(index); - - changeView( DeviceView, false, params ); -} - -BtCpUiBaseView * BtCpUiMainView::idToView(int targetViewId) -{ - switch (targetViewId) { - case MainView: - return mMainView; - case SearchView: - return mSearchView; - case DeviceView: - return mDeviceView; - default : - BTUI_ASSERT_X(false, "BtCpUiMainView::idToView", "invalid view id"); - } - return 0; -} - -void BtCpUiMainView::setSoftkeyBack() -{ - // not needed in main view -} - -/*! - Jump to previous view. This function is used when back button is pressed. - semantics slightly different than in other views, since this is called by other - views when a view switch is needed - */ -void BtCpUiMainView::switchToPreviousView() -{ - BTUI_ASSERT_X( (mCurrentViewId >= 0) && (mCurrentViewId < LastView), - "BtCpUiMainView::switchToPreviousView", "invalid view id"); - changeView( mPreviousViewIds[mCurrentViewId], true ); -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuimainview.h --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +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 View of BT Application -* -*/ - -#ifndef BTCPUIMAINVIEW_H -#define BTCPUIMAINVIEW_H - -#include "btcpuibaseview.h" -#include -#include - -class HbLabel; -class HbLineEdit; -class HbPushButton; -class HbIcon; -class HbComboBox; -class HbDocumentLoader; -class HbGridView; -class BtAbstractDelegate; -class HbListView; -class HbGroupBox; -class HbDataForm; - -class BtCpUiMainView : public BtCpUiBaseView -{ - Q_OBJECT - -public: - explicit BtCpUiMainView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent = 0 ); - ~BtCpUiMainView(); - // from view manager - void createViews(); - - Qt::Orientation orientation(); - - // from base class BtCpUiBaseView - virtual void setSoftkeyBack(); - virtual void activateView( const QVariant& value, bool fromBackButton ); - virtual void deactivateView(); - -public slots: - void changeOrientation( Qt::Orientation orientation ); - void changePowerState(); - void visibilityChanged (int index); - void changeBtLocalName(); - - void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight); - void deviceSelected(const QModelIndex& modelIndex); - void goToDiscoveryView(); - void goToDeviceView(const QModelIndex& modelIndex); - virtual void switchToPreviousView(); - - //from delegate classes - void powerDelegateCompleted(int status); - void visibilityDelegateCompleted(int status); - void btNameDelegateCompleted(int status, QVariant param); - void allActionTriggered(); - void pairActionTriggered(); - -private slots: - void changeView(int targetViewId, bool fromBackButton, const QVariant& value = 0 ); - -private: - enum filterType { - BtuiAll = 0, - BtuiPaired - }; - -private: - VisibilityMode indexToVisibilityMode(int index); - int visibilityModeToIndex(VisibilityMode mode); - BtCpUiBaseView * idToView(int targetViewId); - - //Functions to set the Previous Local settings in case of error - void setPrevBtLocalName(); - void setPrevVisibilityMode(); - - void updateDeviceListFilter(BtCpUiMainView::filterType filter); - -private: - - HbDocumentLoader *mLoader; - - HbLineEdit *mDeviceNameEdit; - HbPushButton *mPowerButton; - HbComboBox *mVisibilityMode; - HbListView *mDeviceList; - - Qt::Orientation mOrientation; - - // from view manager - HbMainWindow* mMainWindow; - BtCpUiBaseView* mMainView; - BtCpUiBaseView* mDeviceView; - BtCpUiBaseView* mSearchView; - BtCpUiBaseView* mCurrentView; - int mCurrentViewId; - QList mPreviousViewIds; - - //poiter to abstract delegate, and it is instantiated at runtime - BtAbstractDelegate* mAbstractDelegate; - BtuiModelSortFilter *mMainFilterModel; - - HbAction *mAllAction; - HbAction *mPairAction; - HbDataForm *mDataForm; - HbAction* mRemovePairedDevices; - HbAction* mRemoveDevices; - HbMenu* mSubMenu; -}; -#endif // BTCPUIMAINVIEW_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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: BTUISearchListViewItem implementation -* -*/ - - -#include "btcpuisearchlistviewitem.h" -#include "btdevicemodel.h" -#include "btuiiconutil.h" -#include - -BtCpUiSearchListViewItem::BtCpUiSearchListViewItem(QGraphicsItem * parent) : - HbListViewItem(parent), mParent(parent) -{ - mDeviceNameLabel = 0; - mDevTypeIconLabel = 0; - mDevTypeTextLabel = 0; - mBtuiModelSortFilter = ((BtCpUiSearchListViewItem *)parent)->mBtuiModelSortFilter; - - mRow = 0; -} - -BtCpUiSearchListViewItem::~BtCpUiSearchListViewItem() -{ -// delete mDeviceNameLabel; -// delete mDevTypeIconLabel; -// delete mDevTypeTextLabel; -} - -/* - * This method is called by the HbListView when it needs a new - * view item element. - * - */ -HbAbstractViewItem * BtCpUiSearchListViewItem::createItem() -{ - return new BtCpUiSearchListViewItem(*this); -} - -/*! - UpdateChildItem updates the item graphics. - Screen elements are created once if not already done. This may increase the overall memory - consumption of the application, however, this is deemed inconsequential. There might be a small - performance improvement with current style. - */ -void BtCpUiSearchListViewItem::updateChildItems() -{ - QModelIndex index; - - // Get device name from model - if (mBtuiModelSortFilter) - index = mBtuiModelSortFilter->mapToSource(modelIndex()); - else - index = modelIndex(); - - - // create new icon label if needed - if (!mDevTypeIconLabel) { - mDevTypeIconLabel = new HbLabel(); - mDevTypeIconLabel->setPreferredSize(53.5260, 53.5260); //8un x 8un - mDevTypeIconLabel->setMinimumWidth(53.5260); - } - // create new label if needed - if (!mDeviceNameLabel) { - mDeviceNameLabel = new HbLabel(); - mDeviceNameLabel->setPreferredSize(250, 26.763); - } - // create new label if needed - if (!mDevTypeTextLabel) { - mDevTypeTextLabel = new HbLabel(); - mDevTypeTextLabel->setPreferredSize(250, 26.763); - } - // create layout if needed - if ( !mRow ) { - // Still need to create the actual layout - mRow = new QGraphicsGridLayout(); - mRow->addItem(mDevTypeIconLabel,0,0,2,1); - mRow->addItem(mDeviceNameLabel,0,1,1,1); - mRow->addItem(mDevTypeTextLabel,1,1,1,1); - setLayout(mRow); - } - - QString data = index.data(Qt::DisplayRole).toString(); - int cod = (index.data(BtDeviceModel::CoDRole)).toInt(); - int majorProperty = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); - - // ToDo: remove clear() once Orbit bug is fixed - mDeviceNameLabel->clear(); - mDeviceNameLabel->setPlainText(data); - mDevTypeIconLabel->clear(); - mDevTypeTextLabel->clear(); - mDevTypeTextLabel->setPlainText( getDeviceTypeString( cod )); - HbIcon icon = - getBadgedDeviceTypeIcon(cod, majorProperty, - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight ); - mDevTypeIconLabel->setIcon(icon); -} - - -void BtCpUiSearchListViewItem::setModelSortFilter(BtuiModelSortFilter *filter) -{ - mBtuiModelSortFilter = filter; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.h --- a/bluetoothengine/btui/btcpplugin/btcpuisearchlistviewitem.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: device view item -* -*/ - - -#ifndef BTCPUISEARCHLISTVIEWITEM_H -#define BTCPUISEARCHLISTVIEWITEM_H - -#include -#include -#include -#include -#include "btuimodelsortfilter.h" - -class BtCpUiSearchListViewItem : public HbListViewItem -{ - Q_OBJECT - -public: - BtCpUiSearchListViewItem(QGraphicsItem * parent = 0); - ~BtCpUiSearchListViewItem(); - - HbAbstractViewItem * createItem(); - void updateChildItems(); - - void setModelSortFilter(BtuiModelSortFilter *filter); - -private: - QGraphicsItem *mParent; - HbLabel *mDevTypeIconLabel; - HbLabel *mDeviceNameLabel; - HbLabel *mDevTypeTextLabel; - BtuiModelSortFilter* mBtuiModelSortFilter; - - QGraphicsGridLayout *mRow; -}; - -#endif /* BTCPUISEARCHLISTVIEWITEM_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,388 +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 "btcpuisearchview.h" -#include "btuiviewutil.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "btcpuimainview.h" -#include "btdelegatefactory.h" -#include "btabstractdelegate.h" -#include "btcpuisearchlistviewitem.h" -#include "btuidevtypemap.h" - - -// docml to load -const char* BTUI_SEARCHVIEW_DOCML = ":/docml/bt-search-view.docml"; - -BtCpUiSearchView::BtCpUiSearchView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent) : - BtCpUiBaseView(settingModel,deviceModel, parent), mAbstractDelegate(0), mBtuiModelSortFilter(0) -{ - bool ret(false); - - mQuery = 0; - mLoader = 0; - mSoftKeyBackAction = 0; - - mMainView = (BtCpUiMainView *) parent; - mMainWindow = hbInstance->allMainWindows().first(); - - mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); - BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiSearchView::BtCpUiSearchView", "can't create back action"); - - // Create view for the application. - // Set the name for the view. The name should be same as the view's - // name in docml. - setObjectName("bt_search_view"); - - mLoader = new HbDocumentLoader(); - BTUI_ASSERT_X( mLoader != 0, "BtCpUiSearchView::BtCpUiSearchView", "can't create mLoader" ); - // Pass the view to documentloader. Document loader uses this view - // when docml is parsed, instead of creating new view. - QObjectList objectList; - objectList.append(this); - mLoader->setObjectTree(objectList); - - // read view info from docml file - bool ok = false; - mLoader->load( BTUI_SEARCHVIEW_DOCML, &ok ); - // Exit if the file format is invalid - BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file" ); - - // Set title for the control panel - // ToDo: check if deprecated API - setTitle("Control Panel"); - - // assign automatically created widgets to local variables - - mDeviceIcon=0; - // can't use qobject_cast since HbIcon is not derived from QObject! - mDeviceIcon = qobject_cast( mLoader->findWidget( "icon" ) ); - BTUI_ASSERT_X( mDeviceIcon != 0, "BtCpUiSearchView::BtCpUiSearchView", "Device Icon not found" ); - - mDataForm=0; - mDataForm = qobject_cast( mLoader->findWidget( "dataForm" ) ); - BTUI_ASSERT_X( mDataForm != 0, "BtCpUiSearchView::BtCpUiSearchView", "dataForm not found" ); - mDataForm->setHeading(hbTrId("txt_bt_subhead_bluetooth_found_devices")); - - mLabelSearching=0; - mLabelSearching = qobject_cast( mLoader->findWidget( "label_searching" ) ); - BTUI_ASSERT_X( mLabelSearching != 0, "BtCpUiSearchView::BtCpUiSearchView", "Searching not found" ); - mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_searching")); - - mDeviceList=0; - mDeviceList = qobject_cast( mLoader->findWidget( "deviceList" ) ); - BTUI_ASSERT_X( mDeviceList != 0, "BtCpUiSearchView::BtCpUiSearchView", "Device List not found" ); - - - mDeviceList->setSelectionMode( HbAbstractItemView::SingleSelection ); - - // read landscape orientation section from docml file if needed - mOrientation = mMainWindow->orientation(); - - if (mOrientation == Qt::Horizontal) { - mLoader->load(BTUI_SEARCHVIEW_DOCML, "landscape_ui", &ok); - BTUI_ASSERT_X( ok, "BtCpUiSearchView::BtCpUiSearchView", "Invalid docml file: landscape section problem" ); - } else { - mLoader->load(BTUI_SEARCHVIEW_DOCML, "portrait_ui", &ok); - BTUI_ASSERT_X( ok, "BtCpUiSearchView::BtCpUiSearchView", "Invalid docml file: portrait section problem" ); - } - - // listen for orientation changes - ret = connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)), - this, SLOT(changeOrientation(Qt::Orientation))); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView()", "connect orientationChanged() failed"); - - // load tool bar actions - mViewBy = static_cast( mLoader->findObject( "viewByAction" ) ); - BTUI_ASSERT_X( mViewBy, "BtCpUiSearchView::BtCpUiSearchView", "view by action missing" ); - ret = connect(mViewBy, SIGNAL(triggered()), this, SLOT(viewByDeviceTypeDialog())); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "viewByAction can't connect" ); - - mStop = static_cast( mLoader->findObject( "stopAction" ) ); - BTUI_ASSERT_X( mStop, "BtCpUiSearchView::BtCpUiSearchView", "stopAction missing" ); - ret = connect(mStop, SIGNAL(triggered()), this, SLOT(stopSearching())); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "stopAction can't connect" ); - mStop->setEnabled(true); - - mRetry = static_cast( mLoader->findObject( "retryAction" ) ); - BTUI_ASSERT_X( mRetry, "BtCpUiSearchView::BtCpUiSearchView", "retryAction missing" ); - ret = connect(mRetry, SIGNAL(triggered()), this, SLOT(retrySearch())); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "retryAction can't connect" ); - // Disable for initial search - mRetry->setEnabled(false); - - // load menu - HbMenu *optionsMenu = qobject_cast(mLoader->findWidget("viewMenu")); - BTUI_ASSERT_X( optionsMenu != 0, "BtCpUiSearchView::BtCpUiSearchView", "Options menu not found" ); - this->setMenu(optionsMenu); - - ret = connect(mDeviceList, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex))); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "deviceSelected can't connect" ); - - // initialize device type list for "view by" option - // Note: this list needs to be in the same order as enum devTypeSelectionList - mDevTypeList << hbTrId("txt_bt_list_audio_devices") - << hbTrId("txt_bt_list_computers") - << hbTrId("txt_bt_list_input_devices") - << hbTrId("txt_bt_list_phones") - << hbTrId("txt_bt_list_other_devices"); - - // initialize sort model & create - // inquiry delegate - // Sort is set to dynamic sort filter = true in the class, will sort automatically - mBtuiModelSortFilter = new BtuiModelSortFilter(this); - mBtuiModelSortFilter->setSourceModel(mDeviceModel); - mBtuiModelSortFilter->addDeviceMajorFilter( - BtuiDevProperty::InRange, BtuiModelSortFilter::AtLeastMatch); - mDeviceList->setModel(mBtuiModelSortFilter); - // add sort order to show devices in the order they are found - mBtuiModelSortFilter->setSortRole(BtDeviceModel::SeqNumRole); - // Sort according to the first column (and the only column) in the listview - sorted according SeqNumRole - mBtuiModelSortFilter->sort(0, Qt::AscendingOrder); - - BtCpUiSearchListViewItem *prototype = new BtCpUiSearchListViewItem(mDeviceList); - prototype->setModelSortFilter(mBtuiModelSortFilter); - mDeviceList->setItemPrototype(prototype); - - // Create the inquiry delegate. - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Inquiry, mSettingModel, mDeviceModel ); - - -} - -BtCpUiSearchView::~BtCpUiSearchView() -{ - delete mLoader; // Also deletes all widgets that it constructed. - - setNavigationAction(0); - disconnect( mSoftKeyBackAction ); - delete mSoftKeyBackAction; - - if(mAbstractDelegate) { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - } - if(mBtuiModelSortFilter) { - delete mBtuiModelSortFilter; - } - if ( mQuery ) { - delete mQuery; - } -} - -void BtCpUiSearchView::changeOrientation( Qt::Orientation orientation ) -{ - // ToDo: this does not handle redrawing list view items differently for portrait/landscape - bool ok = false; - mOrientation = orientation; - - if( orientation == Qt::Vertical ) { - // load "portrait" section - mLoader->load( BTUI_SEARCHVIEW_DOCML, "portrait_ui", &ok ); - BTUI_ASSERT_X( ok, "BtCpUiSearchView::changeOrientation", "Invalid docml file: portrait section problem" ); - } else { - // load "landscape" section - mLoader->load( BTUI_SEARCHVIEW_DOCML, "landscape_ui", &ok ); - BTUI_ASSERT_X( ok, "BtCpUiSearchView::changeOrientation", "Invalid docml file: landscape section problem" ); - } -} - - -void BtCpUiSearchView::viewByDeviceTypeDialog() -{ - if ( !mQuery ) { - mQuery = new HbSelectionDialog; - mQuery->setStringItems(mDevTypeList, 0); - mQuery->setSelectionMode(HbAbstractItemView::MultiSelection); - - QList current; - current.append(QVariant(0)); - mQuery->setSelectedItems(current); - - // Set the heading for the dialog. - HbLabel *headingLabel = new HbLabel(hbTrId("txt_bt_title_show"), mQuery); - mQuery->setHeadingWidget(headingLabel); - } - mQuery->open(this,SLOT(viewByDialogClosed(HbAction*))); -} -/*! - Callback for HbSelectionDialog closing - - */ -void BtCpUiSearchView::viewByDialogClosed(HbAction* action) -{ - disconnect( mQuery ); // remove slot - if (action == mQuery->actions().first()) { // user pressed "Ok" - // Get selected items. - QList selections; - selections = mQuery->selectedItems(); - - int devTypesWanted = 0; - - for (int i=0; i < selections.count(); i++) { - switch (selections.at(i).toInt()) { - case BtUiDevAudioDevice: - devTypesWanted |= BtuiDevProperty::AVDev; - break; - case BtUiDevComputer: - devTypesWanted |= BtuiDevProperty::Computer; - break; - case BtUiDevInputDevice: - devTypesWanted |= BtuiDevProperty::Peripheral; - break; - case BtUiDevPhone: - devTypesWanted |= BtuiDevProperty::Phone; - break; - case BtUiDevOtherDevice: - devTypesWanted |= (BtuiDevProperty::LANAccessDev | - BtuiDevProperty::Toy | - BtuiDevProperty::WearableDev | - BtuiDevProperty::ImagingDev | - BtuiDevProperty::HealthDev | - BtuiDevProperty::UncategorizedDev); - break; - default: - // should never get here - BTUI_ASSERT_X(false, "BtCpUiSearchView::viewByDialogClosed()", - "wrong device type in viewBy dialog!"); - } - } - if (devTypesWanted) { - mBtuiModelSortFilter->clearDeviceMajorFilters(); - mBtuiModelSortFilter->addDeviceMajorFilter(BtuiDevProperty::InRange, - BtuiModelSortFilter::AtLeastMatch); // device must be in range - mBtuiModelSortFilter->addDeviceMajorFilter(devTypesWanted, - BtuiModelSortFilter::RoughMatch); // device can be any one of selected ones - } - } -} - -void BtCpUiSearchView::stopSearching() -{ - // Stop searching - - // Stop search delegate - mAbstractDelegate->cancel(); - // reset view - deviceSearchCompleted(KErrNone); -} - -void BtCpUiSearchView::startSearchDelegate () -{ - bool ret = false; - - // Connect to the signal from the BtDelegateInquiry for completion of the search request - ret = connect(mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(searchDelegateCompleted(int))); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "searchDelegateCompleted can't connect" ); - - // Connect to the signal from the BtuiModel when the search has been completed. - ret = connect(mDeviceModel, SIGNAL(deviceSearchCompleted(int)), this, SLOT(deviceSearchCompleted(int))); - BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "deviceSearchCompleted can't connect" ); - - mAbstractDelegate->exec(QVariant()); -} - -void BtCpUiSearchView::retrySearch() -{ - // Retry search - - // Change label and buttons to reflect status - mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_searching")); - mRetry->setEnabled(false); - mStop->setEnabled(true); - - // Make use of the delegate and start the search. - startSearchDelegate (); -} - -void BtCpUiSearchView::setSoftkeyBack() -{ - if (navigationAction() != mSoftKeyBackAction) { - setNavigationAction(mSoftKeyBackAction); - connect( mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(switchToPreviousView()) ); - } -} - -void BtCpUiSearchView::switchToPreviousView() -{ - BTUI_ASSERT_X(mMainView, "BtCpUiSearchView::switchToPreviousView", "invalid mMainView"); - mMainView->switchToPreviousView(); -} - -void BtCpUiSearchView::activateView( const QVariant& value, bool fromBackButton ) -{ - Q_UNUSED(value); - - // ToDo: consider whether orientation should be updated here rather than when orientation really changes; - // advantage: if orientation changes temporarily in another view, but returns to previous setting before - // search is reactived, there is no processing overhead - - setSoftkeyBack(); - - if ( !fromBackButton ) { - // Sets the label and toolbar buttons - retrySearch(); - } -} - -void BtCpUiSearchView::deactivateView() -{ - mAbstractDelegate->cancel(); // Stop searching when leaving view - deviceSearchCompleted(KErrNone); // reset view -} - -void BtCpUiSearchView::searchDelegateCompleted(int error) -{ - Q_UNUSED(error); - -} - -void BtCpUiSearchView::deviceSearchCompleted(int error) -{ - //TODO - handle error. - Q_UNUSED(error); - - mLabelSearching->setPlainText(hbTrId("txt_bt_subhead_search_done")); - mRetry->setEnabled(true); - mStop->setEnabled(false); - - // disconnect signals - disconnect(mAbstractDelegate); - disconnect(mDeviceModel); -} - -void BtCpUiSearchView::deviceSelected(const QModelIndex& modelIndex) -{ - QModelIndex index = mBtuiModelSortFilter->mapToSource(modelIndex); - static_cast(mMainView)->goToDeviceView(index); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisearchview.h --- a/bluetoothengine/btui/btcpplugin/btcpuisearchview.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +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 BTCPUISEARCHVIEW_H -#define BTCPUISEARCHVIEW_H - -#include -#include -#include -#include "btcpuibaseview.h" -#include "btuimodelsortfilter.h" - -class HbLabel; -class HbPushButton; -class HbIcon; -class HbDocumentLoader; -class HbListView; -class BtAbstractDelegate; -class HbSelectionDialog; -class HbGroupBox; -class HbDataForm; - -class BtCpUiSearchView : public BtCpUiBaseView -{ - Q_OBJECT - -public: - - explicit BtCpUiSearchView( - BtSettingModel &settingModel, - BtDeviceModel &deviceModel, - QGraphicsItem *parent = 0); - virtual ~BtCpUiSearchView(); - virtual void activateView( const QVariant& value, bool fromBackButton ); - virtual void deactivateView(); - virtual void setSoftkeyBack(); - -public slots: - virtual void switchToPreviousView(); - void changeOrientation( Qt::Orientation orientation ); - void stopSearching(); - void retrySearch(); - void viewByDeviceTypeDialog(); - void viewByDialogClosed(HbAction* action); - void searchDelegateCompleted(int error); - void deviceSearchCompleted(int error); - void deviceSelected(const QModelIndex& modelIndex); - -private: - void startSearchDelegate(); - -private: - enum devTypeSelectionList { - BtUiDevAudioDevice = 0, - BtUiDevComputer, - BtUiDevInputDevice, - BtUiDevPhone, - BtUiDevOtherDevice - }; -private: - HbDocumentLoader *mLoader; - HbLabel *mDeviceIcon; - HbDataForm *mDataForm; - HbLabel *mLabelSearching; - HbListView *mDeviceList; - QStringList mDevTypeList; - HbSelectionDialog *mQuery; - - Qt::Orientation mOrientation; - - HbMainWindow* mMainWindow; - BtCpUiBaseView* mMainView; - HbAction * mSoftKeyBackAction; - HbAction* mViewBy; - HbAction* mStop; - HbAction* mRetry; - - //pointer to abstract delegate, and it is instantiated at runtime - BtAbstractDelegate* mAbstractDelegate; - BtuiModelSortFilter* mBtuiModelSortFilter; -}; - -#endif// BTCPUISEARCHVIEW_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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 "btcpuisettingitem.h" -#include -#include - -#include -#include - -BtCpUiSettingItem::BtCpUiSettingItem(CpItemDataHelper &itemDataHelper) : - CpSettingFormEntryItemData(itemDataHelper) -{ - bool ret(false); - loadTranslators(); - mSettingModel = new BtSettingModel(this); - mDeviceModel = new BtDeviceModel(this); - - ret = connect(mSettingModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(handleDataChanged(QModelIndex,QModelIndex))); - BTUI_ASSERT_X( ret, "BtCpUiSettingItem::BtCpUiSettingItem", "can't connect dataChanged" ); - - this->setDescription(hbTrId("txt_cp_dblist_bluetooth")); - updateStatus(); -} - -BtCpUiSettingItem::~BtCpUiSettingItem() -{ - delete mViewTranslator; - delete mDialogTranslator; -} - -void BtCpUiSettingItem::loadTranslators() -{ - mViewTranslator = new HbTranslator("btviews"); - mDialogTranslator = new HbTranslator("btdialogs"); -} - -void BtCpUiSettingItem::onLaunchView() -{ - - mMainWindow = hbInstance->allMainWindows().first(); - - mBtMainView = new BtCpUiMainView(*mSettingModel, *mDeviceModel); - - mCpView = mMainWindow->currentView(); - - mMainWindow->addView(mBtMainView); - mMainWindow->setCurrentView(mBtMainView); - - connect(mBtMainView, SIGNAL(aboutToClose()), this, SLOT(handleCloseView())); - -} - -void BtCpUiSettingItem::handleCloseView() -{ - mBtMainView->deactivateView(); - mMainWindow->setCurrentView(mCpView); - - mMainWindow->removeView(mBtMainView); - delete mBtMainView; - mBtMainView = 0; - -} - -/*! - Slot for receiving notification of local setting changes from the model. - Identify the setting changed and update the corresponding UI item. - */ -void BtCpUiSettingItem::handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -{ - // update only the part of the view specified by the model's row(s) - for (int i=topLeft.row(); i <= bottomRight.row(); i++) { - QModelIndex index = mSettingModel->index( i, 0); - // Distinguish which setting value is changed. - switch ( i ) { - case BtSettingModel::PowerStateRow: - case BtSettingModel::VisibilityRow: - updateStatus(); - break; - } - } -} - -void BtCpUiSettingItem::updateStatus() -{ - QString btStatusText; - HbIcon btStatusIcon; - - //todo: Connection status is not updated right now, which is also required as per UI Spec. - PowerStateQtValue btPower = (PowerStateQtValue)mSettingModel->data(mSettingModel->index( - BtSettingModel::PowerStateRow, 0), - BtSettingModel::SettingValueRole).toInt(); - - if(BtPowerOn == btPower) { - VisibilityMode visibilityMode = (VisibilityMode) mSettingModel->data( - mSettingModel->index(BtSettingModel::VisibilityRow, 0), - BtSettingModel::SettingValueRole).toInt(); - switch(visibilityMode) { - case BtHidden: - btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_on_and_hidden"); - btStatusIcon.setIconName("qtg_large_bluetooth_hide"); - break; - case BtVisible: - case BtTemporary: - btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_on_and_visible"); - btStatusIcon.setIconName("qtg_large_bluetooth"); - break; - default: - BTUI_ASSERT_X(false, "BtCpUiSettingItem::updateStatus", "invalid visibility mode"); - } - } - else { - //Bt is off. - btStatusText = hbTrId("txt_cp_dblist_bluetooth_val_off"); - btStatusIcon.setIconName("qtg_large_bluetooth_off"); - } - - this->setDescription(btStatusText); - this->setEntryItemIcon(btStatusIcon); -} - -CpBaseSettingView *BtCpUiSettingItem::createSettingView() const -{ - return 0; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btcpuisettingitem.h --- a/bluetoothengine/btui/btcpplugin/btcpuisettingitem.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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 BTCPUISETTINGITEM_H -#define BTCPUISETTINGITEM_H - -#include -#include -#include - -#include "btcpuimainview.h" - -class HbTranslator; - -class BtCpUiSettingItem : public CpSettingFormEntryItemData -{ - Q_OBJECT -public: - explicit BtCpUiSettingItem(CpItemDataHelper &itemDataHelper); - virtual ~BtCpUiSettingItem(); -private slots: - void onLaunchView(); - void handleCloseView(); - void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); -private: - virtual CpBaseSettingView *createSettingView() const; - void updateStatus(); - void loadTranslators(); -private: - HbMainWindow* mMainWindow; - - BtCpUiMainView *mBtMainView; - - //Owns this model. - BtSettingModel *mSettingModel; - BtDeviceModel *mDeviceModel; - - HbView *mCpView; - - HbTranslator *mViewTranslator; - HbTranslator *mDialogTranslator; - -}; - -#endif //BTCPUISETTINGITEM_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/btuiviewutil.h --- a/bluetoothengine/btui/btcpplugin/btuiviewutil.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 BTUIVIEWUTIL_H -#define BTUIVIEWUTIL_H - -enum ViewIndex { - MainView, - SearchView, - DeviceView, - LastView -}; - - - -#endif // BTUIVIEWUTIL_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/docml/bt-advanced-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-advanced-view.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/docml/bt-device-details-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-device-details-view.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - - - - -
-
- - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_frwidget_add_friend_photo.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_frwidget_add_friend_photo.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_det_circle.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_det_circle.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_time.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_time.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_blocked.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_blocked.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_paired_add.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_paired_add.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_trusted_add.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_trusted_add.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_audio.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_audio.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_blocked_tab3.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_blocked_tab3.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_car_kit.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_car_kit.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_carkit.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_carkit.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_computer.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_computer.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_connected.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_connected.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_headset.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_headset.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_keyboard.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_keyboard.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_misc.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_misc.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_mouse.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_mouse.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_phone.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_phone.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_printer.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_printer.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_unknown.svg --- a/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_unknown.svg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/btdevsettingframework.pro --- a/bluetoothengine/btui/btdevsettingframework/btdevsettingframework.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: -# - -TEMPLATE = lib -TARGET = btdevsettingframework - -MOC_DIR = moc -DEFINES += BUILD_BTDEVSETTINGFRAMEWORK - -CONFIG += qt \ - hb \ - dll - -INCLUDEPATH += ../../../btservices_plat/bt_remote_device_setting_api/inc - -HEADERS += \ - ../../../btservices_plat/bt_remote_device_setting_api/inc/btabstractdevsetting.h - - -SOURCES += src/btabstractdevsetting.cpp \ - src/btdevsettingpluginloader.cpp - -defFilePath = . - -symbian: { - SYMBIAN_PLATFORMS = WINSCW \ - ARMV5 - - BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include" \ - "rom/btdevsettingframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btdevsettingframework.iby)" - - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0xEEEEEEEE - TARGET.CAPABILITY = CAP_GENERAL_DLL - - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/bwins/btdevsettingframeworku.def --- a/bluetoothengine/btui/btdevsettingframework/bwins/btdevsettingframeworku.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - ?aboutToClose@BtAbstractDevSetting@@UAEXXZ @ 1 NONAME ; void BtAbstractDevSetting::aboutToClose(void) - ??0BtAbstractDevSetting@@QAE@ABVQString@@PAVQObject@@@Z @ 2 NONAME ; BtAbstractDevSetting::BtAbstractDevSetting(class QString const &, class QObject *) - ?tr@BtAbstractDevSetting@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString BtAbstractDevSetting::tr(char const *, char const *, int) - ?staticMetaObject@BtAbstractDevSetting@@2UQMetaObject@@B @ 4 NONAME ; struct QMetaObject const BtAbstractDevSetting::staticMetaObject - ?tr@BtAbstractDevSetting@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString BtAbstractDevSetting::tr(char const *, char const *) - ?isSettingAvailable@BtAbstractDevSetting@@UAE_NXZ @ 6 NONAME ; bool BtAbstractDevSetting::isSettingAvailable(void) - ?trUtf8@BtAbstractDevSetting@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString BtAbstractDevSetting::trUtf8(char const *, char const *) - ?getStaticMetaObject@BtAbstractDevSetting@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & BtAbstractDevSetting::getStaticMetaObject(void) - ??_EBtDevSettingInterface@@UAE@I@Z @ 9 NONAME ; BtDevSettingInterface::~BtDevSettingInterface(unsigned int) - ?trUtf8@BtAbstractDevSetting@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString BtAbstractDevSetting::trUtf8(char const *, char const *, int) - ?aboutToBackground@BtAbstractDevSetting@@UAEXXZ @ 11 NONAME ; void BtAbstractDevSetting::aboutToBackground(void) - ??_EBtAbstractDevSetting@@UAE@I@Z @ 12 NONAME ; BtAbstractDevSetting::~BtAbstractDevSetting(unsigned int) - ?aboutToForeground@BtAbstractDevSetting@@UAEXXZ @ 13 NONAME ; void BtAbstractDevSetting::aboutToForeground(void) - ?getSettingWidget@BtAbstractDevSetting@@UAEPAVHbDataForm@@XZ @ 14 NONAME ; class HbDataForm * BtAbstractDevSetting::getSettingWidget(void) - ?metaObject@BtAbstractDevSetting@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * BtAbstractDevSetting::metaObject(void) const - ?qt_metacast@BtAbstractDevSetting@@UAEPAXPBD@Z @ 16 NONAME ; void * BtAbstractDevSetting::qt_metacast(char const *) - ??1BtAbstractDevSetting@@UAE@XZ @ 17 NONAME ; BtAbstractDevSetting::~BtAbstractDevSetting(void) - ?qt_metacall@BtAbstractDevSetting@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 18 NONAME ; int BtAbstractDevSetting::qt_metacall(enum QMetaObject::Call, int, void * *) - ?getRemote@BtAbstractDevSetting@@QBEABVQString@@XZ @ 19 NONAME ; class QString const & BtAbstractDevSetting::getRemote(void) const - ?loadDevSettingInterfaces@BtDevSettingPluginLoader@@SA?AV?$QList@PAVBtDevSettingInterface@@@@XZ @ 20 NONAME ; class QList BtDevSettingPluginLoader::loadDevSettingInterfaces(void) - ?settingAvailabilityChanged@BtAbstractDevSetting@@IAEXPAV1@_N@Z @ 21 NONAME ; void BtAbstractDevSetting::settingAvailabilityChanged(class BtAbstractDevSetting *, bool) - ??1BtDevSettingInterface@@UAE@XZ @ 22 NONAME ; BtDevSettingInterface::~BtDevSettingInterface(void) - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/eabi/btdevsettingframeworku.def --- a/bluetoothengine/btui/btdevsettingframework/eabi/btdevsettingframeworku.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -EXPORTS - _ZN20BtAbstractDevSetting11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME - _ZN20BtAbstractDevSetting11qt_metacastEPKc @ 2 NONAME - _ZN20BtAbstractDevSetting12aboutToCloseEv @ 3 NONAME - _ZN20BtAbstractDevSetting16getSettingWidgetEv @ 4 NONAME - _ZN20BtAbstractDevSetting16staticMetaObjectE @ 5 NONAME DATA 16 - _ZN20BtAbstractDevSetting17aboutToBackgroundEv @ 6 NONAME - _ZN20BtAbstractDevSetting17aboutToForegroundEv @ 7 NONAME - _ZN20BtAbstractDevSetting18isSettingAvailableEv @ 8 NONAME - _ZN20BtAbstractDevSetting19getStaticMetaObjectEv @ 9 NONAME - _ZN20BtAbstractDevSetting26settingAvailabilityChangedEPS_b @ 10 NONAME - _ZN20BtAbstractDevSettingC1ERK7QStringP7QObject @ 11 NONAME - _ZN20BtAbstractDevSettingC2ERK7QStringP7QObject @ 12 NONAME - _ZN20BtAbstractDevSettingD0Ev @ 13 NONAME - _ZN20BtAbstractDevSettingD1Ev @ 14 NONAME - _ZN20BtAbstractDevSettingD2Ev @ 15 NONAME - _ZN24BtDevSettingPluginLoader24loadDevSettingInterfacesEv @ 16 NONAME - _ZNK20BtAbstractDevSetting10metaObjectEv @ 17 NONAME - _ZNK20BtAbstractDevSetting9getRemoteEv @ 18 NONAME - _ZTI20BtAbstractDevSetting @ 19 NONAME - _ZTV20BtAbstractDevSetting @ 20 NONAME - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/rom/btdevsettingframework.iby --- a/bluetoothengine/btui/btdevsettingframework/rom/btdevsettingframework.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 BTDEVSETTINGFRAMEWORK_IBY -#define BTDEVSETTINGFRAMEWORK_IBY - -#include -#include -#ifdef __BT - -file=ABI_DIR/BUILD_DIR/btdevsettingframework.dll SHARED_LIB_DIR/btdevsettingframework.dll - -#endif //__BT - -#endif // BTDEVSETTINGFRAMEWORK_IBY - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/src/btabstractdevsetting.cpp --- a/bluetoothengine/btui/btdevsettingframework/src/btabstractdevsetting.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +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: The plugin interface of Bluetooth device setting ui -* -*/ - -#include - -BtAbstractDevSetting::BtAbstractDevSetting( - const QString &address, QObject *parent) - : QObject( parent ) -{ - mRemote = address; -} - -/*! - Destructor of BtAbstractDevSetting. - */ -BtAbstractDevSetting::~BtAbstractDevSetting() -{ -} - -/*! - Gets the BD_ADDR of the remote device which this setting - plugin is provided for. - - \return the device address of the remote device in hex string - */ -const QString &BtAbstractDevSetting::getRemote() const -{ - return mRemote; -} - -/*! - Tells if this setting plugin can provide a setting UI - for the target device. If the answer is true, this plugin may be - requested to create a setting widget by function - \code createSettingWidget() \endcode. - - \return true if a setting is currently available. false, otherwise. - - The default implementation returns false. - */ -bool BtAbstractDevSetting::isSettingAvailable() -{ - return false; -} - -/*! - Gets a \code HbDataForm \endcode instance which consists of the - setting UI from this specific plugin. The loader of this plugin will - add this dataform into its setting view if its setting is available at - the time. - - The ownership of this widget is not transferred. That is, the plugin - is responsible to free it at plugin destruction. - - The default implementation returns 0. - - \return an \code HbDataForm \endcode instance. - */ -HbDataForm *BtAbstractDevSetting::getSettingWidget() -{ - return 0; -} - -/*! - Informs that device setting is going to foreground. This - implies that the \code HbWidget \endcode from function - \code createSettingWidget \endcode will be shown if the setting - from this plugin is available. - - The default implementation does nothing. - */ -void BtAbstractDevSetting::aboutToForeground() -{ -} - -/*! - Informs that device setting is going to background. - - The default implementation does nothing. - */ -void BtAbstractDevSetting::aboutToBackground() -{ -} - -/*! - Informs that device setting is going to close. - - The default implementation does nothing. - */ -void BtAbstractDevSetting::aboutToClose() -{ -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btdevsettingframework/src/btdevsettingpluginloader.cpp --- a/bluetoothengine/btui/btdevsettingframework/src/btdevsettingpluginloader.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +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 -#include -#include -#include -#include -#include -#include - -/*! - \class BtDevSettingPluginLoader - \brief The BtDevSettingPluginLoader class loads BT device setting plugins. - */ - -#ifdef WIN32 - #define PLUGINFILE_SUFFIX "dll" -#else - #define PLUGINFILE_SUFFIX "qtplugin" -#endif - - -static QStringList getDrives() -{ - static QStringList drives; - if (drives.empty()) { -#ifdef WIN32 - drives.append("C:"); -#else - QFileInfoList fileInfoList = QDir::drives(); - foreach(const QFileInfo &fileInfo,fileInfoList) { - QString str = fileInfo.filePath(); - if (str.length() > 2) { - str = str.left(2); - } - drives.append(str); - } -#endif - } - return drives; -} - -static QStringList directoriesFromAllDrives(const QString &baseDir) -{ - QStringList dirs; - QStringList drives = getDrives(); - foreach(const QString &drive,drives) { - QString dir = drive + baseDir + QDir::separator(); - if (QFileInfo(dir).exists()) { - dirs.append(dir); - } - } - return dirs; -} - -static BtDevSettingInterface* loadPluginInterface(const QFileInfo &pluginFile) -{ - QPluginLoader loader(pluginFile.absoluteFilePath()); - BtDevSettingInterface *plugin = - qobject_cast (loader.instance()); - if (!plugin) { - loader.unload(); - } - return plugin; -} - -/*! - Load all setting interfaces. - - \return the list of plugin interface. - */ -QList BtDevSettingPluginLoader::loadDevSettingInterfaces() -{ - QList interfaces; - - static QStringList pluginDirs; - if (pluginDirs.empty()) { - pluginDirs = directoriesFromAllDrives(BTDEVSETTING_PLUGIN_PATH); - } - foreach(const QString &dirStr,pluginDirs) { - QDir pluginDir( dirStr ); - QFileInfoList fileInfoList = pluginDir.entryInfoList( QDir::Files ); - foreach(const QFileInfo &fileInfo,fileInfoList) { - int diff = fileInfo.suffix().compare(PLUGINFILE_SUFFIX,Qt::CaseInsensitive); - if (!diff) { - BtDevSettingInterface* settingIf = loadPluginInterface(fileInfo); - if ( settingIf ) { - interfaces.append( settingIf ); - } - } - } - } - - return interfaces; -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btui.pro --- a/bluetoothengine/btui/btui.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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: -# - - -TEMPLATE = subdirs - -# Directories -SUBDIRS += btuimodel \ -btdevsettingframework \ -btuidelegate \ -btcpplugin \ -tsrc - -CONFIG += ordered - -symbian: { - SYMBIAN_PLATFORMS = WINSCW \ - ARMV5 - BLD_INF_RULES.PRJ_EXPORTS += \ - "$${LITERAL_HASH}include" \ - "rom/btui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btui.iby)" \ - "rom/btui_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(btui_resources.iby)" \ - "inc/btuiiconutil.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btuiiconutil.h)" \ - "inc/btuidevtypemap.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btuidevtypemap.h)" -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp --- a/bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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 "btabstractdelegate.h" -#include "btqtconstants.h" - -#include -#include - -/*! - Constructor. - */ -BtAbstractDelegate::BtAbstractDelegate( BtSettingModel *settingModel, - BtDeviceModel *deviceModel, QObject *parent ) - : QObject( parent ), mSettingModel(settingModel),mDeviceModel(deviceModel) -{ -} - -/*! - Destructor. - */ -BtAbstractDelegate::~BtAbstractDelegate() -{ -} - -BtSettingModel *BtAbstractDelegate::getSettingModel() -{ - return mSettingModel; -} - -BtDeviceModel *BtAbstractDelegate::getDeviceModel() -{ - return mDeviceModel; -} - -void BtAbstractDelegate::cancel() -{ - -} - -bool BtAbstractDelegate::isBtPowerOn() -{ - QModelIndex powerIndex = getSettingModel()->index(BtSettingModel::PowerStateRow, 0); - PowerStateQtValue powerState = (PowerStateQtValue)getSettingModel()->data(powerIndex, BtSettingModel::SettingValueRole).toInt(); - - return (BtPowerOn == powerState); -} - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btabstractdelegate.h --- a/bluetoothengine/btui/btuidelegate/btabstractdelegate.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 BTABSTRACTDELEGATE_H -#define BTABSTRACTDELEGATE_H - -#include -#include -#include - -class BtSettingModel; -class BtDeviceModel; - -#ifdef BUILD_BTUIDELEGATE -#define BTUIDELEGATE_IMEXPORT Q_DECL_EXPORT -#else -#define BTUIDELEGATE_IMEXPORT Q_DECL_IMPORT -#endif - - -/*! - \class BtAbstractDelegate - \brief the base class for handling user requests from BT application. - - - \\sa btuidelegate - */ -class BTUIDELEGATE_IMEXPORT BtAbstractDelegate : public QObject -{ - Q_OBJECT - -public: - explicit BtAbstractDelegate( BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent = 0 ); - - virtual ~BtAbstractDelegate(); - - virtual void exec( const QVariant ¶ms ) = 0; - - virtual void cancel(); - -signals: - void commandCompleted(int status, QVariant params = QVariant() ); - -protected: - - BtSettingModel *getSettingModel(); - BtDeviceModel *getDeviceModel(); - - bool isBtPowerOn(); - -public slots: - -private: - - // pointer to models. do not own. - BtSettingModel *mSettingModel; - BtDeviceModel *mDeviceModel; - - Q_DISABLE_COPY(BtAbstractDelegate) - -}; - -Q_DECLARE_METATYPE(QModelIndex) - -#endif // BTABSTRACTDELEGATE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateconnect.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegateconnect.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,288 +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 "btdelegateconnect.h" -#include "btuiutil.h" -#include "btqtconstants.h" -#include -#include -#include -#include -#include -#include -#include "btuiiconutil.h" -#include "btdelegatefactory.h" -#include -#include -#include - -BtDelegateConnect::BtDelegateConnect( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0), - mAbstractDelegate(0), mActiveHandling(false) -{ - -} - -BtDelegateConnect::~BtDelegateConnect() -{ - delete mBtengConnMan; -} - -/*! - * execute connect operation - * first check if power is on - */ -void BtDelegateConnect::exec( const QVariant ¶ms ) -{ - if ( mActiveHandling ) { - emit commandCompleted( KErrAlreadyExists ); - return; - } - mIndex = params.value(); - mActiveHandling = true; - // save needed values from model - mDeviceName = (mIndex.data(BtDeviceModel::NameAliasRole)).toString(); - QString addrStr = (mIndex.data(BtDeviceModel::ReadableBdaddrRole)).toString(); - addrReadbleStringToSymbian( addrStr, mAddr ); - - mCod = (mIndex.data(BtDeviceModel::CoDRole)).toInt(); - mMajorProperty = (mIndex.data(BtDeviceModel::MajorPropertyRole)).toInt(); - - // first turn on power if needed - if (!isBtPowerOn()) { - if (!mAbstractDelegate) //if there is no other delegate running - { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, - getSettingModel(), getDeviceModel() ); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); - mAbstractDelegate->exec(QVariant(BtPowerOn)); - } - } - else { - // power is already on - exec_connect(); - } -} - -/*! - * power delegate has completed, continue processing - */ -void BtDelegateConnect::powerDelegateCompleted(int status) -{ - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - if ( status == KErrNone ) { - // continue connecting - exec_connect(); - } - else { - // error - emitCommandComplete(status); - } -} - -/*! - * execute connect operation - */ -void BtDelegateConnect::exec_connect() -{ - int error = KErrNone; - - if ( ! mBtengConnMan ){ - TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); - } - - if ( !error ) { - TBTDeviceClass btEngDeviceClass(mCod); - error = mBtengConnMan->Connect(mAddr, btEngDeviceClass); - } - - if( error ) { - emitCommandComplete(error); - } -} - -/*! - * connect callback from CBTengConnMan - */ -void BtDelegateConnect::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - // It is possible that another audio device has just connected to phone when we are - // connecting to this audio device. Or a device is connected while this command - // is idle. No handling for these cases. - if ( mAddr != aAddr || !mActiveHandling ) { - return; - } - - // conflict could occur as well if another audio device is already connected - // since currently we don't support multiple audio device connections. - if ( aErr && aConflicts && aConflicts->Count() ) { - // get the display name of the device that is - // causing the conflict - QString conflictDevAddr; - addrSymbianToReadbleString(conflictDevAddr, (*aConflicts)[0] ); - QModelIndex start = getDeviceModel()->index(0,0); - QModelIndexList indexList = getDeviceModel()->match(start, BtDeviceModel::ReadableBdaddrRole, conflictDevAddr); - BTUI_ASSERT_X(indexList.count(), "BtDelegateConnect::ConnectComplete()", "device missing from model!"); - mConflictDevIndex = indexList.at(0); - - // check if conflict device is being used in a call - // Note: actually only checking if *any* audio device is involved in a call, not necessarily the - // one we are concerned with here. Btaudioman does not currently support finding out the actual - // device involved in a call. - if (callOngoing()) { - HbMessageBox::warning(hbTrId("txt_bt_info_not_possible_during_a_call")); - emitCommandComplete(KErrCancel); - } - else { - // no call, check if user wants to disconnect conflict device - QString conflictDevName = (mConflictDevIndex.data(BtDeviceModel::NameAliasRole)).toString(); - - QString questionText(hbTrId("txt_bt_info_to_connect_1_2_needs_to_be_disconnec") - .arg(mDeviceName).arg(conflictDevName)); - - HbMessageBox::question( questionText, this, SLOT(handleUserAnswer(int)), - HbMessageBox::Continue | HbMessageBox::Cancel ); - } - } - else { - // command is finished - emitCommandComplete(aErr); - } -} - -/*! - * handle user response to query about disconnecting conflict device - */ -void BtDelegateConnect::handleUserAnswer( int answer ) -{ - if( answer == HbMessageBox::Continue ) { - // Continue, ie. disconnect conflict device and then try reconnecting again - if (!mAbstractDelegate) //if there is no other delegate running - { - QListlist; - QVariant paramFirst; - paramFirst.setValue(mConflictDevIndex); - QVariant paramSecond(ServiceLevel); - list.append(paramFirst); - list.append(paramSecond); - QVariant paramsList(list); - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Disconnect, - getSettingModel(), getDeviceModel() ); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); - mAbstractDelegate->exec(paramsList); - } - } - else { - // Cancel connect operation - emitCommandComplete(KErrCancel); - } -} - -/*! - * returns true if phone call is ongoing - */ -bool BtDelegateConnect::callOngoing() -{ - // ToDo: check if there exists Qt PS key for ongoing call - int callState; - int err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); - if (!err && (callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized)) { - return false; - } - else { - return true; - } -} - -/*! - * disconnecting conflict device has completed, continue connecting - */ -void BtDelegateConnect::disconnectDelegateCompleted(int status) -{ - if (mAbstractDelegate) - { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - // finished disconnecting conflict device, now reconnect to original device - if ( status == KErrNone ) { - exec_connect(); - } - else { - // disconnect failed, abort - emitCommandComplete( status ); - } -} - -/*! - * not used here - */ -void BtDelegateConnect::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} - -/*! - * cancel connect operation - * ConnectComplete() callback will be called upon completion of cancel with KErrCancel - */ -void BtDelegateConnect::cancel() -{ - if ( mBtengConnMan ) { - mBtengConnMan->CancelConnect(mAddr); - } -} - -/*! - * shows user notes with connection success/failure information - * cancel operation is handled without a user note - */ -void BtDelegateConnect::emitCommandComplete(int error) -{ - if ( error == KErrNone ) { - // success, show indicator with connection status - - HbIcon icon = getBadgedDeviceTypeIcon( mCod, mMajorProperty, BtuiNoCorners); - QString str(hbTrId("txt_bt_dpopinfo_connected_to_1")); - HbNotificationDialog::launchDialog( icon, hbTrId("txt_bt_dpophead_connected"), - str.arg(mDeviceName) ); - } - else if ( error == KErrCancel ) { - // no user note, return success since cancel operation completed successfully - error = KErrNone; - } - else { - // failure to connect, show user note - QString err(hbTrId("txt_bt_info_unable_to_connect_with_bluetooth")); - HbMessageBox::warning(err.arg(mDeviceName)); - } - mActiveHandling = false; - - emit commandCompleted(error); -} - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateconnect.h --- a/bluetoothengine/btui/btuidelegate/btdelegateconnect.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 BTDELEGATECONNECT_H -#define BTDELEGATECONNECT_H - -#include -#include -#include "btabstractdelegate.h" -#include - -class BtuiModel; - -/*! - \class BtDelegateConnect - \brief the base class for handling Bluetooth Connection. - */ -class BtDelegateConnect : public BtAbstractDelegate, - public MBTEngConnObserver -{ - Q_OBJECT - -public: - explicit BtDelegateConnect( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent = 0 ); - - virtual ~BtDelegateConnect(); - virtual void exec( const QVariant ¶ms ); - virtual void cancel(); - -public slots: - - -protected: - //From MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - -private slots: - void handleUserAnswer( int answer ); - void powerDelegateCompleted(int status); - void disconnectDelegateCompleted(int status); - -private: - void exec_connect(); - void emitCommandComplete(int error); - bool callOngoing(); - -private: - QModelIndex mIndex; - QModelIndex mConflictDevIndex; - CBTEngConnMan *mBtengConnMan; - QString mDeviceName; - int mMajorProperty; - int mCod; - BtAbstractDelegate* mAbstractDelegate; - bool mActiveHandling; - TBTDevAddr mAddr; - - Q_DISABLE_COPY(BtDelegateConnect) - -}; - - -#endif /* BTDELEGATECONNECT_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateconsts.h --- a/bluetoothengine/btui/btuidelegate/btdelegateconsts.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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 BTDELEGATECONSTS_H -#define BTDELEGATECONSTS_H - -#include - -namespace BtDelegate - { - enum Command - { - Undefined, - ManagePower, - DeviceName, - Visibility, - Inquiry, - Connect, - Pair, - Disconnect, - Unpair, - RemoteDevName - }; - } - -#endif // BTDELEGATECONSTS_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedevname.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatedevname.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +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 "btdelegatedevname.h" -#include -#include -#include - -BtDelegateDevName::BtDelegateDevName(QObject *parent ) : - BtAbstractDelegate( NULL, NULL, parent ) -{ - TRAP_IGNORE( mBtEngSettings = CBTEngSettings::NewL() ); - Q_CHECK_PTR( mBtEngSettings ); - -} - -BtDelegateDevName::~BtDelegateDevName() -{ - delete mBtEngSettings; -} - -/*! - Validate the bluetooth device name given by the user: - Extra spaces (' ', '\n', '\t' and '\r') from the beginning, - middle and the end of the name are always removed; - the maximum lengthof a name is 30. - */ -bool BtDelegateDevName::validateName(QString &name ) -{ - // remove spaces at the beginning and end: - name = name.trimmed(); - // regular expression of one or more consecutive spaces: - QRegExp rx("[ \n\t\r]+"); - name.replace( rx, " "); - if (name.length() > 30 ) { - name.resize( 30 ); - } - return name.length() > 0; -} - -void BtDelegateDevName::exec( const QVariant ¶ms ) -{ - int error = KErrNone; - QString btDevName = params.toString(); - - validateName(btDevName); - - TPtrC ptrName(reinterpret_cast(btDevName.constData())); - - RBuf16 btName; - error = btName.Create(ptrName.Length()); - - if(error == KErrNone) { - btName.Copy(ptrName); - error = mBtEngSettings->SetLocalName(btName); - btName.Close(); - } - - emit commandCompleted(error, btDevName); -} - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedevname.h --- a/bluetoothengine/btui/btuidelegate/btdelegatedevname.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 BTDELEGATEDEVNAME_H -#define BTDELEGATEDEVNAME_H - -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - -/*! - \class BtDelegateDevName - \brief the base class for handling Bluetooth Local Name. - */ -class BtDelegateDevName : public BtAbstractDelegate -{ - Q_OBJECT - -public: - explicit BtDelegateDevName( QObject *parent = 0 ); - - virtual ~BtDelegateDevName(); - - virtual void exec( const QVariant ¶ms ); - -public slots: - -private: - bool validateName(QString &name ); - - CBTEngSettings* mBtEngSettings; - -private: - - Q_DISABLE_COPY(BtDelegateDevName) - -}; - -#endif // BTDELEGATEDEVNAME_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +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 "btdelegatedevsecurity.h" -#include "btqtconstants.h" -#include -#include -#include -#include -#include - -BtDelegateDevSecurity::BtDelegateDevSecurity( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtEngDevMan(0), mBtengConnMan(0), mDisconnectDelegate(0) -{ - -} - -BtDelegateDevSecurity::~BtDelegateDevSecurity() -{ - delete mBtEngDevMan; - delete mBtengConnMan; - delete mDisconnectDelegate; -} - - -void BtDelegateDevSecurity::exec( const QVariant ¶ms ) -{ - int error = KErrNone; - QModelIndex index = params.value(); - - QString strBtAddr = getDeviceModel()->data(index, - BtDeviceModel::ReadableBdaddrRole).toString(); - - mdeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - - TBTDevAddr symaddr; - TBuf buffer(strBtAddr.utf16()); - symaddr.SetReadable( buffer ); - - // Disconnect if paired device was connected - if ( ! mBtengConnMan ){ - TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); - } - TBTEngConnectionStatus connstatus; - if ( !error && mBtengConnMan->IsConnected(symaddr, connstatus ) == KErrNone) { - if ( connstatus == EBTEngConnected) { - if (! mDisconnectDelegate){ - mDisconnectDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Disconnect, getSettingModel(), getDeviceModel()); - connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); - - } - QListlist; - QVariant paramFirst; - paramFirst.setValue(index); - QVariant paramSecond; - DisconnectOption discoOpt = ServiceLevel; - paramSecond.setValue((int)discoOpt); - list.append(paramFirst); - list.append(paramSecond); - QVariant paramsList; - paramsList.setValue(list); - mDisconnectDelegate->exec(paramsList); - } - } - - // Set device as unpaired - CBTDevice *symBtDevice = 0; - TRAP( error, { - symBtDevice = CBTDevice::NewL( symaddr ); - if( !mBtEngDevMan) { - mBtEngDevMan = CBTEngDevMan::NewL( this ); - } - }); - - if ( !error ) { - symBtDevice->SetPaired(EFalse); - // deleting link key for executing unpair is safe as no - // link key shall exist if the device has been unpaired. - symBtDevice->DeleteLinkKey(); - error = mBtEngDevMan->ModifyDevice( *symBtDevice ); - } - delete symBtDevice; - - if ( error ) { - emitCommandComplete(error); - } -} - -void BtDelegateDevSecurity::cancel() -{ - -} - -void BtDelegateDevSecurity::disconnectDelegateCompleted( int err ) -{ - Q_UNUSED(err); -} - -void BtDelegateDevSecurity::HandleDevManComplete( TInt aErr ) -{ - emitCommandComplete(aErr); -} - -void BtDelegateDevSecurity::HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ) -{ - Q_UNUSED(aErr); - Q_UNUSED(aDeviceArray); -} - -void BtDelegateDevSecurity::emitCommandComplete(int error) -{ - // no dialogs here since stack provides "unpaired to %1" dialog - // and failures are not reported - - emit commandCompleted(error); -} - -void BtDelegateDevSecurity::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); - Q_UNUSED(aConflicts); -} - -void BtDelegateDevSecurity::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h --- a/bluetoothengine/btui/btuidelegate/btdelegatedevsecurity.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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 BTDELEGATEDEVSECURITY_H -#define BTDELEGATEDEVSECURITY_H - -#include -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - -/*! - \class BtDelegateDevSecurity - \brief the base class for Unpairing Bluetooth Connection. - */ -class BtDelegateDevSecurity : public BtAbstractDelegate, - public MBTEngDevManObserver, public MBTEngConnObserver -{ - Q_OBJECT - -public: - explicit BtDelegateDevSecurity( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent = 0 ); - - virtual ~BtDelegateDevSecurity(); - - virtual void exec( const QVariant ¶ms ); - - virtual void cancel(); - -public slots: - void disconnectDelegateCompleted(int err); - -protected: - //From MBTEngDevManObserver - virtual void HandleDevManComplete( TInt aErr ); - virtual void HandleGetDevicesComplete( TInt aErr, CBTDeviceArray* aDeviceArray ); - //From MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - - void emitCommandComplete(int error); - -private: - - CBTEngDevMan *mBtEngDevMan; - QString mdeviceName; - CBTEngConnMan *mBtengConnMan; - BtAbstractDelegate* mDisconnectDelegate; - - Q_DISABLE_COPY(BtDelegateDevSecurity) - -}; - - -#endif /* BTDELEGATEDEVSECURITY_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedisconnect.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +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 "btdelegatedisconnect.h" -#include "btuiutil.h" -#include "btuiiconutil.h" -#include -#include -#include -#include -#include - -BtDelegateDisconnect::BtDelegateDisconnect( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0), mPhyLinks(0), - mMajorRole(0), mActiveHandling(false), mAddrArrayIndex(0), mDisconOpt(DisconUnknown) -{ - -} - -BtDelegateDisconnect::~BtDelegateDisconnect() -{ - delete mBtengConnMan; - delete mPhyLinks; - mSocketServ.Close(); -} - -void BtDelegateDisconnect::exec( const QVariant ¶ms ) -{ - int err; - if ( ! mBtengConnMan ){ - TRAP( err, mBtengConnMan = CBTEngConnMan::NewL(this) ); - } - if(err) { - emit commandCompleted(err); - return; - } - if (params.canConvert()){ - mDisconOpt = (DisconnectOption)params.toInt(); - mActiveHandling = true; - - if (mDisconOpt == AllOngoingConnections){ - err = mBtengConnMan->GetConnectedAddresses(mDevAddrArray); - disconnectAllConnections_service(); - } - if(err) { - emit commandCompleted(err); - } - } - else{ - QList paramList = params.value< QList >(); - QVariant indexVariant = paramList.at(0); - QModelIndex index = indexVariant.value(); - QVariant optionVariant = paramList.at(1); - mDisconOpt = (DisconnectOption)optionVariant.toInt(); - int error = KErrNone; - - mActiveHandling = true; - mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - mMajorRole = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); - - QString strBtAddr = getDeviceModel()->data(index,BtDeviceModel::ReadableBdaddrRole).toString(); - - // todo: address converting should be simplified. check other delegates for example. - - TPtrC ptrName(reinterpret_cast(strBtAddr.constData())); - - RBuf16 btName; - error = btName.Create(ptrName.Length()); - - if(error == KErrNone) { - btName.Copy(ptrName); - mBtEngAddr.SetReadable(btName); - if (mDisconOpt == ServiceLevel){ - disconnectSeviceLevel(); - } - else if (mDisconOpt == PhysicalLink){ - disconnectPhysicalLink(); - } - } - btName.Close(); - - if(error) { - emit commandCompleted(error); - } - } -} - - -void BtDelegateDisconnect::disconnectAllConnections_service(){ - - TBuf addrBuf; - mDevAddrArray[mAddrArrayIndex].GetReadable(addrBuf); - QString btStringAddr= QString::fromUtf16( addrBuf.Ptr(), addrBuf.Length()); - QModelIndex start = getDeviceModel()->index(0,0); - QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::ReadableBdaddrRole, btStringAddr); - QModelIndex index = indexList.at(0); - - mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - mBtEngAddr = mDevAddrArray[mAddrArrayIndex]; - mMajorRole = (index.data(BtDeviceModel::MajorPropertyRole)).toInt(); - - disconnectSeviceLevel(); -} - -void BtDelegateDisconnect::disconnectAllConnections_physical(){ - - TBuf addrBuf; - mDevAddrArray[mAddrArrayIndex].GetReadable(addrBuf); - QString btStringAddr= QString::fromUtf16( addrBuf.Ptr(), addrBuf.Length()); - QModelIndex start = getDeviceModel()->index(0,0); - QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::ReadableBdaddrRole, btStringAddr); - QModelIndex index = indexList.at(0); - - mDeviceName = getDeviceModel()->data(index,BtDeviceModel::NameAliasRole).toString(); - mBtEngAddr = mDevAddrArray[mAddrArrayIndex]; - - disconnectPhysicalLink(); - -} -void BtDelegateDisconnect::disconnectSeviceLevel(){ - int err; - TBTEngConnectionStatus connStatus = EBTEngNotConnected; - err = mBtengConnMan->IsConnected(mBtEngAddr, connStatus); - if (connStatus == EBTEngConnected){ - err = mBtengConnMan->Disconnect(mBtEngAddr, EBTDiscGraceful); - } - if(err) { - if (mDisconOpt == AllOngoingConnections){ - disconnectServiceLevelCompleted(err); - } - else{ - emit commandCompleted(err); - } - } -} - -void BtDelegateDisconnect::disconnectPhysicalLink(){ - int err; - if ( !mSocketServ.Handle() ) { - err = mSocketServ.Connect(); - } - if ( !err && !mPhyLinks ) { - TRAP( err, - mPhyLinks = CBluetoothPhysicalLinks::NewL( *this, mSocketServ ) ); - Q_CHECK_PTR( mPhyLinks ); - } - err = mPhyLinks->Disconnect( mBtEngAddr ); - if(err) { - if (mDisconOpt == AllOngoingConnections){ - disconnectPhysicalLinkCompleted(err); - } - else{ - emit commandCompleted(err); - } - } - -} - -void BtDelegateDisconnect::disconnectServiceLevelCompleted(int err){ - if (mDisconOpt == ServiceLevel){ - mActiveHandling = false; - emit commandCompleted(err); - } - else if (mDisconOpt == AllOngoingConnections){ - if (err){ - mActiveHandling = false; - emit commandCompleted(err); - } - else{ - mAddrArrayIndex++; - if ( mAddrArrayIndex < mDevAddrArray.Count()){ - disconnectAllConnections_service(); - } - else{ - mDevAddrArray.Reset(); - err = mBtengConnMan->GetConnectedAddresses(mDevAddrArray); - if(err) { - emit commandCompleted(err); - return; - } - mAddrArrayIndex = 0; - //connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectPhysicalLinkCompleted(int)) ); - disconnectAllConnections_physical(); - } - } - } -} - -void BtDelegateDisconnect::disconnectPhysicalLinkCompleted(int err){ - if (mDisconOpt == PhysicalLink){ - //emitCommandComplete(err); - mActiveHandling = false; - emit commandCompleted(err); - } - else if (mDisconOpt == AllOngoingConnections){ - if (err){ - mActiveHandling = false; - emit commandCompleted(err); - } - else{ - mAddrArrayIndex++; - if ( mAddrArrayIndex < mDevAddrArray.Count()){ - disconnectAllConnections_physical(); - } - else{ - //TODO: check if there is still ongoing connection from BTEngVonnMan. and close them again if there is any new - mActiveHandling = false; - emit commandCompleted(err); - } - } - - } - -} -void BtDelegateDisconnect::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aConflicts); - Q_UNUSED(aErr); -} - -void BtDelegateDisconnect::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - if ( mBtEngAddr != aAddr || !mActiveHandling ) { - return; - } - DisplayCommandCompleteNotif(aErr); - disconnectServiceLevelCompleted(aErr); -} - - -void BtDelegateDisconnect::cancel() -{ - -} - -void BtDelegateDisconnect::HandleCreateConnectionCompleteL( TInt err ){ - Q_UNUSED( err ); -} - -void BtDelegateDisconnect::HandleDisconnectCompleteL( TInt err ){ - if ( !mActiveHandling ) { - return; - } - disconnectPhysicalLinkCompleted(err); - -} - -void BtDelegateDisconnect::HandleDisconnectAllCompleteL( TInt err ){ - Q_UNUSED( err ); -} - -void BtDelegateDisconnect::DisplayCommandCompleteNotif(int error) -{ - - if(error == KErrNone) { - // success, show indicator with connection status - HbIcon icon = getBadgedDeviceTypeIcon( mCod, mMajorRole, 0 ); // no badging required, only icon - QString str( hbTrId("txt_bt_dpopinfo_disconnected_from_1") ); - HbNotificationDialog::launchDialog( icon, hbTrId("txt_bt_dpophead_disconnected"), - str.arg(mDeviceName) ); - } - -} - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatedisconnect.h --- a/bluetoothengine/btui/btuidelegate/btdelegatedisconnect.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +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 BTDELEGATEDISCONNECT_H -#define BTDELEGATEDISCONNECT_H - -#include -#include -#include "btqtconstants.h" -#include "btabstractdelegate.h" - -class BtuiModel; - -/*! - \class BtDelegateDisconnect - \brief the base class for Disconnecting Bluetooth Connection. - */ -class BtDelegateDisconnect : public BtAbstractDelegate, - public MBTEngConnObserver, public MBluetoothPhysicalLinksNotifier -{ - Q_OBJECT - -public: - explicit BtDelegateDisconnect( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent = 0 ); - - virtual ~BtDelegateDisconnect(); - - virtual void exec( const QVariant ¶ms ); - - virtual void cancel(); - - - -protected: - //From MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - - // from MBluetoothPhysicalLinksNotifier - virtual void HandleCreateConnectionCompleteL( TInt err ); - - virtual void HandleDisconnectCompleteL( TInt err ); - - virtual void HandleDisconnectAllCompleteL( TInt err ); - - void DisplayCommandCompleteNotif(int error); - -private: - - void disconnectAllConnections_service(); - - void disconnectAllConnections_physical(); - - void disconnectSeviceLevel(); - - void disconnectPhysicalLink(); - - void disconnectServiceLevelCompleted(int err); - - void disconnectPhysicalLinkCompleted(int err); - - - -private: - - CBTEngConnMan *mBtengConnMan; - - CBluetoothPhysicalLinks *mPhyLinks; - - int mMajorRole; - bool mActiveHandling; - - int mAddrArrayIndex; - DisconnectOption mDisconOpt; - - RBTDevAddrArray mDevAddrArray; - TBTDevAddr mBtEngAddr; - - QString mDeviceName; - int mCod; - - RSocketServ mSocketServ; - - Q_DISABLE_COPY(BtDelegateDisconnect) - -}; - - - -#endif /* BTDELEGATEDISCONNECT_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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 "btdelegatefactory.h" -#include -#include -#include "btdelegatepower.h" -#include "btdelegatedevname.h" -#include "btdelegateremotedevname.h" -#include "btdelegatevisibility.h" -#include "btdelegateinquiry.h" -#include "btdelegateconnect.h" -#include "btdelegatepair.h" -#include "btdelegatedisconnect.h" -#include "btdelegatedevsecurity.h" - -/*! - Constructor. - */ -BtAbstractDelegate * BtDelegateFactory::newDelegate( - BtDelegate::Command cmd, - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent ) -{ - switch ( cmd ) { - case BtDelegate::ManagePower: - return new BtDelegatePower( settingModel, deviceModel, parent ); - case BtDelegate::DeviceName: - return new BtDelegateDevName( parent ); - case BtDelegate::Visibility: - return new BtDelegateVisibility( parent ); - case BtDelegate::Inquiry: - return new BtDelegateInquiry( settingModel, deviceModel, parent ); - case BtDelegate::Connect: - return new BtDelegateConnect( settingModel, deviceModel, parent ); - case BtDelegate::Pair: - return new BtDelegatePair( settingModel, deviceModel, parent ); - case BtDelegate::Disconnect: - return new BtDelegateDisconnect( settingModel, deviceModel, parent ); - case BtDelegate::Unpair: - return new BtDelegateDevSecurity( settingModel, deviceModel, parent ); - case BtDelegate::RemoteDevName: - return new BtDelegateRemoteDevName( settingModel, deviceModel, parent ); - } - return 0; -} - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatefactory.h --- a/bluetoothengine/btui/btuidelegate/btdelegatefactory.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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 BTDELEGATEFACTORY_H -#define BTDELEGATEFACTORY_H - -#include -#include "btdelegateconsts.h" - -class BtAbstractDelegate; -class BtSettingModel; -class BtDeviceModel; - -#ifdef BUILD_BTUIDELEGATE -#define BTUIDELEGATE_IMEXPORT Q_DECL_EXPORT -#else -#define BTUIDELEGATE_IMEXPORT Q_DECL_IMPORT -#endif - -/*! - \class BtDelegateFactory - \brief the base class for creating concrete delegate instances - - \\sa btuidelegate - */ -class BTUIDELEGATE_IMEXPORT BtDelegateFactory -{ - -public: - static BtAbstractDelegate *newDelegate( - BtDelegate::Command cmd, - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent = 0 ); - -}; - -#endif // BTDELEGATEFACTORY_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateinquiry.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegateinquiry.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +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 "btdelegateinquiry.h" -#include "btdelegatefactory.h" -#include "btqtconstants.h" - -#include -#include -#include - - -BtDelegateInquiry::BtDelegateInquiry( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject* parent ) - :BtAbstractDelegate( settingModel, deviceModel, parent ) -{ - mAbstractDelegate = NULL; -} - -BtDelegateInquiry::~BtDelegateInquiry() -{ - -} - -void BtDelegateInquiry::exec( const QVariant& params ) -{ - Q_UNUSED(params); - - if(isBtPowerOn()) { - exec_inquiry(); - } - else { - //If Bt Power is off, switch it on and then perform pairing. - //todo: Do we ask for user confirmation here..? - if (!mAbstractDelegate) { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, - getSettingModel(), getDeviceModel() ); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); - mAbstractDelegate->exec(QVariant(BtPowerOn)); - } - } -} - -void BtDelegateInquiry::powerDelegateCompleted(int error) -{ - if (mAbstractDelegate) { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - if ( error == KErrNone ) { - exec_inquiry(); - } - else { - // error - emit commandCompleted(error); - } -} - -void BtDelegateInquiry::exec_inquiry() -{ - bool err = getDeviceModel()->searchDevice(); - - emit commandCompleted(err); // in case of error, passing original error back -} - -void BtDelegateInquiry::cancel() -{ - getDeviceModel()->cancelSearchDevice(); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateinquiry.h --- a/bluetoothengine/btui/btuidelegate/btdelegateinquiry.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 BTDELEGATEINQUIRY_H -#define BTDELEGATEINQUIRY_H - -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - - -class BtDelegateInquiry : public BtAbstractDelegate -{ - Q_OBJECT - -public: - explicit BtDelegateInquiry( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject* parent = 0 ); - - virtual ~BtDelegateInquiry(); - - virtual void exec( const QVariant ¶ms ); - - virtual void cancel(); - -public slots: - void powerDelegateCompleted(int error); - -private: - void exec_inquiry(); - -private: - BtAbstractDelegate* mAbstractDelegate; - -}; - -#endif /* BTDELEGATEINQUIRY_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatepair.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatepair.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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 "btdelegatepair.h" -#include "btuiutil.h" -#include "btdelegatefactory.h" -#include "btqtconstants.h" - -#include -#include -#include -#include -#include -#include -#include - -// docml to load -const char* BTUI_PAIR_WAIT_DOCML = ":/docml/pairwaitingdialog.docml"; - -BtDelegatePair::BtDelegatePair( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, - QObject *parent) : - BtAbstractDelegate(settingModel, deviceModel, parent), mBtengConnMan(0) -{ - mLoader = new HbDocumentLoader(); - mAbstractDelegate = NULL; -} - -BtDelegatePair::~BtDelegatePair() -{ - delete mBtengConnMan; - delete mLoader; -} - -void BtDelegatePair::exec( const QVariant ¶ms ) -{ - - deviceIndex = params.value(); - - if(isBtPowerOn()) { - exec_pair(); - } - else { - //If Bt Power is off, switch it on and then perform pairing. - //todo: Do we ask for user confirmation here..? - if (!mAbstractDelegate) { - mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, - getSettingModel(), getDeviceModel() ); - connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) ); - mAbstractDelegate->exec(QVariant(BtPowerOn)); - } - } - -} - -void BtDelegatePair::powerDelegateCompleted(int error) -{ - if (mAbstractDelegate) { - disconnect(mAbstractDelegate); - delete mAbstractDelegate; - mAbstractDelegate = 0; - } - if ( error == KErrNone ) { - exec_pair(); - } - else { - // error - emitCommandComplete(error); - } -} - -void BtDelegatePair::exec_pair() -{ - int error = KErrNone; - mdeviceName = getDeviceModel()->data(deviceIndex,BtDeviceModel::NameAliasRole).toString(); - - QString strBtAddr = getDeviceModel()->data(deviceIndex,BtDeviceModel::ReadableBdaddrRole).toString(); - int cod = getDeviceModel()->data(deviceIndex,BtDeviceModel::CoDRole).toInt(); - - if ( ! mBtengConnMan ){ - TRAP( error, mBtengConnMan = CBTEngConnMan::NewL(this) ); - } - - if ( !error ) { - TBTDevAddr btEngddr; - addrReadbleStringToSymbian( strBtAddr, btEngddr ); - TBTDeviceClass btEngDeviceClass(cod); - error = mBtengConnMan->PairDevice(btEngddr, btEngDeviceClass); - launchWaitDialog(); - } - - if(error) { - emitCommandComplete(error); - } - -} - - -void BtDelegatePair::launchWaitDialog() -{ - QString headingText(hbTrId("txt_bt_title_pairing_with_1")); - HbLabel *heading; - HbProgressBar* progressBar; - - bool ok = false; - mLoader->load( BTUI_PAIR_WAIT_DOCML, &ok ); - // Exit if the file format is invalid - BTUI_ASSERT_X( ok, "BTUI_PAIR_WAIT_DOCML", "Invalid docml file" ); - - mWaitDialog = qobject_cast( mLoader->findWidget( "dialog" ) ); - BTUI_ASSERT_X( mWaitDialog != 0, "BTUI_PAIR_WAIT_DOCML", "dialog not found" ); - - heading = qobject_cast( mLoader->findWidget( "heading" ) ); - BTUI_ASSERT_X( heading != 0, "BTUI_PAIR_WAIT_DOCML", "heading not found" ); - - progressBar = qobject_cast( mLoader->findWidget( "progressBar" ) ); - BTUI_ASSERT_X( progressBar != 0, "BTUI_PAIR_WAIT_DOCML", "progressBar not found" ); - progressBar->setRange(0,0); - - heading->setPlainText(headingText.arg(mdeviceName)); - - mWaitDialog->setDismissPolicy(HbPopup::NoDismiss); - mWaitDialog->setTimeout(HbPopup::NoTimeout); - - mWaitDialog->show(); -} - -void BtDelegatePair::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); - Q_UNUSED(aConflicts); - -} - -void BtDelegatePair::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} - -void BtDelegatePair::PairingComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - - mWaitDialog->close(); - emitCommandComplete(aErr); -} - -void BtDelegatePair::emitCommandComplete(int error) -{ - - emit commandCompleted(error); -} - -void BtDelegatePair::cancel() -{ - if ( mBtengConnMan ) { - mBtengConnMan->CancelPairDevice(); - } -} - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatepair.h --- a/bluetoothengine/btui/btuidelegate/btdelegatepair.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +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 BTDELEGATEPAIR_H -#define BTDELEGATEPAIR_H - -#include -#include -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - -/*! - \class BtDelegatePair - \brief the base class for handling Bluetooth Pair functionality. - */ -class BtDelegatePair : public BtAbstractDelegate, - public MBTEngConnObserver -{ - Q_OBJECT - -public: - explicit BtDelegatePair( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent = 0 ); - - virtual ~BtDelegatePair(); - - virtual void exec( const QVariant ¶ms ); - - virtual void cancel(); - -public slots: - void powerDelegateCompleted(int error); -protected: - //From MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); - -private: - void launchWaitDialog(); - void emitCommandComplete(int error); - void exec_pair(); - -private: - - CBTEngConnMan *mBtengConnMan; - HbDialog *mWaitDialog; - QString mdeviceName; - - HbDocumentLoader *mLoader; - BtAbstractDelegate* mAbstractDelegate; - QModelIndex deviceIndex; - - Q_DISABLE_COPY(BtDelegatePair) - -}; - -#endif /* BTDELEGATEPAIR_H */ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatepower.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatepower.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,284 +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 "btdelegatepower.h" -#include "btqtconstants.h" -#include -#include -#include -#include -#include -#include -#include - -/*! - Constructor. - */ -BtDelegatePower::BtDelegatePower( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent ) - : BtAbstractDelegate( settingModel, deviceModel, parent ), - mDisconnectDelegate(0) -{ - TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) ); - Q_CHECK_PTR( mBtengSettings ); - mActiveHandling = false; -} - -/*! - Destructor. - */ -BtDelegatePower::~BtDelegatePower() -{ - delete mDisconnectDelegate; - delete mBtengSettings; -} - -/*! - Turns BT power on/off - param powerState is the desired power state and is of type PowerStateQtValue - */ -void BtDelegatePower::exec( const QVariant &powerState ) -{ - mReqPowerState = BtEngPowerState((PowerStateQtValue)powerState.toInt()); - BTUI_ASSERT_X( (mReqPowerState == EBTPowerOff) || (mReqPowerState == EBTPowerOn), - "BtDelegatePower::exec()", "wrong power state value" ); - - // get current power status - TBTPowerStateValue curPowerState(EBTPowerOff); - mBtengSettings->GetPowerState( curPowerState ); - - // verify requested power is not the same as current status - if ( mReqPowerState == curPowerState ) { - // no need to do anything - emit commandCompleted( KErrNone ); - return; - } - - // perform power on/off operation - if ( mReqPowerState == EBTPowerOff ){ - switchBTOff(); - } - else if ( mReqPowerState == EBTPowerOn ) { - switchBTOn(); - } -} - - - -void BtDelegatePower::switchBTOn() -{ - int err = 0; - - //check if device is in OFFLINE mode first - bool btEnabledInOffline = false; - if (checkOfflineMode(btEnabledInOffline)){ // offline mode is active - if (btEnabledInOffline){ - // BT is allowed to be enabled in offline mode, show query. - HbMessageBox::question( hbTrId("txt_bt_info_trun_bluetooth_on_ini_offline_mode" ),this, - SLOT(btOnQuestionClose(int)), HbMessageBox::Yes | HbMessageBox::No ); - - } - else{ - //if BT is not allowed to be enabled in offline mode, show message and complete - HbMessageBox::warning( hbTrId("txt_bt_info_bluetooth_not_allowed_to_be_turned_on" ),this, - SLOT(btOnWarningClose())); - } - - } - else { // offline mode is not active - mActiveHandling = true; - err = mBtengSettings->SetPowerState(EBTPowerOn); - } - - if ( err ) { - //TODO: handle the error here - emit commandCompleted(KErrGeneral); - } - -} - -void BtDelegatePower::btOnQuestionClose(int action) -{ - int err = 0; - if(action == HbMessageBox::Yes) - { - //user chooses "yes" for using BT in offline - mActiveHandling = true; - err = mBtengSettings->SetPowerState(EBTPowerOn); - } - else - { - //if user chooses "NO", emits the signal - emit commandCompleted(KErrNone); - - } - if ( err ) { - //TODO: handle the error here - emit commandCompleted(KErrGeneral); - } -} - -void BtDelegatePower::btOnWarningClose() -{ - emit commandCompleted(KErrNone); -} - - - -void BtDelegatePower::switchBTOff() -{ - int err = 0; - - CBTEngConnMan *btengConnMan = 0; - TRAP(err, btengConnMan = CBTEngConnMan::NewL(this)); - Q_CHECK_PTR( btengConnMan ); - RBTDevAddrArray devAddrArray; - err = btengConnMan->GetConnectedAddresses(devAddrArray); - if ( err != KErrNone) { - //TODO: handle the error here - emit commandCompleted(err); - return; - } - int count = devAddrArray.Count(); - devAddrArray.Close(); - delete btengConnMan; - if( count> 0 ){ - mActiveHandling = true; - disconnectOngoingConnections(); - } - else{ - mActiveHandling = true; - err = mBtengSettings->SetPowerState(EBTPowerOff); - - if ( err ) { - //TODO: handle the error here - emit commandCompleted(KErrGeneral); - } - - } -} -/* -void BtDelegatePower::btOffDialogClose(HbAction *action) -{ - HbMessageBox *dlg = static_cast(sender()); - if(action == dlg->actions().at(0)) - { - //user chooses "yes" for closing active connection before power off - mActiveHandling = true; - disconnectOngoingConnections(); - } - else - { - //if user chooses "NO", emits the signal - emit commandCompleted(KErrNone); - - } - -} -*/ -void BtDelegatePower::disconnectOngoingConnections(){ - if (! mDisconnectDelegate){ - mDisconnectDelegate = BtDelegateFactory::newDelegate( - BtDelegate::Disconnect, getSettingModel(), getDeviceModel()); - connect( mDisconnectDelegate, SIGNAL(commandCompleted(int)), this, SLOT(disconnectDelegateCompleted(int)) ); - - - DisconnectOption discoOpt = AllOngoingConnections; - QVariant param; - param.setValue((int)discoOpt); - mDisconnectDelegate->exec(param); - } -} - -void BtDelegatePower::disconnectDelegateCompleted(int err) -{ - Q_UNUSED( err ); - //TODO: handle the return error here - - int error = mBtengSettings->SetPowerState(EBTPowerOff); - if ( error ) { - //TODO: handle the error here - emit commandCompleted(KErrGeneral); - } - - -} - - -void BtDelegatePower::PowerStateChanged( TBTPowerStateValue aPowerState ) -{ - // It is possible that others change power: no handling for these cases. - if ( !mActiveHandling ) { - return; - } - mActiveHandling = false; - - if ( mReqPowerState == aPowerState ) { - // power state changed successfully - emit commandCompleted( KErrNone ); - } - else { - // the actual power state is not the same as we requested, - // command failed: - // ToDo: show error note? - emit commandCompleted( KErrGeneral ); - } -} - -//Method derived from MBTEngSettingsObserver, no need to be implemented here -void BtDelegatePower::VisibilityModeChanged( TBTVisibilityMode aState ) -{ - Q_UNUSED( aState ); -} - -void BtDelegatePower::ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); - Q_UNUSED(aConflicts); - /* - if ( mBtEngAddr != aAddr ) { // callback coming for some other device - return; - } - emitCommandComplete(aErr); - */ -} - -void BtDelegatePower::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ) -{ - Q_UNUSED(aAddr); - Q_UNUSED(aErr); -} - -/*! - Returns true if offline mode is on, parameter returns true if BT is allowed - in offline mode - */ -bool BtDelegatePower::checkOfflineMode(bool& btEnabledInOffline) -{ - TCoreAppUIsNetworkConnectionAllowed offLineMode; - TBTEnabledInOfflineMode btEnabled; - - mBtengSettings->GetOfflineModeSettings(offLineMode, btEnabled); - - btEnabledInOffline = (btEnabled == EBTEnabledInOfflineMode); - return (offLineMode == ECoreAppUIsNetworkConnectionNotAllowed); -} - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatepower.h --- a/bluetoothengine/btui/btuidelegate/btdelegatepower.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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 BTDELEGATEPOWER_H -#define BTDELEGATEPOWER_H - -#include -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; -class HbAction; - -/*! - \class BtDelegatePower - \brief the base class for handling Bluetooth power management. - - \\sa btuidelegate - */ -class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver, - public MBTEngConnObserver -{ - Q_OBJECT - -public: - explicit BtDelegatePower( - BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent = 0 ); - - virtual ~BtDelegatePower(); - - virtual void exec( const QVariant ¶ms ); - - //from MBTEngSettingsObserver - - virtual void PowerStateChanged( TBTPowerStateValue aState ); - - virtual void VisibilityModeChanged( TBTVisibilityMode aState ); - -public slots: - void btOnQuestionClose(int action); - - void btOnWarningClose(); - - void disconnectDelegateCompleted(int err); - - -protected: - //From MBTEngConnObserver - virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr, - RBTDevAddrArray* aConflicts ); - virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr ); - - -private: - void switchBTOn(); - - void switchBTOff(); - - bool checkOfflineMode(bool& btEnabledInOffline); - - void disconnectOngoingConnections(); - - -private: - CBTEngSettings* mBtengSettings; - bool mActiveHandling; - TBTPowerStateValue mReqPowerState; - - BtAbstractDelegate* mDisconnectDelegate; - - -private: - - Q_DISABLE_COPY(BtDelegatePower) - -}; - -#endif // BTDELEGATEPOWER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +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 "btdelegateremotedevname.h" -#include -#include -#include -#include -#include -#include "btuidevtypemap.h" - - -BtDelegateRemoteDevName::BtDelegateRemoteDevName(BtSettingModel* settingModel, - BtDeviceModel* deviceModel,QObject *parent ) - :BtAbstractDelegate( settingModel, deviceModel, parent ), mRegistryActive(0), mRegistryOpened(false) -{ - -} - -BtDelegateRemoteDevName::~BtDelegateRemoteDevName() -{ - delete mRegistryActive; - mSymName.Close(); - if (mRegistryOpened) - mBtRegistry.Close();//there is crash is close the btregistry without opening it first - mBtRegServ.Close(); -} - -/*! - Validate the bluetooth device name given by the user: - Extra spaces (' ', '\n', '\t' and '\r') from the beginning, - middle and the end of the name are always removed; - the maximum lengthof a name is 30. - - TODO:Add duplicate name checking. If the new name duplicates - existing name in registry, prompt user to change the name - */ - -bool BtDelegateRemoteDevName::validateName(QString &name ) -{ - // remove spaces at the beginning and end: - name = name.trimmed(); - // regular expression of one or more consecutive spaces: - QRegExp rx("[ \n\t\r]+"); - name.replace( rx, " "); - if (name.length() > 30 ) { - name.resize( 30 ); - } - return name.length() > 0; -} - -void BtDelegateRemoteDevName::exec( const QVariant ¶ms ) -{ - QList paramList = params.value< QList >(); - QVariant indexVariant = paramList.at(0); - QModelIndex index = indexVariant.value(); - QVariant nameVariant = paramList.at(1); - QString btRemoteDevName = nameVariant.toString(); - - if (!validateName(btRemoteDevName)){ - emit commandCompleted(KErrBadName); - return; - } - mNewName = btRemoteDevName; - /* - QModelIndex start = getDeviceModel()->index(0,0); - QModelIndexList indexList = getDeviceModel()->match(start,BtDeviceModel::NameAliasRole, mNewName); - if (indexList.size() > 1){ - emit commandCompleted(KErrBadName, mNewName); - return; - } - */ - int error = KErrNone; - TPtrC ptrName(reinterpret_cast(btRemoteDevName.constData())); - - error = mSymName.Create(ptrName.Length()); - - // todo (review comment): missing proper exception handling. - if(error == KErrNone) { - mSymName.Copy(ptrName); - } - else{ - emit commandCompleted(error,mNewName); - return; - } - - QString strBtAddr = getDeviceModel()->data(index, - BtDeviceModel::ReadableBdaddrRole).toString(); - - TBuf buffer(strBtAddr.utf16()); - mSymaddr.SetReadable( buffer ); - - error = mBtRegServ.Connect(); - if ( error != KErrNone && error != KErrAlreadyExists) { - emit commandCompleted(error,mNewName); - return; - } - - error = mBtRegistry.Open( mBtRegServ ) ; - if ( error != KErrNone && error != KErrAlreadyExists) { - emit commandCompleted(error,mNewName); - return; - } - mRegistryOpened = true; - - if (!mRegistryActive){ - RequestIdentifiers requestId = Unknown; - TRAP(error, mRegistryActive = CBtSimpleActive::NewL( - *this, requestId)); - if(error!=KErrNone) { - emit commandCompleted(KErrGeneral); - return; - } - } - //first check if this device is already in the registry - - int majorRole = (getDeviceModel()->data(index,BtDeviceModel::MajorPropertyRole)).toInt(); - int cod = (getDeviceModel()->data(index,BtDeviceModel::CoDRole)).toInt(); - if (!(majorRole & BtuiDevProperty::InRegistry)) { - CBTDevice *symBtDevice; - TRAP( error, { - symBtDevice = CBTDevice::NewL( mSymaddr ); - symBtDevice->SetDeviceClass(cod); - RequestIdentifiers requestId = AddDevice; - mRegistryActive->SetRequestId(requestId); - mBtRegistry.AddDeviceL(*symBtDevice, mRegistryActive->iStatus); - mRegistryActive->GoActive(); - }); - - } - else{ - RequestIdentifiers requestId = ModifyFriendlyName; - mRegistryActive->SetRequestId(requestId); - TRAP( error, { - mBtRegistry.ModifyFriendlyDeviceNameL(mSymaddr, mSymName, mRegistryActive->iStatus); - mRegistryActive->GoActive(); - }); - } - if ( error != KErrNone ) { - emit commandCompleted(error,mNewName); - } - -} - -void BtDelegateRemoteDevName::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ){ - - if(aStatus != KErrNone){ - emit commandCompleted(aStatus, mNewName); - return; - } - int error = KErrNone; - if ( aActive->RequestId() == AddDevice ){ - RequestIdentifiers requestId = ModifyFriendlyName; - mRegistryActive->SetRequestId(requestId); - TRAP( error, { - mBtRegistry.ModifyFriendlyDeviceNameL(mSymaddr, mSymName, mRegistryActive->iStatus); - mRegistryActive->GoActive(); - }); - if(error != KErrNone){ - emit commandCompleted(error, mNewName); - } - } - else if ( aActive->RequestId() == ModifyFriendlyName ){ - emit commandCompleted(error, mNewName); - } - -} - -void BtDelegateRemoteDevName::CancelRequest( TInt aRequestId ){ - if ( aRequestId == 1 ){ - mBtRegistry.CancelRequest(mRegistryActive->RequestStatus()); - emit commandCompleted(KErrCancel, mNewName); - } - -} - -void BtDelegateRemoteDevName::HandleError( CBtSimpleActive* aActive, TInt aError ){ - //TODO: handle the error here - Q_UNUSED( aActive ); - Q_UNUSED( aError ); - emit commandCompleted(KErrGeneral,mNewName); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h --- a/bluetoothengine/btui/btuidelegate/btdelegateremotedevname.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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 BTDELEGATEREMOTEDEVNAME_H -#define BTDELEGATEREMOTEDEVNAME_H - -#include -#include -//#include -//#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - -enum RequestIdentifiers { - Unknown = 0, // using a different number space than TBTVisibilityMode - AddDevice, - ModifyFriendlyName -}; - -/*! - \class BtDelegateRemoteDevName - \brief the base class for handling Bluetooth Local Name. - */ -class BtDelegateRemoteDevName : public BtAbstractDelegate, public MBtSimpleActiveObserver -{ - Q_OBJECT - -public: - explicit BtDelegateRemoteDevName( BtSettingModel* settingModel, - BtDeviceModel* deviceModel, QObject *parent = 0 ); - - virtual ~BtDelegateRemoteDevName(); - - virtual void exec( const QVariant ¶ms ); - - // from MBtSimpleActiveObserver - virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ); - - virtual void CancelRequest( TInt aRequestId ); - - virtual void HandleError( CBtSimpleActive* aActive, TInt aError ); - - -private: - bool validateName(QString &name ); - - RBTRegistry mBtRegistry; - - RBTRegServ mBtRegServ; - - CBtSimpleActive* mRegistryActive; - - QString mNewName; - - RBuf16 mSymName; - - TBTDevAddr mSymaddr; - - bool mRegistryOpened; - - -private: - - Q_DISABLE_COPY(BtDelegateRemoteDevName) - -}; - -#endif // BTDELEGATEREMOTEDEVNAME_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp --- a/bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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: Delegate class for setting visibility mode -* -*/ - - -#include "btdelegatevisibility.h" -#include -#include -#include -#include "btqtconstants.h" -#include - -const int MAX_TEMPORARY_VISIBILITY = 60; // minutes, this value comes from the UI spec - -/*! - Constructor. - */ -BtDelegateVisibility::BtDelegateVisibility( - QObject *parent ) - : BtAbstractDelegate( NULL, NULL, parent ) -{ - TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) ); - Q_CHECK_PTR( mBtengSettings ); - mActiveHandling = false; -} - -/*! - Destructor. - */ -BtDelegateVisibility::~BtDelegateVisibility() -{ - delete mBtengSettings; -} -/*! - * executes visibility delegate functionality, ie. calls CBTEngSettings to set the visibility mode; - * when operation completes, emits commandCompleted signal - * Parameters: Qlist where first item is VisibilityMode integer specifying operation; - * for BtTemporary a 2nd parameter is give which signifies the number of minutes to stay visible. - */ -void BtDelegateVisibility::exec( const QVariant ¶ms ) -{ - int minutes, err = 0; - - if (mActiveHandling) { - // complete command with error - emit commandCompleted(KErrInUse); - return; - } - mActiveHandling = true; - - // read 1st parameter - BTUI_ASSERT_X(params.toList().at(0).isValid(), "BtDelegateVisibility::exec", "invalid parameter"); - VisibilityMode btQtMode = (VisibilityMode)params.toList().at(0).toInt(); - mOperation = BtEngVisibilityMode(btQtMode); - - // verify that we are setting visibility to a new value, otherwise we won't get a callback - TBTVisibilityMode visibilityMode( EBTVisibilityModeNoScans ); - err = mBtengSettings->GetVisibilityMode( visibilityMode ); - if (err) { - mActiveHandling = false; - emit commandCompleted(err); - return; - } - if (visibilityMode == mOperation) { - mActiveHandling = false; - emit commandCompleted(KErrNone); - return; - } - - switch (mOperation) { - case EBTVisibilityModeGeneral : - err = mBtengSettings->SetVisibilityMode(mOperation, 0); - break; - case EBTVisibilityModeHidden: - err = mBtengSettings->SetVisibilityMode(mOperation, 0); - break; - case EBTVisibilityModeTemporary: - BTUI_ASSERT_X(params.toList().at(1).isValid(), "BtDelegateVisibility::exec", "invalid time parameter"); - minutes = params.toList().at(1).toInt(); - BTUI_ASSERT_X(((minutes >= 0 ) && (minutes <= MAX_TEMPORARY_VISIBILITY)), - "BtDelegateVisibility::exec", "invalid time parameter"); - err = mBtengSettings->SetVisibilityMode(mOperation, minutes); - break; - default: - // error - BTUI_ASSERT_X(false, "BtDelegateVisibility::exec", "invalid parameter"); - } - if (err) { - // complete command with error - mActiveHandling = false; - emit commandCompleted(err); - } -} - -void BtDelegateVisibility::PowerStateChanged( TBTPowerStateValue aState ) -{ - Q_UNUSED( aState ); -} - -/*! - * callback from BtEngine - * emits command complete with either: - * 1) KErrUnknown if something went wrong, or - * 2) KErrNone if everything ok - */ -void BtDelegateVisibility::VisibilityModeChanged( TBTVisibilityMode aState ) -{ - if (mActiveHandling) { - //Error handling has to be done, if value is not set properly. - mActiveHandling = false; - if (mOperation == aState) { - emit commandCompleted(KErrNone); - } - else { - emit commandCompleted(KErrUnknown); - } - } -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btdelegatevisibility.h --- a/bluetoothengine/btui/btuidelegate/btdelegatevisibility.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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 BTDELEGATEVISIBILITY_H -#define BTDELEGATEVISIBILITY_H - -#include -#include -#include "btabstractdelegate.h" - -class BtuiModel; - -/*! - \class BtDelegateVisibility - \brief the base class for handling Bluetooth visibility management. - - \\sa btuidelegate - */ -class BtDelegateVisibility : public BtAbstractDelegate, public MBTEngSettingsObserver -{ - Q_OBJECT - -public: - explicit BtDelegateVisibility( QObject *parent = 0 ); - - virtual ~BtDelegateVisibility(); - - virtual void exec( const QVariant ¶ms ); - - - -public slots: - -private: - - virtual void PowerStateChanged( TBTPowerStateValue aState ); - virtual void VisibilityModeChanged( TBTVisibilityMode aState ); - -private: - CBTEngSettings* mBtengSettings; - bool mActiveHandling; - TBTVisibilityMode mOperation; - -private: - - Q_DISABLE_COPY(BtDelegateVisibility) - -}; - -#endif // BTDELEGATEVISIBILITY_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btuidelegate.pro --- a/bluetoothengine/btui/btuidelegate/btuidelegate.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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: -# - -TEMPLATE = lib -TARGET = btuidelegate -MOC_DIR = moc -DEFINES += BUILD_BTUIDELEGATE -INCLUDEPATH += . \ - ../inc - -RESOURCES += btuidelegate.qrc - -CONFIG += qt \ - hb \ - dll -HEADERS += btdelegateconsts.h \ - btdelegatepower.h \ - btdelegatefactory.h \ - btabstractdelegate.h \ - btdelegatevisibility.h \ - btdelegatedevname.h \ - btdelegateinquiry.h \ - btdelegateconnect.h \ - btdelegatepair.h \ - btdelegatedisconnect.h \ - btdelegatedevsecurity.h \ - btdelegateremotedevname.h - -SOURCES += btdelegatepower.cpp \ - btdelegatefactory.cpp \ - btabstractdelegate.cpp \ - btdelegatevisibility.cpp \ - btdelegatedevname.cpp \ - btdelegateinquiry.cpp \ - btdelegateconnect.cpp \ - btdelegatepair.cpp \ - btdelegatedisconnect.cpp \ - btdelegatedevsecurity.cpp \ - btdelegateremotedevname.cpp - -defFilePath = . - -symbian: { - SYMBIAN_PLATFORMS = WINSCW \ - ARMV5 - BLD_INF_RULES.prj_exports += "btdelegatefactory.h |../inc/btdelegatefactory.h" - BLD_INF_RULES.prj_exports += "btabstractdelegate.h |../inc/btabstractdelegate.h" - BLD_INF_RULES.prj_exports += "btdelegateconsts.h |../inc/btdelegateconsts.h" - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0xEE02434F - TARGET.CAPABILITY = CAP_GENERAL_DLL - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - LIBS += -lbtengsettings \ - -lbtserviceutil \ - -lbtdevice \ - -lbtmanclient \ - -lesock \ - -lbluetooth \ - -lbtengdevman \ - -lbtengconnman \ - -lcentralrepository \ - -lflogger \ - -lbtuimodel - //MMP_RULES -= EXPORTUNFROZEN -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/btuidelegate.qrc --- a/bluetoothengine/btui/btuidelegate/btuidelegate.qrc Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ - - - docml/pairwaitingdialog.docml - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/bwins/btuidelegateu.def --- a/bluetoothengine/btui/btuidelegate/bwins/btuidelegateu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -EXPORTS - ?qt_metacall@BtAbstractDelegate@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int BtAbstractDelegate::qt_metacall(enum QMetaObject::Call, int, void * *) - ??1BtAbstractDelegate@@UAE@XZ @ 2 NONAME ; BtAbstractDelegate::~BtAbstractDelegate(void) - ?metaObject@BtAbstractDelegate@@UBEPBUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const * BtAbstractDelegate::metaObject(void) const - ?tr@BtAbstractDelegate@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString BtAbstractDelegate::tr(char const *, char const *, int) - ?newDelegate@BtDelegateFactory@@SAPAVBtAbstractDelegate@@W4Command@BtDelegate@@PAVBtSettingModel@@PAVBtDeviceModel@@PAVQObject@@@Z @ 5 NONAME ; class BtAbstractDelegate * BtDelegateFactory::newDelegate(enum BtDelegate::Command, class BtSettingModel *, class BtDeviceModel *, class QObject *) - ?tr@BtAbstractDelegate@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString BtAbstractDelegate::tr(char const *, char const *) - ?qt_metacast@BtAbstractDelegate@@UAEPAXPBD@Z @ 7 NONAME ; void * BtAbstractDelegate::qt_metacast(char const *) - ?getStaticMetaObject@BtAbstractDelegate@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & BtAbstractDelegate::getStaticMetaObject(void) - ??0BtAbstractDelegate@@QAE@PAVBtSettingModel@@PAVBtDeviceModel@@PAVQObject@@@Z @ 9 NONAME ; BtAbstractDelegate::BtAbstractDelegate(class BtSettingModel *, class BtDeviceModel *, class QObject *) - ?staticMetaObject@BtAbstractDelegate@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const BtAbstractDelegate::staticMetaObject - ??_EBtAbstractDelegate@@UAE@I@Z @ 11 NONAME ; BtAbstractDelegate::~BtAbstractDelegate(unsigned int) - ?commandCompleted@BtAbstractDelegate@@IAEXHVQVariant@@@Z @ 12 NONAME ; void BtAbstractDelegate::commandCompleted(int, class QVariant) - ?cancel@BtAbstractDelegate@@UAEXXZ @ 13 NONAME ; void BtAbstractDelegate::cancel(void) - ?trUtf8@BtAbstractDelegate@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString BtAbstractDelegate::trUtf8(char const *, char const *) - ?getSettingModel@BtAbstractDelegate@@IAEPAVBtSettingModel@@XZ @ 15 NONAME ; class BtSettingModel * BtAbstractDelegate::getSettingModel(void) - ?getDeviceModel@BtAbstractDelegate@@IAEPAVBtDeviceModel@@XZ @ 16 NONAME ; class BtDeviceModel * BtAbstractDelegate::getDeviceModel(void) - ?trUtf8@BtAbstractDelegate@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString BtAbstractDelegate::trUtf8(char const *, char const *, int) - ?isBtPowerOn@BtAbstractDelegate@@IAE_NXZ @ 18 NONAME ; bool BtAbstractDelegate::isBtPowerOn(void) - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/docml/pairwaitingdialog.docml --- a/bluetoothengine/btui/btuidelegate/docml/pairwaitingdialog.docml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuidelegate/eabi/btuidelegateu.def --- a/bluetoothengine/btui/btuidelegate/eabi/btuidelegateu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -EXPORTS - _ZN17BtDelegateFactory11newDelegateEN10BtDelegate7CommandEP14BtSettingModelP13BtDeviceModelP7QObject @ 1 NONAME - _ZN18BtAbstractDelegate11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN18BtAbstractDelegate11qt_metacastEPKc @ 3 NONAME - _ZN18BtAbstractDelegate14getDeviceModelEv @ 4 NONAME - _ZN18BtAbstractDelegate15getSettingModelEv @ 5 NONAME - _ZN18BtAbstractDelegate16commandCompletedEi8QVariant @ 6 NONAME - _ZN18BtAbstractDelegate16staticMetaObjectE @ 7 NONAME DATA 16 - _ZN18BtAbstractDelegate19getStaticMetaObjectEv @ 8 NONAME - _ZN18BtAbstractDelegate6cancelEv @ 9 NONAME - _ZN18BtAbstractDelegateC2EP14BtSettingModelP13BtDeviceModelP7QObject @ 10 NONAME - _ZN18BtAbstractDelegateD0Ev @ 11 NONAME - _ZN18BtAbstractDelegateD1Ev @ 12 NONAME - _ZN18BtAbstractDelegateD2Ev @ 13 NONAME - _ZNK18BtAbstractDelegate10metaObjectEv @ 14 NONAME - _ZTI18BtAbstractDelegate @ 15 NONAME - _ZTV18BtAbstractDelegate @ 16 NONAME - _ZN18BtAbstractDelegate11isBtPowerOnEv @ 17 NONAME - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btdevicemodel.cpp --- a/bluetoothengine/btui/btuimodel/btdevicemodel.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +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 -#include "btdevicemodel_p.h" -#include "bluetoothuitrace.h" - -/*! - This Constructor creates new instances of model data structure. - */ -BtDeviceModel::BtDeviceModel( QObject *parent ) - : QAbstractItemModel( parent ) -{ - d = QSharedPointer( new BtDeviceModelPrivate( *this ) ); - connectModelSignals(); -} - -/*! - This Constructor shares the private implementation of the device model. - */ -BtDeviceModel::BtDeviceModel( const BtDeviceModel &model, QObject *parent ) - : QAbstractItemModel( parent ) -{ - d = model.d; - connectModelSignals(); -} - -/*! - Destructor. - */ -BtDeviceModel::~BtDeviceModel() -{ -} - -/*! - Requests the model to searching Bluetooth devices. - \return true if the request is accepted; false otherwise - */ -bool BtDeviceModel::searchDevice() -{ - return d->searchDevice(); -} - -/*! - Cancels a possible outstanding device search request. - */ -void BtDeviceModel::cancelSearchDevice() -{ - d->cancelSearchDevice(); -} - -/*! - Removes transient (not-in-registry) devices - which were added as the result of device search. - */ -void BtDeviceModel::removeTransientDevices() -{ - d->removeTransientDevices(); -} - -/*! - \reimp - */ -QModelIndex BtDeviceModel::index( int row, int column, const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - if ( d->isValid( row, column ) ) { - return createIndex( row, column, d.data() ); - } - // invalid row and column: - return QModelIndex(); -} - -/*! - \reimp - */ -QModelIndex BtDeviceModel::parent( const QModelIndex &child ) const -{ - Q_UNUSED( child ); - // root level, no parent. - return QModelIndex(); -} - -/*! - \reimp - */ -int BtDeviceModel::rowCount( const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - return d->rowCount(); -} - -/*! - \reimp - */ -int BtDeviceModel::columnCount( const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - return d->columnCount(); -} - -/*! - \reimp - */ -QVariant BtDeviceModel::data( const QModelIndex &index, int role ) const -{ - QVariant val( QVariant::Invalid ); - d.data()->data( val, index.row(), index.column(), role ); - return val; -} - -QMap BtDeviceModel::itemData( const QModelIndex & index ) const -{ - return d.data()->itemData( index.row(), index.column() ); -} - - -/*! - emits dataChanged signal. - */ -void BtDeviceModel::deviceDataChanged( int row, void *parent ) -{ - QModelIndex idx = createIndex( row, 0, parent ); - emit dataChanged( idx, idx ); -} - -/*! - emits dataChanged signal. - */ -void BtDeviceModel::deviceDataChanged( int first, int last, void *parent ) -{ - QModelIndex top = createIndex( first, 0, parent ); - QModelIndex bottom = createIndex( last, 0, parent ); - emit dataChanged( top, bottom ); -} - -/*! - call beginInsertRows. - */ -void BtDeviceModel::beginInsertDevices(int first, int last, void *parent) -{ - Q_UNUSED( parent); - beginInsertRows(QModelIndex(), first, last); -} - -/*! - calls endInsertRows. - */ -void BtDeviceModel::BtDeviceModel::endInsertDevices() -{ - endInsertRows(); -} - -/*! - calls beginRemoveRows. - */ -void BtDeviceModel::beginRemoveDevices(int first, int last, void *parent) -{ - Q_UNUSED( parent); - beginRemoveRows(QModelIndex(), first, last); -} - -/*! - calls endRemoveRows. - */ -void BtDeviceModel::endRemoveDevices() -{ - endRemoveRows(); -} - -/*! - emits deviceSearchCompleted signal. - */ -void BtDeviceModel::emitDeviceSearchCompleted( int error ) -{ - emit deviceSearchCompleted( error ); -} - -/*! - connects all signals of private impl to slots of this - */ -void BtDeviceModel::connectModelSignals() -{ - bool ok = connect(d.data(), SIGNAL(deviceDataChanged(int,void*)), SLOT(deviceDataChanged(int,void*))); - BTUI_ASSERT_X( ok, "BtDeviceModel", "deviceDataChanged can't connect" ); - ok = connect(d.data(), SIGNAL(deviceDataChanged(int,int,void*)), SLOT(deviceDataChanged(int,int,void*))); - BTUI_ASSERT_X( ok, "BtDeviceModel", "deviceDataChanged can't connect 2" ); - ok = connect(d.data(), SIGNAL(beginInsertDevices(int,int,void*)), SLOT(beginInsertDevices(int,int,void*))); - BTUI_ASSERT_X( ok, "BtDeviceModel", "beginInsertDevices can't connect" ); - ok = connect(d.data(), SIGNAL(endInsertDevices()), SLOT(endInsertDevices())); - BTUI_ASSERT_X( ok, "BtDeviceModel", "endInsertDevices can't connect" ); - ok = connect(d.data(), SIGNAL(beginRemoveDevices(int,int,void*)), SLOT(beginRemoveDevices(int,int,void*))); - BTUI_ASSERT_X( ok, "BtDeviceModel", "beginRemoveDevices can't connect" ); - ok = connect(d.data(), SIGNAL(endRemoveDevices()), SLOT(endRemoveDevices())); - BTUI_ASSERT_X( ok, "BtDeviceModel", "endRemoveDevices can't connect" ); - ok = connect(d.data(), SIGNAL(deviceSearchCompleted(int)), SLOT(emitDeviceSearchCompleted(int))); - BTUI_ASSERT_X( ok, "BtDeviceModel", "emitDeviceSearchCompleted can't connect" ); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btdevicemodel_p.cpp --- a/bluetoothengine/btui/btuimodel/btdevicemodel_p.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,478 +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 "btdevicemodel_p.h" -#include -#include -#include -#include "btuiutil.h" -#include "btuidevtypemap.h" -#include "btqtconstants.h" - -/*! - Constructor. - */ -BtDeviceModelPrivate::BtDeviceModelPrivate( BtDeviceModel& model, QObject *parent ) - : QObject( parent ), mModel( model ), mDiscover( 0 ), mSeqNum( 0 ) -{ - mDeviceRepo = 0; - isSearchingDevice = false; - TRAP_IGNORE({ - mDeviceRepo = CBtDevRepository::NewL(); - }); - Q_CHECK_PTR( mDeviceRepo ); - TRAP_IGNORE( mDeviceRepo->AddObserverL( this ) ); - - if ( mDeviceRepo->IsInitialized() ) { - initializeDataStore(); - } -} - -/*! - Destructor. - */ -BtDeviceModelPrivate::~BtDeviceModelPrivate() -{ - delete mDeviceRepo; - delete mDiscover; -} - - -/*! - Tells whether the given column is in the range of the setting list. - - \param row the row number to be checked - \param col the column number to be checked - - \return true if the given row and column are valid; false otherwise. -*/ -bool BtDeviceModelPrivate::isValid( int row, int column) const -{ - return row >= 0 && row < mData.count() && column == 0; -} - -/*! - \return the total amount of rows. - -*/ -int BtDeviceModelPrivate::rowCount() const -{ - return mData.count(); -} - -/*! - \return the total amount of columns. - -*/ -int BtDeviceModelPrivate::columnCount() const -{ - return 1; -} - -/*! - Gets the value within a data item. - \param val contains the value at return. - \param row the row number which the value is from - \param col the column number which the value is from - \param role the role identifier of the value. - */ -void BtDeviceModelPrivate::data(QVariant& val, int row, int col, int role ) const -{ - if ( isValid( row, col ) ) { - val = mData.at( row ).value( role ); - } - else { - val = QVariant( QVariant::Invalid ); - } -} - -/*! - Gets the whole item data at the specified column - \param row the row number of the item data to be returned - \param col the column number of the item data to be returned - \return the item data - */ -BtuiModelDataItem BtDeviceModelPrivate::itemData( int row, int col ) const -{ - if ( isValid( row, col ) ) { - return mData.at( row ); - } - return BtuiModelDataItem(); -} - - -/*! - Requests the model to searching Bluetooth devices. - \return true if the request is accepted; false otherwise - */ -bool BtDeviceModelPrivate::searchDevice() -{ - int err ( 0 ); - removeTransientDevices(); - if ( !mDiscover ) { - TRAP(err, mDiscover = CAdvanceDevDiscoverer::NewL( *mDeviceRepo, *this) ); - } - if ( !err ) { - TRAP(err, mDiscover->DiscoverDeviceL() ); - } - isSearchingDevice = true; - return err == 0; -} - -/*! - Cancels a possible outstanding device search request. - */ -void BtDeviceModelPrivate::cancelSearchDevice() -{ - if ( mDiscover ) { - isSearchingDevice = false; - mDiscover->CancelDiscovery(); - } -} - -/*! - Removes transient (not-in-registry) devices - (added as the result of device search). - */ -void BtDeviceModelPrivate::removeTransientDevices() -{ - // clear in-range property for all device items in this model. - int cnt = mData.count(); - for ( int i = mData.count() - 1; i > -1; --i) - { - const BtuiModelDataItem& qtdev = mData.at(i); - if(isDeviceInRange(qtdev)) { - if(isDeviceInRegistry(qtdev)) { - // we cannot remove this device as it is in registry. - // remove it in-range property. - setMajorProperty(mData[i], BtuiDevProperty::InRange, false); - updateRssi(mData[i], RssiInvalid); - updateSeqNum(mData[i], -1); - emit deviceDataChanged(i, this); - } - else { - // this device is not in-registry. Delete it from local - // store. - emit beginRemoveDevices(i, i, this); - mData.removeAt( i ); - emit endRemoveDevices(); - } - } - } -} - -/*! - callback from repository. - re-initialize our store. - */ -void BtDeviceModelPrivate::RepositoryInitialized() -{ - initializeDataStore(); -} - -/*! - callback from repository. - update our store. - */ -void BtDeviceModelPrivate::DeletedFromRegistry( const TBTDevAddr& addr ) -{ - int i = indexOf( addr ); - if ( i > -1 ) { - if ( isSearchingDevice && isDeviceInRange( mData.at(i) ) ) { - // device searching is ongoing, and it is in-range. we can not - // remove it from model now. - // clear-registry related properties, so that - // we get a chance to clean it after device searching later. - setMajorProperty(mData[i], BtuiDevProperty::RegistryProperties, false); - emit deviceDataChanged(i, this); - } - else { - emit beginRemoveDevices(i, i, this); - mData.removeAt( i ); - emit endRemoveDevices(); - } - } -} - -/*! - callback from repository. - update our store. - */ -void BtDeviceModelPrivate::AddedToRegistry( const CBtDevExtension& dev ) -{ - ChangedInRegistry( dev, 0 ); -} - -/*! - callback from repository. - update our store. - */ -void BtDeviceModelPrivate::ChangedInRegistry( - const CBtDevExtension& dev, TUint similarity ) -{ - int i = indexOf( dev.Addr() ); - if ( i == -1 ) { - BtuiModelDataItem devData; - if ( !isSearchingDevice ) { - // Rssi is only available at device inquiry stage. - // We initialize this property to an invalid value - updateRssi(devData, RssiInvalid); - } - // add device-in-registry property: - setMajorProperty(devData, BtuiDevProperty::InRegistry, true); - updateDeviceProperty(devData, dev, 0 ); - emit beginInsertDevices( mData.count(), mData.count(), this ); - mData.append( devData ); - emit endInsertDevices(); - } - else { - updateDeviceProperty(mData[i], dev, similarity ); - setMajorProperty(mData[i], BtuiDevProperty::InRegistry, true); - emit deviceDataChanged( i, this ); - } -} - -/*! - callback from repository. - update our store. - */ -void BtDeviceModelPrivate::ServiceConnectionChanged( - const CBtDevExtension& dev, TBool connected ) -{ - int i = indexOf( dev.Addr() ); - if ( i > -1 ) { - int preconn = BtuiDevProperty::Connected - & mData[i][BtDeviceModel::MajorPropertyRole].toInt(); - // we only update and signal if connection status is really - // changed: - if ( ( preconn != 0 && !connected ) - || ( preconn == 0 && connected ) ) { - setMajorProperty(mData[i], BtuiDevProperty::Connected, connected ); - emit deviceDataChanged( i, this ); - } - } - // it is impossible that a device has connected but it is not in - // our local store according to current bteng services. - // need to take more care in future when this becomes possible. -} - -/*! - callback from device search. - update our store. - */ -void BtDeviceModelPrivate::HandleNextDiscoveryResultL( - const TInquirySockAddr& inqAddr, const TDesC& name ) -{ - int pos = indexOf( inqAddr.BTAddr() ); - const CBtDevExtension* dev = mDeviceRepo->Device( inqAddr.BTAddr() ); - - //RssiRole - int rssi( RssiInvalid ); // initialize to an invalid value. - if( inqAddr.ResultFlags() & TInquirySockAddr::ERssiValid ) { - rssi = inqAddr.Rssi(); - } - - if ( pos == -1 ) { - BtuiModelDataItem devData; - setMajorProperty(devData, BtuiDevProperty::InRange, true); - updateRssi(devData, rssi); - updateSeqNum( devData, mSeqNum++ ); - CBtDevExtension* devExt(NULL); - TRAP_IGNORE( { - devExt = CBtDevExtension::NewLC( inqAddr, name ); - CleanupStack::Pop(); }); - updateDeviceProperty(devData, *devExt, 0); - delete devExt; - emit beginInsertDevices( mData.count(), mData.count(), this ); - mData.append( devData ); - emit endInsertDevices(); - } - else { - setMajorProperty(mData[pos], BtuiDevProperty::InRange, true); - updateRssi(mData[pos], rssi); - updateSeqNum( mData[pos], mSeqNum++ ); - emit deviceDataChanged( pos, this ); - } -} - -/*! - callback from device search. - inform client. - */ -void BtDeviceModelPrivate::HandleDiscoveryCompleted( TInt error ) -{ - isSearchingDevice = false; - // Reset the sequence number for the next search - mSeqNum = 0; - emit deviceSearchCompleted( (int) error ); -} - -void BtDeviceModelPrivate::initializeDataStore() - { - - mSeqNum = 0; // reset when starting search again - - // it is possible that we are searching devices. - // We use a simple but not-so-efficient method to update the model. - - // If the device store is not empty, we clear - // registry property from these devices first. - for (int i = 0; i < mData.count(); ++i) { - setMajorProperty(mData[i], BtuiDevProperty::RegistryProperties, false); - } - if ( mData.count() ) { - // need to update view because we have changed device properties. - emit deviceDataChanged( 0, mData.count() - 1, this ); - } - - const RDevExtensionArray& devs = mDeviceRepo->AllDevices(); - for (int i = 0; i < devs.Count(); ++i) { - int pos = indexOf( devs[i]->Addr() ); - if ( pos > -1 ) { - // add device-in-registry property: - setMajorProperty(mData[pos], BtuiDevProperty::InRegistry, true); - updateDeviceProperty(mData[pos], *(devs[i]), 0); - updateSeqNum(mData[pos], -1); - emit deviceDataChanged( pos, this ); - } - else { - BtuiModelDataItem devData; - // add device-in-registry property: - setMajorProperty(devData, BtuiDevProperty::InRegistry, true); - updateDeviceProperty(devData, *( devs[i] ), 0 ); - updateSeqNum(devData, -1); - emit beginInsertDevices(mData.count(), mData.count(), this ); - mData.append( devData ); - emit endInsertDevices(); - } - } -} - -void BtDeviceModelPrivate::updateDeviceProperty(BtuiModelDataItem& qtdev, - const CBtDevExtension& dev, TUint similarity ) -{ - // similarity is not used currently. - // It is possible to gain better performance - // with this info to avoid re-manipulate - // unchanged properties. - Q_UNUSED(similarity); - - //DevDisplayNameRole - QString str = QString::fromUtf16( - dev.Alias().Ptr(), dev.Alias().Length() ); - qtdev[BtDeviceModel::NameAliasRole] = QVariant( str ); - - //DevAddrReadableRole - addrSymbianToReadbleString( str, dev.Addr() ); - qtdev[BtDeviceModel::ReadableBdaddrRole] = QVariant( str ); - - //LastUsedTimeRole - TDateTime symDt = dev.Device().Used().DateTime(); - QDate date( symDt.Year(), symDt.Month(), symDt.Day() ); - QTime time( symDt.Hour(), symDt.Minute(), symDt.MicroSecond() / 1000 ); - QDateTime qdt(date, time); - qtdev[BtDeviceModel::LastUsedTimeRole] = QVariant(qdt); - - // set paired status: - setMajorProperty(qtdev, BtuiDevProperty::Bonded, isBonded( dev.Device() )); - - // set blocked status: - setMajorProperty(qtdev, BtuiDevProperty::Blocked, - dev.Device().GlobalSecurity().Banned() ); - // set trusted status: - setMajorProperty(qtdev, BtuiDevProperty::Trusted, - dev.Device().GlobalSecurity().NoAuthorise() ); - // set connected status: - // EBTEngConnecting is an intermediate state between connected and not-connected, - // we do not treat it as connected: - setMajorProperty(qtdev, BtuiDevProperty::Connected, dev.ServiceConnectionStatus() == EBTEngConnected); - - // Check whether the device has services that are connectable in bteng scope. - CBTEngConnMan* connMan( 0 ); - TRAP_IGNORE( connMan = CBTEngConnMan::NewL(0)); - TBool connectable(EFalse); - if ( connMan ) { - (void) connMan->IsConnectable(dev.Addr(), dev.Device().DeviceClass(), connectable); - delete connMan; - } - setMajorProperty(qtdev, BtuiDevProperty::Connectable, connectable); - - int cod = static_cast( dev.Device().DeviceClass().DeviceClass() ); - qtdev[BtDeviceModel::CoDRole] = QVariant(cod); - - int majorDeviceType; - int minorDeviceType; - // device type is mapped according to CoD: - BtuiDevProperty::mapDeiveType(majorDeviceType, minorDeviceType, cod); - - - - - qtdev[BtDeviceModel::MajorPropertyRole] = - QVariant( qtdev[BtDeviceModel::MajorPropertyRole].toInt() | majorDeviceType ); - qtdev[BtDeviceModel::MinorPropertyRole] = QVariant( minorDeviceType ); -} - -int BtDeviceModelPrivate::indexOf( const TBTDevAddr& addr ) const -{ - QString addrStr; - addrSymbianToReadbleString( addrStr, addr ); - for (int i = 0; i < mData.count(); ++i ) { - if ( mData.at( i ).value( BtDeviceModel::ReadableBdaddrRole ) - == addrStr ) { - return i; - } - } - return -1; -} - -void BtDeviceModelPrivate::updateRssi(BtuiModelDataItem& qtdev, int rssi ) -{ - qtdev[BtDeviceModel::RssiRole] = QVariant( rssi ); -} - -void BtDeviceModelPrivate::updateSeqNum(BtuiModelDataItem& qtdev, int seqNum ) -{ - qtdev[BtDeviceModel::SeqNumRole] = QVariant( seqNum ); -} - -/*! - Add the specified major property to the device if addto is true. - Otherwise the property is removed from the device. - */ -void BtDeviceModelPrivate::setMajorProperty( - BtuiModelDataItem& qtdev, int prop, bool addto) -{ - if ( addto ) { - qtdev[BtDeviceModel::MajorPropertyRole] = - QVariant( qtdev[BtDeviceModel::MajorPropertyRole].toInt() | prop); - } - else { - qtdev[BtDeviceModel::MajorPropertyRole] = - QVariant( qtdev[BtDeviceModel::MajorPropertyRole].toInt() & ~prop); - } -} - -bool BtDeviceModelPrivate::isDeviceInRange( const BtuiModelDataItem& qtdev ) -{ - return BtuiDevProperty::InRange & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); -} - -bool BtDeviceModelPrivate::isDeviceInRegistry( const BtuiModelDataItem& qtdev ) -{ - return BtuiDevProperty::InRegistry & qtdev[BtDeviceModel::MajorPropertyRole].toInt(); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btdevicemodel_p.h --- a/bluetoothengine/btui/btuimodel/btdevicemodel_p.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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 BTDEVICEMODELPRIVATE_H -#define BTDEVICEMODELPRIVATE_H - -#include "btuimodeltypes.h" -#include - -#include -#include -#include - -class CAdvanceDevDiscoverer; - -/*! - \class BtDeviceData - \brief class for providing remote device data. - - BtDeviceData class is responsible for providing the latest information - regarding the properties of remote devices. - - \\sa bluetoothuimodel - */ -class BtDeviceModelPrivate : public QObject, - public MBtDevRepositoryObserver, - public MDevDiscoveryObserver -{ - Q_OBJECT - -public: - explicit BtDeviceModelPrivate( BtDeviceModel& model, QObject *parent = 0 ); - - virtual ~BtDeviceModelPrivate(); - - bool isValid( int row, int col ) const; - - int rowCount() const; - - int columnCount() const; - - void data(QVariant& val, int row, int col, int role ) const; - - BtuiModelDataItem itemData( int row, int col ) const; - - bool searchDevice(); - - void cancelSearchDevice(); - - void removeTransientDevices(); - -private: - // From MBtDeviceRepositoryObserver - - void RepositoryInitialized(); - - void DeletedFromRegistry( const TBTDevAddr& addr ); - - void AddedToRegistry( const CBtDevExtension& dev ); - - void ChangedInRegistry( const CBtDevExtension& dev, TUint similarity ); - - void ServiceConnectionChanged( - const CBtDevExtension& dev, TBool connected ); - - // from MDevDiscoveryObserver - void HandleNextDiscoveryResultL( - const TInquirySockAddr& inqAddr, const TDesC& name ); - - void HandleDiscoveryCompleted( TInt error ); - -signals: - - void deviceDataChanged( int row, void *parent ); - - void deviceDataChanged( int first, int last, void *parent ); - - void beginInsertDevices(int first, int last, void *parent); - void endInsertDevices(); - - void beginRemoveDevices(int first, int last, void *parent); - void endRemoveDevices(); - - void deviceSearchCompleted( int error ); - -public slots: - //void activeRequestCompleted( int status, int id ); - -private: - - void initializeDataStore(); - - void updateDeviceProperty(BtuiModelDataItem& qtdev, - const CBtDevExtension& dev, TUint similarity ); - - int indexOf( const TBTDevAddr& addr ) const; - - void updateRssi(BtuiModelDataItem& qtdev, int rssi ); - - void updateSeqNum(BtuiModelDataItem& qtdev, int seqNum ); - - void setMajorProperty( BtuiModelDataItem& qtdev, int prop, bool addto); - - bool isDeviceInRange( const BtuiModelDataItem& qtdev ); - - bool isDeviceInRegistry( const BtuiModelDataItem& qtdev ); - -private: - - BtuiModelDataSource mData; - - BtDeviceModel& mModel; - - CBtDevRepository* mDeviceRepo; - - CAdvanceDevDiscoverer* mDiscover; - - bool isSearchingDevice; - - int mSeqNum; // sequence number based on order the device is found during search - - Q_DISABLE_COPY(BtDeviceModelPrivate) - -}; - -#endif // BTDEVICEMODELPRIVATE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btsettingmodel.cpp --- a/bluetoothengine/btui/btuimodel/btsettingmodel.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +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 -#include "btsettingmodel_p.h" -#include "bluetoothuitrace.h" - -/*! - This Constructor creates new instances of model data structure. - */ -BtSettingModel::BtSettingModel( QObject *parent ) - : QAbstractItemModel( parent ) -{ - d = QSharedPointer( new BtSettingModelPrivate( *this ) ); - connectModelSignals(); -} - -/*! - This Constructor shares the private implementation of the setting model. - */ -BtSettingModel::BtSettingModel( const BtSettingModel &model, QObject *parent ) - : QAbstractItemModel( parent ) -{ - d = model.d; - connectModelSignals(); -} - -/*! - Destructor. - */ -BtSettingModel::~BtSettingModel() -{ -} - -/*! - \reimp - */ -QModelIndex BtSettingModel::index( int row, int column, const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - if ( d->isValid( row, column ) ) { - return createIndex( row, column, d.data() ); - } - // invalid row and column: - return QModelIndex(); -} - -/*! - \reimp - */ -QModelIndex BtSettingModel::parent( const QModelIndex &child ) const -{ - Q_UNUSED( child ); - // root level, no parent. - return QModelIndex(); -} - -/*! - \reimp - */ -int BtSettingModel::rowCount( const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - return d->rowCount(); -} - -/*! - \reimp - */ -int BtSettingModel::columnCount( const QModelIndex &parent ) const -{ - Q_UNUSED( parent ); - return d->columnCount(); -} - -/*! - \reimp - */ -QVariant BtSettingModel::data( const QModelIndex &index, int role ) const -{ - QVariant val( QVariant::Invalid ); - d.data()->data( val, index.row(), index.column(), role ); - return val; -} - -QMap BtSettingModel::itemData( const QModelIndex & index ) const -{ - return d.data()->itemData( index.row(), index.column() ); -} - -/*! - emits dataChanged signal. - */ -void BtSettingModel::settingDataChanged( int row, void *parent ) -{ - QModelIndex idx = createIndex( row, 0, parent ); - emit dataChanged( idx, idx ); -} - -/*! - emits dataChanged signal. - */ -void BtSettingModel::settingDataChanged(int first, int last, void *parent ) - { - QModelIndex top = createIndex( first, 0, parent ); - QModelIndex bottom = createIndex( last, 0, parent ); - emit dataChanged( top, bottom ); - } - -/*! - connects all signals of private impl to slots of this - */ -void BtSettingModel::connectModelSignals() -{ - bool ok = connect(d.data(), SIGNAL(settingDataChanged(int,void*)), SLOT(settingDataChanged(int,void*))); - BTUI_ASSERT_X( ok, "BtSettingModel", "settingDataChanged can't connect" ); - ok = connect(d.data(), SIGNAL(settingDataChanged(int,int,void*)), SLOT(settingDataChanged(int,int,void*))); - BTUI_ASSERT_X( ok, "BtSettingModel", "settingDataChanged can't connect 2" ); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btsettingmodel_p.cpp --- a/bluetoothengine/btui/btuimodel/btsettingmodel_p.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +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 "btsettingmodel_p.h" -#include -#include -#include -#include "btqtconstants.h" - -const int KLocalDeviceNameWatcher = 10; -const int KBtLinkCountWatcher = 11; - -/*! - Constructor. - */ -BtSettingModelPrivate::BtSettingModelPrivate( BtSettingModel& model, QObject *parent ) - : QObject( parent), mModel( model ), mLocalDeviceWatcher(0) - { - int err( 0 ); - if (!err ) { - err = mLocalDeviceKey.Attach( KPropertyUidBluetoothCategory, - KPropertyKeyBluetoothGetRegistryTableChange ); - } - - Q_CHECK_PTR( !err ); // other proper alternative? - - TRAP_IGNORE({ - mBtengSetting = CBTEngSettings::NewL( this ); - mLocalDeviceWatcher = CBtSimpleActive::NewL(*this, KLocalDeviceNameWatcher ); - }); - - Q_CHECK_PTR( mBtengSetting ); - Q_CHECK_PTR( mLocalDeviceWatcher ); - - for ( int i = 0; i < BtSettingModel::LocalSettingRowCount; ++i ) { - // Initialize the list with empty values. - mData.append( BtuiModelDataItem() ); - } - - // subscribe to local device table change: - mLocalDeviceKey.Subscribe( mLocalDeviceWatcher->RequestStatus() ); - mLocalDeviceWatcher->GoActive(); - - // Get the device name - TBTDeviceName deviceName; - (void) mBtengSetting->GetLocalName( deviceName ); - updateDeviceName( QString::fromUtf16( deviceName.Ptr(), deviceName.Length() ) ); - - // Get the power setting. - TBTPowerStateValue power( EBTPowerOff ); - (void) mBtengSetting->GetPowerState( power ); - setPowerSetting( power ); - - // Get the visibility mode - TBTVisibilityMode visibilityMode( EBTVisibilityModeNoScans ); - (void) mBtengSetting->GetVisibilityMode( visibilityMode ); - setVisibilityMode( visibilityMode ); -} - -/*! - Destructor. - */ -BtSettingModelPrivate::~BtSettingModelPrivate() -{ - // delete main data structure - delete mBtengSetting; - delete mLocalDeviceWatcher; - mLocalDeviceKey.Close(); - - // delete mBtLinkCountWatcher; - //mBtLinkCountKey.Close(); -} - - -/*! - Tells whether the given column is in the range of the setting list. - - \param row the row number to be checked - \param col the column number to be checked - - \return true if the given row and column are valid; false otherwise. -*/ -bool BtSettingModelPrivate::isValid( int row, int column) const -{ - return row >= 0 && row < mData.count() && column == 0; -} - -/*! - \return the total amount of rows. - -*/ -int BtSettingModelPrivate::rowCount() const -{ - return mData.count(); -} - -/*! - \return the total amount of columns. - -*/ -int BtSettingModelPrivate::columnCount() const -{ - return 1; -} - -/*! - Gets the value within a data item. - \param val contains the value at return. - \param row the row number which the value is from - \param col the column number which the value is from - \param role the role idenfier of the value. - */ -void BtSettingModelPrivate::data(QVariant& val, int row, int col, int role ) const -{ - if ( isValid( row, col ) ) { - val = mData.at( row ).value( role ); - } - else { - val = QVariant( QVariant::Invalid ); - } -} - -/*! - Gets the whole item data at the specified column - \param row the row number of the item data to be returned - \param col the column number of the item data to be returned - \return the item data - */ -BtuiModelDataItem BtSettingModelPrivate::itemData( int row, int col ) const -{ - if ( isValid( row, col ) ) { - return mData.at( row ); - } - return BtuiModelDataItem(); -} - -/*! - Provides notification of changes in the power state - of the Bluetooth hardware. - - \param state EBTPowerOff if the BT hardware has been turned off, - EBTPowerOn if it has been turned on. - */ -void BtSettingModelPrivate::PowerStateChanged( TBTPowerStateValue state ) -{ - setPowerSetting( state ); - emit settingDataChanged( BtSettingModel::PowerStateRow, this ); -} - -/*! - Provides notification of changes in the discoverability - mode of the Bluetooth hardware. - \param state EBTDiscModeHidden if the BT hardware is in hidden mode, - EBTDiscModeGeneral if it is in visible mode. - */ -void BtSettingModelPrivate::VisibilityModeChanged( TBTVisibilityMode state ) -{ - setVisibilityMode( state ); - emit settingDataChanged( BtSettingModel::VisibilityRow, this ); -} - -void BtSettingModelPrivate::RequestCompletedL( CBtSimpleActive* active, TInt status ) { - Q_UNUSED( active ); - Q_UNUSED( status ); - if ( active->RequestId() == KLocalDeviceNameWatcher ) { - mLocalDeviceKey.Subscribe( mLocalDeviceWatcher->RequestStatus() ); - mLocalDeviceWatcher->GoActive(); - updateDeviceName( QString() ); - } -} - -void BtSettingModelPrivate::CancelRequest( TInt requestId ) { - if ( requestId == KLocalDeviceNameWatcher ) { - mLocalDeviceKey.Cancel(); - } - else if ( requestId == KBtLinkCountWatcher ) { - //mBtLinkCountKey.Cancel(); - } -} - -void BtSettingModelPrivate::HandleError( CBtSimpleActive* active, TInt error ) { - Q_UNUSED( active ); - Q_UNUSED( error ); -} - -/*! - Update local Bluetooth device name in the data store. - @param name the latest Bluetooth name. - */ -void BtSettingModelPrivate::updateDeviceName( const QString &name ) -{ - // To-do: the data structure initialization is not impled yet in the model - BtuiModelDataItem& item = - mData[ BtSettingModel::LocalBtNameRow ]; - - bool setByUser = !name.isEmpty(); - - // The additional parameter is the flag indicating whether the - // Bluetooth name has been set by the user. - // The flag is set to true if the name has been set. - // item[ BtSettingModel::SettingValueParamRole ] = QVariant( setByUser ); - - QString resolvedName( name ); - if ( resolvedName.isEmpty() ) { - // We get the default name as suggestion for the user to set. - getNameFromRegistry( resolvedName ); - } - item[ BtSettingModel::settingDisplayRole ] = QVariant( resolvedName ); - item[ BtSettingModel::SettingValueRole ] = QVariant( resolvedName ); -} - -/*! - Updates all values related to the power setting. - */ -void BtSettingModelPrivate::setPowerSetting( TBTPowerStateValue state ) -{ - BtuiModelDataItem& item = - mData[ BtSettingModel::PowerStateRow ]; - - item[ BtSettingModel::SettingValueRole ] = QVariant( QtPowerMode(state) ); -} - -void BtSettingModelPrivate::setVisibilityMode( TBTVisibilityMode state ) -{ - BtuiModelDataItem& item = mData[ BtSettingModel::VisibilityRow ]; - - item [ BtSettingModel::SettingValueRole ] = QVariant( QtVisibilityMode(state) ); -} - -/*! - Get local Bluetooth device name from BTRegistry. - */ -void BtSettingModelPrivate::getNameFromRegistry( QString &name ) -{ - RBTRegServ btRegServ; // Session with BTMan - RBTLocalDevice btReg; // Subsession with local device table - TBTLocalDevice localDev;// Data structure holding local device information - - TInt err = btRegServ.Connect(); - if ( !err ) { - err = btReg.Open( btRegServ ); - } - if ( !err ) { - // Read the BT local name from BT Registry. - err = btReg.Get( localDev ); - } - if ( !err ) { - name = QString::fromUtf8( (const char*) localDev.DeviceName().Ptr(), (int) localDev.DeviceName().Length() ); - } - btReg.Close(); - btRegServ.Close(); -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btsettingmodel_p.h --- a/bluetoothengine/btui/btuimodel/btsettingmodel_p.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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 BTSETTINGMODEL_P_H -#define BTSETTINGMODEL_P_H - -#include - -#include -#include -#include -#include - -/*! - \class BtuimSettings - \brief class for handling local Bluetooth setting updates. - - BtLocalSetting class is responsible for providing the latest information - regarding the local Bluetooth settings such as device name and power state. - - \\sa bluetoothuimodel - */ -class BtSettingModelPrivate : public QObject, - public MBTEngSettingsObserver, - public MBtSimpleActiveObserver -{ - Q_OBJECT - -public: - explicit BtSettingModelPrivate( BtSettingModel& model, QObject *parent = 0 ); - - virtual ~BtSettingModelPrivate(); - - bool isValid( int row, int col ) const; - - int rowCount() const; - - int columnCount() const; - - void data(QVariant& val, int row, int col, int role ) const; - - BtuiModelDataItem itemData( int row, int col ) const; -signals: - - void settingDataChanged( int row, void *parent ); - - void settingDataChanged( int first, int last, void *parent ); - -private: - // from MBTEngSettingsObserver - - void PowerStateChanged( TBTPowerStateValue state ); - - void VisibilityModeChanged( TBTVisibilityMode state ); - - // from MBtSimpleActiveObserver - - void RequestCompletedL( CBtSimpleActive* active, TInt status ); - - void CancelRequest( TInt requestId ); - - void HandleError( CBtSimpleActive* active, TInt error ); - -private: - - void setVisibilityMode( TBTVisibilityMode state ); - void updateDeviceName( const QString &name ); - - void setPowerSetting( TBTPowerStateValue state ); - - //void setOfflineSetting( bool state ); - //void setBtConnectionsSetting( int connections ); - - void getNameFromRegistry( QString &name ); - -private: - - BtuiModelDataSource mData; - - BtSettingModel& mModel; - - CBTEngSettings *mBtengSetting; - - // For monitoring local device name change - RProperty mLocalDeviceKey; - CBtSimpleActive *mLocalDeviceWatcher; - - //RProperty mBtLinkCountKey; - //CBTEngActive *mBtLinkCountWatcher; - Q_DISABLE_COPY(BtSettingModelPrivate) - -}; - -#endif // BTSETTINGMODEL_P_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btuimodel.pro --- a/bluetoothengine/btui/btuimodel/btuimodel.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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: -# - -TEMPLATE = lib -TARGET = btuimodel - -MOC_DIR = moc -DEFINES += BUILD_BTUIMODEL - -INCLUDEPATH += . \ - ../inc - -CONFIG += qt \ - hb \ - dll -HEADERS += btdevicemodel_p.h \ - btsettingmodel_p.h \ - ../inc/btsettingmodel.h \ - ../inc/btdevicemodel.h \ - ../inc/btuimodelsortfilter.h \ - ../inc/btuiutil.h - -SOURCES += btdevicemodel_p.cpp \ - btsettingmodel_p.cpp \ - btsettingmodel.cpp \ - btdevicemodel.cpp \ - btuimodelsortfilter.cpp - -defFilePath = . - -symbian: { - SYMBIAN_PLATFORMS = WINSCW \ - ARMV5 - - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x2002434F - TARGET.CAPABILITY = CAP_GENERAL_DLL - - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - - LIBS += -lbtengsettings \ - -lbtserviceutil \ - -lbtdevice \ - -lbtmanclient \ - -lesock \ - -lbluetooth \ - -lbtengdevman \ - -lbtengconnman \ - -lcentralrepository \ - -lflogger - //MMP_RULES -= EXPORTUNFROZEN -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/btuimodelsortfilter.cpp --- a/bluetoothengine/btui/btuimodel/btuimodelsortfilter.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +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 -#include -#include "btuidevtypemap.h" -/*! - Constructor. - */ -BtuiModelSortFilter::BtuiModelSortFilter( QObject *parent ) - : QSortFilterProxyModel( parent ) -{ - setDynamicSortFilter( true ); -} - -/*! - Destructor. - */ -BtuiModelSortFilter::~BtuiModelSortFilter() -{ -} - -/*! - Replace current filter values for filtering on major device class with - the specified. - */ -void BtuiModelSortFilter::setDeviceMajorFilter( int filter, FilterMode mode ) -{ - mFilters.clear(); - addDeviceMajorFilter( filter, mode ); -} - -/*! - Add the specified filter value for filtering on major device class - if the specified filter doesn't exist when this function is called. - */ -void BtuiModelSortFilter::addDeviceMajorFilter( int filter, FilterMode mode ) -{ - FilterItem f(filter, mode); - if ( mFilters.indexOf(f) == -1 ) { - mFilters.append( f ); - invalidateFilter(); - } -} - -/*! - Clear the specified filter value for filtering on major device class from this model. - */ -void BtuiModelSortFilter::clearDeviceMajorFilter( int filter, FilterMode mode ) -{ - FilterItem f(filter, mode); - int i = mFilters.indexOf(f); - if ( i > -1 ) { - mFilters.removeAt( i ); - invalidateFilter(); - } -} - -/*! - clear all filters for filtering on major device class. - This Model will reset itself. - */ -void BtuiModelSortFilter::clearDeviceMajorFilters() -{ - // model reset is needed if there are filters : - if ( mFilters.size() > 0 ) { - mFilters.clear(); - invalidateFilter(); - } -} - -/*! - return true if the specified filter exists; return false otherwise. - */ -bool BtuiModelSortFilter::hasFilter( int filter, FilterMode mode ) -{ - FilterItem f(filter, mode); - return mFilters.indexOf(f) > -1 ; -} - -/*! - \reimp - */ -bool BtuiModelSortFilter::filterAcceptsRow( - int sourceRow, const QModelIndex &sourceParent) const -{ - bool accepted (false ); - // Get the device name from the model - QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - - // the row shall pass all filters: - for (int i = 0; i < mFilters.size(); i++ ) { - if ( mFilters.at(i).mFilter == BtuiDevProperty::NullProperty ) { - accepted = true; // There is no filter, we accept all - } - else { - int majorProperty = - sourceModel()->data(index, BtDeviceModel::MajorPropertyRole).toInt(); - switch (mFilters.at(i).mMode) { - case ExactMatch: - // Accept if the match is spot-on - accepted = majorProperty == mFilters.at(i).mFilter ; - break; - case AtLeastMatch: - // accept if it matches all specified properties: - accepted = ( mFilters.at(i).mFilter == - ( majorProperty & mFilters.at(i).mFilter ) ); - break; - case RoughMatch: - // Accept if it matches one of specified properties: - accepted = (majorProperty & mFilters.at(i).mFilter) != 0; - break; - case Exclusive: - // Accept if this is not one that we want to filter out - accepted = (majorProperty & mFilters.at(i).mFilter) == 0; - break; - default: - accepted = false; - } - } - // Break out of the loop at first non-accepted condition - if (!accepted) - break; - } - if (accepted) { - // emit signal to inform a row has been accepted by fitler, - // currently this is only needed by search view - emit const_cast(this)->deviceAcceptedByFilter( sourceRow ); - } - return accepted; -} - -/*! - \reimp - */ -bool BtuiModelSortFilter::lessThan( - const QModelIndex &left, const QModelIndex &right) const -{ - if (sortRole() == BtDeviceModel::NameAliasRole || - sortRole() == BtDeviceModel::LastUsedTimeRole || - sortRole() == BtDeviceModel::RssiRole || - sortRole() == BtDeviceModel::SeqNumRole) { - // base class provides sorting for these types already: - return QSortFilterProxyModel::lessThan(left, right); - } - // no custom sort supported yet. - return true; -} diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/bwins/btuimodelu.def --- a/bluetoothengine/btui/btuimodel/bwins/btuimodelu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -EXPORTS - ?emitDeviceSearchCompleted@BtDeviceModel@@AAEXH@Z @ 1 NONAME ; void BtDeviceModel::emitDeviceSearchCompleted(int) - ??1BtDeviceModel@@UAE@XZ @ 2 NONAME ; BtDeviceModel::~BtDeviceModel(void) - ?tr@BtDeviceModel@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString BtDeviceModel::tr(char const *, char const *, int) - ?searchDevice@BtDeviceModel@@QAE_NXZ @ 4 NONAME ; bool BtDeviceModel::searchDevice(void) - ?parent@BtSettingModel@@UBE?AVQModelIndex@@ABV2@@Z @ 5 NONAME ; class QModelIndex BtSettingModel::parent(class QModelIndex const &) const - ?settingDataChanged@BtSettingModel@@AAEXHPAX@Z @ 6 NONAME ; void BtSettingModel::settingDataChanged(int, void *) - ?setDeviceMajorFilter@BtuiModelSortFilter@@QAEXHW4FilterMode@1@@Z @ 7 NONAME ; void BtuiModelSortFilter::setDeviceMajorFilter(int, enum BtuiModelSortFilter::FilterMode) - ?metaObject@BtuiModelSortFilter@@UBEPBUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const * BtuiModelSortFilter::metaObject(void) const - ?metaObject@BtSettingModel@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * BtSettingModel::metaObject(void) const - ?hasFilter@BtuiModelSortFilter@@QAE_NHW4FilterMode@1@@Z @ 10 NONAME ; bool BtuiModelSortFilter::hasFilter(int, enum BtuiModelSortFilter::FilterMode) - ?itemData@BtSettingModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 11 NONAME ; class QMap BtSettingModel::itemData(class QModelIndex const &) const - ?tr@BtSettingModel@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString BtSettingModel::tr(char const *, char const *) - ??0BtDeviceModel@@QAE@PAVQObject@@@Z @ 13 NONAME ; BtDeviceModel::BtDeviceModel(class QObject *) - ?tr@BtDeviceModel@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString BtDeviceModel::tr(char const *, char const *) - ?staticMetaObject@BtuiModelSortFilter@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const BtuiModelSortFilter::staticMetaObject - ?qt_metacast@BtuiModelSortFilter@@UAEPAXPBD@Z @ 16 NONAME ; void * BtuiModelSortFilter::qt_metacast(char const *) - ?qt_metacall@BtDeviceModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 17 NONAME ; int BtDeviceModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ??_EBtDeviceModel@@UAE@I@Z @ 18 NONAME ; BtDeviceModel::~BtDeviceModel(unsigned int) - ?index@BtSettingModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 19 NONAME ; class QModelIndex BtSettingModel::index(int, int, class QModelIndex const &) const - ?trUtf8@BtuiModelSortFilter@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString BtuiModelSortFilter::trUtf8(char const *, char const *) - ?qt_metacall@BtSettingModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 21 NONAME ; int BtSettingModel::qt_metacall(enum QMetaObject::Call, int, void * *) - ?settingDataChanged@BtSettingModel@@AAEXHHPAX@Z @ 22 NONAME ; void BtSettingModel::settingDataChanged(int, int, void *) - ??0BtuiModelSortFilter@@QAE@PAVQObject@@@Z @ 23 NONAME ; BtuiModelSortFilter::BtuiModelSortFilter(class QObject *) - ?lessThan@BtuiModelSortFilter@@MBE_NABVQModelIndex@@0@Z @ 24 NONAME ; bool BtuiModelSortFilter::lessThan(class QModelIndex const &, class QModelIndex const &) const - ??1BtuiModelSortFilter@@UAE@XZ @ 25 NONAME ; BtuiModelSortFilter::~BtuiModelSortFilter(void) - ?deviceDataChanged@BtDeviceModel@@AAEXHHPAX@Z @ 26 NONAME ; void BtDeviceModel::deviceDataChanged(int, int, void *) - ?columnCount@BtDeviceModel@@UBEHABVQModelIndex@@@Z @ 27 NONAME ; int BtDeviceModel::columnCount(class QModelIndex const &) const - ?trUtf8@BtDeviceModel@@SA?AVQString@@PBD0H@Z @ 28 NONAME ; class QString BtDeviceModel::trUtf8(char const *, char const *, int) - ?deviceSearchCompleted@BtDeviceModel@@IAEXH@Z @ 29 NONAME ; void BtDeviceModel::deviceSearchCompleted(int) - ?cancelSearchDevice@BtDeviceModel@@QAEXXZ @ 30 NONAME ; void BtDeviceModel::cancelSearchDevice(void) - ??_EBtuiModelSortFilter@@UAE@I@Z @ 31 NONAME ; BtuiModelSortFilter::~BtuiModelSortFilter(unsigned int) - ??0BtSettingModel@@QAE@PAVQObject@@@Z @ 32 NONAME ; BtSettingModel::BtSettingModel(class QObject *) - ?deviceAcceptedByFilter@BtuiModelSortFilter@@IAEXH@Z @ 33 NONAME ; void BtuiModelSortFilter::deviceAcceptedByFilter(int) - ?index@BtDeviceModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 34 NONAME ; class QModelIndex BtDeviceModel::index(int, int, class QModelIndex const &) const - ?qt_metacast@BtDeviceModel@@UAEPAXPBD@Z @ 35 NONAME ; void * BtDeviceModel::qt_metacast(char const *) - ?rowCount@BtSettingModel@@UBEHABVQModelIndex@@@Z @ 36 NONAME ; int BtSettingModel::rowCount(class QModelIndex const &) const - ??1BtSettingModel@@UAE@XZ @ 37 NONAME ; BtSettingModel::~BtSettingModel(void) - ??0BtSettingModel@@QAE@ABV0@PAVQObject@@@Z @ 38 NONAME ; BtSettingModel::BtSettingModel(class BtSettingModel const &, class QObject *) - ?endRemoveDevices@BtDeviceModel@@AAEXXZ @ 39 NONAME ; void BtDeviceModel::endRemoveDevices(void) - ?trUtf8@BtSettingModel@@SA?AVQString@@PBD0@Z @ 40 NONAME ; class QString BtSettingModel::trUtf8(char const *, char const *) - ??_EBtSettingModel@@UAE@I@Z @ 41 NONAME ; BtSettingModel::~BtSettingModel(unsigned int) - ?filterAcceptsRow@BtuiModelSortFilter@@MBE_NHABVQModelIndex@@@Z @ 42 NONAME ; bool BtuiModelSortFilter::filterAcceptsRow(int, class QModelIndex const &) const - ?clearDeviceMajorFilter@BtuiModelSortFilter@@QAEXHW4FilterMode@1@@Z @ 43 NONAME ; void BtuiModelSortFilter::clearDeviceMajorFilter(int, enum BtuiModelSortFilter::FilterMode) - ?tr@BtuiModelSortFilter@@SA?AVQString@@PBD0@Z @ 44 NONAME ; class QString BtuiModelSortFilter::tr(char const *, char const *) - ?addDeviceMajorFilter@BtuiModelSortFilter@@QAEXHW4FilterMode@1@@Z @ 45 NONAME ; void BtuiModelSortFilter::addDeviceMajorFilter(int, enum BtuiModelSortFilter::FilterMode) - ?qt_metacall@BtuiModelSortFilter@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 46 NONAME ; int BtuiModelSortFilter::qt_metacall(enum QMetaObject::Call, int, void * *) - ?rowCount@BtDeviceModel@@UBEHABVQModelIndex@@@Z @ 47 NONAME ; int BtDeviceModel::rowCount(class QModelIndex const &) const - ?itemData@BtDeviceModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 48 NONAME ; class QMap BtDeviceModel::itemData(class QModelIndex const &) const - ?parent@BtDeviceModel@@UBE?AVQModelIndex@@ABV2@@Z @ 49 NONAME ; class QModelIndex BtDeviceModel::parent(class QModelIndex const &) const - ?staticMetaObject@BtDeviceModel@@2UQMetaObject@@B @ 50 NONAME ; struct QMetaObject const BtDeviceModel::staticMetaObject - ?getStaticMetaObject@BtSettingModel@@SAABUQMetaObject@@XZ @ 51 NONAME ; struct QMetaObject const & BtSettingModel::getStaticMetaObject(void) - ?qt_metacast@BtSettingModel@@UAEPAXPBD@Z @ 52 NONAME ; void * BtSettingModel::qt_metacast(char const *) - ??0BtDeviceModel@@QAE@ABV0@PAVQObject@@@Z @ 53 NONAME ; BtDeviceModel::BtDeviceModel(class BtDeviceModel const &, class QObject *) - ?trUtf8@BtuiModelSortFilter@@SA?AVQString@@PBD0H@Z @ 54 NONAME ; class QString BtuiModelSortFilter::trUtf8(char const *, char const *, int) - ?tr@BtuiModelSortFilter@@SA?AVQString@@PBD0H@Z @ 55 NONAME ; class QString BtuiModelSortFilter::tr(char const *, char const *, int) - ?beginInsertDevices@BtDeviceModel@@AAEXHHPAX@Z @ 56 NONAME ; void BtDeviceModel::beginInsertDevices(int, int, void *) - ?staticMetaObject@BtSettingModel@@2UQMetaObject@@B @ 57 NONAME ; struct QMetaObject const BtSettingModel::staticMetaObject - ?data@BtSettingModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 58 NONAME ; class QVariant BtSettingModel::data(class QModelIndex const &, int) const - ?columnCount@BtSettingModel@@UBEHABVQModelIndex@@@Z @ 59 NONAME ; int BtSettingModel::columnCount(class QModelIndex const &) const - ?removeTransientDevices@BtDeviceModel@@QAEXXZ @ 60 NONAME ; void BtDeviceModel::removeTransientDevices(void) - ?trUtf8@BtDeviceModel@@SA?AVQString@@PBD0@Z @ 61 NONAME ; class QString BtDeviceModel::trUtf8(char const *, char const *) - ?metaObject@BtDeviceModel@@UBEPBUQMetaObject@@XZ @ 62 NONAME ; struct QMetaObject const * BtDeviceModel::metaObject(void) const - ?deviceDataChanged@BtDeviceModel@@AAEXHPAX@Z @ 63 NONAME ; void BtDeviceModel::deviceDataChanged(int, void *) - ?endInsertDevices@BtDeviceModel@@AAEXXZ @ 64 NONAME ; void BtDeviceModel::endInsertDevices(void) - ?trUtf8@BtSettingModel@@SA?AVQString@@PBD0H@Z @ 65 NONAME ; class QString BtSettingModel::trUtf8(char const *, char const *, int) - ?getStaticMetaObject@BtuiModelSortFilter@@SAABUQMetaObject@@XZ @ 66 NONAME ; struct QMetaObject const & BtuiModelSortFilter::getStaticMetaObject(void) - ?clearDeviceMajorFilters@BtuiModelSortFilter@@QAEXXZ @ 67 NONAME ; void BtuiModelSortFilter::clearDeviceMajorFilters(void) - ?tr@BtSettingModel@@SA?AVQString@@PBD0H@Z @ 68 NONAME ; class QString BtSettingModel::tr(char const *, char const *, int) - ?beginRemoveDevices@BtDeviceModel@@AAEXHHPAX@Z @ 69 NONAME ; void BtDeviceModel::beginRemoveDevices(int, int, void *) - ?getStaticMetaObject@BtDeviceModel@@SAABUQMetaObject@@XZ @ 70 NONAME ; struct QMetaObject const & BtDeviceModel::getStaticMetaObject(void) - ?data@BtDeviceModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 71 NONAME ; class QVariant BtDeviceModel::data(class QModelIndex const &, int) const - ?connectModelSignals@BtDeviceModel@@AAEXXZ @ 72 NONAME ; void BtDeviceModel::connectModelSignals(void) - ?connectModelSignals@BtSettingModel@@AAEXXZ @ 73 NONAME ; void BtSettingModel::connectModelSignals(void) - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/btuimodel/eabi/btuimodelu.def --- a/bluetoothengine/btui/btuimodel/eabi/btuimodelu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -EXPORTS - _ZN13BtDeviceModel11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME - _ZN13BtDeviceModel11qt_metacastEPKc @ 2 NONAME - _ZN13BtDeviceModel12searchDeviceEv @ 3 NONAME - _ZN13BtDeviceModel16endInsertDevicesEv @ 4 NONAME - _ZN13BtDeviceModel16endRemoveDevicesEv @ 5 NONAME - _ZN13BtDeviceModel16staticMetaObjectE @ 6 NONAME DATA 16 - _ZN13BtDeviceModel17deviceDataChangedEiPv @ 7 NONAME - _ZN13BtDeviceModel17deviceDataChangedEiiPv @ 8 NONAME - _ZN13BtDeviceModel18beginInsertDevicesEiiPv @ 9 NONAME - _ZN13BtDeviceModel18beginRemoveDevicesEiiPv @ 10 NONAME - _ZN13BtDeviceModel18cancelSearchDeviceEv @ 11 NONAME - _ZN13BtDeviceModel19getStaticMetaObjectEv @ 12 NONAME - _ZN13BtDeviceModel21deviceSearchCompletedEi @ 13 NONAME - _ZN13BtDeviceModel22removeTransientDevicesEv @ 14 NONAME - _ZN13BtDeviceModel25emitDeviceSearchCompletedEi @ 15 NONAME - _ZN13BtDeviceModelC1EP7QObject @ 16 NONAME - _ZN13BtDeviceModelC1ERKS_P7QObject @ 17 NONAME - _ZN13BtDeviceModelC2EP7QObject @ 18 NONAME - _ZN13BtDeviceModelC2ERKS_P7QObject @ 19 NONAME - _ZN13BtDeviceModelD0Ev @ 20 NONAME - _ZN13BtDeviceModelD1Ev @ 21 NONAME - _ZN13BtDeviceModelD2Ev @ 22 NONAME - _ZN14BtSettingModel11qt_metacallEN11QMetaObject4CallEiPPv @ 23 NONAME - _ZN14BtSettingModel11qt_metacastEPKc @ 24 NONAME - _ZN14BtSettingModel16staticMetaObjectE @ 25 NONAME DATA 16 - _ZN14BtSettingModel18settingDataChangedEiPv @ 26 NONAME - _ZN14BtSettingModel18settingDataChangedEiiPv @ 27 NONAME - _ZN14BtSettingModel19getStaticMetaObjectEv @ 28 NONAME - _ZN14BtSettingModelC1EP7QObject @ 29 NONAME - _ZN14BtSettingModelC1ERKS_P7QObject @ 30 NONAME - _ZN14BtSettingModelC2EP7QObject @ 31 NONAME - _ZN14BtSettingModelC2ERKS_P7QObject @ 32 NONAME - _ZN14BtSettingModelD0Ev @ 33 NONAME - _ZN14BtSettingModelD1Ev @ 34 NONAME - _ZN14BtSettingModelD2Ev @ 35 NONAME - _ZN19BtuiModelSortFilter11qt_metacallEN11QMetaObject4CallEiPPv @ 36 NONAME - _ZN19BtuiModelSortFilter11qt_metacastEPKc @ 37 NONAME - _ZN19BtuiModelSortFilter16staticMetaObjectE @ 38 NONAME DATA 16 - _ZN19BtuiModelSortFilter19getStaticMetaObjectEv @ 39 NONAME - _ZN19BtuiModelSortFilter20addDeviceMajorFilterEiNS_10FilterModeE @ 40 NONAME - _ZN19BtuiModelSortFilter20setDeviceMajorFilterEiNS_10FilterModeE @ 41 NONAME - _ZN19BtuiModelSortFilter22clearDeviceMajorFilterEiNS_10FilterModeE @ 42 NONAME - _ZN19BtuiModelSortFilter22deviceAcceptedByFilterEi @ 43 NONAME - _ZN19BtuiModelSortFilter23clearDeviceMajorFiltersEv @ 44 NONAME - _ZN19BtuiModelSortFilter9hasFilterEiNS_10FilterModeE @ 45 NONAME - _ZN19BtuiModelSortFilterC1EP7QObject @ 46 NONAME - _ZN19BtuiModelSortFilterC2EP7QObject @ 47 NONAME - _ZN19BtuiModelSortFilterD0Ev @ 48 NONAME - _ZN19BtuiModelSortFilterD1Ev @ 49 NONAME - _ZN19BtuiModelSortFilterD2Ev @ 50 NONAME - _ZNK13BtDeviceModel10metaObjectEv @ 51 NONAME - _ZNK13BtDeviceModel11columnCountERK11QModelIndex @ 52 NONAME - _ZNK13BtDeviceModel4dataERK11QModelIndexi @ 53 NONAME - _ZNK13BtDeviceModel5indexEiiRK11QModelIndex @ 54 NONAME - _ZNK13BtDeviceModel6parentERK11QModelIndex @ 55 NONAME - _ZNK13BtDeviceModel8itemDataERK11QModelIndex @ 56 NONAME - _ZNK13BtDeviceModel8rowCountERK11QModelIndex @ 57 NONAME - _ZNK14BtSettingModel10metaObjectEv @ 58 NONAME - _ZNK14BtSettingModel11columnCountERK11QModelIndex @ 59 NONAME - _ZNK14BtSettingModel4dataERK11QModelIndexi @ 60 NONAME - _ZNK14BtSettingModel5indexEiiRK11QModelIndex @ 61 NONAME - _ZNK14BtSettingModel6parentERK11QModelIndex @ 62 NONAME - _ZNK14BtSettingModel8itemDataERK11QModelIndex @ 63 NONAME - _ZNK14BtSettingModel8rowCountERK11QModelIndex @ 64 NONAME - _ZNK19BtuiModelSortFilter10metaObjectEv @ 65 NONAME - _ZNK19BtuiModelSortFilter16filterAcceptsRowEiRK11QModelIndex @ 66 NONAME - _ZNK19BtuiModelSortFilter8lessThanERK11QModelIndexS2_ @ 67 NONAME - _ZTI13BtDeviceModel @ 68 NONAME - _ZTI14BtSettingModel @ 69 NONAME - _ZTI19BtuiModelSortFilter @ 70 NONAME - _ZTV13BtDeviceModel @ 71 NONAME - _ZTV14BtSettingModel @ 72 NONAME - _ZTV19BtuiModelSortFilter @ 73 NONAME - _ZN14BtSettingModel19connectModelSignalsEv @ 74 NONAME - _ZN13BtDeviceModel19connectModelSignalsEv @ 75 NONAME - diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/data/BTUI.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/data/BTUI.rss Wed Sep 01 12:20:04 2010 +0100 @@ -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: This file contains all the resources for the BTUI. +* +*/ + + +#include + +// RESOURCE IDENTIFIER + +NAME BTUI // 4 letter ID + +// INCLUDES +#include +#include "btui.hrh" // Enums for these resources +#include // Localisation file +#include // Icon indexes created by abld +#include "eikon.rsg" +#include +#include +#include + +// MACROS + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="BTUI"; } + +RESOURCE EIK_APP_INFO + { + status_pane = r_btui_status_pane; + } + +//---------------------------------------------------- +// +// Hotkeys for BTUI +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_btui_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + +//---------------------------------------------------- +// +// The status pane for BTUI application +// +//---------------------------------------------------- +// +RESOURCE STATUS_PANE_APP_MODEL r_btui_status_pane + { + panes = + { + SPANE_PANE + { + id = EEikStatusPaneUidNavi; + type = EAknCtNaviPane; + resource = r_btui_navi_decorator; + } + }; + } + +//---------------------------------------------------- +// +// The navi decorator for BTUI application +// Defines application views tabs +// +//---------------------------------------------------- +// +RESOURCE NAVI_DECORATOR r_btui_navi_decorator + { + type = ENaviDecoratorControlTabGroup; + control = TAB_GROUP + { + tab_width = EAknTabWidthWithThreeTabs; + active = 0; // Initial tab to be active + tabs = + { + TAB + { + id = EBTUIMainViewTab; + bmpfile = btui_bitmap_file_data_caging; + bmpid = EMbmBtuiQgn_prop_bt_set_tab3; + bmpmask = EMbmBtuiQgn_prop_bt_set_tab3_mask; + }, + TAB + { + id = EBTUIPairedDevicesViewTab; + bmpfile = btui_bitmap_file_data_caging; + bmpid = EMbmBtuiQgn_prop_bt_devices_tab3; + bmpmask = EMbmBtuiQgn_prop_bt_devices_tab3_mask; + }, + + TAB + { + id = EBTUIBlockedDevicesViewTab; + bmpfile = btui_bitmap_file_data_caging; + bmpid = EMbmBtuiQgn_prop_bt_blocked_tab3; + bmpmask = EMbmBtuiQgn_prop_bt_blocked_tab3_mask; + } + }; + }; + } + + + +//---------------------------------------------------- +// +// LOCALISABLE_APP_INFO +// +//---------------------------------------------------- + + +RESOURCE LOCALISABLE_APP_INFO r_btui_localisable_app_info + { + short_caption = qtn_apps_bluetooth_grid; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_bluetooth_list; + #ifdef __SCALABLE_ICONS + number_of_icons = 1; + icon_file = APP_BITMAP_DIR"\\Btui_aif.mif"; + #else + number_of_icons = 2; + icon_file = APP_BITMAP_DIR"\\Btui_aif.mbm"; + #endif + }; + } + + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/data/Btui_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/data/Btui_reg.rss Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,33 @@ +/* +* 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 +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x10005951 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "Btui"; + localisable_resource_file = APP_RESOURCE_DIR"\\btui"; + localisable_resource_id = R_BTUI_LOCALISABLE_APP_INFO; + } + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/BWINS/btdevmodelU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/BWINS/btdevmodelU.DEF Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,16 @@ +EXPORTS + ??0TBTDevice@@QAE@XZ @ 1 NONAME ; TBTDevice::TBTDevice(void) + ?IsAnyDeviceConnected@CBTDevModel@@QAEHXZ @ 2 NONAME ; int CBTDevModel::IsAnyDeviceConnected(void) + ?CancelChange@CBTDevModel@@QAEXABVTBTDevice@@@Z @ 3 NONAME ; void CBTDevModel::CancelChange(class TBTDevice const &) + ?ReverseCompareAphabetically@TBTDeviceComparison@@SAHABVTBTDevice@@0@Z @ 4 NONAME ; int TBTDeviceComparison::ReverseCompareAphabetically(class TBTDevice const &, class TBTDevice const &) + ?ChangeDevice@CBTDevModel@@QAEXPBVCBTDevice@@PAV?$TPckgBuf@VTNameRecord@@@@W4TBTDeviceOp@@@Z @ 5 NONAME ; void CBTDevModel::ChangeDevice(class CBTDevice const *, class TPckgBuf *, enum TBTDeviceOp) + ?DeviceChangeInProgress@CBTDevModel@@QAEHXZ @ 6 NONAME ; int CBTDevModel::DeviceChangeInProgress(void) + ??0TBTDevice@@QAE@ABV0@@Z @ 7 NONAME ; TBTDevice::TBTDevice(class TBTDevice const &) + ?CreateDeviceL@CBTDevModel@@QAEPAVTBTDevice@@PBVCBTDevice@@PAV?$TPckgBuf@VTNameRecord@@@@@Z @ 8 NONAME ; class TBTDevice * CBTDevModel::CreateDeviceL(class CBTDevice const *, class TPckgBuf *) + ?ChangeDevice@CBTDevModel@@QAEXABVTBTDevice@@@Z @ 9 NONAME ; void CBTDevModel::ChangeDevice(class TBTDevice const &) + ??4TBTDevice@@QAEAAV0@ABV0@@Z @ 10 NONAME ; class TBTDevice & TBTDevice::operator=(class TBTDevice const &) + ?ChangeAllDevices@CBTDevModel@@QAEXW4TBTDeviceOp@@@Z @ 11 NONAME ; void CBTDevModel::ChangeAllDevices(enum TBTDeviceOp) + ?GetDevice@CBTDevModel@@QAEHAAVTBTDevice@@@Z @ 12 NONAME ; int CBTDevModel::GetDevice(class TBTDevice &) + ?NewL@CBTDevModel@@SAPAV1@W4TBTDeviceGroup@@PAVMBTDeviceObserver@@PAV?$TLinearOrder@VTBTDevice@@@@@Z @ 13 NONAME ; class CBTDevModel * CBTDevModel::NewL(enum TBTDeviceGroup, class MBTDeviceObserver *, class TLinearOrder *) + ?CompareAphabetically@TBTDeviceComparison@@SAHABVTBTDevice@@0@Z @ 14 NONAME ; int TBTDeviceComparison::CompareAphabetically(class TBTDevice const &, class TBTDevice const &) + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/eabi/btdevmodelu.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/eabi/btdevmodelu.DEF Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,18 @@ +EXPORTS + _ZN11CBTDevModel12CancelChangeERK9TBTDevice @ 1 NONAME + _ZN11CBTDevModel12ChangeDeviceEPK9CBTDeviceP8TPckgBufI11TNameRecordE11TBTDeviceOp @ 2 NONAME + _ZN11CBTDevModel12ChangeDeviceERK9TBTDevice @ 3 NONAME + _ZN11CBTDevModel13CreateDeviceLEPK9CBTDeviceP8TPckgBufI11TNameRecordE @ 4 NONAME + _ZN11CBTDevModel16ChangeAllDevicesE11TBTDeviceOp @ 5 NONAME + _ZN11CBTDevModel20IsAnyDeviceConnectedEv @ 6 NONAME + _ZN11CBTDevModel22DeviceChangeInProgressEv @ 7 NONAME + _ZN11CBTDevModel4NewLE14TBTDeviceGroupP17MBTDeviceObserverP12TLinearOrderI9TBTDeviceE @ 8 NONAME + _ZN11CBTDevModel9GetDeviceER9TBTDevice @ 9 NONAME + _ZN19TBTDeviceComparison20CompareAphabeticallyERK9TBTDeviceS2_ @ 10 NONAME + _ZN19TBTDeviceComparison27ReverseCompareAphabeticallyERK9TBTDeviceS2_ @ 11 NONAME + _ZN9TBTDeviceC1ERKS_ @ 12 NONAME + _ZN9TBTDeviceC1Ev @ 13 NONAME + _ZN9TBTDeviceC2ERKS_ @ 14 NONAME + _ZN9TBTDeviceC2Ev @ 15 NONAME + _ZN9TBTDeviceaSERKS_ @ 16 NONAME + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project btdevmodel +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/btdevmodel.h |../../../inc/btdevmodel.h +PRJ_MMPFILES +btdevmodel.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/group/btdevmodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/group/btdevmodel.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,52 @@ +/* +* 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 definition file for project btdevmodel +* +*/ + + + +#include +#include + +TARGET btdevmodel.dll +TARGETTYPE DLL +UID 0x10009D8D 0x1020745E + +CAPABILITY CAP_GENERAL_DLL NetworkControl +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE btdevmodel.cpp +SOURCE btdevmodelbase.cpp +SOURCE btpairedmodel.cpp +SOURCE btblockedmodel.cpp +SOURCE btregistryobserver.cpp +SOURCE btdevice.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +SYSTEMINCLUDE ../../../inc +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib //CActive, TDes +LIBRARY btengsettings.lib +LIBRARY btengdevman.lib +LIBRARY btengconnman.lib +LIBRARY btmanclient.lib //TBTRegistrySearch,CBluetoothPhysicalLinks +LIBRARY bluetooth.lib //TBTDevAddr +LIBRARY btdevice.lib +LIBRARY centralrepository.lib +LIBRARY esock.lib //btpairedmodel +DEBUGLIBRARY flogger.lib diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/inc/btblockedmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/inc/btblockedmodel.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,73 @@ +/* +* 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: Maintains a Bluetooth devices data model for blocked devices view. +* +*/ + +#ifndef BTBLOCKEDMODEL_H +#define BTBLOCKEDMODEL_H + +#include "btdevmodelbase.h" +/** +* This is a adds funtionality to show only blocked devices to BTDevModelBase. +* +* It act as a mediator between UI applications and Bluetooth Engine Device Management API. +* +*@lib btdevmodel.dll +*@since S60 V3.2 +*/ +NONSHARABLE_CLASS(CBTBlockedModel) : public CBTDevModelBase + { +public: // Constructors and destructor + /** NewL function + * @param aObserver The observer will receive information about command completes and + * changes in the devices. + * @param aOrder The order the devices are sorted. Default order is added by CBTDevMan, so + * this class can assume this parameter to be used. This class is responsible for deleting this parameter on + * its destructor. + */ + static CBTBlockedModel* NewL(MBTDeviceObserver* aObserver , + TBTDeviceSortOrder* aOrder ); + /** Destructor + */ + virtual ~CBTBlockedModel(); + + /** Add new device to the list, but only if the device is blocked. + * This function will filter out those devices that are not blocked. + *@param aRegdevice the device to be added to the list + */ + void HandleNewDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry); + +private: + /** Constructor + * @param aObserver The observer will receive information about command completes and + * changes in the devices. + * @param aOrder The order the devices are sorted. Default order is added by CBTDevMan, so + * this class can assume this parameter to be used. This class is responsible for deleting this parameter on + * its destructor. + */ + CBTBlockedModel(MBTDeviceObserver* aObserver , + TBTDeviceSortOrder* aOrder ); + /** Symbian 2nd phase constuctor that may leave. + *@param None. + * @return None. + */ + void ConstructL(); + + + }; + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/inc/btdevmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/inc/btdevmodel.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,304 @@ +/* +* 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: Maintain a Bluetooth devices data model for UI components. +* +*/ + +#ifndef BTDEVMODEL_H +#define BTDEVMODEL_H + +#include +#include +#include +#include + +// used to support different device list of UI +enum TBTDeviceGroup + { + EGroupPaired, // for paired device list + EGroupBlocked // for blocked device list + }; + +// for showing left side icon of a device in device list. Based on CoD major device +enum TBTDeviceType + { + EDeviceComputer = 0,// computer + EDevicePhone, // mobile phone + EDeviceAudio, // headset or loudspeakers + EDeviceCarkit, // audio-caraudio + EDevicePrinter, // imaging-printer + EDeviceKeyboard, // peripheral-keyboard + EDeviceMice, // peripheral-pointer + EDeviceGPS, // major service positioning + EDeviceDefault, // device of other type than define above. + }; + +// for showing right side icon of a device on a device list +enum TBTDeviceStatus + { + EStatusTrusted = 0x0001, // show authorised icon on both paired and blocked lists + EStatusBtuiConnected = 0x0002, // show connected icon on paired list + EStatusBlocked = 0x0004, // show device on blocked list + EStatusPaired = 0x0008, // show the device in paired devices list + EStatusConnectable = 0x0010, // The device can be connected to. + // NOTE: connected devices are also connectable, + // despite they cannot be connected before disconnect. + EStatusPhysicallyConnected = 0x0020 // Physical bluetooth connection. + }; + +enum TBTDeviceOp + { + EOpPair, + EOpUnpair, + EOpBlock, + EOpUnblock, + EOpConnect, + EOpDisconnect, + EOpTrust, + EOpUntrust, + EOpChangeName, + EOpNone, + EOPInternalUntust // used by CBTDevModel internally + }; + +/* TBTDevAddr that is not address of any device +*/ +#define KNullAddress TBTDevAddr(TInt64(0)) + +// contain all device info needed for shown on a device list +NONSHARABLE_CLASS( TBTDevice ) + { +public: + /** Constructor, that initialized this as empty*/ + IMPORT_C TBTDevice(); + /** Copy constructor */ + IMPORT_C TBTDevice(const TBTDevice& aDevice); + /** Copy */ + IMPORT_C TBTDevice& operator=(const TBTDevice& aDevice); + + TBTDeviceType iType; // left side icon + TBTDeviceClass iDeviceClass; // this is needed by connect + TBTDeviceName iName; // a formated friendly/device name in corresponding CBTDevice + TBTDeviceName iFriendlyName; // still need to remember if friendly name has been set + TUint iStatus; // mask of TDeviceStatus + TBTDeviceOp iOperation; // last operation on the device + TBTDevAddr iAddr; // bt device address + TInt iIndex; // new position of the device in the device list. + // Default value means iAddr should be used instead. + TBTLinkKeyType iLinkKeyType; + TNameEntry iNameEntry; // the device's EIR data + }; +/** Static methods for TBTDeviceComparison. These are meant to be given to TBTDeviceSortOrder and +* to be used for defining sort orders. +*/ +class TBTDeviceComparison + { +public: + /** + * Compare function for alphabetic sorting order. + * @param aFirstDevice to be compared + * @param aSecondDevice sencond device to be compared + * @return 1 if aFirstDevice is before aSecondDevice -1 otherwise. May not return 0, + * on devices that are not the same. + */ + + IMPORT_C static TInt CompareAphabetically( + const TBTDevice& aFirstDevice, const TBTDevice& aSecondDevice) ; + + /** + * Compare function for reverse alphabetic sorting order. + * @param aFirstDevice to be compared + * @param aSecondDevice sencond device to be compared + * @return 1 if aFirstDevice is before aSecondDevice -1 otherwise. May not return 0, + * on devices that are not the same. + */ + IMPORT_C static TInt ReverseCompareAphabetically( + const TBTDevice& aFirstDevice, const TBTDevice& aSecondDevice) ; + }; + +typedef RPointerArray RDeviceArray; +typedef RPointerArray RBTDevNameArray; +typedef TLinearOrder TBTDeviceSortOrder ; + +class CBTDevModelBase; + +/** +* Callback interface for informing about the changes in the devices shown by the listening view. +* Also a callback interface that informs the listener when the issued commands have been completed. +*/ +class MBTDeviceObserver + { +public: + /** + * Informs the observer that ChangeDevice command has been completed. + * + * The listener must not change the displaid devices, since RefreshDeviceList is used for that purpose. + * Also this will not be called, if changes happen from outside such as pairing initiated by 3rd party + * of blocking from notifier. + * + * @param aErr Symbian error code, KErrNone if no error. + * @param aDevice the device which is changed. This has allways given to the listener by RefreshDeviceList + * prior this call, if that device is visible at the listening view. This not passed by refrence, + * since this device could change, if registry is changed + * @param aDevNameArray hold conflicting devices' short names if "AlreadyExist" error happened during "connect" + * @return None. + */ + virtual void NotifyChangeDeviceComplete(const TInt aErr, const TBTDevice& aDevice, + const RBTDevNameArray* aDevNameArray = NULL) = 0; + + /** + * This is used to notify the listening graphic component that the deviceList is changed. + * After receiving this call the graphic component has to redraw its screen to match this list. + * @param aDevices The devices to be displaid. + * @param aSelectedItemIndex The index of the item to be selected in the given devices. + */ + virtual void RefreshDeviceList(const RDeviceArray* aDevices,TInt aSelectedItemIndex) =0; + + /** + * This is used before calling RefreshDeviceList to save the currently selected index, + * so that the same device could be selected after the refresh, if that device still exists. + * @param None. + * @return the selected device. KErrNotFound if the view has no devices. + */ + virtual TInt CurrentItemIndex() =0; + }; + +/** +* This is a abstract class providing basic common fucntions for derived classes. +* It act as a facade between UI applications and Bluetooth Engine Device Management API. +*/ +NONSHARABLE_CLASS( CBTDevModel ) : public CBase + { +public: // Constructors and destructor + /** + * Constructs devmodel. + * @param aGroup. do you wish to list other or blocked devices. + * @param MBTDeviceObserver The object that will receive the notifications for command completes, + * @param the order the devices are sorted in the list. If you do not give this the devices + * will be sorted in ascending alphabetic order. Devices with same name are sorted according to + * bluetooth addreses. DevModel will take the ownership of this object. + */ + IMPORT_C static CBTDevModel* NewL(const TBTDeviceGroup aGroup, + MBTDeviceObserver* aObserver=NULL, + TBTDeviceSortOrder* aOrder=NULL); + /** Destructor */ + virtual ~CBTDevModel(); + +public: // New functions + + /** + * Get device based on addr or index. + * @param aDevice the TBTDevice holder. The device address is passed in + * @return KErrNone if ok. + * KErrArgument, if neither index not address is filled. + * KErrOverFlow if index is out of range. + * KErrNotFound if the given address does not exists, in the internal array. + */ + IMPORT_C TInt GetDevice(TBTDevice& aDevice); + + /** + * Checks if any of the devices shown in view have active bluetooth connection. + * @return ETrue, if one or more devices are connected. EFalse if no devices are connected. + * This also return EFalse, in case of blocked devices. + */ + IMPORT_C TBool IsAnyDeviceConnected(); + + /** + * Creates and allocates TBTDevice representation of this device. + * The caller is responsibe for the garbage connection of the created device. + * @param aRegDevice the device to be converted + * @return the TBTDevice representation of the same device + */ + IMPORT_C TBTDevice* CreateDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry); + + /** + * Change status of all devices on the list, e.g. used by unpair all and unblock all commands. + * @param aOperation unpair/unblock + * @return None. + */ + IMPORT_C void ChangeAllDevices(const TBTDeviceOp aOperation); + + /** + * Change device status, add device, e.g. pair/block, or delete device,e.g. unpair/unblcok + * You must not pair device without properly filling deviceName. + * @param aDevice the TBTDevice holder. The device address is passed in + * @return None + */ + IMPORT_C void ChangeDevice(const TBTDevice& aDevice); + + /** + * Change device status, add device, e.g. pair/block, or delete device,e.g. unpair/unblcok + * @param aDevice the CBTDevice holder. + * @return None. + */ + IMPORT_C void ChangeDevice(const CBTDevice* aDevice, + TNameEntry* aNameEntry, + TBTDeviceOp aOp) ; + + /** + * Cancel ongoing operation, such as connecting or pairing. + * At the moment btui does not support other Other operations than pairing and connecting cannot be canceled. + * + * @param aDevice the device, whose command is to be canceled. + * @return None. + */ + IMPORT_C void CancelChange(const TBTDevice& aDevice); + + /** + *Checks if there are ChangeDeviceCommands that are not finnished. + */ + IMPORT_C TBool DeviceChangeInProgress(); + + +private: + /** constructor */ + CBTDevModel(); + + /** Symbian 2nd phase constuctor that may leave. + * @param aGroup EGroupPaired and EGroupBlocked are supported. + * @param aObserver the observer of the device list. This is not mandatory + * @param aOrder The order the devices are sorted + */ + void ConstructL(const TBTDeviceGroup aGroup, + MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder ); +private: + + CBTDevModelBase* iDevModel; // CBTDevModelPaired or CBTDevModel Blocked + TBTDeviceGroup iGroup; + }; + + +/** Adds flags to iStatus of TBTDevice. + *@param aStatus the status of the device + *@param aFlags the flags to be set + */ +inline TUint SetStatusFlags(TUint& aStatus,TBTDeviceStatus aFlags) + { + aStatus |=aFlags; + return aStatus; + } +/** Clear status flags to iStatus of TBTDevice. + *@param aStatus the status of the device + *@param aFlags the flags to be set + */ +inline TUint UnsetStatusFlags(TUint& aStatus,TBTDeviceStatus aFlags) + { + aStatus &= ~aFlags; + return aStatus; + } + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/inc/btdevmodelbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/inc/btdevmodelbase.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,286 @@ +/* +* 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: Abstract base class for concete models. +* +*/ + + +#ifndef BTDEVMODELBASE_H +#define BTDEVMODELBASE_H + +#include // for MBTEngDevManObserver + +#include "btdevmodel.h" +#include "btregistryobserver.h" // for MBTRegistryObserver + +/** +* This is a abstract class providing basic common fucntions for derived classes. +* It act as a mediator between UI applications and Bluetooth Engine Device Management API. +* +*@lib btdevmodel.dll +*@since S60 V3.2 +*/ +NONSHARABLE_CLASS( CBTDevModelBase ): public CBase, public MBTEngDevManObserver, public MBTRegistryObserver + { +public: // Constructors and destructor + /** destructor + *@param none. + *@return none. + */ + virtual ~CBTDevModelBase(); +public: + + /** Checks if any of the devices shown in view have active bluetooth connection. + * This baseclass does not support connections, so the answer is allways EFalse. + * + * NOTE: TBTUIViewsCommonUtils::IsAnyDeviceConnectedL will report also those devices + * that are not part of particular view, such as paired devices. + * CBTPairedModel::IsAnyDeviceConnected reports only connection from paired devices. + * + *@return ETrue, if one or more devices are connected. EFalse if no devices are connected. + */ + TBool virtual IsAnyDeviceConnected(); + /** + * Get device based on addr or index. + * @param aDevice the TBTDevice holder. You have to set either the deviceAddress or the + * or the device index. If you specify both the device address and the index then the address is used, + * this includes those cases when there is no device corresponding the address. + * @return KErrNone if ok. + * KErrArgument, if neither index not address is filled. + * KErrOverFlow if index is out of range. which means it is negative or the internal array does not have that + * many items. + * KErrNotFound if the given address does not exists, in the internal array. + */ + TInt virtual GetDevice(TBTDevice& aDevice); + + /** + * Change status of all devices on the list. This is used by Delete All operations in paired devices view + * (EOpPair) and Blocked devices view(EOpUnblock) + * + * This creates multiple operations in the intergal queue that are all executed on by one. + * + * @param aOperation unpair/unblock + * @return None. + */ + void ChangeAllDevices(const TBTDeviceOp aOperation); + + /** + * Change device status, add device, e.g. block, unpair,unblock etc. + * + * The operation is put to queue and executed when the prior operations + * of the queue are finnished. Immeadiately if the queue is empty. + * + * @param aDevice. The device and the type of the change. If the address is empty, then the + * device index means what device is to be used. + * @return none + */ + virtual void ChangeDeviceL(const TBTDevice& aDevice); + + /** + * Change device status, add device, e.g. block, unpair,unblock etc. + * This will check for leaves and make a callback, if leave occurs. + * + * The operation is put to queue and executed when the prior operations + * of the queue are finnished. Immeadiately if the queue is empty. + * + * @param aDevice. The device and the type of the change. If the address is empty, then the + * device index means what device is to be used. + * @return none + */ + + virtual void ChangeDevice(const TBTDevice& aDevice); + + /** + * Cancel connecting, pairing, modifying device in BTRegistry + * + * Cancels ongoing operation or operation from queue, if it has not been started yet. + * Cancels it, if it is being executed. Used by Canceling Connecting and pairing operations. + * + * @param aDevice. The device and the type of the change that will be canceled. + * If the address is empty, then the + * device index means what device is to be used. + * @return None. + */ + virtual void CancelChange(const TBTDevice& aDevice); + + /** Creates and allocates TBTDevice representation of this device + *@param aRegDevice the device to be converted, + *@param aNameEntry contains the EIR data of the device if its data is valid + *@return the TBTDevice representation of the same device. (Note the caller is responsible for deleting + * the returned item.) + */ + virtual TBTDevice* CreateDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry); + + /** Checks if there are any ChangeDeviceCommands that are not finnished. + *@return ETrue if the are one or more commands being executed or are in the execution queue. + */ + virtual TBool DeviceChangeInProgress(); + + /** This is used to make callback to iObserver, when a leave has been detected. + *It will also clean up the partial operation. + * + *@param aErr the leave error code + *@param aDevice The device and operation that cause the leave. + * If this is inserted in the queue, it is deleted from there. + * If the leave occurred before inserting it to execution queue + * (not common), then it will not deleted from there. + *@return none. + */ + virtual void HandleLeave(TInt aErr,const TBTDevice* aDevice ); + +protected: + /** + * Change device status, add device, e.g. block, unpair,unblock etc. + * + * This is the operation that is used to to execute the operation queued by ChangeDevice. + * + * @param aDevice. The device and the type of the change. If the address is empty, then the + * device index means what device is to be used. + * @return KerrNone or system wide error code. + */ + virtual TInt DoChangeDeviceL(const TBTDevice& aDevice); + + /** + * Cancel ongoing connecting, pairing, modifying device in BTRegistry + * + * This is the operation that is used to cancel ongoing operation. + * + * @param aDevice. The device and the type of the change that will be canceled. + * If the address is empty, then the + * device index means what device is to be used. + * @return None. + */ + virtual void DoCancelChangeL(const TBTDevice& aDevice); + + /** This function recounts the indexes of iDeviceArray. + *@return none. + */ + void RenumberDeviceArray(); + + /** Constructor + * @param aObserver The observer will receive information about command completes and + * changes in the devices. + * @param aOrder The order the devices are sorted. Default order is added by CBTDevMan, so + * this class can assume this parameter to be used. This class is responsible for deleting this parameter on + * its destructor. + */ + CBTDevModelBase(MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder ); + + /** Get the index for a device specified by bluetooth device address. + * + *@param aAddr the address of the searched device or KNullAddres. + *@param aIndexIfNullAddress, if this parameter is defined this function + *returns this index instead of KErrNotFound, it the device has nullAddress. + *@return index of the address. If the given address is KNullAddress then returns aIndexIfNullAddress or KErrNotFound if one is not specified by called. + *This will allways return KErrNone if the given address is not a KNullAddress and is not found. + */ + TInt GetIndexByAddress(const TBTDevAddr aAddr,TInt aIndexIfNullAddress=KErrNotFound); + + /** Adds the TBTDevice representation of this device to iDeviceArray, if + * this device is of that type (paired/blocked) that this model supports. + * If the device is not that type, it will not be added. + * + * NOTE: This function is not guaranteed againt duplicates, so multiple + * additions of the same device will lead to multiple copies of it. + * + * Subclasses can also implement their version of this function to add information + * to the device objects, such as connection information. + * + * @param aRegDevice the device to be added (if not filtered). + * @param aNameEntry contains the EIR data of the device if its data is valid + * @aOperation the operation that this device will contain when added. + */ + void AddDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry, + const TBTDeviceOp aOperation=EOpNone); + + /** Replaces iDeviceArray contents with the given devices + *@param aDeviceArray the devices that will be added to internal structures. + */ + virtual void CreateDevicesL(const CBTDeviceArray* aDeviceArray); + + /** Adds the given device to internal structures of this class + * using AddDeviceL, if the device is such that it should not be listed by this + * class, then it is not added. + * + * Implementing is used to filter out devices that are not handled by particular view. + * + * @param aNameEntry contains the EIR data of the device if its data is valid + */ + virtual void HandleNewDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) = 0; + + /** Sends refresh of list of shown devices to listener. + * + * @param aErr If this is not KErrNone, then this function + * will send refresh to the listener. Allways send, if not specified. + * If this funtion is not KEerrNone, then the funtion does nothing. + * @param aSelectedItem. If this is specified, then select this item. + * if not specified uses the same item that the listener used to have active. + */ + virtual void SendRefreshIfNoError(TInt aErr=KErrNone,TInt aSelectedItem = KErrNotSupported ); + +protected: + + /** This callback is used to to notify this call from completed changed from iDevMan. + * Inherited from MBTEngDevManObserver. + * + * This funtion will trap any leave if they may occur and report them as errors in the + * corresponfing device change operarion. + */ + void HandleDevManComplete(TInt aErr); + + /** Inherited from BTEng's MBTEngDevManObserver, and implemented as empty, + * because we do ask devicelists directly from iDevman, but trough iRegistryObserver->Refresh() + */ + void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); + + /** This callback is used by iRegistryObserver to notify device changes, that + * originate both from changes of the BTRegistry as well as refreshes requested + * by this class. + * @aDeviceArray the devices that the registry observer gets. + */ + void RegistryChangedL(const CBTDeviceArray* aDeviceArray); + + /** Check if there is allready one or more devices with this name. + *@return ETrue if there is. + */ + TBool IsNameExisting(const TDesC& aName); + + /** Executes the next one in the queue, if any. + * Leaves are trapped by this class and send as failed commands to iObserver + * using HandleLeave. + *@param none. + *@return none. + */ + void HandleQueue(); + +protected: // Data + MBTDeviceObserver* iObserver; // the listener of the completed commands and registry changes. + CBTEngDevMan* iDevMan; // This is used to change the devices. + TBTDeviceSortOrder* iSortOrder; // The order the devices are sorted to. + RDeviceArray iDeviceArray; // The list of current devices. + CBTRegistryObserver* iRegistryObserver; // This takes care of sending the devicelist to us each time + // something may have been changes. + TBTRegistrySearch iSearchPattern; // the pattern iRegistrySearch uses in retrieving devicelist. + // NOTE: HandleDeviceL is used to filter the results. + TBool iIsChangeAll; + TBTDevice* iDevice; // the currently changed device, if any + RDeviceArray iQueue; // The queue of commands to be executed + }; + +#endif // BT_DEV_MODEL_BASE_H + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/inc/btpairedmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/inc/btpairedmodel.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,282 @@ +/* +* 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: The model that is used to list and handle all paired devices. +* +*/ + + +#ifndef BTPAIREDMODEL_H +#define BTPAIREDMODEL_H + +#include "btdevmodelbase.h" +#include +#include // for TBTDevAddr +#include //for TBTPowerStateValue +#include +#include + +enum TPairedModelState + { + EIdleState=0, + EDeleteDeviceState, + EAddDeviceState, + EPairDeviceState, + EDisconnectBeforeOperationState, + }; +class CBTEngSettings; + +/** +* This is a adds pairing and connecting functionality to BTDevModelBase. +* +* It act as a mediator between UI applications and Bluetooth Engine Device Management API. +* +*@lib btdevmodel.dll +*@since S60 V3.2 +*/ +NONSHARABLE_CLASS(CBTPairedModel) : + public CBTDevModelBase, public MBTEngConnObserver, + public MBluetoothPhysicalLinksNotifier, + public MBTEngSettingsObserver + { + +public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CBTPairedModel(MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder ); + + /** Symbian 2nd phase constuctor that may leave. + *@param None. + *@return None. + */ + void ConstructL(); + + /** + * NewL function + * @param aObserver The observer will receive information about command completes and + * changes in the devices. + * @param aOrder The order the devices are sorted. Default order is added by CBTDevMan, so + * this class can assume this parameter to be used. This class is responsible for deleting this parameter on + * its destructor. + */ + static CBTPairedModel* NewL(MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder ); + + /** + * Destructor + * @param None. + */ + virtual ~CBTPairedModel(); + + /** + * Checks if any of the devices shown in paired devices view have active bluetooth connection. + * + * NOTE: TBTUIViewsCommonUtils::IsAnyDeviceConnectedL will also check + * those devices that are not paired. + * + *@return ETrue, if one or more devices are connected. EFalse if no devices are connected. + */ + TBool virtual IsAnyDeviceConnected(); + + /** + * Start new device pairing. This is handled by Queue, like + * all other device changes. + * + * This is used by CBTDevice::ChangeDevice(CBTDevice* ,EOpPair) + * + * @param aPairingDevice the device to be paired. + * @return KErrInUse, if another operation has be queued and not finnished. KErrNone otherwise. + */ + TInt PairDeviceL(const CBTDevice* aPairingDevice, + TNameEntry* aNameEntry); + +protected: + + /** + * Change device status, add device, e.g. block, unpair,unblock etc. + * + * This is the operation that is used to to execute the operation queued by ChangeDevice. + * + * This class will add connection releted operations to CBTDevModelBase::DoChangeDevice. + * + * @param aDevice. The device and the type of the change. If the address is empty, then the + * device index means what device is to be used. + * @return KerrNone or system wide error code. + */ + TInt DoChangeDeviceL(const TBTDevice& aDevice); + + /** + * Cancel ongoing connecting, pairing, modifying device in BTRegistry + * + * This is the operation that is used to cancel ongoing operation. + * + * @param aDevice. The device and the type of the change that will be canceled. + * If the address is empty, then the + * device index means what device is to be used. + * @return None. + */ + void DoCancelChangeL(const TBTDevice& aDevice); + + /** + * These two methods set the EStatusPhysicallyConnected attribute to + * the devices that have active connection. + */ + void FlagPhysicallyConnectedDevices(RDeviceArray &aDevices); + void FlagPhysicallyConnectedDevices(TBTDevice& aDevice, RBTDevAddrArray& aBTDeviceArray); + + +private: + + /** + * Start the actual pairing of iPairingDevice + * This is called by DoChangeDevice, if the operation is pairing. + *@param none. + *@return none. + */ + void DoPairDeviceL(); + + /** + * BTEngConnMan will call this when the connecting is finnished. + * This is called as callback not only for connections initiated by this class, + * but also for all BT Engines supported porofile connections, including those + * initiated by remote devices. + * @param aAddr The address of the device whose connection attempt has been finnished. + * @param aErr KErrNone if connection is succesfull, Otherwise system wide error code. + * @param aConflicts The conflicting devices in case of unsuccesfull connection attempt if any. + * @return none. + */ + void ConnectComplete(TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts = NULL); + + /** + * BTEngConnMan will call this when the disconnecting is finnished. + * This is called as callback not only for disconnections initiated by this class, + * but also for disconnection of BT Engines supported porofile connections, including those + * initiated by remote devices. + * @param aAddr The address of the device whose connection attempt has been finnished. + * @param aErr KErrNone if disconnection is succesfull, Otherwise system wide error code. + * @return none. + */ + void DisconnectComplete(TBTDevAddr& aAddr, TInt aErr); + + /** + * from BTEng's MBTEngConnObserver + */ + void PairingComplete(TBTDevAddr& aAddr, TInt aErr); + + /** + * The leaving version of PairingComplete. Internally called by PairingComplete + */ + void PairingCompleteL(TBTDevAddr& aAddr, TInt aErr); + + /** + * Creates and allocates TBTDevice representation of this device + * + * This class will add the connection status information to + * to CBTDevModelBase::CreateDevice. + * + * @param aRegDevice the device to be converted + * @return the TBTDevice representation of the same device. (Note the caller is responsible for deleting + * the returned item.) + */ + TBTDevice* CreateDeviceL(const CBTDevice* aRegDevice, TNameEntry* aNameEntry); + + /** + * Adds the given device to internal structures of this class + * using AddDeviceL, if it is paired and not blocked. + * + * @param aRegDevice + */ + void HandleNewDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry); + + /** + * This callback is used to to notify this call from completed changed from iDevMan. + * Inherited from MBTEngDevManObserver. + * + * This funtion will trap any leave if they may occur and report them as errors in the + * corresponfing device change operarion. + * + * @param aErr KErrNone or system wide error code. + */ + void HandleDevManComplete(TInt aErr); + +public: + + /** + * From MBTEngSettingsObserver - Called when powerstate is changed + * @param TBTPowerStateValue power state + * @return None + */ + void PowerStateChanged( TBTPowerStateValue aState ); + + /** + * From MBTEngSettingsObserver - Called when visibility is changed + * @param TBTPowerStateValue state of visibility mode + * @return None + */ + void VisibilityModeChanged( TBTVisibilityMode aState ); + + +public: //from MBluetoothPhysicalLinksNotifier + + /** + * Inherited from MBluetoothPhysicalLinksNotifier and implemented empty + */ + void HandleCreateConnectionCompleteL(TInt ) {}; + + /** + * Disconnect from non BTEng device by iLinks is complete. + *@param aErr KErrNone or system wide errorcode. + */ + void HandleDisconnectCompleteL(TInt aErr) ; + + /** Inherited from MBluetoothPhysicalLinksNotifier and not used. + */ + void HandleDisconnectAllCompleteL(TInt aErr) {HandleDisconnectCompleteL(aErr); } + + /** + * Get device based on addr or index. + * @param aDevice the TBTDevice holder. The device address is passed in + * @return KErrNone if ok. + * KErrArgument, if neither index not address is filled. + * KErrOverFlow if index is out of range. + * KErrNotFound if the given address does not exists, in the internal array. + */ + TInt virtual GetDevice(TBTDevice& aDevice); + + /** + * This is used to make callback to iObserver, when a leave has been detected. + * + *@param aErr the leave error code + *@param aDevice The device and operation that cause the leave. + */ + virtual void HandleLeave(TInt aErr,const TBTDevice* aDevice ); + +private: + + CBTEngConnMan* iConnMan; + CBTDevice* iPairingDevice; + + TBTDevice* iDisconnectDevice; + TPairedModelState iState; // The device is deleted and written back to bt registry before pairing + // this is used to control those operations + //used for disconnecting connections not managed by BTEngine + CBluetoothPhysicalLinks *iLinks; + RSocketServ iSocketServ; + CBTEngSettings *iBtEngSettings; // used for turning on BT, if not enabled + }; + +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/inc/btregistryobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/inc/btregistryobserver.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,139 @@ +/* +* 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: Registry observer is listening to registry changes and +* and reporting the changed devices to the listener. +* +*/ + +#ifndef BTREGISTRYOBSERVER_H +#define BTREGISTRYOBSERVER_H + +#include +#include +#include +#include + +/** This class will inform the listener about the new BTregistry status +*after registry change events. +* +* This class will listen to events about registry changes and inform +* the listener about the latest registry status. The listener can +* also ask the status using refresh. This is usefull for for +* for example retrieval of initial lists of devices. +* +*@lib btdevmodel.dll +*@since S60 V3.2 +*/ +NONSHARABLE_CLASS(MBTRegistryObserver) + { +public: + /** The aDeviceArray constents are deleted after this + * call returns. If storage is wanted the array and its contents + * must be copied by implementor. + */ + virtual void RegistryChangedL(const CBTDeviceArray* aDeviceArray) = 0; + }; + +NONSHARABLE_CLASS(CBTRegistryObserver) : public CActive, public MBTEngDevManObserver + { +public: + /** NewL + *@param aObserver The class that is listening to registry changes + *@param aPattern The pattern to be used to retrieve the changed objects. + */ + static CBTRegistryObserver* NewL(MBTRegistryObserver* aObserver, + const TBTRegistrySearch aPattern); + + /** Destructor*/ + virtual ~CBTRegistryObserver(); + + /** Start listening to registry changes. + * + *Calling this while registry observer is running is silently ignored. + */ + void StartIfNotRunning(); + + /* Registry observer will retrieve list of devices in the backround + * and send it to the listener, when one is retrieved. + */ + void Refresh(); + + /** Check if this is running. + *@return ETrue if not listening to registry changes. + */ + inline TBool IsStopped() {return iIsStopped;} + + /** This will stop listening and cancel any retrieval of devicelists, + * if any. + * @param none. + * @return none. + */ + void Cancel(); +private: + /* Constructor that may not leave. + *@param aObserver The class that is listening to registry changes + *@param aPattern The pattern to be used to retrieve the changed objects. + */ + CBTRegistryObserver(MBTRegistryObserver* aObserver, const TBTRegistrySearch aPattern); + /** 2nd phase constructor. Called by NewL only. + * @param none. + * @return none. + */ + void ConstructL(); + + /** This is called when registry changes occur, but not when deviceLists are + * retrieved, since HandleGetDevicesComplete is called then. + * + * If one or more registry events occur during devicelist retrieval, there + * will be one new devicelist retrieval after the current retrieval is done. + * + * @param none. + * @return none. + */ + void RunL(); + + /** This will clear iRegDeviceArray and delete its contents. + * @param none. + * @return none. + */ + void DeleteAllocatedDevices(); + + + /** This will cancel listening. To be called by Cancel only. + * @param none. + * @return none. + */ + void DoCancel(); + + /** This is called when devicelist have been read from BtDevMan + * @param aErr KErrNone or the accurred error. + * @param aDeviceArray the devices that have been retrieved. + * @return none. + */ + void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); + +private: + MBTRegistryObserver* iObserver; // the class listening to this class + CBTDeviceArray* iRegDeviceArray; // this is used for retrieving devices + TBTRegistrySearch iSearchPattern; // the search used to retrieve devices + // NOTE: this class does not filter the results, + // but the one listening to this (if filtering is done). + RProperty iProperty; + CBTEngDevMan* iDevMan; // the object that is used to retrieve the device lists. + TBool iIsStopped; // is this runining. + TBool iAnotherEventPending; // Has there been one or more changes during this retrieval. + // if this is true then HandleGetDevices will start a new search. + }; + +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btblockedmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btblockedmodel.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,77 @@ +/* +* 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: Maintain a Bluetooth devices data model for Blocked devices view. +* +*/ + + +// INCLUDE FILES +#include "btblockedmodel.h" +#include "debug.h" + +// --------------------------------------------------------------------- +// constructor +// ---------------------------------------------------------------------- +CBTBlockedModel::CBTBlockedModel(MBTDeviceObserver* aObserver,TBTDeviceSortOrder* aOrder ) + : CBTDevModelBase(aObserver, aOrder) + { + TRACE_FUNC + } +// --------------------------------------------------------------------- +// CBTBlockedModel::NewL +// ---------------------------------------------------------------------- +CBTBlockedModel* CBTBlockedModel::NewL(MBTDeviceObserver* aObserver, TBTDeviceSortOrder* aOrder ) + { + CBTBlockedModel* self = new (ELeave) CBTBlockedModel(aObserver, aOrder); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } +// --------------------------------------------------------------------- +// destructor +// ---------------------------------------------------------------------- +CBTBlockedModel::~CBTBlockedModel() + { + TRACE_FUNC + } +// --------------------------------------------------------------------- +// CBTBlockedModel::ConstructL +// ---------------------------------------------------------------------- +void CBTBlockedModel::ConstructL() + { + TRACE_FUNC_ENTRY + // get all devices from btregistry to iDeviceArray - a TBTDevice array + iDevMan = CBTEngDevMan::NewL(this); + iSearchPattern.FindAll(); + iRegistryObserver = CBTRegistryObserver::NewL(this, iSearchPattern); + iRegistryObserver->Refresh(); + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTBlockedModel::HandleNewDeviceL +// from CBTDevModel +// ---------------------------------------------------------------------- +void CBTBlockedModel::HandleNewDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) + { + TRACE_FUNC_ENTRY + TBTDeviceSecurity security = aRegDevice->GlobalSecurity(); + if (security.Banned()) + { + AddDeviceL(aRegDevice, aNameEntry, EOpBlock); + } + TRACE_FUNC_EXIT + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btdevice.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,68 @@ +/* +* 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: This is used by BTUI to contain the information on a displaid device. +* +*/ + +#include "btdevmodel.h" +// --------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------- +EXPORT_C TBTDevice::TBTDevice() + { + iType = EDeviceDefault; + iName = KNullDesC; + iFriendlyName = KNullDesC; + iStatus = 0; + iOperation = EOpNone; + iAddr = KNullAddress; + iIndex = KErrNotFound; + iDeviceClass=TBTDeviceClass(0); + iLinkKeyType = ELinkKeyCombination; + iNameEntry() = TNameRecord(); + } +// --------------------------------------------------------------------- +// Copy Constructor +// --------------------------------------------------------------------- +EXPORT_C TBTDevice::TBTDevice(const TBTDevice& aDevice) + { + iType = aDevice.iType; + iName = aDevice.iName; + iFriendlyName = aDevice.iFriendlyName; + iStatus = aDevice.iStatus; + iOperation = aDevice.iOperation; + iAddr = aDevice.iAddr; + iIndex = aDevice.iIndex; + iDeviceClass= aDevice.iDeviceClass; + iLinkKeyType = aDevice.iLinkKeyType; + iNameEntry() = TNameRecord(); + } +// --------------------------------------------------------------------- +// operator= +// --------------------------------------------------------------------- +EXPORT_C TBTDevice& TBTDevice::operator=(const TBTDevice& aDevice) + { + iType = aDevice.iType; + iName = aDevice.iName; + iFriendlyName = aDevice.iFriendlyName; + iStatus = aDevice.iStatus; + iOperation = aDevice.iOperation; + iAddr = aDevice.iAddr; + iIndex = aDevice.iIndex; + iDeviceClass= aDevice.iDeviceClass; + iLinkKeyType = aDevice.iLinkKeyType; + iNameEntry = aDevice.iNameEntry; + return *this; + } +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btdevmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btdevmodel.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,230 @@ +/* +* 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: Maintain a Bluetooth devices data model for UI components. +* +*/ + +// INCLUDE FILES +#include +#include "btdevmodel.h" +#include "btpairedmodel.h" +#include "btblockedmodel.h" +#include "debug.h" + +// -------------------------------------------------------------------------------------------- +// CBTDevModel::CBTDevModel +// -------------------------------------------------------------------------------------------- +CBTDevModel::CBTDevModel() + { + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::NewL +// -------------------------------------------------------------------------------------------- +EXPORT_C CBTDevModel* CBTDevModel::NewL(const TBTDeviceGroup aGroup, + MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder + ) + { + CBTDevModel* self = new (ELeave) CBTDevModel(); + CleanupStack::PushL(self); + + TBTDeviceSortOrder *order=NULL; + if(aOrder == NULL) + { + order=new(ELeave) TBTDeviceSortOrder(TBTDeviceComparison::CompareAphabetically); + // Order ownership goes to btdevmodel - don't push it to stack + self->ConstructL(aGroup, aObserver, order); + } + else + { + order=aOrder; + self->ConstructL(aGroup, aObserver, order); + } + CleanupStack::Pop(self); + return self; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::~CBTDevModel +// +// Destructor +// -------------------------------------------------------------------------------------------- + +CBTDevModel::~CBTDevModel() + { + TRACE_FUNC_ENTRY + delete iDevModel; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::ConstructL +// +// Constructs CBTPairedModel or CBTBlockedModel, depending on aGroup +// -------------------------------------------------------------------------------------------- +void CBTDevModel::ConstructL(const TBTDeviceGroup aGroup, + MBTDeviceObserver* aObserver, + TBTDeviceSortOrder* aOrder ) + { + TRACE_FUNC_ENTRY + iGroup=aGroup; + switch (aGroup) + { + case EGroupPaired: + iDevModel = CBTPairedModel::NewL(aObserver, aOrder); + break; + + case EGroupBlocked: + iDevModel = CBTBlockedModel::NewL(aObserver, aOrder); + break; + default: + break; + } + TRACE_FUNC_EXIT + } + +EXPORT_C TBool CBTDevModel::IsAnyDeviceConnected() + { + return iDevModel->IsAnyDeviceConnected(); + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::GetDevice +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C TInt CBTDevModel::GetDevice(TBTDevice& aDevice) + { + return iDevModel->GetDevice(aDevice); + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::CreateDevice +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C TBTDevice* CBTDevModel::CreateDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) + { + return iDevModel->CreateDeviceL(aRegDevice, aNameEntry); + } + +// -------------------------------------------------------------------------------------------- +// CBTDevModel::GetDeviceType +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C void CBTDevModel::ChangeAllDevices(const TBTDeviceOp aOperation) + { + iDevModel->ChangeAllDevices(aOperation); + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::ChangeDevice +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C void CBTDevModel::ChangeDevice(const TBTDevice& aDevice) + { + iDevModel->ChangeDevice(aDevice); + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::ChangeDevice +// -------------------------------------------------------------------------------------------- +EXPORT_C void CBTDevModel::ChangeDevice(const CBTDevice* aDevice, + TNameEntry* aNameEntry, TBTDeviceOp aOp) + { + TRACE_FUNC_ENTRY + TBTDevice *tmp=NULL; + TInt err = KErrNone; + if(aOp == EOpPair) + { + if(iGroup !=EGroupPaired ) + { + err = KErrNotSupported; + } + else + { + TInt err2 = KErrNone; + TRAP(err, err2 = static_cast(iDevModel)->PairDeviceL( aDevice, aNameEntry)); + err = (err2 != KErrNone) ? err2 : err; + } + } + else + { + TRAP(err, tmp=iDevModel->CreateDeviceL(aDevice, aNameEntry )); + if(err == KErrNone) + { + tmp->iOperation=aOp; + iDevModel->ChangeDevice(*tmp ); + } + } + if(err != KErrNone) + { + iDevModel->HandleLeave(err,tmp); + } + TRACE_FUNC_EXIT + } +// -------------------------------------------------------------------------------------------- +// CBTDevModel::CancelChange +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C void CBTDevModel::CancelChange(const TBTDevice& aDevice) + { + iDevModel->CancelChange(aDevice); + } + +// -------------------------------------------------------------------------------------------- +// CBTDevModel::DeviceChangeInProgress +// wrapper function +// -------------------------------------------------------------------------------------------- +EXPORT_C TBool CBTDevModel::DeviceChangeInProgress() + { + return iDevModel->DeviceChangeInProgress(); + } +// -------------------------------------------------------------------------------------------- +// TBTDeviceComparison::CompareAphabetically +// -------------------------------------------------------------------------------------------- +EXPORT_C TInt TBTDeviceComparison::CompareAphabetically( + const TBTDevice& aFirstDevice, const TBTDevice& aSecondDevice) + { + // This funtion is used when sorting devicelists, so the tracing has been omnitted + // in order decreas the amount of trash in the logs. + TInt rvalue= aFirstDevice.iName.CompareC(aSecondDevice.iName); + if(rvalue !=0) + { + return rvalue; + } + if( aFirstDevice.iAddr <= aSecondDevice.iAddr ) + { + return -1; + } + else + { + return 1; + } + } + +// -------------------------------------------------------------------------------------------- +// TBTDeviceComparison::ReverseCompareAphabetically +// -------------------------------------------------------------------------------------------- +EXPORT_C TInt TBTDeviceComparison::ReverseCompareAphabetically( + const TBTDevice& aFirstDevice, const TBTDevice& aSecondDevice) + { + // This funtion is used when sorting devicelists, so the tracing has been omnitted + // in order decreas the amount of trash in the logs. + TInt rvalue= aSecondDevice.iName.CompareC(aFirstDevice.iName); + if(rvalue !=0) + { + return rvalue; + } + if(aFirstDevice.iAddr <= aSecondDevice.iAddr ) + { + return 1; + } + else + { + return -1; + } + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btdevmodelbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btdevmodelbase.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,807 @@ +/* +* 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: Maintain a Bluetooth devices data model for UI components. +* +*/ + +#include "btdevice.h" +#include "btdevmodelbase.h" +#include +#include "debug.h" +#include "btui.h" +#include "btregistryobserver.h" + +// -------------------------------------------------------------------------------------------- +// 1st phaze constructor +// -------------------------------------------------------------------------------------------- +CBTDevModelBase::CBTDevModelBase(MBTDeviceObserver* aObserver, TBTDeviceSortOrder* aOrder) + : iObserver(aObserver) + { + TRACE_FUNC_ENTRY + iSortOrder=aOrder; + TRACE_FUNC_EXIT + + } + +// -------------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------------- +CBTDevModelBase::~CBTDevModelBase() + { + TRACE_FUNC_ENTRY + delete iRegistryObserver; + + for(TInt i=0;iCancel(); + delete iDevMan; + + delete iSortOrder; + TRACE_FUNC_EXIT + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::IsAnyDeviceConnected +// Allways false, since base class does not support connection +// -------------------------------------------------------------------------------------------- + +TBool CBTDevModelBase::IsAnyDeviceConnected() + { + TRACE_FUNC_ENTRY + return EFalse; + + } + +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::GetDevice +// -------------------------------------------------------------------------------------------- +TInt CBTDevModelBase::GetDevice(TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + TBTDeviceOp op=aDevice.iOperation; + + TInt index = GetIndexByAddress(aDevice.iAddr,aDevice.iIndex); + + if (index < 0 ) + { + if(aDevice.iAddr == KNullAddress ) + { + return KErrArgument; + } + else + { + return KErrNotFound ; + } + } + if(index >= iDeviceArray.Count()) + return KErrOverflow; + + aDevice=*iDeviceArray[index]; + aDevice.iOperation=op; + TRACE_FUNC_EXIT + return KErrNone; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::ChangeAllDevices +// -------------------------------------------------------------------------------------------- +void CBTDevModelBase::ChangeAllDevices(const TBTDeviceOp aOperation) + { + TRACE_FUNC_ENTRY + TInt count = iDeviceArray.Count(); + + for (TInt i = 0; i < count; i++) + { + //TBTDevice device; + //device=iDeviceArray[i]; + //device.iIndex = i; + //device.iOperation = aOperation; + //ChangeDevice(device); + iDeviceArray[i]->iIndex = i; + iDeviceArray[i]->iOperation = aOperation; + ChangeDevice(*iDeviceArray[i]); + } + TRACE_FUNC_EXIT + } + +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::GetIndexByAddress +// +// returns the index of the address, if one is not null address. +// if it is give aNullAdressIndex +// -------------------------------------------------------------------------------------------- +TInt CBTDevModelBase::GetIndexByAddress(TBTDevAddr aAddr,TInt aNullAdressIndex) + { + TRACE_FUNC_ENTRY + + if(aAddr == KNullAddress ) + { + TRACE_FUNC_EXIT + return aNullAdressIndex; + } + else + { + TInt count = iDeviceArray.Count(); + TInt i; + for (i = 0; i < count; i++) + { + if (iDeviceArray[i]->iAddr == aAddr) break; + } + if(i == count) + { + TRACE_FUNC_EXIT + return KErrNotFound ; + } + + else + { + TRACE_FUNC_EXIT + return i; + } + } + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::DoChangeDevice +// -------------------------------------------------------------------------------------------- +TInt CBTDevModelBase::DoChangeDeviceL(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + //check that the command in progress has been started + __ASSERT_DEBUG(iDevice==NULL,PANIC(EBTPanicDevManQueueIsCorrupt)); + + TInt index = GetIndexByAddress(aDevice.iAddr, aDevice.iIndex ); + + if (index == KErrNotFound) + { + TRACE_INFO(_L("index not found")); + TRACE_FUNC_EXIT + if (aDevice.iAddr == KNullAddress) + { + return KErrArgument; + } + else + { + return KErrNotFound ; + } + } + if(index >= iDeviceArray.Count()) + { + TRACE_INFO((_L("index is %d, max expected is %d"), index, iDeviceArray.Count())); + TRACE_FUNC_EXIT + return KErrOverflow; + } + + + TBTDevice* device = iDeviceArray[index]; + // store pointer to the indexed TBTDevice + + // untrust trusted device to be deleted, and delete it only after that + if( (device->iStatus & EStatusTrusted ) + && aDevice.iOperation== EOpUnpair ) + { + device=new (ELeave) TBTDevice(*iDeviceArray[index]); + device->iOperation=EOPInternalUntust; + iQueue.Insert(device,0); + TInt rvalue=DoChangeDeviceL(*device); + TRACE_FUNC_EXIT + return rvalue; + } + + + iDevice = new (ELeave) TBTDevice(*device); + iDevice->iOperation = aDevice.iOperation; + + CBTDevice* regDevice = CBTDevice::NewL(iDevice->iAddr); + + regDevice->SetPaired( aDevice.iLinkKeyType ); + + TBTDeviceSecurity security; + + if(aDevice.iOperation != EOpChangeName) + { + regDevice->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( iDevice->iName ) ); + + // BTEngDevMan will delete friendly name when modify device if friendly name is not set + // So if friendly name has been set before, it need to be set again before modify it for + // any other purpuse e.g change security + regDevice->SetFriendlyNameL(iDevice->iFriendlyName); + } + + switch (aDevice.iOperation) + { + case EOpUntrust: + case EOPInternalUntust: + security.SetNoAuthenticate(EFalse); + security.SetNoAuthorise(EFalse); + regDevice->SetGlobalSecurity(security); + UnsetStatusFlags(iDeviceArray[index]->iStatus,EStatusTrusted ); + break; + + case EOpTrust: + security.SetNoAuthenticate(EFalse); + security.SetNoAuthorise(ETrue); + security.SetBanned(EFalse); + regDevice->SetGlobalSecurity(security); + + SetStatusFlags(iDeviceArray[index]->iStatus,EStatusTrusted ); + break; + + case EOpUnblock: + // unblock may be done to a number of devices. + // So we want it to happen as quicky as possible + iRegistryObserver->Cancel(); + UnsetStatusFlags( iDevice->iStatus,EStatusBlocked ); + security.SetBanned(EFalse ); + regDevice->DeleteLinkKey(); + + regDevice->SetGlobalSecurity(security); + break; + + case EOpBlock: + security.SetBanned(ETrue ); + security.SetNoAuthenticate(EFalse ); + security.SetNoAuthorise(EFalse); + regDevice->SetGlobalSecurity(security); + regDevice->DeleteLinkKey(); + + UnsetStatusFlags( iDevice->iStatus,EStatusTrusted ); + SetStatusFlags( iDevice->iStatus,EStatusBlocked ); + break; + + case EOpUnpair: + // unpair may be done to a number of devices. + // So we want it to happen as quicky as possible + iRegistryObserver->Cancel(); + regDevice->DeleteLinkKey(); + + UnsetStatusFlags(iDevice->iStatus,EStatusPaired); + security.SetNoAuthenticate(EFalse ); + security.SetNoAuthorise(EFalse ); + regDevice->SetGlobalSecurity(security); + break; + + case EOpChangeName: + if (IsNameExisting(aDevice.iName)) + { + delete regDevice; + regDevice=NULL; + return KErrAlreadyExists; + } + + regDevice->SetFriendlyNameL(aDevice.iName); + iDevice->iName = aDevice.iName; + + // set iFriendlyName to remember that friendly name has been set + iDevice->iFriendlyName = aDevice.iName; + break; + + default: + delete regDevice; + delete iDevice; + iDevice=NULL; + TRACE_FUNC_EXIT + return KErrNotSupported; + } + iDevMan->ModifyDevice(*regDevice); + delete regDevice; + + TRACE_FUNC_EXIT + return KErrNone; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::DoChangeDevice +// -------------------------------------------------------------------------------------------- +void CBTDevModelBase::DoCancelChangeL(const TBTDevice& /*aDevice*/) + { + TRACE_FUNC_ENTRY + iDevMan->Cancel(); + TRACE_FUNC_EXIT + } + +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::CreateDevice +// -------------------------------------------------------------------------------------------- +TBTDevice* CBTDevModelBase::CreateDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) + { + TRACE_FUNC_ENTRY + TRACE_BDADDR(aRegDevice->BDAddr()); + TRACE_INFO((_L("CoD %b"), aRegDevice->DeviceClass().DeviceClass())); + TBTDevice* device = new (ELeave) TBTDevice(); + if ( aNameEntry ) + { + device->iNameEntry = *aNameEntry; + } + switch( aRegDevice->DeviceClass().MajorDeviceClass() ) + { + case EMajorDeviceComputer: + device->iType=EDeviceComputer; + break; + case EMajorDevicePhone: + device->iType=EDevicePhone; + break; + case EMajorDeviceAudioDevice: + if ( aRegDevice->DeviceClass().MinorDeviceClass() == EMinorDeviceAVCarAudio || + aRegDevice->DeviceClass().MinorDeviceClass() == EMinorDeviceAVHandsfree) + { + device->iType=EDeviceCarkit; + } + else + { + device->iType=EDeviceAudio; + } + break; + + case EMajorDevicePeripheral: + if ( aRegDevice->DeviceClass().MinorDeviceClass() == EMinorDevicePeripheralKeyboard ) + { + device->iType=EDeviceKeyboard; + } + else + { + + if ( aRegDevice->DeviceClass().MinorDeviceClass() == EMinorDevicePeripheralPointer ) + { + device->iType=EDeviceMice; + } + else + { + device->iType=EDeviceDefault; + } + } + break; + + case EMajorDeviceImaging: + if ( aRegDevice->DeviceClass().MinorDeviceClass() == EMinorDeviceImagingPrinter ) + { + device->iType=EDevicePrinter; + } + else + { + device->iType=EDeviceDefault; + } + break; + + default: + device->iType=EDeviceDefault; + break; + } + device->iAddr = aRegDevice->BDAddr(); + + TBTDeviceSecurity security = aRegDevice->GlobalSecurity(); + + if(security.Banned() ) + { + SetStatusFlags(device->iStatus,EStatusBlocked); + } + if( IsUserAwarePaired( aRegDevice->AsNamelessDevice() ) ) + { + SetStatusFlags(device->iStatus,EStatusPaired); + device->iLinkKeyType = aRegDevice->LinkKeyType(); + } + if( security.NoAuthorise()) + SetStatusFlags(device->iStatus,EStatusTrusted); + if(aRegDevice->FriendlyName().Length() >0) + { + device->iName = aRegDevice->FriendlyName(); + + // set iFriendlyName to remember that friendly name has been set before in registry + device->iFriendlyName = aRegDevice->FriendlyName(); + } + else + { + CleanupStack::PushL(device); + device->iName = BTDeviceNameConverter::ToUnicodeL(aRegDevice->DeviceName()); + CleanupStack::Pop(device); + } + + + device->iDeviceClass=aRegDevice->DeviceClass(); + TRACE_FUNC_EXIT + return device; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::AddDeviceL +// -------------------------------------------------------------------------------------------- +void CBTDevModelBase::AddDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry, const TBTDeviceOp aOperation) + { + TRACE_FUNC_ENTRY + TBTDevice* device = CreateDeviceL(aRegDevice, aNameEntry); + device->iOperation = aOperation; + // insert it to the RDeviceArray by order + iDeviceArray.InsertInOrderL(device,*iSortOrder); + TRACE_FUNC_EXIT + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::CreateDevices +// -------------------------------------------------------------------------------------------- +void CBTDevModelBase::CreateDevicesL(const CBTDeviceArray* aDeviceArray) + { + TRACE_FUNC_ENTRY + // clear the old contents of the array + for(TInt i=0;iCount(); + for (TInt i = 0; i < count; i++) + { + // form a TBTDevice for a CBTDevice + CBTDevice* regDevice = aDeviceArray->At(i); + HandleNewDeviceL(regDevice, NULL); + RenumberDeviceArray(); + } + TRACE_FUNC_EXIT + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::IsNameExisting +// -------------------------------------------------------------------------------------------- +TBool CBTDevModelBase::IsNameExisting(const TDesC& aName) + { + TRACE_FUNC_ENTRY + for (TInt i = 0; i < iDeviceArray.Count(); i++) + { + if (iDeviceArray[i]->iName.Compare(aName) == 0) + { + return ETrue; + } + } + TRACE_FUNC_EXIT + return EFalse; + } +// -------------------------------------------------------------------------------------------- +// CBTDevModelBase::RegistryChangedL +// -------------------------------------------------------------------------------------------- +void CBTDevModelBase::RegistryChangedL(const CBTDeviceArray* aDeviceArray) + { + TRACE_FUNC_ENTRY + + // Store the device seleted before refresh + TInt bSelectedDeviceIndex = KErrNotFound; + if (iObserver) + { + bSelectedDeviceIndex=iObserver->CurrentItemIndex(); + } + + // the selected device before the update + TBTDevice currentDevice; + + if (bSelectedDeviceIndex != KErrNotFound && bSelectedDeviceIndex < iDeviceArray.Count() ) + { + currentDevice=*iDeviceArray[bSelectedDeviceIndex]; + } + + CreateDevicesL(aDeviceArray); + + TInt newIndex=GetIndexByAddress(currentDevice.iAddr,KErrNotFound); + if (newIndex==KErrNotFound) + { + newIndex= bSelectedDeviceIndex; + } + + newIndex=Min(newIndex,iDeviceArray.Count() -1 ); + + // notify the listener about the new list of devices + SendRefreshIfNoError(KErrNone,newIndex); + TRACE_FUNC_EXIT + } +// ---------------------------------------------------------- +// CBTDevModelBase::RenumberDeviceArray +// +// ReCalculates the indexes of internal array. +// ---------------------------------------------------------- +void CBTDevModelBase::RenumberDeviceArray() + { + TRACE_FUNC_ENTRY + for(TInt i=0;iiIndex=i; + } + TRACE_FUNC_EXIT + } +//--------------------------------------------------------------------------------------------- +// from MBTEngDevManObserver for call back on adding, modifying, deleting device completion +//--------------------------------------------------------------------------------------------- +void CBTDevModelBase::HandleDevManComplete(TInt aErr) + { + TRACE_FUNC_ENTRY + //command has been succesfully completed. If there is no command but something has + // completed, something is very wrong. + __ASSERT_DEBUG(iDevice != NULL || aErr != KErrNone, PANIC(EBTPanicDevManQueueIsCorrupt)); + __ASSERT_DEBUG(iQueue.Count()>0, PANIC(EBTPanicDevManQueueIsCorrupt)); + + RenumberDeviceArray(); + + // EOPInternalUntust is untrst before delete. It is not an operation of its own, so no-one is notified about it. + if(iDevice && iDevice->iOperation== EOPInternalUntust) + { + delete(iDevice); + iDevice=NULL; + delete iQueue[0]; + iQueue.Remove(0); + + HandleQueue(); + TRACE_FUNC_EXIT + return; + } + // in case of just paired device the refresh does + // not work adequately quickly, so we have not refresh the + // shown devices immediately. + // + // If we would not do it, there might be a small window, for + // answering yes to to question if user wants to trust the + // device. This would fail, since the device would not + // be in the list. + if( aErr == KErrNone && (iDevice->iOperation== EOpTrust || iDevice->iOperation== EOpUntrust )) + { + TInt index=GetIndexByAddress(iDevice->iAddr); + if(index != KErrNotFound) + { + if(iDevice->iOperation== EOpTrust ) + { + SetStatusFlags(iDeviceArray[index]->iStatus, EStatusTrusted); + } + else + { + UnsetStatusFlags(iDeviceArray[index]->iStatus, EStatusTrusted); + } + + SendRefreshIfNoError(aErr); + } + + } + // delete the unpaired and blocked devices from the list + if( aErr == KErrNone && iDevice && + (iDevice->iOperation== EOpBlock || iDevice->iOperation== EOpUnpair ) ) + { + TInt index=GetIndexByAddress(iDevice->iAddr); + if(index != KErrNotFound ) + { + delete( iDeviceArray[index] ); + iDeviceArray.Remove(index); + } + // do not send refresh if this and the next are unpair/unblock operations. + // This is meant to hasten the screen refresh, in case of DeleteAll command + // is issued. + if( iQueue.Count()>1 && iQueue[1]->iOperation==iDevice->iOperation ) + { + + } + else + { + SendRefreshIfNoError(); + iRegistryObserver->StartIfNotRunning(); + //NOTE:It is ok to attempt starting when allready running. + } + + } + if(iObserver && iDevice) + iObserver->NotifyChangeDeviceComplete(aErr, *iDevice); + + delete(iDevice); + iDevice=NULL; + + iRegistryObserver->Refresh(); + + delete iQueue[0]; + iQueue.Remove(0); + + HandleQueue(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::HandleGetDevicesComplete +// From MBTEngDevManObserver +// +// Devices are received from CBTRegistryObserver, so this is not used. +// ---------------------------------------------------------------------- +void CBTDevModelBase::HandleGetDevicesComplete(TInt /*aErr*/, CBTDeviceArray* /*aDeviceArray*/) + { + TRACE_FUNC_ENTRY + + TRACE_FUNC_EXIT + } + + +// --------------------------------------------------------------------- +// CBTDevModelBase::SendRefreshIfNoError +// --------------------------------------------------------------------- +void CBTDevModelBase::SendRefreshIfNoError(TInt aErr,TInt selectedItem) + { + TRACE_FUNC_ENTRY + + //this shouldn't be reached if iObserver is NULL + __ASSERT_DEBUG(iObserver, PANIC(EBTPanicNullObserver)); + + if (selectedItem == KErrNotSupported ) + { + iObserver->RefreshDeviceList( &iDeviceArray , + Min(iObserver->CurrentItemIndex(),iDeviceArray.Count()-1 ) ); + } + else + { + if (aErr == KErrNone && iObserver) + { + iObserver->RefreshDeviceList( &iDeviceArray, + Min(selectedItem,iDeviceArray.Count()-1 ) ); + } + } + + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTDevModelBase::ChangeDeviceL +// +// puts the change device command into Queue +// --------------------------------------------------------------------- +void CBTDevModelBase::ChangeDeviceL(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + + TBTDevice* device=new(ELeave) TBTDevice(aDevice); + CleanupStack::PushL(device); + + TInt err = GetDevice(*device); + if(err!=KErrNone) + { + CleanupStack::PopAndDestroy(device); + User::Leave(err); + } + + if(aDevice.iOperation==EOpChangeName) + { + device->iName=aDevice.iName; + } + + iQueue.Append(device); + CleanupStack::Pop(device); + if(iQueue.Count() ==1 ) + { + User::LeaveIfError( DoChangeDeviceL(*iQueue[0]) ); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::ChangeDevice +// +// Calls the ChangeDeviceL and traps leaves and calls error callback, +// if they occur. +// --------------------------------------------------------------------- +void CBTDevModelBase::ChangeDevice(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + TRAPD(err, + ChangeDeviceL(aDevice); + ); + if(err!=KErrNone) + { + HandleLeave(err,&aDevice); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::CancelChange +// +// cancels the change from queue, only calls DoCancelChange, +// if the command is actually in progress. +// --------------------------------------------------------------------- +void CBTDevModelBase::CancelChange(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + // retrieve the device based on index, in + // case the address is not filled in. + TBTDevice device=aDevice; + GetDevice(device); + device.iOperation=aDevice.iOperation; + + // delete any operations to device from queueu + if(iQueue.Count()>0 ) + { + // Before calling DoCancelChangeL check if first operation on the + // queue is the one to be cancelled - otherwise crash may occure + // as per TSW EMZA-7EUHYE + if(iQueue[0]->iAddr== device.iAddr && + iQueue[0]->iOperation== device.iOperation ) + TRAP_IGNORE(DoCancelChangeL(device)); + + for (TInt i = iQueue.Count() - 1; i >= 0; i--) + { + if(iQueue[i]->iAddr== device.iAddr && + iQueue[i]->iOperation== device.iOperation ) + { + delete iQueue[i]; + iQueue.Remove(i); + } + } + } + // failed cancel is not reported forward. + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::DeviceChangeInProgress +// --------------------------------------------------------------------- +TBool CBTDevModelBase::DeviceChangeInProgress() + { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT + return iQueue.Count() !=0; + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::HandleQueue +// +// Starts executing the next devicechange(if any). +// Currently Executed command must be deleted from iQueue and iDevice +// (and corresponding places in subclasses), before calling this method. +// --------------------------------------------------------------------- + +void CBTDevModelBase::HandleQueue() + { + TRACE_FUNC_ENTRY + + RenumberDeviceArray(); + if(iQueue.Count() >0 ) + { + TRAPD(err2, DoChangeDeviceL(*iQueue[0]); ); + if (err2 !=KErrNone) + { + HandleLeave(err2,iQueue[0]); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTDevModelBase::HandleLeave +// --------------------------------------------------------------------- +void CBTDevModelBase::HandleLeave(TInt aErr,const TBTDevice* aDevice ) + { + TRACE_FUNC_ENTRY + iRegistryObserver->StartIfNotRunning(); + iRegistryObserver->Refresh(); + if(aDevice == NULL ) + { + iObserver->NotifyChangeDeviceComplete(aErr,TBTDevice() ); + } + else + { + iObserver->NotifyChangeDeviceComplete(aErr, *aDevice ); + } + delete iDevice; + iDevice=NULL; + iDevMan->Cancel(); + + if(aDevice != NULL && iQueue.Count() > 0 && + (iQueue[0]->iAddr == aDevice->iAddr ) && + (iQueue[0]->iOperation == aDevice->iOperation ) ) + { + delete iQueue[0]; + iQueue.Remove(0); + } + + HandleQueue(); + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btpairedmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btpairedmodel.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,999 @@ +/* +* 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: Maintain a Bluetooth devices data model for paired devices view +* +*/ + + +#include "btpairedmodel.h" +#include +#include "debug.h" +#include "btui.h" + +const TInt KMaxCheckedConnections=20; + + +// --------------------------------------------------------------------- +// CBTPairedModel::CBTPairedModel +// --------------------------------------------------------------------- +// +CBTPairedModel::CBTPairedModel(MBTDeviceObserver* aObserver, TBTDeviceSortOrder* aOrder) + : CBTDevModelBase(aObserver, aOrder) + { + TRACE_FUNC_ENTRY + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::NewL +// --------------------------------------------------------------------- +// +CBTPairedModel* CBTPairedModel::NewL(MBTDeviceObserver* aObserver, TBTDeviceSortOrder* aOrder ) + { + CBTPairedModel* self = new (ELeave) CBTPairedModel(aObserver, aOrder); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// -------------------------------------------------------------------------------------------- +// Destructor +// -------------------------------------------------------------------------------------------- +// +CBTPairedModel::~CBTPairedModel() + { + TRACE_FUNC_ENTRY + + delete iConnMan; + delete iPairingDevice; + delete iLinks; + delete iBtEngSettings; + iSocketServ.Close(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::ConstructL +// ---------------------------------------------------------------------- +// +void CBTPairedModel::ConstructL() + { + TRACE_FUNC_ENTRY + + // get all devices from btregistry to cache - local copy of CBTDeviceArray + iDevMan = CBTEngDevMan::NewL(this); + iConnMan = CBTEngConnMan::NewL(this); + iSearchPattern.FindAll(); + iRegistryObserver = CBTRegistryObserver::NewL(this, iSearchPattern); + iRegistryObserver->Refresh(); + User::LeaveIfError( iSocketServ.Connect() ); + iLinks=CBluetoothPhysicalLinks::NewL(*this,iSocketServ); + + iBtEngSettings = CBTEngSettings::NewL(this); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::IsAnyDeviceConnected +// ---------------------------------------------------------------------- +// +TBool CBTPairedModel::IsAnyDeviceConnected() + { + TRACE_FUNC_ENTRY + + FlagPhysicallyConnectedDevices(iDeviceArray); + + for(TInt i = 0; i < iDeviceArray.Count(); i++) + { + if(iDeviceArray[i]->iStatus & (EStatusPhysicallyConnected|EStatusBtuiConnected)) + { + TRACE_FUNC_EXIT + return ETrue; + } + } + + TRACE_FUNC_EXIT + + return EFalse; + } + +// --------------------------------------------------------------------- +// CBTPairedModel::DoChangeDevice +// --------------------------------------------------------------------- + +TInt CBTPairedModel::DoChangeDeviceL(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + TRACE_BDADDR(aDevice.iAddr) + // check that the device actually still exists + if(aDevice.iOperation != EOpPair ) + { + User::LeaveIfError( GetIndexByAddress(aDevice.iAddr, aDevice.iIndex ) ); + } + + // disconnect device to be unpaired, or blocked + if((aDevice.iOperation == EOpBlock || aDevice.iOperation == EOpUnpair )) + { + if( iState != EDisconnectBeforeOperationState) + { + // disconnect by CBTEngConnMan if connected that way. + if (aDevice.iStatus & static_cast(EStatusBtuiConnected ) ) + { + TInt code=KErrNone; + TRAPD(err, + iState=EDisconnectBeforeOperationState; + iDisconnectDevice=new(ELeave) TBTDevice(aDevice); + code=iConnMan->Disconnect(aDevice.iAddr,EBTDiscImmediate); + ); + // if the return code is KErrNone then there will be + // a callback. However if it fails, there will not be any. + // So the execution will go on inside this method, if there was an error. + if(err == KErrNone && code==KErrNone ) + { + return KErrNone; + } + + } + else // try disconnecting from the link layer + { + TInt code=KErrNone; + TRAPD(err, + iState=EDisconnectBeforeOperationState; + iDisconnectDevice=new(ELeave) TBTDevice(aDevice); + code=iLinks->Disconnect(aDevice.iAddr); + ); + // if the return code is KErrNone then there will be + // a callback. However if it fails, there will not be any. + // So the execution will go on inside this method, if there was an error. + if(err == KErrNone && code==KErrNone ) + { + return KErrNone; + } + } + } + else + iState=EIdleState; + + } + + if( aDevice.iOperation ==EOpPair) + { + DoPairDeviceL(); + TRACE_FUNC_EXIT + return KErrNone; + } + + TInt err = CBTDevModelBase::DoChangeDeviceL(aDevice); + if(iDisconnectDevice!= NULL) + { + delete iDisconnectDevice; + iDisconnectDevice=NULL; + } + + if (err != KErrNone) + { + TBTDevAddr addr; + if(aDevice.iAddr == KNullAddress ) + { + if(aDevice.iIndex < 0 || aDevice.iIndex >= iDeviceArray.Count()) + return KErrArgument; + else + addr=iDeviceArray[aDevice.iIndex]->iAddr; + } + else + addr=aDevice.iAddr; + + switch (aDevice.iOperation) + { + case EOpConnect: + { + err = iConnMan->Connect(addr, aDevice.iDeviceClass); + break; + } + case EOpDisconnect: + { + iDisconnectDevice=new(ELeave) TBTDevice(aDevice); + if (aDevice.iStatus & static_cast(EStatusBtuiConnected ) ) + { + err = iConnMan->Disconnect(addr, EBTDiscImmediate); + } + else + { + err=iLinks->Disconnect(aDevice.iAddr); + } + + break; + } + default: + User::Leave(err); + break; + } + } + + TRACE_FUNC_EXIT + + return err; + } + +// --------------------------------------------------------------------- +// CBTPairedModel::DoCancelChange +// --------------------------------------------------------------------- +// +void CBTPairedModel::DoCancelChangeL(const TBTDevice& aDevice) + { + TRACE_FUNC_ENTRY + + if(aDevice.iIndex >= iDeviceArray.Count()) + { + TRACE_INFO((_L("index is %d, max expected is %d"), aDevice.iIndex, iDeviceArray.Count())); + TRACE_FUNC_EXIT + return; + } + + // in case it was stopped + iRegistryObserver->StartIfNotRunning(); + switch (aDevice.iOperation) + { + case EOpPair: + if( iState==EDeleteDeviceState || iState==EAddDeviceState ) + { + iDevMan->Cancel(); + } + else + { + iConnMan->CancelPairDevice(); + } + delete iPairingDevice; + iPairingDevice=NULL; + iState=EIdleState; + iRegistryObserver->Refresh(); + break; + + case EOpConnect: + { + + TBTDevAddr addr; + if(aDevice.iIndex == KErrNotFound) + { + addr=aDevice.iAddr; + } + else + { + addr=iDeviceArray[aDevice.iIndex]->iAddr; + } + + iConnMan->CancelConnect(addr); + break; + } + default: + CBTDevModelBase::CancelChange(aDevice); + return; + } + iRegistryObserver->StartIfNotRunning(); + + if(iQueue.Count()>0) + { + delete iQueue[0]; + iQueue.Remove(0); + HandleQueue(); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::HandleNewDevice +// +// Adds the device if it is not banned +// --------------------------------------------------------------------- +// +void CBTPairedModel::HandleNewDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) + { + TRACE_FUNC_ENTRY + + // It is needed to filter out blocked devices, + // since otherwise blocked and paired devices would + // be listed. + if( ! aRegDevice->GlobalSecurity().Banned() + && IsUserAwarePaired( aRegDevice->AsNamelessDevice() ) ) + { + AddDeviceL(aRegDevice, aNameEntry, EOpNone); + } + + TRACE_FUNC_EXIT + } + +// ----------------------------------------------------------------------- +// CBTPairedModel::CreateDevice +// +// This implementaion will add the connectable status from the superclass. +// ----------------------------------------------------------------------- +// +TBTDevice* CBTPairedModel::CreateDeviceL(const CBTDevice* aRegDevice, + TNameEntry* aNameEntry) + { + TRACE_FUNC_ENTRY + + TBTDevice* device = CBTDevModelBase::CreateDeviceL(aRegDevice, aNameEntry); + + // add EStatusBtuiConnected status if the device has a profile connection + TBTEngConnectionStatus connStatus; + iConnMan->IsConnected(device->iAddr, connStatus); + + if(connStatus == EBTEngConnecting || connStatus == EBTEngConnected) + { + SetStatusFlags(device->iStatus,EStatusBtuiConnected); + } + + // add connectable status + TBool connectable=EFalse; + iConnMan->IsConnectable(aRegDevice->BDAddr(), aRegDevice->DeviceClass(), connectable ); + + if( connectable) + { + SetStatusFlags(device->iStatus, EStatusConnectable ); + } + + TRACE_FUNC_EXIT + + return device; + } + +// --------------------------------------------------------------------- +// CBTPairedModel::ConnectComplete +// from MBTEngConnObserver +// ---------------------------------------------------------------------- +// +void CBTPairedModel::ConnectComplete(TBTDevAddr& aAddr, TInt aErr, RBTDevAddrArray* aConflicts) + { + TRACE_FUNC_ENTRY + + TRACE_INFO((_L("aErr=%d"), aErr)) + + TInt index = GetIndexByAddress(aAddr); + TBool requestIssuedFromPhone = EFalse; + TBTDevice connectedDevice; + + // was the device connected from request by the ui + if(iQueue.Count()>0 && iQueue[0]->iOperation==EOpConnect && + iQueue[0]->iAddr == aAddr) + { + requestIssuedFromPhone = ETrue; + if(index >=0) // is it from paired list + { + connectedDevice=*iDeviceArray[index]; + connectedDevice.iOperation=EOpConnect; + } + else + { + connectedDevice=*iQueue[0]; + } + + } + else + { + requestIssuedFromPhone = EFalse; + if(index >=0) // is it from paired list + { + connectedDevice=*iDeviceArray[index]; + connectedDevice.iOperation=EOpConnect; + } + else + { + // it was not. Try to fill what can be filled. + connectedDevice.iAddr=aAddr; + connectedDevice.iIndex=KErrNotFound; + connectedDevice.iOperation = EOpConnect; + } + } + + if (aErr == KErrAlreadyExists ) + { + // gather the names of the conflicting devices. + RBTDevNameArray nameArray; + for (TInt i = 0; aConflicts!= NULL && i < aConflicts->Count(); i++) + { + //remove duplicates + if(i>0&& (*aConflicts)[i]==(*aConflicts)[i-1]) + { + continue; + } + TInt di = GetIndexByAddress((*aConflicts)[i]); + + if(di >=0 ) + { + nameArray.Append(&iDeviceArray[di]->iName); + } + } + + // we will unset the connect status of the device if connection failed & + // it is found in paired devices. + if( index >= 0 ) + { + // add EStatusBtuiConnected status if the device has a profile connection + TBTEngConnectionStatus connStatus; + iConnMan->IsConnected(connectedDevice.iAddr, connStatus); + + if (connStatus != EBTEngConnecting && connStatus != EBTEngConnected) + { + TRACE_INFO(_L("Unset EStatusBtuiConnected")) + UnsetStatusFlags(iDeviceArray[index]->iStatus,EStatusBtuiConnected ); + } + } + + if(iObserver) + { + //Show only phone issued request complete notes + //Do not show notes for device issued request when BTUI is active + if ( requestIssuedFromPhone ) + { + iObserver->NotifyChangeDeviceComplete(aErr, connectedDevice, &nameArray); + } + + SendRefreshIfNoError(aErr); + } + nameArray.Reset(); + } + else + { + if (aErr == KErrNone) + { + // we will set the connect status of the device + // if it is found in paired devices. + if( index >= 0 ) + { + SetStatusFlags(iDeviceArray[index]->iStatus,EStatusBtuiConnected ); + } + } + else + { + // we will unset the connect status of the device if connection failed & + // it is found in paired devices. + if( index >= 0 ) + { + // add EStatusBtuiConnected status if the device has a profile connection + TBTEngConnectionStatus connStatus; + iConnMan->IsConnected(connectedDevice.iAddr, connStatus); + + if (connStatus != EBTEngConnecting && connStatus != EBTEngConnected) + { + TRACE_INFO(_L("Unset EStatusBtuiConnected")) + UnsetStatusFlags(iDeviceArray[index]->iStatus,EStatusBtuiConnected ); + } + } + } + if(iObserver) + { + //Show only phone issued request complete notes + //Do not show notes for device issued request when BTUI is active + if ( requestIssuedFromPhone ) + { + iObserver->NotifyChangeDeviceComplete(aErr, connectedDevice); + } + + SendRefreshIfNoError(aErr); + } + } + + // Process the next command if the connect was + //initiated by this UI. + if(iQueue.Count()>0 && iQueue[0]->iOperation==EOpConnect && + iQueue[0]->iAddr == aAddr) + { + delete iQueue[0]; + iQueue.Remove(0); + HandleQueue(); + } + else + { + if( iQueue.Count()==0 ) + { + TRACE_INFO((_L("op Q is empty"))); + } + else + { + TRACE_INFO((_L("unexpected op Q contents, count is %d, op is %d"), iDeviceArray.Count(), iQueue[0]->iOperation)); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::PowerStateChanged +// from MBTEngSettingObserver +// ---------------------------------------------------------------------- +// +void CBTPairedModel::PowerStateChanged( TBTPowerStateValue ) + { + TRACE_FUNC_ENTRY + + // This is implemented for case like when user choses offlne mode, Bluetooth is swithced off + // very fast. Bt audio components don't have enough time to close audio connection. + // BTUI needs to update UI display. + + TInt count = iDeviceArray.Count(); + + for (TInt i = 0; i < count; i++) + { + UnsetStatusFlags(iDeviceArray[i]->iStatus, EStatusBtuiConnected ); + } + + SendRefreshIfNoError(KErrNone); + + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------- +// CBTPairedModel::VisibilityModeChanged +// from MBTEngSettingObserver +// ---------------------------------------------------- +// +void CBTPairedModel::VisibilityModeChanged( TBTVisibilityMode ) + { + TRACE_FUNC_ENTRY + + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::DisconnectComplete +// from MBTEngConnObserver +// ---------------------------------------------------------------------- +// +void CBTPairedModel::DisconnectComplete(TBTDevAddr& aAddr, TInt aErr) + { + TRACE_FUNC_ENTRY + + // the disconnect was part of a unpairing or blocking operation + if(iState == EDisconnectBeforeOperationState && iDisconnectDevice && aAddr == iDisconnectDevice->iAddr ) + { + + TRAPD(err, + DoChangeDeviceL(*iDisconnectDevice); + ); + iState=EIdleState; + if(err != KErrNone) + { + HandleLeave(err,iDisconnectDevice); + } + TRACE_FUNC_EXIT + return; + } + + TInt index = GetIndexByAddress(aAddr); + + // the disconnected device was not the devicein the list, + // so we do not tell anyone about it. + if ( iDisconnectDevice == NULL || iDisconnectDevice->iAddr != aAddr ) + { + if (index >=0 ) + { + UnsetStatusFlags(iDeviceArray[index]->iStatus, EStatusBtuiConnected ); + } + + SendRefreshIfNoError(KErrNone); + + TBTDevice disconnectedDevice; + disconnectedDevice.iAddr = aAddr; + // Notify needed when there is active disconnect query dialog + iObserver->NotifyChangeDeviceComplete(KErrDisconnected, disconnectedDevice); + + TRACE_FUNC_EXIT + return; + } + + if(index >=0 ) + { + // set it to "not connected" no matter disconnection works or not + UnsetStatusFlags(iDeviceArray[index]->iStatus, EStatusBtuiConnected ); + iDeviceArray[index]->iOperation = EOpDisconnect; + iObserver->NotifyChangeDeviceComplete(aErr, *iDeviceArray[index]); + } + else + { + iDisconnectDevice->iIndex=index; + iObserver->NotifyChangeDeviceComplete(aErr, *iDisconnectDevice); + } + + delete iDisconnectDevice; + iDisconnectDevice=NULL; + + SendRefreshIfNoError(aErr); + // continue processing queue only if the disconnected device is + // the device with we requested disconnect to. + // this has to be checked so that we do not end on having multiple + // queue processors at the same time + if(iQueue.Count()>0 && iQueue[0]->iOperation==EOpDisconnect && + iQueue[0]->iAddr == aAddr) + { + delete iQueue[0]; + iQueue.Remove(0); + HandleQueue(); + } + else + { + if( iQueue.Count()==0 ) + { + TRACE_INFO((_L("op Q is empty"))); + } + else + { + TRACE_INFO((_L("unexpected op Q contents, count is %d, op is %d"), iDeviceArray.Count(), iQueue[0]->iOperation)); + } + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::PairingComplete +// from MBTEngConnObserver +// ---------------------------------------------------------------------- +// +void CBTPairedModel::PairingComplete(TBTDevAddr& aAddr, TInt aErr) + { + TRACE_FUNC_ENTRY + + TRAPD(err, + PairingCompleteL(aAddr,aErr); + ); + + if(err!=KErrNone) + { + TBTDevice tmp; + tmp.iAddr=aAddr; + tmp.iIndex=GetIndexByAddress(aAddr); + tmp.iOperation=EOpPair; + HandleLeave(err,&tmp ); + + delete iPairingDevice; + iPairingDevice=NULL; + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::PairingCompleteL +// Leaving version of PairingComplete +// ---------------------------------------------------------------------- +// +void CBTPairedModel::PairingCompleteL(TBTDevAddr& aAddr, TInt aErr) + { + TRACE_FUNC_ENTRY + + // The device that was attempted to be paired is + // different from the the device that the pairing is finnished. + // This cannot happen, since CBTConnMan will report + // only pairing started by the listener and the UI + // does not allow making two pairings at the same time + __ASSERT_DEBUG(aAddr==iPairingDevice->BDAddr(), + PANIC(EBTPanicCommandComplettedToDiffrentDeviceThanStarted)); + (void) aAddr; + + // bail out if the operation queue is not what we expect + if( iQueue.Count() == 0 + || iQueue[0]->iOperation != EOpPair + || iQueue[0]->iAddr != aAddr ) + { + if( iQueue.Count()==0 ) + { + TRACE_INFO((_L("op Q is empty"))); + } + else + { + TRACE_INFO((_L("unexpected op Q contents, count is %d, op is %d"), iDeviceArray.Count(), iQueue[0]->iOperation)); + } + TRACE_FUNC_EXIT + return; + } + + iState=EIdleState; + TBTDevice* tmpDevice=NULL; + tmpDevice=CreateDeviceL(iPairingDevice, &( iQueue[0]->iNameEntry ) ); + tmpDevice->iOperation=EOpPair; + + // new paired device must be inserted to the array, since + // user may be doing trust/ connect operations before + // it is refreshed from registry + TBool deleleteTmpDevice=ETrue; + + if( aErr == KErrNone ) + { + SetStatusFlags(tmpDevice->iStatus,EStatusPaired); + TInt index; + index=GetIndexByAddress(iPairingDevice->BDAddr()); + + if(index == KErrNotFound) + { + iDeviceArray.InsertInOrderL(tmpDevice,*iSortOrder ); + + RenumberDeviceArray(); + + // iPairingDevice is now owned by iDeviceArray. + // So it must not be deleted by his function + deleleteTmpDevice=EFalse; + + SendRefreshIfNoError(aErr,GetIndexByAddress(iPairingDevice->BDAddr())); + } + } + + + iObserver->NotifyChangeDeviceComplete(aErr, *tmpDevice); + + /* + * We issue an background refresh in case + * registry is updated from btnotif + */ + iRegistryObserver->StartIfNotRunning(); + iRegistryObserver->Refresh(); + // delete if the ownership has not changed + if(deleleteTmpDevice ) + { + delete tmpDevice; + tmpDevice=NULL; + } + + delete iPairingDevice; + iPairingDevice=NULL; + delete iQueue[0]; + iQueue.Remove(0); + + HandleQueue(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// BTPairedModel::HandleDevManComplete +// from MBTEngDevModelBase +// ---------------------------------------------------------------------- +// +void CBTPairedModel::HandleDevManComplete(TInt aErr) + { + TRACE_FUNC_ENTRY + + // if this is handled we can remove this + if(iDisconnectDevice) + { + delete iDisconnectDevice; + iDisconnectDevice=NULL; + } + + if(iPairingDevice) + { + // add the device just deleted + if(iState==EDeleteDeviceState && (aErr==KErrNone || aErr == KErrNotFound)) + { + iPairingDevice->DeleteLinkKey(); + TBTDeviceSecurity sec=iPairingDevice->GlobalSecurity(); + sec.SetBanned(EFalse); + sec.SetNoAuthorise(EFalse); + iDevMan->AddDevice(*iPairingDevice); + iState=EAddDeviceState; + TRACE_FUNC_EXIT + return; + } + // if the device is added allready, or if deletion failed + // we will go on with pairing the device + if(iState==EAddDeviceState||(iState==EDeleteDeviceState&& aErr != KErrNone)) + { + aErr = iConnMan->PairDevice(iPairingDevice->BDAddr(), iPairingDevice->DeviceClass()); + iState=EPairDeviceState; + // NOTE: now PairingComplete will be called and not this method. + TRACE_FUNC_EXIT + return; + } + } + // these are not handled by superclass + if(iQueue.Count()>0 && + ( iQueue[0]->iOperation==EOpConnect || + iQueue[0]->iOperation==EOpDisconnect ) ) + { + iObserver->NotifyChangeDeviceComplete(aErr, *iQueue[0]); + } + + CBTDevModelBase::HandleDevManComplete(aErr); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::DoPairDevice +// --------------------------------------------------------------------- +// +void CBTPairedModel::DoPairDeviceL() + { + TRACE_FUNC_ENTRY + + // we are starting a new command. Checks that no earlier commands + // have been executed, but not finished properly. + __ASSERT_DEBUG(iState==EIdleState,PANIC(EBTPanicDevManQueueIsInIllegalState)); + // check that there is no other pairing going on. + __ASSERT_DEBUG(iPairingDevice!=NULL,PANIC(EBTPanicTwoPairingAttemptsAtTheSameTime)); + + iRegistryObserver->Cancel(); + + // devices to be paired are first deleted + // then added back. Only after that the paring itself is + // started + TBTRegistrySearch dele; + dele.FindAddress(iPairingDevice->BDAddr()); + TInt err = iDevMan->DeleteDevices(dele); + + iState=EDeleteDeviceState; + if (err) + { + HandleDevManComplete(err); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::PairDevice +// +// Puts the given aPairingDevice to iPairingDevice and +// adds and empty device with iOperation=EOpPair as placeholder to iQueue. +// the pairing itself will be handled by DoChangeDevice that +// cals then +// --------------------------------------------------------------------- +// +TInt CBTPairedModel::PairDeviceL(const CBTDevice* aPairingDevice, + TNameEntry* aNameEntry) + { + TRACE_FUNC_ENTRY + + // cannot put two pairings to queue. + // this is not possible since ui does not allow it. + if(iPairingDevice) + return KErrInUse; + + TBTDevice* device=new(ELeave) TBTDevice(); + device->iOperation=EOpPair; + device->iAddr=aPairingDevice->BDAddr(); + if ( aNameEntry ) + { + device->iNameEntry = *aNameEntry; + } + CleanupStack::PushL(device); + iPairingDevice=aPairingDevice->CopyL(); + // put the device to queue directly + iQueue.AppendL(device); + TInt err = KErrNone; + if(iQueue.Count() ==1 ) + { + err = DoChangeDeviceL(*iQueue[0]); + } + CleanupStack::Pop(device); + TRACE_FUNC_EXIT + return err; + + } + +// --------------------------------------------------------------------- +// CBTPairedModel::HandleDisconnectCompleteL +// Disconnection by CBluetoothPhysicalLinks, for those +// connections not opened by btui. +// --------------------------------------------------------------------- +// +void CBTPairedModel::HandleDisconnectCompleteL(TInt aErr) + { + TRACE_FUNC_ENTRY + + if(iDisconnectDevice) + { + DisconnectComplete(iDisconnectDevice->iAddr,aErr); + } + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTPairedModel::FlagPhysicallyConnectedDevices +// +// Marks the EStatusPhysicallyConnected attribute to the devices +// that have active connection. +// --------------------------------------------------------------------- +// +void CBTPairedModel::FlagPhysicallyConnectedDevices(RDeviceArray &aDeviceArray) + { + TRACE_FUNC_ENTRY + + RBTDevAddrArray a; + iLinks->Enumerate(a,KMaxCheckedConnections); + + TInt i=0; + + for(i=0;iEnumerate(a,KMaxCheckedConnections); + FlagPhysicallyConnectedDevices(aDevice, a); + a.Close(); + + TRACE_FUNC_EXIT + + return rvalue; + } + +// --------------------------------------------------------------------- +// CBTPairedModel::HandleLeave +// from CBTDevModelBase +// --------------------------------------------------------------------- +// +void CBTPairedModel::HandleLeave(TInt aErr,const TBTDevice* aDevice ) + { + TRACE_FUNC_ENTRY + + iConnMan->CancelPairDevice(); + + delete iPairingDevice; + iPairingDevice=NULL; + + delete iDisconnectDevice; + iDisconnectDevice=NULL; + + iRegistryObserver->StartIfNotRunning(); + iRegistryObserver->Refresh(); + + iState=EIdleState; + + CBTDevModelBase::HandleLeave(aErr,aDevice ); + + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/devmodel/src/btregistryobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/devmodel/src/btregistryobserver.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,256 @@ +/* +* 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: Monitors BTRegistry device changes and sends the +* new status to listener +* +*/ + +#include "btregistryobserver.h" +#include "debug.h" + +#include +const TInt KDeviceArrayDefaultSize=10; +// --------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------- +CBTRegistryObserver::CBTRegistryObserver(MBTRegistryObserver* aObserver, + const TBTRegistrySearch aPattern) + : CActive(CActive::EPriorityHigh), + iObserver(aObserver), iSearchPattern(aPattern) + { + TRACE_FUNC_ENTRY + CActiveScheduler::Add(this); + // The priority will be EPriorityHigh only initially. + // after the first successfull retrieval of the devicelist + // the priority will be changed to EPriorityLow. + + // This will make the 1st devicelist drawn as quickly as possible, + // but the subsequent refrehes will not decrease the responsiveness + // of the Btui. + iAnotherEventPending=EFalse; + + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::NewL +// --------------------------------------------------------------------- +CBTRegistryObserver* CBTRegistryObserver::NewL(MBTRegistryObserver* aObserver, + const TBTRegistrySearch aPattern) + { + CBTRegistryObserver* self = new (ELeave) CBTRegistryObserver(aObserver, aPattern); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } +// --------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------- +CBTRegistryObserver::~CBTRegistryObserver() + { + TRACE_FUNC_ENTRY + Cancel(); + iProperty.Close(); + delete iDevMan; + + DeleteAllocatedDevices(); + + delete iRegDeviceArray; + iRegDeviceArray=NULL; + + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::ConstructL() +// --------------------------------------------------------------------- +void CBTRegistryObserver::ConstructL() + { + TRACE_FUNC_ENTRY + iRegDeviceArray = new (ELeave) CBTDeviceArray(KDeviceArrayDefaultSize); + iDevMan = CBTEngDevMan::NewL(this); + iDevMan->SetPriority(CActive::EPriorityHigh); + + iProperty.Attach(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetRegistryTableChange); + StartIfNotRunning(); + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::Refresh +// This will simulate registry change event. +// --------------------------------------------------------------------- +void CBTRegistryObserver::Refresh() + { + TRACE_FUNC_ENTRY + + __ASSERT_DEBUG(iDevMan, User::Invariant()); + + if (iDevMan->IsActive()) + { + // An attempt to start a new search, during a prior + // one. + iAnotherEventPending=ETrue; + return; + } + Cancel(); + + DeleteAllocatedDevices(); + iDevMan->GetDevices(iSearchPattern, iRegDeviceArray); + + StartIfNotRunning(); + + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTRegistryObserver::StartIfNotRunning +// this have to be called again each time there has been registry event +// --------------------------------------------------------------------- +void CBTRegistryObserver::StartIfNotRunning() + { + TRACE_FUNC_ENTRY + if (!IsActive()) + { + TRACE_INFO(_L("Start()")) + iIsStopped = EFalse; + iProperty.Subscribe(iStatus); + SetActive(); + } + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::RunL +// From CAtive +// This is called when registry has changed. This will not +// be called when BTRegistry date retrieval is complete, since +// HandleGetDevicesComplete is called when RBTregistry data retrieval +// is complete +// ---------------------------------------------------------------------- + +void CBTRegistryObserver::RunL() + { + TRACE_FUNC_ENTRY + if(iDevMan && iDevMan->IsActive()) + { + // An attempt to start a new search, during a prior + // one. We will not start a new search, but we + // will do it after the current search is complete + iAnotherEventPending=ETrue; + StartIfNotRunning(); + TRACE_FUNC_EXIT + return; + } + if(!IsActive()) + SetPriority(CActive::EPriorityLow); + + + + TInt registryTable; + iProperty.Get(registryTable); + iAnotherEventPending=EFalse; + + if(iDevMan && iStatus.Int() == KErrNone && registryTable == KRegistryChangeRemoteTable) + { + TRACE_INFO(_L("Remote table change")) + + DeleteAllocatedDevices(); + iDevMan->GetDevices(iSearchPattern, iRegDeviceArray); + } + StartIfNotRunning(); + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTRegistryObserver::HandleGetDevicesComplete +// From MBTEngDevManObserver +// +// This function will not filter out refreshes with no changes, +// since the connect status may have been changed in those cases, and +// this class does not know about that +// +// It is worth to mention that CBTDeviceContainer will not refresh parts +// of the screen that are not changed. +// --------------------------------------------------------------------- +void CBTRegistryObserver::HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray) + { + TRACE_FUNC_ENTRY + TRACE_INFO((_L("aErr = %d"), aErr)) + + // the initial view refresh is done. We will decrese + // the priority of this component to quarantee UI + // responsiveness + if(!iDevMan->IsActive()) + iDevMan->SetPriority(CActive::EPriorityLow); + + TRAP_IGNORE( + if( aErr != KErrNotFound) + iObserver->RegistryChangedL(aDeviceArray ); + else + { + // handle the empty response case. The DevMan may issue + // NULL in that case + iObserver->RegistryChangedL(iRegDeviceArray ); + } + ); + + DeleteAllocatedDevices(); + + if(iAnotherEventPending) + { + // Current results are not sent further, since + // there has been changes, witch may have rendered the current + // results allready obsolate. Therefore a refresh is made instead + + iAnotherEventPending=EFalse; + iDevMan->GetDevices(iSearchPattern, iRegDeviceArray); + } + TRACE_FUNC_EXIT + } + +// --------------------------------------------------------------------- +// CBTRegistryObserver::DeleteAllocatedDevices +// --------------------------------------------------------------------- +void CBTRegistryObserver::DeleteAllocatedDevices() + { + TRACE_FUNC_ENTRY + if(iRegDeviceArray) + { + iRegDeviceArray->ResetAndDestroy(); + } + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::Cancel +// From CActive +// --------------------------------------------------------------------- + +void CBTRegistryObserver::Cancel() + { + TRACE_FUNC_ENTRY + iIsStopped = ETrue; + iAnotherEventPending=EFalse; + CActive::Cancel(); + if (iDevMan) iDevMan->Cancel(); + DeleteAllocatedDevices(); + TRACE_FUNC_EXIT + } +// --------------------------------------------------------------------- +// CBTRegistryObserver::DoCancel +// From CActive +// --------------------------------------------------------------------- +void CBTRegistryObserver::DoCancel() + { + TRACE_FUNC_ENTRY + iProperty.Cancel(); + TRACE_FUNC_EXIT + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/group/BTUI.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/group/BTUI.mmp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,88 @@ +/* +* 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 BTUI. +* +*/ + +#include +#include +#include + +VENDORID VID_DEFAULT + +CAPABILITY CAP_APPLICATION NetworkServices NetworkControl + +TARGET BTUI.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 +UID 0x100039CE 0x10005951 + +SOURCEPATH ../src +SOURCE BTUIApp.cpp +SOURCE BTUIAppUi.cpp +SOURCE BTUIDocument.cpp + + +// Application Resource +// +START RESOURCE ../data/BTUI.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + + +// Application Registeration Resource +// +START RESOURCE ../data/Btui_reg.rss +DEPENDS btui.rsg + +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +USERINCLUDE ../inc +USERINCLUDE ../devmodel/inc +USERINCLUDE ../Ecom/inc +USERINCLUDE ../data + +SYSTEMINCLUDE ../../inc //for private API headers (BluetoothEngine subsystem) +SYSTEMINCLUDE ../../../inc //for internal API headers (localconnectivity) +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib apparc.lib cone.lib // Symbian OS framework libraries +LIBRARY eikcore.lib eikcoctl.lib eikctl.lib // UIKON libraries +LIBRARY avkon.lib // Series 60 UI library +LIBRARY bafl.lib // Basic Application Framework +LIBRARY AknSkins.lib // Skinned icons +LIBRARY aknicon.lib +LIBRARY BtdevModel.lib +LIBRARY ecom.lib + +LIBRARY GSEcomPlugin.lib +LIBRARY GSFramework.lib + +#ifdef __SERIES60_HELP +LIBRARY hlplch.lib // Help library +#endif + +DEBUGLIBRARY flogger.lib // File logging services + +// This is optional - used only by Codewarrior IDE for .RSS file editing. +// +//Document ../data/Btui_reg.rss +//Document ../data/BTUI.rss +//Document ../inc/btui.loc + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,60 @@ +/* +* 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 project information required for BTUI. +* +*/ + + +#include +#include "../devmodel/group/bld.inf" + +PRJ_PLATFORMS +//DEFAULT + +PRJ_EXPORTS +../loc/btui.loc MW_LAYER_LOC_EXPORT_PATH(btui.loc) +../rom/btui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btui.iby) +../rom/BtuiResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(BtuiResources.iby) +../inc/BtuiPluginInterface.h |../../inc/BtuiPluginInterface.h +../inc/BtuiPluginInterface.inl |../../inc/BtuiPluginInterface.inl +../Ecom/inc/bluetoothuiutil.h |../../inc/bluetoothuiutil.h +../Ecom/inc/bluetoothuiutil.inl |../../inc/bluetoothuiutil.inl +// Help exports +#include "../help/group/bld.inf" + +PRJ_EXTENSIONS + +START EXTENSION s60/mifconv +OPTION TARGETFILE btui.mif +OPTION HEADERFILE btui.mbg +OPTION SOURCES \ + -c8,8 qgn_prop_bt_devices_tab3 -c8,8 qgn_prop_bt_set_tab3 -c8,8 qgn_prop_set_apps_bt \ + -c8,8 qgn_prop_bt_blocked_tab3 -c8,8 qgn_prop_set_apps_bt_off -c8,8 qgn_prop_set_apps_bt_on_shown \ + -c8,8 qgn_prop_set_apps_bt_on_hidden -c8,8 qgn_prop_set_apps_bt_conn_shown -c8,8 qgn_prop_set_apps_bt_conn_hidden \ + -c8,8 qgn_prop_bt_audio_connect -c8,8 qgn_prop_bt_computer_connect -c8,8 qgn_prop_bt_car_kit_connect \ + -c8,8 qgn_prop_bt_keyboard_connect -c8,8 qgn_prop_bt_mouse_connect +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE btui_aif.mif +OPTION SOURCES -c8,8 qgn_menu_bt +END + +PRJ_MMPFILES + +../Ecom/group/BtuiPlugin.mmp +../group/BTUI.mmp + + +//---End of File--- diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/group/btui_Icons_aif_bitmaps_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/group/btui_Icons_aif_bitmaps_dc.mk Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,69 @@ +# +# 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\btui_aif.mbm + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_bt_lst.bmp \ + /c8,8 qgn_menu_bt_cxt.bmp + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/group/btui_Icons_aif_scalable_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/group/btui_Icons_aif_scalable_dc.mk Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,68 @@ +# +# 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\btui_aif.mif + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) \ + /c8,8 qgn_menu_bt.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/group/btui_icons_dc.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/group/btui_icons_dc.mk Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,84 @@ +# +# 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +# ---------------------------------------------------------------------------- +# TODO: Configure these +# ---------------------------------------------------------------------------- + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\btui.mif + +HEADERDIR=\epoc32\include +HEADERFILENAME=$(HEADERDIR)\btui.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# TODO: Configure these. +# +# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by +# MifConv if the mask detph is defined. +# +# NOTE 2: Usually, source paths should not be included in the bitmap +# definitions. MifConv searches for the icons in all icon directories in a +# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. +# The directory \s60\icons is included in the search only if the feature flag +# __SCALABLE_ICONS is defined. +# ---------------------------------------------------------------------------- + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 qgn_prop_bt_devices_tab3.svg \ + /c8,8 qgn_prop_bt_set_tab3.svg \ + /c8,8 qgn_prop_set_apps_bt.svg \ + /c8,8 qgn_prop_bt_blocked_tab3.svg \ + /c8,8 qgn_prop_set_apps_bt_off.svg \ + /c8,8 qgn_prop_set_apps_bt_on_shown.svg \ + /c8,8 qgn_prop_set_apps_bt_on_hidden.svg \ + /c8,8 qgn_prop_set_apps_bt_conn_shown.svg \ + /c8,8 qgn_prop_set_apps_bt_conn_hidden.svg \ + /c8,8 qgn_prop_bt_audio_connect.svg \ + /c8,8 qgn_prop_bt_computer_connect.svg \ + /c8,8 qgn_prop_bt_car_kit_connect.svg \ + /c8,8 qgn_prop_bt_keyboard_connect.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/help/data/xhtml.zip Binary file bluetoothengine/btui/help/data/xhtml.zip has changed diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/help/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -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: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/bt.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/bt.hlp.hrh) +../rom/btuihelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(btuihelps_variant.iby) diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/help/inc/bt.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/help/inc/bt.hlp.hrh Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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: +* +*/ + +// +// bt.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __BT_HLP_HRH__ +#define __BT_HLP_HRH__ + +_LIT(KBT_HLP_MAIN, "BT_HLP_MAIN"); // +_LIT(KBT_HLP_PAIRED, "BT_HLP_PAIRED"); // +_LIT(KBT_HLP_BLOCKED, "BT_HLP_BLOCKED"); // +_LIT(KBTKEYBOARD_HLP_SETTINGS, "BTKEYBOARD_HLP_SETTINGS"); // + +#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/help/rom/btuihelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/help/rom/btuihelps_variant.iby Wed Sep 01 12:20:04 2010 +0100 @@ -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 __BTUIHELPS_VARIANT_IBY__ +#define __BTUIHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) && defined(__BT) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10005951\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10005951\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10005951\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10005951\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10005951\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10005951\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10005951\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10005951\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/BTUIApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/BTUIApp.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,53 @@ +/* +* 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: +* +*/ + + +#ifndef BTUIAPP_H +#define BTUIAPP_H + +#include + +/** +* CBTUIApp application class +* +* Provides factory to create concrete document object. +* +* @lib btui.exe +* @sice S60v3.0 +*/ +class CBTUIApp : public CAknApplication + { + + private: + + /** + * From CAknApplication Creates CBTUIDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CAknApplication Returns application's UID (KUidBTUI). + * @return The value of KUidBTUI. + */ + TUid AppDllUid() const; + }; + +#endif + + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/BTUIAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/BTUIAppUi.h Wed Sep 01 12:20:04 2010 +0100 @@ -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: +* +*/ + + +#ifndef BTUIAPPUI_H +#define BTUIAPPUI_H + +// INCLUDES +#include // AVKON components +#include +#include +#include +#include +#include "BtuiPluginInterface.h" + +// CLASS DECLARATION + +/** +* This class is a base class mandatory for all Symbian OS UI applications. +*/ +class CBTUIAppUi : public CAknViewAppUi, + public MAknTabObserver, + public MBtuiPluginViewActivationObserver + { + public: // Constructors and destructor + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Destructor + */ + virtual ~CBTUIAppUi(); + + + public: // Functions from base classes + + /** + * From CAknViewAppUi Handles user commands. + * @param aCommand A command id. + * @return None. + */ + void HandleCommandL(TInt aCommand); + + private: // Functions from base classes + + /** + * From CAknViewAppUi Initializes menu pane dynamically. + * @param aResourceId Resource ID identifying the menu pane to initialise. + * @param aMenuPane The in-memory representation of the menu pane. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + /** + * From CAknViewAppUi Handles key events. + * @param aKeyEvent The key event that occurred. + * @param aType The event type. + * @return Response to the key event. + */ + virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType ); + + /** + * From MBtuiPluginViewActivationObserver + * @param aViewId activated plugin id + * @return none + */ + void PluginViewActivated(TPluginViewId aViewId); + + /** + * From MAknTabObserver Takes care of tab handling. + * @param aIndex tab to be handled + */ + virtual void TabChangedL(TInt aIndex); + + private: // Data + + CAknNavigationControlContainer* iNaviPane; // pointer to the navi pane control + CAknTabGroup* iTabGroup; // Tab group + CAknNavigationDecorator* iDecoratedTabGroup; // Frame for tabgroup + }; + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/BTUIDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/BTUIDocument.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,74 @@ +/* +* 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: +* +*/ + + +#ifndef BTUIDOCUMENT_H +#define BTUIDOCUMENT_H + +// INCLUDES + +#include +#include + +// FORWARD DECLARATIONS + +class CEikAppUi; +//class CBTUIModel; + +// CLASS DECLARATION + +/** +* This class is a base class mandatory for all Symbian OS UI applications. +*/ +class CBTUIDocument : public CAknDocument + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBTUIDocument* NewL(CAknApplication& aApp); + + /** + * Destructor. + */ + virtual ~CBTUIDocument(); + + private: // Functions from base classes + + /** + * From CAknDocument Creates AppUi class. + * @param None. + * @return A reference to created class. + */ + CEikAppUi* CreateAppUiL(); + + private: + + /** + * C++ default constructor. + */ + CBTUIDocument(CEikApplication& aApp) :CAknDocument(aApp) { } + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/BtuiPluginInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/BtuiPluginInterface.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,113 @@ +/* +* 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: +* +*/ + +#ifndef BTUIPLUGININTERFACE_H +#define BTUIPLUGININTERFACE_H + +#include +#include +#include + +const TUid KCBtuiPluginInterfaceUid = { 0x1020745F }; + + +enum TPluginViewId +{ + EMainViewId =1, + EPairedDevicesViewId=2, + EBlockedDevicesViewId=3 +}; + + + +/** +* Callback interface for plugins view activation observer +*/ +class MBtuiPluginViewActivationObserver +{ +public: + /** + * Called when view is activated + * + * @param aView Activated view id + */ + virtual void PluginViewActivated(TPluginViewId aViewId)=0; +}; + + +/** This class implements the CGSPluginInterface which is used +* to implement the main view as general settings plugin. +* +*@lib BTUIPlugin.dll +*@since S60 v3.1 +*/ +class CBtuiPluginInterface : public CGSBaseView + { + public: // Constructors & destructors + + /** + * Creates new BTUI View plugin having the given UID. + * Uses Leave code KErrNotFound if implementation is not found. + * + * @param aImplementationUid Implementation UID of the plugin to be + * created. + * @param aModel Pointer to the BTUI Model of BTUI Application. + */ + static CBtuiPluginInterface* NewL( + const TUid aImplementationUid, MBtuiPluginViewActivationObserver* aObserver = NULL); + + /** + * From CGSPluginInterface + */ + void GetCaptionL( TDes& aCaption ) const; + + /** + * Destructor + */ + inline ~CBtuiPluginInterface(); + + /** + * One ECom plugin of a type of HID device has its unique DeviceClass. + * The HID plugin has to implement this function to report the plug-in loader of its COD. + * Otherwise, it won't be added to enable setting view. + * @return TBTDeviceClass Class of Device defined in btdevice.h + */ + inline void SetCOD(TBTDeviceClass& aCOD); + inline TBTDeviceClass GetCOD() const; + + protected: + /** Non leaving constructor + */ + inline CBtuiPluginInterface(); + + inline void NewContainerL(); + + inline void HandleListBoxSelectionL(); + + + private: // Data + + /** + * ECOM plugin instance UID. + */ + TUid iDtor_ID_Key; + TBTDeviceClass iCOD; + }; + +#include "BtuiPluginInterface.inl" + +#endif //BTUIPLUGININTERFACE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/BtuiPluginInterface.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/BtuiPluginInterface.inl Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,79 @@ +/* +* 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: Inline code of CBtuiPluginInterface class. +* +*/ + + +// ----------------------------------------------------------------------------- +// Empty implementations of 3 pure virtual functions +// defined in base class CGSBaseView +// ----------------------------------------------------------------------------- +inline void CBtuiPluginInterface::NewContainerL() + { + } +inline void CBtuiPluginInterface::HandleListBoxSelectionL() + { + } +inline CBtuiPluginInterface::CBtuiPluginInterface() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +inline CBtuiPluginInterface::~CBtuiPluginInterface() + { + REComSession::DestroyedImplementation( iDtor_ID_Key ); + } + +// ----------------------------------------------------------------------------- +// CBtuiPluginInterface::NewL +// ----------------------------------------------------------------------------- +// +inline CBtuiPluginInterface* CBtuiPluginInterface::NewL( + TUid aImplementationUid, MBtuiPluginViewActivationObserver* aObserver) + { + TInt32 keyOffset = _FOFF( CBtuiPluginInterface, iDtor_ID_Key ); + TAny* ptr = REComSession::CreateImplementationL( aImplementationUid, keyOffset, aObserver); + + return reinterpret_cast< CBtuiPluginInterface* >( ptr ) ; + } + +// ----------------------------------------------------------------------------- +// CBtuiPluginInterface::NewL +// offer a default implementation to make it non-pure virtual. +// ----------------------------------------------------------------------------- +// +inline void CBtuiPluginInterface::GetCaptionL( TDes& aCaption ) const + { + _LIT( NO_CAPTION,"no caption to offer" ); + aCaption.Copy(NO_CAPTION); + return; + } + +// ----------------------------------------------------------------------------- +// CBtuiPluginInterface::SetCOD +// only used for derived add-on plugins out of BTUI +// ----------------------------------------------------------------------------- +// +inline void CBtuiPluginInterface::SetCOD(TBTDeviceClass& aCOD) + { + iCOD = aCOD; + } +inline TBTDeviceClass CBtuiPluginInterface::GetCOD() const + { + return iCOD; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/bluetoothtrace.h --- a/bluetoothengine/btui/inc/bluetoothtrace.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,450 +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 BLUETOOTHTRACE_H -#define BLUETOOTHTRACE_H - -#include -#include "traceconfig.h" - -/* - * Common tracing utility definition to be used by Bluetooth projects. - * The configuration is loaded from traceconfig.h which shall be private for - * each individual project. - * - * In this utility, a set of OST-alike tracing macros are defined. - * (The purpose is to ease migration to OST in future.) - * - * Individual project can also define new macros based on this utility in - * its own space. - * - */ - -#ifdef BLUETOOTHTRACE_ENABLED - -#ifdef BLUETOOTHTRACE_MEDIA_OST - -/** - * Convert own macros to OST macros when OST tracing is used. - * In OST tracing, aTraceName must be a unique identifier in scope of a module. - * Thus many OST compiling errors may occur if the same TraceName is used in multiple - * tracing lines where tracing is miigrated from non-OST to OST. - * The fix is to renaming the TraceName:s to be unique. - */ -#include - -#define BOstrace0( aGroupName, aTraceName, aTraceText ) \ - OstTrace0( aGroupName, aTraceName, aTraceText ) - -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \ - OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) - -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \ - OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) - -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \ - OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) - -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ - OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) - -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ - OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) - -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ - OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) - -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ - OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) - -#define BOstraceFunctionEntry0( aTraceName ) \ - OstTraceFunctionEntry0( aTraceName ) - -#define BOstraceFunctionEntry1( aTraceName, aInstance ) \ - OstTraceFunctionEntry1( aTraceName, aInstance ) - -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ - OstTraceFunctionEntryExt(aTraceName, aInstance, aArg) - -#define BOstraceFunctionExit0( aTraceName ) \ - OstTraceFunctionExit0( aTraceName ) - -#define BOstraceFunctionExit1( aTraceName, aInstance ) \ - OstTraceFunctionExit1( aTraceName, aInstance ) - -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ - OstTraceFunctionExitExt(aTraceName, aInstance, aRetval) - -#define BOstraceEventStart0( aTraceName, aEventName ) \ - OstTraceEventStart0( aTraceName, aEventName ) - -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ - OstTraceEventStart1( aTraceName, aEventName, aParam ) - -#define BOstraceEventStop( aTraceName, aEventName ) \ - OstTraceEventStop( aTraceName, aEventName ) - -#define BOstraceState0( aTraceName, aStateName, aNewState ) \ - OstTraceState0( aTraceName, aStateName, aNewState ) - -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ - OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) - -#else // BLUETOOTHTRACE_MEDIA_OST - -#ifdef BLUETOOTHTRACE_MEDIA_FILE -#include -#else -#include -#endif - -/** - * When tracing compilation with OST is disabled, the TraceName in each OST trace line - * is ignored, that is, the Trace Names are not checked at compiling time, neither - * are they written into the specified trace output media. - */ - -/** - * Handlers below are used for tolerating overflow of formatting strings. - * to trucate rather than panic the caller. - */ -NONSHARABLE_CLASS( TBtTraceOflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TBtTraceOflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -/** - * internal tracing implementation, do not use it out of this file. - */ -inline void Trace(const TDesC &trGrp, const TDesC &trTxt) -{ - _LIT(Format, "%S%S%S"); - TBuf16<0x180> str; - TPtrC cp(KComponentName); - str.Format(Format, &cp, &trGrp, &trTxt); -#ifdef BLUETOOTHTRACE_MEDIA_FILE - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, str); -#else - RDebug::Print( str ); -#endif -} - -/* - * trace with no parameters - */ -#define BOstrace0( aGroupName, aTraceName, aTraceText ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - Trace( TrGrp, TrTxt ); \ -} - -/* - * trace with one 32-bit parameter - */ -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with more than 32 bits of data. Not supported - */ -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) - -/* - * trace with one parameter that is not 32-bit integer - */ -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \ - BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) - -/* - * trace with two parameters. - */ -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with three parameters. - */ -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with four parameters - */ -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \ - Trace( TrGrp, buf ); \ -} - -/* - * trace with five parameters - */ -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ -{\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace without extra parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntry0( aTraceName ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace with a parameter representing the instance identifier, e.g. - * "this" pointer. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntry1( aTraceName, aInstance ) \ -{\ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function entry trace, which traces function parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ -{ \ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \ - Trace( TrGrp, buf ); \ -} -/* - * Function exit trace without extra parameters. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExit0( aTraceName ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function exit trace with a parameter representing the instance identifier - * for example "this" pointer. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExit1( aTraceName, aInstance ) \ -{\ - _LIT(TrGrp, "[ API ]"); \ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ -} - -/* - * Function exit trace with parameters representing the instance identifier, - * for example "this" pointer, and return value. - * The trace is mapped to TRACE_API group. - */ -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ -{\ - _LIT(TrGrp, "[ API ]");\ - TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event start trace without extra parameters. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStart0( aTraceName, aEventName ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event start trace with single 32-bit parameter. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] %S 0x%X(%d)"); \ - TPtrC evt(EvName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \ - Trace( TrGrp, buf ); \ -} - -/* - * Performance measurement event end trace. - * The trace is mapped to TRACE_PERFORMANCE group. - */ -#define BOstraceEventStop( aTraceName, aEventName ) \ -{\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Stop] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ -} - -/* - * State transition event. - * The trace is mapped to TRACE_STATE group. - */ -#define BOstraceState0( aTraceName, aStateName, aNewState ) \ -{\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \ - Trace( TrGrp, buf ); \ -} - -/* - * State transition event with instance identifier. - * The trace is mapped to TRACE_STATE group. - */ -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ -{\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ - TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ - Trace( TrGrp, buf ); \ -} - -#endif // BLUETOOTHTRACE_MEDIA_OST - -// Extended tracing macros facilitating domain specific tracing needs: - -/* - * A block of source code merely for tracing purpose. - */ -#define BtTraceBlock( exp ) {exp} - -/* - * trace macro for BT device address printing with an additional trace text. - * aParam must be TBTDevAddr type. - */ -#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) \ -{ \ - _LIT(TrTxt, aTraceText); TPtrC p(TrTxt); \ - TBuf<12> buf; \ - aParam.GetReadable( buf ); TPtrC p2(buf);\ - BOstraceExt2( aGroupName, aTraceName, "%S%S", &p, &p2 ); \ -} - -/* - * trace macro for BT device address printing with no additional trace text. - * aParam must be TBTDevAddr type. - */ -#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) \ -{ \ - TBuf<12> buf; aParam.GetReadable( buf ); TPtrC p(buf); \ - BOstraceExt1( aGroupName, aTraceName, "%S", &p ); \ -} - -#else // BLUETOOTHTRACE_ENABLED - -#define BOstrace0( aGroupName, aTraceName, aTraceText ) -#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) -#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) -#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) -#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) -#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) -#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) -#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) - -#define BOstraceFunctionEntry0( aTraceName ) -#define BOstraceFunctionEntry1( aTraceName, aInstance ) -#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) -#define BOstraceFunctionExit0( aTraceName ) -#define BOstraceFunctionExit1( aTraceName, aInstance ) -#define BOstraceEventStart0( aTraceName, aEventName ) -#define BOstraceEventStart1( aTraceName, aEventName, aParam ) -#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) -#define BOstraceEventStop( aTraceName, aEventName ) -#define BOstraceState0( aTraceName, aStateName, aNewState ) -#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) - -#define BtTraceBlock( exp ) -#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) -#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) - -#endif // BLUETOOTHTRACE_ENABLED - -/* - * Additional general purpose definition, a hook for defining a friend class - * for unit testing to get access to class internals. - */ -#ifndef BTUNITTEST -#define BTUNITTESTHOOK -#endif - -#endif // BLUETOOTHTRACE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/bluetoothuitrace.h --- a/bluetoothengine/btui/inc/bluetoothuitrace.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +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 BLUETOOTHUITRACE_H -#define BLUETOOTHUITRACE_H - -#include -#include - -#ifdef BLUETOOTHTRACE_ENABLED - -/* - * trace macro for Qt code with an additional trace text. - * param must be QString type. - */ -#define BtTraceQString1( groupName, traceName, traceText, param ) \ -{\ - _LIT(TrTxt, traceText); TPtrC p(TrTxt); \ - TPtrC textPtr(reinterpret_cast(param.utf16()), param.length() ); \ - BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \ -} - -/* - * trace macro for Qt code with no additional trace text. - * param must be QString type. - */ -#define BtTraceQString0( groupName, traceName, param ) \ -{\ - TPtrC textPtr(reinterpret_cast(param.utf16()), param.length() ); \ - BOstraceExt1( groupName, traceName, "%S", &textPtr ); \ -} - -/* - * Macro for tracing a Bluetooth device entry in btuimdevlist - * with no additional trace text. - */ -#define BtTraceDevListEntry0( groupName, traceName, dev ) \ -{\ - QString info("["); \ - info += dev[Btuim::DevAddrReadableRole].toString() + "]"; \ - QString filterBinary; \ - filterBinary.setNum( dev[Btuim::MajorFilterRole].toInt(), 16); \ - info += "[" + filterBinary + "]"; \ - info += "[" \ - + dev[Btuim::LastUsedTimeRole].value().toString(Qt::ISODate ) \ - + "]" ; \ - info += "[" + dev[Btuim::DevNameRoleRole].toString() + "]" ; \ - TPtrC textPtr(reinterpret_cast(info.utf16()), info.length() ); \ - BOstraceExt1( groupName, traceName, "%S", &textPtr ); \ -} - -/* - * Macro for tracing a Bluetooth device entry in btuim - * with an additional trace text. - */ -#define BtTraceDevListEntry1( groupName, traceName, traceText, dev ) \ -{\ - QString info("["); \ - info += dev[Btuim::DevAddrReadableRole].toString() + "]"; \ - QString cod; \ - cod.setNum( dev[Btuim::ClassOfDeviceRole].toInt(), 16); \ - info += "[" + cod + "]"; \ - QString filterBinary; \ - filterBinary.setNum( dev[Btuim::MajorFilterRole].toInt(), 16); \ - info += "[" + filterBinary + "]"; \ - info += "[" \ - + dev[Btuim::LastUsedTimeRole].value().toString(Qt::ISODate ) \ - + "]" ; \ - info += "[" + dev[Btuim::DevNameRole].toString() + "]" ; \ - TPtrC textPtr(reinterpret_cast(info.utf16()), info.length() ); \ - _LIT(TrTxt, traceText); TPtrC p(TrTxt); \ - BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \ -} - -/* - * Macro for Qt code with additional trace text. - * list must be QStringList type. - */ -#define BtTraceQStringList1( groupName, traceName, traceText, list ) \ -{\ - QString info(": ["); \ - info += list.join(".") + "]"; \ - TPtrC textPtr(reinterpret_cast(info.utf16()), info.length() ); \ - _LIT(TrTxt, traceText); TPtrC p(TrTxt); \ - BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \ -} - -/* - * Macro for Qt code with no additional trace text. - * list must be QStringList type. - */ -#define BtTraceQStringList0( groupName, traceName, list ) \ -{\ - QString info(": ["); \ - info += list.join(".") + "]"; \ - TPtrC textPtr(reinterpret_cast(info.utf16()), info.length() ); \ - BOstraceExt1( groupName, traceName, "%S", &textPtr ); \ -} - - -/* - * Macro for tracing Bluetooth DevData data source in btuimdevdata - * with no additional trace text. -*/ -#define BtTraceDevDataEntry0( groupName, traceName, devData ) \ -{\ - QString info("["); \ - QMap< int, QVariant > val = devData.at( Btuim::DevDataIndexName ); \ - info += val.value(Qt::EditRole).toString() + "]" ; \ - val = devData.at( Btuim::DevDataIndexStatus ); \ - int statusBits = val.value(Qt::EditRole).toInt(); \ - info += "["; \ - info += QString::number(statusBits, 16 ); \ - info += "]"; \ - QStringList strl = val.value(Qt::DisplayRole).toStringList(); \ - info += "[" ; \ - for ( int i = 0; i < strl.count(); ++i ) { \ - info += strl.at(i) + ","; \ - } \ - info += "]" ; \ - val = devData.at( Btuim::DevDataIndexOptionsMenu ); \ - info += " opts:"; \ - QList cmdItems = val.value( Btuim::DevDataCmdItemsRole ).toList(); \ - for ( int i = 0; i < cmdItems.count(); i++ ) { \ - const Btuim::DevDataCmdItem& item = cmdItems.at(i).value(); \ - info += "[" + QString::number(item.mCmdId) + "," + QString::number(item.mEnabled) + "," + "]"; \ - } \ - val = devData.at( Btuim::DevDataIndexCmdList ); \ - info += " cmds:"; \ - cmdItems = val.value( Btuim::DevDataCmdItemsRole ).toList(); \ - for ( int i = 0; i < cmdItems.count(); i++ ) { \ - const Btuim::DevDataCmdItem& item = cmdItems.at(i).value(); \ - info += "[" + QString::number(item.mCmdId) + "," + QString::number(item.mEnabled) + "," + "]"; \ - } \ - TPtrC textPtr(reinterpret_cast(info.utf16()), info.length() ); \ - BOstraceExt1( groupName, traceName, "%S", &textPtr ); \ -} -#else - -#define BtTraceQString1( aGroupName, aTraceName, aTraceText, aParam ) -#define BtTraceQString0( aGroupName, aTraceName, aParam ) -#define BtTraceDevListEntry0( groupName, traceName, dev ) -#define BtTraceDevListEntry1( groupName, traceName, traceText, dev ) -#define BtTraceQStringList1( groupName, traceName, traceText, list ) -#define BtTraceQStringList0( groupName, traceName, list ) -#define BtTraceDevDataEntry0( groupName, traceName, devData ) -#endif // BLUETOOTHTRACE_ENABLED - -// At early development phase, we force assertion in release build to find out -// design and implementation issues. -//#ifndef QT_NO_DEBUG -#define BTUI_DEBUG -//#endif - -#if !defined(BTUI_ASSERT_X) -# ifdef BTUI_DEBUG -#define BTUI_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop()) -# else -# define BTUI_ASSERT_X(cond, where, what) qt_noop() -# endif -#endif - -#endif // BLUETOOTHUITRACE_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btdevicemodel.h --- a/bluetoothengine/btui/inc/btdevicemodel.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +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 BTDEVICEMODEL_H -#define BTDEVICEMODEL_H - -#include -#include -#include -#include - -class BtDeviceModelPrivate; - -/*! - \class BtDeviceModel - \brief The data model provided to Bluetooth UIs in QT - - BtDeviceModel provides APIs for accessing the data of remote devices. - In addition, signals from this - model are provided for being informed of data update. - - This model is in one dimension (n rows * 1 columns), i.e., - - row 0 ( a remote device) - row 1 ( another device) - ... - - The data in this model is non-modifiable from the user interface (except device - search may add a number of in-range devices temporarily) , - determined by the characteristics of Bluetooth, the underline BT software - services and the BT application requirements. - - Whenever feasible, the detailed description should contain a simple - example code example: - \code - // ... - \endcode - - \sa \link model-view-programming.html Model/View Programming\endlink - */ - -class BTUIMODEL_IMEXPORT BtDeviceModel : public QAbstractItemModel -{ - Q_OBJECT - Q_ENUMS( DevDataRole DevMajorProperty AVDevMinorProperty PeripheralMinorProperty ) - -public: - - // the roles for catogerizing Bluetooth device properties - enum DevDataRole { - NameAliasRole = Qt::DisplayRole, // QVariant::String, the name showing in UI - ReadableBdaddrRole = Qt::UserRole, // QString, the readable format of a BD_ADDR (BT Device address) - LastUsedTimeRole, // QDateTime - RssiRole, // QVariant::Int - MajorPropertyRole, // QVariant::Int, bits of DevMajorProperty - MinorPropertyRole, // QVariant::Int, bits of DevMinorProperty - CoDRole, // QVariant::Int, the value of Class of Device - SeqNumRole // sequence number indicating order in which device was found - }; - -public: - - explicit BtDeviceModel( QObject *parent = 0 ); - - explicit BtDeviceModel( const BtDeviceModel &model, QObject *parent = 0 ); - - virtual ~BtDeviceModel(); - - bool searchDevice(); - - void cancelSearchDevice(); - - void removeTransientDevices(); - - // from QAbstractItemModel - virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; - - virtual QModelIndex parent( const QModelIndex &child ) const; - - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - - virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; - - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - - virtual QMap itemData( const QModelIndex & index ) const; - -signals: - - void deviceSearchCompleted(int error); - -private slots: - - void deviceDataChanged( int row, void *parent ); - - void deviceDataChanged( int first, int last, void *parent ); - - void beginInsertDevices(int first, int last, void *parent); - void endInsertDevices(); - - void beginRemoveDevices(int first, int last, void *parent); - void endRemoveDevices(); - - void emitDeviceSearchCompleted( int error ); - -private: - - void connectModelSignals(); - -private: - QSharedPointer d; -}; - -#endif // BTUIMODEL_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btqtconstants.h --- a/bluetoothengine/btui/inc/btqtconstants.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +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 BTQTCONSTANTS_H -#define BTQTCONSTANTS_H - -#include -#include - - -// RSSI value range: -127dB ~ +20dB -const int RssiMinRange = -127; - -//const int RssiMaxRange = 20; // maybe useful in the future - -const int RssiMediumStrength = -75; - -const int RssiHighStrength = -46; - -const int RssiInvalid = RssiMinRange - 1; - -enum PowerStateQtValue { - BtPowerOff = 0, - BtPowerOn, - BtPowerUnknown // only for error situations -}; - -enum DisconnectOption { - ServiceLevel = 0, - PhysicalLink, - AllOngoingConnections, - DisconUnknown -}; - -enum VisibilityMode { - BtHidden = 0x10, // using a different number space than TBTVisibilityMode - BtVisible, - BtTemporary, - BtVisibilityUnknown -}; - -// used for mapping between UI row and VisibilityMode item -enum VisibilityModeUiRowMapping { - UiRowBtHidden = 0, - UiRowBtVisible, - UiRowBtTemporary, - UiRowBtUnknown -}; - - -inline VisibilityMode QtVisibilityMode(TBTVisibilityMode btEngMode) -{ - VisibilityMode mode; - switch(btEngMode) { - case EBTVisibilityModeHidden: - mode = BtHidden; - break; - case EBTVisibilityModeGeneral: - mode = BtVisible; - break; - case EBTVisibilityModeTemporary: - mode = BtTemporary; - break; - default: - mode = BtVisibilityUnknown; - } - return mode; -} - -inline TBTVisibilityMode BtEngVisibilityMode(VisibilityMode btQtMode) -{ - TBTVisibilityMode mode; - switch(btQtMode) { - case BtHidden: - mode = EBTVisibilityModeHidden; - break; - case BtVisible: - mode = EBTVisibilityModeGeneral; - break; - case BtTemporary: - mode = EBTVisibilityModeTemporary; - break; - default: - mode = (TBTVisibilityMode)KErrUnknown; - } - return mode; -} - -inline PowerStateQtValue QtPowerMode(TBTPowerStateValue btEngMode) -{ - PowerStateQtValue mode; - switch(btEngMode) { - case EBTPowerOff: - mode = BtPowerOff; - break; - case EBTPowerOn: - mode = BtPowerOn; - break; - default: - mode = BtPowerUnknown; // error - } - return mode; -} - -inline TBTPowerStateValue BtEngPowerState(PowerStateQtValue qtPowerState) -{ - TBTPowerStateValue btEngPowerState; - switch (qtPowerState){ - case BtPowerOff: - btEngPowerState = EBTPowerOff; - break; - case BtPowerOn: - btEngPowerState = EBTPowerOn; - break; - default: - btEngPowerState = (TBTPowerStateValue)KErrUnknown; - } - return btEngPowerState; -} - -#endif // BTQTCONSTANTS_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btsettingmodel.h --- a/bluetoothengine/btui/inc/btsettingmodel.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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 BTSETTINGMODEL_H -#define BTSETTINGMODEL_H - -#include -#include -#include -#include - -class BtSettingModelPrivate; - -/*! - \class BtSettingModel - \brief The data model provided to Bluetooth UIs in QT - - BtSettingModel provides APIs for accessing BT local Bluetooth - settings. In addition, signals from this - model are provided for being informed of data update. - - This model is in one dimension (n rows * 1 column), i.e., - - row 0 (local device name) - row 1 (power state) - ... - - The data in this model is non-modifiable from the user interface, - determined by the characteristics of Bluetooth, the underline BT software - services and the BT application requirements. - */ - -class BTUIMODEL_IMEXPORT BtSettingModel : public QAbstractItemModel -{ - Q_OBJECT - Q_ENUMS( LocalSettingRowId LocalSettingDataRole ) - -public: - - //Q_DECLARE_FLAGS(Rows, BtSettingModelRow) - - /** - * child row identifiers of the local setting row - */ - enum LocalSettingRowId { - LocalBtNameRow = 0, - PowerStateRow , - VisibilityRow, - SimAccessProfileRow, - AllowedInOfflineRow, - LocalSettingRowCount, - }; - //Q_DECLARE_FLAGS(BtSettingModelLocalSettings, BtSettingModelLocalSettingColumn) - - /** - * Data roles of the items in the local setting row - */ - enum LocalSettingDataRole { - SettingNameRole = Qt::WhatsThisRole, - settingDisplayRole = Qt::DisplayRole, - SettingValueRole = Qt::EditRole, - SettingValueParamRole = Qt::UserRole + 1, // e.g., temp visibility time - }; - -public: - - explicit BtSettingModel( QObject *parent = 0 ); - - explicit BtSettingModel( const BtSettingModel &model, QObject *parent = 0 ); - - virtual ~BtSettingModel(); - - // from QAbstractItemModel - virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; - - virtual QModelIndex parent( const QModelIndex &child ) const; - - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - - virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; - - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - - virtual QMap itemData( const QModelIndex & index ) const; - -private slots: - - void settingDataChanged( int row, void *parent ); - - void settingDataChanged( int first, int last, void *parent ); - -private: - - void connectModelSignals(); - -private: - QSharedPointer d; - -}; - -#endif diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/btui.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,69 @@ +/* +* 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 header file contains global declarations and methods +* which are visible to all BTUI classes. +* +*/ + +#ifndef BTUI_H +#define BTUI_H + +#include // For RDebug and Panic +#include + +const TUid KBtuiUid3 = { 0x10005951 }; //Application UID for help context + +//Ecom implementation UID of GS interface plugin +const TUid KGsBtuiPluginUid = { 0x1020742B }; + +//Ecom implementation UID of BTUI interface plugin +const TUid KBtuiPluginUidMainView = { 0x1020745C }; // Ecom interface implementation UID +const TUid KBtuiPluginUidPairedDevicesView = { 0x1020745D }; // Ecom interface implementation UID +const TUid KBtuiPluginUidBlockedDevicesView = {0x20002780 }; // Ecom interface implementation UID + + +_LIT( KBTUIAppName, "BTUI" ); // The application name + +// Literals for bitmap files ( drive, directory, filename(s) ) +_LIT(KBitmapFileDrive,"z:"); +// KDC_APP_BITMAP_DIR == from data_caging_path_literals.hrh + + +_LIT( KGSBtuiPluginResourceFileName, "z:BtuiViewResources.rsc" ); + +_LIT(KBtuiBmpFileName,"btui.mbm"); + +_LIT(KFileDrive,"z:"); +_LIT(KResourceFileName, "BtuiViewResources.rsc"); + + +enum TBTPanics { + EBTMainListNotEmpty = 10000, + EBTAllFormatStingsArrayNotEmpty, + EBTFormatStingsArrayNotEmpty, + EBTPairedDevicesListNotEmpty, + EBTPanicClassMemberVariableNotNull, + EBTPanicClassMemberVariableIsNull, + EBTPanicIllegalValue, + EBTPanicDevManQueueIsCorrupt, + EBTPanicDevManQueueIsInIllegalState, + EBTPanicTwoPairingAttemptsAtTheSameTime, + EBTPanicCommandComplettedToDiffrentDeviceThanStarted, + EBTPanicNullObserver +}; + +// MACROS +//#define PANIC(aPanic) User::Panic(KBTUIAppName,aPanic) + +#endif // BTUI_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btui.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/btui.hrh Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,119 @@ +/* +* 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 file contains declarations for resources of BTUI. +* +*/ + + + + +#ifndef BTUI_HRH +#define BTUI_HRH + +enum TBTUIMenuCommands + { + EBTUICmdUndefined = 0, + EBTUICmdChangePowerStateMenu, + EBTUICmdChangePowerStateSelect, + EBTUICmdChangeVisibilityMenu, + EBTUICmdChangeVisibilitySelect, + EBTUICmdChangeBTNameMenu, + EBTUICmdChangeBTNameSelect, + EBTUICmdNewPairedDevice, + EBTUICmdDelete, + EBTUICmdDeleteAll, + EBTUICmdSetTrusted, + EBTUICmdSetUnTrusted, + EBTUICmdGiveNickname, + EBTUICmdConnect, + EBTUICmdConnectAudio, + EBTUICmdDisconnect, + EBTUICmdChangeSapStateMenu, + EBTUICmdChangeSapStateSelect, + EBTUICmdMSK, + EBTUICmdUnblock, + EBTUICmdUnblockAll, + EBTUIDeleteTabGroup, + EBTUICreateTabGroup, + EBTUICmdSetBlocked, + EBTUICmdSettings + }; + +enum TBTUITabViewId + { + EBTUIMainViewTab = 1, + EBTUIPairedDevicesViewTab, + EBTUIBlockedDevicesViewTab + }; + +enum TBTUINotes + { + EBTUIGeneralError = 100, + EBTUIPhoneVisibleToOthers, + EBTUIHiddenFromOthersNote, + EBTUINameAlreadyExists, + EBTUIInvalidLocalNameNote, + EBTUIDeviceSetAsUntrusted, + EBTUIWaitingForPairing, + EBTUIConnectingTo, + EBTUIDisconnectWired, + EBTUINotIncall, + EBTUIBtBusy, + EBTUIBtSapEnableNote + }; + +// This enum reflects the "r_bt_label_strings" in .rss file and must follow the same order. +// +enum TBTUIMainViewSettingFormatStrings + { + EBTUISettModulePowerOn, + EBTUISettModulePowerOff, + EBTUISettVisibilityModeGeneral, + EBTUISettVisibilityModeHidden, + EBTUISettVisibilityModeTemp, + + EBTUISettBTNameHeader, + EBTUISettSapEnabled, + EBTUISettSapDisabled + }; + +// Main list item indexes (see KNumberOfMainViewItems also) + +enum TBTMainListItemIndexes + { + EBTMainListItemPowerMode = 0, + EBTMainListItemVisibilityMode, + EBTMainListItemNameSetting, + EBTMainListItemSapMode, + + EBTMainListItemVisibilityTimeSetting + }; + +#ifdef __BT_SAP + #define KNumberOfMainViewItems 4 +#else + #define KNumberOfMainViewItems 3 +#endif + +// Maximum lengths of bluetooth device names +#define KBTUIMaxNameLength 30 // Series 60 local BT name +#define KBTUIMaxAliasLength 30 // Series 60 friendlyname/alias BT name +#define KBTUIMaxFormattedNameLength 270 // Localized header (icon indexes with tabs) + name + +#define btui_bitmap_file "Z:\\system\\data\\btui.mbm" +#define btui_bitmap_file_data_caging "Z:\\resource\\apps\\btui.mbm" + +#endif // BTUI + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btuidevtypemap.h --- a/bluetoothengine/btui/inc/btuidevtypemap.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +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 BTUIDEVTYPEMAP_H -#define BTUIDEVTYPEMAP_H - -#include -#include - -class BtuiDevProperty -{ -public: // type definitions: - /* - * Major device property values. - */ - enum DevMajorProperty { - NullProperty = 0x00000000, // device without any specific filter. - Bonded = 0x00000001, // device is in registry and bonded with phone - Blocked = 0x00000002, // device is in registry and blocked by user - RecentlyUsed = 0x00000004, // device is in registry and was used in last 30 days. - Trusted = 0x00000008, // device is in registry and authorized by user. - InRegistry = 0x00000010, // device exists in registry. - - Connected = 0x00000020, // device is currently connected to one or more - // services managed by Bluetooth Engine. - Connectable = 0x00000040, // device is connectable to one or more - // services managed by Bluetooth Engine. - InRange = 0x00000100, // device is in range - - // bits re-defined according to Class of Device: - Computer = 0x00010000, // a computer - Phone = 0x00020000, // a phone - LANAccessDev = 0x00040000, // a LAN access point - AVDev = 0x00080000, // an A/V device - Peripheral = 0x00100000, // a peripheral (input device) - ImagingDev = 0x00200000, // an imaging device - WearableDev = 0x00400000, // a wearable device - Toy = 0x00800000, // a toy - HealthDev = 0x01000000, // a health device - UncategorizedDev = 0x02000000, // a generic device that is uncategorized - - // all properties derived from BT registry - RegistryProperties = Bonded | - Blocked | RecentlyUsed | Trusted | InRegistry, - - // all properties derived from CoD - CodProperties = Computer | Phone | LANAccessDev | - AVDev | Peripheral | ImagingDev | WearableDev | - Toy | HealthDev | UncategorizedDev, - }; - - /* - * Minor device filters for major property \code AVDev \endcode - */ - enum AVDevMinorProperty { - Carkit = 0x00000001, - Headset = 0x00000002, - }; - - /* - * Minor device filters for major property \code Peripheral \endcode - */ - enum PeripheralMinorProperty { - Mouse = 0x00000001, - Keyboard = 0x00000002, - }; - -public: - static void mapDeiveType(int &majorProperty, int &minorProperty, int cod ); - -}; - - -class DevTypeMapping -{ -public: - int majorDevClass; // major device class value from CoD - int minorDevClass; // minor device class value from CoD - int majorProperty; // one of major properties defined in BtDeviceModel - int minorProperty; // one of minor properties defined in BtDeviceModel -}; - -// mapping table from major and minor Device Classes to device types -// which are specifically defined in Bluetooth ui namespace. -// (Note audio device mapping is not in this table due to its complex logic) -static const DevTypeMapping DeviceTypeMappingTable[] = -{ -{EMajorDeviceComputer, 0, BtuiDevProperty::Computer, 0 }, -{EMajorDevicePhone, 0, BtuiDevProperty::Phone, 0 }, -{EMajorDeviceLanAccessPoint, 0, BtuiDevProperty::LANAccessDev, 0}, -{EMajorDevicePeripheral, EMinorDevicePeripheralKeyboard, - BtuiDevProperty::Peripheral, - BtuiDevProperty::Keyboard}, -{EMajorDevicePeripheral, EMinorDevicePeripheralPointer, - BtuiDevProperty::Peripheral, - BtuiDevProperty::Mouse}, -{EMajorDeviceImaging, 0, BtuiDevProperty::ImagingDev, 0}, -{EMajorDeviceWearable, 0, BtuiDevProperty::WearableDev, 0}, -{EMajorDeviceToy, 0, BtuiDevProperty::Toy, 0} -}; - -static const int DeviceTypeMappingTableSize = - sizeof( DeviceTypeMappingTable ) / sizeof( DevTypeMapping ); - -inline void BtuiDevProperty::mapDeiveType( - int &majorProperty, int &minorProperty, int cod ) -{ - // remove garbage value. - majorProperty = 0; - minorProperty = 0; - TBTDeviceClass codClass = TBTDeviceClass( cod ); - - // device type must be mapped according to CoD: - int majorServiceCls = codClass.MajorServiceClass(); - int majorDevCls = codClass.MajorDeviceClass(); - int minorDevCls = codClass.MinorDeviceClass(); - - int i; - for (i = 0; i < DeviceTypeMappingTableSize; ++i ) { - if ( DeviceTypeMappingTable[i].majorDevClass == majorDevCls && - ( DeviceTypeMappingTable[i].minorDevClass == 0 || - DeviceTypeMappingTable[i].minorDevClass == minorDevCls ) ) { - // device classes match a item in table, get the mapping: - majorProperty |= DeviceTypeMappingTable[i].majorProperty; - minorProperty |= DeviceTypeMappingTable[i].minorProperty; - break; - } - } - - // AV device mapping are not defined in the table, - // do mapping here if no device type has been mapped so far. - // This part is not reliably working with all AV devices. - if ( i == DeviceTypeMappingTableSize) { - // audio device, carkit, headset or speaker: - if( ( majorDevCls == EMajorDeviceAV) - || (majorServiceCls == EMajorServiceRendering - && majorDevCls != EMajorDeviceImaging) ) { - majorProperty |= BtuiDevProperty::AVDev; - if( minorDevCls == EMinorDeviceAVCarAudio ) { - // carkit: - minorProperty |= BtuiDevProperty::Carkit; - } - else { - // headset: - minorProperty |= BtuiDevProperty::Headset; - } - } - } -} -#endif // BTUIDEVTYPEMAP_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btuiiconutil.h --- a/bluetoothengine/btui/inc/btuiiconutil.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +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 BTUIICONUTIL_H -#define BTUIICONUTIL_H - -#include -#include -#include -//#include "btdevicemodel.h" -#include "btuidevtypemap.h" - -enum BtuiIconCorner { - BtuiNoCorners = 0x00, // No badge needed - BtuiBottomLeft = 0x01, // Badge for : Paired, Paired & Authorized, Blocked - BtuiBottomRight = 0x02, // Badge for : Connected - BtuiTopLeft = 0x04, // Badge for : Signal strength - BtuiTopRight = 0x08 // Badge for : Battery low -}; - -/*! - Creates a HbIcon according to the type of the CBTDevice dev, - Creates badges in the icon's 4 corners according to the parameters - passed to the function - bottom left corner: Paired, Paired & Authorized, Blocked - bottom right corner: Connected - top right corner: Battery low - top left corner: signal strength -*/ - -inline void setBadging(HbIcon &deviceIcon, int majorProperty, int corners) -{ - if (corners & BtuiBottomLeft) { - if (majorProperty & BtuiDevProperty::Trusted ) { - HbIcon badge("qtg_small_authorised"); - badge.setIconName("qtg_small_authorised"); - deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); - } - else if (majorProperty & BtuiDevProperty::Bonded) { - HbIcon badge("qtg_small_pair"); - badge.setIconName("qtg_small_pair"); - deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); - } - else if (majorProperty & BtuiDevProperty::Blocked) { - HbIcon badge("qtg_small_blocked"); - badge.setIconName("qtg_small_blocked"); - deviceIcon.addBadge(Qt::AlignLeft|Qt::AlignBottom, badge); - } - } - if (corners & BtuiBottomRight) { - if (majorProperty & BtuiDevProperty::Connected) { - HbIcon badge("qtg_small_connection"); - badge.setIconName("qtg_small_connection"); - deviceIcon.addBadge(Qt::AlignRight|Qt::AlignBottom, badge); - } - } - if (corners & BtuiTopRight) { - //ToDo: when power level added to model - } - if (corners & BtuiTopLeft) { - //ToDo: add signal strength. - } -} - - -/*! - * builds device icon based on device type, including badging with connection info, etc. - * - * \param cod the integer value of the CoD. - * \param majorProperty the major property consisting of BtuiDevProperty::DevMajorProperty bits - * \param corners specifies which corners of primary icon - * should be badged with connectivity, pairing, trust, etc information - * \return an HbIcon - * - */ -inline HbIcon getBadgedDeviceTypeIcon(int cod, int majorProperty = 0, int corners = BtuiNoCorners) -{ - int uiMajorDevice; - int uiMinorDevice; - // device type is mapped according to CoD: - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - - // Set icon according to the device category - QString name; - if (uiMajorDevice & BtuiDevProperty::Phone) { - name = QString("qtg_large_mobile"); - } - else if (uiMajorDevice & BtuiDevProperty::Computer) { - name = QString("qtg_large_computer"); - } - else if (uiMajorDevice & BtuiDevProperty::AVDev) { - name = QString("qtg_large_generic_audio"); - } - else if (uiMajorDevice & BtuiDevProperty::Peripheral) { - // todo: map to keyboard & mouse from uiMinorDevice - name = QString("qtg_large_input_device"); - } - else { - name = QString("qtg_large_generic_bluetooth"); - } - HbIcon icon(name); - if (corners > BtuiNoCorners) { - setBadging(icon, majorProperty, corners); - } - return icon; -} - -/* - * returns device type as a translated string based on - * Class of Device (CoD) parameter - */ -inline QString getDeviceTypeString( int cod ) -{ - int uiMajorDevice; - int uiMinorDevice; - // device type is mapped according to CoD: - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - - // Set icon according to the device category - if (uiMajorDevice & BtuiDevProperty::Phone) { - return hbTrId("txt_bt_list_phone"); - } - else if (uiMajorDevice & BtuiDevProperty::Computer) { - return hbTrId("txt_bt_list_computer"); - } - else if (uiMajorDevice & BtuiDevProperty::AVDev) { - return hbTrId("txt_bt_list_audio_device"); - } - else if (uiMajorDevice & BtuiDevProperty::Peripheral) { - // todo: map to keyboard & mouse - return hbTrId("txt_bt_list_input_device"); - } - else { - return hbTrId("txt_bt_list_other"); - } -} - -#endif // BTUIMODELUTIL_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btuimodelsortfilter.h --- a/bluetoothengine/btui/inc/btuimodelsortfilter.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 BTUIMODELSORTFILTER_H -#define BTUIMODELSORTFILTER_H - -#include -#include - -/*! - \class BtuiModelSortFilter - \brief the class handling sorting and filtering Bluetooth devices. - - BtuiModelSortFilter handles filtering/sorting a list of Bluetooth devices. - - \\sa bluetoothuimodel - */ -class BTUIMODEL_IMEXPORT BtuiModelSortFilter : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - - // matching mechanism applied for filters defined in Btuim::DeviceListFilter - enum FilterMode { - ExactMatch, // The filter value of the device must equal to the specified filters - AtLeastMatch, // The filter value of the device must contains - // all the specified filters at least. - RoughMatch, // match at least one of the specified filters - Exclusive, // not match any of the specified filters - }; - - explicit BtuiModelSortFilter( QObject *parent = 0 ); - virtual ~BtuiModelSortFilter(); - - void setDeviceMajorFilter( int filter, FilterMode mode ); - void addDeviceMajorFilter( int filter, FilterMode mode ); - void clearDeviceMajorFilter( int filter, FilterMode mode ); - void clearDeviceMajorFilters(); - - bool hasFilter( int filter, FilterMode mode ); - -signals: - void deviceAcceptedByFilter(int sourceRow); - -protected: - - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const; - -private: - class FilterItem { - public: - int mFilter; - FilterMode mMode; - FilterItem(int filter, FilterMode mode ) { - mFilter = filter; mMode = mode; - } - bool operator== ( const FilterItem & other ) const { - return mFilter == other.mFilter && mMode == other.mMode; - } - }; - -private: - QList mFilters; -}; - -#endif // BTUIMODELSORTFILTER_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btuimodeltypes.h --- a/bluetoothengine/btui/inc/btuimodeltypes.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +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 BTUIMODELTYPES_H -#define BTUIMODELTYPES_H - -#include -#include -#include -#include - -// A data item in this model DLL. For example, power state item consists -// of the information regarding the current Bluetooth power state. -typedef QMap< int, QVariant > BtuiModelDataItem; - -// A category of the model data for specific group -typedef QList< BtuiModelDataItem > BtuiModelDataSource; - -Q_DECLARE_METATYPE(BtuiModelDataItem) -Q_DECLARE_METATYPE(BtuiModelDataSource) - -#ifdef BUILD_BTUIMODEL -#define BTUIMODEL_IMEXPORT Q_DECL_EXPORT -#else -#define BTUIMODEL_IMEXPORT Q_DECL_IMPORT -#endif - - -#endif // BTUIMODELTYPES_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/btuiutil.h --- a/bluetoothengine/btui/inc/btuiutil.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +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 BTUIUTIL_H -#define BTUIUTIL_H - -#include -#include - -/*! - Converts a QString which contains a BT device address in readable format to - Symbian native TBTDevAddr type. - */ -inline void addrReadbleStringToSymbian( const QString &readable, TBTDevAddr &addr) -{ - TBuf buffer(readable.utf16()); - addr.SetReadable( buffer ); -} - -/*! - Converts a Symbian native TBTDevAddr to - QString which contains the BT device address in readable format. - */ -inline void addrSymbianToReadbleString( QString &readable, const TBTDevAddr &addr) -{ - TBuf buffer; - addr.GetReadable( buffer ); - readable = QString::fromUtf16( buffer.Ptr(), buffer.Length() ); -} - -/*! - Decide the device name to display from the device information, and - converts the name if necessary. If the device doesn't have a valid name, - the given default name will be used. -*/ -inline void getDeviceDisplayName( QString& dispName, const CBTDevice& device , - const TDesC& defaultName ) -{ - // friendly name is preferred if available - if( device.IsValidFriendlyName() && device.FriendlyName().Length()){ - dispName = QString::fromUtf16( - device.FriendlyName().Ptr(), device.FriendlyName().Length() ); - } - // next preferred is actual device name - else if( device.IsValidDeviceName() && device.DeviceName().Length() ) { - dispName = QString::fromUtf8( - (char*) device.DeviceName().Ptr(), device.DeviceName().Length() ); - } - else { - // finally, use default name if nothing else is available - dispName = QString::fromUtf16( - defaultName.Ptr(), defaultName.Length() ); - } -} - -/*! - Guess if the given Class of Device indicates an Audio/Video device (headset and carkit) - or not. - Computer device supporting audio is not considered as AV device. -*/ -inline bool isAVDevice( const TBTDeviceClass &cod ) -{ - int majorDevCls = cod.MajorDeviceClass(); - int minorDevCls = cod.MinorDeviceClass(); - return ( ( majorDevCls == EMajorDeviceAV ) - || ( cod.MajorServiceClass() == EMajorServiceRendering - && majorDevCls != EMajorDeviceImaging ) ); -} - -/*! - Guess if the given Class of Device indicates an input device (keyboard and mouse) - or not. -*/ -inline bool isHIDDevice( const TBTDeviceClass &cod ) -{ - int majorDevCls = cod.MajorDeviceClass(); - int minorDevCls = cod.MinorDeviceClass(); - return ( ( majorDevCls == EMajorDevicePeripheral ) && - ( minorDevCls == EMinorDevicePeripheralKeyboard || - minorDevCls == EMinorDevicePeripheralPointer ) ); -} - -/*! - Tells if the given device is bonded. -*/ -inline bool isBonded( const CBTDevice &dev ) -{ - // todo: this has not addresses Just Works pairing mode yet. - return dev.IsValidPaired() && dev.IsPaired() && - dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable; -} - -/*! - Tells if the given device supports file transfer. -*/ -inline bool supportsFileTransfer( const TBTDeviceClass &cod ) -{ - int majorDevCls = cod.MajorDeviceClass(); - return ( majorDevCls == EMajorDevicePhone - || majorDevCls == EMajorDeviceComputer ); -} - -#endif // BTUIMODELUTIL_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/debug.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,184 @@ +/* +* 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 +#include +#include "debugconfig.h" + +#ifdef PRJ_ENABLE_TRACE + +#ifdef PRJ_FILE_TRACE +#include +#else +#include +#endif + +NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow + { +public: + void Overflow(TDes16& /*aDes*/) {} + }; + +NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow + { +public: + void Overflow(TDes8& /*aDes*/) {} + }; + +inline void Trace(TRefByValue 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::Leave(aReason); + } + +inline void DebugPrintBDAddr(const TBTDevAddr& aAddr) + { + TBuf<16> addrdes; + aAddr.GetReadable(addrdes); + Trace(_L("[BTENG]\t BD addr %S") , &addrdes); + } + +#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;} + +#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;} + +#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;} + +#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;} + +#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;} + +#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);} + +#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory) + +#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);} + +#define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeave(__FILE__, __LINE__, KErrGeneral);} + +#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} + +#define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} + +#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}} + +#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}} + +#define TRACE_STATIC_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}} + +#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}} + +#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}} + +#define TRACE_BDADDR( a ) { if( KTraceMask & KPRINTINFO ) DebugPrintBDAddr(a); } + +#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_IF_NULL(PTR) {static_cast(User::LeaveIfNull(PTR));} + +#define LEAVE(REASON) {static_cast(User::Leave(REASON));} + +#define TRACE_STATIC_FUNC_ENTRY + +#define TRACE_FUNC_ENTRY + +#define TRACE_FUNC_EXIT + +#define TRACE_STATIC_FUNC + +#define TRACE_FUNC + +#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;} + +#define TRACE_BDADDR( a ) + +#endif // PRJ_ENABLE_TRACE + +#endif // PRJ_LOGGING_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/debugconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/debugconfig.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: logging configure file. +* +*/ + + +#ifndef BTUI_DEBUGCONFIG_H +#define BTUI_DEBUGCONFIG_H + +#include "prjconfig.h" + +/** + * Custom logging variations. + */ +#ifdef PRJ_FILE_TRACE +_LIT(KLogFile,"btuilog.txt"); +_LIT(KLogDir,"BT"); +#endif + +#ifdef PRJ_ENABLE_TRACE +_LIT(KTracePrefix16, "[BTUI] "); +_LIT8(KTracePrefix8, "[BTUI] "); +_LIT8(KFuncFormat8, "><%S"); +_LIT8(KFuncThisFormat8, "><%S, [0x%08X]"); +_LIT8(KFuncEntryFormat8, ">%S"); +_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]"); +_LIT8(KFuncExitFormat8, "<%S"); + +_LIT(KPanicCategory, "BTUI"); +_LIT8(KPanicPrefix8, "PANIC code "); +_LIT8(KLeavePrefix8, "LEAVE code "); +#endif + +const TInt KMaxLogLineLength = 512; + +#define KPRINTERROR 0x00000001 // Tracing level: error +#define KPRINTINFO 0x00000002 // Tracing level: function trace +#define KPRINTSTATE 0x00000004 // Tracing level: state machine info +#define KPRINTWARNING 0x00000008 // Tracing level: warning + +const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING; + +#endif // BTUI_DEBUGCONFIG_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/prjconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/inc/prjconfig.h Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project configure file. +* +*/ + + +#ifndef BTUI_PRJCONFIG_H +#define BTUI_PRJCONFIG_H + +/** + * Traces are enabled in _DEBUG build, by default. + */ +#ifdef _DEBUG +#define PRJ_ENABLE_TRACE +#endif + +/** + * traces to file if this is defined. + */ +//#define PRJ_FILE_TRACE + + +/** + * build the project for module test purpose if this is defined + */ +//#define PRJ_MODULETEST_BUILD + +/** + * build the project using stubs to replace the dependencies if this is defined + */ +//#define PRJ_USE_STUB + + +#endif // BTUI_PRJCONFIG_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/inc/traceconfig.h --- a/bluetoothengine/btui/inc/traceconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +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 BLUETOOTHTRACECONFIG_H -#define BLUETOOTHTRACECONFIG_H - -/* -Sample usage: - void testTracing() - { - BOstrace0( TRACE_FATAL, TNAME_DEVLIST_1, "BOstrace0" ); - BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_2, "BOstrace1 %d", 123 ); - _LIT(String, "\"Symbian Descriptor\""); - TPtrC ptr(String); - TBuf<20> buf(ptr); - BOstraceExt1( TRACE_NORMAL, TNAME_DEVLIST_3, "BOstraceExt1 %S", &ptr); - BOstraceExt2( TRACE_API, TNAME_DEVLIST_4, "BOstraceExt2 %d %S", 456, &ptr ); - BOstraceExt3( TRACE_FLOW, TNAME_DEVLIST, "BOstraceExt3 0x%x %d %S", 128, 256, &ptr ); - BOstraceExt4( TRACE_DETAILED, TNAME_DEVL_5IST, "BOstraceExt4 0x%x %d %S %S", 128, 256, &ptr, &buf ); - BOstraceExt5( TRACE_DEBUG, TNAME_DEVLIST_6, "BOstraceExt5 0x%x %d %S %S, %b", 128, 256, &ptr, &buf, 512 ); - BOstraceFunctionEntry0( TNAME_DEVLIST_7 ); - BOstraceFunctionEntry1( TNAME_DEVLIST_8, 0x00abcdef ); - BOstraceFunctionEntryExt(TNAME_DEVLIST_9, 0xdeadbeef, 123 ); - BOstraceFunctionExit0( TNAME_DEVLIST_9 ); - BOstraceFunctionExit1( TNAME_DEVLIST_10, 0x00beebee ); - BOstraceFunctionExitExt(TNAME_DEVLIST_11, 0x00badbed, -1); - BOstraceEventStart0( TNAME_DEVLIST_12, "BOstraceEventStart0" ); - BOstraceEventStart1( TNAME_DEVLIST_13, "BOstraceEventStart1", 789 ); - BOstraceEventStop( TNAME_DEVLIST_14, "BOstraceEventStop" ); - BOstraceState0( TNAME_DEVLIST_15, "connection state", 1 ); - BOstraceState1( TNAME_DEVLIST_16, "audio state", 2, 0xdeadbeef ); - BtTraceBlock( - for (int i = 0; i < 5; ++i) { - BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_, "BtTraceBlock counter(1-5): %d", i+1 ); - }); - QString str("\"Qt String\""); - BtTraceQString0( TRACE_NORMAL, TNAME_DEVLIST_17, str); - BtTraceQString1( TRACE_NORMAL, TNAME_DEVLIST_18, "additioanl text;", str); - TBTDevAddr addr; - addr.SetReadable(_L("0060576ff376")); - BtTraceBtAddr0( TRACE_NORMAL, TNAME_DEVLIST_19, addr ); - BtTraceBtAddr1( TRACE_NORMAL, TNAME_DEVLIST_20, "additional trace;", addr ); - } - - */ - -// At early development phase, tracing is activated -//#ifdef _DEBUG -#define BLUETOOTHTRACE_ENABLED -//#endif //_DEBUG - -/* - * Tracing media configuration - */ -#ifdef BLUETOOTHTRACE_ENABLED - #ifdef __WINS__ - #define BLUETOOTHTRACE_MEDIA_FILE - #else - // RDEBUG is used for tracing output before we migrate to OST tracing. - #define BLUETOOTHTRACE_MEDIA_RDEBUG - //#define BLUETOOTHTRACE_MEDIA_OST - #endif // __WINS__ -#endif //BLUETOOTHTRACE_ENABLED - -/* - * Configuration of tracing to file - */ -#ifdef BLUETOOTHTRACE_MEDIA_FILE - -_LIT( KLogFile, "btuiqt.txt" ); -_LIT( KLogDir, "bt" ); - -#endif //BLUETOOTHTRACE_MEDIA_FILE - -/* - * Configuration of tracing using RDebug - */ -#ifdef BLUETOOTHTRACE_MEDIA_RDEBUG - -#endif //BLUETOOTHTRACE_MEDIA_RDEBUG - -/* - * Configuration of tracing using OST - */ -#ifndef BLUETOOTHTRACE_MEDIA_OST - -/** - * Group-mapping aligning with OST groups. - * The purpose of using groups is to ease migrating tracing from legacy logging to OST. - */ -#define TRACE_FATAL "[FATAL]" -#define TRACE_IMPORTANT "[IMPTT]" -#define TRACE_NORMAL "[NORML]" -#define TRACE_API "[ API ]" -#define TRACE_FLOW "[FLOW ]" -#define TRACE_STATE "[STATE]" -#define TRACE_DETAILED "[DETLD]" -#define TRACE_DEBUG "[DEBUG]" -#define TRACE_PERFORMANCE "[PFMAN]" - -/** - * Component Identifier to be written into traces: - */ -_LIT(KComponentName, "[BtUi]"); - -#endif //BLUETOOTHTRACE_MEDIA_OST - -#endif // BLUETOOTHTRACECONFIG_H diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/loc/btui.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/loc/btui.loc Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,528 @@ +/* +* 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 a localisation file for Bluetooth UI application. +* +*/ + + +// LOCALISATION STRINGS + +// Please note! Default class of device names are defined in "btnotif.loc". + + +// *** CAPTION STRINGS *** + +// d: BTUI application name on the application shell's app. list +// l: list_single_large_graphic_pane_t1 +// +#define qtn_apps_bluetooth_list "Bluetooth" + +// d: BTUI application name on the application shell's app. grid +// l: cell_app_pane_t1 +// +#define qtn_apps_bluetooth_grid "Bluetooth" + + +// *** TITLES *** + +// d: Status pane title for main view +// l: title_pane_t2/opt9 +// +#define qtn_bt_title_bluetooth "Bluetooth" + +// d: Status pane title for paired devices view +// l: title_pane_t2/opt9 +// +#define qtn_bt_title_paired_dev "Paired devices" + + +// *** MAIN VIEW SETTING ITEMS *** + +// d: The setting item title for bluetooth functionality (1st item) +// l: list_setting_pane_t1 +// +#define qtn_bt_sett_module "Bluetooth" + +// d: The setting item value when bluetooth functionality is enabled +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_sett_on "On" + +// d: The setting item value when bluetooth functionality is disabled +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_sett_off "Off" + +// d: The setting item title for phone's bluetooth visibility mode (2nd item) +// l: list_setting_pane_t1 +// +#define qtn_bt_sett_phone_visibility "My phone's visibility" + +// d: The setting item value visibility mode +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_det_sett_general "Shown to all" + +// d: The setting item value visibility mode +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_hidden "Hidden" + +// d: The setting item title for phones bluetooth name (3rd item) +// d: Also for the title of settings item editing window for phones bluetooth name +// l: list_setting_pane_t1 +// +#define qtn_bt_sett_bt_name "My bluetooth name" + +// d: The setting item title for SIM Access Profile (4th item) +// l: list_setting_pane_t1 +// +#define qtn_bt_sap "SIM Access Profile" + +// d: The setting item value when SIM Access Profile is enabled +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_sap_enabled "Enabled" + +// d: The setting item value when SIM Access profile is disabled +// l: list_set_graphic_pane_t1 +// +#define qtn_bt_sap_disabled "Disabled" + +// *** EMPTY LISTS *** + +// d: Empty list text when there are no paired devices +// l: main_list_empty_pane +// +#define qtn_bt_no_paired_devices "(no paired devices)" + + +// *** MENU POPUP OPTIONS *** + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_change_value "Change" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_new_paired_device "New paired device" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_give_nickname "Assign short name" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_set_as_trusted "Set as authorised" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_set_as_untrusted "Set as unauthorised" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_delete "Delete" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_delete_all "Delete all" + +// d: Command in options list, and this text should inform user that only an audio connection can be established with this command. +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_connect "Connect to audio" + +// d: Command in options list, and this text should inform user that connection can be established with this command. +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_gen_connect "Connect" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_disconnect "Disconnect" + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// +#define qtn_bt_settings "Settings" + + +// *** QUERIES *** + +// d: Confirmation query if the value Enabled is selected when Bluetooth is off +// l: popup_note_window +// +#define qtn_bt_sap_enable_info "Enabling SIM Access Profile connection Bluetooth must be on" + +// d: Data query when user has opened BTUI (for first time) and +// d: there is no local Bluetooth name defined yet (empty name). +// l: popup_query_data_window +// +#define qtn_enter_bt_name "My Bluetooth name:" + +// d: Confirmation query to disable bluetooth functionality while there is still connections active. +// l: popup_note_window +// +#define qtn_bt_switch_off_anyway "Active Bluetooth connection. Switch off anyway?" + +// d: Confirmation query when Bluetooth needs to be activated in off-line mode. +// l: popup_note_window +// +#define qtn_bt_activate_in_offline "Do you want to activate bluetooth in off-line mode?" + +// d: Confirmation query when bluetooth functionality is off and user action (connect) cannot be performed. +// l: popup_note_window +// +#define qtn_bt_is_off "Bluetooth is currently switched off.\nSwitch on?" + +// d: Confirmation query when user has requested to remove pairing for bluetooth device concerned. +// l: popup_note_window +// +#define qtn_bt_warn_erase "Delete pairing with: %U" + +// d: Confirmation query when user has requested to remove pairing with connected Bluetooth device. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_warn_erase_connected "Deleting this pairing will disconnect %U" + +// d: Confirmation query when user has requested to remove all pairings. +// l: popup_note_window +// +#define qtn_bt_warn_erase_all "Delete all pairings?" + +// d: Confirmation query when user has requested to remove all pairings and +// some ( or only one ) of the devices are connected. +// l: popup_note_window +// +#define qtn_bt_warn_erase_all_connected "Delete all pairings? Some devices may be disconnected." + +// d: Data query when user has requested to change local friendlyname/nickname for bluetooth device concerned. +// l: popup_query_data_window +// +#define qtn_bt_enter_nickname "Short name:" + +// d: Confirmation query when user has requested to change Bluetooth device security to trusted. +// l: popup_note_window +// +#define qtn_bt_conf_aut "Connections will take place automatically without confirmation. Continue?" + +// d: Confirmation query when disconnecting BT Accessory. +// l: popup_note_window +// +#define qtn_bt_disconn_from "Disconnect from: %U" + + +// *** NOTES *** + +// d: Information note after the phone's visibility has changed to general. +// l: popup_note_window +// +#define qtn_bt_phone_visib_to_oth "Phone is detectable by all other devices." + +// d: Information note after the phone's visibility has changed to hidden. +// l: popup_note_window +// +#define qtn_bt_hidden_from_others "Phone is not detectable in searches made by other devices" + +// d: Error note after user has changed the local friendlyname/nickname and it conflicts with existing one +// l: popup_note_window +// +#define qtn_bt_name_exists "Short name already in use" + +// d: Confirmation note when user has requested to change Bluetooth device security to untrusted. +// l: popup_note_window +// +#define qtn_bt_dev_set_as_untrust "Device set as unauthorised. Connection requests will require confirmation." + +// d: Error note for situations which are not defined in UI specs. and user interaction cannot be completed. +// l: popup_note_window +// +#define qtn_bt_general_error "Unable to perform Bluetooth operation" + +// d: Wait note after "New paired device" is executed from paired devices view. +// d: %U contains device name. +// l: popup_note_wait_window +// +#define qtn_bt_waiting "Waiting for response from %U" + + +// d: Information note for disconnecting wired accessory +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_disconnect_wired "Disconnect wired accessory" + +// d: Wait note during connection establishment. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_wait_connecting_to "Connecting to %U" + +// d: Information note telling there's already an active BTAA connection. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_disconnect_first "Disconnect %U first" + +// d: Information note telling there's already an active BTAA connection with call ongoing. +// l: popup_note_window +// +#define qtn_bt_not_incall "Not possible during a call" + +// d: Information note if there is maximum number of connections and new one can not be created. +// l: popup_note_window +// +#define qtn_bt_busy "Maximum amount of Bluetooth connections in use. Can't establish a new one." + +// d: An information note when Bluetooth needs to be activated and it's disallowed in off-line mode. +// l: popup_note_window +// +#define qtn_bt_offline_disabled "Bluetooth can't activated in off-line mode" + +// d: Information note telling there's already an active BTAA connection. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_disconnect_first_stereo "Disconnect %0U device and %1U device first" + +// *** GLOBAL NOTES *** + +// d: Global Information note telling audio is routed to BT handsfree. +// l: popup_note_window +// +#define qtn_bt_audio_accessory "Audio routed to BT handsfree" + +// d: Global Information note for successful connection establishment. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_conf_connected "Connected to %U" + +// d: Global Information note for successful connection close. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_conf_disconnected "Disconnected from %U" + +// d: Global Information note for unsuccessful connection establishment. +// d: Reason: The audio device does not support Hands-Free Profile. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_hfp_not_supported "Hands-Free Profile not supported by %U" + +// d: Global Information note for unsuccessful connection establishment. +// d: Reason: The audio device does not support Bluetooth Hands-Free nor Headset Profile. +// d: %U contains device name. +// l: popup_note_window +// +#define qtn_bt_device_not_supported "Unsupported device: %U" + + +// VISIBILITY MODE OPTION + +//d:The setting item value of visibility mode (option item in radio box) +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_bt_set_visibility_time "Set visibility time" + +//d:The setting item value of visibility mode (shows in listbox after visibility timeout set) +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_bt_temp_visible "Temporarily visible" + + +// VISIBLILITY TIME SETTING SLIDER + +//d:Text in slider control head label +//d:visibility time-out setting page +//l:list_setting_pane_t1 +//w: +//r:3.1 +// +#define qtn_bt_slider_visibility_time "Visibility time" + +//d:Text in slider control slider's current value label +//d:visibility time-out setting page +//d:Current value when it's 1 minute +//l:list_set_graphic_pane_t1 + +//w: +//r:3.1 +// +#define qtn_bt_slider_singular "%U minute" + +//d:Text in slider control slider's current value label +//d:visibility time-out setting page +//d:Current value when it's > 1 minute +//l:list_set_graphic_pane_t1 +//w: +//r:3.1 +// +#define qtn_bt_slider_plural "%U minutes" + +//d:Text in slider control +//d:visibility time-out setting page +//d:Minimum value +//l:setting_slider_pane_t2 + +//w: +//r:3.1 +// +#define qtn_bt_slider_min "1 min" + +//d:Text in slider control +//d:visibility time-out setting page +//d:Maximum value +//l:setting_slider_pane_t2 + +//w: +//r:3.1 +// +#define qtn_bt_slider_max "60 min" + +//Blocked device view + +// d: Command in options list +// l: list_single_pane_t1_cp2 +// w: +// r: 3.2 +#define qtn_bt_block "Block" + +// d: Status pane title for blocked devices view +// l: title_pane_t2/opt9 + +// w: +// r: 3.2 +#define qtn_bt_title_blocked_devices "Blocked devices" + +// d: query header of the message queries about blocked devices +// l: heading_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_block_device_header "Block device?" + +// d: text of dialog asking about blocking a paired devices. +// l: popup_info_list_pane_t1 +// w: +// r:3.2 +#define qtn_bt_block_paired_device "Do you want to block all future connection attempts from paired device ?U? \nThis will delete your pairing with the device." + + +// d: text of dialog asking about blocking a paired devices. +// l: popup_info_list_pane_t1 +// w: +// r:3.2 +#define qtn_bt_block_connected_paired_devices "Do you want to block all future connection attempts from paired device ?U?\n This will disconnect the device and delete your pairing with it." + +// d: the link key to help in blocking queries. +// l: popup_info_list_pane_t1 +// w: +// r: 3.2 +#define qtn_bt_block_device_link "More Info" + +// d: the query text about deleting one blocking. +// l: popup_note_window +// w: +// r: 3.2 +#define qtn_bt_warn_erase_blocked "Delete blocked device\n%U?" + +// d: the query text about deleting all blockings +// l: popup_note_window +// w: +// r: 3.2 +#define qtn_bt_warn_erase_all_blocked "Delete all blocked devices?" + +// d: Empty list text when there are no blocked devices +// l: main_list_empty_pane +// w: +// r: 3.2 +#define qtn_bt_no_blocked_devices "(no blocked devices)" + +// d: Empty list primary text when there are no blocked devices +// l: main_pane_empty_t1/opt2 +// w: +// r: 3.2 +#define qtn_bt_empty_blocked_view_primary_text "(no blocked devices)" + +// d: Empty list secondary text when there are no blocked devices +// l: main_list_empty_pane/opt2 +// w: +// r: 3.2 +#define qtn_bt_empty_blocked_view_sedondary_text "Block devices only if you wish to ever receive connections from them." + +// *** For General Setting Application *** + +// *** Caption for General Setting Application *** +// d: BTUI Setting caption +// l: list_double_large_graphic_pane_t1 +// w: +// r: 3.1 +#define qtn_set_folder_bluetooth "Bluetooth" + +// d: Secondary status information of BT power, discoverability and connection +// l: list_double_large_graphic_pane_t2 +// w: +// r:5.0 +#define qtn_cp_detail_bt_off "Switched off" + +// d: Secondary status information +// l: list_double_large_graphic_pane_t2 +// w: +// r:5.0 +#define qtn_cp_detail_bt_on_shown "Enabled, shown to all" + +// d: Secondary status information +// l: list_double_large_graphic_pane_t2 +// w: +// r:5.0 +#define qtn_cp_detail_bt_on_hidden "Enabled, hidden" + +// d: Secondary status information +// l: list_double_large_graphic_pane_t2 +// w: +// r:5.0 +#define qtn_cp_detail_bt_conn_shown "Connected, shown to all" + +// d: Secondary status information +// l: list_double_large_graphic_pane_t2 +// w: +// r:5.0 +#define qtn_cp_detail_bt_conn_hidden "Connected, hidden" + +// *** Error code handling for SSP PasskeyEntry mode *** +// d: Warning Note if the passcode entered on the remote device doesn't match the one given on the local device (Passkey Entry mode). +// l: popup_note_window +// r: 5.1 +#define qtn_bt_simple_incorrect_passcode "Incorrect passcode" + +// d: Query gives the user an option to enter a passcode again (Passkey Entry mode). +// l: popup_note_window +// r: 5.1 +#define qtn_bt_simple_passcode_retry "Try again?" + +// End of File diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/rom/BtuiResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/rom/BtuiResources.iby Wed Sep 01 12:20:04 2010 +0100 @@ -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 __BTUIRESOURCES_IBY__ +#define __BTUIRESOURCES_IBY__ + +#ifdef __BT +//Resource file(s) for BTUI application (BtUi.iby) +data=DATAZ_\APP_RESOURCE_DIR\BTUI.RSC APP_RESOURCE_DIR\Btui.rsc + +//View resource in Ecom plutin +data=DATAZ_\RESOURCE_FILES_DIR\BtuiViewResources.rsc RESOURCE_FILES_DIR\BtuiViewResources.rsc + +#endif //__BT +#endif //__BTUIRESOURCES_IBY__ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/rom/btui.iby --- a/bluetoothengine/btui/rom/btui.iby Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/btui/rom/btui.iby Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -11,23 +11,26 @@ * * Contributors: * -* Description: +* Description: * */ -#ifndef __BTCPPLUGIN_IBY__ -#define __BTCPPLUGIN_IBY__ +#ifndef __BTUI_IBY__ +#define __BTUI_IBY__ -#include -#include #ifdef __BT -file=ABI_DIR/BUILD_DIR/btuimodel.dll SHARED_LIB_DIR/btuimodel.dll -file=ABI_DIR/BUILD_DIR/btuidelegate.dll SHARED_LIB_DIR/btuidelegate.dll +// BTUI Application(EXE) +S60_APP_EXE(BtUi) +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,BtUi) +S60_APP_AIF_ICONS(BtUi) +S60_APP_AIF_RSC(BtUi) -file=ABI_DIR/BUILD_DIR/btcpplugin.dll SHARED_LIB_DIR/btcpplugin.dll -data=/epoc32/data/c/resource/qt/plugins/controlpanel/btcpplugin.qtplugin resource/qt/plugins/controlpanel/btcpplugin.qtplugin +// BTUI Model(DLL) +file=ABI_DIR\BUILD_DIR\btdevmodel.dll SHARED_LIB_DIR\btdevmodel.dll + +//ECOM plugin(Ecom DLL) +ECOM_PLUGIN( BtuiPlugin.dll, BtuiPlugin.rsc ) #endif //__BT -#endif // __BTCPPLUGIN_IBY__ - +#endif //__BTUI_IBY__ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/rom/btui_resources.iby --- a/bluetoothengine/btui/rom/btui_resources.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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 __BTCPPLUGIN_RESOURCES_IBY__ -#define __BTCPPLUGIN_RESOURCES_IBY__ - -#include -#include -#ifdef __BT - -//For localization resource -data=DATAZ_/QT_TRANSLATIONS_DIR/btviews.qm QT_TRANSLATIONS_DIR/btviews.qm -data=DATAZ_/QT_TRANSLATIONS_DIR/btdialogs.qm QT_TRANSLATIONS_DIR/btdialogs.qm -data=DATAZ_/QT_TRANSLATIONS_DIR/btindimenu.qm QT_TRANSLATIONS_DIR/btindimenu.qm - -#endif //__BT -#endif // __BTCPPLUGIN_RESOURCES_IBY__ diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/src/BTUIApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/src/BTUIApp.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,64 @@ +/* +* 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 is the implementation of application class. + * +*/ + + +// INCLUDE FILES + +#include "btui.h" // Global declarations +#include "BTUIApp.h" +#include "BTUIDocument.h" + +// --------------------------------------------------------- +// CBTUIApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid CBTUIApp::AppDllUid() const + { + return KBtuiUid3; + } + +// --------------------------------------------------------- +// CBTUIApp::CreateDocumentL() +// Creates CBTUIDocument object +// --------------------------------------------------------- +// +CApaDocument* CBTUIApp::CreateDocumentL() + { + return CBTUIDocument::NewL( *this ); + } + +#include + +// --------------------------------------------------------- +// NewApplication() +// --------------------------------------------------------- +LOCAL_C CApaApplication* NewApplication() + { + return new CBTUIApp; + } +// --------------------------------------------------------- +// E32Main() +// --------------------------------------------------------- +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + + + + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/src/BTUIAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/src/BTUIAppUi.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,214 @@ +/* +* 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 the care of opening and closing the views. + * +*/ + + +// INCLUDE FILES +#include "BTUIDocument.h" +#include +#include "BTUIAppUi.h" +#include +#include +#include "BtuiPluginInterface.h" +#include "btui.h" +#include "BTUIMainView.h" +#include "debug.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------------- +// CBTUIAppUi::ConstructL +// +// Symbian 2nd phase constructor can leave. +// Contains status pane, navi pane, tab group and view +// creations and setting the main view active. +// ---------------------------------------------------------- +// +void CBTUIAppUi::ConstructL() + { + TRACE_FUNC_ENTRY + + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible); + + // Show tabs for main views from resources + CEikStatusPane* sp = StatusPane(); + + // Fetch pointer to the default navi pane control + iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)); + + // Tabgroup has been read from resource and it were pushed to the navi pane. + // Get pointer to the navigation decorator and set this to be a MAknTabObserver + iDecoratedTabGroup = iNaviPane->ResourceDecorator(); + + if (iDecoratedTabGroup) + { + iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl(); + iTabGroup->SetObserver( this ); + } + + // ----------------------------------------------------------------------- + // Construct Views by calling ECOM interface CBtuiPluginInterface's + // factory function NewL(), which in turn will call instantiation funtion + // of the concrate class that implement this interface. + // ----------------------------------------------------------------------- + + // 1.Construct Mainview + // + CBtuiPluginInterface* mainView = CBtuiPluginInterface::NewL(KBtuiPluginUidMainView,(MBtuiPluginViewActivationObserver*) this ); + + CleanupStack::PushL( mainView ); + AddViewL( mainView ); // Transfer ownership to CAknViewAppUi + CleanupStack::Pop(mainView ); + + // 2.Construct OtherDeviceView + // + CBtuiPluginInterface* otherDeviceView = CBtuiPluginInterface::NewL( + KBtuiPluginUidPairedDevicesView, (MBtuiPluginViewActivationObserver*) this ); + + CleanupStack::PushL( otherDeviceView ); + AddViewL( otherDeviceView ); // Transfer ownership to CAknViewAppUi + CleanupStack::Pop(otherDeviceView ); + + // 3.Construct BlockDeviceView + // + CBtuiPluginInterface* blockDeviceView = CBtuiPluginInterface::NewL( + KBtuiPluginUidBlockedDevicesView , (MBtuiPluginViewActivationObserver*) this ); + + CleanupStack::PushL( blockDeviceView ); + AddViewL( blockDeviceView ); // Transfer ownership to CAknViewAppUi + CleanupStack::Pop(blockDeviceView ); + + //ActivateLocalViewL( mainView->Id() ); + TRACE_FUNC_EXIT + } + +// ---------------------------------------------------- +// CBTUIAppUi::~CBTUIAppUi +// ---------------------------------------------------- +// +CBTUIAppUi::~CBTUIAppUi() + { + TRACE_FUNC_ENTRY + if(iNaviPane != NULL && iDecoratedTabGroup != NULL) + { + + delete iDecoratedTabGroup; // Tabgroup was read from resource. + iDecoratedTabGroup=NULL; + } + + REComSession::FinalClose(); + + TRACE_FUNC_EXIT + } + + +// ------------------------------------------------------------------------------ +// CBTUIAppUi::DynInitMenuPaneL +// +// This function is called by the UIKON framework just before it displays +// a menu pane. Its default implementation is empty, and by overriding it, +// the application can set the state of menu items dynamically according +// to the state of application data. +// ------------------------------------------------------------------------------ +// +void CBTUIAppUi::DynInitMenuPaneL( TInt /* aResourceId */, CEikMenuPane* /* aMenuPane */ ) + { + } + +// ---------------------------------------------------- +// CBTUIAppUi::HandleKeyEventL +// ---------------------------------------------------- +// + +TKeyResponse CBTUIAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TRACE_FUNC + + iTabGroup = (CAknTabGroup*)iDecoratedTabGroup->DecoratedControl(); + + // Event will not be handled, if: + // 1.It is not a key event. + // 2.No tab group be created yet. + // 3.Device's BT name hasn't been initialized by user yet. + // + if (aType != EEventKey || !iTabGroup ) + { + return EKeyWasNotConsumed; + } + + return iTabGroup->OfferKeyEventL(aKeyEvent, aType); + } + +// ---------------------------------------------------- +// CBTUIAppUi::HandleCommandL +// +// Handle user commands. All commands are handled via +// this routine. +// ---------------------------------------------------- +// +void CBTUIAppUi::HandleCommandL(TInt aCommand) + { + TRACE_INFO((_L("command = %d"), aCommand )) + + switch ( aCommand ) + { + case EAknCmdExit: + case EEikCmdExit: + { + Exit(); + break; + } + default: + { + break; + } + } + } +// ---------------------------------------------------- +// CBTUIAppUi::PluginViewActivated +// ---------------------------------------------------- +// +void CBTUIAppUi::PluginViewActivated(TPluginViewId aViewId) + + { + TRACE_INFO((_L("view id = %d"), aViewId )) + if(iTabGroup->ActiveTabId()!=aViewId) + { + iTabGroup->SetActiveTabById(aViewId); + } + } + +// ---------------------------------------------------- +// CBTUIAppUi::TabChangedL +// ---------------------------------------------------- +// +void CBTUIAppUi::TabChangedL(TInt aIndex) + { + TRACE_FUNC + switch (aIndex) + { + case 0: + ActivateLocalViewL(KBtuiPluginUidMainView); + break; + case 1: + ActivateLocalViewL(KBtuiPluginUidPairedDevicesView); + break; + case 2: + ActivateLocalViewL(KBtuiPluginUidBlockedDevicesView); + break; + } + } + diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/btui/src/BTUIDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btui/src/BTUIDocument.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,68 @@ +/* +* 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 is the implementation of document class. + * +*/ + + +// INCLUDE FILES + +#include "BTUIDocument.h" +#include "debug.h" +#include "BTUIAppUi.h" + +// ================= MEMBER FUNCTIONS ======================= + +// ---------------------------------------------------- +// Destructor +// ---------------------------------------------------- +// +CBTUIDocument::~CBTUIDocument() + { + TRACE_FUNC + // delete iModel; + } + +// ---------------------------------------------------- +// Symbian OS default constructor can leave. +// ---------------------------------------------------- +// +void CBTUIDocument::ConstructL() + { + TRACE_FUNC + } + +// ---------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------- +// +CBTUIDocument* CBTUIDocument::NewL( CAknApplication& aApp ) // CBTUIApp reference + { + CBTUIDocument* self = new (ELeave) CBTUIDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self); + + return self; + } + +// ---------------------------------------------------- +// CBTUIDocument::CreateAppUiL() +// constructs CBTUIAppUi +// ---------------------------------------------------- +// +CEikAppUi* CBTUIDocument::CreateAppUiL() + { + return new (ELeave) CBTUIAppUi; + } diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/conf/TestFramework.ini --- a/bluetoothengine/conf/TestFramework.ini Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -# -# 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= 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 - -[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= c:\testframework\btserviceutiltest.cfg -TestCaseFile= c:\testframework\btnotifwrappertest.cfg -TestCaseFile= c:\testframework\btnotifsrvtest.cfg -#TestCaseFile= c:\testframework\btnotifclienttest.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 - -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b bluetoothengine/group/bld.inf --- a/bluetoothengine/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/bluetoothengine/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Build information file for project bluetoothengine +* Description: Build information file for project ?myapp * */ @@ -19,18 +19,15 @@ PRJ_PLATFORMS DEFAULT -// This is to break cyclic building dependency between these logical components. -// A better source structure will be implemented in future. -#include "../btnotif/btnotifclient/group/bld.inf" #include "../bteng/group/bld.inf" -#include "../btserviceutil/group/bld.inf" #include "../btnotif/group/bld.inf" #include "../btaudioman/group/bld.inf" #include "../btmac/group/bld.inf" #include "../btsac/group/bld.inf" #include "../btaudiostreamer/group/bld.inf" #include "../btsap/group/bld.inf" +#include "../btui/group/bld.inf" #include "../btpbap/group/bld.inf" #include "../bthid/group/bld.inf" #include "../btctrldcmoadapter/group/bld.inf" @@ -44,8 +41,3 @@ PRJ_TESTMMPFILES PRJ_TESTEXPORTS -../conf/testframework.ini /epoc32/WINSCW/C/TestFramework/testframework.ini -../btserviceutil/tsrc/btserviceutiltest/conf/btserviceutiltest.cfg /epoc32/winscw/c/TestFramework/btserviceutiltest.cfg -../btnotif/btnotifclient/tsrc/btnotifclienttest/conf/btnotifclienttest.cfg /epoc32/WINSCW/C/TestFramework/btnotifclienttest.cfg -../btnotif/btnotifwrapper/tsrc/btnotifwrappertest/conf/btnotifwrappertest.cfg /epoc32/WINSCW/C/TestFramework/btnotifwrappertest.cfg -../btnotif/btnotifsrv/tsrc/btnotifsrvtest/conf/btnotifsrvtest.cfg /epoc32/WINSCW/C/TestFramework/btnotifsrvtest.cfg diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/group/bld.inf --- a/btobexprofiles/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/inc/BTServiceParameterList.h --- a/btobexprofiles/inc/BTServiceParameterList.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/inc/btserviceapi.h --- a/btobexprofiles/inc/btserviceapi.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/inc/obexutilsdialog.h --- a/btobexprofiles/inc/obexutilsdialog.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +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 COBEXUTILSDIALOG_H -#define COBEXUTILSDIALOG_H - -#include - -#include -#include -#include -#include - -class CObexUtilsDialogTimer; - -enum TButtonId - { - ECancelButton = -1, - EYesButton, - ENoButton - }; -/** -* 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 - * todo check whether the parameter is required - * @param aButtonId The button that was used to dismiss the dialog. - */ - virtual void DialogDismissed(TInt aButtonId) = 0; //TInt aButtonId - }; - - -// CLASS DECLARATION - -/** -* A class for launching and managing dialogs. -*/ -NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, - public MHbDeviceProgressDialogObserver, - public MHbDeviceDialogObserver, - public MHbDeviceMessageBoxObserver - { - 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. - * @param aObserverPtr A pointer to progress observer. A NULL pointer if - the progress dialog is updated manually. - * @param aFileCount Total number of files to be sent. - * @param aDeviceName Device Name to which files to be sent. - * @param aTimeoutValue A value telling how often should the dialog be - updated. Relevant only if observer is given. - */ - IMPORT_C void LaunchProgressDialogL( - MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, - const TDesC& aDeviceName, TInt aTimeoutValue ); - - /** - * Updates the progress dialog with new file information when multiples files are sent. - * @param aFileSize Size of the file to be sent - * @param aFileIndex Index of the file to be sent - * @param aFileName Name of the file to be sent. - */ - IMPORT_C void UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ); - - /** - * Launches a wait dialog. - * @param aDisplayText Text that needs to be displayed. - */ - IMPORT_C void LaunchWaitDialogL( const TDesC& aDisplayText ); - - /** - * Cancels a wait dialog if one exists. - * @since 2.6 - * @return None. - */ - IMPORT_C void CancelWaitDialog(); - - /** - * Cancels a wait progress dialog if one exists. - * @since 2.6 - * @return None. - */ - IMPORT_C void CancelProgressDialog(); - - /** - * Updates a progress dialog with the latest progress value - * @param aValue A progress value relative to final value. - * @return None - */ - IMPORT_C void UpdateProgressDialogL( TInt aProgressValue ); - - /** - * Show a query note - * @param aConfirmText text for the note. - * @return None - */ - IMPORT_C void LaunchQueryDialogL( const TDesC& aConfirmText ); - - /** - * Shows an error note. - * @param aTextId A resource id for the note. - * @return None. - */ - IMPORT_C void ShowErrorNoteL( const TDesC& aErrorText ); - - /** - * Shows an information note. - * @param aTextId A resource id for the note. - * @return None. - */ - IMPORT_C void ShowInformationNoteL( const TDesC& aInfoText ); - - public: // New functions (not exported) - - /** - * Updates the progress dialog. - * @return None. - */ - void UpdateProgressDialog(); - - private: // Functions from base classes - - /** - * From MHbDeviceProgressDialogObserver called when dialog is closed by pressing the "cancel" button - * @param aDialog Pointer to dialog that was cancelled. - * @return None. - */ - void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog); - - /** - * From MHbDeviceProgressDialogObserver called when a device progress dialog is has closed - * @param aDialog Pointer to dialog instance that has closed. - * @return None. - */ - void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog ) ; - - /** - * From MHbDeviceDialogObserver called when data is received from a device dialog - * @param aDialog Pointer to dialog instance that has closed. - * @return None. - */ - void DataReceived(CHbSymbianVariantMap& aData); - - /** - * From MHbDeviceDialogObserver called when a device dialog is closed - * @param aData contains data from the dialog plugin. - * @return None. - */ - void DeviceDialogClosed(TInt aCompletionCode); - - /** - * from base class MHbDeviceMessageBoxObserver - * @param aMessageBox Pointer to dialog instance that has closed. - * @param aButton the id of the button the user pressed - */ - void MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, - CHbDeviceMessageBoxSymbian::TButtonId aButton); - - private: - - /** - * C++ default constructor. - */ - CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr ); - - /** - * By default Symbian OS constructor is private. - */ - void ConstructL(); - - /** - * Add a data item into the given CHbSymbianVariantMap. - * @param aMap the instance to which the data item will be added. - * @param aKey the key of the data item. - * @param aData the value of the data item - * @param aDataType the data-type of the data item - */ - void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, - const TAny* aData, CHbSymbianVariant::TType aDataType); - - /** - * Creates and shows a message box. - * @param aType the type of the message box to create. - * @param aText the text to be shown in the message box - * @param aObserver the observer that receives the events from the - * message box - * @param aTimeout the timeout value of the message box - */ - CHbDeviceMessageBoxSymbian* CreateAndShowMessageBoxL( - CHbDeviceMessageBoxSymbian::TType aType, - const TDesC& aText, - MHbDeviceMessageBoxObserver* aObserver, - TInt aTimeout ); - - private: // Data - - CHbDeviceDialogSymbian *iProgressDialog; - CHbDeviceProgressDialogSymbian* iWaitDialog; - CHbDeviceMessageBoxSymbian* iMessageBox; - - CObexUtilsDialogTimer* iObexDialogTimer; - TInt iFileIndex; - TInt iFileCount; - RBuf iDeviceName; - - // Not Owned - // - MObexUtilsProgressObserver* iProgressObserverPtr; - MObexUtilsDialogObserver* iDialogObserverPtr; - }; - -#endif // COBEXUTILSDIALOG_H - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/inc/obexutilspropertynotifier.h --- a/btobexprofiles/inc/obexutilspropertynotifier.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/data/101F8671.rss --- a/btobexprofiles/obexreceiveservices/bip/data/101F8671.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/eabi/MtmUiServerBipu.DEF --- a/btobexprofiles/obexreceiveservices/bip/eabi/MtmUiServerBipu.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z18NewMessageHandlerLv @ 1 NONAME - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/group/bld.inf --- a/btobexprofiles/obexreceiveservices/bip/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp --- a/btobexprofiles/obexreceiveservices/bip/group/obexservicebip.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* 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 -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets -SYSTEMINCLUDE /epoc32/include/platform/mw/btservices - -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 -LIBRARY HbCore.lib -LIBRARY HbWidgets.lib - -DEBUGLIBRARY flogger.lib // For logging - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/BIPCapabilityHandler.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPCapabilityHandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/BIPController.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPController.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* -* 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 "obexutilspropertynotifier.h" -#include "debug.h" -#include -#include -#include -#include "btengdevman.h" -#include -#include -#include - -// FORWARD DECLARATIONS - -class CBIPCapabilityHandler; -class CBIPImageHandler; - -/** -* Backup status. -* The value is controlled by FileManager -*/ -enum TFileManagerBkupStatusType - { - EFileManagerBkupStatusUnset = 0x00000000, - EFileManagerBkupStatusBackup = 0x00000001, - EFileManagerBkupStatusRestore = 0x00000002 - }; - -const TUid KUidMsgTypeBt = {0x10009ED5}; - -// CLASS DECLARATION - -/** -* The main controller for Basic Imaging Profile. -*/ -NONSHARABLE_CLASS (CBIPController): public CSrcsInterface, public MObexServerNotify, - public MObexUtilsPropertyNotifyHandler, - public MObexUtilsDialogObserver, - public MBTEngDevManObserver, - public MHbDeviceDialogObserver - { -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 MBTEngDevManObserver - void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); - -private: //from MObexUtilsDialogObserver - void DialogDismissed(TInt aButtonId); - -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 (iDialogActive); } - void UpdateReceivingIndicatorL(); - void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); - TInt GetDriveWithMaximumFreeSpaceL(); - TBool IsBackupRunning(); - TBool ProcessExists( const TSecureId& aSecureId ); - -private: - void DataReceived(CHbSymbianVariantMap& aData); - void DeviceDialogClosed(TInt aCompletionCode); - -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; - TBool iNoteDisplayed; - CBTEngDevMan* iDevMan; - CBTDeviceArray* iResultArray; - TBTDeviceName iRemoteDeviceName; - TFileName iReceivingFileName; - TFileName iCenRepFolder; - CObexUtilsDialog* iDialog; - CHbDeviceDialogSymbian* iProgressDialog; - TBool iDialogActive; - TInt iFileCount; - TBool iReceivingFailed; - CHbDeviceDialogSymbian* iRecvDoneDialog; - TBool iShowRecvCompleteDialog; - }; - -_LIT(KBipPanicCategory, "BIP"); -enum TBipPanicCode - { - EBipPanicNotBluetoothMediaType = 0, - }; - -#endif //_BIPCONTROLLER_H - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/BIPImageHandler.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPImageHandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h --- a/btobexprofiles/obexreceiveservices/bip/inc/BIPXMLWriter.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* 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 "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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/debug.h --- a/btobexprofiles/obexreceiveservices/bip/inc/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/debugconfig.h --- a/btobexprofiles/obexreceiveservices/bip/inc/debugconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/inc/prjconfig.h --- a/btobexprofiles/obexreceiveservices/bip/inc/prjconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/src/BIPCapabilityHandler.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPCapabilityHandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1101 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Obex Server image receiver module implementation -* -*/ - - -// INCLUDE FILES -#include "BIPController.h" -#include "BIPCapabilityHandler.h" -#include "BIPImageHandler.h" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" -#include -#include - -// CONSTANTS -_LIT8(KBipCapabilityType, "x-bt/img-capabilities\0"); -const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 -const TInt KBufferSize = 0x10000; // 64 kB -_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" ); -_LIT(KLocFileName, "btdialogs_"); -_LIT(KPath, "z:/resource/qt/translations/"); - - -// ================= 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); - iDialog = CObexUtilsDialog::NewL(this); - TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); - if (!ok) - { - User::Leave( KErrNotFound ); - } - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------- -// ~CBIPController() -// --------------------------------------------------------- -// -CBIPController::~CBIPController() - { - TRACE_FUNC_ENTRY - delete iGetObject; - delete iBIPCapabilityHandler; - delete iBIPImageHandler; - delete iLowMemoryActiveCDrive; - delete iLowMemoryActiveMMC; - delete iBuf; - delete iBTObject; - delete iDevMan; - if (iResultArray) - { - iResultArray->ResetAndDestroy(); - delete iResultArray; - } - iFs.Close(); - delete iDialog; - delete iProgressDialog; - delete iRecvDoneDialog; - 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 - iReceivingFailed = ETrue; - iShowRecvCompleteDialog = EFalse; - if( iBTTransferState == ETransferPut || (!aAbort && iBTTransferState == ETransferPutDiskError) ) - { - if(iBTObject) - { - iBTObject->Reset(); - } - CancelTransfer(); - - TRAP_IGNORE( - HBufC* note = HbTextResolverSymbian::LoadLC(_L("txt_bt_dpophead_receiving_failed")); - iDialog->ShowErrorNoteL(note->Des()); - CleanupStack::PopAndDestroy(note); - ); - } - 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 - iReceivingFailed = EFalse; - 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 - - (void) aRemoteInfo; - (void) aInfo; - - // 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 - (void) aInfo; - } - -// --------------------------------------------------------- -// TransportDownIndication() -// --------------------------------------------------------- -// -void CBIPController::TransportDownIndication() - { - TRACE_FUNC - if(!iReceivingFailed && iShowRecvCompleteDialog) - { - //Launch recevice completed dialog. - iRecvDoneDialog = CHbDeviceDialogSymbian::NewL(); - iRecvDoneDialog->SetObserver(this); - - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt dialogIdx = TBluetoothDialogParams::EReceiveDone; - CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), - CHbSymbianVariant::EInt ); - CleanupStack::PushL(dialogType); - TBuf16<6> dialogTypeKey; - dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); - User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); - CleanupStack::Pop(dialogType); - - CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(deviceName); - TBuf16<6> deviceNameKey; - deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); - User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); - CleanupStack::Pop(deviceName); - - CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(fileName); - TBuf16<6> fileNameKey; - fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); - User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); - CleanupStack::Pop(fileName); - - CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileSz); - TBuf16<6> fileSzKey; - fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); - User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); - CleanupStack::Pop(fileSz); - - CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileCnt); - TBuf16<6> fileCntKey; - fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount); - User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt)); - CleanupStack::Pop(fileCnt); - - iRecvDoneDialog->Show( KBTDevDialogId(), *variantMap, this ); - CleanupStack::PopAndDestroy(variantMap); - - iShowRecvCompleteDialog = EFalse; - } - - // Remove receiving buffer and files used during file receiving. - // - delete iBTObject; - iBTObject = NULL; - TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); - iFs.Close(); - iFileCount = 0; - } - -// --------------------------------------------------------- -// 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 ( 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)); - //todo: Need to use Localized string. - _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); - TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); - - 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()) - { - TRAPD(err, UpdateReceivingIndicatorL()); - if(err < KErrNone) - { - return err; - } - } - 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(); - iFileCount++; - iShowRecvCompleteDialog = ETrue; - } - 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. - (void) aPathInfo; - (void) aInfo; - - 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)); - //todo: Need to use Localized string. - _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); - TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); - - 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) - { - if(iReceivingFileName.Length() > 0) - { - iProgressDialog = CHbDeviceDialogSymbian::NewL(); - iProgressDialog->SetObserver(this); - - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt dialogIdx = TBluetoothDialogParams::EReceiveProgress; - CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), - CHbSymbianVariant::EInt ); - CleanupStack::PushL(dialogType); - TBuf16<6> dialogTypeKey; - dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); - User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); - CleanupStack::Pop(dialogType); - - CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(deviceName); - TBuf16<6> deviceNameKey; - deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); - User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); - CleanupStack::Pop(deviceName); - - CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(fileName); - TBuf16<6> fileNameKey; - fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); - User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); - CleanupStack::Pop(fileName); - - CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileSz); - TBuf16<6> fileSzKey; - fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); - User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); - CleanupStack::Pop(fileSz); - - CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileCnt); - TBuf16<6> fileCntKey; - fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount); - User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt)); - CleanupStack::Pop(fileCnt); - - iDialogActive = ETrue; - iProgressDialog->Show( KBTDevDialogId(), *variantMap, this ); - CleanupStack::PopAndDestroy(variantMap); - } - else - { - // TODO - iDialogActive = ETrue; - } - } - else - { - iDialogActive = ETrue; - /* - * TODO - The functionality provided by CGlobalDialog will be removed - * TODO - and this will be provided by CGlobalProgressDialog. - */ - - } - } - -void CBIPController::UpdateReceivingIndicatorL() - { - if(iProgressDialog) - { - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt bytesReceived = iBTObject->BytesReceived(); - CHbSymbianVariant* progress = CHbSymbianVariant::NewL( (TAny*) &bytesReceived, CHbSymbianVariant::EInt ); - CleanupStack::PushL(progress); - User::LeaveIfError(variantMap->Add(_L("progress"), progress)); - CleanupStack::Pop(progress); - - iProgressDialog->Update(*variantMap); - CleanupStack::PopAndDestroy(variantMap); - } - } - -void CBIPController::CloseReceivingIndicator(TBool aResetDisplayedState) - { - TRACE_FUNC - if(aResetDisplayedState) - { - iNoteDisplayed = EFalse; - } - if(iProgressDialog) - { - iProgressDialog->Cancel(); - iDialogActive = EFalse; - delete iProgressDialog; - iProgressDialog = 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) - { - (void) 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()))); - } - } - } - } - - TBool CBIPController::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; - } - - TBool CBIPController::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; - } - - void CBIPController::DialogDismissed(TInt aButtonId) - { - (void) aButtonId; - } - - void CBIPController::DataReceived(CHbSymbianVariantMap& aData) - { - if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) - { - TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); - switch(val) - { - case TBluetoothDialogParams::ECancelReceive: - { - //User choose to cancel receiving. - CancelTransfer(); - }break; - - case TBluetoothDialogParams::EHide: - { - //Use choose to hide the progress dialog. - CloseReceivingIndicator(EFalse); - }break; - - case TBluetoothDialogParams::EShow: - case TBluetoothDialogParams::ECancelShow: - { - //In case of Show, the device dialog will handle the opening of conversation view. - iRecvDoneDialog->Cancel(); - delete iRecvDoneDialog; - iRecvDoneDialog = NULL; - }break; - } - } - } - - void CBIPController::DeviceDialogClosed(TInt aCompletionCode) - { - (void) aCompletionCode; - } - - -//////////////////////////// Global part //////////////////////////// - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/src/BIPImageHandler.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPImageHandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/src/BIPXMLWriter.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPXMLWriter.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/bip/src/obexservicebip.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/obexservicebip.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/btmsgviewer.pro --- a/btobexprofiles/obexreceiveservices/btmsgviewer/btmsgviewer.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE = app -TARGET = btmsgviewer -CONFIG += hb \ - service -symbian: - { - TARGET.UID3 = 0x2002ED70 - TARGET.CAPABILITY = ALL \ - -TCB -} -LIBS += -lhbcore \ - -lxqservice \ - -lxqserviceutil \ - -lbluetooth \ - -lmsgs \ - -lapmime \ - -lefsrv \ - -lapgrfx \ - -lxqutils - -SERVICE.FILE = service_conf.xml -libFiles.sources = xqservice.dll -SERVICE.OPTIONS = embeddable \ - hidden -libFiles.path = "!:\sys\bin" -DEPLOYMENT += libFiles -HEADERS += ./inc/btmsgviewer.h \ - ./inc/btmsgviewerutils.h -SOURCES += ./src/btmsgviewer.cpp \ - ./src/main.cpp \ - ./src/btmsgviewerutils.cpp -BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ - "./rom/btmsgviewer.iby CORE_APP_LAYER_IBY_EXPORT_PATH(btmsgviewer.iby)" diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewer.h --- a/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#ifndef BTMSGVIEWER_H -#define BTMSGVIEWER_H - -#include -#include -#include - -#include "btmsgviewerutils.h" - - -class BTMsgViewer : public XQServiceProvider -{ - Q_OBJECT - -public: - BTMsgViewer (QObject* parent=0 ); - ~BTMsgViewer (); - -public slots: - void displaymsg(int messageId); - -private: - bool isError(int aError); - QString copyVCardToTemp(const QString& filepath); - void deleteVCardFromTemp(const QString& filepath); - -private: - int mCurrentRequestIndex; -}; - -#endif // BTMSGVIEWER_H diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewerutils.h --- a/btobexprofiles/obexreceiveservices/btmsgviewer/inc/btmsgviewerutils.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef BTMSGVIEWERUTILS_H_ -#define BTMSGVIEWERUTILS_H_ - -#include - - -class CBtMsgViewerUtils: public CBase, public MMsvSessionObserver - { -public: - static CBtMsgViewerUtils* NewL(); - ~CBtMsgViewerUtils(); - HBufC* GetMessagePath(TInt aMessageId, TInt aError); - HBufC8* GetMimeType(); - -private: // From MMsvSessionObserver - void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); - -private: - void GetMessagePathL(TPtr aMsgPath, const TInt aMessageId); - void StoreMessageMimeTypeL(TPtr aMsgPath); - -private: - CBtMsgViewerUtils(); - void ConstructL(); - -private: - CMsvSession* iMsvSession; - HBufC8* iMimeType; - }; - -#endif // BTMSGVIEWERUTILS_H_ diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/rom/btmsgviewer.iby --- a/btobexprofiles/obexreceiveservices/btmsgviewer/rom/btmsgviewer.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#ifndef __BTMSGVIEWER_IBY__ -#define __BTMSGVIEWER_IBY__ - -file=ABI_DIR\UREL\btmsgviewer.exe SHARED_LIB_DIR\btmsgviewer.exe -data=DATAZ_\resource\apps\btmsgviewer.rsc resource\apps\btmsgviewer.rsc -data=DATAZ_\private\10003a3f\import\apps\btmsgviewer_reg.rsc private\10003a3f\import\apps\btmsgviewer_reg.rsc - -#endif \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/service_conf.xml --- a/btobexprofiles/obexreceiveservices/btmsgviewer/service_conf.xml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - BT msg Disp service - - display message from inbox - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewer.cpp --- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#include "btmsgviewer.h" -#include "apmstd.h" -#include -#include -#include -#include -#include -#include -#include - -const QString KMimeTypeVCard("text/X-vCard"); - - -BTMsgViewer::BTMsgViewer(QObject* parent) -: XQServiceProvider("com.nokia.services.btmsgdispservices.displaymsg", parent), mCurrentRequestIndex(0) - { - publishAll(); - connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - } - -BTMsgViewer::~BTMsgViewer () - { - - } - -void BTMsgViewer::displaymsg( int messageId ) - { - mCurrentRequestIndex = setCurrentRequestAsync(); - CBtMsgViewerUtils* btViewerUtils = 0; - - TRAPD(error, btViewerUtils = CBtMsgViewerUtils::NewL()); - if(isError(error)) - { - if(btViewerUtils) - delete btViewerUtils; - - QVariant retVal(error); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - - HBufC* fileName = 0; - fileName = btViewerUtils->GetMessagePath(messageId, error); - if(isError(error)) - { - if(fileName) - delete fileName; - - delete btViewerUtils; - - QVariant retVal(error); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - - QString attachmentFName = XQConversions::s60DescToQString(fileName->Des()); - QString mimeType = XQConversions::s60Desc8ToQString(btViewerUtils->GetMimeType()->Des()); - delete fileName; - delete btViewerUtils; - - if(mimeType == KMimeTypeVCard) - { - int error = KErrGeneral; - - /*todo: copyVCardToTemp() has to be removed when phonebook updates it's capabilites to - access messages from private folder*/ - QString newfilepath = copyVCardToTemp(attachmentFName); - - QString service("com.nokia.services.phonebookservices"); - QString interface("Fetch"); - QString operation("editCreateNew(QString)"); - XQApplicationManager appManager; - XQAiwRequest* request = appManager.create(service, interface, operation, true); //embedded - if(request) - { - QList args; - args << newfilepath; - request->setArguments(args); - QVariant retValue; - bool res = request->send(retValue); - if (!res) - { - error = request->lastError(); - } - else - { - error = retValue.toInt(); - } - - delete request; - } - - /*todo: copyVCardToTemp() has to be removed when phonebook updates it's capabilites to - access messages from private folder*/ - deleteVCardFromTemp(newfilepath); - - QVariant retVal(error); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - - XQSharableFile sf; - XQAiwRequest* request = 0; - - if (!sf.open(attachmentFName)) { - QVariant retVal(KErrGeneral); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - - // Get handlers - XQApplicationManager appManager; - QList fileHandlers = appManager.list(sf); - if (fileHandlers.count() > 0) { - XQAiwInterfaceDescriptor d = fileHandlers.first(); - request = appManager.create(sf, d); - - if (!request) { - sf.close(); - - QVariant retVal(KErrGeneral); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - } - else { - sf.close(); - - QVariant retVal(KErrGeneral); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - - request->setEmbedded(true); - request->setSynchronous(true); - - // Fill args - QList args; - args << qVariantFromValue(sf); - request->setArguments(args); - - int err = KErrNone; - bool res = request->send(); - if (!res) - { - err = request->lastError(); - } - - // Cleanup - sf.close(); - delete request; - - QVariant retVal(err); - completeRequest(mCurrentRequestIndex, retVal); - return; - } - -bool BTMsgViewer::isError(int aError) - { - return ((aError < KErrNone)?true:false); - } - -QString BTMsgViewer::copyVCardToTemp(const QString& filepath) -{ - QDir tempDir; - QString tempFilePath(QDir::toNativeSeparators(tempDir.tempPath())); - tempFilePath.append(QDir::separator()); - QFileInfo fInfo(filepath); - tempFilePath.append(fInfo.fileName()); - QFile::copy(filepath, tempFilePath); - return tempFilePath; -} - -void BTMsgViewer::deleteVCardFromTemp(const QString& filepath) -{ - QFile::remove(filepath); -} diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewerutils.cpp --- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/btmsgviewerutils.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include -#include -#include "btmsgviewerutils.h" - -const TInt32 KUidMsgTypeBtTInt32 = 0x10009ED5; - - -CBtMsgViewerUtils* CBtMsgViewerUtils::NewL() - { - CBtMsgViewerUtils* me = new (ELeave) CBtMsgViewerUtils(); - CleanupStack::PushL(me); - me->ConstructL(); - CleanupStack::Pop(me); - return me; - } - -CBtMsgViewerUtils::CBtMsgViewerUtils() - { - - } - -void CBtMsgViewerUtils::ConstructL() - { - iMsvSession = CMsvSession::OpenSyncL(*this); - } - -CBtMsgViewerUtils::~CBtMsgViewerUtils() - { - if ( iMsvSession ) - { - delete iMsvSession; - } - delete iMimeType; - } - -HBufC* CBtMsgViewerUtils::GetMessagePath(TInt aMessageId, TInt aError) - { - HBufC* fileName = NULL; - TRAP(aError, fileName = HBufC::NewL(KMaxPath)); - if(aError < KErrNone) - { - return fileName; - } - - TRAP(aError, GetMessagePathL(fileName->Des(), aMessageId)); - return fileName; - } - -void CBtMsgViewerUtils::GetMessagePathL(TPtr aMsgPath, const TInt aMessageId) - { - CMsvEntry* messageEntry = iMsvSession->GetEntryL(aMessageId); - CleanupStack::PushL(messageEntry); //1st push - - TMsvEntry entry = messageEntry->Entry(); - if(entry.MtmData1() == KUidMsgTypeBtTInt32) - { - CMsvStore* store = messageEntry->ReadStoreL(); - CleanupStack::PushL(store); //2nd push - - //get file handle for the attachment & the complete path of the file - RFile attachmentFile; - attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); - CleanupClosePushL(attachmentFile); //3rd push - User::LeaveIfError(attachmentFile.FullName(aMsgPath)); - CleanupStack::PopAndDestroy(&attachmentFile); - StoreMessageMimeTypeL(aMsgPath); - - //mark attachment as Read - TMsvEntry attachEntry = messageEntry->Entry(); - attachEntry.SetUnread(EFalse); - messageEntry->ChangeL(attachEntry); - - CleanupStack::PopAndDestroy(store); - CleanupStack::PopAndDestroy(messageEntry); - } - else - { - CMsvEntry* attachmentEntry = iMsvSession->GetEntryL((*messageEntry)[0].Id()); - CleanupStack::PushL(attachmentEntry); //2nd push - - CMsvStore* store = attachmentEntry->ReadStoreL(); - CleanupStack::PushL(store); //3rd push - - //get file handle for the attachment & the complete path of the file - RFile attachmentFile; - attachmentFile = store->AttachmentManagerL().GetAttachmentFileL(0); - CleanupClosePushL(attachmentFile); - User::LeaveIfError(attachmentFile.FullName(aMsgPath)); - CleanupStack::PopAndDestroy(&attachmentFile); - StoreMessageMimeTypeL(aMsgPath); - - //mark attachment as Read - TMsvEntry attachEntry = attachmentEntry->Entry(); - attachEntry.SetUnread(EFalse); - attachmentEntry->ChangeL(attachEntry); - - CleanupStack::PopAndDestroy(store); - CleanupStack::PopAndDestroy(attachmentEntry); - CleanupStack::PopAndDestroy(messageEntry); - } - } - -void CBtMsgViewerUtils::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, - TAny* aArg2, TAny* aArg3) - { - (void) aEvent; - (void) aArg1; - (void) aArg2; - (void) aArg3; - } - -void CBtMsgViewerUtils::StoreMessageMimeTypeL(TPtr aMsgPath) - { - RFs rfs; - RFile file; - - User::LeaveIfError(rfs.Connect()); - - User::LeaveIfError(rfs.ShareProtected()); - - User::LeaveIfError(file.Open(rfs, aMsgPath, EFileShareReadersOrWriters | EFileRead)); - - TDataRecognitionResult dataType; - RApaLsSession apaSession; - - if(apaSession.Connect() == KErrNone) - { - if (apaSession.RecognizeData(file, dataType) == KErrNone) - { - if(iMimeType) - { - delete iMimeType; - iMimeType = NULL; - } - - iMimeType = dataType.iDataType.Des8().AllocL(); - - rfs.Close(); - apaSession.Close(); - } - } - - rfs.Close(); - } - -HBufC8* CBtMsgViewerUtils::GetMimeType() - { - return iMimeType; - } diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/btmsgviewer/src/main.cpp --- a/btobexprofiles/obexreceiveservices/btmsgviewer/src/main.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#include -#include -#include "btmsgviewer.h" - - -int main(int argc, char **argv) -{ - HbApplication a( argc, argv ); - - BTMsgViewer* btmsgviewer = new BTMsgViewer(); - - int retVal = a.exec(); - delete btmsgviewer; - return retVal; -} - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/group/bld.inf --- a/btobexprofiles/obexreceiveservices/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/bmarm/BTMTMUIU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/bmarm/BTMTMUIU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - NewBtMtmUiDataLayerL__FR17CRegisteredMtmDll @ 1 NONAME R3UNUSED ; NewBtMtmUiDataLayerL(CRegisteredMtmDll &) - NewBtMtmUiL__FR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME R3UNUSED ; NewBtMtmUiL(CBaseMtm &, CRegisteredMtmDll &) - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/bwins/BTMTMUIU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/bwins/BTMTMUIU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/data/btmtmui.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* 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 - -// RESOURCE DEFINITIONS -// --------------------------------------------------------- -// -// -// MTM info resource for Bt -// -// --------------------------------------------------------- -// - - - -#include - -RESOURCE MTM_INFO_FILE - { - mtm_type_uid = 0x10009ED5; - technology_type_uid = 0x10009ED6; - components = - { - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Bluetooth"; - component_uid = KUidMtmServerComponentVal; - entry_point = 1; - version = VERSION_V2 {}; - filename = "BtsMtm.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Bluetooth"; - component_uid = KUidMtmClientComponentVal; - entry_point = 1; - version = VERSION_V2 {}; - filename = "BtcMtm.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Bluetooth"; - component_uid = KUidMtmUiComponentVal; - entry_point = 2; - version = VERSION_V2 {}; - filename = "BtMtmUi.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Bluetooth"; - 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/eabi/btmtmuiU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/eabi/btmtmuiU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _Z20NewBtMtmUiDataLayerLR17CRegisteredMtmDll @ 1 NONAME - _Z11NewBtMtmUiLR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME - _ZTI12CBtMtmUiData @ 3 NONAME ; ## - _ZTI8CBtMtmUi @ 4 NONAME ; ## - _ZTV12CBtMtmUiData @ 5 NONAME ; ## - _ZTV8CBtMtmUi @ 6 NONAME ; ## - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/group/BtRegistry.mk --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/BtRegistry.mk Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/group/bld.inf --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/group/btmtmui.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* 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 -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmui.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,453 +0,0 @@ -/* -* 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 MObexUtilsDialogObserver - { - 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 ); - - /** - * Callback function from base class MObexUtilsDialogObserver. - */ - void DialogDismissed(TInt aButtonId); - - 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; - CObexUtilsDialog* iDialog; - }; - -#endif // CBTMTMUI_H - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidata.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* 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 - -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidebug.h --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/inc/btmtmuidebug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmui.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,835 +0,0 @@ -/* -* 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 - - -// 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; - delete iDialog; - } - -// Symbian OS default constructor can leave. -void CBtMtmUi::ConstructL() - { - FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) ); - CBaseMtmUi::ConstructL(); - iDialog = CObexUtilsDialog::NewL(this); - } - -// --------------------------------------------------------- -// GetResourceFileName(...) -// return progress status. -// --------------------------------------------------------- -// -void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const - { - FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) ); - (void)aFileName; - //todo: This function should be removed it is using avkon resource file. - } - -// --------------------------------------------------------- -// 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 ); - //todo: Need to use Localized string. - _LIT(KText, "Cannot establish Bluetooth connection"); - iDialog->ShowInformationNoteL(KText); - 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 ); - //todo: Need to use Localized string. - _LIT(KText, "Cannot establish Bluetooth connection"); - iDialog->ShowInformationNoteL(KText); - - 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 ); - //todo: Need to use Localized string. - _LIT(KText, "Message sent!"); - iDialog->ShowInformationNoteL(KText); - - break; - } - case TObexMtmProgress::ESendError: - { - FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) ); - if( error == KErrIrObexClientNoDevicesFound ) - { - //resourceId = R_BT_DEV_NOT_AVAIL; - //TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); - //todo: Need to use Localized string. - _LIT(KText, "Cannot establish Bluetooth connection"); - iDialog->ShowInformationNoteL(KText); - - } - else - { - //resourceId = R_BT_FAILED_TO_SEND; - //TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); - //todo: Need to use Localized string. - _LIT(KText, "Failed to send message"); - iDialog->ShowErrorNoteL(KText); - - } - 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" ) ); - (void)aStatus; - (void)aSession; - //CMsvEntry* message; - //message = &iBaseMtm.Entry(); - //todo: need to replace this - //return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); - return NULL; - } - -// --------------------------------------------------------- -// 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(); - } - -void CBtMtmUi::DialogDismissed(TInt /*aButtonId*/) - { - - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +0,0 @@ -/* -* 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 - - -// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) -const TUid KUidMsgTypeBt = {0x10009ED5}; - -// ================= 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" ) ); - - //todo: This was returning avkon resource Id of sting "This item is not available". - return 0; - } - -// --------------------------------------------------------- -// 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; - //todo: This function will not work as iIconArrays is not populated might cause panic. - return *iIconArrays->At(icon); - } - -// --------------------------------------------------------- -// PopulateArraysL() -// Populates bitmap array -// --------------------------------------------------------- -// -void CBtMtmUiData::PopulateArraysL() - { - FLOG( _L( " CBtMtmUiData: PopulateArraysL\t" ) ); - //todo: Was populating iIconArrays which should be removed. - } - -// --------------------------------------------------------- -// GetResourceFileName(TFileName& aFileName) const -// Gives resource filename. -// --------------------------------------------------------- -// -void CBtMtmUiData::GetResourceFileName( TFileName& /*aFileName*/ ) const - { - FLOG( _L( " CBtMtmUiData: GetResourceFileName\t" ) ); - //todo: This was returning avkon resource file, which is not required now. - } - -// --------------------------------------------------------- -// 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 --- - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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" ) ); - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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" ) ); - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanDeleteFromEntryL(...) -// Checks if it is possible to delete from entry. -// --------------------------------------------------------- -// -TBool CBtMtmUiData::CanDeleteFromEntryL( const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanCopyMoveToEntryL(...) -// Checks if it is possible to move to entry. -// --------------------------------------------------------- -// -TBool CBtMtmUiData::CanCopyMoveToEntryL( const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanCopyMoveFromEntryL(...) -// Checks if it is possible to move from entry. -// --------------------------------------------------------- -// -TBool CBtMtmUiData::CanCopyMoveFromEntryL( const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanReplyToEntryL(...) -// Checks if it is possible to reply to entry. -// --------------------------------------------------------- -// -TBool CBtMtmUiData::CanReplyToEntryL( const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; // Not Ok to do - } - -// --------------------------------------------------------- -// CanForwardEntryL(...) -// Checks if it is possible to forward entry. -// --------------------------------------------------------- -// -TBool CBtMtmUiData::CanForwardEntryL( const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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. - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - //todo: Need to use localised string. - _LIT(KText, "Sending"); - buffer.Copy(KText); - return buffer.AllocL(); - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidll.cpp --- a/btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidll.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/bmarm/IRMTMUIU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/bmarm/IRMTMUIU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - NewMtmUiDataLayerL__FR17CRegisteredMtmDll @ 1 NONAME R3UNUSED ; NewMtmUiDataLayerL(CRegisteredMtmDll &) - NewMtmUiL__FR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME R3UNUSED ; NewMtmUiL(CBaseMtm &, CRegisteredMtmDll &) - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/bwins/IRMTMUIU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/bwins/IRMTMUIU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/data/irmtmui.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* 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 - -RESOURCE MTM_INFO_FILE - { - mtm_type_uid = 0x100053A4; - technology_type_uid = 0x1000539F; - components = - { - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Infrared "; - component_uid = KUidMtmServerComponentVal; - entry_point = 1; - version = VERSION_V2 {}; - filename = "irs.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Infrared "; - component_uid = KUidMtmClientComponentVal; - entry_point = 1; - version = VERSION_V2 {}; - filename = "irc.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Infrared "; - component_uid = KUidMtmUiComponentVal; - entry_point = 2; - version = VERSION_V2 {}; - filename = "irmtmui.dll"; - }, - MTM_COMPONENT_V2 - { - //todo: Need to use localized string. - human_readable_name = "Via Infrared "; - 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/eabi/irmtmuiU.DEF --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/eabi/irmtmuiU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _Z18NewMtmUiDataLayerLR17CRegisteredMtmDll @ 1 NONAME - _Z9NewMtmUiLR8CBaseMtmR17CRegisteredMtmDll @ 2 NONAME - _ZTI12CIrMtmUiData @ 3 NONAME ; ## - _ZTI8CIrMtmUi @ 4 NONAME ; ## - _ZTV12CIrMtmUiData @ 5 NONAME ; ## - _ZTV8CIrMtmUi @ 6 NONAME ; ## - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/group/IRmtmuiRegistry.mk --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/IRmtmuiRegistry.mk Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/group/bld.inf --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/group/irmtmui.mmp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/group/irmtmui.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/debug.h --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmui.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,339 +0,0 @@ -/* -* 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 -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/inc/irmtmuidata.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* 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 - -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmui.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,706 +0,0 @@ -/* -* 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 // Notifier UID's -#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(); - //todo: Need to use localised string. - _LIT(KConnectText, "Connecting via Infrared.."); - _LIT(KSendText, "Sending message via Infrared..."); - iConnectingText.Copy(KConnectText); - iSendingText.Copy(KSendText); - - iCurrentlySending = EFalse; - } - -// --------------------------------------------------------- -// GetResourceFileName(...) -// return progress status. -// --------------------------------------------------------- -// -void CIrMtmUi::GetResourceFileName( TFileName& /*aFileName*/ ) const - { - FLOG( _L( "[CIrMtmUi] CIrMtmUi: GetResourceFileName\t" ) ); - //todo: This function should be removed it is using avkon resource file. - - } - -// --------------------------------------------------------- -// 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(); - //todo: Need to use proper API for launching editor application, now returning NULL. - return NULL; - } - - -// --------------------------------------------------------- -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,426 +0,0 @@ -/* -* 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 "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" ) ); - //todo: This was returning avkon resource Id of sting "This item is not available". - return 0; - } - -// --------------------------------------------------------- -// 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 = 0; - //todo: This function will not work as iIconArrays is not populated might cause panic. - return *iIconArrays->At( icon ); - } - -// --------------------------------------------------------- -// PopulateArraysL() -// Populates bitmap array -// --------------------------------------------------------- -// -void CIrMtmUiData::PopulateArraysL() - { - FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) ); - - //todo: Was populating iIconArrays which should be removed. - } - -// --------------------------------------------------------- -// GetResourceFileName(TFileName& aFileName) const -// Gives resource filename. -// --------------------------------------------------------- -// -void CIrMtmUiData::GetResourceFileName(TFileName& /*aFileName*/) const - { - FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) ); - //todo: This was returning avkon resource file, which is not required now. - } - -// --------------------------------------------------------- -// 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 --- - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - } - } - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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" ) ); - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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" ) ); - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanDeleteFromEntryL(...) -// Checks if it is possible to delete from entry. -// --------------------------------------------------------- -// -TBool CIrMtmUiData::CanDeleteFromEntryL( - const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanCopyMoveToEntryL(...) -// Checks if it is possible to move to entry. -// --------------------------------------------------------- -// -TBool CIrMtmUiData::CanCopyMoveToEntryL( - const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanCopyMoveFromEntryL(...) -// Checks if it is possible to move from entry. -// --------------------------------------------------------- -// -TBool CIrMtmUiData::CanCopyMoveFromEntryL( - const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; - } - -// --------------------------------------------------------- -// CanReplyToEntryL(...) -// Checks if it is possible to reply to entry. -// --------------------------------------------------------- -// -TBool CIrMtmUiData::CanReplyToEntryL( - const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - return EFalse; // Not Ok to do - } - -// --------------------------------------------------------- -// CanForwardEntryL(...) -// Checks if it is possible to forward entry. -// --------------------------------------------------------- -// -TBool CIrMtmUiData::CanForwardEntryL( - const TMsvEntry& /*aContext*/, - TInt& aReasonResourceId ) const - { - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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. - //todo: This was using avkon resource Id of sting "This item is not available". - aReasonResourceId = 0; - 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; - //todo: Need to use localised string. - _LIT(KText, "Sending"); - buffer.Copy(KText); - HBufC* ptr; - ptr = buffer.AllocL(); - return ptr; - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidll.cpp --- a/btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidll.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/data/101F8636.rss --- a/btobexprofiles/obexreceiveservices/opp/data/101F8636.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/group/bld.inf --- a/btobexprofiles/obexreceiveservices/opp/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp --- a/btobexprofiles/obexreceiveservices/opp/group/obexserviceopp.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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 -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets -SYSTEMINCLUDE /epoc32/include/platform/mw/btservices - -LIBRARY obexutils.lib -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY servicehandler.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 -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 -LIBRARY HbCore.lib -LIBRARY HbWidgets.lib - -DEBUGLIBRARY flogger.lib diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/inc/debug.h --- a/btobexprofiles/obexreceiveservices/opp/inc/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/inc/debugconfig.h --- a/btobexprofiles/obexreceiveservices/opp/inc/debugconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h --- a/btobexprofiles/obexreceiveservices/opp/inc/oppcontroller.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* 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 "obexutilspropertynotifier.h" -#include -#include "btengdevman.h" - -#include - -#include -#include -#include - - -const TInt KBtStartReserveChannel = 9; -const TInt KBtEndReserveChannel = 30; - -// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) -const TUid KUidMsgTypeBt = {0x10009ED5}; -/** -* Backup status. -* The value is controlled by FileManager -*/ -enum TFileManagerBkupStatusType - { - EFileManagerBkupStatusUnset = 0x00000000, - EFileManagerBkupStatusBackup = 0x00000001, - EFileManagerBkupStatusRestore = 0x00000002 - }; -/** -* CBtListenActive -* Class to implement IrObex permanent listen -*/ -class COPPController : public CSrcsInterface, public MObexServerNotify, - public MObexUtilsPropertyNotifyHandler, - public MObexUtilsDialogObserver, - public MBTEngDevManObserver, - public MHbDeviceDialogObserver - { -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 MBTEngDevManObserver - void HandleGetDevicesComplete(TInt aErr, CBTDeviceArray* aDeviceArray); - -private: //from MObexUtilsDialogObserver - void DialogDismissed(TInt aButtonId); - -private: - COPPController(); - void ConstructL(); - - void CancelTransfer(); - void HandlePutRequestL(); - TInt HandlePutCompleteIndication(); - void HandleError(TBool aAbort); - - TBool CheckCapacityL(); - void LaunchReceivingIndicatorL(); - inline TBool ReceivingIndicatorActive() const { return (iDialogActive); } - void UpdateReceivingIndicatorL(); - void CloseReceivingIndicator(TBool aResetDisplayedState = ETrue); - TInt GetDriveWithMaximumFreeSpaceL(); - TBool IsBackupRunning(); - TBool ProcessExists( const TSecureId& aSecureId ); - -private: - void DataReceived(CHbSymbianVariantMap& aData); - void DeviceDialogClosed(TInt aCompletionCode); - -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; - TBool iNoteDisplayed; - CBTEngDevMan* iDevMan; - CBTDeviceArray* iResultArray; - TBTDeviceName iRemoteDeviceName; - CObexUtilsDialog* iDialog; - CHbDeviceDialogSymbian* iProgressDialog; - TBool iDialogActive; - TInt iFileCount; - TBool iReceivingFailed; - CHbDeviceDialogSymbian* iRecvDoneDialog; - TBool iShowRecvCompleteDialog; - }; - -#endif // OPPCONTROLLER_H - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/inc/prjconfig.h --- a/btobexprofiles/obexreceiveservices/opp/inc/prjconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/src/obexserviceopp.cpp --- a/btobexprofiles/obexreceiveservices/opp/src/obexserviceopp.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp --- a/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1065 +0,0 @@ -/* -* 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 "oppcontroller.h" -#include "btengdevman.h" -#include -#include "debug.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// CONSTANTS - -const TInt KBufferSize = 0x10000; // 64 kB -const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3 -_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" ); -_LIT(KLocFileName, "btdialogs_"); -_LIT(KPath, "z:/resource/qt/translations/"); - -// ================= 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); - iDialog = CObexUtilsDialog::NewL(this); - TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); - if (!ok) - { - User::Leave( KErrNotFound ); - } - } - -COPPController::~COPPController() - { - TRACE_FUNC - delete iObexObject; - delete iBuf; - delete iLowMemoryActiveCDrive; - delete iLowMemoryActiveMMC; - delete iDevMan; - if (iResultArray) - { - iResultArray->ResetAndDestroy(); - delete iResultArray; - } - iFs.Close(); - delete iDialog; - delete iProgressDialog; - delete iRecvDoneDialog; - } - -// --------------------------------------------------------- -// 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" ))); - iReceivingFailed = ETrue; - iShowRecvCompleteDialog = EFalse; - if( iObexTransferState == ETransferPut || iObexTransferState == ETransferPutDiskError ) - { - if(iObexObject) - { - iObexObject->Reset(); - } - CancelTransfer(); - if(!aAbort) - { - if(iMediaType == ESrcsMediaBT) - { - TRAP_IGNORE( - HBufC* note = HbTextResolverSymbian::LoadLC(_L("txt_bt_dpophead_receiving_failed")); - iDialog->ShowErrorNoteL(note->Des()); - CleanupStack::PopAndDestroy(note); - ); - } - 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 - iReceivingFailed = EFalse; - 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 - (void) aRemoteInfo; - (void) aInfo; - - 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 - (void) aInfo; - } - -// --------------------------------------------------------- -// TransportDownIndication() -// --------------------------------------------------------- -// -void COPPController::TransportDownIndication() - { - TRACE_FUNC - if(!iReceivingFailed && iShowRecvCompleteDialog) - { - //Launch recevice completed dialog. - iRecvDoneDialog = CHbDeviceDialogSymbian::NewL(); - iRecvDoneDialog->SetObserver(this); - - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt dialogIdx = TBluetoothDialogParams::EReceiveDone; - CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), - CHbSymbianVariant::EInt ); - CleanupStack::PushL(dialogType); - TBuf16<6> dialogTypeKey; - dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); - User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); - CleanupStack::Pop(dialogType); - - CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(deviceName); - TBuf16<6> deviceNameKey; - deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); - User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); - CleanupStack::Pop(deviceName); - - CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(fileName); - TBuf16<6> fileNameKey; - fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); - User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); - CleanupStack::Pop(fileName); - - CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileSz); - TBuf16<6> fileSzKey; - fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); - User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); - CleanupStack::Pop(fileSz); - - CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileCnt); - TBuf16<6> fileCntKey; - fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount); - User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt)); - CleanupStack::Pop(fileCnt); - - iRecvDoneDialog->Show( KBTDevDialogId(), *variantMap, this ); - CleanupStack::PopAndDestroy(variantMap); - iShowRecvCompleteDialog = EFalse; - } - - // Remove receiving buffer and files used during file receiving. - // - delete iObexObject; - iObexObject = NULL; - TRAP_IGNORE(TObexUtilsMessageHandler::RemoveTemporaryRFileL (iFullPathFilename)); - iFs.Close(); - iFileCount = 0; - } - -// --------------------------------------------------------- -// 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 ( 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)); - //todo: Need to use Localized string. - _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); - TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); - - 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()) - { - TRAPD(err, UpdateReceivingIndicatorL()); - if(err < KErrNone) - { - return err; - } - } - 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(); - iFileCount++; - iShowRecvCompleteDialog = ETrue; - } - TRACE_FUNC_EXIT - return retVal; - } - -// --------------------------------------------------------- -// GetRequestIndication() -// --------------------------------------------------------- -// -CObexBufObject* COPPController::GetRequestIndication( CObexBaseObject* aRequiredObject) - { - TRACE_FUNC - (void) aRequiredObject; - 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 - - (void) aPathInfo; - (void) aInfo; - // 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)); - //todo: Need to use Localized string. - _LIT(KText, "Not enough memory to execute operation. Delete some documents and try again."); - TRAP_IGNORE(iDialog->ShowErrorNoteL(KText)); - - 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) - { - if(iReceivingFileName.Length() > 0) - { - iProgressDialog = CHbDeviceDialogSymbian::NewL(); - iProgressDialog->SetObserver(this); - - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt dialogIdx = TBluetoothDialogParams::EReceiveProgress; - CHbSymbianVariant* dialogType = CHbSymbianVariant::NewL( (TAny*) &(dialogIdx), - CHbSymbianVariant::EInt ); - CleanupStack::PushL(dialogType); - TBuf16<6> dialogTypeKey; - dialogTypeKey.Num(TBluetoothDialogParams::EDialogType); - User::LeaveIfError(variantMap->Add(dialogTypeKey, dialogType)); - CleanupStack::Pop(dialogType); - - CHbSymbianVariant* deviceName = CHbSymbianVariant::NewL( (TAny*) (&iRemoteDeviceName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(deviceName); - TBuf16<6> deviceNameKey; - deviceNameKey.Num(TBluetoothDeviceDialog::EDeviceName); - User::LeaveIfError(variantMap->Add(deviceNameKey, deviceName)); - CleanupStack::Pop(deviceName); - - CHbSymbianVariant* fileName = CHbSymbianVariant::NewL( (TAny*) (&iReceivingFileName), - CHbSymbianVariant::EDes ); - CleanupStack::PushL(fileName); - TBuf16<6> fileNameKey; - fileNameKey.Num(TBluetoothDeviceDialog::EReceivingFileName); - User::LeaveIfError(variantMap->Add(fileNameKey, fileName)); - CleanupStack::Pop(fileName); - - CHbSymbianVariant* fileSz = CHbSymbianVariant::NewL( (TAny*) &iTotalSizeByte, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileSz); - TBuf16<6> fileSzKey; - fileSzKey.Num(TBluetoothDeviceDialog::EReceivingFileSize); - User::LeaveIfError(variantMap->Add(fileSzKey, fileSz)); - CleanupStack::Pop(fileSz); - - CHbSymbianVariant* fileCnt = CHbSymbianVariant::NewL( (TAny*) &iFileCount, - CHbSymbianVariant::EInt ); - CleanupStack::PushL(fileCnt); - TBuf16<6> fileCntKey; - fileCntKey.Num(TBluetoothDeviceDialog::EReceivedFileCount); - User::LeaveIfError(variantMap->Add(fileCntKey, fileCnt)); - CleanupStack::Pop(fileCnt); - - iDialogActive = ETrue; - iProgressDialog->Show( KBTDevDialogId(), *variantMap, this ); - CleanupStack::PopAndDestroy(variantMap); - } - else - { - if(iMediaType == ESrcsMediaBT) - { - //TODO - Remove the usage of the resources. - //iProgressDialog->ShowProgressDialogL(R_BT_RECEIVING_DATA); - } - TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); - } - } - else - { - - /* - * TODO - The functionality provided by CGlobalDialog will be removed - * TODO - and this will be provided by CGlobalProgressDialog. - */ - if(iMediaType == ESrcsMediaBT) - { - // TODO - } - TRACE_ASSERT(iMediaType != ESrcsMediaIrDA, KErrNotSupported); - } - } - -void COPPController::UpdateReceivingIndicatorL() - { - if(iProgressDialog) - { - CHbSymbianVariantMap* variantMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(variantMap); - - TInt bytesReceived = iObexObject->BytesReceived(); - CHbSymbianVariant* progress = CHbSymbianVariant::NewL( (TAny*) &bytesReceived, CHbSymbianVariant::EInt ); - CleanupStack::PushL(progress); - User::LeaveIfError(variantMap->Add(_L("progress"), progress)); - CleanupStack::Pop(progress); - - iProgressDialog->Update(*variantMap); - CleanupStack::PopAndDestroy(variantMap); - } - } - -void COPPController::CloseReceivingIndicator(TBool aResetDisplayedState) - { - TRACE_FUNC - if(aResetDisplayedState) - { - iNoteDisplayed = EFalse; - } - - if(iProgressDialog) - { - iProgressDialog->Cancel(); - iDialogActive = EFalse; - delete iProgressDialog; - iProgressDialog = 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" ) ); - - (void) aDeviceArray; - - 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()))); - } - } - } - } - TBool COPPController::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; - } - - TBool COPPController::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; - } - - void COPPController::DialogDismissed(TInt aButtonId) - { - (void) aButtonId; - } - - void COPPController::DataReceived(CHbSymbianVariantMap& aData) - { - if(aData.Keys().MdcaPoint(0).Compare(_L("actionResult")) == 0) - { - TInt val = *(static_cast(aData.Get(_L("actionResult"))->Data())); - switch(val) - { - case TBluetoothDialogParams::ECancelReceive: - { - //User choose to cancel receiving. - CancelTransfer(); - }break; - - case TBluetoothDialogParams::EHide: - { - //Use choose to hide the progress dialog. - CloseReceivingIndicator(EFalse); - }break; - - case TBluetoothDialogParams::EShow: - case TBluetoothDialogParams::ECancelShow: - { - //In case of Show, the device dialog will handle the opening of conversation view. - iRecvDoneDialog->Cancel(); - delete iRecvDoneDialog; - iRecvDoneDialog = NULL; - }break; - } - } - } - - void COPPController::DeviceDialogClosed(TInt aCompletionCode) - { - (void) aCompletionCode; - } - -//////////////////////////// Global part //////////////////////////// - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/mtmuibluetooth.iby --- a/btobexprofiles/obexreceiveservices/rom/mtmuibluetooth.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __MTMUIBLUETOOTH_IBY__ -#define __MTMUIBLUETOOTH_IBY__ - -#ifdef __BT -file=ABI_DIR\BUILD_DIR\btmtmui.dll SHARED_LIB_DIR\btmtmui.dll -#endif - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/mtmuibluetoothresources.iby --- a/btobexprofiles/obexreceiveservices/rom/mtmuibluetoothresources.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __MTMUIBLUETOOTHRESOURCES_IBY__ -#define __MTMUIBLUETOOTHRESOURCES_IBY__ - -#ifdef __BT -data=DATAZ_\resource\messaging\mtm\btmtmui.rsc resource\messaging\mtm\btmtmui.rsc -#endif - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/mtmuiinfrared.iby --- a/btobexprofiles/obexreceiveservices/rom/mtmuiinfrared.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __MTMUIINFRARED_IBY__ -#define __MTMUIINFRARED_IBY__ - -file=ABI_DIR\BUILD_DIR\irmtmui.dll SHARED_LIB_DIR\irmtmui.dll - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/mtmuiinfraredResources.iby --- a/btobexprofiles/obexreceiveservices/rom/mtmuiinfraredResources.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __MTMUIINFRAREDRESOURCES_IBY__ -#define __MTMUIINFRAREDRESOURCES_IBY__ - -data=DATAZ_\resource\messaging\mtm\irmtmui.rsc resource\messaging\mtm\irmtmui.rsc - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/obexservicebip.iby --- a/btobexprofiles/obexreceiveservices/rom/obexservicebip.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __OBEXSERVICEBIP_IBY__ -#define __OBEXSERVICEBIP_IBY__ - -#ifdef __BT -#ifdef __BT_IMAGING_PROFILE -ECOM_PLUGIN(obexservicebip.dll,101F8671.rsc) -#endif -#endif - - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexreceiveservices/rom/obexserviceopp.iby --- a/btobexprofiles/obexreceiveservices/rom/obexserviceopp.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __OBEXSERVICEOPP_IBY__ -#define __OBEXSERVICEOPP_IBY__ - -#ifdef __BT -ECOM_PLUGIN(obexserviceopp.dll,101F8636.rsc) -#endif - - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/BWINS/obexservicesendutilsU.DEF --- a/btobexprofiles/obexsendservices/BWINS/obexservicesendutilsU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/eabi/obexservicesendutilsu.DEF --- a/btobexprofiles/obexsendservices/eabi/obexservicesendutilsu.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/group/bld.inf --- a/btobexprofiles/obexsendservices/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/group/sendutils.mmp --- a/btobexprofiles/obexsendservices/group/sendutils.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* 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 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 BTServiceDelayedDestroyer.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 - -USERINCLUDE ../obexservicesendutils/inc -SYSTEMINCLUDE ../../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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/inc/btsendingservicedebug.h --- a/btobexprofiles/obexsendservices/obexhighway/inc/btsendingservicedebug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceinterface.h --- a/btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceinterface.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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: ?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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceprovider.h --- a/btobexprofiles/obexsendservices/obexhighway/inc/btsendserviceprovider.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/inc/btsssendlisthandler.h --- a/btobexprofiles/obexsendservices/obexhighway/inc/btsssendlisthandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/obexhighway.pro --- a/btobexprofiles/obexsendservices/obexhighway/obexhighway.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/rom/obexhighway.iby --- a/btobexprofiles/obexsendservices/obexhighway/rom/obexhighway.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/src/btsendserviceinterface.cpp --- a/btobexprofiles/obexsendservices/obexhighway/src/btsendserviceinterface.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: ?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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/src/btsendserviceprovider.cpp --- a/btobexprofiles/obexsendservices/obexhighway/src/btsendserviceprovider.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/src/btsssendlisthandler.cpp --- a/btobexprofiles/obexsendservices/obexhighway/src/btsssendlisthandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/src/main.cpp --- a/btobexprofiles/obexsendservices/obexhighway/src/main.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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: ?Description -* -*/ - - -#include -#include "btsendserviceinterface.h" - -int main(int argc, char **argv) - { - QCoreApplication app(argc, argv); - BTSendServiceInterface btSendSI; - return app.exec(); - } - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexhighway/xml/obexhighway_conf.xml --- a/btobexprofiles/obexsendservices/obexhighway/xml/obexhighway_conf.xml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/bmarm/BTSERVICEUTILSU.DEF --- a/btobexprofiles/obexsendservices/obexservicesendutils/bmarm/BTSERVICEUTILSU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/bwins/BTSERVICEUTILSU.DEF --- a/btobexprofiles/obexsendservices/obexservicesendutils/bwins/BTSERVICEUTILSU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/eabi/BtServiceUtilsU.DEF --- a/btobexprofiles/obexsendservices/obexservicesendutils/eabi/BtServiceUtilsU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTConnectionTimer.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTConnectionTimer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBIPController.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* -* 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(); - - void SendUnSupportedFiles(); - - 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPController.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* 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 "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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectRequest.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectRequest.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectServer.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPObjectServer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPServerWait.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSBPPServerWait.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSController.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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( ); - - - virtual void SendUnSupportedFiles(); - -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSOPPController.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSOPPController.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUCapabilityResolver.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUCapabilityResolver.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDataConverter.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDataConverter.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDebug.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUDebug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUImageConverter.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUImageConverter.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUPassKeyRequest.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUPassKeyRequest.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSURefObjectResolver.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSURefObjectResolver.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUXmlParser.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUXmlParser.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceAPI.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceAPI.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceClient.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceClient.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceDelayedDestroyer.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceDelayedDestroyer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2005-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: The base active object declaration -* -*/ - - -#ifndef BT_SERVICE_DELAYED_DESTROYER_H -#define BT_SERVICE_DELAYED_DESTROYER_H - -// INCLUDES -#include -#include - -NONSHARABLE_CLASS (CBTServiceDelayedDestroyer) : public CActive - { - -public: - - static CBTServiceDelayedDestroyer* NewL(CActive::TPriority aPriority); - - static CBTServiceDelayedDestroyer* NewLC(CActive::TPriority aPriority); - - virtual ~CBTServiceDelayedDestroyer(); - -public: - - /** - * Calls SetActive(). - */ - void GoActive(); - - // Sets the pointer which will be destroyed. - // Must be called with GoActive, they are pairs, first - // call SetDestructPointer and then GoActive. - void SetDestructPointer(CBTEngDiscovery* aPtr); - -private: - - /** - * From CActive. - * cancels the outstanding request. - */ - virtual void DoCancel(); - - /** - * From CActive. - * Handles the request completion event. - * Deletes CBTEngDiscovery object which is passed via SetDestructPointer method. - */ - virtual void RunL(); - - /** - * From CActive. - * Handles the leave from RunL(). - * @param aError the leave code in RunL() - * @return the error code to Active Scheduler - */ - virtual TInt RunError(TInt aError); - -private: - - CBTServiceDelayedDestroyer(CActive::TPriority aPriority); - -private: - TRequestStatus iStatus; - CBTEngDiscovery* iPtr; - }; - -#endif // BT_SERVICE_DELAYED_DESTROYER_H diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceParameterList.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceParameterList.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceStarter.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,483 +0,0 @@ -/* -* 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 "BTServiceDelayedDestroyer.h" - -#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; - - -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. - */ - //todo reusing the second param aTotalsize to aFileCount as it wass no longer used check it being used in other places - virtual void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, 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 confirmation query for sending - * should be shouwn for BIP sending - * @return - */ - virtual void LaunchConfirmationQuery(const TDesC& aConfirmText)=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: // 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. - * @param aFileCount Total Number of files to be sent - * @return None. - */ - //todo reuse the second param as it is no longer used check it being used in other places - void LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, 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 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 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 confirmation query for BIP - * profile should be shown. - */ - void LaunchConfirmationQuery(const TDesC& aConfirmText); - - /** - * 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 ShowErrorNote( 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 ); - - 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; - //todo verify the usage of below variable when file sending to mulitple devices or - //when files from different applications are sent simultaneously - TBool iServiceStarted; - TMsvId iMessageServerIndex; - - MBTServiceProgressGetter* iProgressGetter; - CActiveSchedulerWait* iWaiter; - TBool iAllSend; - TInt iBytesSendWithBIP; - //todo verify the usage of below variable as this part of legacy code - //and false condition will never be hit. - 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; - CBTServiceDelayedDestroyer* iDelayedDestroyer; - TBool iLocalisationInit; - }; - -#endif // BT_SERVICE_CONTROLLER_H - -// End of File - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.h --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.inl --- a/btobexprofiles/obexsendservices/obexservicesendutils/inc/BTServiceUtils.inl Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTConnectionTimer.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTConnectionTimer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBIPController.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,691 +0,0 @@ -/* -* 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: 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; - -_LIT(KBTNotSendSomeText,"txt_bt_info_receiving_device_does_not_support_all"); -_LIT(KBTNotSendOneText,"txt_bt_info_receiving_device_does_not_support_this"); - - - - -// ============================ 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->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(KMaxFileName); - 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; - 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) - { - HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendSomeText); - iObserverPtr->LaunchConfirmationQuery(sendText->Des()); - CleanupStack::PopAndDestroy( sendText ); - } - else if ( !allSupported && iListPtr->ImageCount() == 1) - { - // We allow user to choose wheather to send the image file which is not supported on target device - HBufC* sendText = HbTextResolverSymbian::LoadLC(KBTNotSendOneText); - iObserverPtr->LaunchConfirmationQuery(sendText->Des()); - CleanupStack::PopAndDestroy( sendText ); - } - else if( allSupported ) - { - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() + iListPtr->ObjectCount()); - - // Start sending images - // - SendL(); - } - - - FLOG(_L("[BTSU]\t CBTSBIPController::HandleGetCompleteIndicationL() #3")); - } - - -//----------------------------------------------------------------------------- -// void CBTSBIPController::ConnectTimedOut() -// ----------------------------------------------------------------------------- -// -void CBTSBIPController::ConnectTimedOut() - { - iObserverPtr->ConnectTimedOut(); - } - - - -void CBTSBIPController::SendUnSupportedFiles() - { - // Everything went ok. Start sending images - - // group leaving functions in one trap for better performance: - TRAPD(err, { - iObserverPtr->LaunchProgressNoteL( iClient, iListPtr->ImageCount() ); - SendL(); } ); - - if ( err != KErrNone ) - { - DeleteTempFile( iTempFileName ); - // Error on capability handling - // - iObserverPtr->ControllerComplete( EBTSGettingFailed ); - } - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPController.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,420 +0,0 @@ -/* -* 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: Basic printing profile implementation -* -*/ - - - -// INCLUDE FILES -#include "BTServiceUtils.h" -#include "BTSBPPController.h" -#include "BTSUDebug.h" - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectRequest.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectRequest.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,481 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectServer.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPObjectServer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,372 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPServerWait.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSBPPServerWait.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSController.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?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")); - } - -void CBTSController::SendUnSupportedFiles() - { - - } - -// --------------------------------------------------------------------------- -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSOPPController.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -* 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->ObjectCount() ); - iFileIndex = 0; - UpdateProgressNoteL(); - Send(); - } - - -void CBTSOPPController::UpdateProgressNoteL() - { - TInt size; - RBuf filename; - iListPtr->ObjectAtL( iFileIndex ).Size(size); - filename.CreateL(KMaxFileName); - iListPtr->ObjectAtL( iFileIndex ).Name(filename); - iObserverPtr->UpdateProgressNoteL(size,iFileIndex,filename); - filename.Close(); - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUCapabilityResolver.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUCapabilityResolver.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,377 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUDataConverter.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUDataConverter.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUImageConverter.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUImageConverter.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUPassKeyRequest.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUPassKeyRequest.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSURefObjectResolver.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSURefObjectResolver.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUXmlParser.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTSUXmlParser.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceAPI.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceAPI.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceClient.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,600 +0,0 @@ -/* -* 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: Obex client implementation -* -*/ - - - -// INCLUDE FILES -#include // RApaLSession - -#include "BTServiceClient.h" -#include "BTServiceUtils.h" -#include "BTConnectionTimer.h" -#include "BTSUDebug.h" - -const TUint16 KMtuSizeReceiv = 0xFFFF; // 64kB - 1 (65535) -const TUint16 KMtuSizeTrans = 0x8000; // 32kB -const TInt KBufferSize = 0x8000; // 32kB - -const TInt KBTConnectionTimeout = 20 * 1000 * 1000; // 20 seconds -const TInt KBTAbortTimeout = 2 * 1000 * 1000; // 2 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceDelayedDestroyer.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceDelayedDestroyer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2005-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: The base active class definition -* -*/ - - -#include "BTServiceDelayedDestroyer.h" -#include "BTSUDebug.h" - -// ======== MEMBER FUNCTIONS ======== - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::NewL() -// ----------------------------------------------------------------------------- -// -CBTServiceDelayedDestroyer* CBTServiceDelayedDestroyer::NewL(CActive::TPriority aPriority) - { - CBTServiceDelayedDestroyer* self = CBTServiceDelayedDestroyer::NewLC(aPriority); - CleanupStack::Pop(self); - return self; - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::NewLC() -// ----------------------------------------------------------------------------- -// -CBTServiceDelayedDestroyer* CBTServiceDelayedDestroyer::NewLC(CActive::TPriority aPriority) - { - CBTServiceDelayedDestroyer* self = new (ELeave) CBTServiceDelayedDestroyer(aPriority); - CleanupStack::PushL(self); - return self; - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::CBTServiceDelayedDestroyer() -// ----------------------------------------------------------------------------- -// -CBTServiceDelayedDestroyer::CBTServiceDelayedDestroyer(CActive::TPriority aPriority) - : CActive(aPriority), iPtr(NULL) - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::CBTServiceDelayedDestroyer()")); - CActiveScheduler::Add(this); - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::~CBTServiceDelayedDestroyer() -// ----------------------------------------------------------------------------- -// -CBTServiceDelayedDestroyer::~CBTServiceDelayedDestroyer() - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::Destructor()")); - if( iPtr ) - { - delete iPtr; - iPtr = NULL; - } - Cancel(); - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::GoActive() -// ----------------------------------------------------------------------------- -// -void CBTServiceDelayedDestroyer::GoActive() - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::GoActive()")); - if( !IsActive() ) - { - TRequestStatus* status = &iStatus; - iStatus = KRequestPending; - User::RequestComplete(status, KErrNone); - SetActive(); - } - else - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::GoActive(), Already active")); - } - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::SetDestructPointer() -// Must be called with GoActive, they are pairs, first call SetDestructPointer -// and then GoActive. -// ----------------------------------------------------------------------------- -// -void CBTServiceDelayedDestroyer::SetDestructPointer(CBTEngDiscovery* aPtr) - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::SetDestructPointer()")); - if( iPtr ) - { - // If previous is not deleted yet, meaning, RunL is not called yet, - // we can safely delete previous here. - delete iPtr; - } - iPtr = aPtr; - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::DoCancel() -// ----------------------------------------------------------------------------- -// -void CBTServiceDelayedDestroyer::DoCancel() - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::DoCancel()")); - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::RunL() -// ----------------------------------------------------------------------------- -// -void CBTServiceDelayedDestroyer::RunL() - { - FLOG(_L("[BTSU]\t CBTServiceDelayedDestroyer::RunL()")); - delete iPtr; - iPtr = NULL; - } - -// ----------------------------------------------------------------------------- -// CBTServiceDelayedDestroyer::RunError() -// ----------------------------------------------------------------------------- -// -TInt CBTServiceDelayedDestroyer::RunError(TInt aError) - { - FTRACE(FPrint(_L("[BTSU]\t CBTServiceStarter::RunError() aError = %d"), aError) ); - (void) aError; - return KErrNone; - } diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceParameterList.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceParameterList.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,571 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceStarter.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1058 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Service starter implementation -* -*/ - - - -// INCLUDE FILES -#include "BTServiceStarter.h" -#include "BTSUDebug.h" -#include "BTSOPPController.h" -#include "BTSBIPController.h" -#include "BTSBPPController.h" - -#include -#include -#include -#include - -// CONSTANTS - -// From BT SIG - Assigned numbers -const TUint KBTServiceOPPSending = 0x1105; -const TUint KBTServiceDirectPrinting = 0x1118; -const TUint KBTServiceImagingResponder = 0x111B; - -const TUint KBTProgressInterval = 1000000; - -const TUid KUidMsgTypeBt = {0x10009ED5}; -//todo need to find a suitable header to include. This is from obexutilslayer.h - -const TInt KMaxDesCLength = 256; - - -//_LIT(KSendingDialog,"com.nokia.hb.btdevicedialog/1.0"); - -_LIT(KLocFileName, "btdialogs_"); -_LIT(KPath, "z:/resource/qt/translations/"); - -_LIT(KFilesSentText, "txt_bt_dpophead_all_files_sent");//All files sent -_LIT(KDeviceText,"txt_bt_dpopinfo_sent_to_1"); -//_LIT(KNotConnectedText,"txt_bt_info_unable_to_connect_with_bluetooth"); -_LIT(KSendingFailedText,"txt_bt_dpophead_sending_failed"); - -// ============================ 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 ); - iDelayedDestroyer = CBTServiceDelayedDestroyer::NewL(CActive::EPriorityStandard); - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - iLocalisationInit = HbTextResolverSymbian::Init(KLocFileName, KPath); - 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 iDelayedDestroyer; - - 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; - } - } - - -// ----------------------------------------------------------------------------- -// 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 - { - //todo need to do the localisation here - _LIT(KConnectText, "Connecting..."); - iDialog->LaunchWaitDialogL(KConnectText); - - } - FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchWaitNoteL() completed")); - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::CancelWaitNote -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::CancelWaitNote() - { - FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote()")); - - if ( iDialog ) - { - iDialog->CancelWaitDialog(); - } - - FLOG(_L("[BTSU]\t CBTServiceStarter::CancelWaitNote() completed")); - } - - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::LaunchProgressNoteL -// ----------------------------------------------------------------------------- -// -//todo reusing the second param aTotalSize to aFileCount as it is no longer used check it being used in other places -void CBTServiceStarter::LaunchProgressNoteL( MBTServiceProgressGetter* aGetter, - TInt aFileCount) - { - FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL()")); - RBuf deviceName; - if ( iService != EBTPrintingService ) - { - iProgressGetter = aGetter; - CancelWaitNote(); - - if ( !iProgressDialogActive ) - { - // todo need to change the last parameter because we are now using the textmap id which is a string - // whether we replace it with that or remove the parameter is to be decided - iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( - KUidMsgTypeBt, 0 ); - - deviceName.CreateL(KMaxDesCLength); - - if ( iDevice->IsValidFriendlyName() ) - { - deviceName.Copy( iDevice->FriendlyName() ); - } - else - { - deviceName.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName())); - } - iDialog->LaunchProgressDialogL( this, aFileCount, - deviceName, KBTProgressInterval ); - deviceName.Close(); - } - iProgressDialogActive=ETrue; - } - - FLOG(_L("[BTSU]\t CBTServiceStarter::LaunchProgressNoteL() completed")); - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::UpdateProgressNoteL -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::UpdateProgressNoteL(TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) - { - - iDialog->UpdateProgressNoteL(aFileSize,aFileIndex,aFileName); - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::CancelProgressNote -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::CancelProgressNote() - { - FLOG(_L("[BTSU]\t CBTServiceStarter::CancelProgressNote()")); - - if ( iDialog ) - { - iDialog->CancelProgressDialog(); - } - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::DialogDismissed -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::DialogDismissed(TInt aButtonId ) - { - FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed()")); - if( aButtonId == ECancelButton ) - { // this condition is hit for the progress dialog and connecting dialog cancel - FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDissmissed(), cancelled by user")); - iUserCancel=ETrue; - if ( iController ) - { - iController->Abort(); - } - else - { - StopTransfer(KErrCancel); - } - } - else if ( aButtonId == ENoButton ) - { - // user abortion - // - iUserCancel = ETrue; - StopTransfer( KErrCancel ); - CancelWaitNote(); - } - else //EYesButton - {// this condition is hit when user is ok with sending the unsupported images - iController->SendUnSupportedFiles(); - } - FLOG(_L("[BTSU]\t CBTServiceStarter::DialogDismissed() completed")); - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::ShowErrorNote -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::ShowErrorNote( TInt aReason ) const - { - FLOG(_L("[BTSU]\t CBTServiceStarter::ShowErrorNote()")); - - TBuf buf; - TPtrC sendTextMapId; - - if ( iDevice->IsValidFriendlyName() ) - { - buf.Copy( iDevice->FriendlyName() ); - } - else - { - TRAP_IGNORE( buf.Copy( BTDeviceNameConverter::ToUnicodeL(iDevice->DeviceName()))); - } - - - switch ( aReason ) - { - case EBTSNoError: - { - sendTextMapId.Set(KFilesSentText()); - break; - } - case EBTSConnectingFailed: - case EBTSGettingFailed: - case EBTSPuttingFailed: - case EBTSNoSuitableProfiles: - //todo below three enums are not valid and it is not being used at anywhere do we need to have it - -// case EBTSBIPSomeSend: -// case EBTSBIPOneNotSend: -// case EBTSBIPNoneSend: - default: - { - sendTextMapId.Set(KSendingFailedText()); - break; - } - } - - - if(iLocalisationInit) - { - TRAP_IGNORE( - HBufC* sendText = HbTextResolverSymbian::LoadLC(sendTextMapId); - HBufC* deviceName = HbTextResolverSymbian::LoadLC(KDeviceText,buf); - CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, deviceName->Des(), sendText->Des()); - CleanupStack::PopAndDestroy( deviceName ); - CleanupStack::PopAndDestroy( sendText ); - ); - } - else - { - TRAP_IGNORE(CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC, KDeviceText(), sendTextMapId)); - } - FLOG(_L("[BTSU]\t CBTServiceStarter::ShowErrorNote() completed")); - } - - - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::LaunchConfirmationQuery -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::LaunchConfirmationQuery(const TDesC& aConfirmText) - { - TRAP_IGNORE(iDialog->LaunchQueryDialogL(aConfirmText )); - } - -// ----------------------------------------------------------------------------- -// CBTServiceStarter::StopTransfer -// ----------------------------------------------------------------------------- -// -void CBTServiceStarter::StopTransfer(TInt aError) - { - - FLOG(_L("[BTSU]\t CBTServiceStarter::StopTransfer()")); - Cancel(); - if( !iUserCancel ) - { - CancelWaitNote(); - CancelProgressNote(); - - if ( aError != KErrCancel ) - { - ShowErrorNote( 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 || aErr==KErrNone) && 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 if (aErr==KErrNone && aAttr.Count()==0) - { - // This isn't KErrEof so we aren't done yet, wait for further matches - } - else - { - // Set destroyer AO active (destroys CBTEngDiscovery/CBTEngSdpQuery classes). This is done - // to ensure that CBTEngDiscovery/CBTEngSdpQuery classes have finished all their activities, - // callbacks etc.. Destructing it self is handled in CBTServiceDelayedDestroyer's RunL. - iDelayedDestroyer->SetDestructPointer(iBTEngDiscovery); - iDelayedDestroyer->GoActive(); - // Set iBTEngDiscovery pointer to zero. Pointer doesn't exist CBTServiceStarter point of view anymore. - 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; - } - - - - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceUtils.cpp --- a/btobexprofiles/obexsendservices/obexservicesendutils/src/BTServiceUtils.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexsendservices/rom/obexservicesendutils.iby --- a/btobexprofiles/obexsendservices/rom/obexservicesendutils.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/BWINS/obexusbapiU.DEF --- a/btobexprofiles/obexserviceman/BWINS/obexusbapiU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/cenrep/keys_obexserviceman.xls Binary file btobexprofiles/obexserviceman/cenrep/keys_obexserviceman.xls has changed diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/conf/obexserviceman.confml Binary file btobexprofiles/obexserviceman/conf/obexserviceman.confml has changed diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/conf/obexserviceman_20016BC5.crml Binary file btobexprofiles/obexserviceman/conf/obexserviceman_20016BC5.crml has changed diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/eabi/obexusbapiu.DEF --- a/btobexprofiles/obexserviceman/eabi/obexusbapiu.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _ZN8CObexUSB17ManageUSBServicesEiR14TRequestStatus @ 1 NONAME - _ZN8CObexUSB23CancelManageUSBServicesEv @ 2 NONAME - _ZN8CObexUSB4NewLEv @ 3 NONAME - _ZTI8CObexUSB @ 4 NONAME ; ## - _ZTV8CObexUSB @ 5 NONAME ; ## - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/group/backup_registration.xml --- a/btobexprofiles/obexserviceman/group/backup_registration.xml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/group/bld.inf --- a/btobexprofiles/obexserviceman/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* 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) - - -#include "../utils/group/bld.inf" - -#include "../plugins/group/bld.inf" - - - - - - - - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/group/obexserviceman.mmp --- a/btobexprofiles/obexserviceman/group/obexserviceman.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/group/obexservicemanclient.mmp --- a/btobexprofiles/obexserviceman/group/obexservicemanclient.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/group/obexusbapi.mmp --- a/btobexprofiles/obexserviceman/group/obexusbapi.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/inc/obexservicemanprivatecrkeys.h --- a/btobexprofiles/obexserviceman/inc/obexservicemanprivatecrkeys.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/data/0x101F7C88.rss --- a/btobexprofiles/obexserviceman/obexservicemanclient/data/0x101F7C88.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMPlugin.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMPlugin.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMRequester.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/ObexSMRequester.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/debug.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/debugconfig.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/debugconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/obexsmclient.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/obexsmclient.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/prjconfig.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/prjconfig.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/usbclientwrapper.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/usbclientwrapper.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/inc/usbobex.h --- a/btobexprofiles/obexserviceman/obexservicemanclient/inc/usbobex.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMClient.cpp --- a/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMClient.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMPlugin.cpp --- a/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMPlugin.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMRequester.cpp --- a/btobexprofiles/obexserviceman/obexservicemanclient/src/ObexSMRequester.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/src/usbclientwrapper.cpp --- a/btobexprofiles/obexserviceman/obexservicemanclient/src/usbclientwrapper.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanclient/src/usbobex.cpp --- a/btobexprofiles/obexserviceman/obexservicemanclient/src/usbobex.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/bwins/SrcsClientU.DEF --- a/btobexprofiles/obexserviceman/obexservicemanserver/bwins/SrcsClientU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/eabi/SrcsClientu.DEF --- a/btobexprofiles/obexserviceman/obexservicemanserver/eabi/SrcsClientu.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsClSv.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsClSv.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsMessage.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsMessage.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSecurityPolicy.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSecurityPolicy.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsServiceManager.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* 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 ServiceArrayL(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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSession.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsSession.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/SrcsTransport.inl Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/debug.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/obexserviceman.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexserviceman.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexservicemanprop.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: - * 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/inc/obexsm.h --- a/btobexprofiles/obexserviceman/obexservicemanserver/inc/obexsm.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsMessage.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsMessage.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsServiceManager.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,372 +0,0 @@ -/* -* 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); - ServiceArrayL(*iBTConnectionArray, aState); - break; - case ESrcsTransportUSB: - FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(USB)")); - iTransportName.Set(KSrcsTransportUSB); - ServiceArrayL(*iUSBConnectionArray, aState); - break; - case ESrcsTransportIrDA: - FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(IrDA)")); - iTransportName.Set(KSrcsTransportIrDA); - ServiceArrayL(*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::ServiceArrayL(CArrayPtr &aTransport, TBool aState) - { - FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ServiceArrayL")); - - // 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. todo (from reviewing): memory leak when some func above leaves. To be fixed - 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsSession.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/SrcsSession.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,502 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/src/obexsm.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/obexsm.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/obexservicemanserver/src/obexsmmain.cpp --- a/btobexprofiles/obexserviceman/obexservicemanserver/src/obexsmmain.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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) - { - //TODO uncomment UHEAP macros after orbit memory leaks are resolved till then it should be commented. -// __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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/group/bld.inf --- a/btobexprofiles/obexserviceman/plugins/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/group/obexservicemanbt.mmp --- a/btobexprofiles/obexserviceman/plugins/group/obexservicemanbt.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/group/obexservicemanir.mmp --- a/btobexprofiles/obexserviceman/plugins/group/obexservicemanir.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/group/obexservicemanusb.mmp --- a/btobexprofiles/obexserviceman/plugins/group/obexservicemanusb.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/bt/debug.h --- a/btobexprofiles/obexserviceman/plugins/inc/bt/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/bt/obexsmbtconnection.h --- a/btobexprofiles/obexserviceman/plugins/inc/bt/obexsmbtconnection.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/bt/obexsmpasskey.h --- a/btobexprofiles/obexserviceman/plugins/inc/bt/obexsmpasskey.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/ir/debug.h --- a/btobexprofiles/obexserviceman/plugins/inc/ir/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/ir/obexsmirdaconnection.h --- a/btobexprofiles/obexserviceman/plugins/inc/ir/obexsmirdaconnection.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/usb/debug.h --- a/btobexprofiles/obexserviceman/plugins/inc/usb/debug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/inc/usb/obexsmusbconnection.h --- a/btobexprofiles/obexserviceman/plugins/inc/usb/obexsmusbconnection.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/bt/101f7c9d.rss --- a/btobexprofiles/obexserviceman/plugins/src/bt/101f7c9d.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/bt/obexsmbtconnection.cpp --- a/btobexprofiles/obexserviceman/plugins/src/bt/obexsmbtconnection.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,295 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/bt/obexsmpasskey.cpp --- a/btobexprofiles/obexserviceman/plugins/src/bt/obexsmpasskey.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/bt/proxy.cpp --- a/btobexprofiles/obexserviceman/plugins/src/bt/proxy.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/ir/101F9695.rss --- a/btobexprofiles/obexserviceman/plugins/src/ir/101F9695.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/ir/obexsmirdaconnection.cpp --- a/btobexprofiles/obexserviceman/plugins/src/ir/obexsmirdaconnection.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/ir/proxy.cpp --- a/btobexprofiles/obexserviceman/plugins/src/ir/proxy.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/usb/101F9693.rss --- a/btobexprofiles/obexserviceman/plugins/src/usb/101F9693.rss Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp --- a/btobexprofiles/obexserviceman/plugins/src/usb/obexsmusbconnection.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/plugins/src/usb/proxy.cpp --- a/btobexprofiles/obexserviceman/plugins/src/usb/proxy.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/ObexUtils.iby --- a/btobexprofiles/obexserviceman/rom/ObexUtils.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* 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 -data=/epoc32/data/z/resource/qt/translations/btdialogs_en_GB.qm resource/qt/translations/btdialogs_en_GB.qm - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/obex.iby --- a/btobexprofiles/obexserviceman/rom/obex.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* 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__ - -#include - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/obexserviceman.iby --- a/btobexprofiles/obexserviceman/rom/obexserviceman.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/obexservicemanbt.iby --- a/btobexprofiles/obexserviceman/rom/obexservicemanbt.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef __SRCSBT_IBY__ -#define __SRCSBT_IBY__ -//file content - -#ifdef __BT - -ECOM_PLUGIN(obexservicemanbt.dll,101F7C9D.rsc) - -#endif - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/obexservicemanirda.iby --- a/btobexprofiles/obexserviceman/rom/obexservicemanirda.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __SRCSIRDA_IBY__ -#define __SRCSIRDA_IBY__ - -#ifdef __IRDA -ECOM_PLUGIN(obexservicemanir.dll, 101F9695.rsc) -#endif - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/rom/obexservicemanusb.iby --- a/btobexprofiles/obexserviceman/rom/obexservicemanusb.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#ifndef __SRCSUSB_IBY__ -#define __SRCSUSB_IBY__ -//file content - -#ifdef __USB -ECOM_PLUGIN(obexservicemanusb.dll,101F9693.rsc) -#endif - -#endif diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF --- a/btobexprofiles/obexserviceman/utils/bwins/OBEXUTILSU.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -EXPORTS - ?GetCenRepKeyIntValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAH@Z @ 1 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyIntValueL(class TUid, unsigned long, int &) - ?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) - ?CreateReceiveBufferAndRFileL@TObexUtilsMessageHandler@@SAHAAVRFile@@ABVTDesC16@@AAV?$TBuf@$0BAA@@@AAPAVCBufFlat@@H@Z @ 4 NONAME ; int TObexUtilsMessageHandler::CreateReceiveBufferAndRFileL(class RFile &, class TDesC16 const &, class TBuf<256> &, class CBufFlat * &, int) - ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@@Z @ 5 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &) - ?CreateDefaultMtmServiceL@TObexUtilsMessageHandler@@SAXVTUid@@@Z @ 6 NONAME ; void TObexUtilsMessageHandler::CreateDefaultMtmServiceL(class TUid) - ?GetCenRepKeyStringValueL@TObexUtilsMessageHandler@@SAHVTUid@@KAAVTDes16@@@Z @ 7 NONAME ; int TObexUtilsMessageHandler::GetCenRepKeyStringValueL(class TUid, unsigned long, class TDes16 &) - ?GetMmcFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 8 NONAME ; int TObexUtilsMessageHandler::GetMmcFileSystemStatus(void) - ?GetPubSubKeyIntValue@TObexUtilsMessageHandler@@SAHVTUid@@IAAH@Z @ 9 NONAME ; int TObexUtilsMessageHandler::GetPubSubKeyIntValue(class TUid, unsigned int, int &) - ?UpdateEntryAttachmentL@TObexUtilsMessageHandler@@SAXAAV?$TBuf@$0BAA@@@PAVCMsvEntry@@@Z @ 10 NONAME ; void TObexUtilsMessageHandler::UpdateEntryAttachmentL(class TBuf<256> &, class CMsvEntry *) - ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@ABVTDesC16@@@Z @ 11 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &, class TDesC16 const &) - ?AddEntryToInboxL@TObexUtilsMessageHandler@@SAXAAJAAV?$TBuf@$0BAA@@@PAV?$RArray@J@@@Z @ 12 NONAME ; void TObexUtilsMessageHandler::AddEntryToInboxL(long &, class TBuf<256> &, class RArray *) - ?RemoveTemporaryRFileL@TObexUtilsMessageHandler@@SAXABV?$TBuf@$0BAA@@@@Z @ 13 NONAME ; void TObexUtilsMessageHandler::RemoveTemporaryRFileL(class TBuf<256> const &) - ?GetFileSystemStatus@TObexUtilsMessageHandler@@SAHXZ @ 14 NONAME ; int TObexUtilsMessageHandler::GetFileSystemStatus(void) - ?DeleteOutboxEntryL@TObexUtilsMessageHandler@@SAXABJ@Z @ 15 NONAME ; void TObexUtilsMessageHandler::DeleteOutboxEntryL(long const &) - ?SaveFileToFileSystemL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAV?$TBuf@$0BAA@@@AAVRFile@@ABVTDesC16@@@Z @ 16 NONAME ; void TObexUtilsMessageHandler::SaveFileToFileSystemL(class CObexBufObject * &, class TUid, long &, class TBuf<256> &, class RFile &, class TDesC16 const &) - ?CreateOutboxEntryL@TObexUtilsMessageHandler@@SAJABVTUid@@ABH@Z @ 17 NONAME ; long TObexUtilsMessageHandler::CreateOutboxEntryL(class TUid const &, int const &) - ?CreateInboxAttachmentL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@VTUid@@AAJAAVRFile@@@Z @ 18 NONAME ; void TObexUtilsMessageHandler::CreateInboxAttachmentL(class CObexBufObject * &, class TUid, long &, class RFile &) - ?GetMessageCentreDriveL@TObexUtilsMessageHandler@@SAHXZ @ 19 NONAME ; int TObexUtilsMessageHandler::GetMessageCentreDriveL(void) - ?SaveObjToInboxL@TObexUtilsMessageHandler@@SAXAAPAVCObexBufObject@@AAVRFile@@J@Z @ 20 NONAME ; void TObexUtilsMessageHandler::SaveObjToInboxL(class CObexBufObject * &, class RFile &, long) - ?NewL@CObexUtilsPropertyNotifier@@SAPAV1@PAVMObexUtilsPropertyNotifyHandler@@W4TMemoryPropertyCheckType@@@Z @ 21 NONAME ; class CObexUtilsPropertyNotifier * CObexUtilsPropertyNotifier::NewL(class MObexUtilsPropertyNotifyHandler *, enum TMemoryPropertyCheckType) - ?IsString@CObexUtilsOpaqueData@@QAEHXZ @ 22 NONAME ; int CObexUtilsOpaqueData::IsString(void) - ?GetNumber@CObexUtilsOpaqueData@@QAEHAAI@Z @ 23 NONAME ; int CObexUtilsOpaqueData::GetNumber(unsigned int &) - ??0CObexUtilsOpaqueData@@QAE@ABVTDesC8@@@Z @ 24 NONAME ; CObexUtilsOpaqueData::CObexUtilsOpaqueData(class TDesC8 const &) - ?GetString@CObexUtilsOpaqueData@@QAEHAAV?$TBuf8@$0BAA@@@@Z @ 25 NONAME ; int CObexUtilsOpaqueData::GetString(class TBuf8<256> &) - ?LaunchQueryDialogL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 26 NONAME ; void CObexUtilsDialog::LaunchQueryDialogL(class TDesC16 const &) - ?ShowErrorNoteL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 27 NONAME ; void CObexUtilsDialog::ShowErrorNoteL(class TDesC16 const &) - ?NewL@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 28 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewL(class MObexUtilsDialogObserver *) - ?UpdateProgressNoteL@CObexUtilsDialog@@QAEXHHABVTDesC16@@@Z @ 29 NONAME ; void CObexUtilsDialog::UpdateProgressNoteL(int, int, class TDesC16 const &) - ?CancelWaitDialog@CObexUtilsDialog@@QAEXXZ @ 30 NONAME ; void CObexUtilsDialog::CancelWaitDialog(void) - ?LaunchWaitDialogL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 31 NONAME ; void CObexUtilsDialog::LaunchWaitDialogL(class TDesC16 const &) - ?CancelProgressDialog@CObexUtilsDialog@@QAEXXZ @ 32 NONAME ; void CObexUtilsDialog::CancelProgressDialog(void) - ?LaunchProgressDialogL@CObexUtilsDialog@@QAEXPAVMObexUtilsProgressObserver@@HABVTDesC16@@H@Z @ 33 NONAME ; void CObexUtilsDialog::LaunchProgressDialogL(class MObexUtilsProgressObserver *, int, class TDesC16 const &, int) - ??1CObexUtilsDialog@@UAE@XZ @ 34 NONAME ; CObexUtilsDialog::~CObexUtilsDialog(void) - ?UpdateProgressDialogL@CObexUtilsDialog@@QAEXH@Z @ 35 NONAME ; void CObexUtilsDialog::UpdateProgressDialogL(int) - ?ShowInformationNoteL@CObexUtilsDialog@@QAEXABVTDesC16@@@Z @ 36 NONAME ; void CObexUtilsDialog::ShowInformationNoteL(class TDesC16 const &) - ?NewLC@CObexUtilsDialog@@SAPAV1@PAVMObexUtilsDialogObserver@@@Z @ 37 NONAME ; class CObexUtilsDialog * CObexUtilsDialog::NewLC(class MObexUtilsDialogObserver *) - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF --- a/btobexprofiles/obexserviceman/utils/eabi/obexutilsu.DEF Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -EXPORTS - _ZN24TObexUtilsMessageHandler15SaveObjToInboxLEP14CObexBufObjectRK7TDesC164TUid @ 1 NONAME - _ZN24TObexUtilsMessageHandler15SaveObjToInboxLERP14CObexBufObjectR5RFilel @ 2 NONAME - _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EE @ 3 NONAME - _ZN24TObexUtilsMessageHandler16AddEntryToInboxLERlR4TBufILi256EEP6RArrayIlE @ 4 NONAME - _ZN24TObexUtilsMessageHandler18CreateOutboxEntryLERK4TUidRKi @ 5 NONAME - _ZN24TObexUtilsMessageHandler18DeleteOutboxEntryLERKl @ 6 NONAME - _ZN24TObexUtilsMessageHandler19GetFileSystemStatusEv @ 7 NONAME - _ZN24TObexUtilsMessageHandler19RemoveInboxEntriesLERP14CObexBufObjectl @ 8 NONAME - _ZN24TObexUtilsMessageHandler20GetPubSubKeyIntValueE4TUidjRi @ 9 NONAME - _ZN24TObexUtilsMessageHandler21GetCenRepKeyIntValueLE4TUidmRi @ 10 NONAME - _ZN24TObexUtilsMessageHandler21RemoveTemporaryRFileLERK4TBufILi256EE @ 11 NONAME - _ZN24TObexUtilsMessageHandler21SaveFileToFileSystemLERP14CObexBufObject4TUidRlR4TBufILi256EER5RFileRK7TDesC16 @ 12 NONAME - _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFile @ 13 NONAME - _ZN24TObexUtilsMessageHandler22CreateInboxAttachmentLERP14CObexBufObject4TUidRlR5RFileRK7TDesC16 @ 14 NONAME - _ZN24TObexUtilsMessageHandler22GetMessageCentreDriveLEv @ 15 NONAME - _ZN24TObexUtilsMessageHandler22GetMmcFileSystemStatusEv @ 16 NONAME - _ZN24TObexUtilsMessageHandler22UpdateEntryAttachmentLER4TBufILi256EEP9CMsvEntry @ 17 NONAME - _ZN24TObexUtilsMessageHandler24CreateDefaultMtmServiceLE4TUid @ 18 NONAME - _ZN24TObexUtilsMessageHandler24GetCenRepKeyStringValueLE4TUidmR6TDes16 @ 19 NONAME - _ZN24TObexUtilsMessageHandler28CreateReceiveBufferAndRFileLER5RFileRK7TDesC16R4TBufILi256EERP8CBufFlati @ 20 NONAME - _ZN26CObexUtilsPropertyNotifier4NewLEP31MObexUtilsPropertyNotifyHandler24TMemoryPropertyCheckType @ 21 NONAME - _ZN20CObexUtilsOpaqueData8IsStringEv @ 22 NONAME - _ZN20CObexUtilsOpaqueData9GetNumberERj @ 23 NONAME - _ZN20CObexUtilsOpaqueData9GetStringER5TBuf8ILi256EE @ 24 NONAME - _ZN20CObexUtilsOpaqueDataC1ERK6TDesC8 @ 25 NONAME - _ZN20CObexUtilsOpaqueDataC2ERK6TDesC8 @ 26 NONAME - _ZN16CObexUtilsDialog14ShowErrorNoteLERK7TDesC16 @ 27 NONAME - _ZN16CObexUtilsDialog16CancelWaitDialogEv @ 28 NONAME - _ZN16CObexUtilsDialog17LaunchWaitDialogLERK7TDesC16 @ 29 NONAME - _ZN16CObexUtilsDialog18LaunchQueryDialogLERK7TDesC16 @ 30 NONAME - _ZN16CObexUtilsDialog19UpdateProgressNoteLEiiRK7TDesC16 @ 31 NONAME - _ZN16CObexUtilsDialog20CancelProgressDialogEv @ 32 NONAME - _ZN16CObexUtilsDialog20ShowInformationNoteLERK7TDesC16 @ 33 NONAME - _ZN16CObexUtilsDialog21LaunchProgressDialogLEP26MObexUtilsProgressObserveriRK7TDesC16i @ 34 NONAME - _ZN16CObexUtilsDialog21UpdateProgressDialogLEi @ 35 NONAME - _ZN16CObexUtilsDialog4NewLEP24MObexUtilsDialogObserver @ 36 NONAME - _ZN16CObexUtilsDialog5NewLCEP24MObexUtilsDialogObserver @ 37 NONAME - _ZN16CObexUtilsDialogD0Ev @ 38 NONAME - _ZN16CObexUtilsDialogD1Ev @ 39 NONAME - _ZN16CObexUtilsDialogD2Ev @ 40 NONAME - diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/group/bld.inf --- a/btobexprofiles/obexserviceman/utils/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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: -* This file provides the information required for building the -* whole of a Obexutils. -* -*/ - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/obexutilsdialog.h |../../../inc/obexutilsdialog.h -../inc/obexutilspropertynotifier.h |../../../inc/obexutilspropertynotifier.h - -// todo need to remove below line of code and also the loc folder -// once the localisation files are avaialble and in place in epoc32 - -../loc/btdialogs_en_GB.qm /epoc32/data/z/resource/qt/translations/btdialogs_en_GB.qm - -PRJ_MMPFILES -obexutils.mmp - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/group/obexutils.mmp --- a/btobexprofiles/obexserviceman/utils/group/obexutils.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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: -* Constructs obexutils.dll -* -* -*/ - - -#include -#include - -TARGET obexutils.dll -TARGETTYPE dll -UID 0x10004262 0x101F86AF -VENDORID VID_DEFAULT - -OS_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc -NON_FOUNDATION_ADAPT_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src -SOURCE obexutilsdialogtimer.cpp -SOURCE obexutilsdialog.cpp -SOURCE obexutilsmessagehandler.cpp -SOURCE obexutilspropertynotifier.cpp -SOURCE obexutilsopaquedata.cpp -SOURCE obexutilsentryhandler.cpp -SOURCE updatemusiccollection.cpp -#ifdef __BT_SAP -SOURCE vMessageHandler.cpp -#endif - -SYSTEMINCLUDE ../../../inc ../../../../inc -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore -#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 bafl.lib -LIBRARY bifu.lib -LIBRARY biodb.lib -LIBRARY charconv.lib -LIBRARY efsrv.lib -LIBRARY etext.lib -LIBRARY euser.lib -LIBRARY irobex.lib -LIBRARY msgs.lib -LIBRARY centralrepository.lib -LIBRARY platformenv.lib -LIBRARY mpxcollectionhelper.lib -LIBRARY mpxplaybackutility.lib -LIBRARY hbcore.lib -LIBRARY HbWidgets.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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilsdebug.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsdebug.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsdialog.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +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 COBEXUTILSDIALOG_H -#define COBEXUTILSDIALOG_H - -#include - -#include -#include -#include -#include - -class CObexUtilsDialogTimer; - -enum TButtonId - { - ECancelButton = -1, - EYesButton, - ENoButton - }; -/** -* 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 - * todo check whether the parameter is required - * @param aButtonId The button that was used to dismiss the dialog. - */ - virtual void DialogDismissed(TInt aButtonId) = 0; //TInt aButtonId - }; - - -// CLASS DECLARATION - -/** -* A class for launching and managing dialogs. -*/ -NONSHARABLE_CLASS( CObexUtilsDialog ) : public CBase, - public MHbDeviceProgressDialogObserver, - public MHbDeviceDialogObserver, - public MHbDeviceMessageBoxObserver - { - 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. - * @param aObserverPtr A pointer to progress observer. A NULL pointer if - the progress dialog is updated manually. - * @param aFileCount Total number of files to be sent. - * @param aDeviceName Device Name to which files to be sent. - * @param aTimeoutValue A value telling how often should the dialog be - updated. Relevant only if observer is given. - */ - IMPORT_C void LaunchProgressDialogL( - MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, - const TDesC& aDeviceName, TInt aTimeoutValue ); - - /** - * Updates the progress dialog with new file information when multiples files are sent. - * @param aFileSize Size of the file to be sent - * @param aFileIndex Index of the file to be sent - * @param aFileName Name of the file to be sent. - */ - IMPORT_C void UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ); - - /** - * Launches a wait dialog. - * @param aDisplayText Text that needs to be displayed. - */ - IMPORT_C void LaunchWaitDialogL( const TDesC& aDisplayText ); - - /** - * Cancels a wait dialog if one exists. - * @since 2.6 - * @return None. - */ - IMPORT_C void CancelWaitDialog(); - - /** - * Cancels a wait progress dialog if one exists. - * @since 2.6 - * @return None. - */ - IMPORT_C void CancelProgressDialog(); - - /** - * Updates a progress dialog with the latest progress value - * @param aValue A progress value relative to final value. - * @return None - */ - IMPORT_C void UpdateProgressDialogL( TInt aProgressValue ); - - /** - * Show a query note - * @param aConfirmText text for the note. - * @return None - */ - IMPORT_C void LaunchQueryDialogL( const TDesC& aConfirmText ); - - /** - * Shows an error note. - * @param aTextId A resource id for the note. - * @return None. - */ - IMPORT_C void ShowErrorNoteL( const TDesC& aErrorText ); - - /** - * Shows an information note. - * @param aTextId A resource id for the note. - * @return None. - */ - IMPORT_C void ShowInformationNoteL( const TDesC& aInfoText ); - - public: // New functions (not exported) - - /** - * Updates the progress dialog. - * @return None. - */ - void UpdateProgressDialog(); - - private: // Functions from base classes - - /** - * From MHbDeviceProgressDialogObserver called when dialog is closed by pressing the "cancel" button - * @param aDialog Pointer to dialog that was cancelled. - * @return None. - */ - void ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog); - - /** - * From MHbDeviceProgressDialogObserver called when a device progress dialog is has closed - * @param aDialog Pointer to dialog instance that has closed. - * @return None. - */ - void ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog ) ; - - /** - * From MHbDeviceDialogObserver called when data is received from a device dialog - * @param aDialog Pointer to dialog instance that has closed. - * @return None. - */ - void DataReceived(CHbSymbianVariantMap& aData); - - /** - * From MHbDeviceDialogObserver called when a device dialog is closed - * @param aData contains data from the dialog plugin. - * @return None. - */ - void DeviceDialogClosed(TInt aCompletionCode); - - /** - * from base class MHbDeviceMessageBoxObserver - * @param aMessageBox Pointer to dialog instance that has closed. - * @param aButton the id of the button the user pressed - */ - void MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, - CHbDeviceMessageBoxSymbian::TButtonId aButton); - - private: - - /** - * C++ default constructor. - */ - CObexUtilsDialog( MObexUtilsDialogObserver* aObserverPtr ); - - /** - * By default Symbian OS constructor is private. - */ - void ConstructL(); - - /** - * Add a data item into the given CHbSymbianVariantMap. - * @param aMap the instance to which the data item will be added. - * @param aKey the key of the data item. - * @param aData the value of the data item - * @param aDataType the data-type of the data item - */ - void AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, - const TAny* aData, CHbSymbianVariant::TType aDataType); - - /** - * Creates and shows a message box. - * @param aType the type of the message box to create. - * @param aText the text to be shown in the message box - * @param aObserver the observer that receives the events from the - * message box - * @param aTimeout the timeout value of the message box - */ - CHbDeviceMessageBoxSymbian* CreateAndShowMessageBoxL( - CHbDeviceMessageBoxSymbian::TType aType, - const TDesC& aText, - MHbDeviceMessageBoxObserver* aObserver, - TInt aTimeout ); - - private: // Data - - CHbDeviceDialogSymbian *iProgressDialog; - CHbDeviceProgressDialogSymbian* iWaitDialog; - CHbDeviceMessageBoxSymbian* iMessageBox; - - CObexUtilsDialogTimer* iObexDialogTimer; - TInt iFileIndex; - TInt iFileCount; - RBuf iDeviceName; - - // Not Owned - // - MObexUtilsProgressObserver* iProgressObserverPtr; - MObexUtilsDialogObserver* iDialogObserverPtr; - }; - -#endif // COBEXUTILSDIALOG_H - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilsdialogtimer.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsdialogtimer.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsentryhandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* 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 ); - - - // 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(); - - -private: // member data - - - /** - * Sync waiter object - */ - CActiveSchedulerWait iSyncWaiter; - - -}; - - -#endif /*OBEXUTILSENTRYHANDLER_H_*/ diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilsopaquedata.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilsopaquedata.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/obexutilspropertynotifier.h --- a/btobexprofiles/obexserviceman/utils/inc/obexutilspropertynotifier.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/updatemusiccollection.h --- a/btobexprofiles/obexserviceman/utils/inc/updatemusiccollection.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/inc/vMessageHandler.h --- a/btobexprofiles/obexserviceman/utils/inc/vMessageHandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/loc/btdialogs_en_GB.qm Binary file btobexprofiles/obexserviceman/utils/loc/btdialogs_en_GB.qm has changed diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsdialog.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,472 +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 FILES -#include "obexutilsdialog.h" -#include "obexutilsdialogtimer.h" -#include "obexutilsdebug.h" -#include -#include -#include - -_LIT(KSendingDialog, "com.nokia.hb.btdevicedialog/1.0"); -_LIT(KCurrentFileIndex,"currentFileIdx" ); -_LIT(KTotalFileCount, "totalFilesCnt"); -_LIT(KDestinationName, "destinationName"); -_LIT(KFileName,"fileName"); -_LIT(KFileSizeTxt,"fileSzTxt"); -_LIT(KFileSize,"fileSz"); -_LIT(KProgressValue,"progressValue"); - -_LIT(KSendingCancelledText, "txt_bt_dpophead_sending_cancelled"); -_LIT(KDeviceText,"txt_bt_dpopinfo_sent_to_1"); - -const TInt KMaxDescriptionLength = 256; -const TInt KMinStringSize = 10; -const TInt KMinFileSize = 1024; - -_LIT(KLocFileName, "btdialogs_"); -_LIT(KPath, "z:/resource/qt/translations/"); - -// ============================ 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); - } - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::ConstructL() completed")); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -EXPORT_C CObexUtilsDialog::~CObexUtilsDialog() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog()")); - iDeviceName.Close(); - delete iWaitDialog; - delete iProgressDialog; - delete iObexDialogTimer; - delete iMessageBox; - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::~CObexUtilsDialog() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::LaunchProgressDialogL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::LaunchProgressDialogL( - MObexUtilsProgressObserver* aObserverPtr, TInt aFileCount, - const TDesC& aDeviceName, TInt aTimeoutValue ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL()")); - - TBuf key; - if ( aObserverPtr ) - { - // The observerPtr was given, so store it and start a timer - // - iProgressObserverPtr = aObserverPtr; - - if ( !iObexDialogTimer ) - { - iObexDialogTimer = CObexUtilsDialogTimer::NewL( this ); - } - iObexDialogTimer->Cancel(); - iObexDialogTimer->SetTimeout( aTimeoutValue ); - } - - iFileCount = aFileCount; - iDeviceName.Close(); - iDeviceName.CreateL(aDeviceName); - iProgressDialog = CHbDeviceDialogSymbian::NewL(); - - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - TInt data = TBluetoothDialogParams::ESend; - key.Num(TBluetoothDialogParams::EDialogType); - AddDataL( map, key, &data, CHbSymbianVariant::EInt ); - User::LeaveIfError(iProgressDialog->Show(KSendingDialog(),*map,this)); - CleanupStack::PopAndDestroy(map); - - if ( iProgressObserverPtr ) - { - iObexDialogTimer->Tickle(); - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchProgressDialogL() completed")); - } - - -EXPORT_C void CObexUtilsDialog::UpdateProgressNoteL( TInt aFileSize,TInt aFileIndex, const TDesC& aFileName ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressNoteL()")); - HBufC* key = HBufC::NewL(KMaxDescriptionLength); - CleanupStack::PushL(key); - - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - - iFileIndex = aFileIndex+1; - key->Des().Copy(KCurrentFileIndex()); - AddDataL( map, *key, &iFileIndex, CHbSymbianVariant::EInt ); - - key->Des().Copy(KTotalFileCount()); - AddDataL( map, *key, &iFileCount, CHbSymbianVariant::EInt ); - - key->Des().Copy(KDestinationName()); - AddDataL( map, *key, &iDeviceName, CHbSymbianVariant::EDes ); - - key->Des().Copy(KFileName()); - AddDataL( map, *key, &aFileName, CHbSymbianVariant::EDes ); - - // todo: localiation is needed for code below: - HBufC* value = HBufC::NewL(KMaxDescriptionLength); - CleanupStack::PushL(value); - key->Des().Copy(KFileSizeTxt()); - value->Des().Zero(); - if(aFileSize < KMinFileSize) - { - value->Des().AppendNum(aFileSize); - value->Des().Append(_L(" Bytes")); - } - else - { - TInt filesize = aFileSize/KMinFileSize; - value->Des().AppendNum(filesize); - value->Des().Append(_L(" KB")); - } - AddDataL( map, *key, value, CHbSymbianVariant::EDes ); - CleanupStack::PopAndDestroy( value ); - - key->Des().Copy(KFileSize()); - AddDataL( map, *key, &aFileSize, CHbSymbianVariant::EInt ); - TInt ret = iProgressDialog->Update(*map); - CleanupStack::PopAndDestroy(map); - CleanupStack::PopAndDestroy(key); - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressNoteL()Completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::LaunchWaitDialogL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::LaunchWaitDialogL( const TDesC& aDisplayText ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL()")); - - if ( iWaitDialog || iProgressDialog ) - { - // Allow only one dialog at a time - // - User::Leave( KErrInUse ); - } - iWaitDialog = CHbDeviceProgressDialogSymbian::NewL(CHbDeviceProgressDialogSymbian::EWaitDialog,this); - iWaitDialog->SetTextL(aDisplayText); - iWaitDialog->ShowL(); - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchWaitDialogL() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::CancelWaitDialogL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::CancelWaitDialog() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelWaitDialogL()")); - - if( iWaitDialog ) - { - iWaitDialog->Close(); - delete iWaitDialog; - iWaitDialog = NULL; - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelWaitDialogL() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::CancelProgressDialogL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::CancelProgressDialog() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL()")); - - if( iProgressDialog ) - { - iProgressDialog->Cancel(); - delete iProgressDialog; - iProgressDialog = NULL; - delete iObexDialogTimer; - iObexDialogTimer = NULL; - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::CancelProgressDialogL() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::UpdateProgressDialogL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::UpdateProgressDialogL( TInt aProgressValue ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL()")); - - if ( iProgressDialog ) - { - HBufC* key = HBufC::NewL(KMaxDescriptionLength); - CleanupStack::PushL(key); - - CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(map); - - key->Des().Copy(KProgressValue()); - AddDataL( map, *key, &aProgressValue, CHbSymbianVariant::EInt ); - - HBufC* value = HBufC::NewL(KMaxDescriptionLength); - CleanupStack::PushL(value); - key->Des().Copy(KCurrentFileIndex()); - value->Des().AppendNum(iFileIndex); - AddDataL( map, *key, value, CHbSymbianVariant::EDes ); - CleanupStack::PopAndDestroy(value); - - TInt ret = iProgressDialog->Update(*map); - - CleanupStack::PopAndDestroy(map); - CleanupStack::PopAndDestroy(key); - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialogL() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::UpdateProgressDialog -// ----------------------------------------------------------------------------- -void CObexUtilsDialog::UpdateProgressDialog() - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialog()")); - - TRAPD( ignoredError, UpdateProgressDialogL( - iProgressObserverPtr->GetProgressStatus()) ); - - if (ignoredError != KErrNone) - { - FLOG(_L("Ignore this error")); - } - - if ( iObexDialogTimer ) - { - iObexDialogTimer->Tickle(); - } - - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::UpdateProgressDialog() completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::LaunchQueryDialogL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CObexUtilsDialog::LaunchQueryDialogL( const TDesC& aConfirmText ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsDialog::LaunchQueryDialogL()")); - if ( iMessageBox ) - { - //todo: Already one dialog is displayed, currently not supported for - //multiple dialogs at the same time. - User::Leave( KErrGeneral ); - } - iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EQuestion, - aConfirmText, this, 0 ); - } - - -// ----------------------------------------------------------------------------- -// CObexUtilsUiDialog::ShowErrorNoteL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::ShowErrorNoteL( const TDesC& aTextId ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowErrorNoteL")); - if ( iMessageBox ) - { - //todo: Already one dialog is displayed, currently not supported for - //multiple dialogs at the same time. - User::Leave( KErrGeneral ); - } - iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EWarning, - aTextId, this, 0 ); - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowErrorNoteL completed")); - } - -// ----------------------------------------------------------------------------- -// CObexUtilsUiDialog::ShowInformationNoteL -// ----------------------------------------------------------------------------- -EXPORT_C void CObexUtilsDialog::ShowInformationNoteL( const TDesC& aTextId ) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowInformationNoteL")); - if ( iMessageBox ) - { - //todo: Already one dialog is displayed, currently not supported for - //multiple dialogs at the same time. - User::Leave( KErrGeneral ); - } - iMessageBox = CreateAndShowMessageBoxL( CHbDeviceMessageBoxSymbian::EInformation, - aTextId, this, 0 ); - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::ShowInformationNoteL completed")); - } - -void CObexUtilsDialog::ProgressDialogCancelled(const CHbDeviceProgressDialogSymbian* aDialog) - { - FLOG(_L("[BTSU]\t CObexUtilsDialog::ProgressDialogCancelled(), cancelled by user")); - (void) aDialog; - if ( iDialogObserverPtr ) - { - iDialogObserverPtr->DialogDismissed(ECancelButton); - } - delete iWaitDialog; - iWaitDialog = NULL; - } - -// ----------------------------------------------------------------------------- -// CObexUtilsDialog::MessageBoxClosed -// ----------------------------------------------------------------------------- -void CObexUtilsDialog::MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, - CHbDeviceMessageBoxSymbian::TButtonId aButton) - { - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::MessageBoxClosed")); - (void)aMessageBox; - delete iMessageBox; - iMessageBox = NULL; - if(iDialogObserverPtr) - { - //ETrue if user selects Yes, otherwise EFalse. - iDialogObserverPtr->DialogDismissed( - (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) ? - EYesButton : ENoButton ); - } - FLOG(_L("[OBEXUTILS]\t CObexUtilsUiDialog::MessageBoxClosed completed")); - } - -void CObexUtilsDialog::ProgressDialogClosed(const CHbDeviceProgressDialogSymbian* aDialog) - { - (void) aDialog; - } - -void CObexUtilsDialog::DataReceived(CHbSymbianVariantMap& aData) - { - (void) aData; - } - -void CObexUtilsDialog::DeviceDialogClosed(TInt aCompletionCode) - { - FLOG(_L("[BTSU]\t CObexUtilsDialog::DeviceDialogClosed()")); - (void) aCompletionCode; - - delete iObexDialogTimer; - iObexDialogTimer = NULL; - delete iProgressDialog; - iProgressDialog = NULL; - - TBool ok = HbTextResolverSymbian::Init(KLocFileName, KPath); - if(ok) - { - TRAP_IGNORE( - HBufC* deviceName = HbTextResolverSymbian::LoadLC(KDeviceText,iDeviceName); - HBufC* sendText = HbTextResolverSymbian::LoadLC(KSendingCancelledText); - CHbDeviceNotificationDialogSymbian::NotificationL( - KNullDesC, deviceName->Des(), sendText->Des()); - CleanupStack::PopAndDestroy( sendText ); - CleanupStack::PopAndDestroy( deviceName ); - ); - } - else - { - CHbDeviceNotificationDialogSymbian::NotificationL( - KNullDesC, KDeviceText(), KSendingCancelledText()); - } - if ( iDialogObserverPtr ) - { - iDialogObserverPtr->DialogDismissed(ECancelButton); - } - } - -void CObexUtilsDialog::AddDataL(CHbSymbianVariantMap* aMap, const TDesC& aKey, - const TAny* aData, CHbSymbianVariant::TType aDataType) - { - CHbSymbianVariant* value = CHbSymbianVariant::NewL(aData, aDataType); - CleanupStack::PushL( value ); - User::LeaveIfError( aMap->Add( aKey, value ) ); // aMap takes the ownership of value - CleanupStack::Pop( value ); - } - -CHbDeviceMessageBoxSymbian* CObexUtilsDialog::CreateAndShowMessageBoxL( - CHbDeviceMessageBoxSymbian::TType aType, - const TDesC& aText, MHbDeviceMessageBoxObserver* aObserver, - TInt aTimeout ) - { - CHbDeviceMessageBoxSymbian* messageBox = - CHbDeviceMessageBoxSymbian::NewL( aType ); - CleanupStack::PushL(messageBox); - //ToDo: Need to use localised strings. - messageBox->SetTextL(aText); - messageBox->SetObserver(aObserver); - messageBox->SetTimeout(aTimeout); - messageBox->ShowL(); - CleanupStack::Pop(messageBox); - return messageBox; - } - -// End of File diff -r 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilsdialogtimer.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsdialogtimer.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsentryhandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* -* 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, aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus);); - - 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(); - } - - -// --------------------------------------------------------------------------- -// 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsmessagehandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1608 +0,0 @@ -/* -* 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 "obexutilsdebug.h" -#include "obexutilsentryhandler.h" - -#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 ; - -// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) -const TUid KUidMsgTypeBt = {0x10009ED5}; - -const TInt KObexUtilsMaxCharToFromField = 256; - -const TInt32 KUidMsgTypeBtTInt32 = 0x10009ED5; - -// ============================= 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.iMtmData1 = KUidMsgTypeBtTInt32; - 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(); - CleanupStack::PushL(updateMusicCollection); - if (updateMusicCollection->isSupported(mimeType16)) - { - updateMusicCollection->addToCollectionL(aFileName); - } - CleanupStack::PopAndDestroy(); // updateMusicCollection - - 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; - - // todo @ QT migration: load from string id for localization - if (aMtmId == KUidMsgTypeBt) - { - _LIT(KBluetoothMsg, "Bluetooth message"); - toFrom.Copy(KBluetoothMsg); - } - else - { - _LIT(KInfraredMsg, "Infrared message"); - toFrom.Copy(KInfraredMsg); - } - - 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; - - // todo @ QT migration: load from string id for localization - if (aMtmId == KUidMsgTypeBt) - { - _LIT(KBluetoothMsg, "Bluetooth message"); - toFrom.Copy(KBluetoothMsg); - } - else - { - _LIT(KInfraredMsg, "Infrared message"); - toFrom.Copy(KInfraredMsg); - } - - // NOTE: toFrom will be updated to Bluetooth 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,EFileShareReadersOnly)); - 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); - - if (fileParse.NameOrExtPresent()) - { - aFileName = fileParse.NameAndExt(); - 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; - } - } - } - FLOG(_L("[OBEXUTILS]\t MakeValidFileName() completed")); - } - -// ----------------------------------------------------------------------------- -// TObexUtilsMessageHandler::CreateOutboxEntryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TMsvId TObexUtilsMessageHandler::CreateOutboxEntryL( - const TUid& aMtm, // Message type id - //todo need to check whether to use the textmap id or send as a string here - 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 ); - //todo need to change the string constant to orbit localisation file - toFrom.Copy(_L("Bluetooth message")); - - // 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilsopaquedata.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilsopaquedata.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/obexutilspropertynotifier.cpp --- a/btobexprofiles/obexserviceman/utils/src/obexutilspropertynotifier.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/updatemusiccollection.cpp --- a/btobexprofiles/obexserviceman/utils/src/updatemusiccollection.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp --- a/btobexprofiles/obexserviceman/utils/src/vMessageHandler.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,630 +0,0 @@ -/* -* 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 "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 - -// todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h) -const TUid KUidMsgTypeBt = {0x10009ED5}; - -// ================= 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 613943a21004 -r 9386f31cc85b btservices.pro --- a/btservices.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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: -# -# - -TEMPLATE = subdirs - -# Directories -SUBDIRS += btservices_plat \ - bluetoothengine/btui \ - bluetoothengine/btnotif/btdevicedialogplugin \ - bluetoothengine/btindicator \ - btobexprofiles/obexsendservices/obexhighway \ - btobexprofiles/obexreceiveservices/btmsgviewer \ - -CONFIG += ordered - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bluetooth_engine_connection_management_api/inc/btengconnman.h --- a/btservices_plat/bluetooth_engine_connection_management_api/inc/btengconnman.h Tue Aug 31 15:25:10 2010 +0300 +++ b/btservices_plat/bluetooth_engine_connection_management_api/inc/btengconnman.h Wed Sep 01 12:20:04 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -23,7 +23,6 @@ #include class CBTEngConnHandler; -class CBTEngPairingHandler; /** * Class MBTEngConnObserver @@ -90,7 +89,7 @@ * procedure; KErrNone for a normal disconnection, or * e.g. KErrCancel if the user cancelled the pairing dialog. */ - IMPORT_C virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); + virtual void PairingComplete( TBTDevAddr& aAddr, TInt aErr ); }; @@ -450,10 +449,10 @@ CBTEngConnHandler* iConnHandler; /** - * For handling pairing requests + * This field is NOT used. Reserved for future extension. * Own. */ - CBTEngPairingHandler* iPairingHandler; + TAny* iReserved; /** * Reference to receiver of connection events. diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bluetooth_engine_settings_api/tsrc/src/btapitestblocks.cpp --- a/btservices_plat/bluetooth_engine_settings_api/tsrc/src/btapitestblocks.cpp Tue Aug 31 15:25:10 2010 +0300 +++ b/btservices_plat/bluetooth_engine_settings_api/tsrc/src/btapitestblocks.cpp Wed Sep 01 12:20:04 2010 +0100 @@ -86,12 +86,12 @@ static TStifFunctionInfo const KFunctions[] = { - ENTRY( "PowerState", CBtApiTest::CBTEngSettings_GetAndSetPowerState ), - ENTRY( "Visibility", CBtApiTest::CBTEngSettings_SetAndGetVisibility ), - ENTRY( "LocalName", CBtApiTest::CBTEngSettings_SetAndGetLocalName ), - ENTRY( "GetOfflineModeSettingsApi", CBtApiTest::CBTEngSettings_GetOfflineModeSettingsApi ), - ENTRY( "ChangePowerStateTemporarily", CBtApiTest::CBTEngSettings_ChangePowerStateTemporarily ), - ENTRY( "CP", CBtApiTest::CBTEngSettings_ChangePowerStateTemporarily ), + ENTRY( "PowerState", CBTEngSettings_GetAndSetPowerState ), + ENTRY( "Visibility", CBTEngSettings_SetAndGetVisibility ), + ENTRY( "LocalName", CBTEngSettings_SetAndGetLocalName ), + ENTRY( "GetOfflineModeSettingsApi", CBTEngSettings_GetOfflineModeSettingsApi ), + ENTRY( "ChangePowerStateTemporarily", CBTEngSettings_ChangePowerStateTemporarily ), + ENTRY( "CP", CBTEngSettings_ChangePowerStateTemporarily ), }; const TInt count = sizeof( KFunctions ) / diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bluetooth_secondary_display_notification_api/group/bld.inf --- a/btservices_plat/bluetooth_secondary_display_notification_api/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/btservices_plat/bluetooth_secondary_display_notification_api/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -24,5 +24,5 @@ PRJ_EXPORTS -../inc/secondarydisplay/BTnotifSecondaryDisplayAPI.h MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/BTnotifSecondaryDisplayAPI.h) -../inc/secondarydisplay/BtuiSecondaryDisplayAPI.h MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/BtuiSecondaryDisplayAPI.h) +../inc/secondarydisplay/BTnotifSecondaryDisplayAPI.h MW_LAYER_PLATFORM_EXPORT_PATH(secondarydisplay/BTnotifSecondaryDisplayAPI.h) +../inc/secondarydisplay/BtuiSecondaryDisplayAPI.h MW_LAYER_PLATFORM_EXPORT_PATH(secondarydisplay/BtuiSecondaryDisplayAPI.h) diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/bt_remote_device_setting_api.metaxml --- a/btservices_plat/bt_remote_device_setting_api/bt_remote_device_setting_api.metaxml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - bt_remote_device_setting_api - The framework API for implementing the settings UI for remote Bluetooth devices. - c++ - bluetoothengine - - - - no - no - - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/bt_remote_device_setting_api.pri --- a/btservices_plat/bt_remote_device_setting_api/bt_remote_device_setting_api.pri Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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: -# -# - -symbian*: { - # Build.inf rules - BLD_INF_RULES.prj_exports += \ - "$${LITERAL_HASH}include" \ - "bt_remote_device_setting_api/inc/btdevsettingglobal.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettingglobal.h)" \ - "bt_remote_device_setting_api/inc/btdevsettinginterface.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettinginterface.h)" \ - "bt_remote_device_setting_api/inc/btabstractdevsetting.h MW_LAYER_PLATFORM_EXPORT_PATH(btabstractdevsetting.h)" \ - "bt_remote_device_setting_api/inc/btdevsettingpluginloader.h MW_LAYER_PLATFORM_EXPORT_PATH(btdevsettingpluginloader.h)" -} diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/inc/btabstractdevsetting.h --- a/btservices_plat/bt_remote_device_setting_api/inc/btabstractdevsetting.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +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: The plugin interface of Bluetooth device setting ui -* -*/ - -#ifndef BTABSTRACTDEVSETTING_H -#define BTABSTRACTDEVSETTING_H - -#include -#include - -/*! - \class BtAbstractDevSetting - \brief The class BtAbstractDevSetting is the base class - for offering a UI to manage certain settings of - a remote Bluetooth device, e.g., accessory and keyboard settings. - */ -class BTDEVSETTINGINTERFACE_EXPORT BtAbstractDevSetting : public QObject -{ - Q_OBJECT - -public: - - /*! - Constructs a device setting plugin entry. - - \param address the BD_ADDR of the remote device which this setting - plugin is provided for. Its format is XXXXXXXXXXXX, where X is a - hexadecimal digit. Case is insensitive. - \parent the parent of this object. - */ - explicit BtAbstractDevSetting(const QString &address, QObject *parent = 0 ); - - /*! - Destructor of BtAbstractDeviceSetting. - */ - virtual ~BtAbstractDevSetting(); - - /*! - Gets the BD_ADDR of the remote device which this setting - plugin is provided for. - - \return the device address of the remote device in hex string - */ - const QString &getRemote() const; - - /*! - Tells if this setting plugin can provide a setting UI - for the target device. If the answer is true, this plugin may be - requested to create a setting widget by function - \code createSettingWidget() \endcode. - - \return true if a setting is currently available. false, otherwise. - - The default implementation returns false. - */ - virtual bool isSettingAvailable(); - - /*! - Gets a \code HbDataForm \endcode instance which consists of the - setting UI from this specific plugin. The loader of this plugin will - add this dataform into its setting view if its setting is available at - the time. - - The ownership of this widget is transferred to the plugin loader. - - The default implementation returns 0. - - \return an \code HbDataForm \endcode instance. - */ - virtual HbDataForm *getSettingWidget(); - - /*! - Informs that device setting is going to foreground. This - implies that the \code HbWidget \endcode from function - \code createSettingWidget \endcode will be shown if the setting - from this plugin is available. - - The default implementation does nothing. - */ - virtual void aboutToForeground(); - - /*! - Informs that device setting is going to background. - - The default implementation does nothing. - */ - virtual void aboutToBackground(); - - /*! - Informs that device setting is going to close. - - The default implementation does nothing. - */ - virtual void aboutToClose(); - -signals: - - /*! - The signal the plugin should emit for informing that the - availability of this setting is changed. - - If the setting becomes available, the owner of this plugin may - request the plugin to create a setting widget. - - If the setting becomes unavailable, the owner of this plugin may close and - destroy the setting widget. - - \param setting the pointer of the setting whose status has changed. - - \param available true if the setting is available; false otherwise. - - \sa isSettingAvailable(). - */ - void settingAvailabilityChanged(BtAbstractDevSetting *setting, bool available); - -private: - - /*! - The remote device address in format XXXXXXXXXXXX where X is a - hexadecimal digit. - */ - QString mRemote; -}; - -#endif /* BTABSTRACTDEVSETTING_H */ diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/inc/btdevsettingglobal.h --- a/btservices_plat/bt_remote_device_setting_api/inc/btdevsettingglobal.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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 BTDEVSETTINGGLOBAL_H -#define BTDEVSETTINGGLOBAL_H - -#include - -#ifdef BUILD_BTDEVSETTINGFRAMEWORK -#define BTDEVSETTINGINTERFACE_EXPORT Q_DECL_EXPORT -#else -#define BTDEVSETTINGINTERFACE_EXPORT Q_DECL_IMPORT -#endif - -#define BTDEVSETTING_PLUGIN_PATH QLatin1String("/resource/qt/plugins/btdevsetting") - -#endif /* BTDEVSETTINGGLOBAL_H */ diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/inc/btdevsettinginterface.h --- a/btservices_plat/bt_remote_device_setting_api/inc/btdevsettinginterface.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +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: The plugin interface of Bluetooth device setting ui -* -*/ - -#ifndef BTDEVSETTINGINTERFACE_H -#define BTDEVSETTINGINTERFACE_H - -#include -#include -#include - -/*! - \class BtDeviceSettingInterface - \brief The class BtDeviceSettingInterface is an interface - for creating a BT device setting plugin instance. - */ -class BTDEVSETTINGINTERFACE_EXPORT BtDevSettingInterface -{ -public: - - /*! - Destructor of BtDeviceSettingPlugin. - */ - virtual ~BtDevSettingInterface() {} - - /*! - Creates a \code BtDeviceSettingPlugin \endcode instance from a - specific plugin. - - \param address the BD_ADDR of the remote device which this setting - plugin is provided for. Its format is XXXXXXXXXXXX, where X is a - hexadecimal digit. Case is insensitive. - - \parent the parent of this object. - - \return an \code BtDeviceSettingPlugin \endcode instance the ownership of which is - transferred to the plugin loader. - */ - virtual BtAbstractDevSetting *createDevSetting( - const QString &address, QObject *parent = 0) = 0; -}; - -Q_DECLARE_INTERFACE(BtDevSettingInterface, "com.nokia.bt.devsettinginterface/1.0"); - -#endif /* BTDEVSETTINGINTERFACE_H */ diff -r 613943a21004 -r 9386f31cc85b btservices_plat/bt_remote_device_setting_api/inc/btdevsettingpluginloader.h --- a/btservices_plat/bt_remote_device_setting_api/inc/btdevsettingpluginloader.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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 BTDEVSETTINGPLUGINLOADER_H -#define BTDEVSETTINGPLUGINLOADER_H - -#include -#include -#include - -class QString; -class QStringList; -class BtDevSettingInterface; - -class BTDEVSETTINGINTERFACE_EXPORT BtDevSettingPluginLoader -{ -public: - - /*! - Load all setting interfaces. - - \return the list of plugin interface. - */ - static QList loadDevSettingInterfaces(); - -}; - -#endif /* BTDEVSETTINGPLUGINLOADER_H */ diff -r 613943a21004 -r 9386f31cc85b btservices_plat/btservices_plat.pro --- a/btservices_plat/btservices_plat.pro Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +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: -# -# - -TEMPLATE = subdirs - -symbian*: { - include(bt_remote_device_setting_api/bt_remote_device_setting_api.pri) -} diff -r 613943a21004 -r 9386f31cc85b btservices_plat/group/bld.inf --- a/btservices_plat/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/btservices_plat/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -31,7 +31,3 @@ #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 613943a21004 -r 9386f31cc85b btservices_plat/obex_secondary_display_notification_api/group/bld.inf --- a/btservices_plat/obex_secondary_display_notification_api/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_secondary_display_notification_api/inc/secondarydisplay/obexutilssecondarydisplayapi.h --- a/btservices_plat/obex_secondary_display_notification_api/inc/secondarydisplay/obexutilssecondarydisplayapi.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_secondary_display_notification_api/obex_secondary_display_notification_api.metaxml --- a/btservices_plat/obex_secondary_display_notification_api/obex_secondary_display_notification_api.metaxml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - OBEX Secondary Display Notification API - defines message IDs for showing message on secondary display - c++ - localconnectivityservice - - - - - - - - no - no - - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_plugin_api/group/bld.inf --- a/btservices_plat/obex_service_plugin_api/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_plugin_api/inc/SrcsInterface.h --- a/btservices_plat/obex_service_plugin_api/inc/SrcsInterface.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_plugin_api/inc/SrcsInterface.inl --- a/btservices_plat/obex_service_plugin_api/inc/SrcsInterface.inl Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_plugin_api/obex_service_plugin_api.metaxml --- a/btservices_plat/obex_service_plugin_api/obex_service_plugin_api.metaxml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - OBEX Service Plugin API - ECom interface for implementing obex service controllers, e.g. ftp, opp service controller - c++ - localconnectivityservice - - - - - - - - no - no - - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/group/bld.inf --- a/btservices_plat/obex_service_utils_api/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/inc/obexutilsmessagehandler.h --- a/btservices_plat/obex_service_utils_api/inc/obexutilsmessagehandler.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,479 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/obex_service_utils_api.metaxml --- a/btservices_plat/obex_service_utils_api/obex_service_utils_api.metaxml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/Bmarm/ObexServAPItestu.def --- a/btservices_plat/obex_service_utils_api/tsrc/Bmarm/ObexServAPItestu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/Bwins/ObexServAPItestu.def --- a/btservices_plat/obex_service_utils_api/tsrc/Bwins/ObexServAPItestu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/conf/obexservapitest.cfg --- a/btservices_plat/obex_service_utils_api/tsrc/conf/obexservapitest.cfg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -[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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/eabi/ObexServAPItestu.def --- a/btservices_plat/obex_service_utils_api/tsrc/eabi/ObexServAPItestu.def Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/group/bld.inf --- a/btservices_plat/obex_service_utils_api/tsrc/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include -// Example: -/* -/agnmodel/inc/AGMCOMON.H -*/ - -PRJ_TESTMMPFILES -// NOTE: If using ARS requirements .mmp file operation should be done under this. -// 'abld test build' -obexservapitest.mmp - -PRJ_MMPFILES - -// End of File \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.mmp --- a/btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.mmp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/*TYPE TESTCLASS*//* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - -#if defined(__S60_) - // To get the 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.pkg --- a/btservices_plat/obex_service_utils_api/tsrc/group/obexservapitest.pkg Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; -; 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/inc/ObexServAPItest.h --- a/btservices_plat/obex_service_utils_api/tsrc/inc/ObexServAPItest.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - -#ifndef OBEXSERVAPITEST_H -#define OBEXSERVAPITEST_H - -// INCLUDES -#include -#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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h --- a/btservices_plat/obex_service_utils_api/tsrc/inc/testlogger.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef BTTESTLOGGER_H -#define BTTESTLOGGER_H - -// INCLUDES -#include - -// 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/init/obexservapitest.ini --- a/btservices_plat/obex_service_utils_api/tsrc/init/obexservapitest.ini Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# - -# -# This 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/rom/obexservapitest.iby --- a/btservices_plat/obex_service_utils_api/tsrc/rom/obexservapitest.iby Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project bteng -* -*/ - -#ifndef BTENGAPITEST_IBY -#define BTENGAPITEST_IBY - -#include - -file=ABI_DIR\BUILD_DIR\ObexServAPItest.dll SHARED_LIB_DIR\ObexServAPItest.dll - -#endif // BTENGAPITEST_IBY diff -r 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItest.cpp --- a/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItest.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - -// INCLUDE FILES -#include -#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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp --- a/btservices_plat/obex_service_utils_api/tsrc/src/ObexServAPItestBlocks.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,631 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - -// INCLUDE FILES -#include -#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*/ ) - { - //todo resource is unavailable at the moment. - // need to change the string constant according to the coming new localisation file - TRAPD(error, iMessageServerIndex = TObexUtilsMessageHandler::CreateOutboxEntryL( KUidMsgTypeBt, 1 )); - 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 613943a21004 -r 9386f31cc85b btservices_plat/obex_service_utils_api/tsrc/src/testlogger.cpp --- a/btservices_plat/obex_service_utils_api/tsrc/src/testlogger.cpp Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,530 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDES - -#include "testlogger.h" - -#include -#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 613943a21004 -r 9386f31cc85b btservices_plat/usb_obexservicemanager_client_api/group/bld.inf --- a/btservices_plat/usb_obexservicemanager_client_api/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: 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 613943a21004 -r 9386f31cc85b btservices_plat/usb_obexservicemanager_client_api/inc/usbobex.h --- a/btservices_plat/usb_obexservicemanager_client_api/inc/usbobex.h Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* 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 613943a21004 -r 9386f31cc85b group/bld.inf --- a/group/bld.inf Tue Aug 31 15:25:10 2010 +0300 +++ b/group/bld.inf Wed Sep 01 12:20:04 2010 +0100 @@ -23,7 +23,6 @@ #include "../bluetoothengine/group/bld.inf" #include "../atcommands/group/bld.inf" #include "../cbsatplugin/group/bld.inf" -#include "../btobexprofiles/group/bld.inf" PRJ_EXPORTS diff -r 613943a21004 -r 9386f31cc85b layers.sysdef.xml --- a/layers.sysdef.xml Tue Aug 31 15:25:10 2010 +0300 +++ b/layers.sysdef.xml Wed Sep 01 12:20:04 2010 +0100 @@ -1,17 +1,14 @@ - ]> - + - - - diff -r 613943a21004 -r 9386f31cc85b package_definition.xml --- a/package_definition.xml Tue Aug 31 15:25:10 2010 +0300 +++ b/package_definition.xml Wed Sep 01 12:20:04 2010 +0100 @@ -5,12 +5,7 @@ - - - - - diff -r 613943a21004 -r 9386f31cc85b package_map.xml --- a/package_map.xml Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ - - \ No newline at end of file diff -r 613943a21004 -r 9386f31cc85b sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Wed Sep 01 12:20:04 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 613943a21004 -r 9386f31cc85b sysdef_1_5_1.dtd --- a/sysdef_1_5_1.dtd Tue Aug 31 15:25:10 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -