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: Progressive Download Utility Implementation of the BufTypeSupEventAO class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "BufferEmptiedEventAO.h" |
|
20 #include <DataBuffer.h> |
|
21 |
|
22 using namespace multimedia; |
|
23 |
|
24 CBufferEmptiedEventAO::CBufferEmptiedEventAO(MBufferEmptiedObserver& aObserver ) |
|
25 : CActive(CActive::EPriorityStandard), |
|
26 iObserver(aObserver), |
|
27 iError(KErrNone) |
|
28 { |
|
29 CActiveScheduler::Add(this); |
|
30 } |
|
31 |
|
32 CBufferEmptiedEventAO::~CBufferEmptiedEventAO() |
|
33 { |
|
34 Cancel(); |
|
35 } |
|
36 |
|
37 CBufferEmptiedEventAO* CBufferEmptiedEventAO::NewL( MBufferEmptiedObserver& aObserver ) |
|
38 { |
|
39 CBufferEmptiedEventAO* self = new (ELeave)CBufferEmptiedEventAO( aObserver ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 void CBufferEmptiedEventAO::ConstructL() |
|
47 { |
|
48 } |
|
49 |
|
50 void CBufferEmptiedEventAO::SetActive() |
|
51 { |
|
52 if (!IsActive()) |
|
53 { |
|
54 CActive::SetActive(); |
|
55 } |
|
56 } |
|
57 |
|
58 TInt CBufferEmptiedEventAO::Error() |
|
59 { |
|
60 return iError; |
|
61 } |
|
62 |
|
63 // From CActive |
|
64 void CBufferEmptiedEventAO::RunL() |
|
65 { |
|
66 // Save the error code |
|
67 iError = iStatus.Int(); |
|
68 // Signal the observer that this request is serviced |
|
69 iObserver.BufferEmptiedBySource(); |
|
70 } |
|
71 |
|
72 void CBufferEmptiedEventAO::DoCancel() |
|
73 { |
|
74 if(iStatus.Int() != 0) |
|
75 { |
|
76 TRequestStatus* status = &iStatus; |
|
77 User::RequestComplete(status,KErrCancel); |
|
78 } |
|
79 } |
|
80 |
|
81 TInt CBufferEmptiedEventAO::RunError( TInt /*aError*/ ) |
|
82 { |
|
83 return KErrNone; |
|
84 } |
|
85 |
|
86 void CBufferEmptiedEventAO::SetBuffer(MDataBuffer* aBuffer) |
|
87 { |
|
88 iBuffer = aBuffer; |
|
89 } |
|
90 |
|
91 MDataBuffer* CBufferEmptiedEventAO::GetBuffer() |
|
92 { |
|
93 return iBuffer; |
|
94 } |
|
95 |
|
96 // End of File |
|