21 #include <sipsystemstatemonitorpskeys.h> |
21 #include <sipsystemstatemonitorpskeys.h> |
22 #include <sipsystemstateobserver.h> |
22 #include <sipsystemstateobserver.h> |
23 |
23 |
24 _LIT_SECURITY_POLICY_PASS( KSIPRfsAlwaysPass ); |
24 _LIT_SECURITY_POLICY_PASS( KSIPRfsAlwaysPass ); |
25 |
25 |
26 static const TInt KMicroSecondsInSecond = 1000000; |
|
27 static const TInt KGuardTimerSeconds = 20; |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
26 // ----------------------------------------------------------------------------- |
30 // CSipRfsMonitorAo::NewL |
27 // CSipRfsMonitorAo::NewL |
31 // ----------------------------------------------------------------------------- |
28 // ----------------------------------------------------------------------------- |
32 // |
29 // |
33 CSipRfsMonitorAo* CSipRfsMonitorAo::NewL() |
30 CSipRfsMonitorAo* CSipRfsMonitorAo::NewL() |
43 // CSipRfsMonitorAo::ConstructL |
40 // CSipRfsMonitorAo::ConstructL |
44 // ----------------------------------------------------------------------------- |
41 // ----------------------------------------------------------------------------- |
45 // |
42 // |
46 void CSipRfsMonitorAo::ConstructL () |
43 void CSipRfsMonitorAo::ConstructL () |
47 { |
44 { |
48 iGuardTimer = CPeriodic::NewL( EPriorityNormal ); |
|
49 TInt err = iProperty.Define( KPSSipRfsUid, KSipRfsState, RProperty::EInt, |
45 TInt err = iProperty.Define( KPSSipRfsUid, KSipRfsState, RProperty::EInt, |
50 KSIPRfsAlwaysPass, KSIPRfsAlwaysPass); |
46 KSIPRfsAlwaysPass, KSIPRfsAlwaysPass); |
51 if ( KErrNone != err && KErrAlreadyExists != err && |
47 if ( KErrNone != err && KErrAlreadyExists != err && |
52 KErrPermissionDenied != err ) |
48 KErrPermissionDenied != err ) |
53 { |
49 { |
74 // CSipRfsMonitorAo::~CSipRfsMonitorAo |
70 // CSipRfsMonitorAo::~CSipRfsMonitorAo |
75 // ----------------------------------------------------------------------------- |
71 // ----------------------------------------------------------------------------- |
76 // |
72 // |
77 CSipRfsMonitorAo::~CSipRfsMonitorAo() |
73 CSipRfsMonitorAo::~CSipRfsMonitorAo() |
78 { |
74 { |
79 if(iGuardTimer) |
|
80 { |
|
81 iGuardTimer->Cancel(); |
|
82 delete iGuardTimer; |
|
83 iGuardTimer = NULL; |
|
84 } |
|
85 CActive::Cancel(); |
75 CActive::Cancel(); |
86 iProperty.Close(); |
76 iProperty.Close(); |
87 iProperty.Delete(KPSSipRfsUid,KSipRfsState); |
77 iProperty.Delete(KPSSipRfsUid,KSipRfsState); |
88 iObservers.Close(); |
78 iObservers.Close(); |
89 } |
79 } |
122 { |
112 { |
123 iObservers[i]->SystemVariableUpdated( |
113 iObservers[i]->SystemVariableUpdated( |
124 CSipSystemStateMonitor::ERfsState, |
114 CSipSystemStateMonitor::ERfsState, |
125 0, |
115 0, |
126 iState); |
116 iState); |
127 } |
117 } |
128 if(iObservers.Count() && iState == CSipSystemStateMonitor::ERfsStarted) |
|
129 { |
|
130 iGuardTimer->Cancel(); |
|
131 iGuardTimer->Start( |
|
132 TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ), |
|
133 TTimeIntervalMicroSeconds32( KGuardTimerSeconds * KMicroSecondsInSecond ), |
|
134 TCallBack( TimerExpired, this ) ); |
|
135 } |
|
136 |
|
137 } |
118 } |
138 |
119 |
139 // ----------------------------------------------------------------------------- |
120 // ----------------------------------------------------------------------------- |
140 // CSipRfsMonitorAo::State |
121 // CSipRfsMonitorAo::State |
141 // ----------------------------------------------------------------------------- |
122 // ----------------------------------------------------------------------------- |
148 // ----------------------------------------------------------------------------- |
129 // ----------------------------------------------------------------------------- |
149 // CSipRfsMonitorAo::EventProcessingCompleted |
130 // CSipRfsMonitorAo::EventProcessingCompleted |
150 // ----------------------------------------------------------------------------- |
131 // ----------------------------------------------------------------------------- |
151 // |
132 // |
152 void CSipRfsMonitorAo::EventProcessingCompleted( |
133 void CSipRfsMonitorAo::EventProcessingCompleted( |
153 MSipSystemStateObserver& /*aObserver*/ ) |
134 MSipSystemStateObserver& aObserver ) |
154 { |
135 { |
155 } |
136 if (iState == CSipSystemStateMonitor::ERfsStarted) |
156 |
137 { |
157 // ----------------------------------------------------------------------------- |
138 TInt index = iObservers.Find( &aObserver ); |
158 // CSipRfsMonitorAo::EventProcessingCompleted |
139 if ( index >= 0 ) |
159 // ----------------------------------------------------------------------------- |
140 { |
160 // |
141 iCount++; |
161 void CSipRfsMonitorAo::EventProcessingCompleted() |
142 if( iObservers.Count() == iCount) |
162 { |
143 { |
163 iGuardTimer->Cancel(); |
144 iProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsEventProcessingCompleted ); |
164 iProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsEventProcessingCompleted ); |
145 iCount = 0; |
165 iCount = 0; |
146 } |
166 } |
147 } |
167 |
148 } |
168 // ----------------------------------------------------------------------------- |
|
169 // CSipRfsMonitorAo::TimerExpired |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CSipRfsMonitorAo::TimerExpired(TAny* aSelf) |
|
173 { |
|
174 CSipRfsMonitorAo* self = reinterpret_cast<CSipRfsMonitorAo*>(aSelf); |
|
175 self->EventProcessingCompleted(); |
|
176 return ETrue; |
|
177 } |
149 } |
178 |
150 |
179 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
180 // CSipRfsMonitorAo::RunL |
152 // CSipRfsMonitorAo::RunL |
181 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |