|
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: Music Player media key handler - private implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MPMEDIAKEYHANDLER_P_H |
|
19 #define MPMEDIAKEYHANDLER_P_H |
|
20 |
|
21 |
|
22 #include <remconcoreapitargetobserver.h> |
|
23 #include <mpxplaybackobserver.h> |
|
24 #include <mpxplaybackframeworkdefs.h> |
|
25 |
|
26 class CRemConInterfaceSelector; |
|
27 class MMPXPlaybackUtility; |
|
28 class MpMediaKeyHandler; |
|
29 class MpMediaKeyRemConResponse; |
|
30 |
|
31 class MpMediaKeyHandlerPrivate : public MRemConCoreApiTargetObserver, |
|
32 public MMPXPlaybackCallback |
|
33 { |
|
34 public: |
|
35 |
|
36 MpMediaKeyHandlerPrivate( MpMediaKeyHandler *wrapper ); |
|
37 virtual ~MpMediaKeyHandlerPrivate(); |
|
38 |
|
39 void init(); |
|
40 void setEnabled( bool enable ); |
|
41 |
|
42 // From MRemConCoreApiTargetObserver |
|
43 |
|
44 /** |
|
45 * From MRemConCoreApiTargetObserver |
|
46 * A command has been received. |
|
47 * |
|
48 * @param aOperationId The operation ID of the command. |
|
49 * @param aButtonAct The button action associated with the command. |
|
50 */ |
|
51 void MrccatoCommand( |
|
52 TRemConCoreApiOperationId aOperationId, |
|
53 TRemConCoreApiButtonAction aButtonAct ); |
|
54 |
|
55 /** |
|
56 * From MRemConCoreApiTargetObserver |
|
57 * A 'play' command has been received. |
|
58 * |
|
59 * @param aSpeed The playback speed. |
|
60 * @param aButtonAct The button action associated with the command. |
|
61 */ |
|
62 void MrccatoPlay( |
|
63 TRemConCoreApiPlaybackSpeed aSpeed, |
|
64 TRemConCoreApiButtonAction aButtonAct ); |
|
65 |
|
66 /** |
|
67 * From MRemConCoreApiTargetObserver |
|
68 * A 'tune function' command has been received. |
|
69 * |
|
70 * @param aTwoPart Determine which channel to be used. |
|
71 * @param aMajorChannel The major channel number. |
|
72 * @param aMinorChannel The minor channel number. |
|
73 * @param aButtonAct The button action associated with the command. |
|
74 */ |
|
75 void MrccatoTuneFunction( |
|
76 TBool aTwoPart, |
|
77 TUint aMajorChannel, |
|
78 TUint aMinorChannel, |
|
79 TRemConCoreApiButtonAction aButtonAct ); |
|
80 |
|
81 /** |
|
82 * From MRemConCoreApiTargetObserver |
|
83 * A 'select disk function' has been received. |
|
84 * |
|
85 * @param aDisk The disk. |
|
86 * @param aButtonAct The button action associated with the command. |
|
87 */ |
|
88 void MrccatoSelectDiskFunction( |
|
89 TUint aDisk, |
|
90 TRemConCoreApiButtonAction aButtonAct ); |
|
91 |
|
92 /** |
|
93 * From MRemConCoreApiTargetObserver |
|
94 * A 'select AV input function' has been received. |
|
95 * |
|
96 * @param aAvInputSignalNumber The AV input. |
|
97 * @param aButtonAct The button action associated with the command. |
|
98 */ |
|
99 void MrccatoSelectAvInputFunction( |
|
100 TUint8 aAvInputSignalNumber, |
|
101 TRemConCoreApiButtonAction aButtonAct ); |
|
102 |
|
103 /** |
|
104 * From MRemConCoreApiTargetObserver |
|
105 * A 'select audio input function' has been received. |
|
106 * |
|
107 * @param aAudioInputSignalNumber The audio input. |
|
108 * @param aButtonAct The button action associated with the command. |
|
109 */ |
|
110 void MrccatoSelectAudioInputFunction( |
|
111 TUint8 aAudioInputSignalNumber, |
|
112 TRemConCoreApiButtonAction aButtonAct ); |
|
113 |
|
114 // from base class MMPXPlaybackCallback |
|
115 |
|
116 /** |
|
117 * From MMPXPlaybackCallback |
|
118 * Handle playback property |
|
119 * |
|
120 * @param aProperty the property |
|
121 * @param aValue the value of the property |
|
122 * @param aError error code |
|
123 */ |
|
124 void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ); |
|
125 |
|
126 /** |
|
127 * From MMPXPlaybackCallback |
|
128 * Method is called continously until aComplete=ETrue, signifying that |
|
129 * it is done and there will be no more callbacks |
|
130 * Only new items are passed each time |
|
131 * |
|
132 * @param aPlayer UID of the subplayer |
|
133 * @param aSubPlayers a list of sub players |
|
134 * @param aComplete ETrue no more sub players. EFalse more subplayer |
|
135 * expected |
|
136 * @param aError error code |
|
137 */ |
|
138 void HandleSubPlayerNamesL( |
|
139 TUid aPlayer, |
|
140 const MDesCArray* aSubPlayers, |
|
141 TBool aComplete, |
|
142 TInt aError ); |
|
143 |
|
144 /** |
|
145 * From MMPXPlaybackCallback |
|
146 * Handle media properties |
|
147 * |
|
148 * @param aMedia media |
|
149 * @param aError error code |
|
150 */ |
|
151 void HandleMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
152 |
|
153 private: |
|
154 |
|
155 void DoInitL(); |
|
156 void SendCommand( TMPXPlaybackCommand aCommandId ); |
|
157 void DoSendCommandL( TMPXPlaybackCommand aCommandId ); |
|
158 |
|
159 /** |
|
160 * Callback for timer |
|
161 * |
|
162 * @param aPtr Pointer pass to this callback function. |
|
163 * @return Zero if callback function doesn't need to be called again. |
|
164 * Otherwise, non-zero. |
|
165 */ |
|
166 static TInt TimerCallback( TAny* aPtr ); |
|
167 |
|
168 /** |
|
169 * Handle repeat event |
|
170 */ |
|
171 void HandleRepeatEvent(); |
|
172 |
|
173 private: |
|
174 |
|
175 MpMediaKeyHandler *q_ptr; |
|
176 |
|
177 CRemConInterfaceSelector *iInterfaceSelector; // owned |
|
178 MpMediaKeyRemConResponse *iResponseHandler; // owned |
|
179 CPeriodic *iTimer; // owned |
|
180 |
|
181 MMPXPlaybackUtility *iPlaybackUtility; |
|
182 |
|
183 TBool iIncreaseVol; |
|
184 TBool iEnabled; |
|
185 |
|
186 }; |
|
187 |
|
188 #endif // MPMEDIAKEYHANDLER_P_H |