|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : CSatNotifyLocalInfo.cpp |
|
15 // Part of : Common SIM ATK TSY / commonsimatktsy |
|
16 // Local info notification functionality of SAT Tsy |
|
17 // Version : 1.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 //INCLUDES |
|
23 #include <satcs.h> // Etel SAT IPC definitions |
|
24 #include "CSatTsy.h" // Tsy class header |
|
25 #include "CSatNotifyLocalInfo.h" // Class header |
|
26 #include "CBerTlv.h" // Ber Tlv data handling |
|
27 #include "TTlv.h" // TTlv class |
|
28 #include "CSatDataPackage.h" // Parameter packing |
|
29 #include "TfLogger.h" // For TFLOGSTRING |
|
30 #include "TSatUtility.h" // Utilities |
|
31 #include "CSatTsyReqHandleStore.h" // Request handle class |
|
32 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
|
33 #include "MSatTsy_IPCDefs.h" // Sat Tsy internal request types |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CSatNotifyLocalInfo::NewL |
|
37 // Two-phased constructor. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSatNotifyLocalInfo* CSatNotifyLocalInfo::NewL |
|
41 ( |
|
42 CSatNotificationsTsy* aNotificationsTsy |
|
43 ) |
|
44 { |
|
45 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::NewL"); |
|
46 CSatNotifyLocalInfo* const satNotifyLocalInfo = |
|
47 new ( ELeave ) CSatNotifyLocalInfo( aNotificationsTsy ); |
|
48 CleanupStack::PushL( satNotifyLocalInfo ); |
|
49 satNotifyLocalInfo->ConstructL(); |
|
50 CleanupStack::Pop( satNotifyLocalInfo ); |
|
51 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::NewL, end of method"); |
|
52 return satNotifyLocalInfo; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CSatNotifyLocalInfo::~CSatNotifyLocalInfo |
|
57 // Destructor |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CSatNotifyLocalInfo::~CSatNotifyLocalInfo |
|
61 ( |
|
62 // None |
|
63 ) |
|
64 { |
|
65 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::~CSatNotifyLocalInfo"); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSatNotifyLocalInfo::CSatNotifyLocalInfo |
|
70 // Default C++ constructor |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CSatNotifyLocalInfo::CSatNotifyLocalInfo |
|
74 ( |
|
75 CSatNotificationsTsy* aNotificationsTsy |
|
76 ) : iTimingAdvance( 0xFF ), iTimeZone( 0xFF ), |
|
77 iMEStatus( KMEIsInTheIdleState ), iCurrentAccTech( 0xFF ), |
|
78 iNotificationsTsy( aNotificationsTsy ) |
|
79 { |
|
80 // Set time zone as not available ( 0xFF ) |
|
81 // Set timing advance as not available ( 0xFF ) |
|
82 // Set ME status as in the idle state ( KMEIsInTheIdleState ) |
|
83 // Set current access technology as unknown ( 0xFF ) |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSatNotifyLocalInfo::ConstructL |
|
88 // Symbian 2nd phase constructor |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CSatNotifyLocalInfo::ConstructL |
|
92 ( |
|
93 // None |
|
94 ) |
|
95 { |
|
96 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::ConstructL"); |
|
97 // IMEI of the ME |
|
98 iIMEI.Zero(); |
|
99 // Clear NMR (Network Measurement result) |
|
100 iNMR.Zero(); |
|
101 // Clear BCCH channel list |
|
102 iBCCHChannelList.Zero(); |
|
103 // Initialize location info data |
|
104 iLocalInformation.iOperatorCode.FillZ( KOperatorCodeLength ); |
|
105 iLocalInformation.iLocationAreaCode = 0; |
|
106 iLocalInformation.iCellId = 0; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CSatNotifyLocalInfo::Notify |
|
111 // This request allows a client to be notified of a LOCAL INFO proactive |
|
112 // command |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 TInt CSatNotifyLocalInfo::Notify |
|
116 ( |
|
117 const TTsyReqHandle aTsyReqHandle, |
|
118 const TDataPackage& aPackage |
|
119 ) |
|
120 { |
|
121 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::Notify"); |
|
122 // Save data pointer to client side for completion |
|
123 iLocalInfoV3Pckg = reinterpret_cast<RSat::TLocalInfoV3Pckg*>( |
|
124 aPackage.Des1n() ); |
|
125 // Save the request handle |
|
126 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
|
127 CSatTsy::ESatNotifyLocalInfoPCmdReqType ); |
|
128 // Check if requested notification is already pending |
|
129 iNotificationsTsy->NotifySatReadyForNotification( KProvideLocalInformation ); |
|
130 |
|
131 return KErrNone; |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CSatNotifyLocalInfo::CancelNotification |
|
136 // This method cancels an outstanding asynchronous NotifyLocalInfo request. |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TInt CSatNotifyLocalInfo::CancelNotification |
|
140 ( |
|
141 const TTsyReqHandle aTsyReqHandle |
|
142 ) |
|
143 { |
|
144 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CancelNotification"); |
|
145 // Reset the request handle |
|
146 iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( |
|
147 CSatTsy::ESatNotifyLocalInfoPCmdReqType ); |
|
148 // Reset the data pointer |
|
149 iLocalInfoV3Pckg = NULL; |
|
150 // Complete the request with KErrCancel |
|
151 iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
152 return KErrNone; |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CSatNotifyLocalInfo::CompleteNotifyL |
|
157 // This method completes an outstanding asynchronous NotifyLocalInfo request. |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 TInt CSatNotifyLocalInfo::CompleteNotifyL |
|
161 ( |
|
162 CSatDataPackage* aDataPackage, |
|
163 TInt aErrorCode |
|
164 ) |
|
165 { |
|
166 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL"); |
|
167 |
|
168 TInt ret( KErrNone ); |
|
169 TPtrC8* data; |
|
170 |
|
171 // Unpack parameters |
|
172 CSatDataPackage dataPackage; |
|
173 aDataPackage->UnPackData( &data ); |
|
174 // Clear additional info |
|
175 iLocalInfoRspV3.iAdditionalInfo.Zero(); |
|
176 // Get ber tlv |
|
177 CBerTlv berTlv; |
|
178 berTlv.SetData( *data ); |
|
179 // Get command details tlv |
|
180 CTlv commandDetails; |
|
181 berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag ); |
|
182 // Store command details tlv |
|
183 iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( |
|
184 commandDetails.Data() ); |
|
185 |
|
186 TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) ); |
|
187 // Store pCmdNumber |
|
188 iNotificationsTsy->iTerminalRespData.iPCmdNumber = pCmdNumber; |
|
189 |
|
190 switch ( iNotificationsTsy->iTerminalRespData. |
|
191 iCommandDetails[KCommandQualifier] ) |
|
192 { |
|
193 case RSat::KProvideLocalInfo: |
|
194 { |
|
195 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL\ |
|
196 request: LOCAL INFO"); |
|
197 iLocalInfoIsOngoing = ETrue; |
|
198 // Get Local Info |
|
199 dataPackage.PackData( &iLocalInfoIsOngoing ); |
|
200 iNotificationsTsy->iSatTsy->MessageManager()-> |
|
201 HandleRequestL( ESatTsyProvideLocalInfo, &dataPackage ); |
|
202 break; |
|
203 } |
|
204 case RSat::KProvideLocalInfoImei: |
|
205 { |
|
206 TFLOGSTRING("CSAT: CSatNotifyLocalInfo:: CompleteNotifyL, \ |
|
207 request: IMEI"); |
|
208 // Check if IMEI is received |
|
209 if ( iIMEI.Length() ) |
|
210 { |
|
211 iLocalInfoRspV3.iGeneralResult = RSat::KSuccess; |
|
212 } |
|
213 else |
|
214 { |
|
215 iLocalInfoRspV3.iGeneralResult = |
|
216 RSat::KMeUnableToProcessCmd; |
|
217 iLocalInfoRspV3.iAdditionalInfo.Append( |
|
218 KNoSpecificCauseCanBeGiven ); |
|
219 } |
|
220 break; |
|
221 } |
|
222 case RSat::KProvideLocalInformationNmr: |
|
223 { |
|
224 TFLOGSTRING("CSAT: CSatNotifyLocalInfo:: request: NMR"); |
|
225 iLocalInfoIsOngoing = ETrue; |
|
226 // Request Network Measurement Results |
|
227 dataPackage.PackData( &iLocalInfoIsOngoing ); |
|
228 iNotificationsTsy->iSatTsy->MessageManager()-> |
|
229 HandleRequestL( ESatTsyLocalInformationNmr, &dataPackage ); |
|
230 break; |
|
231 } |
|
232 case RSat::KProvideLocalInfoDateTimeTimeZone: |
|
233 { |
|
234 TFLOGSTRING("CSAT: CSatNotifyLocalInfo:: request: \ |
|
235 DATE/TIME/TIMEZONE"); |
|
236 SetDateTimeTimeZone(); |
|
237 break; |
|
238 } |
|
239 case RSat::KProvideLocalInfoLanguage: |
|
240 { |
|
241 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL request, \ |
|
242 Language"); |
|
243 // Reset req handle. Returns the deleted req handle |
|
244 TTsyReqHandle reqHandle = |
|
245 iNotificationsTsy->iSatReqHandleStore->ResetTsyReqHandle( |
|
246 CSatTsy::ESatNotifyLocalInfoPCmdReqType ); |
|
247 |
|
248 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
|
249 { |
|
250 if ( KErrNone == aErrorCode ) |
|
251 { |
|
252 // Fill the send sm structure |
|
253 RSat::TLocalInfoV3& localInfoV3 = ( *iLocalInfoV3Pckg )(); |
|
254 |
|
255 // Get command details tlv |
|
256 CTlv deviceIdentities; |
|
257 berTlv.TlvByTagValue( &deviceIdentities, |
|
258 KTlvDeviceIdentityTag ); |
|
259 |
|
260 localInfoV3.iDevideId = ( RSat::TDeviceId ) |
|
261 deviceIdentities.GetShortInfo( |
|
262 ETLV_SourceDeviceIdentity ); |
|
263 |
|
264 localInfoV3.iInfoType = |
|
265 ( RSat::TLocaInfomationType) iNotificationsTsy-> |
|
266 iTerminalRespData.iCommandDetails[KCommandQualifier]; |
|
267 |
|
268 // Command number |
|
269 localInfoV3.SetPCmdNumber( pCmdNumber ); |
|
270 } |
|
271 iNotificationsTsy->iSatTsy->ReqCompleted( |
|
272 reqHandle, aErrorCode ); |
|
273 } |
|
274 else |
|
275 { |
|
276 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL\ |
|
277 No reqHandle"); |
|
278 iLocalInfoRspV3.iGeneralResult = |
|
279 RSat::KMeUnableToProcessCmd; |
|
280 iLocalInfoRspV3.iAdditionalInfo.Append( |
|
281 RSat::KNoSpecificMeProblem ); |
|
282 TerminalResponseL( NULL ); |
|
283 } |
|
284 break; |
|
285 } |
|
286 case RSat::KProvideLocalInfoTimingAdv: |
|
287 { |
|
288 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL\ |
|
289 request: TimingAdvance"); |
|
290 iLocalInfoIsOngoing = ETrue; |
|
291 dataPackage.PackData( &iLocalInfoIsOngoing ); |
|
292 // Request service |
|
293 iNotificationsTsy->iSatTsy->MessageManager()-> |
|
294 HandleRequestL( ESatTsyTimingAdvance, &dataPackage ); |
|
295 break; |
|
296 } |
|
297 case RSat::KProvideLocalInfoAccTech: |
|
298 { |
|
299 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteNotifyL\ |
|
300 request: Access Technology"); |
|
301 iLocalInfoIsOngoing = ETrue; |
|
302 dataPackage.PackData( &iLocalInfoIsOngoing ); |
|
303 // Request Access technology |
|
304 iNotificationsTsy->iSatTsy->MessageManager()-> |
|
305 HandleRequestL( ESatTsyAccTech, &dataPackage ); |
|
306 break; |
|
307 } |
|
308 // Currently not supported: |
|
309 case RSat::KProvideLocalInfoESN: |
|
310 { |
|
311 iLocalInfoRspV3.iGeneralResult = |
|
312 RSat::KCmdBeyondMeCapabilities; |
|
313 break; |
|
314 } |
|
315 default: |
|
316 { |
|
317 iLocalInfoRspV3.iGeneralResult = RSat::KCmdTypeNotUnderstood; |
|
318 } |
|
319 } |
|
320 |
|
321 if ( ( RSat::KProvideLocalInformationNmr != iNotificationsTsy-> |
|
322 iTerminalRespData.iCommandDetails[KCommandQualifier] ) |
|
323 && ( RSat::KProvideLocalInfo != iNotificationsTsy-> |
|
324 iTerminalRespData.iCommandDetails[KCommandQualifier] ) |
|
325 && ( RSat::KProvideLocalInfoTimingAdv != iNotificationsTsy-> |
|
326 iTerminalRespData.iCommandDetails[KCommandQualifier] ) |
|
327 && ( RSat::KProvideLocalInfoLanguage != iNotificationsTsy-> |
|
328 iTerminalRespData.iCommandDetails[KCommandQualifier] ) |
|
329 && ( RSat::KProvideLocalInfoAccTech != iNotificationsTsy-> |
|
330 iTerminalRespData.iCommandDetails[KCommandQualifier] ) ) |
|
331 { |
|
332 // Send terminal response to the NAA |
|
333 TerminalResponseL( NULL ); |
|
334 } |
|
335 return ret; |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CSatNotifyLocalInfo::TerminalResponseL |
|
340 // Called by ETel server, passes terminal response to DOS |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 TInt CSatNotifyLocalInfo::TerminalResponseL |
|
344 ( |
|
345 TDes8* aRsp |
|
346 ) |
|
347 { |
|
348 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::TerminalResponseL"); |
|
349 |
|
350 TInt ret( KErrNone ); |
|
351 TBuf<RSat::KAdditionalInfoMaxSize> additionalInfo; |
|
352 if ( aRsp ) |
|
353 { |
|
354 RSat::TLocalInfoRspV3Pckg* aRspPckg = |
|
355 reinterpret_cast<RSat::TLocalInfoRspV3Pckg*>( aRsp ); |
|
356 RSat::TLocalInfoRspV3& rspV1 = ( *aRspPckg ) (); |
|
357 // Get Proactive command number |
|
358 iNotificationsTsy->iTerminalRespData.iPCmdNumber = rspV1.PCmdNumber(); |
|
359 // Check that general result value is valid. |
|
360 if ( ( RSat::KSuccess != rspV1.iGeneralResult ) |
|
361 && ( RSat::KSuccessLimitedService != rspV1.iGeneralResult ) |
|
362 && ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) |
|
363 && ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) ) |
|
364 { |
|
365 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::TerminalResponseL,\ |
|
366 Invalid General Result"); |
|
367 // Invalid general result |
|
368 ret = KErrCorrupt; |
|
369 } |
|
370 else |
|
371 { |
|
372 // Do nothing |
|
373 } |
|
374 iLocalInfoRspV3.iGeneralResult = rspV1.iGeneralResult; |
|
375 |
|
376 // If there is ME (Mobile Entity) error, additional info is needed |
|
377 if ( ( RSat::KMeProblem == rspV1.iInfoType ) && |
|
378 ( NULL == rspV1.iAdditionalInfo.Length() ) ) |
|
379 { |
|
380 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::TerminalResponseL,\ |
|
381 Invalid Additional Info"); |
|
382 // Invalid additional info field |
|
383 ret = KErrCorrupt; |
|
384 } |
|
385 else |
|
386 { |
|
387 // Do nothing |
|
388 } |
|
389 |
|
390 iLocalInfoRspV3.iAdditionalInfo = rspV1.iAdditionalInfo; |
|
391 } |
|
392 else |
|
393 { |
|
394 // Do nothing |
|
395 } |
|
396 |
|
397 additionalInfo.Copy( iLocalInfoRspV3.iAdditionalInfo ); |
|
398 CreateTerminalRespL( iNotificationsTsy->iTerminalRespData.iPCmdNumber, |
|
399 static_cast<TUint8>( iLocalInfoRspV3.iGeneralResult ), |
|
400 additionalInfo ); |
|
401 |
|
402 return ret; |
|
403 } |
|
404 |
|
405 // ----------------------------------------------------------------------------- |
|
406 // CSatNotifyLocalInfo::CreateTerminalRespL |
|
407 // Constructs LocalInfo specific part of terminal response and calls |
|
408 // DOS to send the actual message. |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 TInt CSatNotifyLocalInfo::CreateTerminalRespL |
|
412 ( |
|
413 TUint8 aPCmdNumber, |
|
414 TUint8 aGeneralResult, |
|
415 TDesC16& aAdditionalInfo |
|
416 ) |
|
417 { |
|
418 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CreateTerminalRespL"); |
|
419 // Create and append response data |
|
420 TTlv tlvSpecificData; |
|
421 // Create General Result TLV |
|
422 tlvSpecificData.AddTag( KTlvResultTag ); |
|
423 // General result |
|
424 tlvSpecificData.AddByte( aGeneralResult ); |
|
425 |
|
426 if ( ( RSat::KSuccess != aGeneralResult ) && |
|
427 ( RSat::KSuccessLimitedService != aGeneralResult ) ) |
|
428 { |
|
429 if ( aAdditionalInfo.Length() ) |
|
430 { |
|
431 tlvSpecificData.AddByte( static_cast<TUint8>( |
|
432 ( aAdditionalInfo[0] >> 0 ) & 0xFF ) ); |
|
433 } |
|
434 } |
|
435 else |
|
436 { |
|
437 switch ( iNotificationsTsy->iTerminalRespData. |
|
438 iCommandDetails[KCommandQualifier] ) |
|
439 { |
|
440 case RSat::KProvideLocalInfo: |
|
441 { |
|
442 // Create Location Information TLV |
|
443 tlvSpecificData.AddTag( KTlvLocationInformationTag ); |
|
444 // Append Mobile Country & Network Codes, 3 bytes |
|
445 tlvSpecificData.AddData( iLocalInformation.iOperatorCode ); |
|
446 // Append location area code |
|
447 tlvSpecificData.AddByte( static_cast<TUint8>( |
|
448 iLocalInformation.iLocationAreaCode>>8 ) ); |
|
449 tlvSpecificData.AddByte( static_cast<TUint8>( |
|
450 iLocalInformation.iLocationAreaCode>>0 ) ); |
|
451 // Append Cell Id |
|
452 tlvSpecificData.AddByte( static_cast<TUint8>( |
|
453 iLocalInformation.iCellId >> 8 ) ); |
|
454 tlvSpecificData.AddByte( static_cast<TUint8>( |
|
455 iLocalInformation.iCellId >> 0 ) ); |
|
456 break; |
|
457 } |
|
458 case RSat::KProvideLocalInfoImei: |
|
459 { |
|
460 // Add tlv tag |
|
461 tlvSpecificData.AddTag( KTlvImeiTag ); |
|
462 TBuf8<8> bcdImei; |
|
463 // Convert IMEI to BCD format |
|
464 _LIT8( KTen, "*" ); |
|
465 _LIT8( KZero, "0" ); |
|
466 |
|
467 // Check if required changes is allready done for the IMEI |
|
468 if ( '*' != iIMEI[0] ) |
|
469 { |
|
470 // Processing BCD string is much harder than ASCII so |
|
471 // required changes is done before BCD conversion. |
|
472 // (lot's of shifting etc..) |
|
473 // Insert '*'(0x2A) as a first character which is converted |
|
474 // to 0xA in AsciiToBCD method. |
|
475 // Type of identity for IMEI code is 0xA "1010b" |
|
476 // See 3GPP TS 04.08 |
|
477 iIMEI.Insert( 0, KTen ); |
|
478 |
|
479 // Spare digit: this digit shall be zero, when transmitted |
|
480 // by the Mobile Station. |
|
481 // See GSM 03.03 |
|
482 iIMEI.Replace( iIMEI.Length() - 1, 1 , KZero ); |
|
483 } |
|
484 |
|
485 TSatUtility::AsciiToBCD( iIMEI, bcdImei ); |
|
486 // Add IMEI code to the terminal response |
|
487 tlvSpecificData.AddData( bcdImei ); |
|
488 break; |
|
489 } |
|
490 case RSat::KProvideLocalInformationNmr: |
|
491 { |
|
492 SetInformationNmr( &tlvSpecificData ); |
|
493 break; |
|
494 } |
|
495 case RSat::KProvideLocalInfoDateTimeTimeZone: |
|
496 { |
|
497 tlvSpecificData.AddTag( KTlvDateTimeAndTimeZoneTag ); |
|
498 // Append current date/time/timezone to the terminal response |
|
499 TInt i( 0 ); |
|
500 for ( i = 0; i < aAdditionalInfo.Length(); i++ ) |
|
501 { |
|
502 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] |
|
503 & 0x00FF ) ); |
|
504 } |
|
505 break; |
|
506 } |
|
507 case RSat::KProvideLocalInfoTimingAdv: |
|
508 { |
|
509 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::\ |
|
510 CreateTerminalRespL, TimingAdvance"); |
|
511 // Timing advance result |
|
512 tlvSpecificData.AddTag( KTlvTimingAdvanceTag ); |
|
513 tlvSpecificData.AddByte( iMEStatus ); |
|
514 tlvSpecificData.AddByte( iTimingAdvance ); |
|
515 break; |
|
516 } |
|
517 case RSat::KProvideLocalInfoLanguage: |
|
518 { |
|
519 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::\ |
|
520 CreateTerminalRespL, LocalInfoLanguage"); |
|
521 |
|
522 if ( aAdditionalInfo.Length() ) |
|
523 { |
|
524 // create Language TLV |
|
525 tlvSpecificData.AddTag( KTlvLanguageTag ); |
|
526 TBuf8<2> character; |
|
527 TSatUtility::Copy16to8LE( aAdditionalInfo, character); |
|
528 tlvSpecificData.AddData( character ); |
|
529 } |
|
530 else |
|
531 { |
|
532 // Do nothing |
|
533 } |
|
534 break; |
|
535 } |
|
536 case RSat::KProvideLocalInfoAccTech: |
|
537 { |
|
538 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::\ |
|
539 CreateTerminalRespL, Access Technology"); |
|
540 // Access technology result |
|
541 tlvSpecificData.AddTag( KTlvAccessTechnologyTag ); |
|
542 tlvSpecificData.AddByte( iCurrentAccTech ); |
|
543 break; |
|
544 } |
|
545 default: |
|
546 { |
|
547 break; |
|
548 } |
|
549 } |
|
550 } |
|
551 // Prepare data |
|
552 iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber; |
|
553 TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag(); |
|
554 |
|
555 // Pack data |
|
556 CSatDataPackage dataPackage; |
|
557 dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data ); |
|
558 |
|
559 // Forward request to the DOS |
|
560 return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( |
|
561 ESatTerminalRsp, &dataPackage ); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CSatNotifyLocalInfo::CompleteTerminalRespDataL |
|
566 // Unpacks terminal response specific data |
|
567 // calls CreateTerminalRespL. |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 TInt CSatNotifyLocalInfo::CompleteTerminalRespDataL |
|
571 ( |
|
572 CSatDataPackage* aDataPackage, |
|
573 TInt /*aErrorCode*/ |
|
574 ) |
|
575 { |
|
576 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteTerminalRespDataL"); |
|
577 TInt ret( KErrNone ); |
|
578 // Unpack parameters |
|
579 CSatNotificationsTsy::TTerminalRespData* terminalRespData; |
|
580 aDataPackage->UnPackData( &terminalRespData ); |
|
581 CreateTerminalRespL( iNotificationsTsy->iTerminalRespData.iPCmdNumber, |
|
582 terminalRespData->iGeneralResult, |
|
583 terminalRespData->iAdditionalInfo ); |
|
584 return ret; |
|
585 } |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // CSatNotifyLocalInfo::CompleteUpdateLocalInfo |
|
589 // Called when local info is changed |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 void CSatNotifyLocalInfo::CompleteUpdateLocalInfo |
|
593 ( |
|
594 CSatDataPackage* aDataPackage, |
|
595 TInt /*aErrorCode*/ |
|
596 ) |
|
597 { |
|
598 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateLocalInfo"); |
|
599 aDataPackage->UnPackData( iLocalInformation ); |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CSatNotifyLocalInfo::CompleteUpdateNetInfo |
|
604 // Called when NMR or BCCHChannel list is changed |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CSatNotifyLocalInfo::CompleteUpdateNetInfo |
|
608 ( |
|
609 CSatDataPackage* aDataPackage, |
|
610 TInt /*aErrorCode*/ |
|
611 ) |
|
612 { |
|
613 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateNetInfo"); |
|
614 aDataPackage->UnPackData( iNMR, iBCCHChannelList ); |
|
615 } |
|
616 |
|
617 // ----------------------------------------------------------------------------- |
|
618 // CSatNotifyLocalInfo::CompleteUpdateTimingAdvAndMEStatus |
|
619 // Called when Timing addvance or ME Status is changed |
|
620 // ----------------------------------------------------------------------------- |
|
621 // |
|
622 void CSatNotifyLocalInfo::CompleteUpdateTimingAdvAndMEStatus |
|
623 ( |
|
624 CSatDataPackage* aDataPackage, |
|
625 TInt /*aErrorCode*/ |
|
626 ) |
|
627 { |
|
628 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateTimingAdvAndMEStatus"); |
|
629 aDataPackage->UnPackData( iTimingAdvance, iMEStatus ); |
|
630 } |
|
631 |
|
632 // ----------------------------------------------------------------------------- |
|
633 // CSatNotifyLocalInfo::CompleteUpdateAccTech |
|
634 // Called when Access technology is changed |
|
635 // ----------------------------------------------------------------------------- |
|
636 // |
|
637 void CSatNotifyLocalInfo::CompleteUpdateAccTech |
|
638 ( |
|
639 CSatDataPackage* aDataPackage, |
|
640 TInt /*aErrorCode*/ |
|
641 ) |
|
642 { |
|
643 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateAccTech"); |
|
644 aDataPackage->UnPackData( iCurrentAccTech ); |
|
645 } |
|
646 // ----------------------------------------------------------------------------- |
|
647 // CSatNotifyLocalInfo::CompleteUpdateIMEI |
|
648 // Called when IMEI is changed ( in boot up ) |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CSatNotifyLocalInfo::CompleteUpdateIMEI |
|
652 ( |
|
653 CSatDataPackage* aDataPackage, |
|
654 TInt /*aErrorCode*/ |
|
655 ) |
|
656 { |
|
657 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateIMEI"); |
|
658 aDataPackage->UnPackData( iIMEI ); |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CSatNotifyLocalInfo::CompleteUpdateTimeZone |
|
663 // Called when Time zone is changed |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 void CSatNotifyLocalInfo::CompleteUpdateTimeZone |
|
667 ( |
|
668 CSatDataPackage* aDataPackage, |
|
669 TInt /*aErrorCode*/ |
|
670 ) |
|
671 { |
|
672 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::CompleteUpdateTimeZone"); |
|
673 aDataPackage->UnPackData( iTimeZone ); |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CSatNotifyLocalInfo::LocalInformation |
|
678 // Returns const reference to the up-to-date local information data |
|
679 // ----------------------------------------------------------------------------- |
|
680 // |
|
681 const CSatNotificationsTsy::TLocalInformation& |
|
682 CSatNotifyLocalInfo::LocalInformation |
|
683 ( |
|
684 // None |
|
685 ) |
|
686 { |
|
687 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::LocalInformation"); |
|
688 return iLocalInformation; |
|
689 } |
|
690 |
|
691 // ----------------------------------------------------------------------------- |
|
692 // CSatNotifyLocalInfo::SetDateTimeTimeZone |
|
693 // Sets Date, Time and TimeZone into local info structure |
|
694 // ----------------------------------------------------------------------------- |
|
695 // |
|
696 void CSatNotifyLocalInfo::SetDateTimeTimeZone |
|
697 ( |
|
698 // None |
|
699 ) |
|
700 { |
|
701 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::SetDateTimeTimeZone"); |
|
702 TTime time; |
|
703 TLocale locale; |
|
704 TDateTime dateTime; |
|
705 // Get Universal time |
|
706 time.UniversalTime(); |
|
707 // Get Universal time offset ( Time zone in seconds ) |
|
708 TTimeIntervalSeconds universalTimeOffset( |
|
709 locale.UniversalTimeOffset() ); |
|
710 // Add locale's universal time offset to universal time |
|
711 // to get the local time |
|
712 time += universalTimeOffset; |
|
713 // Converts a TTime object into a TDateTime object |
|
714 dateTime = time.DateTime(); |
|
715 // Get and conver year |
|
716 TUint8 temp( TSatUtility::ConvertToSemiOctet( |
|
717 dateTime.Year() ) ); |
|
718 // Append year to additional info |
|
719 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
720 // Convert month |
|
721 // Offset from zero. So adding one. |
|
722 temp = TSatUtility::ConvertToSemiOctet( |
|
723 dateTime.Month() + 1 ); |
|
724 // Append month value to the additional info |
|
725 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
726 // Convert day to the semi-octec presentation |
|
727 // The day.Offset from zero, so add one before displaying |
|
728 // the day number. |
|
729 temp = TSatUtility::ConvertToSemiOctet( |
|
730 dateTime.Day() + 1 ); |
|
731 // Append the day value to the additional info |
|
732 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
733 // Conver current time to the semi-octec presentation. |
|
734 // First hour |
|
735 temp = TSatUtility::ConvertToSemiOctet( |
|
736 dateTime.Hour() ); |
|
737 // Append the hour value to the additional info |
|
738 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
739 // Minute value |
|
740 temp = TSatUtility::ConvertToSemiOctet( |
|
741 dateTime.Minute() ); |
|
742 // Append the minute value to the additional info |
|
743 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
744 // Seconds |
|
745 temp = TSatUtility::ConvertToSemiOctet( |
|
746 dateTime.Second() ); |
|
747 // Append the seconds value to the additional info |
|
748 iLocalInfoRspV3.iAdditionalInfo.Append( temp ); |
|
749 // Append time zone |
|
750 iLocalInfoRspV3.iAdditionalInfo.Append( iTimeZone ); |
|
751 // Set generall result as Success |
|
752 iLocalInfoRspV3.iGeneralResult = RSat::KSuccess; |
|
753 } |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // CSatNotifyLocalInfo::SetInformationNmr |
|
757 // Sets NMR and BCCHChannelList to tlv data |
|
758 // ----------------------------------------------------------------------------- |
|
759 // |
|
760 void CSatNotifyLocalInfo::SetInformationNmr |
|
761 ( |
|
762 TTlv* aTlvSpecificData |
|
763 ) |
|
764 { |
|
765 TFLOGSTRING("CSAT: CSatNotifyLocalInfo::SetInformationNmr"); |
|
766 if ( iNMR.Length() ) |
|
767 { |
|
768 // Network measurement result |
|
769 aTlvSpecificData->AddTag( KTlvNetworkMeasurementResultsTag ); |
|
770 aTlvSpecificData->AddData( iNMR ); |
|
771 } |
|
772 |
|
773 if ( iBCCHChannelList.Length() ) |
|
774 { |
|
775 // Append BCCH channel list tag |
|
776 aTlvSpecificData->AddTag( KTlvBccdChannelListTag ); |
|
777 |
|
778 TInt i( 0 ); |
|
779 TInt mask( 3 ); |
|
780 TInt shiftMove( 2 ); |
|
781 TUint8 nextChar( 0 ); |
|
782 |
|
783 // Convert BCCH channel list from 16-bit to 10-bit format |
|
784 for ( i = 0; i < iBCCHChannelList.Length(); i++ ) |
|
785 { |
|
786 TUint char2 = ( iBCCHChannelList[i] & 0x03FF ); |
|
787 TUint8 char1 = static_cast<TUint8>( char2 >> shiftMove ); |
|
788 |
|
789 // Append byte |
|
790 aTlvSpecificData->AddByte( |
|
791 static_cast<TUint8>( char1 | nextChar ) ); |
|
792 |
|
793 nextChar = static_cast<TUint8>( ( char2 & mask ) |
|
794 << ( 8 - shiftMove ) ); |
|
795 |
|
796 if ( 8 == shiftMove ) |
|
797 { |
|
798 shiftMove = 2; |
|
799 nextChar = 0; |
|
800 aTlvSpecificData->AddByte( |
|
801 static_cast<TUint8> ( char2 & 0x00FF ) ); |
|
802 mask = 3; |
|
803 } |
|
804 else |
|
805 { |
|
806 shiftMove += 2; |
|
807 mask = ( 1L << shiftMove ) - 1; |
|
808 } |
|
809 } |
|
810 // Add last byte |
|
811 aTlvSpecificData->AddByte( nextChar ); |
|
812 } |
|
813 // Clear nmr |
|
814 iNMR.Zero(); |
|
815 // Clear BCCH channel list |
|
816 iBCCHChannelList.Zero(); |
|
817 } |
|
818 |
|
819 |
|
820 // End of file |
|
821 |