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 "CSatNotifyTimerMgmtTraces.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 "CSatNotifyTimerMgmt.h" // Class header |
25 #include "CSatNotifyTimerMgmt.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 "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
32 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
38 #include "MSatTsy_IPCDefs.h" // Sat Tsy internal request types |
33 #include "MSatTsy_IPCDefs.h" // Sat Tsy internal request types |
39 |
34 |
40 |
35 |
46 CSatNotifyTimerMgmt* CSatNotifyTimerMgmt::NewL |
41 CSatNotifyTimerMgmt* CSatNotifyTimerMgmt::NewL |
47 ( |
42 ( |
48 CSatNotificationsTsy* aNotificationsTsy |
43 CSatNotificationsTsy* aNotificationsTsy |
49 ) |
44 ) |
50 { |
45 { |
51 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_NEWL_1, "CSAT: CSatNotifyTimerMgmt::NewL"); |
46 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::NewL"); |
52 CSatNotifyTimerMgmt* const satNotifyTimerMgmt = |
47 CSatNotifyTimerMgmt* const satNotifyTimerMgmt = |
53 new ( ELeave ) CSatNotifyTimerMgmt( aNotificationsTsy ); |
48 new ( ELeave ) CSatNotifyTimerMgmt( aNotificationsTsy ); |
54 CleanupStack::PushL( satNotifyTimerMgmt ); |
49 CleanupStack::PushL( satNotifyTimerMgmt ); |
55 satNotifyTimerMgmt->ConstructL(); |
50 satNotifyTimerMgmt->ConstructL(); |
56 CleanupStack::Pop( satNotifyTimerMgmt ); |
51 CleanupStack::Pop( satNotifyTimerMgmt ); |
57 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_NEWL_2, "CSAT: CSatNotifyTimerMgmt::NewL, end of method"); |
52 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::NewL, end of method"); |
58 return satNotifyTimerMgmt; |
53 return satNotifyTimerMgmt; |
59 } |
54 } |
60 |
55 |
61 // ----------------------------------------------------------------------------- |
56 // ----------------------------------------------------------------------------- |
62 // CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt |
57 // CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt |
66 CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt |
61 CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt |
67 ( |
62 ( |
68 // None |
63 // None |
69 ) |
64 ) |
70 { |
65 { |
71 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_DTOR_1, "CSAT: CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt"); |
66 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt"); |
72 } |
67 } |
73 |
68 |
74 // ----------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
75 // CSatNotifyTimerMgmt::CSatNotifyTimerMgmt |
70 // CSatNotifyTimerMgmt::CSatNotifyTimerMgmt |
76 // Default C++ constructor |
71 // Default C++ constructor |
92 void CSatNotifyTimerMgmt::ConstructL |
87 void CSatNotifyTimerMgmt::ConstructL |
93 ( |
88 ( |
94 // None |
89 // None |
95 ) |
90 ) |
96 { |
91 { |
97 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CONSTRUCTL_1, "CSAT: CSatNotifyTimerMgmt::ConstructL, does nothing"); |
92 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::ConstructL, does nothing"); |
98 } |
93 } |
99 |
94 |
100 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
101 // CSatNotifyTimerMgmt::CompleteNotifyL |
96 // CSatNotifyTimerMgmt::CompleteNotifyL |
102 // This method completes a NotifyTimerMgmt request by sending terminal response. |
97 // This method completes a NotifyTimerMgmt request by sending terminal response. |
106 ( |
101 ( |
107 CSatDataPackage* aDataPackage, |
102 CSatDataPackage* aDataPackage, |
108 TInt aErrorCode |
103 TInt aErrorCode |
109 ) |
104 ) |
110 { |
105 { |
111 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_1, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL"); |
106 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::CompleteNotifyL"); |
112 |
107 |
113 TInt ret( KErrNone ); |
108 TInt ret( KErrNone ); |
114 TInt returnValue( KErrNone ); |
109 TInt returnValue( KErrNone ); |
115 TUint8 generalResult ( RSat::KSuccess ); |
110 TUint8 generalResult ( RSat::KSuccess ); |
116 |
111 |
188 ret = iNotificationsTsy->GetSatTimer()->Start( |
183 ret = iNotificationsTsy->GetSatTimer()->Start( |
189 iTimerId, timeValue ); |
184 iTimerId, timeValue ); |
190 |
185 |
191 if ( KErrNone != ret ) |
186 if ( KErrNone != ret ) |
192 { |
187 { |
193 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_2, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Unable to process cmd"); |
188 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
189 CompleteNotifyL, Unable to process cmd"); |
194 generalResult = RSat::KMeUnableToProcessCmd; |
190 generalResult = RSat::KMeUnableToProcessCmd; |
195 } |
191 } |
196 } |
192 } |
197 else |
193 else |
198 { |
194 { |
199 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_3, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Data not understood"); |
195 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
196 CompleteNotifyL, Data not understood"); |
200 generalResult = RSat::KCmdDataNotUnderstood; |
197 generalResult = RSat::KCmdDataNotUnderstood; |
201 } |
198 } |
202 } |
199 } |
203 else |
200 else |
204 { |
201 { |
205 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_4, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Timer value missing"); |
202 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
203 CompleteNotifyL, Timer value missing"); |
206 generalResult = RSat::KErrorRequiredValuesMissing; |
204 generalResult = RSat::KErrorRequiredValuesMissing; |
207 } |
205 } |
208 } |
206 } |
209 // If operation type is KDeactivateTimer or KGetTimerValue |
207 // If operation type is KDeactivateTimer or KGetTimerValue |
210 else if ( ( KDeactivateTimer == cmdQualifier ) || |
208 else if ( ( KDeactivateTimer == cmdQualifier ) || |
243 TSatUtility::ConvertToSemiOctet( num[i] ); |
241 TSatUtility::ConvertToSemiOctet( num[i] ); |
244 } |
242 } |
245 } |
243 } |
246 else |
244 else |
247 { |
245 { |
248 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_5, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Contradiction with timer state"); |
246 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
247 CompleteNotifyL, Contradiction with timer state"); |
249 generalResult = RSat::KContradictionWithTimerState; |
248 generalResult = RSat::KContradictionWithTimerState; |
250 } |
249 } |
251 } |
250 } |
252 else |
251 else |
253 { |
252 { |
254 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_6, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Cmd type not understood"); |
253 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
254 CompleteNotifyL, Cmd type not understood"); |
255 generalResult = RSat::KCmdTypeNotUnderstood; |
255 generalResult = RSat::KCmdTypeNotUnderstood; |
256 } |
256 } |
257 } |
257 } |
258 } |
258 } |
259 else |
259 else |
260 { |
260 { |
261 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_7, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Required values missing"); |
261 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\ |
|
262 CompleteNotifyL, Required values missing"); |
262 generalResult = RSat::KErrorRequiredValuesMissing; |
263 generalResult = RSat::KErrorRequiredValuesMissing; |
263 } |
264 } |
264 |
265 |
265 CreateTerminalRespL( pCmdNumber, generalResult ); |
266 CreateTerminalRespL( pCmdNumber, generalResult ); |
266 |
267 |
279 ( |
280 ( |
280 TUint8 aPCmdNumber, |
281 TUint8 aPCmdNumber, |
281 TUint8 aGeneralResult |
282 TUint8 aGeneralResult |
282 ) |
283 ) |
283 { |
284 { |
284 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CREATETERMINALRESPL_1, "CSAT: CSatNotifyTimerMgmt::CreateTerminalRespL"); |
285 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::CreateTerminalRespL"); |
285 |
286 |
286 // Create and append response data |
287 // Create and append response data |
287 TTlv tlvSpecificData; |
288 TTlv tlvSpecificData; |
288 // Create General Result TLV here |
289 // Create General Result TLV here |
289 tlvSpecificData.AddTag( KTlvResultTag ); |
290 tlvSpecificData.AddTag( KTlvResultTag ); |
348 TUint32 CSatNotifyTimerMgmt::ConvertToSeconds |
349 TUint32 CSatNotifyTimerMgmt::ConvertToSeconds |
349 ( |
350 ( |
350 TPtrC8 time |
351 TPtrC8 time |
351 ) |
352 ) |
352 { |
353 { |
353 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CONVERTTOSECONDS_1, "CSAT: CSatNotifyTimerMgmt::ConvertToSeconds"); |
354 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::ConvertToSeconds"); |
354 TUint32 timeValue( 0 ); |
355 TUint32 timeValue( 0 ); |
355 // Value of a timer, expressed using |
356 // Value of a timer, expressed using |
356 // the format hour, minute, second |
357 // the format hour, minute, second |
357 // Semi-octec presentation used (23.040) |
358 // Semi-octec presentation used (23.040) |
358 // time[0] is hours |
359 // time[0] is hours |