|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_TCommConfigV01Data.h" |
|
19 |
|
20 /*@{*/ |
|
21 _LIT(KStrNull, " "); |
|
22 |
|
23 _LIT(KCmdConstructor, "new"); |
|
24 _LIT(KCmdDestructor, "~"); |
|
25 _LIT(KCmdiDataBits, "iDataBits"); |
|
26 _LIT(KCmdiFifo, "iFifo"); |
|
27 _LIT(KCmdiHandshake, "iHandshake"); |
|
28 _LIT(KCmdiParity, "iParity"); |
|
29 _LIT(KCmdiParityError, "iParityError"); |
|
30 _LIT(KCmdiParityErrorChar, "iParityErrorChar"); |
|
31 _LIT(KCmdiRate, "iRate"); |
|
32 _LIT(KCmdiSIREnable, "iSIREnable"); |
|
33 _LIT(KCmdiSIRSettings, "iSIRSettings"); |
|
34 _LIT(KCmdiSpecialRate, "iSpecialRate"); |
|
35 _LIT(KCmdiStopBits, "iStopBits"); |
|
36 _LIT(KCmdiTerminator, "iTerminator"); |
|
37 _LIT(KCmdiTerminatorCount, "iTerminatorCount"); |
|
38 _LIT(KCmdiXoffChar, "iXoffChar"); |
|
39 _LIT(KCmdiXonChar, "iXonChar"); |
|
40 |
|
41 _LIT(KFldExpected, "expected"); |
|
42 _LIT(KFldExpectedIndex, "expected%d"); |
|
43 _LIT(KFldValue, "value"); |
|
44 _LIT(KFldValueIndex, "value%d"); |
|
45 |
|
46 _LIT(KLogError, "Error=%d"); |
|
47 _LIT(KLogErrorExpectedValue, "Expected Value does not match actual"); |
|
48 /*@}*/ |
|
49 |
|
50 _LIT(KStrEData5, "EData5"); |
|
51 _LIT(KStrEData6, "EData6"); |
|
52 _LIT(KStrEData7, "EData7"); |
|
53 _LIT(KStrEData8, "EData8"); |
|
54 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableDataBits[] = |
|
55 { |
|
56 // Enum as a descriptor Enum |
|
57 KStrEData5, EData5, |
|
58 KStrEData6, EData6, |
|
59 KStrEData7, EData7, |
|
60 KStrEData8, EData8, |
|
61 KStrNull, -1 |
|
62 }; |
|
63 |
|
64 _LIT(KStrEFifoEnable, "EFifoEnable"); |
|
65 _LIT(KStrEFifoDisable, "KStrEFifoDisable"); |
|
66 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableFifo[] = |
|
67 { |
|
68 // Enum as a descriptor Enum |
|
69 KStrEFifoEnable, EFifoEnable, |
|
70 KStrEFifoDisable, EFifoDisable, |
|
71 KStrNull, -1 |
|
72 }; |
|
73 |
|
74 _LIT(KStrKConfigObeyXoff, "KConfigObeyXoff"); |
|
75 _LIT(KStrKConfigSendXoff, "KConfigSendXoff"); |
|
76 _LIT(KStrKConfigObeyCTS, "KConfigObeyCTS"); |
|
77 _LIT(KStrKConfigFailCTS, "KConfigFailCTS"); |
|
78 _LIT(KStrKConfigObeyDSR, "KConfigObeyDSR"); |
|
79 _LIT(KStrKConfigFailDSR, "KConfigFailDSR"); |
|
80 _LIT(KStrKConfigObeyDCD, "KConfigObeyDCD"); |
|
81 _LIT(KStrKConfigFailDCD, "KConfigFailDCD"); |
|
82 _LIT(KStrKConfigFreeRTS, "KConfigFreeRTS"); |
|
83 _LIT(KStrKConfigFreeDTR, "KConfigFreeDTR"); |
|
84 _LIT(KStrKConfigObeyDTR, "KConfigObeyDTR"); |
|
85 _LIT(KStrKConfigFailDTR, "KConfigFailDTR"); |
|
86 _LIT(KStrKConfigObeyRTS, "KConfigObeyRTS"); |
|
87 _LIT(KStrKConfigFailRTS, "KConfigFailRTS"); |
|
88 _LIT(KStrKConfigFreeDSR, "KConfigFreeDSR"); |
|
89 _LIT(KStrKConfigFreeCTS, "KConfigFreeCTS"); |
|
90 _LIT(KStrKConfigFreeDCD, "KConfigFreeDCD"); |
|
91 _LIT(KStrKConfigFreeRI, "KConfigFreeRI"); |
|
92 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableHandshake[] = |
|
93 { |
|
94 // Enum as a descriptor Enum |
|
95 KStrKConfigObeyXoff, KConfigObeyXoff, |
|
96 KStrKConfigSendXoff, KConfigSendXoff, |
|
97 KStrKConfigObeyCTS, KConfigObeyCTS, |
|
98 KStrKConfigFailCTS, KConfigFailCTS, |
|
99 KStrKConfigObeyDSR, KConfigObeyDSR, |
|
100 KStrKConfigFailDSR, KConfigFailDSR, |
|
101 KStrKConfigObeyDCD, KConfigObeyDCD, |
|
102 KStrKConfigFailDCD, KConfigFailDCD, |
|
103 KStrKConfigFreeRTS, KConfigFreeRTS, |
|
104 KStrKConfigFreeDTR, KConfigFreeDTR, |
|
105 KStrKConfigObeyDTR, KConfigObeyDTR, |
|
106 KStrKConfigFailDTR, KConfigFailDTR, |
|
107 KStrKConfigObeyRTS, KConfigObeyRTS, |
|
108 KStrKConfigFailRTS, KConfigFailRTS, |
|
109 KStrKConfigFreeDSR, KConfigFreeDSR, |
|
110 KStrKConfigFreeCTS, KConfigFreeCTS, |
|
111 KStrKConfigFreeDCD, KConfigFreeDCD, |
|
112 KStrKConfigFreeRI, KConfigFreeRI, |
|
113 KStrNull, -1 |
|
114 }; |
|
115 |
|
116 _LIT(KStrEParityNone, "EParityNone"); |
|
117 _LIT(KStrEParityEven, "EParityEven"); |
|
118 _LIT(KStrEParityOdd, "EParityOdd"); |
|
119 _LIT(KStrEParityMark, "EParityMark"); |
|
120 _LIT(KStrEParitySpace, "EParitySpace"); |
|
121 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableParity[] = |
|
122 { |
|
123 // Enum as a descriptor Enum |
|
124 KStrEParityNone, EParityNone, |
|
125 KStrEParityEven, EParityEven, |
|
126 KStrEParityOdd, EParityOdd, |
|
127 KStrEParityMark, EParityMark, |
|
128 KStrEParitySpace, EParitySpace, |
|
129 KStrNull, -1 |
|
130 }; |
|
131 |
|
132 _LIT(KStrKConfigParityErrorFail, "KConfigParityErrorFail"); |
|
133 _LIT(KStrKConfigParityErrorIgnore, "KConfigParityErrorIgnore"); |
|
134 _LIT(KStrKConfigParityErrorReplaceChar, "KConfigParityErrorReplaceChar"); |
|
135 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableParityError[] = |
|
136 { |
|
137 // Enum as a descriptor Enum |
|
138 KStrKConfigParityErrorFail, KConfigParityErrorFail, |
|
139 KStrKConfigParityErrorIgnore, KConfigParityErrorIgnore, |
|
140 KStrKConfigParityErrorReplaceChar, KConfigParityErrorReplaceChar, |
|
141 KStrNull, -1 |
|
142 }; |
|
143 |
|
144 _LIT(KStrEBps50, "EBps50"); |
|
145 _LIT(KStrEBps75, "EBps75"); |
|
146 _LIT(KStrEBps110, "EBps110"); |
|
147 _LIT(KStrEBps134, "EBps134"); |
|
148 _LIT(KStrEBps150, "EBps150"); |
|
149 _LIT(KStrEBps300, "EBps300"); |
|
150 _LIT(KStrEBps600, "EBps600"); |
|
151 _LIT(KStrEBps1200, "EBps1200"); |
|
152 _LIT(KStrEBps1800, "EBps1800"); |
|
153 _LIT(KStrEBps2000, "EBps2000"); |
|
154 _LIT(KStrEBps2400, "EBps2400"); |
|
155 _LIT(KStrEBps3600, "EBps3600"); |
|
156 _LIT(KStrEBps4800, "EBps4800"); |
|
157 _LIT(KStrEBps7200, "EBps7200"); |
|
158 _LIT(KStrEBps9600, "EBps9600"); |
|
159 _LIT(KStrEBps19200, "EBps19200"); |
|
160 _LIT(KStrEBps38400, "EBps38400"); |
|
161 _LIT(KStrEBps57600, "EBps57600"); |
|
162 _LIT(KStrEBps115200, "EBps115200"); |
|
163 _LIT(KStrEBps230400, "EBps230400"); |
|
164 _LIT(KStrEBps460800, "EBps460800"); |
|
165 _LIT(KStrEBps576000, "EBps576000"); |
|
166 _LIT(KStrEBps1152000, "EBps1152000"); |
|
167 _LIT(KStrEBps4000000, "EBps4000000"); |
|
168 _LIT(KStrEBps921600, "EBps921600"); |
|
169 _LIT(KStrEBpsAutobaud, "EBpsAutobaud"); |
|
170 _LIT(KStrEBpsSpecial, "EBpsSpecial"); |
|
171 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableRate[] = |
|
172 { |
|
173 // Enum as a descriptor Enum |
|
174 KStrEBps50, EBps50, |
|
175 KStrEBps75, EBps75, |
|
176 KStrEBps110, EBps110, |
|
177 KStrEBps134, EBps134, |
|
178 KStrEBps150, EBps150, |
|
179 KStrEBps300, EBps300, |
|
180 KStrEBps600, EBps600, |
|
181 KStrEBps1200, EBps1200, |
|
182 KStrEBps1800, EBps1800, |
|
183 KStrEBps2000, EBps2000, |
|
184 KStrEBps2400, EBps2400, |
|
185 KStrEBps3600, EBps3600, |
|
186 KStrEBps4800, EBps4800, |
|
187 KStrEBps7200, EBps7200, |
|
188 KStrEBps9600, EBps9600, |
|
189 KStrEBps19200, EBps19200, |
|
190 KStrEBps38400, EBps38400, |
|
191 KStrEBps57600, EBps57600, |
|
192 KStrEBps115200, EBps115200, |
|
193 KStrEBps230400, EBps230400, |
|
194 KStrEBps460800, EBps460800, |
|
195 KStrEBps576000, EBps576000, |
|
196 KStrEBps1152000, EBps1152000, |
|
197 KStrEBps4000000, EBps4000000, |
|
198 KStrEBps921600, EBps921600, |
|
199 KStrEBpsAutobaud, EBpsAutobaud, |
|
200 KStrEBpsSpecial, EBpsSpecial, |
|
201 KStrNull, -1 |
|
202 }; |
|
203 |
|
204 _LIT(KStrESIREnable, "ESIREnable"); |
|
205 _LIT(KStrESIRDisable, "ESIRDisable"); |
|
206 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableSir[] = |
|
207 { |
|
208 // Enum as a descriptor Enum |
|
209 KStrESIREnable, ESIREnable, |
|
210 KStrESIRDisable, ESIRDisable, |
|
211 KStrNull, -1 |
|
212 }; |
|
213 |
|
214 _LIT(KStrKConfigSIRPulseWidthMaximum, "KConfigSIRPulseWidthMaximum"); |
|
215 _LIT(KStrKConfigSIRPulseWidthMinimum, "KConfigSIRPulseWidthMinimum"); |
|
216 _LIT(KStrKConfigSIRShutDown, "KConfigSIRShutDown"); |
|
217 _LIT(KStrKConfigSIRMinimumRange, "KConfigSIRMinimumRange"); |
|
218 _LIT(KStrKConfigSIRMediumRange, "KConfigSIRMediumRange"); |
|
219 _LIT(KStrKConfigSIRMaximumRange, "KConfigSIRMaximumRange"); |
|
220 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableSirSetting[] = |
|
221 { |
|
222 // Enum as a descriptor Enum |
|
223 KStrKConfigSIRPulseWidthMaximum, KConfigSIRPulseWidthMaximum, |
|
224 KStrKConfigSIRPulseWidthMinimum, KConfigSIRPulseWidthMinimum, |
|
225 KStrKConfigSIRShutDown, KConfigSIRShutDown, |
|
226 KStrKConfigSIRMinimumRange, KConfigSIRMinimumRange, |
|
227 KStrKConfigSIRMediumRange, KConfigSIRMediumRange, |
|
228 KStrKConfigSIRMaximumRange, KConfigSIRMaximumRange, |
|
229 KStrNull, -1 |
|
230 }; |
|
231 |
|
232 _LIT(KStrEStop1, "EStop1"); |
|
233 _LIT(KStrEStop2, "EStop2"); |
|
234 const CDataWrapperBase::TEnumEntryTable CT_TCommConfigV01Data::iEnumTableStopBits[] = |
|
235 { |
|
236 // Enum as a descriptor Enum |
|
237 KStrEStop1, EStop1, |
|
238 KStrEStop2, EStop2, |
|
239 KStrNull, -1 |
|
240 }; |
|
241 |
|
242 ////////////////////////////////////////////////////////////////////// |
|
243 // Construction/Destruction |
|
244 ////////////////////////////////////////////////////////////////////// |
|
245 |
|
246 CT_TCommConfigV01Data::CT_TCommConfigV01Data() |
|
247 : CDataWrapperBase() |
|
248 , iCommConfig(NULL) |
|
249 { |
|
250 } |
|
251 |
|
252 CT_TCommConfigV01Data::~CT_TCommConfigV01Data() |
|
253 /** |
|
254 * Public destructor |
|
255 */ |
|
256 { |
|
257 DestroyData(); |
|
258 } |
|
259 |
|
260 void CT_TCommConfigV01Data::DestroyData() |
|
261 { |
|
262 delete iCommConfig; |
|
263 iCommConfig=NULL; |
|
264 } |
|
265 |
|
266 TDes8* CT_TCommConfigV01Data::Descriptor() |
|
267 /** |
|
268 * Return a pointer to the buffer |
|
269 * |
|
270 * @return pointer to the buffer |
|
271 */ |
|
272 { |
|
273 return iCommConfig; |
|
274 } |
|
275 |
|
276 TAny* CT_TCommConfigV01Data::GetObject() |
|
277 /** |
|
278 * Return a pointer to the object that the data wraps |
|
279 * |
|
280 * @return pointer to the object that the data wraps |
|
281 */ |
|
282 { |
|
283 return iCommConfig; |
|
284 } |
|
285 |
|
286 TBool CT_TCommConfigV01Data::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) |
|
287 /** |
|
288 * Process a command read from the ini file |
|
289 * |
|
290 * @param aCommand The command to process |
|
291 * @param aSection The section in the ini containing data for the command |
|
292 * @param aAsyncErrorIndex Command index for async calls to return errors to |
|
293 * |
|
294 * @return ETrue if the command is processed |
|
295 * |
|
296 * @leave System wide error |
|
297 */ |
|
298 { |
|
299 TBool ret=ETrue; |
|
300 TInt err=KErrNone; |
|
301 |
|
302 if ( aCommand==KCmdConstructor ) |
|
303 { |
|
304 err=DoCmdConstructor(); |
|
305 } |
|
306 else if ( aCommand==KCmdDestructor ) |
|
307 { |
|
308 DoCmdDestructor(); |
|
309 } |
|
310 else if ( aCommand==KCmdiDataBits ) |
|
311 { |
|
312 DoCmdiDataBits(aSection); |
|
313 } |
|
314 else if ( aCommand==KCmdiFifo ) |
|
315 { |
|
316 DoCmdiFifo(aSection); |
|
317 } |
|
318 else if ( aCommand==KCmdiHandshake ) |
|
319 { |
|
320 DoCmdiHandshake(aSection); |
|
321 } |
|
322 else if ( aCommand==KCmdiParity ) |
|
323 { |
|
324 DoCmdiParity(aSection); |
|
325 } |
|
326 else if ( aCommand==KCmdiParityError ) |
|
327 { |
|
328 DoCmdiParityError(aSection); |
|
329 } |
|
330 else if ( aCommand==KCmdiParityErrorChar ) |
|
331 { |
|
332 DoCmdiParityErrorChar(aSection); |
|
333 } |
|
334 else if ( aCommand==KCmdiRate ) |
|
335 { |
|
336 DoCmdiRate(aSection); |
|
337 } |
|
338 else if ( aCommand==KCmdiSIREnable ) |
|
339 { |
|
340 DoCmdiSIREnable(aSection); |
|
341 } |
|
342 else if ( aCommand==KCmdiSIRSettings ) |
|
343 { |
|
344 DoCmdiSIRSettings(aSection); |
|
345 } |
|
346 else if ( aCommand==KCmdiSpecialRate ) |
|
347 { |
|
348 DoCmdiSpecialRate(aSection); |
|
349 } |
|
350 else if ( aCommand==KCmdiStopBits ) |
|
351 { |
|
352 DoCmdiStopBits(aSection); |
|
353 } |
|
354 else if ( aCommand==KCmdiTerminator ) |
|
355 { |
|
356 DoCmdiTerminator(aSection); |
|
357 } |
|
358 else if ( aCommand==KCmdiTerminatorCount ) |
|
359 { |
|
360 DoCmdiTerminatorCount(aSection); |
|
361 } |
|
362 else if ( aCommand==KCmdiXoffChar ) |
|
363 { |
|
364 DoCmdiXoffChar(aSection); |
|
365 } |
|
366 else if ( aCommand==KCmdiXonChar ) |
|
367 { |
|
368 DoCmdiXonChar(aSection); |
|
369 } |
|
370 else |
|
371 { |
|
372 ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex); |
|
373 } |
|
374 |
|
375 if ( err!=KErrNone ) |
|
376 { |
|
377 ERR_PRINTF2(KLogError, err); |
|
378 SetError(err); |
|
379 } |
|
380 |
|
381 return ret; |
|
382 } |
|
383 |
|
384 TCommConfigV01& CT_TCommConfigV01Data::GetCommConfigV01() |
|
385 { |
|
386 return (*iCommConfig)(); |
|
387 } |
|
388 |
|
389 TInt CT_TCommConfigV01Data::DoCmdConstructor() |
|
390 { |
|
391 DestroyData(); |
|
392 TRAPD(err, iCommConfig=new (ELeave) TCommConfig()); |
|
393 iCommConfig->FillZ(); |
|
394 return err; |
|
395 } |
|
396 |
|
397 void CT_TCommConfigV01Data::DoCmdDestructor() |
|
398 { |
|
399 DestroyData(); |
|
400 } |
|
401 |
|
402 void CT_TCommConfigV01Data::DoCmdiDataBits(const TDesC& aSection) |
|
403 { |
|
404 TDataBits actual=GetCommConfigV01().iDataBits; |
|
405 INFO_PRINTF2(_L("iDataBits : %d"), actual); |
|
406 |
|
407 TInt expected; |
|
408 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableDataBits, expected) ) |
|
409 { |
|
410 if ( expected!=actual ) |
|
411 { |
|
412 ERR_PRINTF1(KLogErrorExpectedValue); |
|
413 SetBlockResult(EFail); |
|
414 } |
|
415 } |
|
416 |
|
417 TInt value; |
|
418 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableDataBits, value) ) |
|
419 { |
|
420 GetCommConfigV01().iDataBits=(TDataBits)value; |
|
421 } |
|
422 } |
|
423 |
|
424 void CT_TCommConfigV01Data::DoCmdiFifo(const TDesC& aSection) |
|
425 { |
|
426 TFifo actual=(TFifo)GetCommConfigV01().iFifo; |
|
427 INFO_PRINTF2(_L("iFifo : %d"), actual); |
|
428 |
|
429 TInt expected; |
|
430 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableFifo, expected) ) |
|
431 { |
|
432 if ( expected!=actual ) |
|
433 { |
|
434 ERR_PRINTF1(KLogErrorExpectedValue); |
|
435 SetBlockResult(EFail); |
|
436 } |
|
437 } |
|
438 |
|
439 TInt value; |
|
440 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableFifo, value) ) |
|
441 { |
|
442 GetCommConfigV01().iFifo=(TUint)value; |
|
443 } |
|
444 } |
|
445 |
|
446 void CT_TCommConfigV01Data::DoCmdiHandshake(const TDesC& aSection) |
|
447 { |
|
448 TUint actual=GetCommConfigV01().iHandshake; |
|
449 INFO_PRINTF2(_L("iHandshake : %d"), actual); |
|
450 |
|
451 TUint expected; |
|
452 if ( GetOrFromConfig(aSection, KFldExpected(), iEnumTableHandshake, expected) ) |
|
453 { |
|
454 if ( expected!=actual ) |
|
455 { |
|
456 ERR_PRINTF1(KLogErrorExpectedValue); |
|
457 SetBlockResult(EFail); |
|
458 } |
|
459 } |
|
460 |
|
461 TUint value; |
|
462 if ( GetOrFromConfig(aSection, KFldValue(), iEnumTableHandshake, value) ) |
|
463 { |
|
464 GetCommConfigV01().iHandshake=value; |
|
465 } |
|
466 } |
|
467 |
|
468 void CT_TCommConfigV01Data::DoCmdiParity(const TDesC& aSection) |
|
469 { |
|
470 TParity actual=GetCommConfigV01().iParity; |
|
471 INFO_PRINTF2(_L("iParity : %d"), actual); |
|
472 |
|
473 TInt expected; |
|
474 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableParity, expected) ) |
|
475 { |
|
476 if ( expected!=actual ) |
|
477 { |
|
478 ERR_PRINTF1(KLogErrorExpectedValue); |
|
479 SetBlockResult(EFail); |
|
480 } |
|
481 } |
|
482 |
|
483 TInt value; |
|
484 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableParity, value) ) |
|
485 { |
|
486 GetCommConfigV01().iParity=(TParity)value; |
|
487 } |
|
488 } |
|
489 |
|
490 void CT_TCommConfigV01Data::DoCmdiParityError(const TDesC& aSection) |
|
491 { |
|
492 TUint actual=GetCommConfigV01().iParityError; |
|
493 INFO_PRINTF2(_L("iParityError : %d"), actual); |
|
494 |
|
495 TInt expected; |
|
496 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableParityError, expected) ) |
|
497 { |
|
498 if ( expected!=(TInt)actual ) |
|
499 { |
|
500 ERR_PRINTF1(KLogErrorExpectedValue); |
|
501 SetBlockResult(EFail); |
|
502 } |
|
503 } |
|
504 |
|
505 TInt value; |
|
506 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableParityError, value) ) |
|
507 { |
|
508 GetCommConfigV01().iParityError=(TUint)value; |
|
509 } |
|
510 } |
|
511 |
|
512 void CT_TCommConfigV01Data::DoCmdiParityErrorChar(const TDesC& aSection) |
|
513 { |
|
514 TText8 actual=GetCommConfigV01().iParityErrorChar; |
|
515 INFO_PRINTF2(_L("iParityErrorChar : 0x%x"), (TUint)actual); |
|
516 |
|
517 TInt expected; |
|
518 if ( GetHexFromConfig(aSection, KFldExpected(), expected) ) |
|
519 { |
|
520 if ( expected!=(TInt)actual ) |
|
521 { |
|
522 ERR_PRINTF1(KLogErrorExpectedValue); |
|
523 SetBlockResult(EFail); |
|
524 } |
|
525 } |
|
526 |
|
527 TInt value; |
|
528 if ( GetHexFromConfig(aSection, KFldValue(), value) ) |
|
529 { |
|
530 GetCommConfigV01().iParityErrorChar=(TText8)value; |
|
531 } |
|
532 } |
|
533 |
|
534 void CT_TCommConfigV01Data::DoCmdiRate(const TDesC& aSection) |
|
535 { |
|
536 TBps actual=GetCommConfigV01().iRate; |
|
537 INFO_PRINTF2(_L("iRate : %d"), actual); |
|
538 |
|
539 TInt expected; |
|
540 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableRate, expected) ) |
|
541 { |
|
542 if ( expected!=(TInt)actual ) |
|
543 { |
|
544 ERR_PRINTF1(KLogErrorExpectedValue); |
|
545 SetBlockResult(EFail); |
|
546 } |
|
547 } |
|
548 |
|
549 TInt value; |
|
550 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableRate, value) ) |
|
551 { |
|
552 GetCommConfigV01().iRate=(TBps)value; |
|
553 } |
|
554 } |
|
555 |
|
556 void CT_TCommConfigV01Data::DoCmdiSIREnable(const TDesC& aSection) |
|
557 { |
|
558 TSir actual=GetCommConfigV01().iSIREnable; |
|
559 INFO_PRINTF2(_L("iSIREnable : %d"), actual); |
|
560 |
|
561 TInt expected; |
|
562 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableSir, expected) ) |
|
563 { |
|
564 if ( expected!=(TInt)actual ) |
|
565 { |
|
566 ERR_PRINTF1(KLogErrorExpectedValue); |
|
567 SetBlockResult(EFail); |
|
568 } |
|
569 } |
|
570 |
|
571 TInt value; |
|
572 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableSir, value) ) |
|
573 { |
|
574 GetCommConfigV01().iSIREnable=(TSir)value; |
|
575 } |
|
576 } |
|
577 |
|
578 void CT_TCommConfigV01Data::DoCmdiSIRSettings(const TDesC& aSection) |
|
579 { |
|
580 TUint actual=GetCommConfigV01().iSIRSettings; |
|
581 INFO_PRINTF2(_L("iSIRSettings : %d"), actual); |
|
582 |
|
583 TInt expected; |
|
584 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableSirSetting, expected) ) |
|
585 { |
|
586 if ( expected!=(TInt)actual ) |
|
587 { |
|
588 ERR_PRINTF1(KLogErrorExpectedValue); |
|
589 SetBlockResult(EFail); |
|
590 } |
|
591 } |
|
592 |
|
593 TInt value; |
|
594 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableSirSetting, value) ) |
|
595 { |
|
596 GetCommConfigV01().iSIRSettings=(TUint)value; |
|
597 } |
|
598 } |
|
599 |
|
600 void CT_TCommConfigV01Data::DoCmdiSpecialRate(const TDesC& aSection) |
|
601 { |
|
602 TInt actual=GetCommConfigV01().iSpecialRate; |
|
603 INFO_PRINTF2(_L("iSpecialRate : %d"), actual); |
|
604 |
|
605 TInt expected; |
|
606 if ( GetIntFromConfig(aSection, KFldExpected(), expected) ) |
|
607 { |
|
608 if ( expected!=actual ) |
|
609 { |
|
610 ERR_PRINTF1(KLogErrorExpectedValue); |
|
611 SetBlockResult(EFail); |
|
612 } |
|
613 } |
|
614 |
|
615 TInt value; |
|
616 if ( GetIntFromConfig(aSection, KFldValue(), value) ) |
|
617 { |
|
618 GetCommConfigV01().iSpecialRate=value; |
|
619 } |
|
620 } |
|
621 |
|
622 void CT_TCommConfigV01Data::DoCmdiStopBits(const TDesC& aSection) |
|
623 { |
|
624 TStopBits actual=GetCommConfigV01().iStopBits; |
|
625 INFO_PRINTF2(_L("iStopBits : %d"), actual); |
|
626 |
|
627 TInt expected; |
|
628 if ( GetEnumFromConfig(aSection, KFldExpected(), iEnumTableStopBits, expected) ) |
|
629 { |
|
630 if ( expected!=actual ) |
|
631 { |
|
632 ERR_PRINTF1(KLogErrorExpectedValue); |
|
633 SetBlockResult(EFail); |
|
634 } |
|
635 } |
|
636 |
|
637 TInt value; |
|
638 if ( GetEnumFromConfig(aSection, KFldValue(), iEnumTableStopBits, value) ) |
|
639 { |
|
640 GetCommConfigV01().iStopBits=(TStopBits)value; |
|
641 } |
|
642 } |
|
643 |
|
644 void CT_TCommConfigV01Data::DoCmdiTerminator(const TDesC& aSection) |
|
645 { |
|
646 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
647 |
|
648 for ( TInt index=0; index<KConfigMaxTerminators; ++index ) |
|
649 { |
|
650 TText8 actual=GetCommConfigV01().iTerminator[index]; |
|
651 INFO_PRINTF3(_L("iTerminator[%d] : 0x%x"), index, (TUint)actual); |
|
652 |
|
653 tempStore.Format(KFldExpectedIndex(), index); |
|
654 TInt expected; |
|
655 if ( GetHexFromConfig(aSection, tempStore, expected) ) |
|
656 { |
|
657 if ( expected!=(TInt)actual ) |
|
658 { |
|
659 ERR_PRINTF1(KLogErrorExpectedValue); |
|
660 SetBlockResult(EFail); |
|
661 } |
|
662 } |
|
663 |
|
664 tempStore.Format(KFldValueIndex(), index); |
|
665 TInt value; |
|
666 if ( GetHexFromConfig(aSection, tempStore, value) ) |
|
667 { |
|
668 GetCommConfigV01().iTerminator[index]=(TText8)value; |
|
669 } |
|
670 } |
|
671 } |
|
672 |
|
673 void CT_TCommConfigV01Data::DoCmdiTerminatorCount(const TDesC& aSection) |
|
674 { |
|
675 TInt actual=GetCommConfigV01().iTerminatorCount; |
|
676 INFO_PRINTF2(_L("iTerminatorCount : %d"), actual); |
|
677 |
|
678 TInt expected; |
|
679 if ( GetIntFromConfig(aSection, KFldExpected(), expected) ) |
|
680 { |
|
681 if ( expected!=actual ) |
|
682 { |
|
683 ERR_PRINTF1(KLogErrorExpectedValue); |
|
684 SetBlockResult(EFail); |
|
685 } |
|
686 } |
|
687 |
|
688 TInt value; |
|
689 if ( GetIntFromConfig(aSection, KFldValue(), value) ) |
|
690 { |
|
691 GetCommConfigV01().iTerminatorCount=value; |
|
692 } |
|
693 } |
|
694 |
|
695 void CT_TCommConfigV01Data::DoCmdiXoffChar(const TDesC& aSection) |
|
696 { |
|
697 TText8 actual=GetCommConfigV01().iXoffChar; |
|
698 INFO_PRINTF2(_L("iXoffChar : 0x%x"), (TUint)actual); |
|
699 |
|
700 TInt expected; |
|
701 if ( GetHexFromConfig(aSection, KFldExpected(), expected) ) |
|
702 { |
|
703 if ( expected!=(TInt)actual ) |
|
704 { |
|
705 ERR_PRINTF1(KLogErrorExpectedValue); |
|
706 SetBlockResult(EFail); |
|
707 } |
|
708 } |
|
709 |
|
710 TInt value; |
|
711 if ( GetHexFromConfig(aSection, KFldValue(), value) ) |
|
712 { |
|
713 GetCommConfigV01().iXoffChar=(TText8)value; |
|
714 } |
|
715 } |
|
716 |
|
717 void CT_TCommConfigV01Data::DoCmdiXonChar(const TDesC& aSection) |
|
718 { |
|
719 TText8 actual=GetCommConfigV01().iXonChar; |
|
720 INFO_PRINTF2(_L("iXonChar : 0x%x"), (TUint)actual); |
|
721 |
|
722 TInt expected; |
|
723 if ( GetHexFromConfig(aSection, KFldExpected(), expected) ) |
|
724 { |
|
725 if ( expected!=(TInt)actual ) |
|
726 { |
|
727 ERR_PRINTF1(KLogErrorExpectedValue); |
|
728 SetBlockResult(EFail); |
|
729 } |
|
730 } |
|
731 |
|
732 TInt value; |
|
733 if ( GetHexFromConfig(aSection, KFldValue(), value) ) |
|
734 { |
|
735 GetCommConfigV01().iXonChar=(TText8)value; |
|
736 } |
|
737 } |