|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // tavsrcmtupdater.h |
|
15 // |
|
16 |
|
17 #ifndef TAVSRCMTUPDATER_H |
|
18 #define TAVSRCMTUPDATER_H |
|
19 |
|
20 #include <remconmediainformationtargetobserver.h> |
|
21 #include <playerinformationtargetobserver.h> |
|
22 #include <remcondatabaseunawarenowplayingtargetobserver.h> |
|
23 #include <remcondatabaseunawarenowplayingbrowseobserver.h> |
|
24 #include <remcondatabaseunawaremedialibrarybrowseobserver.h> |
|
25 #include <remcon/avrcpspec.h> |
|
26 #include "mediainformation.h" |
|
27 |
|
28 _LIT(KAVRCPSettingsResourceFilename, "z:\\bluetooth\\avrcp\\avrcp-settings.rsc"); |
|
29 const TInt KDefaultLength = 120000; |
|
30 const TInt KPositionIncrement = 5000; |
|
31 |
|
32 class CStopBrowseWatcher |
|
33 : public CActive |
|
34 { |
|
35 public: |
|
36 static CStopBrowseWatcher* NewL(); |
|
37 ~CStopBrowseWatcher(); |
|
38 |
|
39 void Start(); |
|
40 void Complete(); |
|
41 |
|
42 private: |
|
43 CStopBrowseWatcher(); |
|
44 void ConstructL(); |
|
45 |
|
46 private: // from CActive |
|
47 void RunL(); |
|
48 void DoCancel(); |
|
49 |
|
50 private: |
|
51 RThread iThread; |
|
52 }; |
|
53 |
|
54 class CActiveCallBackConsole; |
|
55 class CRemConDatabaseUnawareMediaBrowseTarget; |
|
56 class MRemConDatabaseUnawareMediaLibraryBrowse; |
|
57 class MRemConDatabaseUnawareNowPlayingBrowse; |
|
58 class CRemConDatabaseUnawareNowPlayingTarget; |
|
59 class CTavsrcMtUpdater : public CBase, public MActiveConsoleNotify, |
|
60 public MPlayerApplicationSettingsNotify, |
|
61 public MRemConDatabaseUnawareMediaLibraryBrowseObserver, |
|
62 public MRemConDatabaseUnawareNowPlayingBrowseObserver, |
|
63 public MRemConDatabaseUnawareNowPlayingTargetObserver |
|
64 { |
|
65 public: |
|
66 static CTavsrcMtUpdater* NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); |
|
67 ~CTavsrcMtUpdater(); |
|
68 |
|
69 private: |
|
70 CTavsrcMtUpdater(); |
|
71 void ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); |
|
72 |
|
73 void KeyPressed(TChar aKey); |
|
74 void MtMenu(); |
|
75 |
|
76 void ReadAVRCPSettingsFile(const TDesC& aResourceFileName); |
|
77 |
|
78 void AddEvent(TRegisterNotificationEvent aEvent); |
|
79 void AddCompanyId(TInt aCompanyId); |
|
80 void TrackReachedEnd(); |
|
81 void TrackReachedStart(); |
|
82 void PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); |
|
83 void TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds); |
|
84 void SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus); |
|
85 void SetPlaybackPosition(TUint32 aPosition); |
|
86 void SetAsActivePlayer(); |
|
87 |
|
88 MPlayerEventsObserver::TPlaybackStatus NextPlaybackStatus(); |
|
89 MPlayerEventsObserver::TTargetBatteryStatus NextBatteryStatus(); |
|
90 |
|
91 private: |
|
92 // from MPlayerApplicationSettingsNotify |
|
93 void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue); |
|
94 |
|
95 // from MRemConDatabaseUnawareNowPlayingTargetObserver |
|
96 void MrcdunptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope); |
|
97 void MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope); |
|
98 |
|
99 // from MRemConDatabaseUnawareMediaLibraryBrowseObserver |
|
100 void MrcdumlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem); |
|
101 void MrcdumlboFolderUp(); |
|
102 void MrcdumlboFolderDown(const TRemConItemUid& aFolder); |
|
103 void MrcdumlboGetPath(RPointerArray<HBufC8>& aPath); |
|
104 void MrcdumlboSearch(const TDesC8& aSearch); |
|
105 TInt MrcdumlboGetItem(TRemConFolderScope aScope, |
|
106 const TRemConItemUid& aItemId, |
|
107 TMediaAttributeIter& aIter); |
|
108 |
|
109 // from MRemConDatabaseUnawareNowPlayingBrowseObserver |
|
110 void MrcdunpboGetFolderListing(TUint aStartItem, TUint aEndItem); |
|
111 TInt MrcdunpboGetItem(const TRemConItemUid& aItemId, |
|
112 TMediaAttributeIter& aIter); |
|
113 |
|
114 void DisplayCurrentState(); |
|
115 void SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid); |
|
116 |
|
117 private: // Utility functions |
|
118 TInt PrepareItemDataL(TMediaAttributeIter& aIter, |
|
119 const TRemConItemUid& aItemId, |
|
120 HBufC8* &aItemName, |
|
121 RArray<TMediaElementAttribute>& aItemAttributes); |
|
122 |
|
123 private: // second thread functions |
|
124 static TInt MediaBrowseThread(TAny* aPtr); |
|
125 void BrowseSetupL(CRemConInterfaceSelector& aIfSel); |
|
126 void BrowseCleanup(); |
|
127 |
|
128 static TInt BrowseKeyPressed(TAny* aPtr, TChar aKey); |
|
129 void BrowseKeyPressedL(TChar aKey); |
|
130 void BrowseMenu(); |
|
131 |
|
132 private: |
|
133 CPlayerInfoTarget* iPlayerInformation; |
|
134 MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver; |
|
135 MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver; |
|
136 MPlayerEventsObserver* iPlayerEventsObserver; |
|
137 |
|
138 CRemConDatabaseUnawareMediaBrowseTarget* iMediaBrowse; |
|
139 MRemConDatabaseUnawareMediaLibraryBrowse* iMediaBrowseInterface; |
|
140 MRemConDatabaseUnawareNowPlayingBrowse* iNowPlayingBrowseInterface; |
|
141 CRemConDatabaseUnawareNowPlayingTarget* iNowPlaying; |
|
142 |
|
143 CActiveConsole* iMtUpdaterConsole; |
|
144 CActiveCallBackConsole* iMtBrowseConsole; |
|
145 |
|
146 TInt iIndex; |
|
147 MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus; |
|
148 MPlayerEventsObserver::TTargetBatteryStatus iBatteryStatus; |
|
149 TUint32 iPosition; |
|
150 TUint32 iLength; |
|
151 |
|
152 |
|
153 RArray<TInt> iNotificationEvents; |
|
154 RArray<TInt> iCompanyIds; |
|
155 |
|
156 TInt iFolderDepth; |
|
157 |
|
158 TUint iUidCounter; |
|
159 |
|
160 TBool iMediaBrowseThreadOpen; |
|
161 RThread iMediaBrowseThread; |
|
162 CStopBrowseWatcher* iMtBrowseStopper; |
|
163 }; |
|
164 |
|
165 #endif //TAVSRCMTUPDATER_H |