datasourcemodules/bluetoothgpspositioningmodule/btgpspsy/inc/Utils/BTGPSPowerManager.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 /*
       
     2 * Copyright (c) 2005-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 
       
    21 #ifndef BTGPSPOWERMANAGER_H
       
    22 #define BTGPSPOWERMANAGER_H
       
    23 
       
    24 //  INCLUDES
       
    25 
       
    26 #include <e32base.h>
       
    27 #include "BTGPSPsyConnectionListener.h"
       
    28 #include "BTGPSDeviceListener.h"
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CBTGPSConnectManager;
       
    40 class CBTGPSPsyConnectionManager;
       
    41 class CBTGPSDeviceManager;
       
    42 class CBTGPSConstantsManager;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  This class manages power related features. It shurts down BT connection
       
    48 *  when there is not location request received within pre-defined timeout
       
    49 *  value.
       
    50 *  
       
    51 */
       
    52 class CBTGPSPowerManager: 
       
    53         public CBase, 
       
    54         private MBTGPSPsyConnectionListener,
       
    55         private MBTGPSDeviceListener
       
    56     {
       
    57     public: 
       
    58 
       
    59         /**
       
    60         * Two-phase construction.
       
    61         * @param aConnectManager Reference to connect manager
       
    62         * @param aPsyConnectionManager Reference to connection manager
       
    63         * @param aDeviceManager Reference to device manager.
       
    64         * @param aConstantsManager Reference to contants manager.
       
    65         */
       
    66         static CBTGPSPowerManager * NewL(
       
    67             CBTGPSConnectManager& aConnectManager,
       
    68             CBTGPSPsyConnectionManager& aPsyConnectionManager,
       
    69             CBTGPSDeviceManager& aDeviceManager,
       
    70             CBTGPSConstantsManager& aConstantsManager);
       
    71 
       
    72         /**
       
    73         * Destructor
       
    74         */
       
    75         virtual ~CBTGPSPowerManager();
       
    76 
       
    77     private:
       
    78     
       
    79         /**
       
    80         * From MBTGPSPsyConnectionListener
       
    81         */
       
    82         virtual void HandlePsyConnectionChange();
       
    83         
       
    84         /**
       
    85         * From MBTGPSDeviceListener
       
    86         */
       
    87         virtual void BTDeviceStatusChanged(
       
    88             TInt aConnectStatus, 
       
    89             TInt aDeviceType,
       
    90             TInt aErr=KErrNone);
       
    91         
       
    92 
       
    93     private:
       
    94 
       
    95         /**
       
    96         * Second phase of the construction
       
    97         */
       
    98         void ConstructL();
       
    99 
       
   100         /**
       
   101         * Private constructor
       
   102         */
       
   103         CBTGPSPowerManager(
       
   104             CBTGPSConnectManager& aConnectManager,
       
   105             CBTGPSPsyConnectionManager& aPsyConnectionManager,
       
   106             CBTGPSDeviceManager& aDeviceManager,
       
   107             CBTGPSConstantsManager& aConstantsManager);
       
   108         
       
   109         /**
       
   110         * Start or cancel timer if necessary.
       
   111         */
       
   112         void CheckTimer();    
       
   113         
       
   114         /**
       
   115         * Timer callback function
       
   116         */
       
   117         void TimerTick();
       
   118         
       
   119         /**
       
   120         * Static timer callback function
       
   121         */
       
   122         static TInt TimerCallback(TAny* aAny);
       
   123         
       
   124     private:
       
   125         //Connect manager
       
   126         CBTGPSConnectManager& iConnectManager;
       
   127         
       
   128         //Psy connection manager
       
   129         CBTGPSPsyConnectionManager& iPsyConnectionManager;
       
   130         
       
   131         //Device manager
       
   132         CBTGPSDeviceManager& iDeviceManager;
       
   133         
       
   134         //Constants manager
       
   135         CBTGPSConstantsManager& iConstantsManager;
       
   136         
       
   137         //Timer
       
   138         CPeriodic* iTimer;
       
   139     };
       
   140 #endif
       
   141 // End of File
       
   142