|
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: Definition of the stream source reader active object class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DATACOPYENGINEAO_H |
|
20 #define DATACOPYENGINEAO_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 class CSourceQueueItem; |
|
26 class CSinkQueueItem; |
|
27 class MDataCopyEngineObserver; |
|
28 |
|
29 |
|
30 class CDataCopyEngineAO : public CActive |
|
31 { |
|
32 public: // Constructors and destructor |
|
33 |
|
34 /** |
|
35 * Two-phased constructor. |
|
36 */ |
|
37 static CDataCopyEngineAO* NewL( TSglQue<CSourceQueueItem>* aSourceQueue, |
|
38 TSglQue<CSinkQueueItem>* aSinkQueue, |
|
39 MDataCopyEngineObserver& aObserver ); |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 virtual ~CDataCopyEngineAO(); |
|
45 |
|
46 // Called by DataBufferSource when a request is added to source queue |
|
47 void SourceQueueChanged(); |
|
48 // Called by DataBufferSource when a request is added to sink queue |
|
49 void SinkQueueChanged(); |
|
50 // Called by DataBufferSource to start the engine |
|
51 void Start(); |
|
52 // Called by DataBufferSource to stop the engine |
|
53 void Stop(); |
|
54 // Called by DataBufferSource to pause the engine |
|
55 void Pause(); |
|
56 |
|
57 // Called by Active Object framework |
|
58 virtual void RunL(); |
|
59 virtual void DoCancel(); |
|
60 virtual TInt RunError(TInt aError); |
|
61 private: |
|
62 |
|
63 /** |
|
64 * C++ default constructor. |
|
65 */ |
|
66 CDataCopyEngineAO( TSglQue<CSourceQueueItem>* aSourceQueue, |
|
67 TSglQue<CSinkQueueItem>* aSinkQueue, |
|
68 MDataCopyEngineObserver& aObserver ); |
|
69 |
|
70 /** |
|
71 * By default Symbian 2nd phase constructor is private. |
|
72 */ |
|
73 void ConstructL(); |
|
74 |
|
75 // Used by this to keep the AO going |
|
76 void KickSignal(); |
|
77 |
|
78 private: |
|
79 enum TDataCopyEngineState |
|
80 { |
|
81 EStopped, // Stopped state |
|
82 EPaused, // Paused state |
|
83 EExecuting, // Copying data |
|
84 EWaitingForSourceQueueSignal, // Waiting for item to be available in the source queue |
|
85 EWaitingForSinkQueueSignal |
|
86 }; |
|
87 |
|
88 // Reference to Source queue passed in thru constructor |
|
89 TSglQue<CSourceQueueItem>* iSourceQueue; |
|
90 // Reference to Sink queue passed in thru constructor |
|
91 TSglQue<CSinkQueueItem>* iSinkQueue; |
|
92 // Reference to observer |
|
93 MDataCopyEngineObserver* iObserver; |
|
94 // State of the engine |
|
95 TDataCopyEngineState iState; |
|
96 // Holds true if source queue item is processed |
|
97 TBool iSourceQueueItemProcessed; |
|
98 // Holds true if sink queue item is processed |
|
99 TBool iSinkQueueItemProcessed; |
|
100 // Temporary buffer containing data from source queue |
|
101 HBufC8* iSrcDataDes; |
|
102 // Data Position within the temporary buffer |
|
103 TInt iSrcDataPos; |
|
104 }; |
|
105 |
|
106 #endif // DATACOPYENGINEAO_H |
|
107 |
|
108 // End of File |