24
|
1 |
/*
|
|
2 |
* Copyright (c) 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 |
#ifndef RADIOENGINEWRAPPER_P_H
|
|
19 |
#define RADIOENGINEWRAPPER_P_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <QScopedPointer>
|
|
24 |
#include <QList>
|
|
25 |
|
|
26 |
// User includes
|
|
27 |
#include "radioenginewrapper.h"
|
|
28 |
#include "mradioenginehandlerobserver.h"
|
|
29 |
|
|
30 |
// Forward declarations
|
|
31 |
class CRadioEngineHandler;
|
|
32 |
class RadioControlEventListener;
|
|
33 |
class RadioRdsListener;
|
|
34 |
class RadioSettingsIf;
|
|
35 |
class RadioSettings;
|
|
36 |
class RadioStationHandlerIf;
|
|
37 |
class RadioEngineWrapperObserver;
|
|
38 |
|
|
39 |
typedef QList<RadioEngineWrapperObserver*> ObserverList;
|
|
40 |
|
|
41 |
// Constants
|
|
42 |
|
|
43 |
#define RUN_NOTIFY_LOOP( list, func ) \
|
|
44 |
foreach( RadioEngineWrapperObserver* observer, list ) { \
|
|
45 |
observer->func; \
|
|
46 |
}
|
|
47 |
|
|
48 |
// Class declaration
|
|
49 |
class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
|
|
50 |
{
|
|
51 |
Q_DECLARE_PUBLIC( RadioEngineWrapper )
|
|
52 |
Q_DISABLE_COPY( RadioEngineWrapperPrivate )
|
|
53 |
|
|
54 |
friend class RadioFrequencyScanningHandler;
|
|
55 |
|
|
56 |
public:
|
|
57 |
|
|
58 |
RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
|
|
59 |
RadioStationHandlerIf& stationHandler );
|
|
60 |
|
|
61 |
virtual ~RadioEngineWrapperPrivate();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Initialization and startup
|
|
65 |
*/
|
|
66 |
void init();
|
|
67 |
bool isEngineConstructed();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Returns the radio settings
|
|
71 |
*/
|
|
72 |
RadioSettingsIf& settings();
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Getter for CRadioEngineHandler instance.
|
|
76 |
* Returns reference to the CRadioEngineHandler
|
|
77 |
*/
|
|
78 |
CRadioEngineHandler& RadioEnginehandler();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Functions called from slots to tune to given frequency or preset
|
|
82 |
*/
|
|
83 |
void tuneFrequency( uint frequency, const int reason );
|
|
84 |
void tuneWithDelay( uint frequency, const int reason );
|
|
85 |
|
|
86 |
ObserverList& observers();
|
|
87 |
|
|
88 |
void startSeeking( Seeking::Direction direction, const int reason = TuneReason::Unspecified );
|
|
89 |
|
|
90 |
private:
|
|
91 |
|
|
92 |
// from base class MRadioEngineObserver
|
|
93 |
|
|
94 |
void PowerEventL( TBool aPowerState, TInt aError );
|
|
95 |
void FrequencyEventL( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason, TInt aError );
|
|
96 |
void VolumeEventL( TInt aVolume, TInt aError );
|
|
97 |
void MuteEventL( TBool aMuteState, TInt aError );
|
|
98 |
void AudioModeEventL( TInt aAudioMode, TInt aError );
|
|
99 |
void AntennaEventL( TBool aAntennaAttached, TInt aError );
|
|
100 |
void AudioRoutingEventL( TInt aAudioDestination, TInt aError );
|
|
101 |
void SeekingEventL( TInt aSeekingState, TInt aError );
|
|
102 |
void RegionEventL( TInt aRegion, TInt aError );
|
|
103 |
void FmTransmitterEventL( TBool /*aActive*/ ) {}
|
|
104 |
|
|
105 |
// from base class MRadioAudioRoutingObserver
|
|
106 |
|
|
107 |
void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute );
|
|
108 |
|
|
109 |
// from base class MRadioSystemEventObserver
|
|
110 |
|
|
111 |
void HandleSystemEventL( TRadioSystemEventType aEventType );
|
|
112 |
|
|
113 |
// from base class MRadioRepositoryEntityObserver
|
|
114 |
|
|
115 |
void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
|
|
116 |
void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {}
|
|
117 |
void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
|
|
118 |
void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
|
|
119 |
|
|
120 |
private: // data
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Pointer to the public class
|
|
124 |
* Not own.
|
|
125 |
*/
|
|
126 |
RadioEngineWrapper* q_ptr;
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Map of radio stations read from the radio engine
|
|
130 |
* Own.
|
|
131 |
*/
|
|
132 |
RadioStationHandlerIf& mStationHandler;
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Reference to the wrapper observer
|
|
136 |
*/
|
|
137 |
ObserverList mObservers;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Radio settings handler
|
|
141 |
* Own.
|
|
142 |
*/
|
|
143 |
QScopedPointer<RadioSettings> mSettings;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Radio engine handler.
|
|
147 |
* Own.
|
|
148 |
*/
|
|
149 |
QScopedPointer<CRadioEngineHandler> mEngineHandler;
|
|
150 |
|
|
151 |
/**
|
|
152 |
* RemCon listener.
|
|
153 |
* Own.
|
|
154 |
*/
|
|
155 |
QScopedPointer<RadioControlEventListener> mControlEventListener;
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Rds listener
|
|
159 |
* Own.
|
|
160 |
*/
|
|
161 |
QScopedPointer<RadioRdsListener> mRdsListener;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Reason for the tune event. Can be FrequencyStrip, Carousel or station scanner
|
|
165 |
*/
|
|
166 |
int mTuneReason;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Flag to indicate whether or not audio should be routed to loudspeaker
|
|
170 |
*/
|
|
171 |
bool mUseLoudspeaker;
|
|
172 |
|
|
173 |
};
|
|
174 |
|
|
175 |
#endif // RADIOENGINEWRAPPER_P_H
|