1 /* |
|
2 * Copyright (c) 2008-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 the License "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: This class implements an active object with callback functionality. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "wlancbwaiter.h" |
|
20 #include "am_debug.h" |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CWlanCbWaiter::CWlanCbWaiter( |
|
28 const TCallBack& aCallback ) : |
|
29 CActive( CActive::EPriorityStandard ), |
|
30 iCallback( aCallback ) |
|
31 { |
|
32 DEBUG( "CWlanCbWaiter::CWlanCbWaiter()" ); |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 void CWlanCbWaiter::ConstructL() |
|
39 { |
|
40 DEBUG( "CWlanCbWaiter::ConstructL()" ); |
|
41 CActiveScheduler::Add( this ); |
|
42 DEBUG( "CWlanCbWaiter::ConstructL() - done" ); |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CWlanCbWaiter* CWlanCbWaiter::NewL( |
|
49 const TCallBack& aCallback ) |
|
50 { |
|
51 DEBUG( "CWlanCbWaiter::NewL()" ); |
|
52 CWlanCbWaiter* self = new (ELeave) CWlanCbWaiter( aCallback ); |
|
53 |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CWlanCbWaiter::~CWlanCbWaiter() |
|
65 { |
|
66 DEBUG( "CWlanCbWaiter::~CWlanCbWaiter()" ); |
|
67 Cancel(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CWlanCbWaiter::IssueRequest() |
|
74 { |
|
75 DEBUG( "CWlanCbWaiter::IssueRequest()" ); |
|
76 SetActive(); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 TRequestStatus& CWlanCbWaiter::RequestStatus() |
|
83 { |
|
84 DEBUG1( "CWlanCbWaiter::RequestStatus() - iStatus = %d", iStatus.Int() ); |
|
85 return iStatus; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CWlanCbWaiter::RunL() |
|
92 { |
|
93 DEBUG1( "CWlanCbWaiter::RunL() - iStatus = %d", iStatus.Int() ); |
|
94 |
|
95 iCallback.CallBack(); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CWlanCbWaiter::RunError( |
|
102 TInt /* aError */ ) |
|
103 { |
|
104 DEBUG( "CWlanCbWaiter::RunError()" ); |
|
105 |
|
106 return KErrNone; |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CWlanCbWaiter::DoCancel() |
|
113 { |
|
114 DEBUG( "CWlanCbWaiter::DoCancel()" ); |
|
115 } |
|