1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-2009 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 "CSatNotifySendDataTraces.h" |
|
27 #endif |
|
28 |
|
29 #include <satcs.h> // Etel SAT IPC definitions |
23 #include <satcs.h> // Etel SAT IPC definitions |
30 #include "CSatTsy.h" // Tsy class header |
24 #include "CSatTsy.h" // Tsy class header |
31 #include "CSatNotifySendData.h" // Class header |
25 #include "CSatNotifySendData.h" // Class header |
32 #include "CSatNotificationsTsy.h" // Tsy class header |
26 #include "CSatNotificationsTsy.h" // Tsy class header |
33 #include "CBerTlv.h" // Ber Tlv data handling |
27 #include "CBerTlv.h" // Ber Tlv data handling |
34 #include "TTlv.h" // TTlv class |
28 #include "TTlv.h" // TTlv class |
35 #include "CSatDataPackage.h" // Parameter packing |
29 #include "CSatDataPackage.h" // Parameter packing |
|
30 #include "TfLogger.h" // For TFLOGSTRING |
36 #include "TSatUtility.h" // Utilities |
31 #include "TSatUtility.h" // Utilities |
37 #include "CSatTsyReqHandleStore.h" // Request handle class |
32 #include "CSatTsyReqHandleStore.h" // Request handle class |
38 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
33 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
39 |
34 |
40 // ----------------------------------------------------------------------------- |
35 // ----------------------------------------------------------------------------- |
45 CSatNotifySendData* CSatNotifySendData::NewL |
40 CSatNotifySendData* CSatNotifySendData::NewL |
46 ( |
41 ( |
47 CSatNotificationsTsy* aNotificationsTsy |
42 CSatNotificationsTsy* aNotificationsTsy |
48 ) |
43 ) |
49 { |
44 { |
50 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_NEWL_1, "CSAT: CSatNotifySendData::NewL"); |
45 TFLOGSTRING("CSAT: CSatNotifySendData::NewL"); |
51 CSatNotifySendData* const satNotifySendData = |
46 CSatNotifySendData* const satNotifySendData = |
52 new ( ELeave ) CSatNotifySendData( aNotificationsTsy ); |
47 new ( ELeave ) CSatNotifySendData( aNotificationsTsy ); |
53 CleanupStack::PushL( satNotifySendData ); |
48 CleanupStack::PushL( satNotifySendData ); |
54 satNotifySendData->ConstructL(); |
49 satNotifySendData->ConstructL(); |
55 CleanupStack::Pop( satNotifySendData ); |
50 CleanupStack::Pop( satNotifySendData ); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_NEWL_2, "CSAT: CSatNotifySendData::NewL, end of method"); |
51 TFLOGSTRING("CSAT: CSatNotifySendData::NewL, end of method"); |
57 return satNotifySendData; |
52 return satNotifySendData; |
58 } |
53 } |
59 |
54 |
60 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
61 // CSatNotifySendData::~CSatNotifySendData |
56 // CSatNotifySendData::~CSatNotifySendData |
65 CSatNotifySendData::~CSatNotifySendData |
60 CSatNotifySendData::~CSatNotifySendData |
66 ( |
61 ( |
67 // None |
62 // None |
68 ) |
63 ) |
69 { |
64 { |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_DTOR_1, "CSAT: CSatNotifySendData::~CSatNotifySendData"); |
65 TFLOGSTRING("CSAT: CSatNotifySendData::~CSatNotifySendData"); |
71 } |
66 } |
72 |
67 |
73 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
74 // CSatNotifySendData::CSatNotifySendData |
69 // CSatNotifySendData::CSatNotifySendData |
75 // Default C++ constructor |
70 // Default C++ constructor |
91 void CSatNotifySendData::ConstructL |
86 void CSatNotifySendData::ConstructL |
92 ( |
87 ( |
93 // None |
88 // None |
94 ) |
89 ) |
95 { |
90 { |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_CONSTRUCTL_1, "CSAT: CSatNotifySendData::ConstructL, does nothing"); |
91 TFLOGSTRING("CSAT: CSatNotifySendData::ConstructL, does nothing"); |
97 } |
92 } |
98 |
93 |
99 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
100 // CSatNotifySendData::Notify |
95 // CSatNotifySendData::Notify |
101 // This request allows a client to be notified of a SEND DATA proactive |
96 // This request allows a client to be notified of a SEND DATA proactive |
106 ( |
101 ( |
107 const TTsyReqHandle aTsyReqHandle, |
102 const TTsyReqHandle aTsyReqHandle, |
108 const TDataPackage& aPackage |
103 const TDataPackage& aPackage |
109 ) |
104 ) |
110 { |
105 { |
111 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_NOTIFY_1, "CSAT: CSatNotifySendData::Notify"); |
106 TFLOGSTRING("CSAT: CSatNotifySendData::Notify"); |
112 // Save data pointer to client side for completion |
107 // Save data pointer to client side for completion |
113 iSendDataRspV2Pckg = reinterpret_cast<RSat::TSendDataV2Pckg*>( |
108 iSendDataRspV2Pckg = reinterpret_cast<RSat::TSendDataV2Pckg*>( |
114 aPackage.Des1n() ); |
109 aPackage.Des1n() ); |
115 // Save the request handle |
110 // Save the request handle |
116 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
111 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
129 TInt CSatNotifySendData::CancelNotification |
124 TInt CSatNotifySendData::CancelNotification |
130 ( |
125 ( |
131 const TTsyReqHandle aTsyReqHandle |
126 const TTsyReqHandle aTsyReqHandle |
132 ) |
127 ) |
133 { |
128 { |
134 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_CANCELNOTIFICATION_1, "CSAT: CSatNotifySendData::CancelNotification"); |
129 TFLOGSTRING("CSAT: CSatNotifySendData::CancelNotification"); |
135 // Reset the request handle |
130 // Reset the request handle |
136 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
131 TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore-> |
137 ResetTsyReqHandle( CSatTsy::ESatNotifySendDataPCmdReqType ); |
132 ResetTsyReqHandle( CSatTsy::ESatNotifySendDataPCmdReqType ); |
138 // Reset the data pointers |
133 // Reset the data pointers |
139 iSendDataRspV2Pckg = NULL; |
134 iSendDataRspV2Pckg = NULL; |
152 ( |
147 ( |
153 CSatDataPackage* aDataPackage, |
148 CSatDataPackage* aDataPackage, |
154 TInt aErrorCode |
149 TInt aErrorCode |
155 ) |
150 ) |
156 { |
151 { |
157 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_COMPLETENOTIFYL_1, "CSAT: CSatNotifySendData::CompleteNotifyL"); |
152 TFLOGSTRING("CSAT: CSatNotifySendData::CompleteNotifyL"); |
158 TInt ret( KErrNone ); |
153 TInt ret( KErrNone ); |
159 TBuf<1> noAdditionalInfo( 0 ); |
154 TBuf<1> noAdditionalInfo( 0 ); |
160 // Unpack parameters |
155 // Unpack parameters |
161 TPtrC8* data; |
156 TPtrC8* data; |
162 aDataPackage->UnPackData( &data ); |
157 aDataPackage->UnPackData( &data ); |
226 TInt returnValue( berTlv.TlvByTagValue( &alphaIdentifier, |
221 TInt returnValue( berTlv.TlvByTagValue( &alphaIdentifier, |
227 KTlvAlphaIdentifierTag ) ); |
222 KTlvAlphaIdentifierTag ) ); |
228 |
223 |
229 if ( KErrNotFound != returnValue ) |
224 if ( KErrNotFound != returnValue ) |
230 { |
225 { |
231 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_COMPLETENOTIFYL_2, "CSAT: CSatNotifySendData::CompleteNotifyL Alpha ID found"); |
226 TFLOGSTRING("CSAT: CSatNotifySendData::CompleteNotifyL \ |
|
227 Alpha ID found"); |
232 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
228 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
233 if ( alphaIdLength ) |
229 if ( alphaIdLength ) |
234 { |
230 { |
235 // get the alpha id |
231 // get the alpha id |
236 TPtrC8 sourceString; |
232 TPtrC8 sourceString; |
241 sendDataV2.iAlphaId.iAlphaId ); |
237 sendDataV2.iAlphaId.iAlphaId ); |
242 sendDataV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
238 sendDataV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
243 } |
239 } |
244 else |
240 else |
245 { |
241 { |
246 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_COMPLETENOTIFYL_3, "CSAT: CSatNotifySendData::CompleteNotifyL Alpha id is NULL"); |
242 TFLOGSTRING("CSAT: CSatNotifySendData::CompleteNotifyL\ |
|
243 Alpha id is NULL"); |
247 sendDataV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
244 sendDataV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
248 } |
245 } |
249 } |
246 } |
250 |
247 |
251 // Icon Id (Optional) |
248 // Icon Id (Optional) |
253 sendDataV2.iIconId ); |
250 sendDataV2.iIconId ); |
254 |
251 |
255 } |
252 } |
256 else |
253 else |
257 { |
254 { |
258 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_COMPLETENOTIFYL_4, "CSAT: CSatNotifySendData::CompleteNotifyL Required values missing"); |
255 TFLOGSTRING("CSAT: CSatNotifySendData::CompleteNotifyL \ |
|
256 Required values missing"); |
259 // Required values missing |
257 // Required values missing |
260 TUint8 channelDataLength( 0 ); |
258 TUint8 channelDataLength( 0 ); |
261 CreateTerminalRespL( |
259 CreateTerminalRespL( |
262 pCmdNumber, RSat::KErrorRequiredValuesMissing, |
260 pCmdNumber, RSat::KErrorRequiredValuesMissing, |
263 KNullDesC16, channelDataLength ); |
261 KNullDesC16, channelDataLength ); |
272 // Complete request |
270 // Complete request |
273 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
271 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
274 } |
272 } |
275 else |
273 else |
276 { |
274 { |
277 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_COMPLETENOTIFYL_5, "CSAT: CSatNotifySendData::CompleteNotifyL Request not ongoing"); |
275 TFLOGSTRING("CSAT: CSatNotifySendData::CompleteNotifyL \ |
|
276 Request not ongoing"); |
278 // Request not on, returning response immediately |
277 // Request not on, returning response immediately |
279 TUint8 channelDataLength( 0 ); |
278 TUint8 channelDataLength( 0 ); |
280 TBuf16<1> additionalInfo; |
279 TBuf16<1> additionalInfo; |
281 additionalInfo.Append ( RSat::KNoSpecificMeProblem ); |
280 additionalInfo.Append ( RSat::KNoSpecificMeProblem ); |
282 CreateTerminalRespL( |
281 CreateTerminalRespL( |
295 TInt CSatNotifySendData::TerminalResponseL |
294 TInt CSatNotifySendData::TerminalResponseL |
296 ( |
295 ( |
297 TDes8* aRsp |
296 TDes8* aRsp |
298 ) |
297 ) |
299 { |
298 { |
300 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_TERMINALRESPONSEL_1, "CSAT: CSatNotifySendData::TerminalResponseL"); |
299 TFLOGSTRING("CSAT: CSatNotifySendData::TerminalResponseL"); |
301 TInt ret( KErrNone ); |
300 TInt ret( KErrNone ); |
302 |
301 |
303 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
302 TBuf16<RSat::KAdditionalInfoMaxSize> additionalInfo; |
304 |
303 |
305 RSat::TSendDataRspV2Pckg* aRspPckg = |
304 RSat::TSendDataRspV2Pckg* aRspPckg = |
321 && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) |
320 && ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult ) |
322 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
321 && ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult ) |
323 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) |
322 && ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult ) |
324 && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) ) |
323 && ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult ) ) |
325 { |
324 { |
326 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_TERMINALRESPONSEL_2, "CSAT: CSatNotifySendData::TerminalResponseL, Invalid general result: %d", rspV2.iGeneralResult); |
325 TFLOGSTRING2("CSAT: CSatNotifySendData::TerminalResponseL, \ |
|
326 Invalid general result: %d", rspV2.iGeneralResult); |
327 // Invalid general result |
327 // Invalid general result |
328 ret = KErrCorrupt; |
328 ret = KErrCorrupt; |
329 } |
329 } |
330 |
330 |
331 if ( RSat::KMeProblem == rspV2.iInfoType ) |
331 if ( RSat::KMeProblem == rspV2.iInfoType ) |
334 { |
334 { |
335 additionalInfo.Append( rspV2.iAdditionalInfo[0] ); |
335 additionalInfo.Append( rspV2.iAdditionalInfo[0] ); |
336 } |
336 } |
337 else |
337 else |
338 { |
338 { |
339 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_TERMINALRESPONSEL_3, "CSAT: CSatNotifySendData::TerminalResponseL, Additional Info corrupted "); |
339 TFLOGSTRING("CSAT: CSatNotifySendData::TerminalResponseL, \ |
|
340 Additional Info corrupted "); |
340 ret = KErrCorrupt; |
341 ret = KErrCorrupt; |
341 } |
342 } |
342 } |
343 } |
343 |
344 |
344 CreateTerminalRespL( pCmdNumber, ( TUint8 ) rspV2.iGeneralResult, |
345 CreateTerminalRespL( pCmdNumber, ( TUint8 ) rspV2.iGeneralResult, |
359 TUint8 aGeneralResult, |
360 TUint8 aGeneralResult, |
360 const TDesC16& aAdditionalInfo, |
361 const TDesC16& aAdditionalInfo, |
361 TUint8 aChannelDataLength |
362 TUint8 aChannelDataLength |
362 ) |
363 ) |
363 { |
364 { |
364 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDDATA_CREATETERMINALRESPL_1, "CSAT: CSatNotifySendData::CreateTerminalRespL"); |
365 TFLOGSTRING("CSAT: CSatNotifySendData::CreateTerminalRespL"); |
365 TTlv tlvSpecificData; |
366 TTlv tlvSpecificData; |
366 // Append general result tag |
367 // Append general result tag |
367 tlvSpecificData.AddTag( KTlvResultTag ); |
368 tlvSpecificData.AddTag( KTlvResultTag ); |
368 // Append general result |
369 // Append general result |
369 tlvSpecificData.AddByte( aGeneralResult ); |
370 tlvSpecificData.AddByte( aGeneralResult ); |