locationcentre/lcservice/inc/lcserviceimpl.h
branchRCL_3
changeset 16 4721bd00d3da
parent 14 3a25f69541ff
child 21 e15b7f06eba6
equal deleted inserted replaced
14:3a25f69541ff 16:4721bd00d3da
     1 /*
       
     2 * Copyright (c) 2007 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:  Location Centre API implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_LCSERVICEIMPL_H
       
    20 #define C_LCSERVICEIMPL_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // USER INCLUDES
       
    26 #include "lcservice.h"
       
    27 #include "lclocationappinfo.h"
       
    28 #include "lcclientsession.h"
       
    29 #include "lcnotification.h"
       
    30 #include "lcasyncoperation.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class MLcAppExitObserver;
       
    34 class TLcLocationAppFilter;
       
    35 class CLcAppLauncher;
       
    36 class CBufFlat;
       
    37 class CLcAppInfo;
       
    38 class CLcNotificationAO;
       
    39 class CLcBasicAppInfo;
       
    40 class CLcLocationAppInfoArray;
       
    41 class CAknPopupList;
       
    42 class CLcPopupListBox;
       
    43 
       
    44 /**
       
    45  *  Implementation of Location Centre Interface class CLcService.
       
    46  *
       
    47  *  This class provides the implementation of Location Centre API.
       
    48  *  This is needed to ensure that the implementation details of Location
       
    49  *  Centre API is completely abstracted from CLcService.
       
    50  */
       
    51 NONSHARABLE_CLASS( CLcServiceImpl )  : public CBase,
       
    52                                        public MLcNotification,
       
    53                                        public MLcAsynOperationObserver
       
    54     {
       
    55 public: // Exported Functions
       
    56     /**
       
    57      * Constructs a new instance of Location Centre interface.
       
    58      *
       
    59      * @return The new instance of Location Centre interface object.
       
    60      * @leave System wide error code if the object creation fails.         
       
    61      */
       
    62     static CLcServiceImpl* NewL();
       
    63     
       
    64     /**
       
    65      * Constructs a new instance of Location Centre interface.
       
    66      * Leaves the created instance on the cleanup stack.
       
    67      *
       
    68      * @return The new instance of Location Centre interface object.
       
    69      * @leave System wide error code if the object creation fails.         
       
    70      */
       
    71     static CLcServiceImpl* NewLC();        
       
    72 
       
    73     /**
       
    74      * C++ Destructor.
       
    75      * Frees all the resources associated with this Location Centre
       
    76      * interface.
       
    77      */
       
    78     virtual ~CLcServiceImpl();
       
    79 
       
    80     /**
       
    81      * Launches Location Centre as a pop-up dialog with a list of
       
    82      * Location based Application.
       
    83      *
       
    84      * Other documentation present in the corresponding function for
       
    85      * CLcService class.
       
    86      */                        
       
    87     void LaunchLocationCentreL( 
       
    88         const TLcLocationAppFilter&       aLocationAppFilter,
       
    89         CLcLocationAppInfo::TLcLaunchMode aLaunchMode = CLcLocationAppInfo::EDefaultMode,
       
    90         MLcAppExitObserver*               aChainedAppExitObserver = NULL );
       
    91                             
       
    92     /**
       
    93      * Launches Location Centre with the specified array of Location
       
    94      * based Applications in a pop-up dialog.
       
    95      *
       
    96      * Other documentation present in the corresponding function for
       
    97      * CLcService class.
       
    98      */                        
       
    99     void LaunchLocationCentreL(
       
   100           const RPointerArray<CLcService::CLcLaunchParam>& aIncludeAppArray,
       
   101           MLcAppExitObserver*                              aChainedAppExitObserver = NULL );
       
   102   
       
   103     /**
       
   104      * Launches Location Centre without the specified array of
       
   105      * Location based Applications in a pop-up dialog.
       
   106      *
       
   107      * Other documentation present in the corresponding function for
       
   108      * CLcService class.
       
   109      */                        
       
   110     void LaunchLocationCentreL(
       
   111         const RArray<TPtrC>&              aExcludeAppArray,
       
   112         CLcLocationAppInfo::TLcLaunchMode aLaunchMode = CLcLocationAppInfo::EDefaultMode,
       
   113         MLcAppExitObserver*               aChainedAppExitObserver = NULL );
       
   114  
       
   115      /**
       
   116      * Launches Location Centre as a pop-up dialog with a filtered list of
       
   117      * Location based Applications and the user can select a Location
       
   118      * based Application from the pop-up list displayed.
       
   119      *
       
   120      * Other documentation present in the corresponding function for
       
   121      * CLcService class.
       
   122      */     
       
   123     TPtrC SelectLocationApplicationL( 
       
   124                 const TLcLocationAppFilter&         aLocationAppFilter );
       
   125        
       
   126     /**
       
   127      * Launches Location Centre with based Applications in a pop-up
       
   128      * dialog and the user can select a Location based Application
       
   129      * from the pop-up list displayed.
       
   130      *
       
   131      * Other documentation present in the corresponding function for
       
   132      * CLcService class.
       
   133      */                        
       
   134     TPtrC SelectLocationApplicationL( const RArray<TPtrC>&  aAppArray,
       
   135                                             TBool           aIncludeFlag );
       
   136  
       
   137     /**
       
   138      * Gets a filtered list of Location based Applications.
       
   139      *
       
   140      * Other documentation present in the corresponding function for
       
   141      * CLcService class.
       
   142      */
       
   143      CLcLocationAppInfoArray* GetLocationApplicationsL(
       
   144                      const TLcLocationAppFilter&    aLocationAppFilter );
       
   145     
       
   146     /**
       
   147      * Gets a filted list of Location based Applications.
       
   148      *
       
   149      * Other documentation present in the corresponding function for
       
   150      * CLcService class. 
       
   151      */
       
   152      void GetLocationApplications( 
       
   153                             TRequestStatus&             aStatus,
       
   154                       const TLcLocationAppFilter&       aLocationAppFilter,
       
   155                             CLcLocationAppInfoArray*&   aAppInfoArray );
       
   156     
       
   157     /**
       
   158      * Cancels an outstanding @ref GetLocationApplications request.
       
   159      */
       
   160     void CancelGetLocationApplications();
       
   161     
       
   162     /**
       
   163      * Launches a Location based Application in the desired mode. 
       
   164      *
       
   165      * Other documentation present in the corresponding function for
       
   166      * CLcService class.
       
   167      */
       
   168     void LaunchLocationApplicationL( 
       
   169                 const TDesC&                      aAppIdentifier,
       
   170                 CLcLocationAppInfo::TLcLaunchMode aLaunchMode = CLcLocationAppInfo::EDefaultMode,
       
   171                 MLcAppExitObserver*               aChainedAppExitObserver = NULL );
       
   172  
       
   173     /**
       
   174      * Sets an observer for notifying changes to the Location Centre server.
       
   175      *
       
   176      * Other documentation present in the corresponding function for
       
   177      * CLcService class.  
       
   178      */
       
   179     void SetObserverL( MLcNotification&     aObserver );
       
   180                                             
       
   181     /**
       
   182      * Removes the observer that has already been set using the @ref SetObserverL method.
       
   183      *
       
   184      * Other documentation present in the corresponding function for
       
   185      * CLcService class.
       
   186      */
       
   187     TInt RemoveObserver();   
       
   188 
       
   189 public: // Inherited from the base classes
       
   190     /**
       
   191      * Inherited from MLcNotification
       
   192      */
       
   193     void LcStatusChangedL( TInt aErrorCode );
       
   194     	
       
   195 	/**
       
   196 	 * Inherited from MLcAsynOperationObserver
       
   197 	 */
       
   198 	void OperationComplete( TInt aError );            
       
   199     
       
   200 private:
       
   201     /**
       
   202      * Default C++ Constructor.
       
   203      */
       
   204     CLcServiceImpl();
       
   205                            
       
   206     /**
       
   207      * Second phase of the two phase constructor.
       
   208      */
       
   209     void ConstructL();
       
   210     
       
   211     /**
       
   212      * Leaving form of GetLocationApplications. This is needed because the API
       
   213      * does not leave whereas we need certain leaving operations to be performed
       
   214      * in the GetLocationApplications asynchronous version.
       
   215      */
       
   216 	void GetLocationApplicationsL( 
       
   217 	                TRequestStatus&             aStatus,
       
   218 	          const TLcLocationAppFilter&       aLocationAppFilter,
       
   219 	                CLcLocationAppInfoArray*&   aAppInfoArray );
       
   220 	                
       
   221     /**
       
   222      * Launches Location Centre with the supplied Applications in a pop-up
       
   223      * dialog and the user can select a Location based Application from the pop-up
       
   224      * list displayed.
       
   225      *
       
   226      * @param[in] aAppInfoArray Application Information array. The ownership of this
       
   227      *                          array is transferred to the pop-up.
       
   228      * @return TPtrC, Identifier corresponding to the element that has been selected.
       
   229      */ 
       
   230     TPtrC SelectLocationApplicationL( CLcLocationAppInfoArray*   aAppInfoArray );
       
   231        
       
   232 private:
       
   233     /**
       
   234      * Enumeration for the outstanding Pop-up operation.
       
   235      */
       
   236     enum TLcPopUpOutStanding
       
   237         {
       
   238         /**
       
   239          * Filtered based Applications
       
   240          */
       
   241         ELcPopupWithFiltering,
       
   242         ELcPopupWithSpecifiedApps,
       
   243         ELcPopupWithoutSpecifedApps
       
   244         };
       
   245         
       
   246 private: // Data        
       
   247     /**
       
   248      * Location Centre server client side session handle
       
   249      */
       
   250     RLcClientSession                iSession;
       
   251     
       
   252     /**
       
   253      * Location based Application's launcher.
       
   254      * This object can be used to launch all Location based Applications,
       
   255      * contents and services in the standalone mode or in the chained mode.
       
   256      * Owns
       
   257      */
       
   258     CLcAppLauncher*                 iAppLauncher;
       
   259         
       
   260     /**
       
   261      * Observer for notifications
       
   262      */
       
   263     MLcNotification*                iObserver;
       
   264     
       
   265     /**
       
   266      * Active Object for notification requests
       
   267      *
       
   268      * Owns
       
   269      */
       
   270     CLcNotificationAO*              iNotificationAO;
       
   271     
       
   272     /**
       
   273      * Request Status on which the Asynchronous request would be completed.
       
   274      */
       
   275     TRequestStatus*             	iStatus;
       
   276     
       
   277     /**
       
   278      * Location Centre Asynchronous operation handler.
       
   279      *
       
   280      * Owns
       
   281      */
       
   282     CLcAsyncOperation*				iAsyncOperation;
       
   283     
       
   284     /**
       
   285      * Location Centre pop-up.
       
   286      *
       
   287      * Owns.
       
   288      */
       
   289     CAknPopupList*                  iPopUp;
       
   290     
       
   291     /**
       
   292      * Location Centre pop-up list box.
       
   293      *
       
   294      * Owns.
       
   295      */
       
   296     CLcPopupListBox*                iPopUpListBox;
       
   297     
       
   298     /**
       
   299      * Idenfier of the Selected Application.
       
   300      */
       
   301     HBufC*                          iSelectedAppId;
       
   302     
       
   303     /**
       
   304      * Pop-up Operation outstanding
       
   305      */
       
   306     TLcPopUpOutStanding             iPopupOutStanding;
       
   307     
       
   308     /**
       
   309      * Filter conditions.
       
   310      * Owns.
       
   311      */
       
   312     TLcLocationAppFilter*           iFilter;
       
   313     
       
   314     /**
       
   315      * Array of applications which need to be included/excluded in the filtering
       
   316      * operation.
       
   317      *
       
   318      * Owns.
       
   319      */
       
   320     RArray<TPtrC>                   iAppArray;
       
   321     };
       
   322     
       
   323 
       
   324 #endif // C_LCSERVICEIMPL_H