|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "activewaiter.h" |
|
17 #include "ssmdebug.h" |
|
18 |
|
19 #ifdef _DEBUG |
|
20 _LIT( KSsmActiveWaiter, "SsmaSsActiveWaiter" ); |
|
21 const TInt KSsmActiveWaiterPanic = 100; |
|
22 #endif |
|
23 |
|
24 |
|
25 CActiveWaiter::CActiveWaiter() |
|
26 : CActive( CActive::EPriorityStandard ) |
|
27 { |
|
28 CActiveScheduler::Add( this ); |
|
29 } |
|
30 |
|
31 |
|
32 |
|
33 CActiveWaiter::~CActiveWaiter() |
|
34 { |
|
35 Cancel(); |
|
36 } |
|
37 |
|
38 |
|
39 |
|
40 void CActiveWaiter::WaitActive() |
|
41 { |
|
42 __ASSERT_DEBUG( !iScheduler.IsStarted(), User::Panic(KSsmActiveWaiter, KSsmActiveWaiterPanic) ); |
|
43 SetActive(); |
|
44 iScheduler.Start(); |
|
45 } |
|
46 |
|
47 |
|
48 |
|
49 void CActiveWaiter::RunL() |
|
50 { |
|
51 if (iScheduler.IsStarted()) |
|
52 { |
|
53 __ASSERT_DEBUG( iScheduler.CanStopNow(), User::Panic(KSsmActiveWaiter, KSsmActiveWaiterPanic) ); |
|
54 |
|
55 iScheduler.AsyncStop(); |
|
56 } |
|
57 else |
|
58 { |
|
59 __ASSERT_DEBUG( 0, User::Panic(KSsmActiveWaiter, KSsmActiveWaiterPanic) ); |
|
60 } |
|
61 } |
|
62 |
|
63 |
|
64 |
|
65 void CActiveWaiter::DoCancel() |
|
66 { |
|
67 } |
|
68 |
|
69 |
|
70 |
|
71 TInt CActiveWaiter::RunError( TInt aError ) |
|
72 { |
|
73 DEBUGPRINT2A("CActiveWaiter::RunError called with error %d", aError); |
|
74 |
|
75 // Current CActiveWaiter::RunL()'s implementation doesn't leave so we are just returning KErrNone. |
|
76 // In case further derived implementations of this RunL() leaves, then this method can be changed |
|
77 // to handle the error properly. |
|
78 aError = KErrNone; |
|
79 return aError; |
|
80 } |
|
81 |