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