|
1 /* |
|
2 * Copyright (c) 2006 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: Buffer commands |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXPLAYBACKCMDBUFFER_H |
|
20 #define CMPXPLAYBACKCMDBUFFER_H |
|
21 |
|
22 |
|
23 #include "mpxplaybackcommandbufferobserver.h" |
|
24 |
|
25 /** |
|
26 * Special processing for media keys, e.g. buffering a quick |
|
27 * succession of keys and calling back with the net result after |
|
28 * a specific period of time |
|
29 */ |
|
30 NONSHARABLE_CLASS(CMPXPlaybackCmdBuffer) : public CTimer |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Two-phased constructor |
|
36 * |
|
37 * @param aObserver observer of the media key |
|
38 * @return object of constructed |
|
39 */ |
|
40 static CMPXPlaybackCmdBuffer* NewL(MMPXPlaybackCmdBufferObserver& aObserver); |
|
41 |
|
42 public: |
|
43 /** |
|
44 * Is this a command controlled by media keys |
|
45 * |
|
46 * @param aCmd playback command |
|
47 * @return ETrue if the command is controlled by media keys |
|
48 */ |
|
49 TBool CommandForBuffering(TMPXPlaybackCommand aCmd) const; |
|
50 |
|
51 /** |
|
52 * Buffer a command, along with the current state and position in the |
|
53 * track |
|
54 * |
|
55 * @param aCmd play command |
|
56 * @param aState play state |
|
57 * @param aPos position |
|
58 */ |
|
59 void BufferCommandL(TMPXPlaybackCommand aCmd,TMPXPlaybackState aState,TInt aPos); |
|
60 |
|
61 /** |
|
62 * Called by client when finished processing command |
|
63 */ |
|
64 void CompleteCommand(); |
|
65 |
|
66 /** |
|
67 * Any command buffered |
|
68 * |
|
69 * @return ETrue buffered commands available |
|
70 */ |
|
71 TBool IsCommandBuffered() const; |
|
72 |
|
73 /** |
|
74 * Clear all command |
|
75 */ |
|
76 void ClearCommands(); |
|
77 |
|
78 private: |
|
79 /** |
|
80 * From CActive |
|
81 * Handles an active object's request completion event |
|
82 */ |
|
83 void RunL(); |
|
84 |
|
85 /** |
|
86 * From CActive |
|
87 * Handles a leave occurring in the request completion event handler RunL() |
|
88 * |
|
89 * @param aError error code |
|
90 * @return system error code |
|
91 */ |
|
92 TInt RunError(TInt aError); |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * C++ constructor |
|
98 */ |
|
99 CMPXPlaybackCmdBuffer(MMPXPlaybackCmdBufferObserver& aObserver); |
|
100 |
|
101 private: |
|
102 MMPXPlaybackCmdBufferObserver& iObserver; |
|
103 TMPXPlaybackCmdInfo iEvent; |
|
104 TBool iIsCommandBuffered; |
|
105 TBool iEventProcessing; |
|
106 TTimeIntervalMicroSeconds32 iBufferTime; |
|
107 }; |
|
108 |
|
109 #endif // CMPXPLAYBACKCMDBUFFER_H |