1 /* |
|
2 * Copyright (c) 2002-2010 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: USSD Manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cphsrvussdmanager.h" |
|
20 #include "phsrvutils.h" |
|
21 #include "cphsrvussdsendhandler.h" |
|
22 #include "cphsrvussdreceivehandler.h" |
|
23 #include "cphsrvussdnotifynwrelease.h" |
|
24 #include "cphsrvresourcemanager.h" |
|
25 #include "cphsrvussdreplytimer.h" |
|
26 #include "mphsrvussdmessagesentobserver.h" |
|
27 #include "mphsrvphoneinterface.h" |
|
28 #include "cphsrvussdsessioncancelwaiter.h" |
|
29 |
|
30 #include <apacmdln.h> |
|
31 #include <apgtask.h> |
|
32 #include <bautils.h> |
|
33 #include <textresolver.h> |
|
34 #include <charconv.h> |
|
35 #include <gsmuelem.h> |
|
36 #include <exterror.h> |
|
37 #include <rmmcustomapi.h> |
|
38 |
|
39 #include <w32std.h> |
|
40 #include <apgcli.h> |
|
41 #include <cphcltussd.h> |
|
42 #include <hbtextresolversymbian.h> |
|
43 #include <phoneserver.rsg> |
|
44 #include "phsrvdebuginfo.h" |
|
45 #include <e32property.h> |
|
46 #include <centralrepository.h> |
|
47 #include <coreapplicationuisdomainpskeys.h> |
|
48 |
|
49 |
|
50 // CONSTANTS |
|
51 const TInt KPhSrvDefaultValue = 0x00000000; |
|
52 // See SharedDataKeysVariant.h or NcnListInternalPSKeys.h |
|
53 // const TInt KPhSrvUssdNoTone = 0; |
|
54 // const TInt KPhSrvUssdTimeOutObserverGranularity = 2; |
|
55 // const TInt KPhSrvUssdSentMessageObserverGranularity = 2; |
|
56 // See KUssdSecureId in phcltclientserver.h |
|
57 //const TInt KPhSrvUssdAppUID = 0x10005955; |
|
58 |
|
59 const TInt KPhSrvUssdMessageQueryInterval = 500000; // 0.5 sec |
|
60 //const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec |
|
61 // |
|
62 const TUint KPhSrvUssdDefaultDCS = 0x0f; // 00001111 |
|
63 |
|
64 const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguage = 0x10;// 00010000 |
|
65 const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars3 = 3; |
|
66 const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars2 = 2; |
|
67 const TUint KPhSrvUssdDcsAlphabetDefaultPrecededLanguageStartBit = 5; |
|
68 |
|
69 const TUint KPhSrvUssdDcsAlphabetUCS2PrecededLanguage = 0x11; // 00010001 |
|
70 const TUint KPhSrvUssdDcsAlphabetUCS2PrecededLanguageSkipChars = 2; |
|
71 |
|
72 const TUint KPhSrvUssdDcsGeneralInformationMask = 0xc0; // 11000000 |
|
73 const TUint KPhSrvUssdDcsGeneralInformation = 0x40; // 01xxxxxx |
|
74 const TUint KPhSrvUssdDcsGeneralInformationCompressed = 0x20; // xx1xxxxx |
|
75 const TUint KPhSrvUssdDcsGeneralInformationSimMask = 0x13; // 00010011 |
|
76 const TUint KPhSrvUssdDcsGeneralInformationSim = 0x12; // xxx1xx10 |
|
77 const TUint KPhSrvUssdDcsGeneralInformationAlphabetMask = 0x0c; // 00001100 |
|
78 const TUint KPhSrvUssdDcsGeneralInformationAlphabet8Bit = 0x04; // xxxx01xx |
|
79 const TUint KPhSrvUssdDcsGeneralInformationAlphabetUCS2 = 0x08; // xxxx10xx |
|
80 |
|
81 const TUint KPhSrvUssdDcsMessageHandlingAlphabetMask = 0xf4; // 11110100 |
|
82 const TUint KPhSrvUssdDcsMessageHandlingAlphabet8Bit = 0xf4; // 1111x1xx |
|
83 const TInt KPhrUssdNotifyArraySize = 1; |
|
84 |
|
85 // Refers to HbPopup::NoDismiss = 0 |
|
86 const TInt KPhSrvUssdPopupDismissPolicy = 0; |
|
87 // The time out only for testing, from CPhSrvUssdReplyTimer.cpp |
|
88 const TUint KPhSrvUssdTimeout = 300000000; |
|
89 |
|
90 // Use QT style localization |
|
91 _LIT(KUssdLocFilename, "ussd_"); |
|
92 _LIT(KCommonLocFilename, "common_"); |
|
93 _LIT(KLocPath, "z:\\resource\\qt\\translations"); |
|
94 _LIT(KUssdReply, "txt_ussd_button_reply"); // Reply |
|
95 _LIT(KUssdExit, "txt_ussd_button_exit"); // Exit |
|
96 _LIT(KUssdNext, "txt_ussd_button_next"); //Next |
|
97 _LIT(KUssdYes, "txt_common_button_yes"); // Yes |
|
98 _LIT(KUssdNo, "txt_common_button_no"); // No |
|
99 _LIT(KUssdTitle, "txt_ussd_title_message"); // Message |
|
100 _LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done |
|
101 _LIT(KUssdConfirm, "txt_ussd_info_there_are_still_unread_notifications"); |
|
102 |
|
103 // MACROS |
|
104 |
|
105 #define _DPRINT_FLAGS() \ |
|
106 _DDPRINT( 4, "PhSrv.FLAGS.MsgTypeReply ", iMsgTypeReply ); \ |
|
107 _DDPRINT( 4, "PhSrv.FLAGS.NwReleased ", iNetworkReleased ); \ |
|
108 _DDPRINT( 4, "PhSrv.FLAGS.SendingAck ", iSendingAck ); \ |
|
109 _DDPRINT( 4, "PhSrv.FLAGS.AcksToBeSent ", iAcksToBeSent ); \ |
|
110 _DDPRINT( 4, "PhSrv.FLAGS.iSendRelease ", iSendRelease ); \ |
|
111 _DDPRINT( 4, "PhSrv.FLAGS.iClearArray ", iClearArray ); \ |
|
112 _DDPRINT( 4, "PhSrv.FLAGS.iLaunchGMQ ", iLaunchGMQ ); \ |
|
113 _DDPRINT( 4, "PhSrv.FLAGS.NotifyCount ", NotifyCount() ); \ |
|
114 _DDPRINT( 4, "PhSrv.FLAGS.iShowDone ", iShowDone ); |
|
115 |
|
116 // ============================= LOCAL FUNCTIONS =============================== |
|
117 |
|
118 // CLASS DECLARATION |
|
119 |
|
120 #ifndef TPHSRVUSSDALPHABETPACKER_H |
|
121 #define TPHSRVUSSDALPHABETPACKER_H |
|
122 |
|
123 // CONSTANTS |
|
124 const TUint8 KPhSrvUssdCarriageReturn = 0x0d; |
|
125 |
|
126 /** |
|
127 * Packs and unpacks data encoded in an Ussd alphabet. |
|
128 * |
|
129 * @since 1.0 |
|
130 */ |
|
131 class TPhSrvUssdAlphabetPacker |
|
132 { |
|
133 public: // Constructors and destructor |
|
134 |
|
135 /** |
|
136 * Constructor. |
|
137 * |
|
138 * @param aAlphabet The alphabet that is used. |
|
139 * @param aIsBinary Is the data binary, that will be converted. |
|
140 * @param aStartBit The start bit for conversion. |
|
141 */ |
|
142 TPhSrvUssdAlphabetPacker( |
|
143 TSmsDataCodingScheme::TSmsAlphabet aAlphabet, |
|
144 TBool aIsBinary, |
|
145 TInt aStartBit ); |
|
146 |
|
147 |
|
148 public: // New functions |
|
149 |
|
150 /** |
|
151 * Unpacks 7-bit buffer to 8-bit buffer. |
|
152 * |
|
153 * @param aIn Descriptor where the 7-bit buffer is. |
|
154 * @param aOut 8-bit buffer to set the result. |
|
155 * @param aNumUDUnits Buffer length. |
|
156 * @return Length of the result buffer. |
|
157 */ |
|
158 TInt UnpackL( |
|
159 const TDesC8& aIn, |
|
160 TDes8& aOut, |
|
161 TInt aNumUDUnits ); |
|
162 |
|
163 /** |
|
164 * Unpacks 7-bit buffer to 8-bit and converts to unicode. |
|
165 * |
|
166 * @param aCharacterSetConverter Does the converting. |
|
167 * @param aFs File server session. |
|
168 * @param aIn Packed 7-bit buffer. |
|
169 * @param aOut Unicode buffer. |
|
170 * @param aNumUDUnits Number of charahters. |
|
171 * @return Number of used octets in 8-bit buffer. |
|
172 */ |
|
173 TInt UnpackAndConvertL( |
|
174 CCnvCharacterSetConverter& aCharacterSetConverter, |
|
175 RFs& aFs, |
|
176 const TDesC8& aIn, |
|
177 TDes& aOut, |
|
178 TInt aNumUDUnits ); |
|
179 |
|
180 /** |
|
181 * Counts the needed octet amout. |
|
182 * |
|
183 * @param aNumUDUnits Number of source characters. |
|
184 * @return Octets needed. |
|
185 */ |
|
186 TInt PackedOctetsRequiredL( TInt aNumUDUnits ) const; |
|
187 |
|
188 |
|
189 private: |
|
190 |
|
191 // Private helper methods |
|
192 TInt ElementSizeInBitsL() const; |
|
193 |
|
194 |
|
195 private: // Data |
|
196 |
|
197 // The used coding alphabet. |
|
198 TSmsDataCodingScheme::TSmsAlphabet iAlphabet; |
|
199 |
|
200 // Is the packed data binary. |
|
201 TBool iIsBinary; |
|
202 |
|
203 // The start bit for packing. |
|
204 TInt iStartBit; |
|
205 }; |
|
206 |
|
207 #endif // TPHSRVUSSDALPHABETPACKER_H |
|
208 |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // TPhSrvUssdAlphabetPacker::TPhSrvUssdAlphabetPacker |
|
212 // Constructor. |
|
213 // |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 TPhSrvUssdAlphabetPacker::TPhSrvUssdAlphabetPacker( |
|
217 TSmsDataCodingScheme::TSmsAlphabet aAlphabet, |
|
218 TBool aIsBinary, |
|
219 TInt aStartBit) |
|
220 : iAlphabet( aAlphabet ),iIsBinary( aIsBinary ),iStartBit( aStartBit ) |
|
221 { |
|
222 } |
|
223 |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // TPhSrvUssdAlphabetPacker::UnpackL |
|
227 // Unpacks user data units from aIn and appends to aOut. |
|
228 // |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 TInt TPhSrvUssdAlphabetPacker::UnpackL( |
|
232 const TDesC8& aIn, |
|
233 TDes8& aOut, |
|
234 TInt aNumUDUnits ) |
|
235 { |
|
236 TInt length = aNumUDUnits; |
|
237 // Ensure we've got enough output buffer |
|
238 if ( aOut.Length() + length > aOut.MaxLength() ) |
|
239 { |
|
240 User::Leave(KErrCorrupt); |
|
241 } |
|
242 |
|
243 TInt elementSizeInBits = ElementSizeInBitsL(); |
|
244 if ( elementSizeInBits == 8 ) // 8-bit data? |
|
245 { |
|
246 aOut.Append( aIn ); |
|
247 } |
|
248 else if ( elementSizeInBits == 7 ) // need unpacking from 7-bit data |
|
249 { |
|
250 // Get raw pointers and do unpacking |
|
251 TUint8* outPtr = ( TUint8* )aOut.Ptr() + aOut.Length(); |
|
252 const TUint8* inPtr = aIn.Ptr(); |
|
253 |
|
254 for ( TInt i = 0; i < length; i++ ) |
|
255 { |
|
256 TInt from = ( *inPtr >> iStartBit ) & 0x7F; // Take seven bits |
|
257 if ( iStartBit ) |
|
258 { |
|
259 inPtr++; |
|
260 // Take more from next byte |
|
261 from |= ( *inPtr << ( 8 - iStartBit ) ) & 0x7F; |
|
262 } |
|
263 outPtr[i] = ( TUint8 ) from; |
|
264 iStartBit = ( iStartBit + 7 ) % 8; // roll: 0,1,2,...,6,7,0,1,2... |
|
265 } |
|
266 |
|
267 // The last character will be ignored if message ends |
|
268 // on an octet bounday with CR. |
|
269 if ( outPtr[ length-1 ] == KPhSrvUssdCarriageReturn && iStartBit == 0 ) |
|
270 { |
|
271 length--; |
|
272 } |
|
273 aOut.SetLength( aOut.Length() + length ); |
|
274 } |
|
275 else |
|
276 { |
|
277 __ASSERT_DEBUG(EFalse, |
|
278 PhoneServerUtils::Panic( EPhoneServerPanicModeLogicFault ) ); |
|
279 } |
|
280 return length; |
|
281 } |
|
282 |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // TPhSrvUssdAlphabetPacker::UnpackAndConvertL |
|
286 // Unpacks the converts the input data, aIn, and appends to aOut |
|
287 // |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 TInt TPhSrvUssdAlphabetPacker::UnpackAndConvertL( |
|
291 CCnvCharacterSetConverter& aCharacterSetConverter, |
|
292 RFs& aFs, |
|
293 const TDesC8& aIn, |
|
294 TDes& aOut, |
|
295 TInt aNumUDUnits ) |
|
296 { |
|
297 |
|
298 // Unpack first |
|
299 HBufC8* unpackedBuffer = HBufC8::NewLC( aNumUDUnits ); |
|
300 TPtr8 unpackedBufferPtr( unpackedBuffer->Des() ); |
|
301 UnpackL( aIn, unpackedBufferPtr,aNumUDUnits ); |
|
302 |
|
303 // Convert |
|
304 CSmsAlphabetConverter* converter = |
|
305 CSmsAlphabetConverter::NewLC( |
|
306 aCharacterSetConverter, aFs, iAlphabet, iIsBinary ); |
|
307 |
|
308 TPtrC convertedPtr = converter->ConvertToNativeL( *unpackedBuffer ); |
|
309 if ( convertedPtr.Length() > ( aOut.MaxLength() - aOut.Length() ) ) |
|
310 { |
|
311 User::Leave( KErrCorrupt ); |
|
312 } |
|
313 // Cleanup and return |
|
314 aOut.Append( convertedPtr ); |
|
315 CleanupStack::PopAndDestroy( 2 ); // unpackedBuffer, converter |
|
316 return aNumUDUnits; |
|
317 } |
|
318 |
|
319 |
|
320 // ----------------------------------------------------------------------------- |
|
321 // TPhSrvUssdAlphabetPacker::PackedOctetsRequiredL |
|
322 // Returns the number of octets needed to pack the specified number of |
|
323 // |
|
324 // ----------------------------------------------------------------------------- |
|
325 // |
|
326 TInt TPhSrvUssdAlphabetPacker::PackedOctetsRequiredL( TInt aNumUDUnits ) const |
|
327 |
|
328 { |
|
329 TInt octetsRequired = 0; |
|
330 TInt elementSizeInBits = ElementSizeInBitsL(); |
|
331 if ( elementSizeInBits == 8 ) |
|
332 { |
|
333 octetsRequired=aNumUDUnits; |
|
334 } |
|
335 else |
|
336 { |
|
337 octetsRequired = |
|
338 ( iStartBit+aNumUDUnits * elementSizeInBits + 7 ) / 8; // Rounds up |
|
339 } |
|
340 return octetsRequired; |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // TPhSrvUssdAlphabetPacker::ElementSizeInBitsL |
|
345 // Returns the size in bits of a UDL element for the alphabet. Leaves if |
|
346 // invalid data coding scheme. |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 TInt TPhSrvUssdAlphabetPacker::ElementSizeInBitsL() const |
|
350 { |
|
351 if (iIsBinary) |
|
352 return 8; |
|
353 switch ( iAlphabet ) |
|
354 { |
|
355 case TSmsDataCodingScheme::ESmsAlphabet7Bit: |
|
356 { |
|
357 return 7; |
|
358 } |
|
359 case TSmsDataCodingScheme::ESmsAlphabet8Bit: |
|
360 case TSmsDataCodingScheme::ESmsAlphabetUCS2: |
|
361 { |
|
362 return 8; |
|
363 } |
|
364 default: |
|
365 { |
|
366 User::Leave(KErrGsmSMSDataCodingSchemeNotSupported); |
|
367 return 8; |
|
368 } |
|
369 } |
|
370 } |
|
371 |
|
372 |
|
373 |
|
374 // ============================ MEMBER FUNCTIONS =============================== |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // CPhSrvUssdManager::CPhSrvUssdManager |
|
378 // |
|
379 // Constructor |
|
380 // |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 CPhSrvUssdManager::CPhSrvUssdManager( |
|
384 RFs& aFsSession, |
|
385 CPhSrvResourceManager& aResourceManager |
|
386 ) |
|
387 :CActive( EPriorityLow ), |
|
388 iFsSession( aFsSession ), |
|
389 iResourceManager( aResourceManager ), |
|
390 iDeviceDialog( NULL ), |
|
391 iDCS ( KPhCltDcsUnknown ), |
|
392 iReturnResultPckg ( iReturnResult ), |
|
393 iTextResolver ( EFalse ), |
|
394 iTextBuffer ( NULL ) |
|
395 { |
|
396 CActiveScheduler::Add( this ); |
|
397 } |
|
398 |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // CPhSrvUssdManager::~CPhSrvUssdManager |
|
402 // |
|
403 // Destructor |
|
404 // |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 CPhSrvUssdManager::~CPhSrvUssdManager() |
|
408 { |
|
409 _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" ); |
|
410 |
|
411 |
|
412 delete iUssdSendHandler; |
|
413 iUssdSendHandler = NULL; |
|
414 |
|
415 delete iUssdReceiveHandler; |
|
416 iUssdReceiveHandler = NULL; |
|
417 |
|
418 delete iUssdNotifyNWRelease; |
|
419 iUssdNotifyNWRelease = NULL; |
|
420 |
|
421 Cancel(); |
|
422 |
|
423 iTimer.Close(); |
|
424 |
|
425 delete iTextBuffer; |
|
426 iTextBuffer = NULL; |
|
427 |
|
428 delete iDeviceDialog; |
|
429 iDeviceDialog = NULL; |
|
430 |
|
431 if ( iNotifyArray ) |
|
432 { |
|
433 iNotifyArray->Reset(); |
|
434 } |
|
435 delete iNotifyArray; |
|
436 if ( iUssdReplyTimer ) |
|
437 { |
|
438 iUssdReplyTimer->Stop(); |
|
439 } |
|
440 delete iUssdReplyTimer; |
|
441 iUssdReplyTimer = NULL; |
|
442 |
|
443 iFsSession.Close(); |
|
444 |
|
445 iMobileUssdMessaging.Close(); |
|
446 |
|
447 delete iMoAckCallback; |
|
448 |
|
449 _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" ); |
|
450 } |
|
451 |
|
452 |
|
453 // ----------------------------------------------------------------------------- |
|
454 // CPhSrvUssdManager::ConstructL |
|
455 // |
|
456 // Symbian OS 2nd phase constructor |
|
457 // |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 void CPhSrvUssdManager::ConstructL( MPhSrvPhoneInterface& aPhoneInterface ) |
|
461 { |
|
462 _DPRINT( 4, "PhSrv.ConstructL.Start" ); |
|
463 iTextResolver = HbTextResolverSymbian::Init( |
|
464 KUssdLocFilename, KLocPath ); |
|
465 _DDPRINT( 4, "PhSrv.ConstructL.ussd loc:", iTextResolver ); |
|
466 User::LeaveIfError( iTimer.CreateLocal() ); |
|
467 |
|
468 User::LeaveIfError( iMobileUssdMessaging.Open( aPhoneInterface.PhSrvMobilePhone() ) ); |
|
469 |
|
470 // Check support |
|
471 RMobileUssdMessaging::TMobileUssdCapsV1 caps; |
|
472 RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps ); |
|
473 User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) ); |
|
474 |
|
475 if ( !( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMTUssd ) == 0 && |
|
476 ( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString ) == 0 ) ) |
|
477 { |
|
478 _DPRINT( 4, "PhSrv.CPhSrvUssdManager::ConstructL" ); |
|
479 iUssdReceiveHandler = new( ELeave ) CPhSrvUssdReceiveHandler( |
|
480 *this, |
|
481 iMobileUssdMessaging ); |
|
482 iUssdReceiveHandler->ConstructL(); |
|
483 |
|
484 iUssdNotifyNWRelease = new( ELeave ) CPhSrvUssdNotifyNWRelease( |
|
485 *this, |
|
486 iMobileUssdMessaging ); |
|
487 |
|
488 iUssdNotifyNWRelease->ConstructL(); |
|
489 } |
|
490 |
|
491 iPhoneInterface = &aPhoneInterface; |
|
492 |
|
493 SendHandlerL(); |
|
494 |
|
495 iMoAckCallback = new (ELeave) CAsyncCallBack( TCallBack( MoAckCallback, this ), CActive::EPriorityIdle ); |
|
496 |
|
497 iVariantReadOnlyValues = KPhSrvDefaultValue; |
|
498 |
|
499 User::LeaveIfError( GetTelephonyVariantData() ); |
|
500 |
|
501 _DDPRINT( 4, "PhSrv.ConstructL.iSatCanceled ", iSatCanceled ); |
|
502 _DDPRINT( 4, "PhSrv.ConstructL.iShowDone ", iShowDone ); |
|
503 iNotifyArray = new( ELeave ) CDesCArrayFlat( KPhrUssdNotifyArraySize ); |
|
504 _DPRINT( 4, "PhSrv.ConstructL.End" ); |
|
505 } |
|
506 |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // CPhSrvUssdManager::SendHandlerL |
|
510 // |
|
511 // The send handler. |
|
512 // |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 CPhSrvUssdSendHandler& CPhSrvUssdManager::SendHandlerL() |
|
516 { |
|
517 // If SendHandler is not created, first check that MO Ussd |
|
518 // is supported by the TSY. |
|
519 _DPRINT( 4, "PhSrv.SendHandlerL.Start" ); |
|
520 if ( iUssdSendHandler == NULL ) |
|
521 { |
|
522 _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" ); |
|
523 RMobileUssdMessaging::TMobileUssdCapsV1 caps; |
|
524 RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps ); |
|
525 User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) ); |
|
526 _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" ); |
|
527 |
|
528 if ( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMOUssd ) == 0 || |
|
529 ( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString ) |
|
530 == 0 ) |
|
531 { |
|
532 _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" ); |
|
533 User::Leave( KErrNotSupported ); |
|
534 } |
|
535 |
|
536 iUssdSendHandler = |
|
537 new( ELeave ) CPhSrvUssdSendHandler( |
|
538 *this, |
|
539 iMobileUssdMessaging, |
|
540 *iPhoneInterface ); |
|
541 } |
|
542 _DPRINT( 4, "PhSrv.SendHandlerL.End" ); |
|
543 return *iUssdSendHandler; |
|
544 } |
|
545 |
|
546 |
|
547 // ----------------------------------------------------------------------------- |
|
548 // CPhSrvUssdManager::SendUssdL |
|
549 // |
|
550 // Send the USSD message. |
|
551 // |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CPhSrvUssdManager::SendUssdL( |
|
555 const TDesC8& aMsgData, |
|
556 RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttribute, |
|
557 MPhSrvUssdMessageSentObserver& aObserver ) |
|
558 { |
|
559 _DPRINT( 4, "PhSrv.SendUssdL.Start ######" ); |
|
560 _DPRINT_FLAGS(); |
|
561 |
|
562 if ( iObserver && iNetworkReleased ) |
|
563 { |
|
564 // Network has been released but the previous send request is still alive. |
|
565 // Cancel the pervious send operation, complete the old request with error |
|
566 // and clean up the pointer. |
|
567 _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" ); |
|
568 if ( iUssdSendHandler ) |
|
569 { |
|
570 iUssdSendHandler->Cancel(); |
|
571 } |
|
572 iObserver->UssdMessageSentObserverHandleResult( KErrSessionClosed ); |
|
573 iObserver = NULL; |
|
574 } |
|
575 |
|
576 if ( iObserver || iSendingAck ) |
|
577 { |
|
578 _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" ); |
|
579 // Other client is using the service. |
|
580 User::Leave( KErrInUse ); |
|
581 } |
|
582 |
|
583 // Check that message type is set |
|
584 if( ( aMsgAttribute.iFlags & RMobileUssdMessaging::KUssdMessageType ) |
|
585 == 0 ) |
|
586 _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" ); |
|
587 { |
|
588 // Mesasge type not set -> Set it. |
|
589 aMsgAttribute.iFlags |= RMobileUssdMessaging::KUssdMessageType; |
|
590 if ( NetworkWaitingForAnAnswer() ) |
|
591 { |
|
592 // Network is waiting for an answer |
|
593 _DPRINT( 4, "PhSrv.SendUssdL.EUssdMOReply" ); // debug print |
|
594 aMsgAttribute.iType = RMobileUssdMessaging::EUssdMOReply; |
|
595 } |
|
596 else |
|
597 { |
|
598 _DPRINT( 4, "PhSrv.SendUssdL.EUssdMORequest" ); // debug print |
|
599 aMsgAttribute.iType = RMobileUssdMessaging::EUssdMORequest; |
|
600 } |
|
601 } |
|
602 |
|
603 RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs( aMsgAttribute ); |
|
604 iShowDone = ETrue; |
|
605 _DPRINT( 4, "PhSrv.SendUssdL.iShowDone.ETrue" ); |
|
606 _DPRINT( 4, "PhSrv.SendUssdL.Send" ); |
|
607 SendHandlerL().SendUssdL( aMsgData , attribs ); |
|
608 iObserver = &aObserver; |
|
609 // Not closing nor closed anymore |
|
610 iNetworkReleased = EFalse; |
|
611 iSendRelease = EFalse; |
|
612 iClearArray = EFalse; |
|
613 |
|
614 // Reply timer can be killed here... Receive event might come right after this |
|
615 // which will setup the timer again if needed. |
|
616 if ( NetworkWaitingForAnAnswer() ) |
|
617 { |
|
618 _DPRINT( 4, "PhSrv.SendUssdCancel.TimerStop" ); // debug print |
|
619 iUssdReplyTimer->Stop(); |
|
620 } |
|
621 _DPRINT( 4, "PhSrv.SendUssdL.End" ); |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // CPhSrvUssdManager::NetworkWaitingForAnAnswer |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 TBool CPhSrvUssdManager::NetworkWaitingForAnAnswer() |
|
629 { |
|
630 return iUssdReplyTimer && iUssdReplyTimer->IsTimerActive(); |
|
631 } |
|
632 // ----------------------------------------------------------------------------- |
|
633 // CPhSrvUssdManager::SendUssdCancel |
|
634 // |
|
635 // Cancel the USSD sending. |
|
636 // |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 void CPhSrvUssdManager::SendUssdCancel() |
|
640 { |
|
641 _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" ); |
|
642 |
|
643 // Ack sending should not be canceled unless it's about terminating |
|
644 // the whole session |
|
645 _DPRINT_FLAGS(); |
|
646 if ( !iSendingAck || iSendRelease ) |
|
647 { |
|
648 _DPRINT( 4, "PhSrv.SendUssdCancel.DoingCancel" ); |
|
649 iUssdSendHandler->SendUssdCancel(); |
|
650 } |
|
651 |
|
652 if ( iHavePendingSatMessagePointer ) |
|
653 { |
|
654 _DPRINT( 4, "PhSrv.SendUssdCancel.SatCancel" ); |
|
655 iSatCanceled = ETrue; |
|
656 } |
|
657 iObserver = NULL; |
|
658 |
|
659 SetActiveIfPendingNotificationsExist(); |
|
660 _DPRINT( 4, "PhSrv.SendUssdCancel.End" ); |
|
661 } |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // CPhSrvUssdManager::SetActiveIfPendingNotificationsExist |
|
665 // ----------------------------------------------------------------------------- |
|
666 // |
|
667 void CPhSrvUssdManager::SetActiveIfPendingNotificationsExist() |
|
668 { |
|
669 if ( !IsActive() && NotifyCount() > 0 ) |
|
670 { |
|
671 _DPRINT( 4, "PhSrv.AcrtivateIf.NotActiveSelf" ); |
|
672 iLaunchGMQ = ETrue; |
|
673 iNotifyMessage = ETrue; |
|
674 _DPRINT( 4, "PhSrv.SendUssdCancel.iNotifyMessage.ETrue" ); |
|
675 iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); |
|
676 SetActive(); |
|
677 _DPRINT_FLAGS(); |
|
678 _DDPRINT( 4, "PhSrv.AcrtivateIf.SetActive ", iStatus.Int() ); |
|
679 } |
|
680 } |
|
681 // ----------------------------------------------------------------------------- |
|
682 // CPhSrvUssdManager::UssdNetworkObserverHandleSendEventL |
|
683 // |
|
684 // |
|
685 // |
|
686 // ----------------------------------------------------------------------------- |
|
687 // |
|
688 void CPhSrvUssdManager::UssdNetworkObserverHandleSendEventL( TInt aError ) |
|
689 { |
|
690 // debug print |
|
691 _DDPRINT( |
|
692 4, |
|
693 "PhSrv.UssdNetworkObserverHandleSendEventL.Start: ##### ", |
|
694 aError ); |
|
695 |
|
696 // complete SAT if needed |
|
697 if ( aError < KErrNone ) |
|
698 { |
|
699 |
|
700 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.CompleteSat" ); |
|
701 CompleteSatL( NULL, aError ); |
|
702 } |
|
703 |
|
704 if ( iObserver ) |
|
705 { |
|
706 |
|
707 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.Observer" ); |
|
708 |
|
709 iObserver->UssdMessageSentObserverHandleResult( aError ); |
|
710 iObserver = NULL; |
|
711 } |
|
712 |
|
713 iSendingAck = EFalse; |
|
714 |
|
715 AsyncProcessMoAcks(); |
|
716 |
|
717 // debug print |
|
718 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.End" ); |
|
719 } |
|
720 |
|
721 |
|
722 // ----------------------------------------------------------------------------- |
|
723 // CPhSrvUssdManager::UssdAppTaskExists |
|
724 // |
|
725 // |
|
726 // |
|
727 // ----------------------------------------------------------------------------- |
|
728 // |
|
729 TBool CPhSrvUssdManager::UssdAppTaskExistsL() |
|
730 { |
|
731 TBool ret = EFalse; |
|
732 RWsSession wsSession; |
|
733 User::LeaveIfError(wsSession.Connect()); |
|
734 _DPRINT( 4, "PhSrv.UssdAppTaskExists.wsSession.Connect" ); |
|
735 CleanupClosePushL(wsSession); |
|
736 TApaTaskList tasklist(wsSession); |
|
737 TApaTask task = tasklist.FindApp( KUssdSecureId ); |
|
738 ret = task.Exists(); |
|
739 |
|
740 CleanupStack::PopAndDestroy(); |
|
741 return ret; |
|
742 } |
|
743 |
|
744 // ----------------------------------------------------------------------------- |
|
745 // CPhSrvUssdManager::UssdNetworkObserverHandleReceivedEventL |
|
746 // |
|
747 // |
|
748 // |
|
749 // ----------------------------------------------------------------------------- |
|
750 // |
|
751 void CPhSrvUssdManager::UssdNetworkObserverHandleReceivedEventL( |
|
752 const TDes8& aMsgData, |
|
753 const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes, |
|
754 TInt aError ) |
|
755 { |
|
756 _DDPRINT( |
|
757 4, |
|
758 "PhSrv.UssdNetworkObserverHandleReceivedEventL.Start: ### ", |
|
759 aError ); |
|
760 _DPRINT_FLAGS(); |
|
761 if ( aError != KErrNone ) |
|
762 { |
|
763 TurnLightsOn(); //Ensure lights on |
|
764 |
|
765 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.ShErNote" ); |
|
766 ShowErrorNoteL( aError ); |
|
767 } |
|
768 else if ( iSendRelease ) |
|
769 { |
|
770 // Ignore if sendrelease is to be done. If the message was |
|
771 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.SendRelease.Ignore" ); |
|
772 } |
|
773 else |
|
774 { |
|
775 UssdHandleReceivedEventL( aMsgData, aMsgAttributes ); |
|
776 } |
|
777 } |
|
778 |
|
779 // ----------------------------------------------------------------------------- |
|
780 // CPhSrvUssdManager::UssdHandleReceivedEventL |
|
781 // ----------------------------------------------------------------------------- |
|
782 // |
|
783 void CPhSrvUssdManager::UssdHandleReceivedEventL( |
|
784 const TDes8& aMsgData, |
|
785 const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes ) |
|
786 { |
|
787 // This always is either ongoing transaction or starting a new based |
|
788 // on incoming message, mark transaction to be open. |
|
789 iNetworkReleased = EFalse; |
|
790 |
|
791 // 2. Complete Send with some positive value. |
|
792 if ( iObserver ) |
|
793 { |
|
794 |
|
795 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Observer" ); |
|
796 UssdNetworkObserverHandleSendEventL( 1 ); // some positive value |
|
797 } |
|
798 |
|
799 if ( aMsgAttributes.iFlags&RMobileUssdMessaging::KUssdMessageType && |
|
800 aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest ) |
|
801 { |
|
802 // 3. Stop old reply timer and start new one if needed. |
|
803 RestartReplyTimerL(); |
|
804 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.Timer.Stop" ); |
|
805 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.Timer.New" ); |
|
806 } |
|
807 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Decode" ); |
|
808 TUint8 dcs = KPhSrvUssdDefaultDCS; |
|
809 if(aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageDcs) |
|
810 { |
|
811 dcs = aMsgAttributes.iDcs; |
|
812 } |
|
813 iDecodedMessage.Zero(); |
|
814 iReceivedMessage.Zero(); |
|
815 DecodeL(aMsgData, iDecodedMessage, dcs); |
|
816 if(iDecodedMessage.Length() > 0) |
|
817 { |
|
818 iReceivedMessage = iDecodedMessage; |
|
819 } |
|
820 // 5. Show note. |
|
821 // debug print |
|
822 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Note" ); |
|
823 if ( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType ) || |
|
824 aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest ) |
|
825 { |
|
826 if ( !ShowNotesL() ) |
|
827 { |
|
828 |
|
829 _DPRINT( 4, |
|
830 "PhSrv.UssdHandleReceivedEventL.SAtReturn" ); |
|
831 return; |
|
832 } |
|
833 } |
|
834 |
|
835 // empty string is handled as ok message |
|
836 if ( !iDecodedMessage.Length() ) |
|
837 { |
|
838 TurnLightsOn(); //Ensure lights on |
|
839 |
|
840 _DPRINT( 4, |
|
841 "PhSrv.UssdHandleReceivedEventL.EmptyString" ); |
|
842 |
|
843 ShowDoneNoteL(); |
|
844 |
|
845 |
|
846 _DPRINT( 4, |
|
847 "PhSrv.UssdHandleReceivedEventL.EmptyString.OK" ); |
|
848 } |
|
849 else |
|
850 { |
|
851 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.String" ); |
|
852 iNotifyMessage = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTNotify ); |
|
853 _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); |
|
854 _DDPRINT( 4, "PhSrv.UssdNOHREventL.iNotifyMessage: ", iNotifyMessage ); |
|
855 iMsgTypeReply = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTReply ); |
|
856 _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iMsgTypeReply: ", iMsgTypeReply ); |
|
857 |
|
858 if ( iNotifyMessage ) |
|
859 { |
|
860 // need to send an MO ack |
|
861 iAcksToBeSent ++; |
|
862 } |
|
863 |
|
864 if ( !iDeviceDialog ){ |
|
865 iDeviceDialog = CHbDeviceMessageBoxSymbian::NewL( |
|
866 CHbDeviceMessageBoxSymbian::EInformation ); |
|
867 iDeviceDialog->SetObserver( this ); |
|
868 iDeviceDialog->SetTimeout( KPhSrvUssdTimeout ); |
|
869 iDeviceDialog->SetDismissPolicy ( KPhSrvUssdPopupDismissPolicy ); |
|
870 |
|
871 // Show left key with empty string accoring to ui concept |
|
872 iDeviceDialog->SetButton( |
|
873 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); |
|
874 // Show Exit Key always |
|
875 iDeviceDialog->SetButton( |
|
876 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); |
|
877 iDeviceDialog->SetButtonTextL( |
|
878 CHbDeviceMessageBoxSymbian::ERejectButton, |
|
879 LoadDefaultString( KUssdExit ) ); |
|
880 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" ); |
|
881 } |
|
882 |
|
883 if ( iNotifyMessage || iMsgTypeReply ) |
|
884 { |
|
885 //This is for reply message in notifyarray |
|
886 iNotifyMessage = ETrue; |
|
887 _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); |
|
888 |
|
889 //Notify added to array |
|
890 iNotifyArray->AppendL( iReceivedMessage ); |
|
891 |
|
892 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" ); |
|
893 UpdateNotifyMessageL(); |
|
894 |
|
895 if ( !iSendRelease && NotifyCount() <= 1 ) |
|
896 { |
|
897 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" ); |
|
898 Cancel(); |
|
899 } |
|
900 } |
|
901 else |
|
902 { |
|
903 // New message deletes old message, i.e. Cancel existing query. |
|
904 Cancel(); |
|
905 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" ); |
|
906 } |
|
907 |
|
908 // Remove Reply key |
|
909 if( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType ) |
|
910 || aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest ) |
|
911 { |
|
912 // Remove Answer key |
|
913 iDeviceDialog->SetButton( |
|
914 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); |
|
915 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" ); |
|
916 } |
|
917 // Show Reply key |
|
918 else |
|
919 { |
|
920 iDeviceDialog->SetButton( |
|
921 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); |
|
922 iDeviceDialog->SetButtonTextL( |
|
923 CHbDeviceMessageBoxSymbian::EAcceptButton, |
|
924 LoadDefaultString( KUssdReply ) ); |
|
925 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" ); |
|
926 } |
|
927 |
|
928 |
|
929 _DPRINT( 4, |
|
930 "PhSrv.UssdHandleReceivedEventL.String.Middle" ); |
|
931 |
|
932 // Play the USSD tone if needed. Logically should be in RunL, but here |
|
933 // to give better balancing with voice and visible message. |
|
934 // <-- QT PHONE START--> |
|
935 /* |
|
936 if ( IsTelephonyFeatureSupported( KTelephonyLVFlagUssdTone ) ) |
|
937 { |
|
938 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" ); |
|
939 PlayUssdTone(); |
|
940 } |
|
941 */ |
|
942 // <-- QT PHONE END--> |
|
943 // Launch the new message query |
|
944 if ( !IsActive() ) |
|
945 { |
|
946 iLaunchGMQ = ETrue; |
|
947 iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); |
|
948 SetActive(); |
|
949 } |
|
950 AsyncProcessMoAcks(); |
|
951 } |
|
952 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Editor" ); |
|
953 if( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest && UssdAppTaskExistsL() ) |
|
954 { |
|
955 iEmptyEditor = ETrue; |
|
956 } |
|
957 _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.End" ); |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // CPhSrvUssdManager::RestartReplyTimerL |
|
962 // |
|
963 // |
|
964 // |
|
965 // ----------------------------------------------------------------------------- |
|
966 // |
|
967 void CPhSrvUssdManager::RestartReplyTimerL() |
|
968 { |
|
969 if ( iUssdReplyTimer ) |
|
970 { |
|
971 _DPRINT( 4, "PhSrv.RestartReplyTimerL.Stop" ); |
|
972 iUssdReplyTimer->Stop(); |
|
973 } |
|
974 |
|
975 if ( !iUssdReplyTimer ) |
|
976 { |
|
977 _DPRINT( 4, "PhSrv.RestartReplyTimerL.New" ); |
|
978 iUssdReplyTimer = CPhSrvUssdReplyTimer::NewL( *this ); |
|
979 } |
|
980 |
|
981 _DPRINT( 4, "PhSrv.RestartReplyTimerL.Start" ); |
|
982 iUssdReplyTimer->Start(); |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CPhSrvUssdManager::UssdNetworkObserverHandleNotifyNWReleaseL |
|
987 // |
|
988 // |
|
989 // |
|
990 // ----------------------------------------------------------------------------- |
|
991 // |
|
992 void CPhSrvUssdManager::UssdNetworkObserverHandleNotifyNWReleaseL( |
|
993 const RMobilePhone::TMobilePhoneSendSSRequestV3 & aReturnResult, |
|
994 TInt aError ) |
|
995 { |
|
996 _DDPRINT( 4, "PhSrv.UssdNotifyNWRelease ##### ", aError ); // debug print |
|
997 _DPRINT_FLAGS(); |
|
998 TBool showNotes = ShowNotesL(); |
|
999 iNetworkReleased = ETrue; |
|
1000 iSendingAck = EFalse; |
|
1001 iSendRelease = EFalse; |
|
1002 iAcksToBeSent = 0; |
|
1003 |
|
1004 if ( iHavePendingSatMessagePointer ) |
|
1005 { |
|
1006 iReturnResult = aReturnResult; |
|
1007 if ( !iSatCanceled ) |
|
1008 { |
|
1009 CompleteSatL(&iReceivedMessage, aError ); |
|
1010 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" ); |
|
1011 } |
|
1012 } |
|
1013 if ( iUssdReplyTimer && iUssdReplyTimer->IsTimerActive() ) |
|
1014 { |
|
1015 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Timer.Stop" ); |
|
1016 iUssdReplyTimer->Stop(); |
|
1017 Cancel(); |
|
1018 CheckArray(); |
|
1019 } |
|
1020 if ( showNotes && iShowDone ) |
|
1021 { |
|
1022 ShowDoneNoteL(); |
|
1023 } |
|
1024 if ( iUssdSendHandler && iSendingAck ) |
|
1025 { |
|
1026 // if we are sending ack, it can be canceled. |
|
1027 iUssdSendHandler->Cancel(); |
|
1028 } |
|
1029 |
|
1030 iSatCanceled = EFalse; |
|
1031 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.iSatCanceled.EFalse" ); |
|
1032 iShowDone = EFalse; |
|
1033 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Ending" ); |
|
1034 _DPRINT_FLAGS(); |
|
1035 _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.End" ); |
|
1036 } |
|
1037 |
|
1038 // ----------------------------------------------------------------------------- |
|
1039 // CPhSrvUssdManager::ShowDoneNoteL |
|
1040 // |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 // |
|
1043 void CPhSrvUssdManager::ShowDoneNoteL() |
|
1044 { |
|
1045 _DDPRINT( 4, "PhSrv.ShowDoneNoteL.iShowDone", iShowDone ); |
|
1046 // Show global confirmation note "Done" |
|
1047 CHbDeviceMessageBoxSymbian::InformationL( |
|
1048 LoadDefaultString( KUssdDone ) ); |
|
1049 iShowDone = EFalse; |
|
1050 } |
|
1051 |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // CPhSrvUssdManager::ShowErrorNoteL |
|
1054 // |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // |
|
1057 void CPhSrvUssdManager::ShowErrorNoteL( TInt aError ) |
|
1058 { |
|
1059 _DDPRINT( 4, "PhSrv.ShowErrorNoteL.Start ", aError ); |
|
1060 if ( aError == KErrCancel ) |
|
1061 { |
|
1062 _DPRINT( 4, "PhSrv.ShowErrorNoteL.Return" ); |
|
1063 return; |
|
1064 } |
|
1065 |
|
1066 // Show specific error message |
|
1067 CTextResolver* textResolver = CTextResolver::NewLC(); |
|
1068 HBufC* buffer = textResolver->ResolveErrorString( aError ).AllocLC(); |
|
1069 |
|
1070 CHbDeviceMessageBoxSymbian::InformationL( buffer ->Des() ); |
|
1071 |
|
1072 CleanupStack::PopAndDestroy( buffer ); |
|
1073 CleanupStack::PopAndDestroy( textResolver ); |
|
1074 |
|
1075 |
|
1076 _DPRINT( 4, "PhSrv.ShowErrorNoteL.End" ); |
|
1077 return; |
|
1078 } |
|
1079 |
|
1080 |
|
1081 // ----------------------------------------------------------------------------- |
|
1082 // CPhSrvUssdManager::DecodeL |
|
1083 // |
|
1084 // ----------------------------------------------------------------------------- |
|
1085 // |
|
1086 void CPhSrvUssdManager::DecodeL( |
|
1087 const TDesC8& aSrc, |
|
1088 TDes& aDes , |
|
1089 TUint8 aDcs ) |
|
1090 { |
|
1091 _DPRINT( 4, "PhSrv.DecodeL.Start" ); |
|
1092 aDes.Zero(); |
|
1093 CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC(); |
|
1094 |
|
1095 iDCS = KPhCltDcsUnknown; // default |
|
1096 |
|
1097 // Check DCS |
|
1098 TSmsDataCodingScheme::TSmsAlphabet alphabet = |
|
1099 TSmsDataCodingScheme::ESmsAlphabet7Bit; // default |
|
1100 TUint cutChars = 0; |
|
1101 TUint startBit = 0; |
|
1102 |
|
1103 // Codes from GSM 03.38 |
|
1104 if ( aDcs == KPhSrvUssdDcsAlphabetDefaultPrecededLanguage ) |
|
1105 { |
|
1106 FindFirstCarriageReturnL( aSrc , cutChars , startBit ); |
|
1107 } |
|
1108 else if ( aDcs == KPhSrvUssdDcsAlphabetUCS2PrecededLanguage ) |
|
1109 { |
|
1110 alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2; |
|
1111 cutChars = KPhSrvUssdDcsAlphabetUCS2PrecededLanguageSkipChars; |
|
1112 } |
|
1113 else if ( (aDcs&KPhSrvUssdDcsGeneralInformationMask) == |
|
1114 KPhSrvUssdDcsGeneralInformation ) // General data coding information |
|
1115 { |
|
1116 //Is text compressed? |
|
1117 if ( aDcs & KPhSrvUssdDcsGeneralInformationCompressed ) |
|
1118 { |
|
1119 _DPRINT( 4, "PhSrv.DecodeL.KErrNotSupported" ); |
|
1120 User::Leave( KErrNotSupported ); |
|
1121 } |
|
1122 // Is SIM specific message |
|
1123 else if ( ( aDcs & KPhSrvUssdDcsGeneralInformationSimMask ) |
|
1124 == KPhSrvUssdDcsGeneralInformationSim ) |
|
1125 { |
|
1126 _DPRINT( 4, "PhSrv.DecodeL.KErrAbort" ); |
|
1127 User::Leave( KErrAbort ); // Do not show any messages |
|
1128 } |
|
1129 // 8 bit data? |
|
1130 else if ( ( aDcs&KPhSrvUssdDcsGeneralInformationAlphabetMask ) == |
|
1131 KPhSrvUssdDcsGeneralInformationAlphabet8Bit ) |
|
1132 { |
|
1133 alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit; |
|
1134 } |
|
1135 // UCS2 bit data? |
|
1136 else if ( ( aDcs&KPhSrvUssdDcsGeneralInformationAlphabetMask ) == |
|
1137 KPhSrvUssdDcsGeneralInformationAlphabetUCS2 ) |
|
1138 { |
|
1139 alphabet = TSmsDataCodingScheme::ESmsAlphabetUCS2; |
|
1140 } |
|
1141 } |
|
1142 // Data coding/message handling |
|
1143 else if ( ( aDcs & KPhSrvUssdDcsMessageHandlingAlphabetMask ) |
|
1144 == KPhSrvUssdDcsMessageHandlingAlphabet8Bit ) |
|
1145 { |
|
1146 alphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit; |
|
1147 } |
|
1148 |
|
1149 TPhSrvUssdAlphabetPacker* packer = |
|
1150 new ( ELeave ) TPhSrvUssdAlphabetPacker( alphabet , EFalse, startBit ); |
|
1151 CleanupStack::PushL( packer ); |
|
1152 |
|
1153 if ( alphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit ) |
|
1154 { |
|
1155 TInt numberOfElem = ( ( aSrc.Length() - cutChars ) * 8 - startBit ) / 7; |
|
1156 packer->UnpackAndConvertL( |
|
1157 *charConv , |
|
1158 iFsSession , |
|
1159 aSrc.Right( aSrc.Length() - cutChars ), |
|
1160 aDes , |
|
1161 numberOfElem ); |
|
1162 |
|
1163 // DCS was 7-bit data. |
|
1164 iDCS = KPhCltDcs7Bit; |
|
1165 } |
|
1166 else // ESmsAlphabet8Bit || ESmsAlphabetUCS2 |
|
1167 { |
|
1168 CSmsAlphabetConverter* converter = |
|
1169 CSmsAlphabetConverter::NewLC( |
|
1170 *charConv , iFsSession,alphabet,EFalse ); |
|
1171 |
|
1172 aDes = converter->ConvertToNativeL( |
|
1173 aSrc.Right( aSrc.Length() - cutChars ) ); |
|
1174 CleanupStack::PopAndDestroy( converter ); |
|
1175 |
|
1176 if( alphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit ) |
|
1177 { |
|
1178 // DCS was 8-bit data. |
|
1179 iDCS = KPhCltDcs8Bit; |
|
1180 } |
|
1181 else if( alphabet == TSmsDataCodingScheme::ESmsAlphabetUCS2 ) |
|
1182 { |
|
1183 // DCS was UCS2 data. |
|
1184 iDCS = KPhCltDcsUcs2; |
|
1185 } |
|
1186 // If DCS not 8-bit or UCS2, then EPhCltDcsUnknown is returned. |
|
1187 } |
|
1188 |
|
1189 // |
|
1190 CleanupStack::PopAndDestroy(2); // packer, charConv |
|
1191 _DPRINT( 4, "PhSrv.DecodeL.End" ); |
|
1192 } |
|
1193 |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CPhSrvUssdManager::FindFirstCarriageReturnL |
|
1197 // ----------------------------------------------------------------------------- |
|
1198 // |
|
1199 void CPhSrvUssdManager::FindFirstCarriageReturnL( |
|
1200 const TDesC8& aBuffer , |
|
1201 TUint& aSkipChars , |
|
1202 TUint& aStartBit ) |
|
1203 { |
|
1204 _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.Start" ); |
|
1205 if ( aBuffer.Length() < 3 ) |
|
1206 { |
|
1207 _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.KErrUnderflow" ); |
|
1208 User::Leave( KErrUnderflow ); |
|
1209 } |
|
1210 |
|
1211 aSkipChars = 0; |
|
1212 aStartBit = 0; |
|
1213 |
|
1214 // Try out two different cases: |
|
1215 // 1. Find CR from thrid byte |
|
1216 // 2. Find CR from second byte, starting from bit 6 |
|
1217 |
|
1218 // 1.: |
|
1219 if ( aBuffer[2] == KPhSrvUssdCarriageReturn ) |
|
1220 { |
|
1221 aSkipChars = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars3; |
|
1222 aStartBit = 0; |
|
1223 _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.ThirdByte.Return" ); |
|
1224 return; |
|
1225 } |
|
1226 |
|
1227 // 2.: |
|
1228 // First put the pieces together and then compare |
|
1229 // Take last 2 bits from the second byte: |
|
1230 TUint result1 = aBuffer[1]; |
|
1231 result1 = result1 >> 6; |
|
1232 |
|
1233 // Take first 5 bits from the third byte: |
|
1234 TUint result2 = aBuffer[2]; |
|
1235 result2 = result2 & 0x1f; // bits 0-4. |
|
1236 result2 = result2 << 2; // move to bits 2-6. |
|
1237 |
|
1238 TUint result = result1 + result2; // 0000 00xx + 0xxx xx00 |
|
1239 if ( result == KPhSrvUssdCarriageReturn ) |
|
1240 { |
|
1241 aSkipChars = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageSkipChars2; |
|
1242 aStartBit = KPhSrvUssdDcsAlphabetDefaultPrecededLanguageStartBit; |
|
1243 _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.SecondByte.Return" ); |
|
1244 return; |
|
1245 } |
|
1246 |
|
1247 // Is was not case 1. or 2. so we are not supporting sort of string. |
|
1248 User::Leave( KErrNotSupported ); |
|
1249 _DPRINT( 4, "PhSrv.FindFirstCarriageReturnL.KErrNotSupported" ); |
|
1250 } |
|
1251 |
|
1252 |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // CPhSrvUssdManager::UssdReplyTimerObserverHandleExpired |
|
1255 // |
|
1256 // |
|
1257 // |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // |
|
1260 void CPhSrvUssdManager::UssdReplyTimerObserverHandleExpiredL( TInt aError ) |
|
1261 { |
|
1262 _DDPRINT( 4, "PhSrv.ReplyTimer.Start.aError ", aError ); // debug print |
|
1263 delete iUssdReplyTimer; |
|
1264 iUssdReplyTimer = NULL; |
|
1265 |
|
1266 if ( aError == KErrNone && |
|
1267 IsActive() && |
|
1268 iDeviceDialog ) |
|
1269 { |
|
1270 Cancel(); |
|
1271 // Terminates USSD session. |
|
1272 _DPRINT( 4, "PhSrv.ReplyTimer.SendRelease" ); // debug print |
|
1273 if ( iNotifyArray ) |
|
1274 { |
|
1275 iNotifyArray->Reset(); |
|
1276 } |
|
1277 TryCloseSession(); |
|
1278 } |
|
1279 _DPRINT( 4, "PhSrv.ReplyTimer.End" ); // debug print |
|
1280 } |
|
1281 |
|
1282 |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // CPhSrvUssdManager::MessageBoxClosed |
|
1285 // ----------------------------------------------------------------------------- |
|
1286 // |
|
1287 void CPhSrvUssdManager::MessageBoxClosed( |
|
1288 const CHbDeviceMessageBoxSymbian* aMessageBox, |
|
1289 CHbDeviceMessageBoxSymbian::TButtonId aButton) |
|
1290 { |
|
1291 _DPRINT( 4, "PhSrv.MsgClose.Start" ); |
|
1292 // ussd device dialog observer callback function |
|
1293 TPtrC leftBtn = aMessageBox->ButtonText( |
|
1294 CHbDeviceMessageBoxSymbian::EAcceptButton ); |
|
1295 TPtrC rightBtn = aMessageBox->ButtonText( |
|
1296 CHbDeviceMessageBoxSymbian::ERejectButton ); |
|
1297 |
|
1298 TInt err = KErrNone; |
|
1299 // Click Yes on Confirmation note (Yes, No) |
|
1300 if ( !leftBtn.Compare( |
|
1301 LoadDefaultString( KUssdYes ) ) && |
|
1302 ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) |
|
1303 { |
|
1304 _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" ); |
|
1305 iClearArray = EFalse; |
|
1306 iNotifyArray->Reset(); |
|
1307 TryCloseSession(); |
|
1308 } |
|
1309 // Click "No" on Confirmation note (Yes, No) |
|
1310 else if ( !rightBtn.Compare( |
|
1311 LoadDefaultString( KUssdNo ) ) && |
|
1312 ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) ) |
|
1313 { |
|
1314 _DPRINT( 4, "PhSrv.MsgClose.SK.No" ); |
|
1315 iClearArray = EFalse; |
|
1316 iNotifyMessage = ETrue; // for removing the yes/no query |
|
1317 CheckArray(); |
|
1318 TryCloseSession(); |
|
1319 } |
|
1320 // Click "Next" on Notification note (Next, Exit) |
|
1321 else if ( !leftBtn.Compare( |
|
1322 LoadDefaultString( KUssdNext ) ) && |
|
1323 ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) |
|
1324 { |
|
1325 _DPRINT( 4, "PhSrv.MsgClose.SK.Next" ); |
|
1326 CheckArray(); |
|
1327 TryCloseSession(); |
|
1328 } |
|
1329 // Click "Exit" on Notification note (Next, Exit or only Exit) |
|
1330 else if ( !rightBtn.Compare( |
|
1331 LoadDefaultString( KUssdExit ) ) && |
|
1332 ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) ) |
|
1333 { |
|
1334 TRAP( err, ClearArrayL() ); |
|
1335 _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err ); |
|
1336 TryCloseSession(); |
|
1337 _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" ); |
|
1338 } |
|
1339 // Click "Reply" on Message note (Reply, Exit) |
|
1340 else if ( !leftBtn.Compare( |
|
1341 LoadDefaultString( KUssdReply ) ) && |
|
1342 ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) |
|
1343 { |
|
1344 // Answer |
|
1345 iStartEditor = ETrue; |
|
1346 iShowDone = EFalse; |
|
1347 // Start the USSD editor now. |
|
1348 TRAP( err, RequestStartEditingL() ); |
|
1349 _DDPRINT( 4, "PhSrv.MsgClose.RequestStartEditingL.%d", err ); |
|
1350 } |
|
1351 else |
|
1352 { |
|
1353 _DPRINT( 4, "PhSrv.MsgClose.SK.Default" ); |
|
1354 } |
|
1355 |
|
1356 _DPRINT( 4, "PhSrv.MsgClose.End" ); |
|
1357 } |
|
1358 |
|
1359 // ----------------------------------------------------------------------------- |
|
1360 // CPhSrvUssdManager::RunL |
|
1361 // ----------------------------------------------------------------------------- |
|
1362 // |
|
1363 void CPhSrvUssdManager::RunL() |
|
1364 { |
|
1365 _DPRINT( 4, "PhSrv.RunL.Start" ); |
|
1366 |
|
1367 ProcessMoAcksL(); |
|
1368 |
|
1369 if ( iLaunchGMQ ) |
|
1370 { |
|
1371 LaunchGlobalMessageQueryL(); |
|
1372 // Do not launch Global Message Query next time. |
|
1373 iLaunchGMQ = EFalse; |
|
1374 _DPRINT( 4, "PhSrv.iLaunchGMQ.EFalse" ); |
|
1375 } |
|
1376 else |
|
1377 { |
|
1378 iStartEditor = EFalse; |
|
1379 // update device dialog |
|
1380 _DPRINT( 4, "PhSrv.RunL.End" ); // debug print |
|
1381 } |
|
1382 } |
|
1383 |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // CPhSrvUssdManager::LaunchGlobalMessageQueryL |
|
1386 // ----------------------------------------------------------------------------- |
|
1387 // |
|
1388 void CPhSrvUssdManager::LaunchGlobalMessageQueryL() |
|
1389 { |
|
1390 _DPRINT( 4, "PhSrv.LGMQ.start" ); |
|
1391 _DPRINT_FLAGS(); |
|
1392 |
|
1393 if ( iNotifyMessage ) |
|
1394 { |
|
1395 _DDPRINT( 4, "PhSrv.LGMQ.NotifyMessage", iNotifyMessage ); |
|
1396 iNotifyMessage = ETrue; |
|
1397 TInt count = NotifyCount(); |
|
1398 //check softkey in avkon.rss |
|
1399 if ( count > 1 ) |
|
1400 { |
|
1401 // Next, Exit |
|
1402 iDeviceDialog->SetButton( |
|
1403 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); |
|
1404 iDeviceDialog->SetButtonTextL( |
|
1405 CHbDeviceMessageBoxSymbian::EAcceptButton, |
|
1406 LoadDefaultString( KUssdNext ) ); |
|
1407 iDeviceDialog->SetButton( |
|
1408 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); |
|
1409 iDeviceDialog->SetButtonTextL( |
|
1410 CHbDeviceMessageBoxSymbian::ERejectButton, |
|
1411 LoadDefaultString( KUssdExit ) ); |
|
1412 _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" ); |
|
1413 } |
|
1414 else |
|
1415 { |
|
1416 // Only Exit |
|
1417 iDeviceDialog->SetButton( |
|
1418 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); |
|
1419 iDeviceDialog->SetButton( |
|
1420 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); |
|
1421 iDeviceDialog->SetButtonTextL( |
|
1422 CHbDeviceMessageBoxSymbian::ERejectButton, |
|
1423 LoadDefaultString( KUssdExit ) ); |
|
1424 _DPRINT( 4, "PhSrv.LGMQ.onlyExit" ); |
|
1425 } |
|
1426 if ( iClearArray ) |
|
1427 { |
|
1428 iTextResolver = HbTextResolverSymbian::Init( |
|
1429 KCommonLocFilename, KLocPath ); |
|
1430 _DPRINT( 4, "PhSrv.LGMQ.use common loc file" ); |
|
1431 // Yes, No |
|
1432 iDeviceDialog->SetButton( |
|
1433 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); |
|
1434 iDeviceDialog->SetButtonTextL( |
|
1435 CHbDeviceMessageBoxSymbian::EAcceptButton, |
|
1436 LoadDefaultString( KUssdYes ) ); |
|
1437 iDeviceDialog->SetButton( |
|
1438 CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); |
|
1439 iDeviceDialog->SetButtonTextL( |
|
1440 CHbDeviceMessageBoxSymbian::ERejectButton, |
|
1441 LoadDefaultString( KUssdNo ) ); |
|
1442 _DPRINT( 4, "PhSrv.LGMQ.Yes&No" ); |
|
1443 iTextResolver = HbTextResolverSymbian::Init( |
|
1444 KUssdLocFilename, KLocPath ); |
|
1445 _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" ); |
|
1446 } |
|
1447 iReceivedMessage.Zero(); |
|
1448 iReceivedMessage = (*iNotifyArray)[0]; |
|
1449 } |
|
1450 TurnLightsOn(); //Ensure lights on |
|
1451 |
|
1452 _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery" ); // debug print |
|
1453 // Launch Global MessageQuery as requested. |
|
1454 // Dialog not support header text, this code is only |
|
1455 // for testing, not final solution. |
|
1456 TInt receiveLength = iReceivedMessage.Length(); |
|
1457 _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.MsgLength", receiveLength ); |
|
1458 |
|
1459 TInt titleLength = LoadDefaultString( KUssdTitle ).Length(); |
|
1460 _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TilteLength", titleLength ); |
|
1461 |
|
1462 TInt length = receiveLength + titleLength; |
|
1463 _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TotalLength", length ); |
|
1464 |
|
1465 HBufC* titleAndText = HBufC::NewLC( length ); |
|
1466 titleAndText->Des().Append( LoadDefaultString( KUssdTitle ) ); |
|
1467 titleAndText->Des().Append( iReceivedMessage ); |
|
1468 iDeviceDialog->SetTextL( titleAndText->Des() ); |
|
1469 CleanupStack::Pop( titleAndText ); |
|
1470 |
|
1471 iDeviceDialog->Close(); |
|
1472 iDeviceDialog->ShowL(); |
|
1473 iShowDone = EFalse; |
|
1474 |
|
1475 // Do nothing else in RunL this time. |
|
1476 _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.ret" ); // debug print |
|
1477 } |
|
1478 |
|
1479 // ----------------------------------------------------------------------------- |
|
1480 // CPhSrvUssdManager::ProcessMoAcksL() |
|
1481 // ----------------------------------------------------------------------------- |
|
1482 // |
|
1483 void CPhSrvUssdManager::ProcessMoAcksL() |
|
1484 { |
|
1485 //Acknowledgment is sent if notify message |
|
1486 if ( iNotifyMessage && iAcksToBeSent ) |
|
1487 { |
|
1488 _DPRINT( 4, "PhSrv.LGMQ.SendMoAcknowledgementL, start" ); |
|
1489 _DPRINT_FLAGS(); |
|
1490 if ( iUssdSendHandler && !iUssdSendHandler->IsActive() && |
|
1491 !iNetworkReleased && !iSendRelease && !iSendingAck ) |
|
1492 { |
|
1493 _DPRINT( 4, "PhSrv.LGMQ.MoAckNeededToBeSent" ); |
|
1494 SendMoAcknowledgementL(); |
|
1495 iAcksToBeSent--; |
|
1496 iSendingAck = ETrue; |
|
1497 } |
|
1498 _DPRINT( 4, "PhSrv.LGMQ.SendMoAcknowledgementL, end" ); |
|
1499 } |
|
1500 } |
|
1501 |
|
1502 // ----------------------------------------------------------------------------- |
|
1503 // CPhSrvUssdManager::AsyncProcessMoAcks() |
|
1504 // ----------------------------------------------------------------------------- |
|
1505 // |
|
1506 void CPhSrvUssdManager::AsyncProcessMoAcks() |
|
1507 { |
|
1508 if ( iMoAckCallback ) |
|
1509 { |
|
1510 iMoAckCallback->CallBack(); |
|
1511 _DPRINT( 4, "PhSrv.LGMQ.AsyncProcessMoAcksL, queued" ); |
|
1512 } |
|
1513 } |
|
1514 // ----------------------------------------------------------------------------- |
|
1515 // CPhSrvUssdManager::MoAckCallback() |
|
1516 // ----------------------------------------------------------------------------- |
|
1517 // |
|
1518 TInt CPhSrvUssdManager::MoAckCallback( TAny *aUssdManager ) |
|
1519 { |
|
1520 _DPRINT( 4, "PhSrv.MoAckCallback.start" ); |
|
1521 if ( aUssdManager ) |
|
1522 { |
|
1523 CPhSrvUssdManager* manager = static_cast<CPhSrvUssdManager*>( aUssdManager ); |
|
1524 TRAP_IGNORE( manager->ProcessMoAcksL() ); |
|
1525 } |
|
1526 _DPRINT( 4, "PhSrv.MoAckCallback.end" ); |
|
1527 return ETrue; |
|
1528 } |
|
1529 |
|
1530 // ----------------------------------------------------------------------------- |
|
1531 // CPhSrvUssdManager::TryCloseSession() |
|
1532 // ----------------------------------------------------------------------------- |
|
1533 // |
|
1534 void CPhSrvUssdManager::TryCloseSession() |
|
1535 { |
|
1536 // Dismiss, cancel the session. |
|
1537 _DPRINT( 4, "PhSrv.CheckAndCloseSession.close" ); // debug print |
|
1538 |
|
1539 iShowDone = EFalse; |
|
1540 iEmptyEditor = EFalse; |
|
1541 |
|
1542 // If the notification array is empty, close the session. |
|
1543 if ( NotifyCount() == 0 && !iNetworkReleased ) |
|
1544 { |
|
1545 CloseSession(); |
|
1546 } |
|
1547 } |
|
1548 // ----------------------------------------------------------------------------- |
|
1549 // CPhSrvUssdManager::CloseSession() |
|
1550 // ----------------------------------------------------------------------------- |
|
1551 // |
|
1552 void CPhSrvUssdManager::CloseSession() |
|
1553 { |
|
1554 iSendRelease = ETrue; |
|
1555 iClearArray = EFalse; |
|
1556 iAcksToBeSent = 0; |
|
1557 _DPRINT( 4, "PhSrv.CheckAndCloseSession.canceling" ); |
|
1558 SendUssdCancel(); |
|
1559 Cancel(); |
|
1560 |
|
1561 // Terminates USSD session. |
|
1562 if ( !iNetworkReleased ) |
|
1563 { |
|
1564 iUssdSendHandler->SendReleaseSession(); |
|
1565 } |
|
1566 if ( iUssdReplyTimer ) |
|
1567 { |
|
1568 _DPRINT( 4, "PhSrv.CheckAndCloseSession.Timer.Stop" ); |
|
1569 iUssdReplyTimer->Stop(); |
|
1570 } |
|
1571 } |
|
1572 |
|
1573 // ----------------------------------------------------------------------------- |
|
1574 // CPhSrvUssdManager::CheckArray() |
|
1575 // ----------------------------------------------------------------------------- |
|
1576 // |
|
1577 void CPhSrvUssdManager::CheckArray() |
|
1578 { |
|
1579 _DPRINT( 4, "PhSrv.CheckArray.Start" ); // debug print |
|
1580 if (iNotifyArray && NotifyCount() > 0) |
|
1581 { |
|
1582 if ( !iNotifyMessage && !iClearArray ) |
|
1583 { |
|
1584 iLaunchGMQ = ETrue; |
|
1585 iNotifyMessage = ETrue; |
|
1586 _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); |
|
1587 iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); |
|
1588 _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NoNotifyMessage ", iStatus.Int() ); |
|
1589 SetActive(); |
|
1590 } |
|
1591 else if( NotifyCount() > 1 ) |
|
1592 { |
|
1593 ( iNotifyArray )->Delete( 0 ); |
|
1594 ( iNotifyArray )->Compress(); |
|
1595 iLaunchGMQ = ETrue; |
|
1596 iNotifyMessage = ETrue; |
|
1597 _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); |
|
1598 iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); |
|
1599 _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NotifyCount>1 ", iStatus.Int() ); |
|
1600 SetActive(); |
|
1601 } |
|
1602 else |
|
1603 { |
|
1604 iNotifyArray->Reset(); |
|
1605 iNotifyMessage = EFalse; |
|
1606 _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.EFalse" ); |
|
1607 } |
|
1608 } |
|
1609 _DPRINT_FLAGS(); |
|
1610 _DPRINT( 4, "PhSrv.CheckArray.End" ); // debug print |
|
1611 } |
|
1612 |
|
1613 // ----------------------------------------------------------------------------- |
|
1614 // CPhSrvUssdManager::ClearArray() |
|
1615 // ----------------------------------------------------------------------------- |
|
1616 // |
|
1617 void CPhSrvUssdManager::ClearArrayL() |
|
1618 { |
|
1619 _DPRINT( 4, "PhSrv.ClearArrayL.Start" ); // debug print |
|
1620 if (iNotifyArray && NotifyCount() > 0) |
|
1621 { |
|
1622 if (iNotifyMessage && NotifyCount()== 1 ) |
|
1623 { |
|
1624 iNotifyArray->Reset(); |
|
1625 } |
|
1626 else |
|
1627 { |
|
1628 iReceivedMessage.Zero(); |
|
1629 iReceivedMessage.Append( |
|
1630 LoadDefaultString( KUssdConfirm ) ); |
|
1631 iNotifyArray->InsertL( 0, iReceivedMessage ); |
|
1632 iLaunchGMQ = ETrue; |
|
1633 iNotifyMessage = ETrue; |
|
1634 _DPRINT( 4, "PhSrv.ClearArrayL.iNotifyMessage.ETrue" ); |
|
1635 iClearArray = ETrue; |
|
1636 iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); |
|
1637 _DDPRINT( 4, "PhSrv.ClearArrayL.iTimer ", iStatus.Int() ); |
|
1638 SetActive(); |
|
1639 } |
|
1640 } |
|
1641 _DPRINT_FLAGS(); |
|
1642 _DPRINT( 4, "PhSrv.ClearArrayL.End" ); // debug print |
|
1643 } |
|
1644 |
|
1645 // ----------------------------------------------------------------------------- |
|
1646 // CPhSrvUssdManager::NotifyCount() |
|
1647 // ----------------------------------------------------------------------------- |
|
1648 // |
|
1649 TInt CPhSrvUssdManager:: NotifyCount() |
|
1650 { |
|
1651 TInt count = iNotifyArray->Count(); |
|
1652 _DDPRINT( 4, "PhSrv.NotifyCount:", count ); // debug print |
|
1653 return count; |
|
1654 } |
|
1655 |
|
1656 // ----------------------------------------------------------------------------- |
|
1657 // CPhSrvUssdManager::UpdateNotifyMessageL() |
|
1658 // ----------------------------------------------------------------------------- |
|
1659 // |
|
1660 void CPhSrvUssdManager:: UpdateNotifyMessageL() |
|
1661 { |
|
1662 _DDPRINT( 4, "PhSrv.UpdateNotifyMessageL.Start, clear: ", iClearArray ); // debug print |
|
1663 |
|
1664 // Show left softkey - "Next" |
|
1665 if (NotifyCount() > 1 && !iClearArray ) |
|
1666 { |
|
1667 _DPRINT( 4, "PhSrv.UpdateNotifyMessageL" ); // debug print |
|
1668 iDeviceDialog->SetButton( |
|
1669 CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); |
|
1670 iDeviceDialog->SetButtonTextL( |
|
1671 CHbDeviceMessageBoxSymbian::EAcceptButton, |
|
1672 LoadDefaultString( KUssdNext ) ); |
|
1673 } |
|
1674 // Remove left softkey |
|
1675 else |
|
1676 { |
|
1677 iDeviceDialog->SetButton( |
|
1678 CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); |
|
1679 } |
|
1680 iDeviceDialog->UpdateL(); |
|
1681 |
|
1682 _DPRINT( 4, "PhSrv.UpdateNotifyMessageL.End" ); // debug print |
|
1683 } |
|
1684 |
|
1685 // ----------------------------------------------------------------------------- |
|
1686 // CPhSrvUssdManager::DoCancel |
|
1687 // ----------------------------------------------------------------------------- |
|
1688 // |
|
1689 void CPhSrvUssdManager::DoCancel() |
|
1690 { |
|
1691 _DPRINT( 4, "PhSrv.DoCancel.Start" ); // debug print |
|
1692 iTimer.Cancel(); |
|
1693 iLaunchGMQ = EFalse; |
|
1694 if ( iDeviceDialog ) |
|
1695 { |
|
1696 _DPRINT( 4, "PhSrv.DoCancel" ); // debug print |
|
1697 iDeviceDialog->Close(); |
|
1698 delete iDeviceDialog; |
|
1699 iDeviceDialog = NULL; |
|
1700 } |
|
1701 _DPRINT( 4, "PhSrv.DoCancel.End" ); // debug print |
|
1702 } |
|
1703 |
|
1704 // ----------------------------------------------------------------------------- |
|
1705 // CPhSrvUssdManager::RunError |
|
1706 // |
|
1707 // Because the RunL can leave, this function exists. |
|
1708 // In case of error, just returning KErrNone is OK. |
|
1709 // ----------------------------------------------------------------------------- |
|
1710 // |
|
1711 TInt CPhSrvUssdManager::RunError( TInt /*aError*/ ) |
|
1712 { |
|
1713 _DPRINT( 4, "PhSrv.RunError.Start" ); // debug print |
|
1714 return KErrNone; |
|
1715 } |
|
1716 |
|
1717 // ----------------------------------------------------------------------------- |
|
1718 // CPhSrvUssdManager::RequestStartEditingL |
|
1719 // ----------------------------------------------------------------------------- |
|
1720 // |
|
1721 void CPhSrvUssdManager::RequestStartEditingL() |
|
1722 { |
|
1723 _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.start" ); // debug print |
|
1724 |
|
1725 RWsSession wsSession; |
|
1726 User::LeaveIfError( wsSession.Connect() ); |
|
1727 _DPRINT( 4, "PhSrv.RequestStartEditingL.wsSession.connect" ); // debug print |
|
1728 CleanupClosePushL( wsSession ); |
|
1729 |
|
1730 // Find the task with name |
|
1731 TApaTaskList tasklist( wsSession ); |
|
1732 TApaTask task = tasklist.FindApp( KUssdSecureId ); |
|
1733 |
|
1734 // If task exists, bring it to foreground |
|
1735 if ( task.Exists() ) |
|
1736 { |
|
1737 _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" ); |
|
1738 task.BringToForeground(); |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 // Start new app |
|
1743 RApaLsSession apaLsSession; |
|
1744 User::LeaveIfError( apaLsSession.Connect() ); |
|
1745 _DPRINT( 4, "PhSrv.RequestStartEditingL.apaLsSession.connect" ); // debug print |
|
1746 CleanupClosePushL( apaLsSession ); |
|
1747 |
|
1748 TApaAppInfo appInfo; |
|
1749 |
|
1750 TInt err = apaLsSession.GetAppInfo( appInfo, KUssdSecureId ); |
|
1751 _DDPRINT( 4, "PhSrv.RequestStartEditingL.GetAppInfo ", err ); // debug print |
|
1752 |
|
1753 if ( err == KErrNone ) |
|
1754 { |
|
1755 #ifndef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1 |
|
1756 CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); |
|
1757 apaCommandLine->SetExecutableNameL( appInfo.iFullName ); |
|
1758 #else // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1 |
|
1759 CApaCommandLine* apaCommandLine = |
|
1760 CApaCommandLine::NewLC( appInfo.iFullName ); |
|
1761 #endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1 |
|
1762 |
|
1763 TThreadId id( static_cast<TInt64>( 0 ) ); |
|
1764 err = apaLsSession.StartApp( *apaCommandLine, id ); |
|
1765 _DDPRINT( 4, "PhSrv.RequestStartEditingL.ThreadId ", id ); |
|
1766 CleanupStack::PopAndDestroy( apaCommandLine ); |
|
1767 } |
|
1768 CleanupStack::PopAndDestroy( &apaLsSession ); // apaLsSession |
|
1769 |
|
1770 // bring the ussd editor to foreground, only for testing |
|
1771 TApaTaskList tasklist( wsSession ); |
|
1772 TApaTask task = tasklist.FindApp( KUssdSecureId ); |
|
1773 if ( task.Exists() ) |
|
1774 { |
|
1775 _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" ); |
|
1776 task.BringToForeground(); |
|
1777 } |
|
1778 // bring the ussd editor to foreground, only for testing |
|
1779 } |
|
1780 CleanupStack::PopAndDestroy(); // wsSession |
|
1781 |
|
1782 _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.end" ); // debug print |
|
1783 } |
|
1784 |
|
1785 |
|
1786 // ----------------------------------------------------------------------------- |
|
1787 // CPhSrvUssdManager::InformUssdApplicationStarting |
|
1788 // ----------------------------------------------------------------------------- |
|
1789 // |
|
1790 void CPhSrvUssdManager::InformUssdApplicationStarting() |
|
1791 { |
|
1792 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppStarting.start" ); // debug print |
|
1793 if ( iUssdReplyTimer ) |
|
1794 { |
|
1795 _DPRINT( 4, "PhSrv.InformUssdApplicationStarting.iUssdReplyTimer" ); |
|
1796 if ( iUssdReplyTimer->IsTimerActive() ) |
|
1797 { |
|
1798 _DPRINT( 4, "PhSrv.InformUssdApplicationStarting.iUssdReplyTimer.active" ); |
|
1799 iUssdReplyTimer->Pause(); |
|
1800 } |
|
1801 } |
|
1802 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppStarting.end" ); // debug print |
|
1803 } |
|
1804 |
|
1805 // ----------------------------------------------------------------------------- |
|
1806 // CPhSrvUssdManager::InformUssdApplicationTerminatingL |
|
1807 // ----------------------------------------------------------------------------- |
|
1808 // |
|
1809 void CPhSrvUssdManager::InformUssdApplicationTerminatingL( |
|
1810 const RMessage2& aMessage ) |
|
1811 { |
|
1812 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.start" ); // debug print |
|
1813 if ( iUssdReplyTimer ) |
|
1814 { |
|
1815 if ( iUssdReplyTimer->IsTimerActive() ) |
|
1816 { |
|
1817 |
|
1818 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer" ); |
|
1819 |
|
1820 // Read the information what is the reason |
|
1821 // for application termination. |
|
1822 TPhCltUssdAppExitReason exitReason = EPhCltExitReasonUnknown; |
|
1823 TPckg< TPhCltUssdAppExitReason > exitReasonPckg( exitReason ); |
|
1824 aMessage.ReadL( |
|
1825 0, |
|
1826 exitReasonPckg ); |
|
1827 |
|
1828 |
|
1829 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer2" ); |
|
1830 |
|
1831 // If reason was the completion of send operation, the USSD |
|
1832 // session is not canceled, otherwise it is canceled. |
|
1833 if ( exitReason != EPhCltSendCompleted ) |
|
1834 { |
|
1835 |
|
1836 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.SendRelease" ); |
|
1837 CloseSession(); |
|
1838 } |
|
1839 } |
|
1840 } |
|
1841 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.end" ); // debug print |
|
1842 } |
|
1843 |
|
1844 |
|
1845 // ----------------------------------------------------------------------------- |
|
1846 // CPhSrvUssdManager::InformUssdApplicationToForeground |
|
1847 // ----------------------------------------------------------------------------- |
|
1848 // |
|
1849 TInt CPhSrvUssdManager::InformUssdApplicationToForeground() |
|
1850 { |
|
1851 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.start" ); // debug print |
|
1852 |
|
1853 // Do the same actions as in InformUssdApplicationStarting, |
|
1854 // that is why it is called. |
|
1855 InformUssdApplicationStarting(); |
|
1856 |
|
1857 if ( iEmptyEditor ) |
|
1858 { |
|
1859 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.empty" ); // debug print |
|
1860 iEmptyEditor = EFalse; |
|
1861 return 1; // some positive number |
|
1862 } |
|
1863 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToForeground.end" ); // debug print |
|
1864 return KErrNone; |
|
1865 } |
|
1866 |
|
1867 |
|
1868 // ----------------------------------------------------------------------------- |
|
1869 // CPhSrvUssdManager::InformUssdApplicationToBackground |
|
1870 // ----------------------------------------------------------------------------- |
|
1871 // |
|
1872 void CPhSrvUssdManager::InformUssdApplicationToBackground() |
|
1873 { |
|
1874 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.start" ); // debug print |
|
1875 if ( iUssdReplyTimer ) |
|
1876 { |
|
1877 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.timer" ); // debug print |
|
1878 if ( iUssdReplyTimer->IsTimerActive() ) |
|
1879 { |
|
1880 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.timer.Active" ); // debug print |
|
1881 iUssdReplyTimer->Continue(); |
|
1882 } |
|
1883 } |
|
1884 _DPRINT( 4, "PhSrv.UssdM.InfUssdAppToBackground.end" ); // debug print |
|
1885 } |
|
1886 |
|
1887 |
|
1888 // ----------------------------------------------------------------------------- |
|
1889 // CPhSrvUssdManager::InformStartSAT |
|
1890 // ----------------------------------------------------------------------------- |
|
1891 // |
|
1892 void CPhSrvUssdManager::InformStartSAT( const RMessage2& aSatMessage ) |
|
1893 { |
|
1894 _DPRINT( 4, "PhSrv.InformStartSAT.Start" ); // debug print |
|
1895 |
|
1896 if ( iHavePendingSatMessagePointer ) |
|
1897 { |
|
1898 _DPRINT( 4, "PhSrv.InformStartSAT.Complete.InUse" ); // debug print |
|
1899 aSatMessage.Complete( KErrInUse ); |
|
1900 } |
|
1901 else |
|
1902 { |
|
1903 _DPRINT( 4, "PhSrv.InformStartSAT.Set" ); |
|
1904 |
|
1905 // There was not pending SAT message |
|
1906 iHavePendingSatMessagePointer = ETrue; |
|
1907 _DDPRINT( 4, "PhSrv.UssdM.InformStartSAT.PendingSatPointer ", iHavePendingSatMessagePointer ); |
|
1908 iPendingSatMessagePointer = aSatMessage; |
|
1909 } |
|
1910 |
|
1911 _DPRINT( 4, "PhSrv.InformStartSAT.End" ); // debug print |
|
1912 } |
|
1913 |
|
1914 |
|
1915 // ----------------------------------------------------------------------------- |
|
1916 // CPhSrvUssdManager::InformStopSAT |
|
1917 // ----------------------------------------------------------------------------- |
|
1918 // |
|
1919 void CPhSrvUssdManager::InformStopSAT() |
|
1920 { |
|
1921 _DPRINT( 4, "PhSrv.InformStopSAT.Start" ); |
|
1922 |
|
1923 // Do the actions only if there is pending SAT message. |
|
1924 if ( iHavePendingSatMessagePointer ) |
|
1925 { |
|
1926 _DPRINT( 4, "PhSrv.InformStopSAT.Complete.Cancel" ); // debug print |
|
1927 if ( !iPendingSatMessagePointer.IsNull() ) |
|
1928 { |
|
1929 iPendingSatMessagePointer.Complete( KErrCancel ); |
|
1930 _DPRINT( 4, "PhSrv.InformStopSAT.Complete.KErrCancel" ); |
|
1931 } |
|
1932 iHavePendingSatMessagePointer = EFalse; |
|
1933 } |
|
1934 _DPRINT( 4, "PhSrv.InformStopSAT.End" ); |
|
1935 } |
|
1936 |
|
1937 // ----------------------------------------------------------------------------- |
|
1938 // CPhSrvUssdManager::ShowNotes |
|
1939 // ----------------------------------------------------------------------------- |
|
1940 // |
|
1941 |
|
1942 |
|
1943 TBool CPhSrvUssdManager::ShowNotesL() |
|
1944 { |
|
1945 _DPRINT( 4, "PhSrv.ShowNotesL.Start" ); |
|
1946 |
|
1947 if ( !iHavePendingSatMessagePointer ) |
|
1948 { |
|
1949 if ( iSatCanceled ) |
|
1950 { |
|
1951 _DPRINT( 4, "PhSrv.ShowNotesL, EFalse" ); // debug print |
|
1952 return EFalse; |
|
1953 } |
|
1954 else |
|
1955 { |
|
1956 _DPRINT( 4, "PhSrv.ShowNotesL, ETrue" ); // debug print |
|
1957 return ETrue; |
|
1958 } |
|
1959 } |
|
1960 // Read the information whether the notes are shown or not. |
|
1961 TUint notesShown = 0; |
|
1962 TPckg< TUint > noShPckg( notesShown ); |
|
1963 iPendingSatMessagePointer.ReadL( |
|
1964 0, |
|
1965 noShPckg ); |
|
1966 |
|
1967 TBool showNotes = EFalse; |
|
1968 _DPRINT( 4, "PhSrv.ShowNotes Sat= EFalse" ); // debug print |
|
1969 if ( notesShown == KPhCltShowNotes ) |
|
1970 { |
|
1971 _DPRINT( 4, "PhSrv.ShowNotes Sat= ETrue" ); // debug print |
|
1972 showNotes = ETrue; |
|
1973 } |
|
1974 _DPRINT( 4, "PhSrv.ShowNotesL.End" ); |
|
1975 return showNotes; |
|
1976 } |
|
1977 |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // CPhSrvUssdManager::CompleteSatL |
|
1980 // ----------------------------------------------------------------------------- |
|
1981 // |
|
1982 void CPhSrvUssdManager::CompleteSatL( |
|
1983 TDesC* aReceiveString, |
|
1984 TInt aError ) |
|
1985 { |
|
1986 _DPRINT( 4, "PhSrv.CompleteSatL.Start" ); |
|
1987 if ( aReceiveString ) |
|
1988 { |
|
1989 if ( aReceiveString->Length() ) |
|
1990 { |
|
1991 _DPRINT( 4, "PhSrv.CompleteSatL.recString.>0" ); // debug print |
|
1992 // copy the received string to client side. |
|
1993 if ( iPendingSatMessagePointer.Int1() < aReceiveString->Length() ) |
|
1994 { |
|
1995 |
|
1996 _DPRINT( 4, "PhSrv.CompleteSatL.recString.LengthError" ); |
|
1997 if ( !iPendingSatMessagePointer.IsNull() ) |
|
1998 { |
|
1999 iPendingSatMessagePointer.Complete( KErrOverflow ); |
|
2000 _DPRINT( 4, "PhSrv.CompleteSatLComplete.KErrOverFlow" ); |
|
2001 } |
|
2002 iHavePendingSatMessagePointer = EFalse; |
|
2003 } |
|
2004 else |
|
2005 { |
|
2006 _DPRINT( 4, "PhSrv.CompleteSatL.recString.Write" ); // debug print |
|
2007 iPendingSatMessagePointer.WriteL( |
|
2008 2, |
|
2009 *aReceiveString ); |
|
2010 |
|
2011 _DPRINT( 4, "PhSrv.CompleteSatL.recString.Write2" ); // debug print |
|
2012 TPckg< TUint > dcsPackage( iDCS ); |
|
2013 iPendingSatMessagePointer.WriteL( |
|
2014 0, |
|
2015 dcsPackage ); |
|
2016 } |
|
2017 } |
|
2018 } |
|
2019 _DPRINT( 4, "PhSrv.CompleteSatL.Middle" ); |
|
2020 if ( !iPendingSatMessagePointer.IsNull() ) |
|
2021 { |
|
2022 if ( aReceiveString && !iSatCanceled ) |
|
2023 { |
|
2024 _DDPRINT( 4, "PhSrv.CompleteSatL.Complete.", iReturnResult.iOpCode ); // debug print |
|
2025 iPendingSatMessagePointer.Complete( iReturnResult.iOpCode ); // Some positive value |
|
2026 } |
|
2027 else |
|
2028 { |
|
2029 _DPRINT( 4, "PhSrv.CompleteSatL.Complete.aError" ); // debug print |
|
2030 iPendingSatMessagePointer.Complete( aError ); |
|
2031 } |
|
2032 } |
|
2033 |
|
2034 iHavePendingSatMessagePointer = EFalse; |
|
2035 |
|
2036 _DPRINT( 4, "PhSrv.CompleteSatL.End" ); |
|
2037 } |
|
2038 |
|
2039 |
|
2040 // ----------------------------------------------------------------------------- |
|
2041 // CPhSrvUssdManager::IsTelephonyFeatureSupported |
|
2042 // |
|
2043 // ----------------------------------------------------------------------------- |
|
2044 // |
|
2045 TBool CPhSrvUssdManager::IsTelephonyFeatureSupported( |
|
2046 const TInt aFeatureId ) |
|
2047 { |
|
2048 return ( aFeatureId & iVariantReadOnlyValues ); |
|
2049 } |
|
2050 |
|
2051 |
|
2052 // ----------------------------------------------------------------------------- |
|
2053 // CPhSrvUssdManager::PlayUssdTone |
|
2054 // |
|
2055 // ----------------------------------------------------------------------------- |
|
2056 // |
|
2057 TInt CPhSrvUssdManager::PlayUssdTone() |
|
2058 { |
|
2059 _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" ); |
|
2060 |
|
2061 TInt err = KErrNone; |
|
2062 // <-- QT PHONE START--> |
|
2063 // RProperty::Define( KPSUidNcnList, KNcnPlayAlertTone, RProperty::EInt, ECapability_None , ECapabilityWriteDeviceData ); |
|
2064 // RProperty::Set( KPSUidNcnList, KNcnPlayAlertTone, KPhSrvUssdTone ); |
|
2065 // <-- QT PHONE END--> |
|
2066 |
|
2067 // debug print |
|
2068 _DDPRINT( |
|
2069 4, |
|
2070 "PhSrv.UssdM.PlayTone.end", |
|
2071 err ); |
|
2072 return err; |
|
2073 } |
|
2074 |
|
2075 // ----------------------------------------------------------------------------- |
|
2076 // CPhSrvUssdManager::GetTelephonyVariantData |
|
2077 // |
|
2078 // ----------------------------------------------------------------------------- |
|
2079 // |
|
2080 TInt CPhSrvUssdManager::GetTelephonyVariantData() |
|
2081 { |
|
2082 _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.Start" ); |
|
2083 TInt err = KErrNone; |
|
2084 // <-- QT PHONE START--> |
|
2085 /* |
|
2086 // Variation data should be unchangable during run-time, |
|
2087 // therefore, if once succesfully read, later reads are |
|
2088 // not allowed. |
|
2089 if ( iVariantReadOnlyValues == KPhSrvDefaultValue ) |
|
2090 { |
|
2091 CRepository* cenRepSession = NULL; |
|
2092 TRAP ( err , |
|
2093 cenRepSession = CRepository::NewL( KCRUidTelVariation ) ); |
|
2094 if ( err == KErrNone ) |
|
2095 { |
|
2096 err = cenRepSession->Get( KTelVariationFlags, |
|
2097 iVariantReadOnlyValues ); |
|
2098 } |
|
2099 delete cenRepSession; |
|
2100 } |
|
2101 |
|
2102 _DDPRINT( 4, "PhSrv.UssdM.variant", iVariantReadOnlyValues ); // debug print |
|
2103 _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.End" ); |
|
2104 */ |
|
2105 // <-- QT PHONE END--> |
|
2106 return err; |
|
2107 } |
|
2108 |
|
2109 |
|
2110 // ----------------------------------------------------------------------------- |
|
2111 // CPhSrvUssdManager::SendMoAcknowledgementL |
|
2112 // |
|
2113 // ----------------------------------------------------------------------------- |
|
2114 // |
|
2115 void CPhSrvUssdManager::SendMoAcknowledgementL() |
|
2116 { |
|
2117 _DPRINT( 4, "PhSrv.SendMoAckL.Start" ); |
|
2118 |
|
2119 // Acknowledge MT USSD message. |
|
2120 RMobileUssdMessaging::TMobileUssdAttributesV1 msgAttribs; |
|
2121 msgAttribs.iFlags = |
|
2122 RMobileUssdMessaging::KUssdMessageType + |
|
2123 RMobileUssdMessaging::KUssdDataFormat + |
|
2124 RMobileUssdMessaging::KUssdMessageDcs; |
|
2125 |
|
2126 msgAttribs.iType = RMobileUssdMessaging::EUssdMOAcknowledgement; |
|
2127 _DDPRINT( 4, "PhSrv.SendMoAckL.msgAttribs.iType ", msgAttribs.iType ); |
|
2128 msgAttribs.iFormat = RMobileUssdMessaging::EFormatUnspecified; |
|
2129 _DDPRINT( 4, "PhSrv.SendMoAckL.msgAttribs.iFormat ", msgAttribs.iFormat ); |
|
2130 msgAttribs.iDcs = KPhSrvUssdDefaultDCS; |
|
2131 |
|
2132 RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs = msgAttribs; |
|
2133 SendHandlerL().SendUssdL( KNullDesC8() , attribs ); |
|
2134 |
|
2135 _DPRINT( 4, "PhSrv.SendMoAckL.End" ); |
|
2136 } |
|
2137 |
|
2138 // ----------------------------------------------------------------------------- |
|
2139 // CPhSrvUssdManager::TurnLightsOn |
|
2140 // |
|
2141 // ----------------------------------------------------------------------------- |
|
2142 // |
|
2143 void CPhSrvUssdManager::TurnLightsOn() |
|
2144 { |
|
2145 _DPRINT( 4, "PhSrv.TurnLightsOn.Start" ); |
|
2146 |
|
2147 |
|
2148 // Change the bit on and off. SysAp will detect that |
|
2149 // the lights should be switched on for the specified time. |
|
2150 // |
|
2151 RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn); |
|
2152 TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff); |
|
2153 |
|
2154 if ( err != KErrNone ) |
|
2155 { |
|
2156 _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print |
|
2157 } |
|
2158 |
|
2159 _DPRINT( 4, "PhSrv.TurnLightsOn.End" ); |
|
2160 } |
|
2161 |
|
2162 // ----------------------------------------------------------------------------- |
|
2163 // CPhSrvUssdManager::LoadDefaultString |
|
2164 // ----------------------------------------------------------------------------- |
|
2165 // |
|
2166 const TPtrC CPhSrvUssdManager::LoadDefaultString( const TDesC& aText ) |
|
2167 { |
|
2168 _DPRINT( 4, "PhSrv.LoadDefaultString.Start" ); |
|
2169 |
|
2170 if ( iTextBuffer ) |
|
2171 { |
|
2172 delete iTextBuffer; |
|
2173 iTextBuffer = NULL; |
|
2174 _DPRINT( 4, "PhSrv.LoadDefaultString.Clear" ); |
|
2175 } |
|
2176 TInt err = KErrNone; |
|
2177 TPtrC ptr( aText ); |
|
2178 if ( iTextResolver && ptr.Length() ) |
|
2179 { |
|
2180 TRAP( err, iTextBuffer = HbTextResolverSymbian::LoadL( ptr ) ); |
|
2181 _DDPRINT( 4, "PhSrv.LoadDefaultString.LoadL.%d", err ); |
|
2182 if ( iTextBuffer ) |
|
2183 { |
|
2184 ptr.Set( iTextBuffer->Des() ); |
|
2185 _DPRINT( 4, "PhSrv.LoadDefaultString.Set" ); |
|
2186 } |
|
2187 } |
|
2188 _DPRINT( 4, "PhSrv.LoadDefaultString.End" ); |
|
2189 return ptr; |
|
2190 } |
|
2191 |
|
2192 // End of File |
|