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 control operation name. */ |
|
32 const QString KRadioServiceControlOperation = "command(int)"; |
|
33 /** Radio monitor interface name. */ |
|
34 const QString KRadioServiceMonitorInterfaceName = "IRadioMonitor"; |
|
35 /** Radio monitor operation name. */ |
|
36 const QString KRadioServiceMonitorOperation = "requestNotifications()"; |
|
37 /** Radio refresh operation name. */ |
|
38 const QString KRadioServiceRefreshOperation = "requestAllData()"; |
|
39 |
|
40 class FmRadioHsWidgetRadioServiceClient : public QObject |
|
41 { |
|
42 Q_OBJECT |
|
43 |
|
44 public: |
|
45 explicit FmRadioHsWidgetRadioServiceClient(QObject *parent = 0); |
|
46 virtual ~FmRadioHsWidgetRadioServiceClient(); |
|
47 |
|
48 // Enum for station changing command. |
|
49 enum FmRadioStationChangeCommand |
|
50 { |
|
51 PreviousFavouriteStation, |
|
52 NextFavouriteStation |
|
53 }; |
|
54 |
|
55 // Enum for type of radio information. |
|
56 enum FmRadioInformationType |
|
57 { |
|
58 InformationTypeStationName, |
|
59 InformationTypeCallSign, |
|
60 InformationTypeFrequency, |
|
61 InformationTypeRt, |
|
62 InformationTypeDynamicPsName, |
|
63 InformationTypePty |
|
64 }; |
|
65 |
|
66 // Enum for controlling the visibility of the radio application. |
|
67 enum FmRadioVisibilty |
|
68 { |
|
69 DoNotChange, |
|
70 ToForeground, |
|
71 ToBackground |
|
72 }; |
|
73 |
|
74 signals: |
|
75 void radioInformationChanged(const int notificationId, |
|
76 const QVariant &value); |
|
77 void radioStateChanged(const QVariant &value); |
|
78 |
|
79 public slots: |
|
80 void doCloseFmRadio(); |
|
81 void doPowerOnFmRadio(); |
|
82 void doChangeFmRadioVisibility(const FmRadioVisibilty visibility); |
|
83 void doChangeFmRadioStation(const FmRadioStationChangeCommand command); |
|
84 void handleFmRadioInformationChange(const QVariant &value); |
|
85 void handleFmRadioStateChange(const QVariant &value); |
|
86 void startMonitoring(const FmRadioVisibilty visibility); |
|
87 void stopMonitoring(); |
|
88 |
|
89 protected slots: |
|
90 |
|
91 private slots: |
|
92 void handleError(const int errorCode, const QString &errorMessage); |
|
93 void handleRequestError(const int error); |
|
94 |
|
95 void createControlServiceRequest(); |
|
96 void createMonitorServiceRequest(); |
|
97 |
|
98 void doSendMonitorRequest(const FmRadioVisibilty visibility); |
|
99 void doSendControlRequest(const QVariant &argument, |
|
100 const FmRadioVisibilty visibility); |
|
101 |
|
102 void prepareRequestInfo(XQAiwRequest *request, |
|
103 const FmRadioVisibilty visibility); |
|
104 |
|
105 private: // data |
|
106 bool mRequestPending; |
|
107 XQApplicationManager mApplicationManager; |
|
108 XQAiwRequest* mRadioMonitorRequest; |
|
109 XQAiwRequest* mRadioControlRequest; |
|
110 |
|
111 bool mDataInitialized; |
|
112 }; |
|
113 |
|
114 #endif /* FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ */ |
|