|
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 // User includes |
|
19 #include "radiomonitorservice.h" |
|
20 #include "radiouiengine.h" |
|
21 #include "radioserviceconst.h" |
|
22 |
|
23 /*! |
|
24 * |
|
25 */ |
|
26 RadioMonitorService::RadioMonitorService( RadioUiEngine& engine ) : |
|
27 XQServiceProvider( RADIO_MONITOR_SERVICE, &engine ), |
|
28 mUiEngine( engine ), |
|
29 mRequestIndex( 0 ) |
|
30 { |
|
31 publishAll(); |
|
32 } |
|
33 |
|
34 /*! |
|
35 * |
|
36 */ |
|
37 RadioMonitorService::~RadioMonitorService() |
|
38 { |
|
39 } |
|
40 |
|
41 /*! |
|
42 * |
|
43 */ |
|
44 void RadioMonitorService::notifyName( const QString& name ) |
|
45 { |
|
46 notify( RadioServiceNotification::Name, name ); |
|
47 } |
|
48 |
|
49 /*! |
|
50 * |
|
51 */ |
|
52 void RadioMonitorService::notifyGenre( const QString& genre ) |
|
53 { |
|
54 notify( RadioServiceNotification::Genre, genre ); |
|
55 } |
|
56 |
|
57 /*! |
|
58 * |
|
59 */ |
|
60 void RadioMonitorService::notifyRadioText( const QString& radioText ) |
|
61 { |
|
62 notify( RadioServiceNotification::RadioText, radioText ); |
|
63 } |
|
64 |
|
65 /*! |
|
66 * |
|
67 */ |
|
68 void RadioMonitorService::notifyHomepage( const QString& homepage ) |
|
69 { |
|
70 notify( RadioServiceNotification::Homepage, homepage ); |
|
71 } |
|
72 |
|
73 /*! |
|
74 * |
|
75 */ |
|
76 void RadioMonitorService::notifySong( const QString& song ) |
|
77 { |
|
78 notify( RadioServiceNotification::Song, song ); |
|
79 } |
|
80 |
|
81 /*! |
|
82 * Public slot |
|
83 * |
|
84 */ |
|
85 void RadioMonitorService::requestNotifications() |
|
86 { |
|
87 mRequestIndex = setCurrentRequestAsync(); |
|
88 } |
|
89 |
|
90 /*! |
|
91 * |
|
92 */ |
|
93 void RadioMonitorService::notify( int notificationId, const QString& message ) |
|
94 { |
|
95 if ( mRequestIndex > 0 ) { |
|
96 completeRequest( mRequestIndex, QString( "%1 %2" ).arg( notificationId ).arg( message ) ); |
|
97 mRequestIndex = 0; |
|
98 } |
|
99 } |