|
1 /* |
|
2 * Copyright (c) 2007 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: Power save mode client active object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "psmclientimpl.h" |
|
20 #include "psmclientactive.h" |
|
21 #include "psmclientobserver.h" |
|
22 #include "psmtrace.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CPsmClientActive::CPsmClientActive |
|
26 // Two-phased constructor. |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CPsmClientActive::CPsmClientActive( MPsmClientObserver& aObserver ) : |
|
30 CActive( EPriorityStandard ), |
|
31 iObserver( aObserver ) |
|
32 { |
|
33 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::CPsmClientActive()" ) ) ); |
|
34 CActiveScheduler::Add( this ); |
|
35 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::CPsmClientActive - return" ) ) ); |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CPsmClientActive::~CPsmClientActive |
|
40 // Destructor |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CPsmClientActive::~CPsmClientActive() |
|
44 { |
|
45 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::~CPsmClientActive()" ) ) ); |
|
46 Cancel(); |
|
47 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::~CPsmClientActive - return" ) ) ); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CPsmClientActive::RunL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 void CPsmClientActive::RunL() |
|
55 { |
|
56 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::RunL() - %i" ), iStatus.Int() ) ); |
|
57 |
|
58 // Note: As this class does not implement CActive::RunError, this RunL cannot never leave |
|
59 |
|
60 TInt result( iStatus.Int() ); |
|
61 |
|
62 if ( result < KErrNone ) |
|
63 { |
|
64 iObserver.PowerSaveModeChangeError( result ); |
|
65 } |
|
66 else |
|
67 { |
|
68 iObserver.PowerSaveModeChanged( (TPsmsrvMode)result ); |
|
69 } |
|
70 |
|
71 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::RunL - return" ) ) ); |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CPsmClientActive::DoCancel |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CPsmClientActive::DoCancel() |
|
79 { |
|
80 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::DoCancel()" ) ) ); |
|
81 iObserver.PowerSaveModeChangeError( KErrCancel ); |
|
82 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::DoCancel - return" ) ) ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CPsmClientActive::SetActive |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CPsmClientActive::SetActive() |
|
90 { |
|
91 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::SetActive()" ) ) ); |
|
92 CActive::SetActive(); |
|
93 COMPONENT_TRACE( ( _L( "PSM Client - CPsmClientActive::SetActive - return" ) ) ); |
|
94 } |
|
95 |
|
96 // End of file |