39 |
43 |
40 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
41 // C++ constructor. |
45 // C++ constructor. |
42 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
43 // |
47 // |
44 CMusCallMonitorBase::CMusCallMonitorBase(const RMobileCall& aCall, |
48 CMusCallMonitorBase::CMusCallMonitorBase(const RMobileCall& aCall, MMusTsyPropertyObserver& aObserver ) |
45 MMusTsyPropertyObserver& aObserver, |
49 : CActive( EPriorityNormal ),iCall(aCall),iTsyObserver( aObserver ) |
46 MMusCallStateObserver& aCallStateObserver ) |
|
47 : CActive( EPriorityNormal ),iCall(aCall),iTsyObserver( aObserver ), |
|
48 iCallStateObserver( aCallStateObserver ) |
|
49 |
|
50 |
50 |
51 { |
51 { |
52 // Intialize the remote call event state to Resume , means connected. |
52 // Intialize the remote call event state to Resume , means connected. |
53 iRemoteCallEvent = RMobileCall::ERemoteResume; |
53 iRemoteCallEvent = RMobileCall::ERemoteResume; |
54 // Intialize the local call event state to Resume , means connected. |
54 // Intialize the local call event state to Resume , means connected. |
65 MUS_LOG1( "mus: [MUSAO] -> CMusCallMonitorBase::SetStateL, aVal %d", aVal ) |
65 MUS_LOG1( "mus: [MUSAO] -> CMusCallMonitorBase::SetStateL, aVal %d", aVal ) |
66 TInt callCount = 0; |
66 TInt callCount = 0; |
67 User::LeaveIfError(RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
67 User::LeaveIfError(RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
68 NMusSessionInformationApi::KMusCallCount,callCount)); |
68 NMusSessionInformationApi::KMusCallCount,callCount)); |
69 MUS_LOG1( "mus: [MUSAO] - CallCount = %d",callCount ) |
69 MUS_LOG1( "mus: [MUSAO] - CallCount = %d",callCount ) |
70 |
|
71 RMobileCall::TMobileCallInfoV3 callInfo; |
|
72 RMobileCall::TMobileCallInfoV3Pckg pckg( callInfo ); |
|
73 iCall.GetMobileCallInfo( pckg ); |
|
74 if( callInfo.iEmergency ) |
|
75 { |
|
76 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
77 NMusSessionInformationApi::KMusCallEvent, |
|
78 ( TInt ) NMusSessionInformationApi::ENoCall )); |
|
79 } |
|
80 /* |
70 /* |
81 * CountOfCallMonitors is number of CallMonitor Objects.Static Reference Count. |
71 * CountOfCallMonitors is number of CallMonitor Objects.Static Reference Count. |
82 * = No of active calls . |
72 * = No of active calls . |
83 * React one and only if one call is present -> Mush Call criteria. |
73 * React one and only if one call is present -> Mush Call criteria. |
84 * if call count is more than one , should be taken care by conference call or |
74 * if call count is more than one , should be taken care by conference call or |
85 * multicall criteria. |
75 * multicall criteria. |
86 */ |
76 */ |
87 else if( callCount == 1 ) |
77 if( callCount == 1) |
88 { |
78 { |
89 TInt currentVal; |
79 TInt currentVal; |
90 User::LeaveIfError(RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
80 User::LeaveIfError(RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
91 NMusSessionInformationApi::KMusCallEvent,currentVal)); |
81 NMusSessionInformationApi::KMusCallEvent,currentVal)); |
92 MUS_LOG1( "mus: [MUSAO] - Remote State = %d",iRemoteCallEvent ) |
82 MUS_LOG1( "mus: [MUSAO] - Remote State = %d",iRemoteCallEvent ) |
|
83 |
|
84 |
|
85 /* |
|
86 If Call is Connected then set the Call info. |
|
87 */ |
|
88 if( aVal==NMusSessionInformationApi::ECallConnected ) |
|
89 { |
|
90 SetCallInfoL(); |
|
91 } |
|
92 |
93 /* If current event is callconnected and remote is not in hold set the |
93 /* If current event is callconnected and remote is not in hold set the |
94 property value to CallConnected.Else set it to CallHold. |
94 property value to CallConnected.Else set it to CallHold. |
95 Note : We can be sure about Local is connected when it goes to |
95 Note : We can be sure about Local is connected when it goes to |
96 CallConnected State. But remote call events are just notified |
96 CallConnected State. But remote call events are just notified |
97 in call event monitor. So this stores the last remotecall event |
97 in call event monitor. So this stores the last remotecall event |
107 { |
107 { |
108 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
108 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
109 NMusSessionInformationApi::KMusCallEvent, |
109 NMusSessionInformationApi::KMusCallEvent, |
110 aVal )); |
110 aVal )); |
111 } |
111 } |
112 } |
112 } |
|
113 else if( aVal==NMusSessionInformationApi::EConferenceCall) |
|
114 { |
|
115 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
116 NMusSessionInformationApi::KMusCallEvent, |
|
117 NMusSessionInformationApi::EConferenceCall )); |
|
118 } |
113 else if( aVal==NMusSessionInformationApi::ECallHold || iRemoteCallEvent==RMobileCall::ERemoteHold ) |
119 else if( aVal==NMusSessionInformationApi::ECallHold || iRemoteCallEvent==RMobileCall::ERemoteHold ) |
114 { |
120 { |
115 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
121 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
116 NMusSessionInformationApi::KMusCallEvent, |
122 NMusSessionInformationApi::KMusCallEvent, |
117 NMusSessionInformationApi::ECallHold )); |
123 NMusSessionInformationApi::ECallHold )); |
118 } |
124 } |
119 else if( aVal==NMusSessionInformationApi::ENoCall ) |
125 if( aVal != NMusSessionInformationApi::ENoCall) |
120 { |
|
121 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
122 NMusSessionInformationApi::KMusCallEvent, |
|
123 NMusSessionInformationApi::ENoCall )); |
|
124 } |
|
125 else if( aVal==NMusSessionInformationApi::EConferenceCall ) |
|
126 { |
|
127 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
128 NMusSessionInformationApi::KMusCallEvent, |
|
129 NMusSessionInformationApi::EConferenceCall )); |
|
130 } |
|
131 |
|
132 /* |
|
133 If Call is Connected then set the Call info. |
|
134 */ |
|
135 if( aVal==NMusSessionInformationApi::ECallConnected ) |
|
136 { |
126 { |
137 SetCallInfoL(); |
127 RMobileCall::TMobileCallInfoV3 callInfo; |
|
128 RMobileCall::TMobileCallInfoV3Pckg pckg( callInfo ); |
|
129 |
|
130 User::LeaveIfError(iCall.GetMobileCallInfo( pckg )); |
|
131 if( callInfo.iEmergency ) |
|
132 { |
|
133 User::LeaveIfError(RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
134 NMusSessionInformationApi::KMusCallEvent, |
|
135 ( TInt ) NMusSessionInformationApi::ENoCall )); |
|
136 } |
138 } |
137 } |
139 |
138 |
140 // All P/S Keys are Set |
|
141 //Check if preconditions are met to start or stop the MushClient. |
|
142 iCallStateObserver.MusCallStateChanged(); |
|
143 } |
139 } |
144 |
140 |
145 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::SetStateL" ) |
141 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::SetStateL" ) |
146 } |
142 } |
147 |
143 |
157 User::LeaveIfError(iCall.GetMobileCallInfo( callInfoPckg )); |
153 User::LeaveIfError(iCall.GetMobileCallInfo( callInfoPckg )); |
158 RMobilePhone::TMobileAddress remoteNumber = |
154 RMobilePhone::TMobileAddress remoteNumber = |
159 callInfo.iRemoteParty.iRemoteNumber; |
155 callInfo.iRemoteParty.iRemoteNumber; |
160 // Set telephone number |
156 // Set telephone number |
161 HBufC* telNo( NULL ); |
157 HBufC* telNo( NULL ); |
|
158 HBufC* cleanTelNo( NULL ); |
162 if( remoteNumber.iTelNumber.Length() > 0 ) |
159 if( remoteNumber.iTelNumber.Length() > 0 ) |
163 { |
160 { |
164 MUS_LOG( "mus: [MUSAO] remoteNumber.iTelNumber.Lenght > 0" ) |
161 MUS_LOG( "mus: [MUSAO] remoteNumber.iTelNumber.Lenght > 0" ) |
165 telNo = remoteNumber.iTelNumber.AllocLC(); |
162 telNo = remoteNumber.iTelNumber.AllocLC(); |
166 } |
163 } |
167 else |
164 else |
168 { |
165 { |
169 MUS_LOG( "mus: [CALLMN] remoteNumber.iTelNumber.Lenght =< 0" ) |
166 MUS_LOG( "mus: [MUSAO] remoteNumber.iTelNumber.Lenght =< 0" ) |
170 RMobilePhone::TMobileAddress dialledParty = callInfo.iDialledParty; |
167 RMobilePhone::TMobileAddress dialledParty = callInfo.iDialledParty; |
171 telNo = dialledParty.iTelNumber.AllocLC(); |
168 telNo = dialledParty.iTelNumber.AllocLC(); |
172 } |
169 |
|
170 } |
|
171 if ( MultimediaSharingSettings::PrivacySetting() ) |
|
172 { |
|
173 SetClirSetting( *telNo ); |
|
174 } |
|
175 cleanTelNo = RemovePrefix( *telNo ); |
|
176 CleanupStack::PushL( cleanTelNo ); |
|
177 |
173 User::LeaveIfError(RProperty::Set( |
178 User::LeaveIfError(RProperty::Set( |
174 NMusSessionInformationApi::KCategoryUid, |
179 NMusSessionInformationApi::KCategoryUid, |
175 NMusSessionInformationApi::KMusTelNumber, |
180 NMusSessionInformationApi::KMusTelNumber, |
176 *telNo )); |
181 *cleanTelNo )); |
177 MUS_LOG_TDESC("mus: [MUSAO] telNo = ", (*telNo)) |
182 MUS_LOG_TDESC("mus: [MUSAO] telNo = ", (*cleanTelNo)) |
|
183 CleanupStack::PopAndDestroy(cleanTelNo); |
178 CleanupStack::PopAndDestroy(telNo); |
184 CleanupStack::PopAndDestroy(telNo); |
179 |
185 |
180 // Set call direction. |
186 // Set call direction. |
181 RMobileCall::TMobileCallDirection direction = |
187 RMobileCall::TMobileCallDirection direction = |
182 callInfo.iRemoteParty.iDirection; |
188 callInfo.iRemoteParty.iDirection; |
183 MUS_LOG1( "mus: [MUSAO] Call Direction = %d",direction ) |
189 MUS_LOG1( "mus: [MUSAO] Call Direction = %d",direction ) |
184 if( direction == RMobileCall::EMobileOriginated ) |
190 if( direction == RMobileCall::EMobileOriginated ) |
185 { |
191 { |
199 { |
206 { |
200 User::LeaveIfError(RProperty::Set( |
207 User::LeaveIfError(RProperty::Set( |
201 NMusSessionInformationApi::KCategoryUid, |
208 NMusSessionInformationApi::KCategoryUid, |
202 NMusSessionInformationApi::KMusCallDirection, |
209 NMusSessionInformationApi::KMusCallDirection, |
203 ( TInt ) NMusSessionInformationApi::ENoDirection )); |
210 ( TInt ) NMusSessionInformationApi::ENoDirection )); |
204 } |
211 } |
205 |
212 |
206 |
|
207 /* Set the call provider information to some dummy Value */ |
|
208 User::LeaveIfError(RProperty::Set( |
|
209 NMusSessionInformationApi::KCategoryUid, |
|
210 NMusSessionInformationApi::KMUSCallProvider, |
|
211 KNullDesC)); |
|
212 |
213 |
213 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::SetCallInfoL" ) |
214 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::SetCallInfoL" ) |
214 } |
215 } |
215 |
216 |
216 // ----------------------------------------------------------------------------- |
217 // ----------------------------------------------------------------------------- |
239 RCall::TCallInfo callInfo; |
240 RCall::TCallInfo callInfo; |
240 iCall.GetInfo(callInfo); |
241 iCall.GetInfo(callInfo); |
241 iTsyObserver.NotifyCallStateChanged( aVal, callInfo.iCallName ); |
242 iTsyObserver.NotifyCallStateChanged( aVal, callInfo.iCallName ); |
242 } |
243 } |
243 |
244 |
244 |
245 // -------------------------------------------------------------------------- |
245 // -------------------------------------------------------------------------------- |
246 // void CMusCallMonitorBase::SetClirSetting() |
246 // CMusCallConferenceMonitor::IsDataReadyL() |
247 // Determine CLIR setting from dialled digits |
247 // Checks if Data is ready CS Call. |
248 // -------------------------------------------------------------------------- |
248 // -------------------------------------------------------------------------------- |
249 // |
249 |
250 void CMusCallMonitorBase::SetClirSetting( const TDesC& aDialledNumber ) const |
250 TBool CMusCallMonitorBase::IsDataReadyL() |
251 { |
251 { |
252 MUS_LOG( "mus: [MUSAO] -> CMusCallMonitorBase::SetClirSetting" ); |
252 // This function need to be updated when new |
253 |
253 // P/S key is published in Call monitor |
254 NMusSessionInformationApi::TMusClirSetting |
254 |
255 sendNumber( NMusSessionInformationApi::ESendOwnNumber ); |
255 MUS_LOG( "mus: [MUSAO] -> CMusCallMonitorBase::IsDataReadyL" ) |
256 |
256 |
257 TPtrC prefix = aDialledNumber.Left( KDoNotSendOwnNumber().Length() ); |
257 // Ensure there is tel Number. |
258 if ( prefix == KDoNotSendOwnNumber() ) |
258 HBufC* telNumInfo = HBufC::NewLC( RProperty::KMaxPropertySize ); |
259 { |
259 TPtr ptelInfo = telNumInfo->Des(); |
260 sendNumber = NMusSessionInformationApi::EDoNotSendOwnNumber; |
260 TInt err = KErrNone; |
261 } |
261 |
262 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
262 err = RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
263 NMusSessionInformationApi::KMusClirSetting, sendNumber ); |
263 NMusSessionInformationApi::KMusTelNumber, |
264 MUS_LOG1( "mus: [MUSAO] <- CMusCallMonitorBase::SetClirSetting send nbr=%d", |
264 ptelInfo ); |
265 sendNumber == NMusSessionInformationApi::ESendOwnNumber ); |
265 |
266 } |
266 TBool telInfoExisit ( err == KErrNone && telNumInfo->Des().Length() > 0 ); |
267 |
267 CleanupStack::PopAndDestroy( telNumInfo ); |
268 |
268 |
269 // -------------------------------------------------------------------------- |
269 // Ensure Call direction info is there |
270 // void CMusCallMonitorBase::RemovePrefix() |
270 TInt callDirection = NMusSessionInformationApi::ENoDirection; |
271 // -------------------------------------------------------------------------- |
271 err = RProperty::Get( |
272 // |
272 NMusSessionInformationApi::KCategoryUid, |
273 HBufC* CMusCallMonitorBase::RemovePrefix( const TDesC& aOriginator ) const |
273 NMusSessionInformationApi::KMusCallDirection, |
274 { |
274 callDirection ); |
275 MUS_LOG( "mus: [MUSAO] -> CMusCallMonitorBase::removePrefix" ); |
275 |
276 |
276 TBool callInfoExisit ( err == KErrNone && callDirection != NMusSessionInformationApi::ENoDirection ); |
277 HBufC * withoutPrefix(NULL); |
277 |
278 |
278 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::IsDataReadyL" ) |
279 TPtrC prefix = aOriginator.Left( KDoNotSendOwnNumber().Length() ); |
279 return telInfoExisit && callInfoExisit; |
280 if ( prefix == KDoNotSendOwnNumber()|| prefix == KDoSendOwnNumber() ) |
|
281 { |
|
282 MUS_LOG( "Number have a prefix" ); |
|
283 withoutPrefix = aOriginator.AllocL(); |
|
284 *withoutPrefix = aOriginator; |
|
285 TPtr ptr = withoutPrefix->Des(); |
|
286 ptr.Delete(0,KDoNotSendOwnNumber().Length()); |
|
287 } |
|
288 else |
|
289 { |
|
290 withoutPrefix = aOriginator.AllocL(); |
|
291 } |
|
292 |
|
293 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::RemovePrefix" ); |
|
294 return withoutPrefix; |
|
295 } |
|
296 |
|
297 |
|
298 // -------------------------------------------------------------------------- |
|
299 // void CMusCallMonitorBase::SetTerminatingPrivacy() |
|
300 // -------------------------------------------------------------------------- |
|
301 // |
|
302 void CMusCallMonitorBase::SetTerminatingPrivacy( const RMobileCall& aCall ) const |
|
303 { |
|
304 MUS_LOG( "mus: [MUSAO] -> CMusCallMonitorBase::SetTerminatingPrivacy" ) |
|
305 RMobileCall::TMobileCallInfoV3 callInfo; |
|
306 RMobileCall::TMobileCallInfoV3Pckg callInfoPckg( callInfo ); |
|
307 if( aCall.GetMobileCallInfo( callInfoPckg ) != KErrNone ) |
|
308 { |
|
309 return; // error cannot do |
|
310 } |
|
311 MUS_LOG( "mus: [MUSAO] Get remote status" ) |
|
312 RMobileCall::TMobileCallRemoteIdentityStatus remoteStatus = |
|
313 callInfo.iRemoteParty.iRemoteIdStatus; |
|
314 |
|
315 if( remoteStatus == RMobileCall::ERemoteIdentitySuppressed ) |
|
316 { |
|
317 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
318 NMusSessionInformationApi::KMUSPrivacy, |
|
319 ( TInt ) NMusSessionInformationApi::EPrivacyOn ); |
|
320 } |
|
321 else |
|
322 { |
|
323 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
324 NMusSessionInformationApi::KMUSPrivacy, |
|
325 ( TInt ) NMusSessionInformationApi::EPrivacyOff ); |
|
326 } |
|
327 MUS_LOG1( "mus: [MUSAO] Remote status = %d",remoteStatus ) |
|
328 MUS_LOG( "mus: [MUSAO] <- CMusCallMonitorBase::SetTerminatingPrivacy" ) |
280 } |
329 } |
281 |
330 |
282 // End of file |
331 // End of file |
283 |
332 |