|
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 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <UikonInternalPSKeys.h> |
|
20 |
|
21 #include "aknslidestatusnotifier.h" |
|
22 |
|
23 // ======== MEMBER FUNCTIONS ======== |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CAknSlideStatusNotifier::ConstructL() |
|
27 // Second phase of two-phase construction |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 void CAknSlideStatusNotifier::ConstructL( MAknSlideStatusObserver* aObserver ) |
|
31 { |
|
32 TInt err = iProperty.Attach( KPSUidHWRM, KHWRMGripStatus/*KPSUidUikon, KUikFlipStatus*/); |
|
33 User::LeaveIfError( err ); |
|
34 |
|
35 iProperty.Subscribe(iStatus); |
|
36 iObserver = aObserver; |
|
37 CActiveScheduler::Add( this ); |
|
38 SetActive(); |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CAknSlideStatusNotifier::NewL() |
|
44 // Two-phase constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CAknSlideStatusNotifier* CAknSlideStatusNotifier::NewL( MAknSlideStatusObserver* aObserver ) |
|
48 { |
|
49 CAknSlideStatusNotifier* self = CAknSlideStatusNotifier::NewLC( aObserver ); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CAknSlideStatusNotifier::NewLC() |
|
57 // Two-phase constructor, leaves pointer on the cleanup stack |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CAknSlideStatusNotifier* CAknSlideStatusNotifier::NewLC( MAknSlideStatusObserver* aObserver ) |
|
61 { |
|
62 CAknSlideStatusNotifier* self = new( ELeave ) CAknSlideStatusNotifier; |
|
63 CleanupStack::PushL( self ); |
|
64 self->ConstructL( aObserver ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CAknSlideStatusNotifier::CAknSlideStatusNotifier() |
|
71 // Default C++ constructor |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CAknSlideStatusNotifier::CAknSlideStatusNotifier() : CActive( EPriorityNormal ) |
|
75 { |
|
76 // No implementation needed |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CAknSlideStatusNotifier::~CAknSlideStatusNotifier() |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 CAknSlideStatusNotifier::~CAknSlideStatusNotifier() |
|
84 { |
|
85 Cancel(); |
|
86 iProperty.Close(); |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CAknSlideStatusNotifier::RunL |
|
92 // From class CActive |
|
93 // Handles an active object's request completion event. |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 void CAknSlideStatusNotifier::RunL() |
|
97 { |
|
98 TInt status( 0 ); |
|
99 TInt runStatus( iStatus.Int() ); |
|
100 //resubscribe so that no events are lost |
|
101 iProperty.Subscribe( iStatus ); |
|
102 SetActive(); |
|
103 |
|
104 switch( runStatus ) |
|
105 { |
|
106 case KErrNone: |
|
107 if ( KErrNone == iProperty.Get( status ) ) |
|
108 { |
|
109 iObserver->SlideStatusChangedL( status ); |
|
110 } |
|
111 break; |
|
112 |
|
113 case KErrDied: |
|
114 User::Leave( KErrDied ); |
|
115 |
|
116 default: |
|
117 break; |
|
118 } |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CAknSlideStatusNotifier::DoCancel |
|
123 // From class CActive |
|
124 // Implements cancellation of an outstanding request. |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 void CAknSlideStatusNotifier::DoCancel() |
|
128 { |
|
129 iProperty.Cancel(); |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CAknSlideStatusNotifier::RunError |
|
134 // From class CActive |
|
135 // Implements error handling of an outstanding request. |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CAknSlideStatusNotifier::RunError( TInt /*aError*/ ) |
|
139 { |
|
140 return KErrNone; |
|
141 } |
|
142 // End of file SlideStatusNotifier.cpp |