locationmapnavfw/aiwprovider/src/mnnavigatetohandler.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CMnNavigateToHandler class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AiwGenericParam.hrh>
       
    20 #include <AiwCommon.hrh>
       
    21 
       
    22 #include <EPos_CPosLandmark.h>
       
    23 #include <epos_poslandmarkserialization.h>
       
    24 
       
    25 #include <mnnavigator.h>
       
    26 
       
    27 #include "mnaiwdebug.h"
       
    28 #include "mnaiwinternal.h"
       
    29 #include "mnnavigatetohandler.h"
       
    30 
       
    31 // ================= LOCAL FUNCTIONS =======================
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CMnNavigateToHandler::CMnNavigateToHandler( CMnProvider& aProvider )
       
    39 :   CMnAiwCommandHandlerBase( aProvider )
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CMnNavigateToHandler::~CMnNavigateToHandler()
       
    47     {
       
    48     delete iNavigator;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CMnNavigateToHandler* CMnNavigateToHandler::NewL(
       
    55     CMnProvider& aProvider,
       
    56     TRunMode aRunMode )
       
    57     {
       
    58     CMnNavigateToHandler* self = 
       
    59         new (ELeave) CMnNavigateToHandler( aProvider );
       
    60     CleanupStack::PushL( self );        
       
    61     self->ConstructL( aRunMode );
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CMnNavigateToHandler::SetExitObserverL( 
       
    70 	MMnProviderExitCallback& aExitCallback )
       
    71 	{
       
    72 	iNavigator->SetExitObserverL( *this );
       
    73 	CMnAiwCommandHandlerBase::SetExitObserverL( aExitCallback );
       
    74 	}
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CMnNavigateToHandler::ConstructL( TRunMode aRunMode )
       
    80     {
       
    81     LOG("CMnNavigateToHandler::ConstructL in");
       
    82 
       
    83     CMnAiwCommandHandlerBase::ConstructL();
       
    84     
       
    85     if ( aRunMode == ERunModeChained )
       
    86         {
       
    87         iNavigator = CMnNavigator::NewChainedL( Provider() );
       
    88         }
       
    89     else
       
    90         {
       
    91         iNavigator = CMnNavigator::NewL( Provider() );
       
    92         }
       
    93         
       
    94     iRunMode = aRunMode;
       
    95     
       
    96     LOG("CMnNavigateToHandler::ConstructL out");
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CMnNavigateToHandler::DoStartL()
       
   103     {
       
   104     LOG("CMnNavigateToHandler::DoStartL in");
       
   105     if ( iLandmarkData.Size() )
       
   106         {
       
   107         CPosLandmark* lm = PosLandmarkSerialization::UnpackL( iLandmarkData );
       
   108         CleanupStack::PushL( lm );
       
   109         
       
   110         iNavigator->NavigateToL( *lm );
       
   111         
       
   112         CleanupStack::PopAndDestroy( lm );
       
   113         }
       
   114     else    
       
   115         {
       
   116         User::Leave( KErrArgument );
       
   117         }
       
   118         
       
   119     LOG("CMnNavigateToHandler::DoStartL out");
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 //  From class CMnAiwCommandHandlerBase
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CMnNavigateToHandler::HandleAiwParamLandmarksL( RArray<TPtrC8>& aLandmarkDataList )
       
   127     {
       
   128     __ASSERT_DEBUG( aLandmarkDataList.Count() > 0, Panic( KErrGeneral ) );
       
   129     
       
   130     // if already set or not single landmarks are given
       
   131     if ( !iLandmarkData.Length() )
       
   132         {
       
   133         iLandmarkData.Set( aLandmarkDataList[0] );
       
   134         }
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 //  From class CMnAiwCommandHandlerBase
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 void CMnNavigateToHandler::ResetParametersL()
       
   142     {
       
   143     iLandmarkData.Set( NULL, 0 );
       
   144     }