locsrv_plat/map_and_navigation_provider_api/inc/mngeocodingservicebase.h
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:  CMnGeocodingServiceBase class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MN_GEOCODINGSERVICEBASE_H
       
    20 #define MN_GEOCODINGSERVICEBASE_H
       
    21 
       
    22 #include "mnservicebase.h"
       
    23 #include "mngeocoder.h"
       
    24 
       
    25 class CPosLandmark;
       
    26 
       
    27 /** @brief Base class for geocoding service implementations (KMnAppGeocodingService). 
       
    28  *
       
    29  *  Provider Application must derive its geocoding service class from this one. 
       
    30  *  This base implementation hides IPC communication details and provides 
       
    31  *  native methods for accessing various parameters, specified by client.
       
    32  *
       
    33  *  Provider Application must return pointer to instance of its class, derived
       
    34  *  from this class, in response to CAknAppService::CreateServiceL() call, 
       
    35  *  if given parameter is KMnAppGeocodingService. 
       
    36  *
       
    37  *  This class defines handlers of particular requests from client as pure 
       
    38  *  virtual methods, which derived class must implement. The parameters, which
       
    39  *  client application may specify in @ref CMnGeocoder are accessible via other methods
       
    40  *  of this class. Implementation must obey these parameters and use them
       
    41  *  as specified in @ref CMnGeocoder.
       
    42  *
       
    43  *  See parent @ref CMnServiceBase class documentation for 
       
    44  *  other details.
       
    45  *
       
    46  *  @since 3.1
       
    47  *  @lib mnservicelib.lib
       
    48  *  @ingroup MnProviderAPI
       
    49  */
       
    50 class CMnGeocodingServiceBase : public CMnServiceBase
       
    51     {
       
    52     public :
       
    53 
       
    54         /** @brief Returns geocoding options specified by client application.
       
    55          *
       
    56          *  This options must be utilized in request handlers as specified in 
       
    57          *  @ref CMnGeocoder. 
       
    58          *  
       
    59          *  @return Options specified by client.
       
    60          */
       
    61         IMPORT_C CMnGeocoder::TOptions Options() const;
       
    62 
       
    63         /** @brief Completes geocoding request and sends result.
       
    64          *
       
    65          *  Implementation must call this method to signal successful completion
       
    66          *  of conversion request. Result of conversion is supplied as landmark 
       
    67          *  object. It must contain only data, which is part of conversion result,
       
    68          *  any other fields shall be left empty.
       
    69          *
       
    70          *  @param[in] aLandmark Landmark containing result of conversion.
       
    71          */
       
    72         IMPORT_C void CompleteGeocodingRequestL( const CPosLandmark& aLandmark );
       
    73 
       
    74     protected :
       
    75     
       
    76         /** C++ constructor */
       
    77         IMPORT_C CMnGeocodingServiceBase();
       
    78         /** Destructor */
       
    79         IMPORT_C ~CMnGeocodingServiceBase();
       
    80 
       
    81         /** This method must be called from derived class' ConstructL to
       
    82          *  allow internal initialization of this class. */
       
    83         IMPORT_C void BaseConstructL();
       
    84 
       
    85         /** @brief Handles client's request for finding address by given coordinate. 
       
    86          *
       
    87          *  Derived class must implement this method obeying specification of 
       
    88          *  @ref CMnGeocoder::FindAddressByCoordinateL() and if 
       
    89          *  @ref KMnSvcFeatureCoordToAddr feature is specified in SERVICE_INFO.
       
    90          *
       
    91          *  If given landmark coordinates cannot be resolved to address due
       
    92          *  to some ambiguity, then user shall be queried, if allowed by options
       
    93          *  (see @ref Options()). If it is not allowed, the operation
       
    94          *  shall be completed with KErrNotFound (@ref CompleteRequest()).
       
    95          *
       
    96          *  This is asynchronous request.
       
    97          *  Client's request must be completed (when resolving succeeded) with 
       
    98          *  CompleteGeocodingRequest().
       
    99          *
       
   100          *  @param[in] aLandmark Contains coordinate information to be resolved
       
   101          *                       to address.
       
   102          *  
       
   103          *  @leave KErrNotSupported Should leave if this feature is not supported.
       
   104          */
       
   105         virtual void HandleFindAddressByCoordinateL( const CPosLandmark& aLandmark ) =0;
       
   106         
       
   107         /** @brief Handles client's request for finding coordinate by given address. 
       
   108          *
       
   109          *  Derived class must implement this method obeying specification of 
       
   110          *  @ref CMnGeocoder::FindCoordinateByAddressL(const CPosLandmark&, 
       
   111          *  TRequestStatus&) and if @ref KMnSvcFeatureAddrToCoord feature is 
       
   112          *  specified in SERVICE_INFO.
       
   113          *
       
   114          *  If given address cannot be resolved to coordinates due
       
   115          *  to some ambiguity, then user shall be queried, if allowed by options
       
   116          *  (see @ref Options()).If it is not allowed, the result of the operation
       
   117          *  shall be KErrNotFound.
       
   118          *
       
   119          *  This is asynchronous request.
       
   120          *  Client's request must be completed (when resolving succeeded) with 
       
   121          *  CompleteGeocodingRequest().
       
   122          *
       
   123          *  @param[in] aLandmark Contains address information to be resolved
       
   124          *                       to coordinate.
       
   125          *  
       
   126          *  @leave KErrNotSupported Should leave if this feature is not supported.
       
   127          */
       
   128         virtual void HandleFindCoordinateByAddressL( const CPosLandmark& aLandmark ) =0;
       
   129 
       
   130         /** @brief Handles client's request for finding coordinate by given address. 
       
   131          *
       
   132          *  This overload is for cases when address is specified as plain string.
       
   133          *  Derived class must implement this method obeying specification of 
       
   134          *  @ref CMnGeocoder::FindCoordinateByAddressL(const TDesC& aAddress, 
       
   135          *  TRequestStatus& aRequest) and if @ref KMnSvcFeaturePlainAddrToCoord feature 
       
   136          *  is specified in SERVICE_INFO.
       
   137          *
       
   138          *  If given address cannot be resolved to coordinates due
       
   139          *  to some ambiguity, then user shall be queried, if allowed by options
       
   140          *  (see @ref Options()).If it is not allowed, the result of the operation
       
   141          *  shall be KErrNotFound.
       
   142          *
       
   143          *  This is asynchronous request.
       
   144          *  Client's request must be completed (when resolving succeeded) with 
       
   145          *  CompleteGeocodingRequest().
       
   146          *
       
   147          *  @param[in] aAddress Address information to be resolved to coordinate.
       
   148          *  
       
   149          *  @leave KErrNotSupported Should leave if this feature is not supported.
       
   150          */
       
   151         virtual void HandleFindCoordinateByAddressL( const TDesC& aAddress ) =0;
       
   152 
       
   153     protected: // From CAknAppServiceBase
       
   154 
       
   155         /** \internal */
       
   156         IMPORT_C void ServiceL( const RMessage2& aMessage );
       
   157 
       
   158     private:
       
   159         void StartAsyncRequestL( const RMessage2& aMessage );
       
   160         void UnpackOptionsL( const RMessage2& aMsg );
       
   161         HBufC* UnpackPlainAddressLC( const RMessage2& aMsg );
       
   162 
       
   163         void HandleGetConversionResultL( const RMessage2& aMsg );
       
   164     
       
   165     private:
       
   166         CMnGeocoder::TOptions   iOptions;
       
   167 
       
   168         HBufC8*                 iResult;
       
   169         TInt                    iResultType;
       
   170     };
       
   171 
       
   172 #endif // MN_GEOCODINGSERVICEBASE_H
       
   173 
       
   174