|
1 /* |
|
2 * Copyright (c) 2004-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: Header file for CFMRadioSystemEventDetector. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFMRADIOSYSTEMEVENTDETECTOR_H |
|
20 #define CFMRADIOSYSTEMEVENTDETECTOR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "fmradiopropertyobserver.h" |
|
25 |
|
26 class MFMRadioSystemEventDetectorObserver; |
|
27 |
|
28 /** System properties mappings */ |
|
29 enum TFMRadioSystemEvents |
|
30 { |
|
31 EFMRadioNetworkCoverageProperty = 0, |
|
32 EFMRadioCallProperty, |
|
33 EFMRadioAudioResourcesProperty, |
|
34 EFMRadioVoiceUiProperty |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Catches notification of the call and network state changes. |
|
39 * |
|
40 * Class provides implementation to detect system events and notify UI components of the event, |
|
41 * Class keeps several instances of CFMRadioPropertyObserver, and those instances send event notifications |
|
42 * about the particular system component state change. |
|
43 */ |
|
44 class CFMRadioSystemEventDetector : public CBase, public MFMRadioPropertyChangeObserver |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aObserver a reference to the observer interface implementer |
|
51 */ |
|
52 static CFMRadioSystemEventDetector* NewL(MFMRadioSystemEventDetectorObserver& aObserver); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CFMRadioSystemEventDetector(); |
|
58 |
|
59 /** |
|
60 * Returns network coverage state. |
|
61 */ |
|
62 TBool IsNetworkCoverage() const; |
|
63 |
|
64 /** Is Auto resume allowed; based on categories */ |
|
65 TBool IsAutoResumePossible() const; |
|
66 |
|
67 /** |
|
68 * Returns current call state. |
|
69 */ |
|
70 TBool IsCallActive() const; |
|
71 |
|
72 |
|
73 |
|
74 private: |
|
75 |
|
76 /** |
|
77 * By default EPOC constructor is private. |
|
78 */ |
|
79 void ConstructL(); |
|
80 |
|
81 /** |
|
82 * C++ default constructor. |
|
83 * @param aObserver a reference to the observer interface implementer |
|
84 */ |
|
85 CFMRadioSystemEventDetector(MFMRadioSystemEventDetectorObserver& aObserver); |
|
86 /** |
|
87 * Callback for auto resume timer |
|
88 * @param aSelfPtr pointer to itself |
|
89 */ |
|
90 static TInt StaticAutoResumeTimerCallback( TAny* aSelfPtr ); |
|
91 /** |
|
92 * Report audio resource availability to observers. |
|
93 */ |
|
94 void NotifyAudioResourcesAvailability(); |
|
95 |
|
96 // From base class MFMRadioPropertyChangeObserver |
|
97 void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TInt aValue); |
|
98 void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC8& aValue); |
|
99 void HandlePropertyChangeL(const TUid& aCategory, const TUint aKey, const TDesC& aValue); |
|
100 void HandlePropertyChangeErrorL(const TUid& aCategory, const TUint aKey, TInt aError); |
|
101 |
|
102 private: // Data |
|
103 |
|
104 /** Array of audio policy categories that radio must not resume after. */ |
|
105 RArray<TInt> iNoAutoResumeAudioCategories; |
|
106 |
|
107 /**Observer which will be notified of the call and network state changes*/ |
|
108 MFMRadioSystemEventDetectorObserver& iObserver; |
|
109 |
|
110 /**An array of handlers to Publish & Subscribe interface*/ |
|
111 RPointerArray<CFMRadioPropertyObserver> iPropertyArray; |
|
112 |
|
113 /**Indicator for the network status*/ |
|
114 TBool iIsNetworkCoverage; |
|
115 // for tracking currently playing audio clients |
|
116 TInt iNumberOfActiveAudioClients; |
|
117 /** Indicator for Voice UI status. */ |
|
118 TBool iIsVoiceUiActive; |
|
119 /** flag for call status */ |
|
120 TBool iIsCallActive; |
|
121 /** call status observer */ |
|
122 CFMRadioPropertyObserver* iCallStatusObserver; |
|
123 /* timer for audio auto resume */ |
|
124 CPeriodic* iAutoResumeTimer; |
|
125 |
|
126 }; |
|
127 |
|
128 #endif // CFMRADIOSYSTEMEVENTDETECTOR_H |
|
129 |