|
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 #ifndef IRMONITORSERVICE_H |
|
19 #define IRMONITORSERVICE_H |
|
20 |
|
21 // System includes |
|
22 #include <QObject> |
|
23 #include <QList> |
|
24 #include <xqserviceprovider.h> |
|
25 |
|
26 // User includes |
|
27 #include "irservicedef.h" |
|
28 #include "irservicedata.h" |
|
29 |
|
30 // Forward declarations |
|
31 class IRApplication; |
|
32 class IRPlayController; |
|
33 class IRQMetaData; |
|
34 |
|
35 class IrMonitorService : public XQServiceProvider |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 public: |
|
40 explicit IrMonitorService(IRApplication *aIrApp, QObject *aParent = 0); |
|
41 virtual ~IrMonitorService(); |
|
42 |
|
43 public slots: |
|
44 void registerNotifications(); // service interface, called via Qt Highway |
|
45 void refreshAllData(); // service interface, called via Qt Highway |
|
46 |
|
47 private slots: |
|
48 // slots for station logo update |
|
49 void handleStationLogoUpdated(bool aLogoAvailable); |
|
50 |
|
51 // slots for play controller |
|
52 void handleLoadingStarted(const QString &aStationName); |
|
53 void handleLoadingCancelled(const QString &aStationName); |
|
54 void handlePlayStarted(); |
|
55 void handlePlayStopped(); |
|
56 void updateMetaData(IRQMetaData* aMetaData); |
|
57 |
|
58 public: |
|
59 enum ReadyItem |
|
60 { |
|
61 StationName = 0x01, |
|
62 StationLogo = 0x02, |
|
63 MetaData = 0x04, |
|
64 IrState = 0x08 |
|
65 }; |
|
66 Q_DECLARE_FLAGS(ReadyItems, ReadyItem) |
|
67 |
|
68 private: |
|
69 void setupConnection(); |
|
70 |
|
71 void notifyAll(); |
|
72 bool notifyList(const IrServiceDataList &aDataList); |
|
73 |
|
74 private: |
|
75 ReadyItems mReadyItems; |
|
76 QString mStationName; |
|
77 bool mStationLogoAvailable; // true if station has its own logo |
|
78 QString mMetaData; |
|
79 IrAppState::Type mIrState; |
|
80 |
|
81 IRApplication *mIrApp; |
|
82 IRPlayController *mPlayController; |
|
83 |
|
84 QList<int> mRequestList; // used to maintain the async request |
|
85 |
|
86 Q_DISABLE_COPY(IrMonitorService) |
|
87 |
|
88 }; |
|
89 |
|
90 Q_DECLARE_OPERATORS_FOR_FLAGS(IrMonitorService::ReadyItems) |
|
91 |
|
92 #endif // IRMONITORSERVICE_H |