1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 // |
18 // |
19 |
19 |
20 |
20 |
21 |
21 |
22 //INCLUDES |
22 //INCLUDES |
|
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "CSatNotifyCloseChannelTraces.h" |
|
27 #endif |
|
28 |
23 #include <satcs.h> // Etel SAT IPC definitions |
29 #include <satcs.h> // Etel SAT IPC definitions |
24 #include "CSatTsy.h" // Tsy class header |
30 #include "CSatTsy.h" // Tsy class header |
25 #include "CSatNotifyCloseChannel.h" // Class header |
31 #include "CSatNotifyCloseChannel.h" // Class header |
26 #include "CSatNotificationsTsy.h" // Tsy class header |
32 #include "CSatNotificationsTsy.h" // Tsy class header |
27 #include "CBerTlv.h" // Ber Tlv data handling |
33 #include "CBerTlv.h" // Ber Tlv data handling |
28 #include "TTlv.h" // TTlv class |
34 #include "TTlv.h" // TTlv class |
29 #include "CSatDataPackage.h" // Parameter packing |
35 #include "CSatDataPackage.h" // Parameter packing |
30 #include "TfLogger.h" // For TFLOGSTRING |
|
31 #include "TSatUtility.h" // Utilities |
36 #include "TSatUtility.h" // Utilities |
32 #include "CSatTsyReqHandleStore.h" // Request handle class |
37 #include "CSatTsyReqHandleStore.h" // Request handle class |
33 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
38 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
34 |
39 |
35 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
40 CSatNotifyCloseChannel* CSatNotifyCloseChannel::NewL |
45 CSatNotifyCloseChannel* CSatNotifyCloseChannel::NewL |
41 ( |
46 ( |
42 CSatNotificationsTsy* aNotificationsTsy |
47 CSatNotificationsTsy* aNotificationsTsy |
43 ) |
48 ) |
44 { |
49 { |
45 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::NewL"); |
50 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_NEWL_1, "CSAT: CSatNotifyCloseChannel::NewL"); |
46 CSatNotifyCloseChannel* const satNotifyCloseChannel = |
51 CSatNotifyCloseChannel* const satNotifyCloseChannel = |
47 new ( ELeave ) CSatNotifyCloseChannel( aNotificationsTsy ); |
52 new ( ELeave ) CSatNotifyCloseChannel( aNotificationsTsy ); |
48 CleanupStack::PushL( satNotifyCloseChannel ); |
53 CleanupStack::PushL( satNotifyCloseChannel ); |
49 satNotifyCloseChannel->ConstructL(); |
54 satNotifyCloseChannel->ConstructL(); |
50 CleanupStack::Pop( satNotifyCloseChannel ); |
55 CleanupStack::Pop( satNotifyCloseChannel ); |
51 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::NewL, end of method"); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_NEWL_2, "CSAT: CSatNotifyCloseChannel::NewL, end of method"); |
52 return satNotifyCloseChannel; |
57 return satNotifyCloseChannel; |
53 } |
58 } |
54 |
59 |
55 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
56 // CSatNotifyCloseChannel::~CSatNotifyCloseChannel |
61 // CSatNotifyCloseChannel::~CSatNotifyCloseChannel |
60 CSatNotifyCloseChannel::~CSatNotifyCloseChannel |
65 CSatNotifyCloseChannel::~CSatNotifyCloseChannel |
61 ( |
66 ( |
62 // None |
67 // None |
63 ) |
68 ) |
64 { |
69 { |
65 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel"); |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_DTOR_1, "CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel"); |
66 } |
71 } |
67 |
72 |
68 // ----------------------------------------------------------------------------- |
73 // ----------------------------------------------------------------------------- |
69 // CSatNotifyCloseChannel::CSatNotifyCloseChannel |
74 // CSatNotifyCloseChannel::CSatNotifyCloseChannel |
70 // Default C++ constructor |
75 // Default C++ constructor |
86 void CSatNotifyCloseChannel::ConstructL |
91 void CSatNotifyCloseChannel::ConstructL |
87 ( |
92 ( |
88 // None |
93 // None |
89 ) |
94 ) |
90 { |
95 { |
91 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel, \ |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CONSTRUCTL_1, "CSAT: CSatNotifyCloseChannel::~CSatNotifyCloseChannel, does nothing"); |
92 does nothing"); |
|
93 } |
97 } |
94 |
98 |
95 // ----------------------------------------------------------------------------- |
99 // ----------------------------------------------------------------------------- |
96 // CSatNotifyCloseChannel::Notify |
100 // CSatNotifyCloseChannel::Notify |
97 // This request allows a client to be notified of a CLOSE CHANNEL proactive |
101 // This request allows a client to be notified of a CLOSE CHANNEL proactive |
102 ( |
106 ( |
103 const TTsyReqHandle aTsyReqHandle, |
107 const TTsyReqHandle aTsyReqHandle, |
104 const TDataPackage& aPackage |
108 const TDataPackage& aPackage |
105 ) |
109 ) |
106 { |
110 { |
107 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::Notify"); |
111 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_NOTIFY_1, "CSAT: CSatNotifyCloseChannel::Notify"); |
108 |
112 |
109 // Save data pointer to client side for completion |
113 // Save data pointer to client side for completion |
110 iCloseChannelRspV2Pckg = reinterpret_cast<RSat::TCloseChannelV2Pckg*>( |
114 iCloseChannelRspV2Pckg = reinterpret_cast<RSat::TCloseChannelV2Pckg*>( |
111 aPackage.Des1n() ); |
115 aPackage.Des1n() ); |
112 // Save the request handle |
116 // Save the request handle |
127 TInt CSatNotifyCloseChannel::CancelNotification |
131 TInt CSatNotifyCloseChannel::CancelNotification |
128 ( |
132 ( |
129 const TTsyReqHandle aTsyReqHandle |
133 const TTsyReqHandle aTsyReqHandle |
130 ) |
134 ) |
131 { |
135 { |
132 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CancelNotification"); |
136 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CANCELNOTIFICATION_1, "CSAT: CSatNotifyCloseChannel::CancelNotification"); |
133 // Reset the request handle |
137 // Reset the request handle |
134 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
138 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
135 ResetTsyReqHandle( CSatTsy::ESatNotifyCloseChannelPCmdReqType ); |
139 ResetTsyReqHandle( CSatTsy::ESatNotifyCloseChannelPCmdReqType ); |
136 // Reset the data pointers |
140 // Reset the data pointers |
137 iCloseChannelRspV2Pckg = NULL; |
141 iCloseChannelRspV2Pckg = NULL; |
150 ( |
154 ( |
151 CSatDataPackage* aDataPackage, |
155 CSatDataPackage* aDataPackage, |
152 TInt aErrorCode |
156 TInt aErrorCode |
153 ) |
157 ) |
154 { |
158 { |
155 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL"); |
159 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_1, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL"); |
156 TInt ret( KErrNone ); |
160 TInt ret( KErrNone ); |
157 // Unpack parameters |
161 // Unpack parameters |
158 TPtrC8* data; |
162 TPtrC8* data; |
159 aDataPackage->UnPackData( &data ); |
163 aDataPackage->UnPackData( &data ); |
160 // Reset req handle. Returns the deleted req handle |
164 // Reset req handle. Returns the deleted req handle |
200 returnValue = berTlv.TlvByTagValue( &alphaIdentifier, |
204 returnValue = berTlv.TlvByTagValue( &alphaIdentifier, |
201 KTlvAlphaIdentifierTag ) ; |
205 KTlvAlphaIdentifierTag ) ; |
202 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNotPresent; |
206 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNotPresent; |
203 if ( KErrNotFound != returnValue ) |
207 if ( KErrNotFound != returnValue ) |
204 { |
208 { |
205 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\ |
209 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_2, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID present"); |
206 Alpha ID present"); |
|
207 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
210 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
208 if ( alphaIdLength ) |
211 if ( alphaIdLength ) |
209 { |
212 { |
210 // Get the alpha id |
213 // Get the alpha id |
211 TPtrC8 sourceString; |
214 TPtrC8 sourceString; |
221 { |
224 { |
222 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
225 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
223 } |
226 } |
224 else |
227 else |
225 { |
228 { |
226 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\ |
229 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_3, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID is NULL"); |
227 Alpha ID is NULL"); |
|
228 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
230 closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
229 } |
231 } |
230 } |
232 } |
231 |
233 |
232 // Icon Id (Optional) |
234 // Icon Id (Optional) |
234 closeChannelV2.iIconId ); |
236 closeChannelV2.iIconId ); |
235 } // if ( KErrNone == returnValue ) |
237 } // if ( KErrNone == returnValue ) |
236 else |
238 else |
237 { |
239 { |
238 // Required values missing |
240 // Required values missing |
239 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL,\ |
241 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_4, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL, required values missing (Device Identities)"); |
240 required values missing (Device Identities)"); |
|
241 ret = KErrCorrupt; |
242 ret = KErrCorrupt; |
242 CreateTerminalRespL( pCmdNumber, RSat::KErrorRequiredValuesMissing, KNullDesC16 ); |
243 CreateTerminalRespL( pCmdNumber, RSat::KErrorRequiredValuesMissing, KNullDesC16 ); |
243 } |
244 } |
244 } // if ( KErrNone == aErrorCode ) |
245 } // if ( KErrNone == aErrorCode ) |
245 else |
246 else |
249 // Complete request |
250 // Complete request |
250 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
251 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
251 } |
252 } |
252 else |
253 else |
253 { |
254 { |
254 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CompleteNotifyL\ |
255 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_5, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Request not ongoing"); |
255 Request not ongoing"); |
|
256 // Request not on, returning response immediately |
256 // Request not on, returning response immediately |
257 TBuf16<1> additionalInfo; |
257 TBuf16<1> additionalInfo; |
258 additionalInfo.Append ( RSat::KNoSpecificMeProblem ); |
258 additionalInfo.Append ( RSat::KNoSpecificMeProblem ); |
259 CreateTerminalRespL( pCmdNumber,RSat::KMeUnableToProcessCmd, |
259 CreateTerminalRespL( pCmdNumber,RSat::KMeUnableToProcessCmd, |
260 additionalInfo ); |
260 additionalInfo ); |
271 TInt CSatNotifyCloseChannel::TerminalResponseL |
271 TInt CSatNotifyCloseChannel::TerminalResponseL |
272 ( |
272 ( |
273 TDes8* aRsp |
273 TDes8* aRsp |
274 ) |
274 ) |
275 { |
275 { |
276 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL"); |
276 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_1, "CSAT: CSatNotifyCloseChannel::TerminalResponseL"); |
277 TInt ret( KErrNone ); |
277 TInt ret( KErrNone ); |
278 |
278 |
279 TBuf16<1> additionalInfo; |
279 TBuf16<1> additionalInfo; |
280 RSat::TCloseChannelRspV2Pckg* aRspPckg = |
280 RSat::TCloseChannelRspV2Pckg* aRspPckg = |
281 reinterpret_cast<RSat::TCloseChannelRspV2Pckg*>( aRsp ); |
281 reinterpret_cast<RSat::TCloseChannelRspV2Pckg*>( aRsp ); |
296 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
296 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
297 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) |
297 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) |
298 && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) |
298 && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) |
299 && ( RSat::KFramesError != rspV2.iGeneralResult )) |
299 && ( RSat::KFramesError != rspV2.iGeneralResult )) |
300 { |
300 { |
301 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\ |
301 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_2, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid General Result"); |
302 Invalid General Result"); |
|
303 // Invalid general result |
302 // Invalid general result |
304 ret = KErrCorrupt; |
303 ret = KErrCorrupt; |
305 } |
304 } |
306 |
305 |
307 if ( RSat::KMeProblem == rspV2.iInfoType ) |
306 if ( RSat::KMeProblem == rspV2.iInfoType ) |
310 { |
309 { |
311 additionalInfo.Append( rspV2.iAdditionalInfo[0] ); |
310 additionalInfo.Append( rspV2.iAdditionalInfo[0] ); |
312 } |
311 } |
313 else |
312 else |
314 { |
313 { |
315 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\ |
314 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_3, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info"); |
316 Invalid Additional Info"); |
|
317 ret = KErrCorrupt; |
315 ret = KErrCorrupt; |
318 } |
316 } |
319 } |
317 } |
320 else if (RSat::KNoAdditionalInfo == rspV2.iInfoType ) |
318 else if (RSat::KNoAdditionalInfo == rspV2.iInfoType ) |
321 { |
319 { |
322 // do nothing |
320 // do nothing |
323 } |
321 } |
324 else |
322 else |
325 { |
323 { |
326 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::TerminalResponseL\ |
324 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_4, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info type"); |
327 Invalid Additional Info type"); |
|
328 ret = KErrCorrupt; |
325 ret = KErrCorrupt; |
329 } |
326 } |
330 |
327 |
331 TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( |
328 TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>( |
332 rspV2.iGeneralResult ), additionalInfo ); |
329 rspV2.iGeneralResult ), additionalInfo ); |
348 TUint8 aPCmdNumber, |
345 TUint8 aPCmdNumber, |
349 TUint8 aGeneralResult, |
346 TUint8 aGeneralResult, |
350 const TDesC16& aAdditionalInfo |
347 const TDesC16& aAdditionalInfo |
351 ) |
348 ) |
352 { |
349 { |
353 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CreateTerminalRespL"); |
350 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CREATETERMINALRESPL_1, "CSAT: CSatNotifyCloseChannel::CreateTerminalRespL"); |
354 TTlv tlvSpecificData; |
351 TTlv tlvSpecificData; |
355 // Append general result tag |
352 // Append general result tag |
356 tlvSpecificData.AddTag( KTlvResultTag ); |
353 tlvSpecificData.AddTag( KTlvResultTag ); |
357 // Append general result |
354 // Append general result |
358 tlvSpecificData.AddByte( aGeneralResult ); |
355 tlvSpecificData.AddByte( aGeneralResult ); |
365 || ( RSat::KFramesError == aGeneralResult )) |
362 || ( RSat::KFramesError == aGeneralResult )) |
366 { |
363 { |
367 // Unsuccessful result requires an additional info byte |
364 // Unsuccessful result requires an additional info byte |
368 for ( TInt i = 0; i < aAdditionalInfo.Length(); i++ ) |
365 for ( TInt i = 0; i < aAdditionalInfo.Length(); i++ ) |
369 { |
366 { |
370 TFLOGSTRING("CSAT: CSatNotifyCloseChannel::CreateTerminalRespL,\ |
367 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_CREATETERMINALRESPL_2, "CSAT: CSatNotifyCloseChannel::CreateTerminalRespL, Unsuccessful result"); |
371 Unsuccessful result"); |
|
372 tlvSpecificData.AddByte( static_cast<TUint8>( |
368 tlvSpecificData.AddByte( static_cast<TUint8>( |
373 aAdditionalInfo[i] ) ); |
369 aAdditionalInfo[i] ) ); |
374 } |
370 } |
375 } |
371 } |
376 |
372 |