locationcentre/lcserver/inc/lcserverengine.h
branchRCL_3
changeset 9 4721bd00d3da
parent 8 3a25f69541ff
child 11 e15b7f06eba6
equal deleted inserted replaced
8:3a25f69541ff 9: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 Server Engine Object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_LCSERVERENGINE_H
       
    20 #define C_LCSERVERENGINE_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <lclocationappfilter.h>
       
    25 
       
    26 // USER INCLUDES
       
    27 #include "lcipcparams.h"
       
    28 #include "lcregistryobserver.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CLcRegistry;
       
    32 class MLcServerEngineObserver;
       
    33 
       
    34 /**
       
    35  *  Location Centre server engine.
       
    36  *
       
    37  *  This class handles all the requests for the Location Centre Server. The
       
    38  *  requests from the Server session objects are transferred to this object
       
    39  *  which then handles the requests. There is only one instance of this
       
    40  *  class for the entire Server Engine. This class also contains the Location
       
    41  *  Centre registry and observes for anychanges to the Registry.
       
    42  *
       
    43  *  @since S60 v5.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CLcServerEngine ): public CBase,
       
    46                                       public MLcRegistryObserver
       
    47     {
       
    48 public:
       
    49     /**
       
    50      * Constructs a new instance of Location Centre server engine.
       
    51      *
       
    52      
       
    53      * @param[in] aObserver Observer to the Location Centre Server
       
    54      *                      Engine.
       
    55      * @return The new instance of Location Centre server engine object.
       
    56      * @leave System wide error code if the object creation fails.         
       
    57      */
       
    58     static CLcServerEngine* NewL( 
       
    59                     MLcServerEngineObserver&    aObserver );
       
    60     
       
    61     /**
       
    62      * Constructs a new instance of Location Centre server engine.
       
    63      * Leaves the created instance on the cleanup stack.
       
    64      *
       
    65      * @param[in] aObserver Observer to the Location Centre Server
       
    66      *                      Engine.     
       
    67      * @return The new instance of Location Centre server engine object.
       
    68      * @leave System wide error code if the object creation fails.         
       
    69      */
       
    70     static CLcServerEngine* NewLC(
       
    71                     MLcServerEngineObserver&    aObserver );        
       
    72 
       
    73     /**
       
    74      * C++ Destructor.
       
    75      * Frees all the resources associated with this Location Centre
       
    76      * server engine
       
    77      */
       
    78     virtual ~CLcServerEngine();
       
    79     
       
    80     /**
       
    81      * Services the Client Request. The Engine provides a one place
       
    82      * destination for servicing all Client request. If the registry
       
    83      * is under updation, then the request is queued and the request
       
    84      * is served after the updation is completed.
       
    85      *
       
    86      * @param[in] aMessage The Message requets which needs to be served.
       
    87      */
       
    88     void DoServiceL( const RMessage2&      aMessage );
       
    89 
       
    90 public: // Inherited from MLcRegistryObserver
       
    91     void RegistryUnderUpdation();
       
    92     
       
    93     void RegistryUpdated();
       
    94              
       
    95 private:
       
    96     /**
       
    97      * C++ Default constructor
       
    98      */
       
    99     CLcServerEngine( MLcServerEngineObserver&    aObserver );
       
   100     
       
   101     /**
       
   102      * Second phase of the two phase constructor
       
   103      */
       
   104     void ConstructL();
       
   105     
       
   106     /**
       
   107      * Services all the Requets which are outstanding. The implementation
       
   108      * of the Engine class ensures that all this function is called
       
   109      * only when the Engine is in a consistent state.
       
   110      */
       
   111     void ServiceRequests();
       
   112     
       
   113     /**
       
   114      * Services a client request which is outstanding.
       
   115      *
       
   116      * @param[in] aMessage Request message which is outstanding
       
   117      */
       
   118     void ServiceRequestL( RMessage2&      aMessage );
       
   119     
       
   120     /**
       
   121      * Filters the List of Location based Application based on the
       
   122      * System Characteristics and Application Characteristics.
       
   123      *
       
   124      * @param[in] aAppFilter            Filter properties that need to be applied
       
   125      *                                  on the list of Location based Applications.
       
   126      * @param[out] aFilteredAppArray    Array of Location based Applications after
       
   127      *                                  filtering.
       
   128      */
       
   129     void GetFilteredAppsL( 
       
   130             TLcLocationAppFilter&         aAppFilter,             
       
   131             RLcIpcAppInfoArray&           aFilteredAppArray );
       
   132     
       
   133     /**
       
   134      * Obtains a specified set of Location based Applications.
       
   135      *
       
   136      * @param[in] aSpecifedApps         List of Specified Applications whose
       
   137      *                                  description is sought.
       
   138      * @param[out] aFilteredAppArray    Array of specified Location based
       
   139      *                                  Applications.    
       
   140      */
       
   141     void GetSpecifiedAppsL( 
       
   142             RLcIpcAppIdArray&             aSpecifedApps,            
       
   143             RLcIpcAppInfoArray&           aSpecifiedAppArray );    
       
   144     /**
       
   145      * Obtains a list of Location based Application without a specified set
       
   146      * of Location based Applications.
       
   147      *
       
   148      * @param[in] aSpecifedApps         List of Specified Applications whose
       
   149      *                                  description is sought.
       
   150      * @param[out] aFilteredAppArray    Array of Location based Applications
       
   151      *                                  without the specified list.    
       
   152      */
       
   153     void GetWithoutSpecifiedAppsL( 
       
   154             RLcIpcAppIdArray&             aSpecifedApps,              
       
   155             RLcIpcAppInfoArray&           aSpecifiedAppArray );
       
   156     
       
   157     /**
       
   158      * Compares a filter value under specifed configurations.
       
   159      * In the usage of this function, the Engine passes the filter requested by
       
   160      * the Client application as the first parameter and compares it with
       
   161      * the filter of the Location based Application to determine whether the
       
   162      * application satisfies the required filter configuration.
       
   163      *
       
   164      * @param[in] aFilter           New filter parameter.
       
   165      * @param[in] aFiltertoCompare  Filter to which the filter passed in the first
       
   166      *                              argument must be compared with.
       
   167      * @param[in] aFilterConfig     Filter configuration which should be used for
       
   168      *                              comparison.
       
   169      */        
       
   170     TBool  Compare( TUint32         aFilter,
       
   171                     TUint32         aFiltertoCompare, 
       
   172                     TInt            aFilterConfig );
       
   173                     
       
   174 	/**
       
   175 	 * Compares the SID of the application being processed currently with that of
       
   176 	 * the message which is handled. This is needed to ensure that the application
       
   177 	 * which requested for the list of Location based Applications does not
       
   178 	 * figure in the list requested.
       
   179 	 *
       
   180 	 * @param[in] aAppSid	SID of the application.
       
   181 	 * @return TBool, ETrue if the SID matches
       
   182 	 *                EFalse if the SID doesnt match
       
   183 	 */                    
       
   184 	TBool IsSameSID( const TDesC&		aAppSid );
       
   185     
       
   186 private:
       
   187     /**
       
   188      * Location Centre Registry object.
       
   189      *
       
   190      * Owns.
       
   191      */
       
   192     CLcRegistry*                iRegistry;
       
   193     
       
   194     /**
       
   195      * Array of messages which need to be serviced. This class doesn't
       
   196      * own these message objects but just holds a reference to them.
       
   197      */
       
   198     RPointerArray< RMessage2 >  iMessageArray;
       
   199     
       
   200     /**
       
   201      * Observer to the Location Centre Server Engine class.
       
   202      */
       
   203     MLcServerEngineObserver&    iObserver;
       
   204     
       
   205     /**
       
   206      * Boolean value to indicate whether the Location Centre Registry
       
   207      * is currently under updation. This is required because we
       
   208      * cannot fetch the Registry values when its under updation.
       
   209      */
       
   210     TBool                       iRegistryUnderUpdate;
       
   211     
       
   212     /**
       
   213      * SID of the process which has initiated the current request
       
   214      */
       
   215     TUint32						iCurrentRequestorSid;
       
   216     
       
   217     };
       
   218 
       
   219 #endif // C_LCSERVERENGINE_H