datasourcemodules/defaultpositioningmodule/inc/epos_cpospsylisthandler.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPOSPSYLISTHANDLER_H
       
    21 #define CPOSPSYLISTHANDLER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <lbs.h>
       
    25 #include "epos_mposmodulesettingsmanager.h"
       
    26 #include "epos_mposmodulesettingslistener.h"
       
    27 #include "epos_mpospsylistlistener.h"
       
    28 #include "epos_mpospsyfixstatelistener.h"
       
    29 
       
    30 class MPosModuleSettingsManager;
       
    31 class CPosPsyFixStateManager;
       
    32 class CPosConstManager;
       
    33 
       
    34 /**
       
    35 * The CPosPsyListHandler manages dynamic list that is used by Default
       
    36 * Proxy to make location requests.
       
    37 */
       
    38 class CPosPsyListHandler : 
       
    39         public CBase, 
       
    40         public MPosModuleSettingsListener,
       
    41         public MPosPsyFixStateListener
       
    42     {
       
    43     public: // Constructors and destructor
       
    44               
       
    45         /**
       
    46         * Get an instance of CPosPsyListHandler.    
       
    47         *
       
    48         * This function must be called in pair with 
       
    49         * ReleaseInstance()
       
    50         *
       
    51         * @return The new instance of this class.
       
    52         */
       
    53         static CPosPsyListHandler* GetInstanceL();
       
    54         
       
    55         /**
       
    56         * Release the instance of CPosPsyListHandler
       
    57         *
       
    58         * This function must be called in pair with
       
    59         * GetInstanceL()
       
    60         */
       
    61         void ReleaseInstance();
       
    62 
       
    63         /**
       
    64         * Set module settings manager. If the manager is already set,
       
    65         * this function does nothing.
       
    66         * 
       
    67         * @param aManager Reference to module settings manager.
       
    68         */
       
    69         void SetModuleSettingsManagerL(
       
    70             MPosModuleSettingsManager& aManager );
       
    71         
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         ~CPosPsyListHandler();
       
    76 
       
    77     public: // Functions from base classes
       
    78         /**
       
    79         * Add a PSY list change listener
       
    80         * 
       
    81         * @param aListener Pointer to the PSY list change listener
       
    82         */
       
    83         void AddListenerL(
       
    84             MPosPsyListListener* aListener );
       
    85             
       
    86         /**
       
    87         * Remove a PSY list change listener.
       
    88         *
       
    89         * @param aListener Pointer to the PSY list change listener
       
    90         */
       
    91         void RemoveListener(
       
    92             MPosPsyListListener* aListener );
       
    93         
       
    94         /**
       
    95         * Get module list.
       
    96         *
       
    97         * @return aPsyList The PSY list in priority order.
       
    98         * the aPsyList will be emptied wether this function 
       
    99         * succeed or not.
       
   100         */
       
   101         void GetPsyListL(
       
   102             RArray< TPositionModuleId >& aPsyList );
       
   103             
       
   104         /**
       
   105         * Get external GPS PSY module list.
       
   106         *
       
   107         * @return aPsyList The PSY list contains all external
       
   108         * GPS modules. The list will be emptyied first.
       
   109         */
       
   110         void GetExtGpsPsyListL(
       
   111             RArray< TPositionModuleId >& aPsyList );
       
   112             
       
   113         /**
       
   114         * Check if first GPS PSY is located on external device.
       
   115         *
       
   116         * If there is no GPS PSY available in the list, this 
       
   117         * function will return ETrue
       
   118         */
       
   119         TBool IsFirstGpsPsyExternal() const;
       
   120             
       
   121         /**
       
   122         * Check if the PSY is based on Network technology.
       
   123         */
       
   124         TBool IsModuleNetworkBased(
       
   125             TPositionModuleId aModuleId ) const;
       
   126             
       
   127         /**
       
   128         * Check if the requested class is supported by the PSY
       
   129         */
       
   130         TBool IsClassSupported(
       
   131             TUint32 aClassType,
       
   132             TPositionModuleId aModuleId ) const;
       
   133             
       
   134         /**
       
   135         * Get TTFF and TTNF value of a specific PSY.
       
   136         *
       
   137         * @return KErrNone if successful. If the module is not found
       
   138         * then KErrNotFound is returned.
       
   139         */
       
   140         TInt GetTtffAndTtnf(
       
   141             TPositionModuleId aModuleId,
       
   142             TTimeIntervalMicroSeconds& aTtff,
       
   143             TTimeIntervalMicroSeconds& aTtnf ) const;
       
   144             
       
   145     protected: //From base class
       
   146         /*
       
   147         * From MPosModulesObserver.
       
   148         * Called when changes are made in the modules settings
       
   149         */
       
   150         virtual void HandleModuleSettingsChangedL(
       
   151             TPosModulesEvent aEvent );
       
   152             
       
   153         /**
       
   154         * From MPosPsyFixStateListener
       
   155         */
       
   156         virtual void PsyFixStateChanged( 
       
   157             TPositionModuleId aModuleId,
       
   158             CPosPsyFixStateManager::TPsyFixState aFixState ); 
       
   159             
       
   160 
       
   161     private:
       
   162 
       
   163         /**
       
   164         * C++ default constructor.
       
   165         */
       
   166         CPosPsyListHandler();
       
   167 
       
   168         /**
       
   169         * EPOC constructor.
       
   170         */
       
   171         void ConstructL();
       
   172         
       
   173         /**
       
   174         * Update module list
       
   175         */
       
   176         void UpdateModuleListL();
       
   177         
       
   178         /**
       
   179         * Find module in module info array.
       
   180         * This function returns KErrNotFound if module is not 
       
   181         * found in the array.
       
   182         */
       
   183         TInt ModuleIndex( TPositionModuleId aModuleId ) const;
       
   184         
       
   185         /**
       
   186         * Notify listener that PSY list is changed
       
   187         */
       
   188         void NotifyListeners( 
       
   189             const TPosPsyListChangeEvent& aEvent );
       
   190 
       
   191         /**
       
   192         * Check if the module is GPS type of technology
       
   193         */
       
   194         TBool IsGpsTechnology( 
       
   195             const TPositionModuleInfo& aModuleInfo ) const;
       
   196             
       
   197         /**
       
   198         * Move PSY to the top of PSY list. If aId is KPositionNullModuleId,
       
   199         * nothing will be done. Internal GPS PSY will not be moved if the 
       
   200         * top GPS PSY on external device and fix state is Yes.
       
   201         *
       
   202         * @return ETrue if the list is modified. Otherwise returns EFalse.
       
   203         */
       
   204         TBool MovePsyToTop( TPositionModuleId aId );
       
   205 
       
   206         // By default, prohibit copy constructor
       
   207         CPosPsyListHandler(const CPosPsyListHandler&);
       
   208         // Prohibit assigment operator
       
   209         CPosPsyListHandler& operator= (const CPosPsyListHandler&);
       
   210         
       
   211     private: // Data
       
   212         //Reference count
       
   213         TInt iRefCount;
       
   214         
       
   215         //Fix state manager
       
   216         CPosPsyFixStateManager* iFixStateManager;
       
   217         
       
   218         //Const manager
       
   219         CPosConstManager* iConstManager;
       
   220 
       
   221         //Listener array
       
   222         RPointerArray < MPosPsyListListener > iListenerArray;
       
   223 
       
   224         //modules
       
   225         MPosModuleSettingsManager* iModulesSettings;
       
   226         
       
   227         //Module info array
       
   228         RArray< TPositionModuleInfo > iModuleInfoArray;
       
   229         
       
   230     };
       
   231 
       
   232 #endif      // CPOSPSYLISTHANDLER_H  
       
   233             
       
   234 // End of File