author | hgs |
Fri, 15 Oct 2010 16:26:27 +0300 | |
changeset 57 | 21be958eb3ce |
parent 34 | bc10a61bd7d3 |
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 |
||
57 | 99 |
void addRadiotext( const QString& radiotext ); |
100 |
void clearRadiotext(); |
|
101 |
||
24 | 102 |
bool isOffline() const; |
103 |
void setOffline( bool offline ); |
|
104 |
||
57 | 105 |
private Q_SLOTS: |
24 | 106 |
|
107 |
void frequencyEvent(); |
|
108 |
void addSongTags(); |
|
109 |
||
110 |
private: |
|
111 |
||
112 |
// New functions |
|
113 |
||
114 |
void parseData(); |
|
115 |
||
116 |
private: // data |
|
117 |
||
118 |
/** |
|
119 |
* Pointer to the public class |
|
120 |
* Not own. |
|
121 |
*/ |
|
122 |
RadioEngineWrapper* q_ptr; |
|
123 |
||
124 |
/** |
|
125 |
* Map of radio stations read from the radio engine |
|
126 |
* Own. |
|
127 |
*/ |
|
128 |
RadioStationHandlerIf& mStationHandler; |
|
129 |
||
130 |
/** |
|
131 |
* Reference to the wrapper observer |
|
132 |
*/ |
|
133 |
ObserverList mObservers; |
|
134 |
||
135 |
/** |
|
136 |
* Radio settings handler |
|
137 |
* Own. |
|
138 |
*/ |
|
139 |
QScopedPointer<RadioSettings> mSettings; |
|
140 |
||
141 |
QTimer* mTuneTimer; |
|
142 |
||
143 |
// QScopedPointer<T_RadioDataParser> mDataParser; |
|
144 |
||
145 |
QString mParsingError; |
|
146 |
||
147 |
/** |
|
148 |
* Reason for the tune event. RadioFrequencyStrip or someone else |
|
149 |
*/ |
|
150 |
int mTuneReason; |
|
151 |
||
152 |
/** |
|
153 |
* Flag to indicate whether or not audio should be routed to loudspeaker |
|
154 |
*/ |
|
155 |
bool mUseLoudspeaker; |
|
156 |
||
157 |
QScopedPointer<QSettings> mEngineSettings; |
|
158 |
||
159 |
bool mAntennaAttached; |
|
160 |
||
161 |
uint mFrequency; |
|
162 |
uint mNextFrequency; |
|
163 |
||
164 |
int mVolume; |
|
165 |
||
166 |
int mMaxVolume; |
|
167 |
int mFrequencyStepSize; |
|
168 |
RadioRegion::Region mRegionId; |
|
169 |
uint mMinFrequency; |
|
170 |
uint mMaxFrequency; |
|
171 |
||
172 |
QString mArtist; |
|
173 |
QString mTitle; |
|
174 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
175 |
bool mManualSeekMode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
176 |
|
24 | 177 |
}; |
178 |
||
179 |
#endif // RADIOENGINEWRAPPER_P_H |