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 RADIOSTATIONINFO_P_H_ |
|
19 #define RADIOSTATIONINFO_P_H_ |
|
20 |
|
21 // System includes |
|
22 #include <QTime> |
|
23 |
|
24 // User includes |
|
25 #include "radiostation.h" |
|
26 #include "radiostationif.h" |
|
27 |
|
28 // Class declaration |
|
29 class RadioStationPrivate : public RadioStationIf |
|
30 { |
|
31 public: |
|
32 |
|
33 explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 ); |
|
34 explicit RadioStationPrivate( RadioStation::PresetFlag flag ); |
|
35 |
|
36 virtual ~RadioStationPrivate(); |
|
37 |
|
38 void init( int presetIndex, uint frequency = 0 ); |
|
39 |
|
40 private: |
|
41 |
|
42 // from base class RadioStationIf |
|
43 |
|
44 int presetIndex() const; |
|
45 void setPresetIndex( int presetIndex ); |
|
46 uint frequency() const; |
|
47 void setFrequency( uint frequency ); |
|
48 QString name() const; |
|
49 void setName( QString name ); |
|
50 bool isRenamedByUser() const; |
|
51 void setRenamedByUser( bool renamed ); |
|
52 int genre() const; |
|
53 void setGenre( int genre ); |
|
54 QString url() const; |
|
55 void setUrl( QString url ); |
|
56 int piCode() const; |
|
57 void setPiCode( int piCode ); |
|
58 bool isFavorite() const; |
|
59 void setFavorite( bool favorite ); |
|
60 bool isLocalStation() const; |
|
61 void setLocalStation( bool localStation ); |
|
62 |
|
63 public: // data |
|
64 |
|
65 /** |
|
66 * Reference count used for implicit sharing. |
|
67 * Has to be named "ref" instead having the 'm' prefix like all other member variables in Radio |
|
68 * This is because convenience functions like qAtomicAssign() expect it to be named "ref" |
|
69 */ |
|
70 QAtomicInt ref; |
|
71 |
|
72 // ======================================================================== |
|
73 // Persistent data. Saved to Central repository |
|
74 // ======================================================================== |
|
75 |
|
76 /** |
|
77 * Station frequency. The most important bit of information about a radio station. |
|
78 * Is checked to be non-null in the isValid() function |
|
79 */ |
|
80 uint mFrequency; |
|
81 |
|
82 /** |
|
83 * Station index in the Preset Utility. |
|
84 * Negative values signify an invalid RadioStation that has not and will not be saved. |
|
85 * Initialized to -100 by default to indicate and invalid station. |
|
86 */ |
|
87 int mPresetIndex; |
|
88 |
|
89 /** |
|
90 * Station name. Contains a name that is set in one of the following ways: |
|
91 * 1) Received through RDS as the stations PS name and station does not use dynamic PS |
|
92 * 2) Entered by the user. In this case the mRenamedByUser flag will be set and the name |
|
93 * cannot be changed until the user removes the renaming. |
|
94 * 3) Callsign calculated from the PI code can be set as the station name if the station |
|
95 * does not send RDS information and the current region is America |
|
96 */ |
|
97 QString mName; |
|
98 |
|
99 /** |
|
100 * Flag to indicate whether or not the user has renamed the station |
|
101 */ |
|
102 bool mRenamedByUser; |
|
103 |
|
104 /** |
|
105 * Station genre received through RDS |
|
106 */ |
|
107 int mGenre; |
|
108 |
|
109 /** |
|
110 * Station URL. Can be e.g. a web address to the radio stations homepage |
|
111 */ |
|
112 QString mUrl; |
|
113 |
|
114 /** |
|
115 * Stations PI code. Only used in the America region to calculate the Callsign if station |
|
116 * does not use RDS to broadcast PS name |
|
117 */ |
|
118 int mPiCode; |
|
119 |
|
120 /** |
|
121 * Station type. Used by the application mainly to filter out certain stations depending |
|
122 * on the users preference to see all locally audible stations or all favorite stations. |
|
123 * Can have any combination of the following flags: |
|
124 * - Favorite The station is a favorite of the user. |
|
125 * - LocalStation The station was found in the last scan and should be audible in the current location |
|
126 * - Temporary Special flag to mark one RadioStation instance that is used to store |
|
127 * information of a manually tuned frequency that has not been saved by the user. |
|
128 */ |
|
129 RadioStation::Type mType; // Station type, favorite or local station or neither |
|
130 |
|
131 // ======================================================================== |
|
132 // Non-persistent data. Only kept in memory |
|
133 // ======================================================================== |
|
134 |
|
135 /** |
|
136 * Radio station PS name type. Some radio stations use the PS name broadcasting against the |
|
137 * official RDS standard rules to broadcast advertisements. The ads are sent by changing the |
|
138 * PS name in relatively rapid succession. The RDS standard specifies that a station should |
|
139 * only use the PS name to broadcast a static station name. |
|
140 * The FM Radio application attempts to determine if the station uses dynamic PS or not and |
|
141 * stores the information here. Stations with a dynamic PS are treated differently in the UI and the |
|
142 * name is never saved to Central Repository because it would only contain a part of an advertisement. |
|
143 * Can have one of the following values: |
|
144 * - Unknown Dynamic PS check has not been done so it is unknown if the station uses dynamic PS |
|
145 * - Dynamic The check has been done and station has been found to use dynamic PS |
|
146 * - Static The check has been done and the station has been found not to use dynamic PS |
|
147 */ |
|
148 RadioStation::PsType mPsType; |
|
149 |
|
150 /** |
|
151 * Stores the Radio Text received through RDS. Can be either normal Radio Text or Radio Text Plus |
|
152 * where the tags have been parsed. Parsed Radio Text Plus is stored in HTML form, the normal Radio Text |
|
153 * is stored as plain text. |
|
154 */ |
|
155 QString mRadioText; |
|
156 |
|
157 /** |
|
158 * Holder for the ads sent by using dynamic PS. Holds one part of the ad at a time. |
|
159 */ |
|
160 QString mDynamicPsText; |
|
161 |
|
162 /** |
|
163 * Internal book keeping used to determine which member variables have been changed since last save |
|
164 * or reset. Used to decide which signals should be sent by the RadioStationModel when the station is saved. |
|
165 */ |
|
166 RadioStation::Change mChangeFlags; |
|
167 |
|
168 /** |
|
169 * Keeps track of station call sign calculation state |
|
170 */ |
|
171 bool mCallSignCheckDone; |
|
172 |
|
173 /** |
|
174 * Time of the last PS name change. Used to check if the station changes its PS name too often. |
|
175 * In bad RDS coverage a station using dynamic PS might be incorrectly determined to use static PS. |
|
176 * This is a corrective effort to change that decision if the name changes too often. |
|
177 */ |
|
178 QTime mLastPsNameChangeTime; |
|
179 |
|
180 }; |
|
181 |
|
182 #endif // RADIOSTATIONINFO_P_H_ |
|