|
1 // Copyright (c) 2005-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 : CSatNotifyOpenChannel.cpp |
|
15 // Part of : Common SIM ATK TSY / commonsimatktsy |
|
16 // Open channel 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 "CSatNotifyOpenChannel.h" // Class header |
|
26 #include "CSatNotificationsTsy.h" // Tsy class header |
|
27 #include "CBerTlv.h" // Ber Tlv data handling |
|
28 #include "TTlv.h" // TTlv class |
|
29 #include "CSatDataPackage.h" // Parameter packing |
|
30 #include "TfLogger.h" // For TFLOGSTRING |
|
31 #include "TSatUtility.h" // Utilities |
|
32 #include "CSatTsyReqHandleStore.h" // Request handle class |
|
33 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CSatNotifyOpenChannel::NewL |
|
37 // Two-phased constructor. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSatNotifyOpenChannel* CSatNotifyOpenChannel::NewL |
|
41 ( |
|
42 CSatNotificationsTsy* aNotificationsTsy |
|
43 ) |
|
44 { |
|
45 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::NewL"); |
|
46 CSatNotifyOpenChannel* const satNotifyOpenChannel = |
|
47 new ( ELeave ) CSatNotifyOpenChannel( aNotificationsTsy ); |
|
48 CleanupStack::PushL( satNotifyOpenChannel ); |
|
49 satNotifyOpenChannel->ConstructL(); |
|
50 CleanupStack::Pop( satNotifyOpenChannel ); |
|
51 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::NewL, end of method"); |
|
52 return satNotifyOpenChannel; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CSatNotifyOpenChannel::~CSatNotifyOpenChannel |
|
57 // Destructor |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CSatNotifyOpenChannel::~CSatNotifyOpenChannel |
|
61 ( |
|
62 // None |
|
63 ) |
|
64 { |
|
65 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::~CSatNotifyOpenChannel"); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSatNotifyOpenChannel::CSatNotifyOpenChannel |
|
70 // Default C++ constructor |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CSatNotifyOpenChannel::CSatNotifyOpenChannel |
|
74 ( |
|
75 CSatNotificationsTsy* aNotificationsTsy |
|
76 ) : iNotificationsTsy ( aNotificationsTsy ), iBearerType( 0 ), |
|
77 iBearer( 0 ), iBufferSize( 0 ) |
|
78 { |
|
79 // None |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CSatNotifyOpenChannel::ConstructL |
|
84 // Symbian 2nd phase constructor |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CSatNotifyOpenChannel::ConstructL |
|
88 ( |
|
89 // None |
|
90 ) |
|
91 { |
|
92 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::ConstructL"); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CSatNotifyOpenChannel::Notify |
|
97 // This request allows a client to be notified of a OPEN CHANNEL proactive |
|
98 // command |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CSatNotifyOpenChannel::Notify |
|
102 ( |
|
103 const TTsyReqHandle aTsyReqHandle, |
|
104 const TDataPackage& aPackage |
|
105 ) |
|
106 { |
|
107 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::Notify"); |
|
108 // Save data pointers to client side for completion |
|
109 iOpenBaseChannelV2Pckg = reinterpret_cast<RSat::TOpenChannelBaseV2Pckg*>( |
|
110 aPackage.Des1n() ); |
|
111 iOpenCsChannelV2Pckg = reinterpret_cast<RSat::TOpenCsChannelV2Pckg*>( |
|
112 aPackage.Des1n() ); |
|
113 iOpenGprsChannelV4Pckg = reinterpret_cast<RSat::TOpenGprsChannelV4Pckg*>( |
|
114 aPackage.Des1n() ); |
|
115 iOpenLocalLinksChannelV2Pckg = reinterpret_cast< |
|
116 RSat::TOpenLocalLinksChannelV2Pckg*>( aPackage.Des1n() ); |
|
117 // Save the request handle |
|
118 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
|
119 CSatTsy::ESatNotifyOpenChannelPCmdReqType ); |
|
120 // Check if requested notification is already pending |
|
121 iNotificationsTsy->NotifySatReadyForNotification( KOpenChannel ); |
|
122 |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CSatNotifyOpenChannel::CancelNotification |
|
128 // This method cancels an outstanding asynchronous |
|
129 // NotifyOpenChannel request. |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 TInt CSatNotifyOpenChannel::CancelNotification |
|
133 ( |
|
134 const TTsyReqHandle aTsyReqHandle |
|
135 ) |
|
136 { |
|
137 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CancelNotification"); |
|
138 |
|
139 // Reset the request handle |
|
140 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
|
141 ResetTsyReqHandle( CSatTsy::ESatNotifyOpenChannelPCmdReqType ); |
|
142 // Reset the data pointers |
|
143 iOpenCsChannelV2Pckg = NULL; |
|
144 iOpenGprsChannelV4Pckg = NULL; |
|
145 iOpenLocalLinksChannelV2Pckg = NULL; |
|
146 // Complete the request with KErrCancel |
|
147 iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
148 |
|
149 return KErrNone; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CSatNotifyOpenChannel::CompleteNotifyL |
|
154 // This method completes an outstanding asynchronous |
|
155 // NotifyOpenChannel request. |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CSatNotifyOpenChannel::CompleteNotifyL |
|
159 ( |
|
160 CSatDataPackage* aDataPackage, |
|
161 TInt aErrorCode |
|
162 ) |
|
163 { |
|
164 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL"); |
|
165 |
|
166 TInt ret( KErrNone ); |
|
167 // Unpack parameters |
|
168 TPtrC8* data; |
|
169 aDataPackage->UnPackData( &data ); |
|
170 // Reset req handle. Returns the deleted req handle |
|
171 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
|
172 ResetTsyReqHandle( CSatTsy::ESatNotifyOpenChannelPCmdReqType ); |
|
173 |
|
174 // Get ber tlv |
|
175 CBerTlv berTlv; |
|
176 berTlv.SetData( *data ); |
|
177 // Get command details tlv |
|
178 CTlv commandDetails; |
|
179 berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag ); |
|
180 // Store command details tlv |
|
181 iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy( |
|
182 commandDetails.Data() ); |
|
183 // Get proactive command number |
|
184 TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) ); |
|
185 |
|
186 // In case the request was ongoing, continue.. |
|
187 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
|
188 { |
|
189 // Complete right away if error has occured, otherwise continue.. |
|
190 if ( KErrNone == aErrorCode ) |
|
191 { |
|
192 RSat::TOpenChannelBaseV2* openChannelV2 = NULL; |
|
193 |
|
194 // Mandatory: Bearer Description & Buffer Size |
|
195 CTlv bearerDescription; |
|
196 CTlv bufferSize; |
|
197 if ( KErrNone == berTlv.TlvByTagValue( |
|
198 &bearerDescription, KTlvBearerDescriptionTag ) && |
|
199 KErrNone == berTlv.TlvByTagValue( &bufferSize, |
|
200 KTlvBufferSizeTag ) ) |
|
201 { |
|
202 // Switch according to bearer |
|
203 switch ( bearerDescription.GetShortInfo( ETLV_BearerType ) ) |
|
204 { |
|
205 case KBipCsdBearer: |
|
206 { |
|
207 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
208 CompleteNotifyL, Command not supported: \ |
|
209 Csd Bearer"); |
|
210 // Buffer size |
|
211 iBufferSize = bufferSize.GetLongInfo( |
|
212 ETLV_BufferSize ); |
|
213 // Bearer description |
|
214 iBearerType = RSat::ECSDBearer; |
|
215 iBearer = bearerDescription.GetData( |
|
216 ETLV_BearerParameters ); |
|
217 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
218 CompleteNotifyL, BipCsdBearer "); |
|
219 CreateTerminalRespL( pCmdNumber, |
|
220 RSat::KCmdBeyondMeCapabilities, KNullDesC16 ); |
|
221 ret = KErrCorrupt; |
|
222 break; |
|
223 } |
|
224 case KBipGprsBearer: |
|
225 { |
|
226 // Fill in TOpenGprsChannelV4 |
|
227 RSat::TOpenGprsChannelV4& openGprsChannelV4 |
|
228 = ( *iOpenGprsChannelV4Pckg )(); |
|
229 openChannelV2 = &openGprsChannelV4; |
|
230 |
|
231 openChannelV2->iPCmdType = RSat::EGprsBearer; |
|
232 // Network access name (Optional) |
|
233 CTlv nanTlv; |
|
234 if ( KErrNone == berTlv.TlvByTagValue( &nanTlv, |
|
235 KTlvNetworkAccessNameTag ) ) |
|
236 { |
|
237 openGprsChannelV4.iAccessName = |
|
238 nanTlv.GetData( ETLV_NetworkAccessName ); |
|
239 } |
|
240 |
|
241 // Text string (User Logging) |
|
242 CTlv textStringUL; |
|
243 TInt returnValue = berTlv.TlvByTagValue( |
|
244 &textStringUL, KTlvTextStringTag ); |
|
245 if ( KErrNone == returnValue ) |
|
246 { |
|
247 // Convert and set text |
|
248 TSatUtility::SetText( textStringUL, |
|
249 openGprsChannelV4.iUserLogin ); |
|
250 } |
|
251 |
|
252 // Text string (User password) |
|
253 CTlv textStringUP; |
|
254 returnValue = berTlv.TlvByTagValue( &textStringUP, |
|
255 KTlvTextStringTag, 1 ); |
|
256 if ( KErrNone == returnValue ) |
|
257 { |
|
258 // Convert and set text |
|
259 TSatUtility::SetText( textStringUP, |
|
260 openGprsChannelV4.iUserPassword ); |
|
261 } |
|
262 break; |
|
263 } |
|
264 case KBipDefaultBearer: |
|
265 { |
|
266 // Fill in TOpenChannelBaseV2 |
|
267 openChannelV2 = &( *iOpenBaseChannelV2Pckg )(); |
|
268 openChannelV2->iPCmdType = RSat::EAnyBearer; |
|
269 break; |
|
270 } |
|
271 case KBipLocalLinkBearer: |
|
272 default: |
|
273 { |
|
274 // Bearer not supported (RFU) |
|
275 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
276 CompleteNotifyL, Bearer not supported"); |
|
277 // Required values missing |
|
278 iBearer.FillZ( 1 ); |
|
279 iBufferSize = 0; |
|
280 iBearerType = static_cast<TUint8>( |
|
281 RSat::EBearerTypeNotSet ); |
|
282 CreateTerminalRespL( pCmdNumber, |
|
283 RSat::KCmdDataNotUnderstood, KNullDesC16 ); |
|
284 ret = KErrCorrupt; |
|
285 break; |
|
286 } |
|
287 } |
|
288 } |
|
289 else |
|
290 { |
|
291 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL,\ |
|
292 required values missing"); |
|
293 // Required values missing |
|
294 iBearer.FillZ( 1 ); |
|
295 iBufferSize = 0; |
|
296 iBearerType = static_cast<TUint8>( RSat::EBearerTypeNotSet ); |
|
297 CreateTerminalRespL( pCmdNumber, |
|
298 RSat::KErrorRequiredValuesMissing, KNullDesC16 ); |
|
299 ret = KErrCorrupt; |
|
300 } |
|
301 |
|
302 if ( KErrNone == ret ) |
|
303 { |
|
304 // Buffer size |
|
305 openChannelV2->iBufferSize = bufferSize.GetLongInfo( |
|
306 ETLV_BufferSize ); |
|
307 // Bearer description |
|
308 openChannelV2->iBearer.iType = ( RSat::TBearerType ) |
|
309 bearerDescription.GetShortInfo( ETLV_BearerType ); |
|
310 openChannelV2->iBearer.iParams = bearerDescription.GetData( |
|
311 ETLV_BearerParameters ); |
|
312 // Proactive command number |
|
313 openChannelV2->SetPCmdNumber( pCmdNumber ); |
|
314 |
|
315 // Link Establishment, obtained from Command details Bit 1 |
|
316 // Get command qualifier |
|
317 TUint8 cmdQualifier( commandDetails.GetShortInfo( |
|
318 ETLV_CommandQualifier ) ); |
|
319 if ( 0x01 & cmdQualifier ) |
|
320 { |
|
321 openChannelV2->iLinkEst = RSat::EImmediate; |
|
322 } |
|
323 else |
|
324 { |
|
325 openChannelV2->iLinkEst = RSat::EOnDemand; |
|
326 } |
|
327 // Reconnection mode, obtained from Command details Bit 2 |
|
328 if ( 0x02 & cmdQualifier ) |
|
329 { |
|
330 openChannelV2->iReconnectionMode = |
|
331 RSat::EAutomaticReconnection; |
|
332 } |
|
333 else |
|
334 { |
|
335 openChannelV2->iReconnectionMode = |
|
336 RSat::ENoAutomaticReconnection; |
|
337 } |
|
338 |
|
339 // Alpha Id (Optional) |
|
340 TPtrC8 sourceString; // Used with conversions |
|
341 CTlv alphaIdentifier; |
|
342 // Get alpha id tlv from berTlv |
|
343 TInt returnValue( berTlv.TlvByTagValue( &alphaIdentifier, |
|
344 KTlvAlphaIdentifierTag ) ); |
|
345 // If alpha id string exist |
|
346 if ( KErrNone == returnValue ) |
|
347 { |
|
348 if ( alphaIdentifier.GetLength() ) |
|
349 { |
|
350 // 8-bit string to 16-bit string |
|
351 sourceString.Set( alphaIdentifier.GetData( |
|
352 ETLV_AlphaIdentifier ) ); |
|
353 // Convert and set the alpha id |
|
354 TSatUtility::SetAlphaId( sourceString, |
|
355 openChannelV2->iAlphaId.iAlphaId ); |
|
356 // Set alpha id status |
|
357 openChannelV2->iAlphaId.iStatus = RSat::EAlphaIdProvided; |
|
358 } |
|
359 else |
|
360 { |
|
361 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
362 CompleteNotifyL, Alpha ID is NULL"); |
|
363 openChannelV2->iAlphaId.iStatus = RSat::EAlphaIdNull; |
|
364 } |
|
365 } |
|
366 // Alpha id not present |
|
367 else |
|
368 { |
|
369 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL,\ |
|
370 Alpha ID not present"); |
|
371 openChannelV2->iAlphaId.iStatus = RSat::EAlphaIdNotPresent; |
|
372 } |
|
373 |
|
374 |
|
375 // Iconid (optional) |
|
376 TSatUtility::FillIconStructure( berTlv, |
|
377 openChannelV2->iIconId ); |
|
378 |
|
379 // SIM/ME interface transport level |
|
380 CTlv simMeInterfaceTlv; |
|
381 returnValue = berTlv.TlvByTagValue( &simMeInterfaceTlv, |
|
382 KTlvSimMeTransportLevelTag ); |
|
383 |
|
384 if ( KErrNone == returnValue ) |
|
385 { |
|
386 openChannelV2->iSimMeInterface.iPrtNumber = |
|
387 simMeInterfaceTlv.GetLongInfo( ETLV_PortNumber ); |
|
388 TUint8 protocol = simMeInterfaceTlv.GetShortInfo( |
|
389 ETLV_TransportProtocolType ); |
|
390 |
|
391 switch ( protocol ) |
|
392 { |
|
393 case 0x01: |
|
394 { |
|
395 openChannelV2->iSimMeInterface.iTransportProto = |
|
396 RSat::EUdp; |
|
397 break; |
|
398 } |
|
399 case 0x02: |
|
400 { |
|
401 openChannelV2->iSimMeInterface.iTransportProto = |
|
402 RSat::ETcp; |
|
403 break; |
|
404 } |
|
405 default: |
|
406 { |
|
407 openChannelV2->iSimMeInterface.iTransportProto = |
|
408 RSat::EProtocolNotSet; |
|
409 } |
|
410 } |
|
411 } |
|
412 else |
|
413 { |
|
414 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL,\ |
|
415 Protocol not present"); |
|
416 openChannelV2->iSimMeInterface.iTransportProto = |
|
417 RSat::EProtocolNotPresent; |
|
418 } |
|
419 |
|
420 // Data destination address |
|
421 // The Data Destination Address is the end point destination |
|
422 // address of sent data. This data destination address is |
|
423 // requested when a SIM/ME interface transport is present, |
|
424 // otherwise it is ignored |
|
425 |
|
426 // Determine the number of Other Address tags, if there is one |
|
427 // and no SIM/ME interface then this is a Local Address |
|
428 // But if there is one and SIM/ME interface, this is a |
|
429 // Destination address, |
|
430 // And if there are 2, then the last one is the destination |
|
431 // address. |
|
432 |
|
433 CTlv* dataDestAddressTlv=NULL; |
|
434 CTlv* localAddressTlv=NULL; |
|
435 CTlv localAddress1; |
|
436 CTlv localAddress2; |
|
437 TInt ret_laddr1 = berTlv.TlvByTagValue( &localAddress1, |
|
438 KTlvOtherAddressTag ); |
|
439 TInt ret_laddr2 = berTlv.TlvByTagValue( &localAddress2, |
|
440 KTlvOtherAddressTag, 1 ); |
|
441 |
|
442 if ( ( RSat::EProtocolNotPresent != |
|
443 openChannelV2->iSimMeInterface.iTransportProto ) |
|
444 && ( KErrNone == ret_laddr1 ) |
|
445 && ( KErrNotFound == ret_laddr2 ) ) |
|
446 { |
|
447 // Destination Address is localAddress1, no local address |
|
448 dataDestAddressTlv = &localAddress1; |
|
449 } |
|
450 else if ( ( RSat::EProtocolNotPresent != |
|
451 openChannelV2->iSimMeInterface.iTransportProto ) |
|
452 && ( KErrNone == ret_laddr1 ) |
|
453 && ( KErrNone == ret_laddr2 ) ) |
|
454 { |
|
455 // Local address is localAddress1 |
|
456 localAddressTlv = &localAddress1; |
|
457 // Destination Address is localAddress2 |
|
458 dataDestAddressTlv = &localAddress2; |
|
459 } |
|
460 else if ( ( RSat::EProtocolNotPresent == |
|
461 openChannelV2->iSimMeInterface.iTransportProto ) |
|
462 && ( KErrNone == ret_laddr1 ) ) |
|
463 { |
|
464 // There is only a local address, which is localAddress1 |
|
465 localAddressTlv = &localAddress1; |
|
466 } |
|
467 |
|
468 // Set Destination address |
|
469 if( dataDestAddressTlv ) |
|
470 { |
|
471 TUint8 typeOfAddress = dataDestAddressTlv->GetShortInfo( |
|
472 ETLV_TypeOfAddress ); |
|
473 |
|
474 switch( typeOfAddress ) |
|
475 { |
|
476 case KIPV4: // IPv4 |
|
477 { |
|
478 openChannelV2->iDestinationAddress.iType = |
|
479 RSat::EIPv4Address; |
|
480 break; |
|
481 } |
|
482 case KIPV6: // IPv6 |
|
483 { |
|
484 openChannelV2->iDestinationAddress.iType = |
|
485 RSat::EIPv6Address; |
|
486 break; |
|
487 } |
|
488 default: |
|
489 { |
|
490 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
491 CompleteNotifyL, Address not set"); |
|
492 openChannelV2->iDestinationAddress.iType = |
|
493 RSat::EAddressNotSet; |
|
494 break; |
|
495 } |
|
496 } |
|
497 //Is there an address |
|
498 if( dataDestAddressTlv->GetLength() - 1 ) |
|
499 { |
|
500 openChannelV2->iDestinationAddress.iAddress = |
|
501 dataDestAddressTlv->GetData( ETLV_Address ); |
|
502 } |
|
503 } |
|
504 else |
|
505 { |
|
506 openChannelV2->iDestinationAddress.iType = |
|
507 RSat::EAddressNotPresent; |
|
508 } |
|
509 |
|
510 // Set Local address (Other Address) |
|
511 if ( localAddressTlv ) |
|
512 { |
|
513 CTlv bearerDescription; |
|
514 if ( KErrNone == berTlv.TlvByTagValue( &bearerDescription, |
|
515 KTlvBearerDescriptionTag ) ) |
|
516 { |
|
517 switch ( bearerDescription.GetShortInfo( |
|
518 ETLV_BearerType ) ) |
|
519 { |
|
520 case KBipCsdBearer: |
|
521 { |
|
522 RSat::TOpenCsChannelV2& openCsChannelV2 |
|
523 = ( *iOpenCsChannelV2Pckg )(); |
|
524 openCsChannelV2.iLocalAddress.iAddress = |
|
525 localAddressTlv->GetData( ETLV_Address ); |
|
526 TUint8 typeOfAddress = localAddressTlv-> |
|
527 GetShortInfo( ETLV_TypeOfAddress ); |
|
528 |
|
529 switch ( typeOfAddress ) |
|
530 { |
|
531 case KIPV4: |
|
532 { |
|
533 openCsChannelV2.iLocalAddress.iType = |
|
534 RSat::EIPv4Address; |
|
535 break; |
|
536 } |
|
537 case KIPV6: |
|
538 { |
|
539 openCsChannelV2.iLocalAddress.iType = |
|
540 RSat::EIPv6Address; |
|
541 break; |
|
542 } |
|
543 default: |
|
544 { |
|
545 TFLOGSTRING("CSAT:\ |
|
546 CSatNotifyOpenChannel::\ |
|
547 CompleteNotifyL, Address not set"); |
|
548 openCsChannelV2.iLocalAddress.iType = |
|
549 RSat::EAddressNotSet; |
|
550 } |
|
551 } |
|
552 |
|
553 // Is there an address |
|
554 if( localAddressTlv->GetLength() - 1 ) |
|
555 { |
|
556 openCsChannelV2.iLocalAddress.iAddress = |
|
557 localAddressTlv->GetData( ETLV_Address ); |
|
558 } |
|
559 else |
|
560 { |
|
561 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
562 CompleteNotifyL, Address not present"); |
|
563 openCsChannelV2.iLocalAddress.iType = |
|
564 RSat::EAddressNotPresent; |
|
565 } |
|
566 |
|
567 break; |
|
568 } |
|
569 case KBipGprsBearer: |
|
570 { |
|
571 RSat::TOpenGprsChannelV4& openGprsChannelV4 |
|
572 = ( *iOpenGprsChannelV4Pckg )(); |
|
573 openGprsChannelV4.iLocalAddress.iAddress = |
|
574 localAddressTlv->GetData( ETLV_Address ); |
|
575 TUint8 typeOfAddress = localAddressTlv-> |
|
576 GetShortInfo( ETLV_TypeOfAddress ); |
|
577 |
|
578 switch ( typeOfAddress ) |
|
579 { |
|
580 case KIPV4: |
|
581 { |
|
582 openGprsChannelV4.iLocalAddress.iType = |
|
583 RSat::EIPv4Address; |
|
584 break; |
|
585 } |
|
586 case KIPV6: |
|
587 { |
|
588 openGprsChannelV4.iLocalAddress.iType = |
|
589 RSat::EIPv6Address; |
|
590 break; |
|
591 } |
|
592 default: |
|
593 { |
|
594 TFLOGSTRING("CSAT: \ |
|
595 CSatNotifyOpenChannel::\ |
|
596 CompleteNotifyL, Address not set"); |
|
597 openGprsChannelV4.iLocalAddress.iType = |
|
598 RSat::EAddressNotSet; |
|
599 } |
|
600 } |
|
601 |
|
602 // Is there an address |
|
603 if( localAddressTlv->GetLength() - 1 ) |
|
604 { |
|
605 openGprsChannelV4.iLocalAddress.iAddress = |
|
606 localAddressTlv->GetData( |
|
607 ETLV_Address ); |
|
608 } |
|
609 else |
|
610 { |
|
611 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
612 CompleteNotifyL, Address not present"); |
|
613 openGprsChannelV4.iLocalAddress.iType = |
|
614 RSat::EAddressNotPresent; |
|
615 } |
|
616 |
|
617 break; |
|
618 } |
|
619 default: |
|
620 { |
|
621 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::\ |
|
622 CompleteNotifyL, Unknown Bearer type"); |
|
623 break; |
|
624 } |
|
625 |
|
626 } // Switch-case |
|
627 } // If bearer description tag exists |
|
628 } // if ( localAddressTlv ) |
|
629 } // if ( KErrNone == ret ) |
|
630 else |
|
631 { |
|
632 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL,\ |
|
633 Error when parsing Bearer data"); |
|
634 } |
|
635 } // if ( KErrNone == aErrorCode ) |
|
636 else |
|
637 { |
|
638 ret = aErrorCode; |
|
639 } |
|
640 |
|
641 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
|
642 } // if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
|
643 else |
|
644 { |
|
645 // Request not on, returning response immediately |
|
646 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::CompleteNotifyL, \ |
|
647 Request not ongoing"); |
|
648 // additional info must be provided with KMeUnableToProcessCmd |
|
649 TBuf16<1> additionalInfo; |
|
650 additionalInfo.Append( RSat::KNoSpecificMeProblem ); |
|
651 iBearer.FillZ( 1 ); |
|
652 iBufferSize = 0; |
|
653 iBearerType = static_cast<TUint8>( RSat::EBearerTypeNotSet ); |
|
654 CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, |
|
655 additionalInfo ); |
|
656 ret = KErrCorrupt; |
|
657 } |
|
658 return ret; |
|
659 } |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CSatNotifyOpenChannel::TerminalResponseL |
|
662 // Called by ETel server, passes terminal response to DOS |
|
663 // ----------------------------------------------------------------------------- |
|
664 // |
|
665 TInt CSatNotifyOpenChannel::TerminalResponseL |
|
666 ( |
|
667 TDes8* aRsp |
|
668 ) |
|
669 { |
|
670 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::TerminalResponseL"); |
|
671 |
|
672 TInt ret( KErrNone ); |
|
673 |
|
674 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
|
675 |
|
676 RSat::TOpenChannelRspV2Pckg* aRspPckg = |
|
677 REINTERPRET_CAST( RSat::TOpenChannelRspV2Pckg*, aRsp); |
|
678 RSat::TOpenChannelRspV2& rspV2 = ( *aRspPckg ) (); |
|
679 |
|
680 TUint8 pCmdNumber( rspV2.PCmdNumber() ); |
|
681 |
|
682 TFLOGSTRING2("CSAT: CSatNotifyOpenChannel::TerminalResponseL, \ |
|
683 General result: %d", rspV2.iGeneralResult); |
|
684 |
|
685 // Check that general result value is valid |
|
686 if ( ( RSat::KSuccess != rspV2.iGeneralResult ) |
|
687 && ( RSat::KPartialComprehension != rspV2.iGeneralResult ) |
|
688 && ( RSat::KMissingInformation != rspV2.iGeneralResult ) |
|
689 && ( RSat::KSuccessRequestedIconNotDisplayed != rspV2.iGeneralResult ) |
|
690 && ( RSat::KPerformedWithModifications != rspV2.iGeneralResult ) |
|
691 && ( RSat::KRefreshUSIMNotActive != rspV2.iGeneralResult ) |
|
692 && ( RSat::KPSessionTerminatedByUser != rspV2.iGeneralResult ) |
|
693 && ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult ) |
|
694 && ( RSat::KNetworkUnableToProcessCmd != rspV2.iGeneralResult ) |
|
695 && ( RSat::KPCmdNotAcceptedByUser != rspV2.iGeneralResult ) |
|
696 && ( RSat::KInteractionWithCCTemporaryError != rspV2.iGeneralResult ) |
|
697 && ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult ) |
|
698 && ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult ) |
|
699 && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) |
|
700 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
|
701 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) |
|
702 && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) |
|
703 && ( RSat::KAccessTechUnableProcessCmd != rspV2.iGeneralResult ) |
|
704 && ( RSat::KFramesError != rspV2.iGeneralResult ) ) |
|
705 { |
|
706 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::TerminalResponseL, \ |
|
707 Invalid General Result"); |
|
708 // Invalid general result |
|
709 ret = KErrCorrupt; |
|
710 } |
|
711 |
|
712 // Check for additional info type |
|
713 // - If there is ME (Mobile Equipment) error, additional info is needed |
|
714 // - Channel Status Info is sent through additional info |
|
715 if ( ( RSat::KMeProblem == rspV2.iInfoType ) || |
|
716 ( RSat::KChannelStatusInfo == rspV2.iInfoType ) ) |
|
717 { |
|
718 // Check the length of additional info |
|
719 if ( rspV2.iAdditionalInfo.Length() <= 0 ) |
|
720 { |
|
721 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::TerminalResponseL, \ |
|
722 Invalid Additional Info"); |
|
723 // Invalid additional info field |
|
724 ret = KErrCorrupt; |
|
725 } |
|
726 else |
|
727 { |
|
728 additionalInfo.Copy(rspV2.iAdditionalInfo); |
|
729 } |
|
730 } |
|
731 else if ( RSat::KSatNetworkErrorInfo == rspV2.iInfoType ) |
|
732 { |
|
733 // Copy the additional info, if present |
|
734 if ( rspV2.iAdditionalInfo.Length() > 0 ) |
|
735 { |
|
736 additionalInfo.Copy(rspV2.iAdditionalInfo); |
|
737 } |
|
738 } |
|
739 else if ( RSat::KNoAdditionalInfo == rspV2.iInfoType ) |
|
740 { |
|
741 // Do nothing |
|
742 } |
|
743 else |
|
744 { |
|
745 TFLOGSTRING("CSAT: CSatNotifyOpenChannel::TerminalResponseL, \ |
|
746 Invalid Additional Info type"); |
|
747 ret = KErrCorrupt; |
|
748 } |
|
749 |
|
750 iBearerType = static_cast<TUint8>(rspV2.iBearer.iType); |
|
751 iBearer.Copy( rspV2.iBearer.iParams ); |
|
752 iBufferSize = rspV2.iBufferSize; |
|
753 // Send Terminal Response |
|
754 TInt response = CreateTerminalRespL( pCmdNumber, |
|
755 static_cast<TUint8>( rspV2.iGeneralResult ), additionalInfo ); |
|
756 |
|
757 if ( KErrNone == ret ) |
|
758 ret = response; |
|
759 |
|
760 return ret; |
|
761 } |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // CSatNotifyOpenChannel::CreateTerminalRespL |
|
765 // Constructs Open channel specific part of terminal response and calls |
|
766 // DOS to send the actual message. |
|
767 // ----------------------------------------------------------------------------- |
|
768 // |
|
769 TInt CSatNotifyOpenChannel::CreateTerminalRespL |
|
770 ( |
|
771 TUint8 aPCmdNumber, |
|
772 TUint8 aGeneralResult, |
|
773 const TDesC16& aAdditionalInfo |
|
774 ) |
|
775 { |
|
776 TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL"); |
|
777 // Create and append response data |
|
778 TTlv tlvSpecificData; |
|
779 // Create General Result TLV here |
|
780 tlvSpecificData.AddTag( KTlvResultTag ); |
|
781 // General result |
|
782 tlvSpecificData.AddByte( aGeneralResult ); |
|
783 |
|
784 if ( ( RSat::KSuccess == aGeneralResult ) |
|
785 || ( RSat::KPartialComprehension == aGeneralResult ) |
|
786 || ( RSat::KMissingInformation == aGeneralResult ) |
|
787 || ( RSat::KPerformedWithModifications == aGeneralResult ) |
|
788 || ( RSat::KSuccessRequestedIconNotDisplayed == aGeneralResult ) ) |
|
789 { |
|
790 // Successful result: append Channel Status using additional info. |
|
791 for ( TInt i = 1; i < aAdditionalInfo.Length(); i += 2 ) |
|
792 { |
|
793 tlvSpecificData.AddTag( KTlvChannelStatusTag ); |
|
794 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i-1] ) ); |
|
795 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) ); |
|
796 } |
|
797 } |
|
798 else |
|
799 { |
|
800 // Successful result: could/must provide an additional info byte |
|
801 if ( aAdditionalInfo.Length() > 0 ) |
|
802 { |
|
803 TFLOGSTRING2("CSAT: CSatMessHandler::CreateTerminalRespL,\ |
|
804 Unsuccessful result: aAddtionalInfo: %d", aAdditionalInfo[0]); |
|
805 tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[0] ) ); |
|
806 } |
|
807 } |
|
808 |
|
809 // For any result: Append Bearer Description data |
|
810 if ( iBearer.Length() ) |
|
811 { |
|
812 tlvSpecificData.AddTag( KTlvBearerDescriptionTag ); |
|
813 tlvSpecificData.AddByte( iBearerType ); |
|
814 tlvSpecificData.AddData( iBearer ); |
|
815 } |
|
816 else |
|
817 { |
|
818 TFLOGSTRING("CSAT: CSatMessHandler::CreateTerminalRespL: \ |
|
819 No Bearer Description data available"); |
|
820 } |
|
821 |
|
822 // Append Buffer Size |
|
823 tlvSpecificData.AddTag( KTlvBufferSizeTag ); |
|
824 tlvSpecificData.AddByte( TUint8( ( iBufferSize & 0xFF00 ) >> 8 ) ); |
|
825 tlvSpecificData.AddByte( TUint8( iBufferSize & 0x00FF ) ); |
|
826 |
|
827 // Prepare data |
|
828 iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber; |
|
829 TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag(); |
|
830 |
|
831 // Pack data |
|
832 CSatDataPackage dataPackage; |
|
833 dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data ); |
|
834 |
|
835 // Forward request to the DOS |
|
836 return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( |
|
837 ESatTerminalRsp, &dataPackage ); |
|
838 } |
|
839 |
|
840 // End of file |
|
841 |