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