author | Pat Downey <patd@symbian.org> |
Wed, 23 Jun 2010 17:20:24 +0100 | |
changeset 29 | 29ba091146f4 |
parent 28 | 075425b8d9a4 |
permissions | -rw-r--r-- |
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"; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
31 |
/** Radio control operation name. */ |
24 | 32 |
const QString KRadioServiceControlOperation = "command(int)"; |
33 |
/** Radio monitor interface name. */ |
|
34 |
const QString KRadioServiceMonitorInterfaceName = "IRadioMonitor"; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
35 |
/** Radio monitor operation name. */ |
24 | 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: |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
45 |
explicit FmRadioHsWidgetRadioServiceClient(QObject *parent = 0); |
24 | 46 |
virtual ~FmRadioHsWidgetRadioServiceClient(); |
47 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
48 |
// Enum for station changing command. |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
49 |
enum FmRadioStationChangeCommand |
24 | 50 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
51 |
PreviousFavouriteStation, |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
52 |
NextFavouriteStation |
24 | 53 |
}; |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
54 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
55 |
// Enum for type of radio information. |
24 | 56 |
enum FmRadioInformationType |
57 |
{ |
|
58 |
InformationTypeStationName, |
|
59 |
InformationTypeCallSign, |
|
60 |
InformationTypeFrequency, |
|
61 |
InformationTypeRt, |
|
62 |
InformationTypeDynamicPsName, |
|
63 |
InformationTypePty |
|
64 |
}; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
65 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
66 |
// Enum for controlling the visibility of the radio application. |
24 | 67 |
enum FmRadioVisibilty |
68 |
{ |
|
69 |
DoNotChange, |
|
70 |
ToForeground, |
|
71 |
ToBackground |
|
72 |
}; |
|
73 |
||
74 |
signals: |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
75 |
void radioInformationChanged(const int notificationId, |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
76 |
const QVariant &value); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
77 |
void radioStateChanged(const QVariant &value); |
24 | 78 |
|
79 |
public slots: |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
80 |
void doCloseFmRadio(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
81 |
void doPowerOnFmRadio(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
82 |
void doChangeFmRadioVisibility(const FmRadioVisibilty visibility); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
83 |
void doChangeFmRadioStation(const FmRadioStationChangeCommand command); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
84 |
void handleFmRadioInformationChange(const QVariant &value); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
85 |
void handleFmRadioStateChange(const QVariant &value); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
86 |
void startMonitoring(const FmRadioVisibilty visibility); |
24 | 87 |
void stopMonitoring(); |
88 |
||
89 |
protected slots: |
|
90 |
||
91 |
private slots: |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
92 |
void handleError(const int errorCode, const QString &errorMessage); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
93 |
void handleRequestError(const int error); |
24 | 94 |
|
95 |
void createControlServiceRequest(); |
|
96 |
void createMonitorServiceRequest(); |
|
97 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
98 |
void doSendMonitorRequest(const FmRadioVisibilty visibility); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
99 |
void doSendControlRequest(const QVariant &argument, |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
100 |
const FmRadioVisibilty visibility); |
24 | 101 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
102 |
void prepareRequestInfo(XQAiwRequest *request, |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
103 |
const FmRadioVisibilty visibility); |
24 | 104 |
|
105 |
private: // data |
|
106 |
bool mRequestPending; |
|
107 |
XQApplicationManager mApplicationManager; |
|
108 |
XQAiwRequest* mRadioMonitorRequest; |
|
109 |
XQAiwRequest* mRadioControlRequest; |
|
110 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
111 |
bool mDataInitialized; |
24 | 112 |
}; |
113 |
||
114 |
#endif /* FMRADIOHSWIDGETRADIOSERVICECLIENT_H_ */ |