|
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_RBusDevCommData.h" |
|
19 #include "T_TCommCapsV01Data.h" |
|
20 #include "T_TCommConfigV01Data.h" |
|
21 |
|
22 /*@{*/ |
|
23 _LIT(KStrNull, " "); |
|
24 |
|
25 _LIT(KCmdConstructor, "new"); |
|
26 _LIT(KCmdDestructor, "~"); |
|
27 _LIT(KCmdBreak, "Break"); |
|
28 _LIT(KCmdBreakCancel, "BreakCancel"); |
|
29 _LIT(KCmdCaps, "Caps"); |
|
30 _LIT(KCmdConfig, "Config"); |
|
31 _LIT(KCmdMinTurnaroundTime, "MinTurnaroundTime"); |
|
32 _LIT(KCmdNotifyReceiveDataAvailable, "NotifyReceiveDataAvailable"); |
|
33 _LIT(KCmdNotifyReceiveDataAvailableCancel, "NotifyReceiveDataAvailableCancel"); |
|
34 _LIT(KCmdNotifySignalChange, "NotifySignalChange"); |
|
35 _LIT(KCmdNotifySignalChangeCancel, "NotifySignalChangeCancel"); |
|
36 _LIT(KCmdOpen, "Open"); |
|
37 _LIT(KCmdQueryReceiveBuffer, "QueryReceiveBuffer"); |
|
38 _LIT(KCmdRead, "Read"); |
|
39 _LIT(KCmdReadCancel, "ReadCancel"); |
|
40 _LIT(KCmdReadOneOrMore, "ReadOneOrMore"); |
|
41 _LIT(KCmdReceiveBufferLength, "ReceiveBufferLength"); |
|
42 _LIT(KCmdResetBuffers, "ResetBuffers"); |
|
43 _LIT(KCmdSetConfig, "SetConfig"); |
|
44 _LIT(KCmdSetMinTurnaroundTime, "SetMinTurnaroundTime"); |
|
45 _LIT(KCmdSetReceiveBufferLength, "SetReceiveBufferLength"); |
|
46 _LIT(KCmdSetSignals, "SetSignals"); |
|
47 _LIT(KCmdSignals, "Signals"); |
|
48 _LIT(KCmdVersionRequired, "VersionRequired"); |
|
49 _LIT(KCmdWrite, "Write"); |
|
50 _LIT(KCmdWriteCancel, "WriteCancel"); |
|
51 |
|
52 _LIT(KFldBufferLength, "bufferlength"); |
|
53 _LIT(KFldCaps, "caps"); |
|
54 _LIT(KFldClearMask, "clearmask"); |
|
55 _LIT(KFldConfig, "config"); |
|
56 _LIT(KFldData, "data"); |
|
57 _LIT(KFldExpected, "expected"); |
|
58 _LIT(KFldExpectedFile, "expected_file"); |
|
59 _LIT(KFldFile, "file"); |
|
60 _LIT(KFldIsEmpty, "is_empty"); |
|
61 _LIT(KFldMask, "mask"); |
|
62 _LIT(KFldPortPDD, "portpdd"); |
|
63 _LIT(KFldPortLDD, "portldd"); |
|
64 _LIT(KFldRepeat, "repeat"); |
|
65 _LIT(KFldSave, "save"); |
|
66 _LIT(KFldSetMask, "setmask"); |
|
67 _LIT(KFldTime, "time"); |
|
68 _LIT(KFldTimeOut, "timeout"); |
|
69 _LIT(KFldUnit, "unit"); |
|
70 _LIT(KFldUseLength, "uselength"); |
|
71 _LIT(KFldValue, "value"); |
|
72 _LIT(KFldVersionName, "version_name"); |
|
73 _LIT(KFldVersionBuild, "version_build"); |
|
74 _LIT(KFldVersionMajor, "version_major"); |
|
75 _LIT(KFldVersionMinor, "version_minor"); |
|
76 |
|
77 _LIT(KLogError, "Error=%d"); |
|
78 _LIT(KLogErrorBufferLength, "Buffer Length %d must be greater than 0"); |
|
79 _LIT(KLogErrorExpectedValue, "Expected Value does not match actual"); |
|
80 _LIT(KLogErrorExpectedSignal, "Expected Signal %d does not match actual %d"); |
|
81 _LIT(KLogMissingParameter, "Missing parameter '%S'"); |
|
82 _LIT(KLogNullCapsData, "Caps Data - '%S' is NULL"); |
|
83 _LIT(KLogNullConfigData, "Config Data - '%S' is NULL"); |
|
84 _LIT(KLogLoadPhysicalDeviceError, "Load Physical Device '%S' error=%d"); |
|
85 _LIT(KLogLoadLogicalDeviceError, "Load Logical Device '%S' error=%d"); |
|
86 /*@}*/ |
|
87 |
|
88 _LIT(KStrKSignalCTS, "KSignalCTS"); |
|
89 _LIT(KStrKSignalDSR, "KSignalDSR"); |
|
90 _LIT(KStrKSignalDCD, "KSignalDCD"); |
|
91 _LIT(KStrKSignalRNG, "KSignalRNG"); |
|
92 _LIT(KStrKSignalRTS, "KSignalRTS"); |
|
93 _LIT(KStrKSignalDTR, "KSignalDTR"); |
|
94 _LIT(KStrKSignalBreak, "KSignalBreak"); |
|
95 const CDataWrapperBase::TEnumEntryTable CT_RBusDevCommData::iEnumTableSignals[] = |
|
96 { |
|
97 // Enum as a descriptor Enum |
|
98 KStrKSignalCTS, KSignalCTS, |
|
99 KStrKSignalDSR, KSignalDSR, |
|
100 KStrKSignalDCD, KSignalDCD, |
|
101 KStrKSignalRNG, KSignalRNG, |
|
102 KStrKSignalRTS, KSignalRTS, |
|
103 KStrKSignalDTR, KSignalDTR, |
|
104 KStrKSignalBreak, KSignalBreak, |
|
105 KStrNull, -1 |
|
106 }; |
|
107 |
|
108 ////////////////////////////////////////////////////////////////////// |
|
109 // Construction/Destruction |
|
110 ////////////////////////////////////////////////////////////////////// |
|
111 |
|
112 CT_RBusDevCommData* CT_RBusDevCommData::NewL() |
|
113 { |
|
114 CT_RBusDevCommData* ret=new (ELeave) CT_RBusDevCommData(); |
|
115 CleanupStack::PushL(ret); |
|
116 ret->ConstructL(); |
|
117 CleanupStack::Pop(ret); |
|
118 return ret; |
|
119 } |
|
120 |
|
121 CT_RBusDevCommData::CT_RBusDevCommData() |
|
122 : CT_RBusLogicalChannelData() |
|
123 , iBusDevComm(NULL) |
|
124 , iBufferRead(NULL) |
|
125 , iBufferReadPtr(NULL, 0) |
|
126 , iBufferReadOneOrMorePtr(NULL, 0) |
|
127 , iReadOneOrMoreLeft(0) |
|
128 , iHasReadExpected(EFalse) |
|
129 , iBufferLength(0) |
|
130 , iMinTurnaroundTime(0) |
|
131 , iReceiveBufferLength(0) |
|
132 , iSignals(0) |
|
133 , iNotifySignals(0) |
|
134 , iHasNotifySignalsExpected(EFalse) |
|
135 , iNotifySignalsExpected(0) |
|
136 , iCallbackBreak(NULL) |
|
137 , iCallbackNotifyReceiveDataAvailable(NULL) |
|
138 , iCallbackNotifySignalChange(NULL) |
|
139 , iCallbackRead(NULL) |
|
140 , iCallbackReadOneOrMore(NULL) |
|
141 , iCallbackWrite(NULL) |
|
142 { |
|
143 } |
|
144 |
|
145 CT_RBusDevCommData::~CT_RBusDevCommData() |
|
146 /** |
|
147 * Public destructor |
|
148 */ |
|
149 { |
|
150 DestroyData(); |
|
151 |
|
152 delete iBufferRead; |
|
153 iBufferRead=NULL; |
|
154 |
|
155 delete iCallbackWrite; |
|
156 iCallbackWrite=NULL; |
|
157 |
|
158 delete iCallbackReadOneOrMore; |
|
159 iCallbackReadOneOrMore=NULL; |
|
160 |
|
161 delete iCallbackRead; |
|
162 iCallbackRead=NULL; |
|
163 |
|
164 delete iCallbackNotifySignalChange; |
|
165 iCallbackNotifySignalChange=NULL; |
|
166 |
|
167 delete iCallbackNotifyReceiveDataAvailable; |
|
168 iCallbackNotifyReceiveDataAvailable=NULL; |
|
169 |
|
170 delete iCallbackBreak; |
|
171 iCallbackBreak=NULL; |
|
172 } |
|
173 |
|
174 void CT_RBusDevCommData::ConstructL() |
|
175 { |
|
176 iCallbackBreak =CActiveCallbackBase::NewL(*this); |
|
177 iCallbackNotifyReceiveDataAvailable =CActiveCallbackBase::NewL(*this); |
|
178 iCallbackNotifySignalChange =CActiveCallbackBase::NewL(*this); |
|
179 iCallbackRead =CT_ActiveCallbackIO::NewL(*this); |
|
180 iCallbackReadOneOrMore =CT_ActiveCallbackIO::NewL(*this); |
|
181 iCallbackWrite =CT_ActiveCallbackIO::NewL(*this); |
|
182 } |
|
183 |
|
184 void CT_RBusDevCommData::DestroyData() |
|
185 { |
|
186 delete iBusDevComm; |
|
187 iBusDevComm=NULL; |
|
188 } |
|
189 |
|
190 TAny* CT_RBusDevCommData::GetObject() |
|
191 /** |
|
192 * Return a pointer to the object that the data wraps |
|
193 * |
|
194 * @return pointer to the object that the data wraps |
|
195 */ |
|
196 { |
|
197 return iBusDevComm; |
|
198 } |
|
199 |
|
200 RHandleBase* CT_RBusDevCommData::GetHandleBase() |
|
201 { |
|
202 return iBusDevComm; |
|
203 } |
|
204 |
|
205 RBusLogicalChannel* CT_RBusDevCommData::GetBusLogicalChannel() |
|
206 { |
|
207 return iBusDevComm; |
|
208 } |
|
209 |
|
210 void CT_RBusDevCommData::PrepareReadExpectedBufferLengthL(CT_ActiveCallbackIO& aCallback, const TDesC& aSection) |
|
211 { |
|
212 TInt repeat=1; |
|
213 GetIntFromConfig(aSection, KFldRepeat, repeat); |
|
214 |
|
215 TPtrC readExpected; |
|
216 iHasReadExpected=GetStringFromConfig(aSection, KFldExpected, readExpected); |
|
217 if ( iHasReadExpected ) |
|
218 { |
|
219 aCallback.PrepareFromStringL(repeat, readExpected); |
|
220 iBufferLength=aCallback.BufferLength(); |
|
221 } |
|
222 else |
|
223 { |
|
224 iHasReadExpected=GetStringFromConfig(aSection, KFldExpectedFile, readExpected); |
|
225 if ( iHasReadExpected ) |
|
226 { |
|
227 aCallback.PrepareFromFileL(repeat, readExpected); |
|
228 } |
|
229 } |
|
230 |
|
231 if ( iHasReadExpected ) |
|
232 { |
|
233 iBufferLength=aCallback.BufferLength(); |
|
234 } |
|
235 |
|
236 GetIntFromConfig(aSection, KFldBufferLength, iBufferLength); |
|
237 if ( iBufferLength <= 0 ) |
|
238 { |
|
239 ERR_PRINTF2(KLogErrorBufferLength, iBufferLength); |
|
240 SetBlockResult(EFail); |
|
241 } |
|
242 } |
|
243 |
|
244 TBool CT_RBusDevCommData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) |
|
245 /** |
|
246 * Process a command read from the ini file |
|
247 * |
|
248 * @param aCommand The command to process |
|
249 * @param aSection The section in the ini containing data for the command |
|
250 * @param aAsyncErrorIndex Command index for async calls to return errors to |
|
251 * |
|
252 * @return ETrue if the command is processed |
|
253 * |
|
254 * @leave System wide error |
|
255 */ |
|
256 { |
|
257 TBool ret=ETrue; |
|
258 TInt err=KErrNone; |
|
259 |
|
260 if ( aCommand==KCmdConstructor ) |
|
261 { |
|
262 err=DoCmdConstructor(); |
|
263 } |
|
264 else if ( aCommand==KCmdDestructor ) |
|
265 { |
|
266 DoCmdDestructor(); |
|
267 } |
|
268 else if ( aCommand==KCmdBreak ) |
|
269 { |
|
270 DoCmdBreak(aSection, aAsyncErrorIndex); |
|
271 } |
|
272 else if ( aCommand==KCmdBreakCancel ) |
|
273 { |
|
274 DoCmdBreakCancel(); |
|
275 } |
|
276 else if ( aCommand==KCmdCaps ) |
|
277 { |
|
278 DoCmdCapsL(aSection); |
|
279 } |
|
280 else if ( aCommand==KCmdConfig ) |
|
281 { |
|
282 DoCmdConfigL(aSection); |
|
283 } |
|
284 else if ( aCommand==KCmdMinTurnaroundTime ) |
|
285 { |
|
286 DoCmdMinTurnaroundTime(aSection); |
|
287 } |
|
288 else if ( aCommand==KCmdNotifyReceiveDataAvailable ) |
|
289 { |
|
290 DoCmdNotifyReceiveDataAvailable(aSection, aAsyncErrorIndex); |
|
291 } |
|
292 else if ( aCommand==KCmdNotifyReceiveDataAvailableCancel ) |
|
293 { |
|
294 DoCmdNotifyReceiveDataAvailableCancel(); |
|
295 } |
|
296 else if ( aCommand==KCmdNotifySignalChange ) |
|
297 { |
|
298 DoCmdNotifySignalChange(aSection, aAsyncErrorIndex); |
|
299 } |
|
300 else if ( aCommand==KCmdNotifySignalChangeCancel ) |
|
301 { |
|
302 DoCmdNotifySignalChangeCancel(); |
|
303 } |
|
304 else if ( aCommand==KCmdOpen ) |
|
305 { |
|
306 err=DoCmdOpen(aSection); |
|
307 } |
|
308 else if ( aCommand==KCmdQueryReceiveBuffer ) |
|
309 { |
|
310 err=DoCmdQueryReceiveBuffer(aSection); |
|
311 } |
|
312 else if ( aCommand==KCmdRead ) |
|
313 { |
|
314 DoCmdReadL(aSection, aAsyncErrorIndex); |
|
315 } |
|
316 else if ( aCommand==KCmdReadCancel ) |
|
317 { |
|
318 DoCmdReadCancel(); |
|
319 } |
|
320 else if ( aCommand==KCmdReadOneOrMore ) |
|
321 { |
|
322 DoCmdReadOneOrMoreL(aSection, aAsyncErrorIndex); |
|
323 } |
|
324 else if ( aCommand==KCmdReceiveBufferLength ) |
|
325 { |
|
326 DoCmdReceiveBufferLength(aSection); |
|
327 } |
|
328 else if ( aCommand==KCmdResetBuffers ) |
|
329 { |
|
330 DoCmdResetBuffers(); |
|
331 } |
|
332 else if ( aCommand==KCmdSetConfig ) |
|
333 { |
|
334 err=DoCmdSetConfigL(aSection); |
|
335 } |
|
336 else if ( aCommand==KCmdSetMinTurnaroundTime ) |
|
337 { |
|
338 err=DoCmdSetMinTurnaroundTime(aSection); |
|
339 } |
|
340 else if ( aCommand==KCmdSetReceiveBufferLength ) |
|
341 { |
|
342 err=DoCmdSetReceiveBufferLength(aSection); |
|
343 } |
|
344 else if ( aCommand==KCmdSetSignals ) |
|
345 { |
|
346 DoCmdSetSignals(aSection); |
|
347 } |
|
348 else if ( aCommand==KCmdSignals ) |
|
349 { |
|
350 DoCmdSignals(aSection); |
|
351 } |
|
352 else if ( aCommand==KCmdVersionRequired ) |
|
353 { |
|
354 DoCmdVersionRequired(aSection); |
|
355 } |
|
356 else if ( aCommand==KCmdWrite ) |
|
357 { |
|
358 DoCmdWriteL(aSection, aAsyncErrorIndex); |
|
359 } |
|
360 else if ( aCommand==KCmdWriteCancel ) |
|
361 { |
|
362 DoCmdWriteCancel(); |
|
363 } |
|
364 else |
|
365 { |
|
366 ret=CT_RBusLogicalChannelData::DoCommandL(aCommand, aSection, aAsyncErrorIndex); |
|
367 } |
|
368 |
|
369 if ( err!=KErrNone ) |
|
370 { |
|
371 ERR_PRINTF2(KLogError, err); |
|
372 SetError(err); |
|
373 } |
|
374 |
|
375 return ret; |
|
376 } |
|
377 |
|
378 TInt CT_RBusDevCommData::DoCmdConstructor() |
|
379 { |
|
380 DestroyData(); |
|
381 TRAPD(err, iBusDevComm=new (ELeave) RBusDevComm()); |
|
382 return err; |
|
383 } |
|
384 |
|
385 void CT_RBusDevCommData::DoCmdDestructor() |
|
386 { |
|
387 DestroyData(); |
|
388 } |
|
389 |
|
390 void CT_RBusDevCommData::DoCmdBreak(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
391 { |
|
392 TInt timeOut=0; |
|
393 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
394 |
|
395 TInt time; |
|
396 if ( !GetIntFromConfig(aSection, KFldTime, time) ) |
|
397 { |
|
398 ERR_PRINTF2(KLogMissingParameter, &KFldTime()); |
|
399 SetBlockResult(EFail); |
|
400 } |
|
401 else |
|
402 { |
|
403 INFO_PRINTF1(_L("Break")); |
|
404 iBusDevComm->Break(iCallbackBreak->iStatus, time); |
|
405 iCallbackBreak->Activate(aAsyncErrorIndex, timeOut); |
|
406 IncOutstanding(); |
|
407 } |
|
408 } |
|
409 |
|
410 void CT_RBusDevCommData::DoCmdBreakCancel() |
|
411 { |
|
412 INFO_PRINTF1(_L("BreakCancel")); |
|
413 iBusDevComm->BreakCancel(); |
|
414 } |
|
415 |
|
416 void CT_RBusDevCommData::DoCmdCapsL(const TDesC& aSection) |
|
417 { |
|
418 TPtrC dataName; |
|
419 if ( GetStringFromConfig(aSection, KFldCaps, dataName) ) |
|
420 { |
|
421 CT_TCommCapsV01Data* wrapper=static_cast<CT_TCommCapsV01Data*>(GetDataWrapperL(dataName)); |
|
422 TDes8* data=wrapper->Descriptor(); |
|
423 if ( data!=NULL ) |
|
424 { |
|
425 INFO_PRINTF1(_L("Caps")); |
|
426 iBusDevComm->Caps(*data); |
|
427 } |
|
428 else |
|
429 { |
|
430 ERR_PRINTF2(KLogNullCapsData, &dataName); |
|
431 SetBlockResult(EFail); |
|
432 } |
|
433 } |
|
434 else |
|
435 { |
|
436 ERR_PRINTF2(KLogMissingParameter, &KFldCaps()); |
|
437 SetBlockResult(EFail); |
|
438 } |
|
439 } |
|
440 |
|
441 void CT_RBusDevCommData::DoCmdConfigL(const TDesC& aSection) |
|
442 { |
|
443 TPtrC dataName; |
|
444 if ( GetStringFromConfig(aSection, KFldConfig, dataName) ) |
|
445 { |
|
446 CT_TCommConfigV01Data* wrapper=static_cast<CT_TCommConfigV01Data*>(GetDataWrapperL(dataName)); |
|
447 TDes8* data=wrapper->Descriptor(); |
|
448 if ( data!=NULL ) |
|
449 { |
|
450 INFO_PRINTF1(_L("Config")); |
|
451 iBusDevComm->Config(*data); |
|
452 } |
|
453 else |
|
454 { |
|
455 ERR_PRINTF2(KLogNullConfigData, &dataName); |
|
456 SetBlockResult(EFail); |
|
457 } |
|
458 } |
|
459 else |
|
460 { |
|
461 ERR_PRINTF2(KLogMissingParameter, &KFldConfig()); |
|
462 SetBlockResult(EFail); |
|
463 } |
|
464 } |
|
465 |
|
466 void CT_RBusDevCommData::DoCmdMinTurnaroundTime(const TDesC& aSection) |
|
467 { |
|
468 TUint actual=iBusDevComm->MinTurnaroundTime(); |
|
469 INFO_PRINTF2(_L("MinTurnaroundTime : %d"), actual); |
|
470 |
|
471 TUint expected; |
|
472 if ( GetUintFromConfig(aSection, KFldExpected(), expected) ) |
|
473 { |
|
474 if ( expected!=actual ) |
|
475 { |
|
476 ERR_PRINTF1(KLogErrorExpectedValue); |
|
477 SetBlockResult(EFail); |
|
478 } |
|
479 } |
|
480 |
|
481 TBool save=EFalse; |
|
482 GetBoolFromConfig(aSection, KFldSave(), save); |
|
483 if ( save ) |
|
484 { |
|
485 iMinTurnaroundTime=actual; |
|
486 } |
|
487 } |
|
488 |
|
489 void CT_RBusDevCommData::DoCmdNotifyReceiveDataAvailable(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
490 { |
|
491 TInt timeOut=0; |
|
492 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
493 |
|
494 INFO_PRINTF1(_L("NotifyReceiveDataAvailable")); |
|
495 iBusDevComm->NotifyReceiveDataAvailable(iCallbackNotifyReceiveDataAvailable->iStatus); |
|
496 iCallbackNotifyReceiveDataAvailable->Activate(aAsyncErrorIndex, timeOut); |
|
497 IncOutstanding(); |
|
498 } |
|
499 |
|
500 void CT_RBusDevCommData::DoCmdNotifyReceiveDataAvailableCancel() |
|
501 { |
|
502 INFO_PRINTF1(_L("NotifyReceiveDataAvailableCancel")); |
|
503 iBusDevComm->NotifyReceiveDataAvailableCancel(); |
|
504 } |
|
505 |
|
506 void CT_RBusDevCommData::DoCmdNotifySignalChange(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
507 { |
|
508 TInt timeOut=0; |
|
509 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
510 |
|
511 iHasNotifySignalsExpected=GetOrFromConfig(aSection, KFldExpected(), iEnumTableSignals, iNotifySignalsExpected); |
|
512 |
|
513 TUint mask; |
|
514 if ( GetOrFromConfig(aSection, KFldMask(), iEnumTableSignals, mask) ) |
|
515 { |
|
516 INFO_PRINTF1(_L("NotifySignalChange with mask")); |
|
517 iBusDevComm->NotifySignalChange(iCallbackNotifySignalChange->iStatus, iNotifySignals, mask); |
|
518 } |
|
519 else |
|
520 { |
|
521 INFO_PRINTF1(_L("NotifySignalChange without mask")); |
|
522 iBusDevComm->NotifySignalChange(iCallbackNotifySignalChange->iStatus, iNotifySignals); |
|
523 } |
|
524 iCallbackNotifySignalChange->Activate(aAsyncErrorIndex, timeOut); |
|
525 IncOutstanding(); |
|
526 } |
|
527 |
|
528 void CT_RBusDevCommData::DoCmdNotifySignalChangeCancel() |
|
529 { |
|
530 INFO_PRINTF1(_L("NotifySignalChangeCancel")); |
|
531 iBusDevComm->NotifySignalChangeCancel(); |
|
532 } |
|
533 |
|
534 TInt CT_RBusDevCommData::DoCmdOpen(const TDesC& aSection) |
|
535 { |
|
536 TBool dataOk=ETrue; |
|
537 |
|
538 TPtrC pdd; |
|
539 if ( GetStringFromConfig(aSection, KFldPortPDD, pdd) && pdd.Length()!=0 ) |
|
540 { |
|
541 TInt errLoad=User::LoadPhysicalDevice(pdd); |
|
542 if ( (errLoad!=KErrNone) && (errLoad!=KErrAlreadyExists) ) |
|
543 { |
|
544 dataOk=EFalse; |
|
545 ERR_PRINTF3(KLogLoadPhysicalDeviceError, &pdd, errLoad); |
|
546 SetBlockResult(EFail); |
|
547 } |
|
548 } |
|
549 |
|
550 TPtrC ldd; |
|
551 if ( GetStringFromConfig(aSection, KFldPortLDD, ldd) && ldd.Length()!=0 ) |
|
552 { |
|
553 TInt errLoad=User::LoadLogicalDevice(ldd); |
|
554 if ( (errLoad!=KErrNone) && (errLoad!=KErrAlreadyExists) ) |
|
555 { |
|
556 dataOk=EFalse; |
|
557 ERR_PRINTF3(KLogLoadLogicalDeviceError, &ldd, errLoad); |
|
558 SetBlockResult(EFail); |
|
559 } |
|
560 } |
|
561 |
|
562 TInt unit; |
|
563 if ( !GetIntFromConfig(aSection, KFldUnit, unit) ) |
|
564 { |
|
565 dataOk=EFalse; |
|
566 ERR_PRINTF2(KLogMissingParameter, &KFldUnit()); |
|
567 SetBlockResult(EFail); |
|
568 } |
|
569 |
|
570 TInt err=KErrNone; |
|
571 if ( dataOk ) |
|
572 { |
|
573 INFO_PRINTF1(_L("Open")); |
|
574 err=iBusDevComm->Open(unit); |
|
575 } |
|
576 |
|
577 return err; |
|
578 } |
|
579 |
|
580 TInt CT_RBusDevCommData::DoCmdQueryReceiveBuffer(const TDesC& aSection) |
|
581 { |
|
582 INFO_PRINTF1(_L("QueryReceiveBuffer")); |
|
583 TInt actual=iBusDevComm->QueryReceiveBuffer(); |
|
584 TInt ret=KErrNone; |
|
585 if ( actual<0 ) |
|
586 { |
|
587 ret=actual; |
|
588 } |
|
589 else |
|
590 { |
|
591 TInt expected; |
|
592 if ( GetIntFromConfig(aSection, KFldExpected(), expected) ) |
|
593 { |
|
594 if ( expected!=actual ) |
|
595 { |
|
596 ERR_PRINTF1(KLogErrorExpectedValue); |
|
597 SetBlockResult(EFail); |
|
598 } |
|
599 } |
|
600 |
|
601 TBool isEmpty; |
|
602 if ( GetBoolFromConfig(aSection, KFldIsEmpty(), isEmpty) ) |
|
603 { |
|
604 if ( isEmpty ) |
|
605 { |
|
606 if ( actual!=0 ) |
|
607 { |
|
608 ERR_PRINTF1(KLogErrorExpectedValue); |
|
609 SetBlockResult(EFail); |
|
610 } |
|
611 } |
|
612 else |
|
613 { |
|
614 if ( actual==0 ) |
|
615 { |
|
616 ERR_PRINTF1(KLogErrorExpectedValue); |
|
617 SetBlockResult(EFail); |
|
618 } |
|
619 } |
|
620 } |
|
621 |
|
622 TBool save=EFalse; |
|
623 GetBoolFromConfig(aSection, KFldSave(), save); |
|
624 if ( save ) |
|
625 { |
|
626 iBufferLength=actual; |
|
627 } |
|
628 } |
|
629 |
|
630 return ret; |
|
631 } |
|
632 |
|
633 void CT_RBusDevCommData::DoCmdReadL(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
634 { |
|
635 TInt timeOut=0; |
|
636 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
637 |
|
638 TBool useLength=EFalse; |
|
639 GetBoolFromConfig(aSection, KFldUseLength(), useLength); |
|
640 |
|
641 PrepareReadExpectedBufferLengthL(*iCallbackRead, aSection); |
|
642 if ( iBufferLength>0 ) |
|
643 { |
|
644 delete iBufferRead; |
|
645 iBufferRead=HBufC8::New(iBufferLength); |
|
646 |
|
647 iBufferReadPtr.Set(iBufferRead->Des()); |
|
648 if ( useLength ) |
|
649 { |
|
650 INFO_PRINTF2(_L("Read with length %d"), iBufferLength); |
|
651 iBusDevComm->Read(iCallbackRead->iStatus, iBufferReadPtr, iBufferLength); |
|
652 } |
|
653 else |
|
654 { |
|
655 INFO_PRINTF1(_L("Read without length")); |
|
656 iBusDevComm->Read(iCallbackRead->iStatus, iBufferReadPtr); |
|
657 } |
|
658 iCallbackRead->Activate(aAsyncErrorIndex, timeOut); |
|
659 IncOutstanding(); |
|
660 } |
|
661 } |
|
662 |
|
663 void CT_RBusDevCommData::DoCmdReadCancel() |
|
664 { |
|
665 INFO_PRINTF1(_L("ReadCancel")); |
|
666 iBusDevComm->ReadCancel(); |
|
667 } |
|
668 |
|
669 void CT_RBusDevCommData::DoCmdReadOneOrMoreL(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
670 { |
|
671 TInt timeOut=0; |
|
672 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
673 |
|
674 PrepareReadExpectedBufferLengthL(*iCallbackReadOneOrMore, aSection); |
|
675 if ( iBufferLength>0 ) |
|
676 { |
|
677 delete iBufferRead; |
|
678 iBufferRead=HBufC8::New(iBufferLength); |
|
679 |
|
680 iBufferReadPtr.Set(iBufferRead->Des()); |
|
681 iBufferReadPtr.SetLength(iBufferLength); |
|
682 iBufferReadOneOrMorePtr.Set(iBufferRead->Des()); |
|
683 iBufferReadOneOrMorePtr.SetLength(iBufferLength); |
|
684 iReadOneOrMoreLeft=iBufferLength; |
|
685 INFO_PRINTF2(_L("iBufferLength=%d"), iBufferLength); |
|
686 INFO_PRINTF2(_L("iBufferRead->MaxLength=%d"), iBufferRead->Des().MaxLength()); |
|
687 INFO_PRINTF2(_L("iBufferReadPtr.Length=%d"), iBufferReadPtr.Length()); |
|
688 INFO_PRINTF2(_L("iBufferReadPtr.MaxLength=%d"), iBufferReadPtr.MaxLength()); |
|
689 INFO_PRINTF1(_L("ReadOneOrMore")); |
|
690 iBusDevComm->ReadOneOrMore(iCallbackReadOneOrMore->iStatus, iBufferReadPtr); |
|
691 iCallbackReadOneOrMore->Activate(aAsyncErrorIndex, timeOut); |
|
692 IncOutstanding(); |
|
693 } |
|
694 } |
|
695 |
|
696 void CT_RBusDevCommData::DoCmdReceiveBufferLength(const TDesC& aSection) |
|
697 { |
|
698 TInt actual=iBusDevComm->ReceiveBufferLength(); |
|
699 INFO_PRINTF2(_L("ReceiveBufferLength : %d"), actual); |
|
700 |
|
701 TInt expected; |
|
702 if ( GetIntFromConfig(aSection, KFldExpected(), expected) ) |
|
703 { |
|
704 if ( expected!=actual ) |
|
705 { |
|
706 ERR_PRINTF1(KLogErrorExpectedValue); |
|
707 SetBlockResult(EFail); |
|
708 } |
|
709 } |
|
710 |
|
711 TBool save=EFalse; |
|
712 GetBoolFromConfig(aSection, KFldSave(), save); |
|
713 if ( save ) |
|
714 { |
|
715 iReceiveBufferLength=actual; |
|
716 } |
|
717 } |
|
718 |
|
719 void CT_RBusDevCommData::DoCmdResetBuffers() |
|
720 { |
|
721 INFO_PRINTF1(_L("ResetBuffers")); |
|
722 iBusDevComm->ResetBuffers(); |
|
723 } |
|
724 |
|
725 TInt CT_RBusDevCommData::DoCmdSetConfigL(const TDesC& aSection) |
|
726 { |
|
727 TInt ret=KErrNone; |
|
728 |
|
729 TPtrC dataName; |
|
730 if ( GetStringFromConfig(aSection, KFldConfig, dataName) ) |
|
731 { |
|
732 CT_TCommConfigV01Data* wrapper=static_cast<CT_TCommConfigV01Data*>(GetDataWrapperL(dataName)); |
|
733 TDes8* data=wrapper->Descriptor(); |
|
734 if ( data!=NULL ) |
|
735 { |
|
736 INFO_PRINTF1(_L("SetConfig")); |
|
737 ret=iBusDevComm->SetConfig(*data); |
|
738 } |
|
739 else |
|
740 { |
|
741 ERR_PRINTF2(KLogNullConfigData, &dataName); |
|
742 SetBlockResult(EFail); |
|
743 } |
|
744 } |
|
745 else |
|
746 { |
|
747 ERR_PRINTF2(KLogMissingParameter, &KFldConfig()); |
|
748 SetBlockResult(EFail); |
|
749 } |
|
750 |
|
751 return ret; |
|
752 } |
|
753 |
|
754 TInt CT_RBusDevCommData::DoCmdSetMinTurnaroundTime(const TDesC& aSection) |
|
755 { |
|
756 TUint value=iMinTurnaroundTime; |
|
757 GetUintFromConfig(aSection, KFldValue(), value); |
|
758 |
|
759 INFO_PRINTF1(_L("SetMinTurnaroundTime")); |
|
760 return iBusDevComm->SetMinTurnaroundTime(value); |
|
761 } |
|
762 |
|
763 TInt CT_RBusDevCommData::DoCmdSetReceiveBufferLength(const TDesC& aSection) |
|
764 { |
|
765 TInt value=iReceiveBufferLength; |
|
766 GetIntFromConfig(aSection, KFldValue(), value); |
|
767 |
|
768 INFO_PRINTF1(_L("SetReceiveBufferLength")); |
|
769 return iBusDevComm->SetReceiveBufferLength(value); |
|
770 } |
|
771 |
|
772 void CT_RBusDevCommData::DoCmdSetSignals(const TDesC& aSection) |
|
773 { |
|
774 TUint setMask=iSignals; |
|
775 GetOrFromConfig(aSection, KFldSetMask(), iEnumTableSignals, setMask); |
|
776 |
|
777 TUint clearMask=~setMask; |
|
778 GetOrFromConfig(aSection, KFldClearMask(), iEnumTableSignals, clearMask); |
|
779 |
|
780 INFO_PRINTF1(_L("SetSignals")); |
|
781 iBusDevComm->SetSignals(setMask, clearMask); |
|
782 } |
|
783 |
|
784 void CT_RBusDevCommData::DoCmdSignals(const TDesC& aSection) |
|
785 { |
|
786 TUint actual=iBusDevComm->Signals(); |
|
787 INFO_PRINTF2(_L("Signals:0x%x"), actual); |
|
788 |
|
789 TUint expected; |
|
790 if ( GetOrFromConfig(aSection, KFldExpected(), iEnumTableSignals, expected) ) |
|
791 { |
|
792 if ( expected!=actual ) |
|
793 { |
|
794 ERR_PRINTF1(KLogErrorExpectedValue); |
|
795 SetBlockResult(EFail); |
|
796 } |
|
797 } |
|
798 |
|
799 TBool save=EFalse; |
|
800 GetBoolFromConfig(aSection, KFldSave(), save); |
|
801 if ( save ) |
|
802 { |
|
803 iSignals=actual; |
|
804 } |
|
805 } |
|
806 |
|
807 void CT_RBusDevCommData::DoCmdVersionRequired(const TDesC& aSection) |
|
808 { |
|
809 TVersion version=iBusDevComm->VersionRequired(); |
|
810 TBuf<KMaxVersionName> versionName(version.Name()); |
|
811 |
|
812 INFO_PRINTF2(_L("Version name : %S"), &versionName); |
|
813 INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild); |
|
814 INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor); |
|
815 INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor); |
|
816 |
|
817 TPtrC expectedVersionName; |
|
818 if( GetStringFromConfig(aSection, KFldVersionName(), expectedVersionName) ) |
|
819 { |
|
820 if( version.Name() != expectedVersionName ) |
|
821 { |
|
822 ERR_PRINTF3(_L("Expected Version Name (%S) != Actual Version Name (%S)"), &expectedVersionName, &versionName); |
|
823 SetBlockResult(EFail); |
|
824 } |
|
825 } |
|
826 |
|
827 TInt intTemp; |
|
828 if( GetIntFromConfig(aSection, KFldVersionBuild(), intTemp) ) |
|
829 { |
|
830 if( version.iBuild != intTemp ) |
|
831 { |
|
832 ERR_PRINTF3(_L("Expected Version Build (%d) != Actual Version Build (%d)"), intTemp, version.iBuild); |
|
833 SetBlockResult(EFail); |
|
834 } |
|
835 } |
|
836 |
|
837 if( GetIntFromConfig(aSection, KFldVersionMajor(), intTemp) ) |
|
838 { |
|
839 if( version.iMajor != intTemp ) |
|
840 { |
|
841 ERR_PRINTF3(_L("Expected Version Major (%d) != Actual Version Major (%d)"), intTemp, version.iMajor); |
|
842 SetBlockResult(EFail); |
|
843 } |
|
844 } |
|
845 |
|
846 if( GetIntFromConfig(aSection, KFldVersionMinor(), intTemp) ) |
|
847 { |
|
848 if( version.iMinor != intTemp ) |
|
849 { |
|
850 ERR_PRINTF3(_L("Expected Version Minor (%d) != Actual Version Minor (%d)"), intTemp, version.iMinor); |
|
851 SetBlockResult(EFail); |
|
852 } |
|
853 } |
|
854 |
|
855 if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0) |
|
856 { |
|
857 ERR_PRINTF1(_L("Some version fields are not set!")); |
|
858 SetBlockResult(EFail); |
|
859 } |
|
860 } |
|
861 |
|
862 void CT_RBusDevCommData::DoCmdWriteL(const TDesC& aSection, const TInt aAsyncErrorIndex) |
|
863 { |
|
864 TBool dataOk=ETrue; |
|
865 TBool useLength=EFalse; |
|
866 GetBoolFromConfig(aSection, KFldUseLength(), useLength); |
|
867 |
|
868 TInt timeOut=0; |
|
869 GetIntFromConfig(aSection, KFldTimeOut, timeOut); |
|
870 |
|
871 TInt repeat=1; |
|
872 GetIntFromConfig(aSection, KFldRepeat, repeat); |
|
873 |
|
874 TPtrC data; |
|
875 if ( GetStringFromConfig(aSection, KFldData, data) ) |
|
876 { |
|
877 iCallbackWrite->PrepareFromStringL(repeat, data); |
|
878 } |
|
879 else |
|
880 { |
|
881 if ( GetStringFromConfig(aSection, KFldFile, data) ) |
|
882 { |
|
883 iCallbackWrite->PrepareFromFileL(repeat, data); |
|
884 } |
|
885 else |
|
886 { |
|
887 dataOk=EFalse; |
|
888 ERR_PRINTF2(KLogMissingParameter, &KFldData); |
|
889 ERR_PRINTF2(KLogMissingParameter, &KFldFile); |
|
890 SetBlockResult(EFail); |
|
891 } |
|
892 } |
|
893 |
|
894 if ( dataOk ) |
|
895 { |
|
896 iBufferLength=iCallbackWrite->BufferLength(); |
|
897 |
|
898 if ( useLength ) |
|
899 { |
|
900 INFO_PRINTF2(_L("Write with length %d"), iBufferLength); |
|
901 iBusDevComm->Write(iCallbackWrite->iStatus, iCallbackWrite->Buffer(), iBufferLength); |
|
902 } |
|
903 else |
|
904 { |
|
905 INFO_PRINTF1(_L("Write without length")); |
|
906 iBusDevComm->Write(iCallbackWrite->iStatus, iCallbackWrite->Buffer()); |
|
907 } |
|
908 iCallbackWrite->Activate(aAsyncErrorIndex, timeOut); |
|
909 IncOutstanding(); |
|
910 } |
|
911 } |
|
912 |
|
913 void CT_RBusDevCommData::DoCmdWriteCancel() |
|
914 { |
|
915 INFO_PRINTF1(_L("WriteCancel")); |
|
916 iBusDevComm->WriteCancel(); |
|
917 } |
|
918 |
|
919 void CT_RBusDevCommData::RunL(CActive* aActive, TInt aIndex) |
|
920 /** |
|
921 Virtual RunL - Called on completion of an asynchronous command |
|
922 @internalComponent |
|
923 @see MTPActiveCallback |
|
924 @param aActive Active Object that RunL has been called on |
|
925 @pre N/A |
|
926 @post N/A |
|
927 @leave system wide error code |
|
928 */ |
|
929 { |
|
930 TBool activeOk=ETrue; |
|
931 TInt err=KErrNone; |
|
932 |
|
933 if ( aActive!=NULL ) |
|
934 { |
|
935 err=aActive->iStatus.Int(); |
|
936 } |
|
937 |
|
938 if ( aActive==iCallbackRead ) |
|
939 { |
|
940 iCallbackRead->KillTimer(); |
|
941 INFO_PRINTF1(_L("RunL: Read()")); |
|
942 |
|
943 if ( err==KErrNone ) |
|
944 { |
|
945 TInt length=iBufferReadPtr.Length(); |
|
946 HBufC* bufferRead=HBufC::NewLC(length); |
|
947 bufferRead->Des().Copy(iBufferReadPtr); |
|
948 INFO_PRINTF2(_L("Received Data Length:%d"), length); |
|
949 if ( iHasReadExpected ) |
|
950 { |
|
951 const TDesC8& expectedBuffer=iCallbackRead->Buffer(); |
|
952 if ( expectedBuffer.Match(iBufferReadPtr)!=0 ) |
|
953 { |
|
954 for ( TInt index=0; index<length; ++index ) |
|
955 { |
|
956 const TUint8& actual=(*iBufferRead)[index]; |
|
957 const TUint8& expected=expectedBuffer[index]; |
|
958 if ( actual!=expected ) |
|
959 { |
|
960 ERR_PRINTF4(_L("Index:%d Read:%d Expected:%d"), index, (TInt)actual, (TInt)expected); |
|
961 SetBlockResult(EFail); |
|
962 } |
|
963 } |
|
964 } |
|
965 } |
|
966 CleanupStack::PopAndDestroy(bufferRead); |
|
967 } |
|
968 } |
|
969 else if ( aActive==iCallbackReadOneOrMore ) |
|
970 { |
|
971 INFO_PRINTF1(_L("RunL: ReadOneOrMore()")); |
|
972 |
|
973 if ( err==KErrNone ) |
|
974 { |
|
975 TInt length=iBufferReadPtr.Length(); |
|
976 if ( iReadOneOrMoreLeft!=length ) |
|
977 { |
|
978 iBufferReadPtr.SetLength(iReadOneOrMoreLeft); |
|
979 iReadOneOrMoreLeft-=length; |
|
980 INFO_PRINTF2(_L("iReadOneOrMoreLeft:%d"), iReadOneOrMoreLeft); |
|
981 iBufferReadPtr.Set(iBufferReadPtr.RightTPtr(iReadOneOrMoreLeft)); |
|
982 iBufferReadPtr.SetLength(iReadOneOrMoreLeft); |
|
983 INFO_PRINTF1(_L("ReadOneOrMore")); |
|
984 iBusDevComm->ReadOneOrMore(iCallbackReadOneOrMore->iStatus, iBufferReadPtr); |
|
985 iCallbackReadOneOrMore->Activate(aIndex); |
|
986 IncOutstanding(); |
|
987 } |
|
988 else |
|
989 { |
|
990 iCallbackReadOneOrMore->KillTimer(); |
|
991 HBufC* bufferRead=HBufC::NewLC(iBufferLength); |
|
992 bufferRead->Des().Copy(iBufferReadOneOrMorePtr); |
|
993 if ( iHasReadExpected ) |
|
994 { |
|
995 const TDesC8& expectedBuffer=iCallbackReadOneOrMore->Buffer(); |
|
996 if ( expectedBuffer.Match(iBufferReadOneOrMorePtr)!=0 ) |
|
997 { |
|
998 for ( TInt index=0; index<iBufferLength; ++index ) |
|
999 { |
|
1000 const TUint8& actual=(*iBufferRead)[index]; |
|
1001 const TUint8& expected=expectedBuffer[index]; |
|
1002 if ( actual!=expected ) |
|
1003 { |
|
1004 ERR_PRINTF4(_L("Index:%d Read:%d Expected:%d"), index, (TInt)actual, (TInt)expected); |
|
1005 } |
|
1006 } |
|
1007 |
|
1008 ERR_PRINTF1(KLogErrorExpectedValue); |
|
1009 SetBlockResult(EFail); |
|
1010 } |
|
1011 } |
|
1012 CleanupStack::PopAndDestroy(bufferRead); |
|
1013 } |
|
1014 } |
|
1015 } |
|
1016 else if ( aActive==iCallbackBreak ) |
|
1017 { |
|
1018 iCallbackBreak->KillTimer(); |
|
1019 INFO_PRINTF1(_L("RunL: Break()")); |
|
1020 } |
|
1021 else if ( aActive==iCallbackNotifySignalChange ) |
|
1022 { |
|
1023 iCallbackNotifySignalChange->KillTimer(); |
|
1024 INFO_PRINTF1(_L("RunL: NotifySignalChange()")); |
|
1025 |
|
1026 if ( err==KErrNone ) |
|
1027 { |
|
1028 INFO_PRINTF2(_L("Signals Changed=0x%x"), iNotifySignals); |
|
1029 if ( iHasNotifySignalsExpected ) |
|
1030 { |
|
1031 if ( iNotifySignals!=iNotifySignalsExpected ) |
|
1032 { |
|
1033 ERR_PRINTF3(KLogErrorExpectedSignal, iNotifySignals, iNotifySignalsExpected); |
|
1034 SetBlockResult(EFail); |
|
1035 } |
|
1036 } |
|
1037 } |
|
1038 } |
|
1039 else if ( aActive==iCallbackWrite ) |
|
1040 { |
|
1041 iCallbackWrite->KillTimer(); |
|
1042 INFO_PRINTF1(_L("RunL: Write()")); |
|
1043 } |
|
1044 else if ( aActive==iCallbackNotifyReceiveDataAvailable ) |
|
1045 { |
|
1046 iCallbackNotifyReceiveDataAvailable->KillTimer(); |
|
1047 INFO_PRINTF1(_L("RunL: NotifyReceiveDataAvailable()")); |
|
1048 } |
|
1049 else |
|
1050 { |
|
1051 CT_RBusLogicalChannelData::RunL(aActive, aIndex); |
|
1052 activeOk=EFalse; |
|
1053 } |
|
1054 |
|
1055 if ( activeOk ) |
|
1056 { |
|
1057 DecOutstanding(); |
|
1058 } |
|
1059 |
|
1060 if ( err!=KErrNone ) |
|
1061 { |
|
1062 ERR_PRINTF2(_L("RunL Error %d"), err); |
|
1063 SetAsyncError(aIndex, err); |
|
1064 } |
|
1065 } |
|
1066 |
|
1067 void CT_RBusDevCommData::DoCancel(CActive* aActive, TInt aIndex) |
|
1068 /** |
|
1069 Virtual DoCancel - Request to cancel the asynchronous command |
|
1070 @internalComponent |
|
1071 @see - MTPActiveCallback |
|
1072 @param aActive Active Object that DoCancel has been called on |
|
1073 @pre - N/A |
|
1074 @post - N/A |
|
1075 @leave system wide error code |
|
1076 */ |
|
1077 { |
|
1078 TBool activeOk=ETrue; |
|
1079 SetBlockResult(EFail); |
|
1080 |
|
1081 if ( aActive==iCallbackRead ) |
|
1082 { |
|
1083 ERR_PRINTF1(_L("ReadCancel Called")); |
|
1084 iBusDevComm->ReadCancel(); |
|
1085 } |
|
1086 else if ( aActive==iCallbackReadOneOrMore ) |
|
1087 { |
|
1088 ERR_PRINTF1(_L("ReadCancel Called")); |
|
1089 iBusDevComm->ReadCancel(); |
|
1090 } |
|
1091 else if ( aActive==iCallbackBreak ) |
|
1092 { |
|
1093 ERR_PRINTF1(_L("BreakCancel Called")); |
|
1094 iBusDevComm->BreakCancel(); |
|
1095 } |
|
1096 else if ( aActive==iCallbackNotifySignalChange ) |
|
1097 { |
|
1098 ERR_PRINTF1(_L("NotifySignalChangeCancel Called")); |
|
1099 iBusDevComm->NotifySignalChangeCancel(); |
|
1100 } |
|
1101 else if ( aActive==iCallbackWrite ) |
|
1102 { |
|
1103 ERR_PRINTF1(_L("WriteCancel Called")); |
|
1104 iBusDevComm->WriteCancel(); |
|
1105 } |
|
1106 else if ( aActive==iCallbackNotifyReceiveDataAvailable ) |
|
1107 { |
|
1108 ERR_PRINTF1(_L("NotifyReceiveDataAvailableCancel Called")); |
|
1109 iBusDevComm->NotifyReceiveDataAvailableCancel(); |
|
1110 } |
|
1111 else |
|
1112 { |
|
1113 activeOk=EFalse; |
|
1114 CT_RBusLogicalChannelData::DoCancel(aActive, aIndex); |
|
1115 } |
|
1116 |
|
1117 if ( activeOk ) |
|
1118 { |
|
1119 DecOutstanding(); |
|
1120 } |
|
1121 } |