1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2001-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 @file |
20 @file |
21 */ |
21 */ |
22 |
22 |
|
23 |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "CSimIndicatorTraces.h" |
|
28 #endif |
|
29 |
23 #include <testconfigfileparser.h> |
30 #include <testconfigfileparser.h> |
24 #include "CSimIndicator.h" |
31 #include "CSimIndicator.h" |
25 #include "CSimPhone.h" |
32 #include "CSimPhone.h" |
26 #include "Simlog.h" |
|
27 |
33 |
28 |
34 |
29 const TInt KIndicatorsGranularity=5; // < Granularity for indicators list array |
35 const TInt KIndicatorsGranularity=5; // < Granularity for indicators list array |
30 |
36 |
31 CSimIndicator* CSimIndicator::NewL(CSimPhone* aPhone) |
37 CSimIndicator* CSimIndicator::NewL(CSimPhone* aPhone) |
65 * for the duration of the test. |
71 * for the duration of the test. |
66 */ |
72 */ |
67 { |
73 { |
68 iIndicatorsInfo=new(ELeave) CArrayFixFlat<TPhoneIndicatorsInfo>(KIndicatorsGranularity); |
74 iIndicatorsInfo=new(ELeave) CArrayFixFlat<TPhoneIndicatorsInfo>(KIndicatorsGranularity); |
69 |
75 |
70 LOGPHONE1("Starting to parse Indicators config parameters..."); |
76 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_1, "Starting to parse Indicators config parameters..."); |
71 TInt count=CfgFile()->ItemCount(KIndicators); |
77 TInt count=CfgFile()->ItemCount(KIndicators); |
72 const CTestConfigItem* item=NULL; |
78 const CTestConfigItem* item=NULL; |
73 TInt ret=KErrNone; |
79 TInt ret=KErrNone; |
74 |
80 |
75 TInt i; |
81 TInt i; |
82 TInt number; |
88 TInt number; |
83 TInt error; |
89 TInt error; |
84 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,number); |
90 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,number); |
85 if(ret!=KErrNone) |
91 if(ret!=KErrNone) |
86 { |
92 { |
87 LOGPARSERR("number",ret,0,&KIndicators); |
93 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_2, "WARNING - CONFIGURATION FILE PARSING - Reading element NUMBER returned %d (element no. %d) from tag %s.",ret,0,KIndicators); |
88 continue; |
94 continue; |
89 } |
95 } |
90 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,error); |
96 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,error); |
91 if(ret!=KErrNone) |
97 if(ret!=KErrNone) |
92 { |
98 { |
93 LOGPARSERR("error",ret,1,&KIndicators); |
99 OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_3, "WARNING - CONFIGURATION FILE PARSING - Reading element ERROR returned %d (element no. %d) from tag %s.",ret,1,KIndicators); |
94 continue; |
100 continue; |
95 } |
101 } |
96 TPhoneIndicatorsInfo indicInfo; |
102 TPhoneIndicatorsInfo indicInfo; |
97 indicInfo.iNotificationNumber=number; |
103 indicInfo.iNotificationNumber=number; |
98 indicInfo.iError=error; |
104 indicInfo.iError=error; |
99 iIndicatorsInfo->AppendL(indicInfo); |
105 iIndicatorsInfo->AppendL(indicInfo); |
100 } |
106 } |
101 LOGPHONE2("Finished parsing Indicators config parameters...%d items found", count); |
107 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_4, "Finished parsing Indicators config parameters...%d items found", count); |
102 |
108 |
103 iIndicatorCheckPeriod = 1; |
109 iIndicatorCheckPeriod = 1; |
104 count = CfgFile()->ItemCount(KIndicatorCheckPeriod); |
110 count = CfgFile()->ItemCount(KIndicatorCheckPeriod); |
105 if (count > 1) |
111 if (count > 1) |
106 { |
112 { |
107 LOGPHONE1("Warning: Error parsing IndicatorCheckPeriod in config file."); |
113 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_5, "Warning: Error parsing IndicatorCheckPeriod in config file."); |
108 LOGPHONE1(" More than one value found, using default value."); |
114 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_6, " More than one value found, using default value."); |
109 } |
115 } |
110 else |
116 else |
111 { |
117 { |
112 item=CfgFile()->Item(KIndicatorCheckPeriod); |
118 item=CfgFile()->Item(KIndicatorCheckPeriod); |
113 |
119 |
115 { |
121 { |
116 TInt period; |
122 TInt period; |
117 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,period); |
123 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,period); |
118 if(ret!=KErrNone) |
124 if(ret!=KErrNone) |
119 { |
125 { |
120 LOGPHONE1("Warning: Error parsing IndicatorCheckPeriod in config file."); |
126 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_7, "Warning: Error parsing IndicatorCheckPeriod in config file."); |
121 LOGPHONE1(" No value for IndicatorCheckPeriod found."); |
127 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CONSTRUCTL_8, " No value for IndicatorCheckPeriod found."); |
122 } |
128 } |
123 else |
129 else |
124 { |
130 { |
125 iIndicatorCheckPeriod = period; |
131 iIndicatorCheckPeriod = period; |
126 } |
132 } |
183 * @param aReqHandle The request handle associated with this request. |
189 * @param aReqHandle The request handle associated with this request. |
184 * @param aPckg1 This is populated with the Indicators flags. |
190 * @param aPckg1 This is populated with the Indicators flags. |
185 * @return TInt Standard error value. |
191 * @return TInt Standard error value. |
186 */ |
192 */ |
187 { |
193 { |
188 LOGPHONE2("CSimIndicator::GetIndicator request made: returning %d",iCurrentIndicator); |
194 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_GETINDICATOR_1, "CSimIndicator::GetIndicator request made: returning %d",iCurrentIndicator); |
189 TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1; |
195 TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1; |
190 TUint32& indic=(*indicPckg)(); |
196 TUint32& indic=(*indicPckg)(); |
191 |
197 |
192 indic=iCurrentIndicator; |
198 indic=iCurrentIndicator; |
193 iPhone->ReqCompleted(aReqHandle,KErrNone); |
199 iPhone->ReqCompleted(aReqHandle,KErrNone); |
202 * |
208 * |
203 * @param aPckg1 The first parameter package. This is populated with the Indicators flags. |
209 * @param aPckg1 The first parameter package. This is populated with the Indicators flags. |
204 * @return TInt Standard error value. |
210 * @return TInt Standard error value. |
205 */ |
211 */ |
206 { |
212 { |
207 LOGPHONE1("CSimIndicator::NotifyIndicatorChange notification posted"); |
213 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_NOTIFYINDICATORCHANGE_1, "CSimIndicator::NotifyIndicatorChange notification posted"); |
208 TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1; |
214 TPckg<TUint32>* indicPckg=(TPckg<TUint32>*)aPckg1; |
209 TUint32& indic=(*indicPckg)(); |
215 TUint32& indic=(*indicPckg)(); |
210 |
216 |
211 __ASSERT_ALWAYS(!iIndicatorsChangeNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
217 __ASSERT_ALWAYS(!iIndicatorsChangeNotificationPending,SimPanic(ENotificationReqAlreadyOutstanding)); |
212 iIndicatorsChangeNotificationPending=ETrue; |
218 iIndicatorsChangeNotificationPending=ETrue; |
222 * Cancel a previous request to be notified of a change in indicators. |
228 * Cancel a previous request to be notified of a change in indicators. |
223 */ |
229 */ |
224 { |
230 { |
225 if(iIndicatorsChangeNotificationPending) |
231 if(iIndicatorsChangeNotificationPending) |
226 { |
232 { |
227 LOGPHONE1("CSimIndicator::NotifyIndicatorChange notification cancelled"); |
233 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_NOTIFYINDICATORCHANGECANCEL_1, "CSimIndicator::NotifyIndicatorChange notification cancelled"); |
228 iIndicatorsChangeNotificationPending=EFalse; |
234 iIndicatorsChangeNotificationPending=EFalse; |
229 iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,KErrCancel); |
235 iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,KErrCancel); |
230 } |
236 } |
231 } |
237 } |
232 |
238 |
260 } |
266 } |
261 |
267 |
262 // Trigger notification with appropriate data and result codes |
268 // Trigger notification with appropriate data and result codes |
263 iIndicatorsChangeNotificationPending=EFalse; |
269 iIndicatorsChangeNotificationPending=EFalse; |
264 *iIndicatorsChangeNofificationValue=iCurrentIndicator; |
270 *iIndicatorsChangeNofificationValue=iCurrentIndicator; |
265 LOGPHONE2("CSimIndicator::NotifyIndicatorChange triggered: returned %d",iCurrentIndicator); |
271 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSIMINDICATOR_CHECKNOTIFICATION_1, "CSimIndicator::NotifyIndicatorChange triggered: returned %d",iCurrentIndicator); |
266 iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,ret); |
272 iPhone->ReqCompleted(iIndicatorsChangeNotificationReqHandle,ret); |
267 } |
273 } |
268 } |
274 } |
269 } |
275 } |
270 |
276 |