locationcentre/lcservice/src/lcservice.cpp
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 interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDES
       
    20 
       
    21 // USER INCLUDES
       
    22 #include "lcservice.h"
       
    23 #include "lcserviceimpl.h"
       
    24 #include "lclocationappfilter.h"
       
    25 #include "lcappexitobserver.h"
       
    26 #include "lcnotification.h"
       
    27 
       
    28 // ---------- Member funtions for CLcService::CLcLaunchParam -----------------
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CLcService::CLcLaunchParam::CLcLaunchParam
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CLcService::CLcLaunchParam::CLcLaunchParam( 
       
    35 					CLcLocationAppInfo::TLcLaunchMode aLaunchMode)
       
    36 	:iLaunchMode( aLaunchMode )
       
    37 	{
       
    38 	}
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CLcService::CLcLaunchParam::~CLcLaunchParam
       
    42 // ---------------------------------------------------------------------------
       
    43 //	
       
    44 CLcService::CLcLaunchParam::~CLcLaunchParam()
       
    45 	{
       
    46 	delete iId;
       
    47 	}
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CLcService::CLcLaunchParam::NewL
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CLcService::CLcLaunchParam* CLcService::CLcLaunchParam::NewL( 
       
    54 							const TDesC&     						aAppId,
       
    55 								  CLcLocationAppInfo::TLcLaunchMode aLaunchMode )
       
    56 	{
       
    57 	CLcService::CLcLaunchParam* self = NewLC( aAppId, aLaunchMode );
       
    58 	CleanupStack::Pop( self );
       
    59 	return self;
       
    60 	}
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CLcService::CLcLaunchParam::NewLC
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 EXPORT_C CLcService::CLcLaunchParam* CLcService::CLcLaunchParam::NewLC( 
       
    67 						const TDesC&     					    aAppId,
       
    68 						   	  CLcLocationAppInfo::TLcLaunchMode aLaunchMode )
       
    69 	{
       
    70 	CLcService::CLcLaunchParam* self = new ( ELeave )CLcService::CLcLaunchParam( aLaunchMode );
       
    71 	CleanupStack::PushL( self );
       
    72 	self->ConstructL( aAppId );
       
    73 	return self;
       
    74 	}
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // TPtrC  CLcService::CLcLaunchParam::Id
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 TPtrC  CLcService::CLcLaunchParam::Id() const
       
    81 	{
       
    82     // Check whether the application id exists, incase it doesnt exist then
       
    83     // return a NULL string.
       
    84     if( !iId )
       
    85         {
       
    86         return TPtrC();
       
    87         }
       
    88     // Return the Application Id.
       
    89     return *iId;	
       
    90 	}
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CLcLocationAppInfo::TLcLaunchMode  CLcLaunchParam::LaunchMode
       
    94 // ---------------------------------------------------------------------------
       
    95 //	
       
    96 CLcLocationAppInfo::TLcLaunchMode  CLcService::CLcLaunchParam::LaunchMode() const
       
    97 	{
       
    98 	return iLaunchMode;
       
    99 	}
       
   100 	
       
   101 // ---------------------------------------------------------------------------
       
   102 // void CLcService::CLcLaunchParam::ConstructL
       
   103 // ---------------------------------------------------------------------------
       
   104 //	
       
   105 void CLcService::CLcLaunchParam::ConstructL( const TDesC& 	aAppId )
       
   106 	{
       
   107 	iId = aAppId.AllocL();
       
   108 	}
       
   109 	
       
   110 // ---------- Member funtions for CLcService ---------------------------------
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // CLcService::CLcService
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 CLcService::CLcService()
       
   117     {
       
   118     // C++ Default constructor. No allocations or functions which can Leave
       
   119     // should be called from here.
       
   120     }
       
   121          
       
   122 // ---------------------------------------------------------------------------
       
   123 // CLcService::~CLcService
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 CLcService::~CLcService()
       
   127     {
       
   128     // C++ Destructor. Free all resources associated with this class.
       
   129     
       
   130     delete iImplementation;
       
   131     }
       
   132         
       
   133 // ---------------------------------------------------------------------------
       
   134 // CLcService* CLcService::NewL
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C CLcService* CLcService::NewL()
       
   138     {
       
   139     CLcService* self = NewLC();
       
   140     CleanupStack::Pop( self );
       
   141     return self;         
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // CLcService* CLcService::NewLC
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C CLcService* CLcService::NewLC()
       
   149     {
       
   150     // Symbian Two phased constructor. Leaves the object on the Clean-up
       
   151     // stack.
       
   152     CLcService* self = 
       
   153                 new ( ELeave )CLcService();
       
   154     CleanupStack::PushL( self );
       
   155     self->ConstructL();
       
   156     return self;         
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // void CLcService::ConstructL
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 void CLcService::ConstructL()
       
   164     {
       
   165     // Second phase of the two phase constructor.
       
   166     
       
   167     // Create the Location Centre API implementation
       
   168     iImplementation = CLcServiceImpl::NewL();
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // void CLcService::LaunchLocationCentreL
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 EXPORT_C void CLcService::LaunchLocationCentreL(
       
   176             CLcLocationAppInfo::TLcLaunchMode   aLaunchMode,                        
       
   177             MLcAppExitObserver*                 aChainedAppExitObserver )
       
   178     {
       
   179     // The Filter construction without any arguments will act as no filtering
       
   180     // applied on the list of Location based Applications and Contents/Services.
       
   181     TLcLocationAppFilter filter; 
       
   182         
       
   183     iImplementation->LaunchLocationCentreL( filter,
       
   184                                             aLaunchMode,
       
   185                                             aChainedAppExitObserver );
       
   186     }
       
   187                     
       
   188 // ---------------------------------------------------------------------------
       
   189 // void CLcService::LaunchLocationCentreL
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 EXPORT_C void CLcService::LaunchLocationCentreL( 
       
   193               const TLcLocationAppFilter&             aLocationAppFilter,
       
   194                     CLcLocationAppInfo::TLcLaunchMode aLaunchMode,                        
       
   195                     MLcAppExitObserver*               aChainedAppExitObserver )
       
   196     {
       
   197     iImplementation->LaunchLocationCentreL( aLocationAppFilter,
       
   198                                             aLaunchMode,
       
   199                                             aChainedAppExitObserver );
       
   200     }
       
   201     
       
   202 // ---------------------------------------------------------------------------
       
   203 // void CLcService::LaunchLocationCentreL
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 EXPORT_C void CLcService::LaunchLocationCentreL(
       
   207                   const RPointerArray<CLcLaunchParam>& aIncludeAppArray,
       
   208                   MLcAppExitObserver*           aChainedAppExitObserver )
       
   209     {
       
   210     iImplementation->LaunchLocationCentreL( aIncludeAppArray,
       
   211                                             aChainedAppExitObserver );
       
   212     }
       
   213     
       
   214 // ---------------------------------------------------------------------------
       
   215 // void CLcService::LaunchLocationCentreL
       
   216 // ---------------------------------------------------------------------------
       
   217 //
       
   218 EXPORT_C void CLcService::LaunchLocationCentreL( 
       
   219                     const RArray<TPtrC>&              aExcludeAppArray,
       
   220                     CLcLocationAppInfo::TLcLaunchMode aLaunchMode,
       
   221                     MLcAppExitObserver*               aChainedAppExitObserver )
       
   222     {
       
   223     iImplementation->LaunchLocationCentreL( aExcludeAppArray,
       
   224                                             aLaunchMode,
       
   225                                             aChainedAppExitObserver );    
       
   226     }
       
   227 
       
   228 // ---------------------------------------------------------------------------
       
   229 // void CLcService::SelectLocationApplicationL
       
   230 // ---------------------------------------------------------------------------
       
   231 //
       
   232 EXPORT_C TPtrC CLcService::SelectLocationApplicationL()
       
   233     {
       
   234     // The Filter construction without any arguments will act as no filtering
       
   235     // applied on the list of Location based Applications and Contents/Services.
       
   236     // coverity[var_decl : FALSE]
       
   237     TLcLocationAppFilter filter;    
       
   238     // coverity[uninit_use_in_call : FALSE]
       
   239     return iImplementation->SelectLocationApplicationL( filter );
       
   240     }
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // void CLcService::SelectLocationApplicationL
       
   244 // ---------------------------------------------------------------------------
       
   245 //
       
   246 EXPORT_C TPtrC CLcService::SelectLocationApplicationL(
       
   247                         const TLcLocationAppFilter& aLocationAppFilter )
       
   248     {
       
   249     return iImplementation->SelectLocationApplicationL( aLocationAppFilter );      
       
   250     }
       
   251     
       
   252 // ---------------------------------------------------------------------------
       
   253 // void CLcService::SelectLocationApplicationL
       
   254 // ---------------------------------------------------------------------------
       
   255 //
       
   256 EXPORT_C TPtrC CLcService::SelectLocationApplicationL(
       
   257                             const RArray<TPtrC>&    aAppArray,
       
   258                                   TBool             aIncludeFlag )
       
   259     {
       
   260     return iImplementation->SelectLocationApplicationL( aAppArray,
       
   261                                                         aIncludeFlag );        
       
   262     }
       
   263 
       
   264 // ---------------------------------------------------------------------------
       
   265 // CLcLocationAppInfoArray* CLcService::GetLocationApplicationsL
       
   266 // ---------------------------------------------------------------------------
       
   267 //    
       
   268 EXPORT_C CLcLocationAppInfoArray* CLcService::GetLocationApplicationsL()
       
   269     {
       
   270     // The Get Location Applications call is implemented as a Get Location
       
   271     // based Applications function which doesn't have any filtering. So, we
       
   272     // need to create an empty filter and pass it to this function.
       
   273     
       
   274     // The Filter construction without any arguments will act as no filtering
       
   275     // applied on the list of Location based Applications and Contents/Services.
       
   276     TLcLocationAppFilter filter;
       
   277     return iImplementation->GetLocationApplicationsL( filter );
       
   278     }
       
   279 
       
   280 // ---------------------------------------------------------------------------
       
   281 // void CLcService::GetLocationApplications
       
   282 // ---------------------------------------------------------------------------
       
   283 //    
       
   284 EXPORT_C void CLcService::GetLocationApplications(
       
   285             TRequestStatus&             aStatus,
       
   286             CLcLocationAppInfoArray*&   aAppInfoArray )
       
   287     {
       
   288     TLcLocationAppFilter filter;    
       
   289     iImplementation->GetLocationApplications( aStatus,
       
   290     										  filter,
       
   291     										  aAppInfoArray );
       
   292     }
       
   293     
       
   294 // ---------------------------------------------------------------------------
       
   295 // CLcLocationAppInfoArray* CLcService::GetLocationApplicationsL
       
   296 // ---------------------------------------------------------------------------
       
   297 //    
       
   298 EXPORT_C CLcLocationAppInfoArray* CLcService::GetLocationApplicationsL(
       
   299             const TLcLocationAppFilter&     aLocationAppFilter )
       
   300     {
       
   301     return iImplementation->GetLocationApplicationsL( aLocationAppFilter );
       
   302     }
       
   303     
       
   304 // ---------------------------------------------------------------------------
       
   305 // void CLcService::GetLocationApplicationsL
       
   306 // ---------------------------------------------------------------------------
       
   307 //    
       
   308 EXPORT_C void CLcService::GetLocationApplications(
       
   309                             TRequestStatus&             aStatus,
       
   310                       const TLcLocationAppFilter&       aLocationAppFilter,
       
   311                             CLcLocationAppInfoArray*&   aAppInfoArray )
       
   312     {
       
   313     iImplementation->GetLocationApplications( aStatus,
       
   314                                               aLocationAppFilter,
       
   315                                               aAppInfoArray );
       
   316     }
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // void CLcService::CancelGetLocationApplications
       
   320 // ---------------------------------------------------------------------------
       
   321 //     
       
   322 EXPORT_C void CLcService::CancelGetLocationApplications()
       
   323     {
       
   324     iImplementation->CancelGetLocationApplications(); 
       
   325     }
       
   326 
       
   327 // ---------------------------------------------------------------------------
       
   328 // void CLcService::LaunchLocationApplicationL
       
   329 // ---------------------------------------------------------------------------
       
   330 // 
       
   331 EXPORT_C void CLcService::LaunchLocationApplicationL( 
       
   332                 const TDesC&                      aAppIdentifier,
       
   333                 CLcLocationAppInfo::TLcLaunchMode aLaunchMode,
       
   334                 MLcAppExitObserver*               aChainedAppExitObserver )
       
   335     {
       
   336     iImplementation->LaunchLocationApplicationL( aAppIdentifier,
       
   337                                                  aLaunchMode,
       
   338                                                  aChainedAppExitObserver );
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // void CLcService::SetObserverL
       
   343 // ---------------------------------------------------------------------------
       
   344 // 
       
   345 EXPORT_C void CLcService::SetObserverL( MLcNotification&    aObserver )
       
   346     {
       
   347     iImplementation->SetObserverL( aObserver );
       
   348     }
       
   349 
       
   350 // ---------------------------------------------------------------------------
       
   351 // TInt CLcService::RemoveObserver
       
   352 // ---------------------------------------------------------------------------
       
   353 //                                         
       
   354 EXPORT_C TInt CLcService::RemoveObserver()
       
   355     {
       
   356     return iImplementation->RemoveObserver();
       
   357     }
       
   358                                                            
       
   359 // End of File
       
   360