diff -r 82ee1f804b63 -r 4c4ed41530db locationmapnavfw/library/src/mnnavigator.cpp --- a/locationmapnavfw/library/src/mnnavigator.cpp Mon May 03 12:54:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +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: CMnNavigator class implementation -* -*/ - - -#include -#include -#include -#include - -#include -#include -#include - -#include "mnprovider.h" -#include "mnnavigationserviceclient.h" -#include "mnnavigator.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -CMnNavigator::CMnNavigator() - { - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C CMnNavigator* CMnNavigator::NewL( CMnProvider& aProvider ) - { - CMnNavigator* self = new (ELeave) CMnNavigator; - CleanupStack::PushL( self ); - self->ConstructNewL( aProvider ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C CMnNavigator* CMnNavigator::NewChainedL( CMnProvider& aProvider ) - { - CMnNavigator* self = new (ELeave) CMnNavigator; - CleanupStack::PushL( self ); - self->ConstructChainedL( aProvider ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void CMnNavigator::ConstructCommonL( CMnProvider& aProvider ) - { - if ( !( aProvider.SupportedServices() & CMnProvider::EServiceNavigation ) ) - { - User::Leave( KErrNotSupported ); - } - - iSession = new (ELeave) RMnNavigationServiceClient; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void CMnNavigator::ConstructNewL( CMnProvider& aProvider ) - { - ConstructCommonL( aProvider ); - iSession->ConnectL( aProvider.Uid() ); - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void CMnNavigator::ConstructChainedL( CMnProvider& aProvider ) - { - ConstructCommonL( aProvider ); - iSession->ConnectChainedL( aProvider.Uid() ); - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C CMnNavigator::~CMnNavigator() - { - delete iExitMonitor; - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C void CMnNavigator::NavigateToL(const CPosLandmark& aDestination) - { - // verify that destination landmark has coordinates - TLocality loc; - TBool valid = (KErrNone == aDestination.GetPosition( loc ) ); - valid &= !Math::IsNaN( loc.Latitude() ) && !Math::IsNaN( loc.Longitude() ); - - if ( !valid ) - { - // verify that destination landmark has address info - TPositionFieldId fieldId = aDestination.FirstPositionFieldId(); - while ( fieldId != EPositionFieldNone ) - { - if ( fieldId > EPositionFieldAddressCapabilitiesBegin && - fieldId < EPositionFieldNMEACapabilitiesBegin) - { - TPtrC field; - aDestination.GetPositionField( fieldId, field ); - if ( field.Length() ) - { - valid = ETrue; - break; - } - } - fieldId = aDestination.NextPositionFieldId( fieldId ); - } - } - - if ( valid ) - { - iSession->NavigateToL( aDestination ); - } - else - { - User::Leave( KErrArgument ); - } - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C void CMnNavigator::SetExitObserverL( MAknServerAppExitObserver& aObserver ) - { - if ( iExitMonitor ) - { - User::Leave( KErrAlreadyExists ); - } - else - { - iExitMonitor = CApaServerAppExitMonitor::NewL( - *iSession, aObserver, CActive::EPriorityStandard ); - } - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -EXPORT_C void CMnNavigator::RemoveExitObserver() - { - delete iExitMonitor; - iExitMonitor = NULL; - }