author | hgs |
Thu, 08 Jul 2010 12:44:18 +0300 | |
changeset 36 | ba22309243a1 |
parent 34 | bc10a61bd7d3 |
child 37 | 451b2e1545b2 |
child 57 | 21be958eb3ce |
permissions | -rw-r--r-- |
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 <QObject> |
|
23 |
#include <QScopedPointer> |
|
24 |
||
25 |
// User includes |
|
26 |
#include "radioenginewrapper.h" |
|
27 |
||
28 |
// Forward declarations |
|
29 |
class RadioControlEventListener; |
|
30 |
class RadioRdsListener; |
|
31 |
class RadioSettings; |
|
32 |
class RadioSettingsIf; |
|
33 |
class RadioFrequencyScanningHandler; |
|
34 |
class RadioStationHandlerIf; |
|
35 |
class RadioEngineWrapperObserver; |
|
36 |
class T_RadioDataParser; |
|
37 |
class QSettings; |
|
38 |
class QTimer; |
|
39 |
||
40 |
typedef QList<RadioEngineWrapperObserver*> ObserverList; |
|
41 |
||
42 |
#define RUN_NOTIFY_LOOP( list, func ) \ |
|
43 |
foreach( RadioEngineWrapperObserver* observer, list ) { \ |
|
44 |
observer->func; \ |
|
45 |
} |
|
46 |
||
47 |
// Class declaration |
|
48 |
class WRAPPER_DLL_EXPORT RadioEngineWrapperPrivate : public QObject |
|
49 |
{ |
|
50 |
Q_OBJECT |
|
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 |
~RadioEngineWrapperPrivate(); |
|
62 |
||
63 |
static RadioEngineWrapperPrivate* instance(); |
|
64 |
||
65 |
/** |
|
66 |
* Initialization and startup |
|
67 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
68 |
bool init(); |
24 | 69 |
|
70 |
/** |
|
71 |
* Returns the radio settings |
|
72 |
*/ |
|
73 |
RadioSettingsIf& settings(); |
|
74 |
||
75 |
/** |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
76 |
* Tunes to the given frequency |
24 | 77 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
78 |
void setFrequency( uint frequency, const int reason ); |
24 | 79 |
|
80 |
ObserverList& observers(); |
|
81 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
82 |
void startSeeking( Seek::Direction direction, const int reason ); |
24 | 83 |
void cancelSeeking(); |
84 |
||
85 |
void toggleAudioRoute(); |
|
86 |
||
87 |
// Functions used by the win32 test window |
|
88 |
||
89 |
QString dataParsingError() const; |
|
90 |
||
91 |
void setHeadsetStatus( bool connected ); |
|
92 |
||
93 |
void setVolume( int volume ); |
|
94 |
||
95 |
void addSong( const QString& artist, const QString& title ); |
|
96 |
||
97 |
void clearSong(); |
|
98 |
||
99 |
bool isOffline() const; |
|
100 |
void setOffline( bool offline ); |
|
101 |
||
102 |
private slots: |
|
103 |
||
104 |
void frequencyEvent(); |
|
105 |
void addSongTags(); |
|
106 |
||
107 |
private: |
|
108 |
||
109 |
// New functions |
|
110 |
||
111 |
void parseData(); |
|
112 |
||
113 |
private: // data |
|
114 |
||
115 |
/** |
|
116 |
* Pointer to the public class |
|
117 |
* Not own. |
|
118 |
*/ |
|
119 |
RadioEngineWrapper* q_ptr; |
|
120 |
||
121 |
/** |
|
122 |
* Map of radio stations read from the radio engine |
|
123 |
* Own. |
|
124 |
*/ |
|
125 |
RadioStationHandlerIf& mStationHandler; |
|
126 |
||
127 |
/** |
|
128 |
* Reference to the wrapper observer |
|
129 |
*/ |
|
130 |
ObserverList mObservers; |
|
131 |
||
132 |
/** |
|
133 |
* Radio settings handler |
|
134 |
* Own. |
|
135 |
*/ |
|
136 |
QScopedPointer<RadioSettings> mSettings; |
|
137 |
||
138 |
QTimer* mTuneTimer; |
|
139 |
||
140 |
// QScopedPointer<T_RadioDataParser> mDataParser; |
|
141 |
||
142 |
QString mParsingError; |
|
143 |
||
144 |
/** |
|
145 |
* Reason for the tune event. RadioFrequencyStrip or someone else |
|
146 |
*/ |
|
147 |
int mTuneReason; |
|
148 |
||
149 |
/** |
|
150 |
* Flag to indicate whether or not audio should be routed to loudspeaker |
|
151 |
*/ |
|
152 |
bool mUseLoudspeaker; |
|
153 |
||
154 |
QScopedPointer<QSettings> mEngineSettings; |
|
155 |
||
156 |
bool mAntennaAttached; |
|
157 |
||
158 |
uint mFrequency; |
|
159 |
uint mNextFrequency; |
|
160 |
||
161 |
int mVolume; |
|
162 |
||
163 |
int mMaxVolume; |
|
164 |
int mFrequencyStepSize; |
|
165 |
RadioRegion::Region mRegionId; |
|
166 |
uint mMinFrequency; |
|
167 |
uint mMaxFrequency; |
|
168 |
||
169 |
QString mArtist; |
|
170 |
QString mTitle; |
|
171 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
172 |
bool mManualSeekMode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
173 |
|
24 | 174 |
}; |
175 |
||
176 |
#endif // RADIOENGINEWRAPPER_P_H |