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 "CSatNotifyPlayToneTraces.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 "CSatNotifyPlayTone.h" // Tsy class header |
25 #include "CSatNotifyPlayTone.h" // Tsy class header |
32 #include "CSatNotificationsTsy.h" // Class header |
26 #include "CSatNotificationsTsy.h" // 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 CSatNotifyPlayTone* CSatNotifyPlayTone::NewL |
40 CSatNotifyPlayTone* CSatNotifyPlayTone::NewL |
46 ( |
41 ( |
47 CSatNotificationsTsy* aNotificationsTsy |
42 CSatNotificationsTsy* aNotificationsTsy |
48 ) |
43 ) |
49 { |
44 { |
50 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_NEWL_1, "CSAT: CSatNotifyPlayTone::NewL"); |
45 TFLOGSTRING("CSAT: CSatNotifyPlayTone::NewL"); |
51 CSatNotifyPlayTone* const satNotifyPlayTone = |
46 CSatNotifyPlayTone* const satNotifyPlayTone = |
52 new ( ELeave ) CSatNotifyPlayTone( aNotificationsTsy ); |
47 new ( ELeave ) CSatNotifyPlayTone( aNotificationsTsy ); |
53 CleanupStack::PushL( satNotifyPlayTone ); |
48 CleanupStack::PushL( satNotifyPlayTone ); |
54 satNotifyPlayTone->ConstructL(); |
49 satNotifyPlayTone->ConstructL(); |
55 CleanupStack::Pop( satNotifyPlayTone ); |
50 CleanupStack::Pop( satNotifyPlayTone ); |
56 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_NEWL_2, "CSAT: CSatNotifyPlayTone::NewL, end of method"); |
51 TFLOGSTRING("CSAT: CSatNotifyPlayTone::NewL, end of method"); |
57 return satNotifyPlayTone; |
52 return satNotifyPlayTone; |
58 } |
53 } |
59 |
54 |
60 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
61 // CSatNotifyPlayTone::~CSatNotifyPlayTone |
56 // CSatNotifyPlayTone::~CSatNotifyPlayTone |
65 CSatNotifyPlayTone::~CSatNotifyPlayTone |
60 CSatNotifyPlayTone::~CSatNotifyPlayTone |
66 ( |
61 ( |
67 // None |
62 // None |
68 ) |
63 ) |
69 { |
64 { |
70 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_DTOR_1, "CSAT: CSatNotifyPlayTone::~CSatNotifyPlayTone"); |
65 TFLOGSTRING("CSAT: CSatNotifyPlayTone::~CSatNotifyPlayTone"); |
71 } |
66 } |
72 |
67 |
73 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
74 // CSatNotifyPlayTone::CSatNotifyPlayTone |
69 // CSatNotifyPlayTone::CSatNotifyPlayTone |
75 // Default C++ constructor |
70 // Default C++ constructor |
91 void CSatNotifyPlayTone::ConstructL |
86 void CSatNotifyPlayTone::ConstructL |
92 ( |
87 ( |
93 // None |
88 // None |
94 ) |
89 ) |
95 { |
90 { |
96 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_CONSTRUCTL_1, "CSAT: CSatNotifyPlayTone::ConstructL, does nothing"); |
91 TFLOGSTRING("CSAT: CSatNotifyPlayTone::ConstructL, does nothing"); |
97 } |
92 } |
98 |
93 |
99 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
100 // CSatNotifyPlayTone::Notify |
95 // CSatNotifyPlayTone::Notify |
101 // Save the request handle type for notification requested by ETel server |
96 // Save the request handle type for notification requested by ETel server |
105 ( |
100 ( |
106 const TTsyReqHandle aTsyReqHandle, |
101 const TTsyReqHandle aTsyReqHandle, |
107 const TDataPackage& aPackage |
102 const TDataPackage& aPackage |
108 ) |
103 ) |
109 { |
104 { |
110 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_NOTIFY_1, "CSAT: CSatNotifyPlayTone::Notify"); |
105 TFLOGSTRING("CSAT: CSatNotifyPlayTone::Notify"); |
111 // Save data pointer to client side for completion |
106 // Save data pointer to client side for completion |
112 iPlayToneV2Pckg = reinterpret_cast<RSat::TPlayToneV2Pckg*>( |
107 iPlayToneV2Pckg = reinterpret_cast<RSat::TPlayToneV2Pckg*>( |
113 aPackage.Des1n() ); |
108 aPackage.Des1n() ); |
114 // Save the request handle |
109 // Save the request handle |
115 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
110 iNotificationsTsy->iSatTsy->SaveReqHandle( aTsyReqHandle, |
130 TInt CSatNotifyPlayTone::CancelNotification |
125 TInt CSatNotifyPlayTone::CancelNotification |
131 ( |
126 ( |
132 const TTsyReqHandle aTsyReqHandle |
127 const TTsyReqHandle aTsyReqHandle |
133 ) |
128 ) |
134 { |
129 { |
135 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_CANCELNOTIFICATION_1, "CSAT: CSatNotifyPlayTone::CancelNotification"); |
130 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CancelNotification"); |
136 // Reset the request handle |
131 // Reset the request handle |
137 iNotificationsTsy->iSatReqHandleStore-> |
132 iNotificationsTsy->iSatReqHandleStore-> |
138 ResetTsyReqHandle( CSatTsy::ESatNotifyPlayTonePCmdReqType ); |
133 ResetTsyReqHandle( CSatTsy::ESatNotifyPlayTonePCmdReqType ); |
139 iPlayToneV2Pckg = NULL; |
134 iPlayToneV2Pckg = NULL; |
140 iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
135 iNotificationsTsy->iSatTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
153 ( |
148 ( |
154 CSatDataPackage* aDataPackage, |
149 CSatDataPackage* aDataPackage, |
155 TInt aErrorCode |
150 TInt aErrorCode |
156 ) |
151 ) |
157 { |
152 { |
158 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_COMPLETENOTIFYL_1, "CSAT: CSatNotifyPlayTone::CompleteNotifyL"); |
153 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CompleteNotifyL"); |
159 TInt returnValue( KErrNone ); |
154 TInt returnValue( KErrNone ); |
160 TInt ret( KErrNone ); |
155 TInt ret( KErrNone ); |
161 |
156 |
162 // Unpack parameters |
157 // Unpack parameters |
163 TPtrC8* data; |
158 TPtrC8* data; |
194 returnValue = berTlv.TlvByTagValue( &alphaIdentifier, |
189 returnValue = berTlv.TlvByTagValue( &alphaIdentifier, |
195 KTlvAlphaIdentifierTag ); |
190 KTlvAlphaIdentifierTag ); |
196 |
191 |
197 if ( KErrNotFound != returnValue ) |
192 if ( KErrNotFound != returnValue ) |
198 { |
193 { |
199 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_COMPLETENOTIFYL_2, "CSAT: CSatNotifyPlayTone::CompleteNotifyL, Alpha ID present"); |
194 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CompleteNotifyL,\ |
|
195 Alpha ID present"); |
200 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
196 TUint16 alphaIdLength = alphaIdentifier.GetLength(); |
201 if ( alphaIdLength ) |
197 if ( alphaIdLength ) |
202 { |
198 { |
203 // Get the alpha id |
199 // Get the alpha id |
204 TPtrC8 sourceString; |
200 TPtrC8 sourceString; |
214 { |
210 { |
215 playToneV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
211 playToneV2.iAlphaId.iStatus = RSat::EAlphaIdProvided; |
216 } |
212 } |
217 else |
213 else |
218 { |
214 { |
219 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_COMPLETENOTIFYL_3, "CSAT: CSatNotifyPlayTone::CompleteNotifyL, Alpha ID is NULL"); |
215 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CompleteNotifyL,\ |
|
216 Alpha ID is NULL"); |
220 playToneV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
217 playToneV2.iAlphaId.iStatus = RSat::EAlphaIdNull; |
221 } |
218 } |
222 } |
219 } |
223 |
220 |
224 // Tone selection (optional) |
221 // Tone selection (optional) |
227 returnValue = berTlv.TlvByTagValue( &tone, KTlvToneTag ); |
224 returnValue = berTlv.TlvByTagValue( &tone, KTlvToneTag ); |
228 if ( KErrNotFound != returnValue ) |
225 if ( KErrNotFound != returnValue ) |
229 { |
226 { |
230 playToneV2.iTone = ( RSat::TTone ) tone.GetShortInfo( |
227 playToneV2.iTone = ( RSat::TTone ) tone.GetShortInfo( |
231 ETLV_Tone ); |
228 ETLV_Tone ); |
232 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_COMPLETENOTIFYL_4, "CSAT: CSatNotifyPlayTone::CompleteNotifyL, Tone Selection: %d", playToneV2.iTone); |
229 TFLOGSTRING2("CSAT: CSatNotifyPlayTone::CompleteNotifyL,\ |
|
230 Tone Selection: %d", playToneV2.iTone); |
233 } |
231 } |
234 |
232 |
235 // Duration of the tone (optional) |
233 // Duration of the tone (optional) |
236 TSatUtility::FillDurationStructure( berTlv, |
234 TSatUtility::FillDurationStructure( berTlv, |
237 playToneV2.iDuration ); |
235 playToneV2.iDuration ); |
248 |
246 |
249 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
247 iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret ); |
250 }// End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
248 }// End of if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
251 else |
249 else |
252 { |
250 { |
253 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_COMPLETENOTIFYL_5, "CSAT: CSatNotifyPlayTone::CompleteNotifyL, Request not ongoing"); |
251 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CompleteNotifyL,\ |
|
252 Request not ongoing"); |
254 // Request not on, returning response immediately |
253 // Request not on, returning response immediately |
255 additionalInfo.Zero(); |
254 additionalInfo.Zero(); |
256 additionalInfo.Append( KNoCause ); |
255 additionalInfo.Append( KNoCause ); |
257 CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, |
256 CreateTerminalRespL( pCmdNumber, RSat::KMeUnableToProcessCmd, |
258 additionalInfo ); |
257 additionalInfo ); |
271 TInt CSatNotifyPlayTone::TerminalResponseL |
270 TInt CSatNotifyPlayTone::TerminalResponseL |
272 ( |
271 ( |
273 TDes8* aRsp |
272 TDes8* aRsp |
274 ) |
273 ) |
275 { |
274 { |
276 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_TERMINALRESPONSEL_1, "CSAT: CSatNotifyPlayTone::TerminalResponseL" ); |
275 TFLOGSTRING( "CSAT: CSatNotifyPlayTone::TerminalResponseL" ); |
277 |
276 |
278 TInt ret( KErrNone ); |
277 TInt ret( KErrNone ); |
279 TBuf<1>additionalInfo; |
278 TBuf<1>additionalInfo; |
280 additionalInfo.Append( 0 ); |
279 additionalInfo.Append( 0 ); |
281 RSat::TPlayToneRspV1Pckg* aRspPckg = |
280 RSat::TPlayToneRspV1Pckg* aRspPckg = |
292 ( RSat::KPSessionTerminatedByUser != rspV1.iGeneralResult ) && |
291 ( RSat::KPSessionTerminatedByUser != rspV1.iGeneralResult ) && |
293 ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) && |
292 ( RSat::KMeUnableToProcessCmd != rspV1.iGeneralResult ) && |
294 ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) && |
293 ( RSat::KCmdBeyondMeCapabilities != rspV1.iGeneralResult ) && |
295 ( RSat::KCmdDataNotUnderstood != rspV1.iGeneralResult ) ) |
294 ( RSat::KCmdDataNotUnderstood != rspV1.iGeneralResult ) ) |
296 { |
295 { |
297 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_TERMINALRESPONSEL_2, "CSAT: CSatNotifyPlayTone::TerminalResponseL, Invalid General Result" ); |
296 TFLOGSTRING( "CSAT: CSatNotifyPlayTone::TerminalResponseL,\ |
|
297 Invalid General Result" ); |
298 // Invalid general result |
298 // Invalid general result |
299 ret = KErrCorrupt; |
299 ret = KErrCorrupt; |
300 } |
300 } |
301 |
301 |
302 // If there is ME (Mobile Equipment) error, additional info is needed |
302 // If there is ME (Mobile Equipment) error, additional info is needed |
308 additionalInfo.Zero(); |
308 additionalInfo.Zero(); |
309 additionalInfo.Append( rspV1.iAdditionalInfo[0] ); |
309 additionalInfo.Append( rspV1.iAdditionalInfo[0] ); |
310 } |
310 } |
311 else |
311 else |
312 { |
312 { |
313 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_TERMINALRESPONSEL_3, "CSAT: CSatNotifyPlayTone::TerminalResponseL, Invalid Additional Info" ); |
313 TFLOGSTRING( "CSAT: CSatNotifyPlayTone::TerminalResponseL,\ |
|
314 Invalid Additional Info" ); |
314 // Invalid additional info field |
315 // Invalid additional info field |
315 ret = KErrCorrupt; |
316 ret = KErrCorrupt; |
316 } |
317 } |
317 } |
318 } |
318 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_TERMINALRESPONSEL_4, "CSAT: CSatNotifyPlayTone::TerminalResponseL: AdditionalInfo: %S", additionalInfo ); |
319 TFLOGSTRING2( "CSAT: CSatNotifyPlayTone::TerminalResponseL: \ |
|
320 AdditionalInfo: %s", &additionalInfo ); |
319 |
321 |
320 CreateTerminalRespL( pCmdNumber, static_cast< TUint8 >( |
322 CreateTerminalRespL( pCmdNumber, static_cast< TUint8 >( |
321 rspV1.iGeneralResult ), additionalInfo ); |
323 rspV1.iGeneralResult ), additionalInfo ); |
322 |
324 |
323 return ret; |
325 return ret; |
334 TUint8 aPCmdNumber, |
336 TUint8 aPCmdNumber, |
335 TUint8 aGeneralResult, |
337 TUint8 aGeneralResult, |
336 TDesC16& aAdditionalInfo |
338 TDesC16& aAdditionalInfo |
337 ) |
339 ) |
338 { |
340 { |
339 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYPLAYTONE_CREATETERMINALRESPL_1, "CSAT: CSatNotifyPlayTone::CreateTerminalRespL"); |
341 TFLOGSTRING("CSAT: CSatNotifyPlayTone::CreateTerminalRespL"); |
340 TTlv tlvSpecificData; |
342 TTlv tlvSpecificData; |
341 tlvSpecificData.AddTag( KTlvResultTag ); |
343 tlvSpecificData.AddTag( KTlvResultTag ); |
342 //General result |
344 //General result |
343 tlvSpecificData.AddByte( aGeneralResult ); |
345 tlvSpecificData.AddByte( aGeneralResult ); |
344 |
346 |