|
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 RADIOMONITORSERVICE_H |
|
19 #define RADIOMONITORSERVICE_H |
|
20 |
|
21 // System includes |
|
22 #include <xqserviceprovider.h> |
|
23 |
|
24 // User includes |
|
25 #include "radioservicedef.h" |
|
26 #include "radioenginewrapperobserver.h" |
|
27 |
|
28 // Forward declarations |
|
29 class RadioUiEnginePrivate; |
|
30 class RadioStation; |
|
31 class QTimer; |
|
32 |
|
33 class RadioMonitorService : public XQServiceProvider |
|
34 , public RadioEngineWrapperObserver |
|
35 { |
|
36 Q_OBJECT |
|
37 |
|
38 public: |
|
39 |
|
40 RadioMonitorService( RadioUiEnginePrivate& engine ); |
|
41 virtual ~RadioMonitorService(); |
|
42 |
|
43 void init(); |
|
44 |
|
45 public slots: |
|
46 |
|
47 void requestNotifications(); // Slot called by Qt Highway |
|
48 void requestAllData(); // Slot called by Qt Highway |
|
49 |
|
50 private slots: |
|
51 |
|
52 void notifyRadioStatus(); |
|
53 void notifyFavoriteCount(); |
|
54 void notifyStationChange( const RadioStation& station ); |
|
55 void sendNotifications(); |
|
56 |
|
57 private: |
|
58 |
|
59 // from base class RadioEngineWrapperObserver |
|
60 |
|
61 void tunedToFrequency( uint frequency, int reason ); |
|
62 |
|
63 // New functions |
|
64 |
|
65 RadioStatus::Status determineRadioStatus() const; |
|
66 |
|
67 void checkIfCurrentStationIsFavorite(); |
|
68 |
|
69 QString trimHtmlTags( const QString& html ); |
|
70 |
|
71 void notify( const QVariant& notification ); |
|
72 void notifyList( const QVariantList& list ); |
|
73 |
|
74 private: // data |
|
75 |
|
76 RadioUiEnginePrivate& mUiEngine; |
|
77 |
|
78 QList<int> mRequestIndexes; |
|
79 |
|
80 RadioStatus::Status mRadioStatus; |
|
81 |
|
82 QVariantList mNotificationList; |
|
83 |
|
84 QTimer* mNotificationTimer; |
|
85 |
|
86 }; |
|
87 |
|
88 #endif // RADIOMONITORSERVICE_H |