|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "mcssatnotifier.h" |
|
21 |
|
22 // ============================ MEMBER FUNCTIONS ============================= |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CMcsSatNotifier::CMcsSatNotifier |
|
25 // C++ default constructor |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 CMcsSatNotifier::CMcsSatNotifier( MMcsSATNotifierCallback* aCallback, |
|
29 TUid aCategory, |
|
30 TUint aKey ) : CActive( EPriorityNormal ) |
|
31 { |
|
32 CActiveScheduler::Add( this ); |
|
33 |
|
34 iCallback = aCallback; |
|
35 iCategory = aCategory; |
|
36 iKey = aKey; |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMcsSatNotifier::ConstructL |
|
41 // S2nd phase constructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CMcsSatNotifier::ConstructL() |
|
45 { |
|
46 // Prepare automatically |
|
47 iProperty.Attach( iCategory, iKey ); |
|
48 SetActive(); |
|
49 iStatus = KRequestPending; |
|
50 iProperty.Subscribe( iStatus ); |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CMcsSatNotifier::NewL |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CMcsSatNotifier* CMcsSatNotifier::NewL( MMcsSATNotifierCallback* aCallback, |
|
58 TUid aCategory, |
|
59 TUint aKey ) |
|
60 { |
|
61 CMcsSatNotifier* self = new (ELeave) CMcsSatNotifier( aCallback, |
|
62 aCategory, |
|
63 aKey ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CMcsSatNotifier::~CMcsSatNotifier |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 |
|
77 CMcsSatNotifier::~CMcsSatNotifier() |
|
78 { |
|
79 Cancel(); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CMcsSatNotifier::DoCancel |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CMcsSatNotifier::DoCancel() |
|
87 { |
|
88 iProperty.Cancel(); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CMcsSatNotifier::RunError |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CMcsSatNotifier::RunError( TInt /*aError*/ ) |
|
96 { |
|
97 // Prime the active object |
|
98 SetActive(); |
|
99 iStatus = KRequestPending; |
|
100 iProperty.Subscribe( iStatus ); |
|
101 |
|
102 return KErrNone; |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CMcsSatNotifier::RunL |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CMcsSatNotifier::RunL() |
|
110 { |
|
111 // Filter out cancel status |
|
112 if( iStatus != KErrCancel ) |
|
113 { |
|
114 // Re-issue request before notifying |
|
115 SetActive(); |
|
116 iStatus = KRequestPending; |
|
117 iProperty.Subscribe( iStatus ); |
|
118 iCallback->SATChangeL(); |
|
119 } |
|
120 else |
|
121 { |
|
122 // For PC-Lint |
|
123 } |
|
124 } |
|
125 // End of File |