|
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: Active object helper class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "btengactive.h" |
|
23 |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // C++ default constructor |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CBTEngActive::CBTEngActive( MBTEngActiveObserver& aObserver, TInt aId, |
|
32 TInt aPriority ) |
|
33 : CActive( aPriority ), |
|
34 iRequestId( aId ), |
|
35 iObserver( aObserver ) |
|
36 { |
|
37 CActiveScheduler::Add( this ); |
|
38 } |
|
39 |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Symbian 2nd-phase constructor |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CBTEngActive::ConstructL() |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // NewLC |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CBTEngActive* CBTEngActive::NewL( MBTEngActiveObserver& aObserver, |
|
55 TInt aId, TInt aPriority ) |
|
56 { |
|
57 CBTEngActive* self = new( ELeave ) CBTEngActive( aObserver, aId, aPriority ); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // Destructor |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CBTEngActive::~CBTEngActive() |
|
70 { |
|
71 Cancel(); |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // From class CActive. |
|
77 // Called by the active scheduler when the request has been cancelled. |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CBTEngActive::DoCancel() |
|
81 { |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // From class CActive. |
|
87 // Called by the active scheduler when the request has been completed. |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CBTEngActive::RunL() |
|
91 { |
|
92 iObserver.RequestCompletedL( this, iRequestId, iStatus.Int() ); |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // From class CActive. |
|
98 // Called by the active scheduler when an error in RunL has occurred. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CBTEngActive::RunError( TInt aError ) |
|
102 { |
|
103 iObserver.HandleError( this, iRequestId, aError ); |
|
104 return KErrNone; |
|
105 } |