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