|
1 /* |
|
2 * Copyright (c) 2006-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 HWRMFMTXSTATEUTILITY_H |
|
21 #define HWRMFMTXSTATEUTILITY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "HWRMPSChangeObserver.h" |
|
26 #include "HWRMPluginHandler.h" |
|
27 #include "HWRMFmTxPowersaveTimer.h" |
|
28 #include "HWRMFmTxData.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CHWRMFmTxService; |
|
32 class CHWRMFmTxCommonData; |
|
33 class CHWRMPluginHandler; |
|
34 class CHWRMReservationHandler; |
|
35 |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Handles FM Tx and Audio Routing state changes. |
|
41 * Some events require plug-in requests to be sent automatically. |
|
42 */ |
|
43 class CHWRMFmTxStateUtility : public CBase, |
|
44 public MHWRMPSChangeObserver, |
|
45 public MHWRMIndicationHandler, |
|
46 public MHWRMFmTxPowerSaveTimerObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 // Constructors and Destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * |
|
55 * @param aPluginHandler Pointer to plugin handler for FM Tx |
|
56 * @param aWatcherPluginHandler Pointer to watcher plugin handler for FM Tx |
|
57 * @param aReservationHandler Pointer to reservation handler for FM Tx |
|
58 * @param aFmTxCommonData Pointer to FM Tx common data storage |
|
59 */ |
|
60 static CHWRMFmTxStateUtility* NewL(CHWRMPluginHandler* aPluginHandler, |
|
61 CHWRMPluginHandler* aWatcherPluginHandler, |
|
62 CHWRMReservationHandler* aReservationHandler, |
|
63 CHWRMFmTxCommonData* aFmTxCommonData); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CHWRMFmTxStateUtility(); |
|
69 |
|
70 public: // Functions from base classes |
|
71 |
|
72 // From MHWRMPSChangeObserver |
|
73 void PSValueChanged(const TUid& aUid, TUint32 aKey, TInt aValue); |
|
74 |
|
75 // From MHWRMIndicationHandler |
|
76 virtual void ProcessIndicationL( const TUint32 aId, TDesC8& aData ); |
|
77 |
|
78 /** |
|
79 * HWRMFmTxPowerSaveTimer calls this method when timer expires |
|
80 */ |
|
81 void TimerExpired(); |
|
82 |
|
83 private: |
|
84 |
|
85 /** |
|
86 * C++ default constructor. |
|
87 */ |
|
88 CHWRMFmTxStateUtility(); |
|
89 |
|
90 /** |
|
91 * By default Symbian 2nd phase constructor is private. |
|
92 * |
|
93 * @param aPluginHandler Pointer to plugin handler for FM Tx |
|
94 * @param aWatcherPluginHandler Pointer to watcher plugin handler for FM Tx |
|
95 * @param aReservationHandler Pointer to reservation handler for FM Tx |
|
96 * @param aFmTxCommonData Pointer to FM Tx common data storage |
|
97 */ |
|
98 void ConstructL(CHWRMPluginHandler* aPluginHandler, |
|
99 CHWRMPluginHandler* aWatcherPluginHandler, |
|
100 CHWRMReservationHandler* aReservationHandler, |
|
101 CHWRMFmTxCommonData* aFmTxCommonData); |
|
102 |
|
103 /** |
|
104 * Stops and deletes power save timer. |
|
105 * |
|
106 */ |
|
107 void CancelPowerSaveTimer(); |
|
108 |
|
109 private: |
|
110 |
|
111 CHWRMFmTxService* iFmTxService; // Used to notify plugin about Audio Policy events. Owned. |
|
112 CHWRMFmTxCommonData* iFmTxCommonData; // Pointer to FM Tx common data storage. Not owned. |
|
113 |
|
114 TFmTxState iPreviousState; // Cached FM Tx state |
|
115 |
|
116 CHWRMPSChangeObserver* iFmTxStateObserver; // Observes FM Tx status. Owned. |
|
117 CHWRMPSChangeObserver* iPowerSaveObserver; // Observes power save flag. Owned. |
|
118 CHWRMPSChangeObserver* iAudioRoutedObserver; // Observes audio routed flag. Owned. |
|
119 |
|
120 /* |
|
121 * Power save timer for audio routing inactivity. |
|
122 * This variable is usually NULL, the timer is created and started when |
|
123 * audio output is no longer routed to FM Tx chip, which is still active. |
|
124 * Owned. |
|
125 */ |
|
126 CHWRMFmTxPowerSaveTimer* iPowerSaveTimer; |
|
127 |
|
128 // Used to determine whether standby or off state entered from audio policy point of view |
|
129 TBool iEnableStandby; |
|
130 }; |
|
131 |
|
132 #endif // HWRMFMTXSTATEUTILITY_H |
|
133 |
|
134 // End of File |