|
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: FM Radio widget radio service client |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ |
|
19 #define FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ |
|
20 |
|
21 // System includes |
|
22 #include <QObject> |
|
23 #include <xqservicerequest.h> |
|
24 #include <xqappmgr.h> |
|
25 |
|
26 // Constants |
|
27 /** Radio service name. */ |
|
28 const QString KRadioServiceName = "com.nokia.services.Radio"; |
|
29 /** Radio control interface name. */ |
|
30 const QString KRadioServiceControlInterfaceName = "IRadioControl"; |
|
31 /** Radio monitor interface name. */ |
|
32 const QString KRadioServiceControlOperation = "command(int)"; |
|
33 /** Radio monitor interface name. */ |
|
34 const QString KRadioServiceMonitorInterfaceName = "IRadioMonitor"; |
|
35 /** Radio monitor interface name. */ |
|
36 const QString KRadioServiceMonitorOperation = "requestNotifications()"; |
|
37 |
|
38 class FmRadioHsWidgetRadioServiceClient : public QObject |
|
39 { |
|
40 Q_OBJECT |
|
41 |
|
42 public: |
|
43 FmRadioHsWidgetRadioServiceClient(QObject *parent = 0); |
|
44 virtual ~FmRadioHsWidgetRadioServiceClient(); |
|
45 |
|
46 enum FmRadioStartupState |
|
47 { |
|
48 StartForeground, |
|
49 StartBackground |
|
50 }; |
|
51 enum FmRadioChannelChangeCommand |
|
52 { |
|
53 PreviousFavouriteChannel, |
|
54 NextFavouriteChannel |
|
55 }; |
|
56 enum FmRadioAudioControlCommand |
|
57 { |
|
58 Mute, |
|
59 Unmute |
|
60 }; |
|
61 enum FmRadioInformationType |
|
62 { |
|
63 InformationTypeStationName, |
|
64 InformationTypeCallSign, |
|
65 InformationTypeFrequency, |
|
66 InformationTypeRt, |
|
67 InformationTypeDynamicPsName, |
|
68 InformationTypePty |
|
69 }; |
|
70 |
|
71 |
|
72 signals: |
|
73 void radioInformationChanged(int notificationId, QVariant value); |
|
74 void radioStateChanged(QVariant value); |
|
75 |
|
76 public slots: |
|
77 void doStartFmRadio(FmRadioStartupState startupState); |
|
78 void doBringFmRadioToForeground(bool toForeground); |
|
79 void test(); |
|
80 void doChangeFmRadioChannel(FmRadioChannelChangeCommand command); |
|
81 void doControlFmRadioAudio(FmRadioAudioControlCommand command); |
|
82 void handleFmRadioInformationChange(const QVariant& value); |
|
83 void handleFmRadioControlRequestComplete(const QVariant& value); |
|
84 void handleRequestError(int error); |
|
85 void handleRequestError2(int error); |
|
86 void handleFmRadioStateChange(QVariant& value); |
|
87 void startMonitoring(); |
|
88 void stopMonitoring(); |
|
89 |
|
90 protected slots: |
|
91 void requestCompleted(const QVariant& value); |
|
92 |
|
93 private slots: |
|
94 void handleOk(const QVariant &result); |
|
95 void handleError(int errorCode, const QString& errorMessage); |
|
96 |
|
97 void createControlServiceRequest(); |
|
98 void createMonitorServiceRequest(); |
|
99 |
|
100 void doGetFmRadioInformation(); |
|
101 |
|
102 private: // data |
|
103 XQServiceRequest* mRadioInformationServiceRequest; |
|
104 XQServiceRequest* mRadioControlServiceRequest; |
|
105 |
|
106 XQApplicationManager mApplicationManager; |
|
107 |
|
108 }; |
|
109 |
|
110 #endif /* FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ */ |