24
|
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 |
/** Radio refresh operation name. */
|
|
38 |
const QString KRadioServiceRefreshOperation = "requestAllData()";
|
|
39 |
|
|
40 |
class FmRadioHsWidgetRadioServiceClient : public QObject
|
|
41 |
{
|
|
42 |
Q_OBJECT
|
|
43 |
|
|
44 |
public:
|
|
45 |
FmRadioHsWidgetRadioServiceClient(QObject *parent = 0);
|
|
46 |
virtual ~FmRadioHsWidgetRadioServiceClient();
|
|
47 |
|
|
48 |
enum FmRadioStartupState
|
|
49 |
{
|
|
50 |
StartForeground,
|
|
51 |
StartBackground
|
|
52 |
};
|
|
53 |
enum FmRadioChannelChangeCommand
|
|
54 |
{
|
|
55 |
PreviousFavouriteChannel,
|
|
56 |
NextFavouriteChannel
|
|
57 |
};
|
|
58 |
enum FmRadioAudioControlCommand
|
|
59 |
{
|
|
60 |
Mute,
|
|
61 |
Unmute
|
|
62 |
};
|
|
63 |
enum FmRadioInformationType
|
|
64 |
{
|
|
65 |
InformationTypeStationName,
|
|
66 |
InformationTypeCallSign,
|
|
67 |
InformationTypeFrequency,
|
|
68 |
InformationTypeRt,
|
|
69 |
InformationTypeDynamicPsName,
|
|
70 |
InformationTypePty
|
|
71 |
};
|
|
72 |
enum FmRadioVisibilty
|
|
73 |
{
|
|
74 |
DoNotChange,
|
|
75 |
ToForeground,
|
|
76 |
ToBackground
|
|
77 |
};
|
|
78 |
|
|
79 |
void init();
|
|
80 |
|
|
81 |
signals:
|
|
82 |
void radioInformationChanged(int notificationId, QVariant value);
|
|
83 |
void radioStateChanged(QVariant value);
|
|
84 |
|
|
85 |
public slots:
|
|
86 |
void doChangeFmRadioVisibility(FmRadioVisibilty visibility);
|
|
87 |
void test();
|
|
88 |
void doChangeFmRadioChannel(FmRadioChannelChangeCommand command);
|
|
89 |
void doControlFmRadioAudio(FmRadioAudioControlCommand command);
|
|
90 |
void handleFmRadioInformationChange(const QVariant& value);
|
|
91 |
void handleFmRadioStateChange(QVariant& value);
|
|
92 |
void startMonitoring(FmRadioVisibilty visibility);
|
|
93 |
void stopMonitoring();
|
|
94 |
|
|
95 |
protected slots:
|
|
96 |
void requestCompleted(const QVariant& value);
|
|
97 |
|
|
98 |
private slots:
|
|
99 |
//void handleOk(const QVariant &result);
|
|
100 |
void handleError(int errorCode, const QString& errorMessage);
|
|
101 |
void handleRequestError(int error);
|
|
102 |
|
|
103 |
void createControlServiceRequest();
|
|
104 |
void createMonitorServiceRequest();
|
|
105 |
|
|
106 |
void doSendMonitorRequest(FmRadioVisibilty visibility);
|
|
107 |
void doSendControlRequest(QVariant &argument, FmRadioVisibilty visibility);
|
|
108 |
|
|
109 |
void prepareRequestInfo(XQAiwRequest *request, FmRadioVisibilty visibility);
|
|
110 |
|
|
111 |
private: // data
|
|
112 |
bool mRequestPending;
|
|
113 |
XQApplicationManager mApplicationManager;
|
|
114 |
XQAiwRequest* mRadioMonitorRequest;
|
|
115 |
XQAiwRequest* mRadioControlRequest;
|
|
116 |
|
|
117 |
bool mDataInitialized;
|
|
118 |
|
|
119 |
};
|
|
120 |
|
|
121 |
#endif /* FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ */
|