mapnavproviderrefapp/inc/mnrpgeocodingservice.h
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 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:  CMnrpGeocodingService class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MNRP_GEOCODINGSERVICE_H
       
    20 #define MNRP_GEOCODINGSERVICE_H
       
    21 
       
    22 #include "mngeocodingservicebase.h"
       
    23 
       
    24 class CPosLandmark;
       
    25 class CMnrpEngine;
       
    26 
       
    27 /** Implementation of geocoding service (KMnAppGeocodingService). 
       
    28  *	It uses CIdle to simulate asynchronous processing. All the geocoding
       
    29  *	job is done using the CMnrpEngine class.
       
    30  */
       
    31 class CMnrpGeocodingService : public CMnGeocodingServiceBase
       
    32     {
       
    33     public :
       
    34         static CMnrpGeocodingService* NewL( CMnrpEngine& aEngine );
       
    35         
       
    36     protected :
       
    37         CMnrpGeocodingService( CMnrpEngine& aEngine );
       
    38         virtual ~CMnrpGeocodingService();
       
    39 
       
    40         void ConstructL();
       
    41 
       
    42 		/** Prevents parallel asynchronous requests */
       
    43         void LeaveIfBusyL();
       
    44         /** Starts processing of new request by starting CIdle.*/
       
    45         void StartProcessingL();
       
    46         /** Callback for CIdle. Parameter is the pointer to this. */
       
    47         static TInt GeocodingProcessingCallBack( TAny* aPtr );
       
    48         /** Non-leaving part of geocoding. Calls FinishProcessingL and if
       
    49          *	it leaves, completes client's request with error.*/
       
    50         void HandleGeocodingCompleted();
       
    51         /** Does the geocoding and completes user's request.*/
       
    52         void FinishProcessingL();
       
    53 
       
    54         /** Asks user to select one of best Coord to Addr matches */
       
    55         CPosLandmark* LetUserSelectBestMatchL( const CPosLandmark& aReference );
       
    56 
       
    57     protected: // from CMnGeocodingServiceBase
       
    58     
       
    59         /** Handles client's request for finding address by given coordinate. */
       
    60         void HandleFindAddressByCoordinateL( const CPosLandmark& aLandmark );
       
    61         
       
    62         /** Handles client's request for finding coordinate by given address. */
       
    63         void HandleFindCoordinateByAddressL( const CPosLandmark& aLandmark );
       
    64 
       
    65         /** Handles client's request for finding coordinate by given address. */
       
    66         void HandleFindCoordinateByAddressL( const TDesC& aAddress );
       
    67         
       
    68     protected: // from CMnServiceBase
       
    69 
       
    70         /** Reports that client cancelled request */
       
    71         void DoCancel();
       
    72 
       
    73     private:
       
    74         CMnrpEngine&            iEngine;
       
    75     
       
    76         enum TServiceType
       
    77             {
       
    78             ENone,
       
    79             ECoordToAddr,
       
    80             EAddrToCoord,
       
    81             EPlainToCoord
       
    82             };
       
    83         
       
    84         /** Type of last received request to make correct request to Engine */    
       
    85         TServiceType            iCurrentService;
       
    86     
       
    87     	/** Keeps client's data */
       
    88         CPosLandmark*           iLandmark;
       
    89     	/** Keeps client's data */
       
    90         HBufC*                  iPlainAddress;
       
    91 
       
    92         /** Keeps client's option */
       
    93         TBool                   iDialogAllowed;
       
    94 
       
    95 		/** Asynchronous geocoding processor */        
       
    96         CIdle*                  iProcessor;
       
    97         
       
    98     };
       
    99 
       
   100 #endif // MNRP_GEOCODINGSERVICE_H
       
   101 
       
   102