1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/e32/src/T_RBusDevCommData.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1121 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include "T_RBusDevCommData.h"
1.22 +#include "T_TCommCapsV01Data.h"
1.23 +#include "T_TCommConfigV01Data.h"
1.24 +
1.25 +/*@{*/
1.26 +_LIT(KStrNull, " ");
1.27 +
1.28 +_LIT(KCmdConstructor, "new");
1.29 +_LIT(KCmdDestructor, "~");
1.30 +_LIT(KCmdBreak, "Break");
1.31 +_LIT(KCmdBreakCancel, "BreakCancel");
1.32 +_LIT(KCmdCaps, "Caps");
1.33 +_LIT(KCmdConfig, "Config");
1.34 +_LIT(KCmdMinTurnaroundTime, "MinTurnaroundTime");
1.35 +_LIT(KCmdNotifyReceiveDataAvailable, "NotifyReceiveDataAvailable");
1.36 +_LIT(KCmdNotifyReceiveDataAvailableCancel, "NotifyReceiveDataAvailableCancel");
1.37 +_LIT(KCmdNotifySignalChange, "NotifySignalChange");
1.38 +_LIT(KCmdNotifySignalChangeCancel, "NotifySignalChangeCancel");
1.39 +_LIT(KCmdOpen, "Open");
1.40 +_LIT(KCmdQueryReceiveBuffer, "QueryReceiveBuffer");
1.41 +_LIT(KCmdRead, "Read");
1.42 +_LIT(KCmdReadCancel, "ReadCancel");
1.43 +_LIT(KCmdReadOneOrMore, "ReadOneOrMore");
1.44 +_LIT(KCmdReceiveBufferLength, "ReceiveBufferLength");
1.45 +_LIT(KCmdResetBuffers, "ResetBuffers");
1.46 +_LIT(KCmdSetConfig, "SetConfig");
1.47 +_LIT(KCmdSetMinTurnaroundTime, "SetMinTurnaroundTime");
1.48 +_LIT(KCmdSetReceiveBufferLength, "SetReceiveBufferLength");
1.49 +_LIT(KCmdSetSignals, "SetSignals");
1.50 +_LIT(KCmdSignals, "Signals");
1.51 +_LIT(KCmdVersionRequired, "VersionRequired");
1.52 +_LIT(KCmdWrite, "Write");
1.53 +_LIT(KCmdWriteCancel, "WriteCancel");
1.54 +
1.55 +_LIT(KFldBufferLength, "bufferlength");
1.56 +_LIT(KFldCaps, "caps");
1.57 +_LIT(KFldClearMask, "clearmask");
1.58 +_LIT(KFldConfig, "config");
1.59 +_LIT(KFldData, "data");
1.60 +_LIT(KFldExpected, "expected");
1.61 +_LIT(KFldExpectedFile, "expected_file");
1.62 +_LIT(KFldFile, "file");
1.63 +_LIT(KFldIsEmpty, "is_empty");
1.64 +_LIT(KFldMask, "mask");
1.65 +_LIT(KFldPortPDD, "portpdd");
1.66 +_LIT(KFldPortLDD, "portldd");
1.67 +_LIT(KFldRepeat, "repeat");
1.68 +_LIT(KFldSave, "save");
1.69 +_LIT(KFldSetMask, "setmask");
1.70 +_LIT(KFldTime, "time");
1.71 +_LIT(KFldTimeOut, "timeout");
1.72 +_LIT(KFldUnit, "unit");
1.73 +_LIT(KFldUseLength, "uselength");
1.74 +_LIT(KFldValue, "value");
1.75 +_LIT(KFldVersionName, "version_name");
1.76 +_LIT(KFldVersionBuild, "version_build");
1.77 +_LIT(KFldVersionMajor, "version_major");
1.78 +_LIT(KFldVersionMinor, "version_minor");
1.79 +
1.80 +_LIT(KLogError, "Error=%d");
1.81 +_LIT(KLogErrorBufferLength, "Buffer Length %d must be greater than 0");
1.82 +_LIT(KLogErrorExpectedValue, "Expected Value does not match actual");
1.83 +_LIT(KLogErrorExpectedSignal, "Expected Signal %d does not match actual %d");
1.84 +_LIT(KLogMissingParameter, "Missing parameter '%S'");
1.85 +_LIT(KLogNullCapsData, "Caps Data - '%S' is NULL");
1.86 +_LIT(KLogNullConfigData, "Config Data - '%S' is NULL");
1.87 +_LIT(KLogLoadPhysicalDeviceError, "Load Physical Device '%S' error=%d");
1.88 +_LIT(KLogLoadLogicalDeviceError, "Load Logical Device '%S' error=%d");
1.89 +/*@}*/
1.90 +
1.91 +_LIT(KStrKSignalCTS, "KSignalCTS");
1.92 +_LIT(KStrKSignalDSR, "KSignalDSR");
1.93 +_LIT(KStrKSignalDCD, "KSignalDCD");
1.94 +_LIT(KStrKSignalRNG, "KSignalRNG");
1.95 +_LIT(KStrKSignalRTS, "KSignalRTS");
1.96 +_LIT(KStrKSignalDTR, "KSignalDTR");
1.97 +_LIT(KStrKSignalBreak, "KSignalBreak");
1.98 +const CDataWrapperBase::TEnumEntryTable CT_RBusDevCommData::iEnumTableSignals[] =
1.99 + {
1.100 +// Enum as a descriptor Enum
1.101 + KStrKSignalCTS, KSignalCTS,
1.102 + KStrKSignalDSR, KSignalDSR,
1.103 + KStrKSignalDCD, KSignalDCD,
1.104 + KStrKSignalRNG, KSignalRNG,
1.105 + KStrKSignalRTS, KSignalRTS,
1.106 + KStrKSignalDTR, KSignalDTR,
1.107 + KStrKSignalBreak, KSignalBreak,
1.108 + KStrNull, -1
1.109 + };
1.110 +
1.111 +//////////////////////////////////////////////////////////////////////
1.112 +// Construction/Destruction
1.113 +//////////////////////////////////////////////////////////////////////
1.114 +
1.115 +CT_RBusDevCommData* CT_RBusDevCommData::NewL()
1.116 + {
1.117 + CT_RBusDevCommData* ret=new (ELeave) CT_RBusDevCommData();
1.118 + CleanupStack::PushL(ret);
1.119 + ret->ConstructL();
1.120 + CleanupStack::Pop(ret);
1.121 + return ret;
1.122 + }
1.123 +
1.124 +CT_RBusDevCommData::CT_RBusDevCommData()
1.125 +: CT_RBusLogicalChannelData()
1.126 +, iBusDevComm(NULL)
1.127 +, iBufferRead(NULL)
1.128 +, iBufferReadPtr(NULL, 0)
1.129 +, iBufferReadOneOrMorePtr(NULL, 0)
1.130 +, iReadOneOrMoreLeft(0)
1.131 +, iHasReadExpected(EFalse)
1.132 +, iBufferLength(0)
1.133 +, iMinTurnaroundTime(0)
1.134 +, iReceiveBufferLength(0)
1.135 +, iSignals(0)
1.136 +, iNotifySignals(0)
1.137 +, iHasNotifySignalsExpected(EFalse)
1.138 +, iNotifySignalsExpected(0)
1.139 +, iCallbackBreak(NULL)
1.140 +, iCallbackNotifyReceiveDataAvailable(NULL)
1.141 +, iCallbackNotifySignalChange(NULL)
1.142 +, iCallbackRead(NULL)
1.143 +, iCallbackReadOneOrMore(NULL)
1.144 +, iCallbackWrite(NULL)
1.145 + {
1.146 + }
1.147 +
1.148 +CT_RBusDevCommData::~CT_RBusDevCommData()
1.149 +/**
1.150 + * Public destructor
1.151 + */
1.152 + {
1.153 + DestroyData();
1.154 +
1.155 + delete iBufferRead;
1.156 + iBufferRead=NULL;
1.157 +
1.158 + delete iCallbackWrite;
1.159 + iCallbackWrite=NULL;
1.160 +
1.161 + delete iCallbackReadOneOrMore;
1.162 + iCallbackReadOneOrMore=NULL;
1.163 +
1.164 + delete iCallbackRead;
1.165 + iCallbackRead=NULL;
1.166 +
1.167 + delete iCallbackNotifySignalChange;
1.168 + iCallbackNotifySignalChange=NULL;
1.169 +
1.170 + delete iCallbackNotifyReceiveDataAvailable;
1.171 + iCallbackNotifyReceiveDataAvailable=NULL;
1.172 +
1.173 + delete iCallbackBreak;
1.174 + iCallbackBreak=NULL;
1.175 + }
1.176 +
1.177 +void CT_RBusDevCommData::ConstructL()
1.178 + {
1.179 + iCallbackBreak =CActiveCallbackBase::NewL(*this);
1.180 + iCallbackNotifyReceiveDataAvailable =CActiveCallbackBase::NewL(*this);
1.181 + iCallbackNotifySignalChange =CActiveCallbackBase::NewL(*this);
1.182 + iCallbackRead =CT_ActiveCallbackIO::NewL(*this);
1.183 + iCallbackReadOneOrMore =CT_ActiveCallbackIO::NewL(*this);
1.184 + iCallbackWrite =CT_ActiveCallbackIO::NewL(*this);
1.185 + }
1.186 +
1.187 +void CT_RBusDevCommData::DestroyData()
1.188 + {
1.189 + delete iBusDevComm;
1.190 + iBusDevComm=NULL;
1.191 + }
1.192 +
1.193 +TAny* CT_RBusDevCommData::GetObject()
1.194 +/**
1.195 + * Return a pointer to the object that the data wraps
1.196 + *
1.197 + * @return pointer to the object that the data wraps
1.198 + */
1.199 + {
1.200 + return iBusDevComm;
1.201 + }
1.202 +
1.203 +RHandleBase* CT_RBusDevCommData::GetHandleBase()
1.204 + {
1.205 + return iBusDevComm;
1.206 + }
1.207 +
1.208 +RBusLogicalChannel* CT_RBusDevCommData::GetBusLogicalChannel()
1.209 + {
1.210 + return iBusDevComm;
1.211 + }
1.212 +
1.213 +void CT_RBusDevCommData::PrepareReadExpectedBufferLengthL(CT_ActiveCallbackIO& aCallback, const TDesC& aSection)
1.214 + {
1.215 + TInt repeat=1;
1.216 + GetIntFromConfig(aSection, KFldRepeat, repeat);
1.217 +
1.218 + TPtrC readExpected;
1.219 + iHasReadExpected=GetStringFromConfig(aSection, KFldExpected, readExpected);
1.220 + if ( iHasReadExpected )
1.221 + {
1.222 + aCallback.PrepareFromStringL(repeat, readExpected);
1.223 + iBufferLength=aCallback.BufferLength();
1.224 + }
1.225 + else
1.226 + {
1.227 + iHasReadExpected=GetStringFromConfig(aSection, KFldExpectedFile, readExpected);
1.228 + if ( iHasReadExpected )
1.229 + {
1.230 + aCallback.PrepareFromFileL(repeat, readExpected);
1.231 + }
1.232 + }
1.233 +
1.234 + if ( iHasReadExpected )
1.235 + {
1.236 + iBufferLength=aCallback.BufferLength();
1.237 + }
1.238 +
1.239 + GetIntFromConfig(aSection, KFldBufferLength, iBufferLength);
1.240 + if ( iBufferLength <= 0 )
1.241 + {
1.242 + ERR_PRINTF2(KLogErrorBufferLength, iBufferLength);
1.243 + SetBlockResult(EFail);
1.244 + }
1.245 + }
1.246 +
1.247 +TBool CT_RBusDevCommData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
1.248 +/**
1.249 + * Process a command read from the ini file
1.250 + *
1.251 + * @param aCommand The command to process
1.252 + * @param aSection The section in the ini containing data for the command
1.253 + * @param aAsyncErrorIndex Command index for async calls to return errors to
1.254 + *
1.255 + * @return ETrue if the command is processed
1.256 + *
1.257 + * @leave System wide error
1.258 + */
1.259 + {
1.260 + TBool ret=ETrue;
1.261 + TInt err=KErrNone;
1.262 +
1.263 + if ( aCommand==KCmdConstructor )
1.264 + {
1.265 + err=DoCmdConstructor();
1.266 + }
1.267 + else if ( aCommand==KCmdDestructor )
1.268 + {
1.269 + DoCmdDestructor();
1.270 + }
1.271 + else if ( aCommand==KCmdBreak )
1.272 + {
1.273 + DoCmdBreak(aSection, aAsyncErrorIndex);
1.274 + }
1.275 + else if ( aCommand==KCmdBreakCancel )
1.276 + {
1.277 + DoCmdBreakCancel();
1.278 + }
1.279 + else if ( aCommand==KCmdCaps )
1.280 + {
1.281 + DoCmdCapsL(aSection);
1.282 + }
1.283 + else if ( aCommand==KCmdConfig )
1.284 + {
1.285 + DoCmdConfigL(aSection);
1.286 + }
1.287 + else if ( aCommand==KCmdMinTurnaroundTime )
1.288 + {
1.289 + DoCmdMinTurnaroundTime(aSection);
1.290 + }
1.291 + else if ( aCommand==KCmdNotifyReceiveDataAvailable )
1.292 + {
1.293 + DoCmdNotifyReceiveDataAvailable(aSection, aAsyncErrorIndex);
1.294 + }
1.295 + else if ( aCommand==KCmdNotifyReceiveDataAvailableCancel )
1.296 + {
1.297 + DoCmdNotifyReceiveDataAvailableCancel();
1.298 + }
1.299 + else if ( aCommand==KCmdNotifySignalChange )
1.300 + {
1.301 + DoCmdNotifySignalChange(aSection, aAsyncErrorIndex);
1.302 + }
1.303 + else if ( aCommand==KCmdNotifySignalChangeCancel )
1.304 + {
1.305 + DoCmdNotifySignalChangeCancel();
1.306 + }
1.307 + else if ( aCommand==KCmdOpen )
1.308 + {
1.309 + err=DoCmdOpen(aSection);
1.310 + }
1.311 + else if ( aCommand==KCmdQueryReceiveBuffer )
1.312 + {
1.313 + err=DoCmdQueryReceiveBuffer(aSection);
1.314 + }
1.315 + else if ( aCommand==KCmdRead )
1.316 + {
1.317 + DoCmdReadL(aSection, aAsyncErrorIndex);
1.318 + }
1.319 + else if ( aCommand==KCmdReadCancel )
1.320 + {
1.321 + DoCmdReadCancel();
1.322 + }
1.323 + else if ( aCommand==KCmdReadOneOrMore )
1.324 + {
1.325 + DoCmdReadOneOrMoreL(aSection, aAsyncErrorIndex);
1.326 + }
1.327 + else if ( aCommand==KCmdReceiveBufferLength )
1.328 + {
1.329 + DoCmdReceiveBufferLength(aSection);
1.330 + }
1.331 + else if ( aCommand==KCmdResetBuffers )
1.332 + {
1.333 + DoCmdResetBuffers();
1.334 + }
1.335 + else if ( aCommand==KCmdSetConfig )
1.336 + {
1.337 + err=DoCmdSetConfigL(aSection);
1.338 + }
1.339 + else if ( aCommand==KCmdSetMinTurnaroundTime )
1.340 + {
1.341 + err=DoCmdSetMinTurnaroundTime(aSection);
1.342 + }
1.343 + else if ( aCommand==KCmdSetReceiveBufferLength )
1.344 + {
1.345 + err=DoCmdSetReceiveBufferLength(aSection);
1.346 + }
1.347 + else if ( aCommand==KCmdSetSignals )
1.348 + {
1.349 + DoCmdSetSignals(aSection);
1.350 + }
1.351 + else if ( aCommand==KCmdSignals )
1.352 + {
1.353 + DoCmdSignals(aSection);
1.354 + }
1.355 + else if ( aCommand==KCmdVersionRequired )
1.356 + {
1.357 + DoCmdVersionRequired(aSection);
1.358 + }
1.359 + else if ( aCommand==KCmdWrite )
1.360 + {
1.361 + DoCmdWriteL(aSection, aAsyncErrorIndex);
1.362 + }
1.363 + else if ( aCommand==KCmdWriteCancel )
1.364 + {
1.365 + DoCmdWriteCancel();
1.366 + }
1.367 + else
1.368 + {
1.369 + ret=CT_RBusLogicalChannelData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
1.370 + }
1.371 +
1.372 + if ( err!=KErrNone )
1.373 + {
1.374 + ERR_PRINTF2(KLogError, err);
1.375 + SetError(err);
1.376 + }
1.377 +
1.378 + return ret;
1.379 + }
1.380 +
1.381 +TInt CT_RBusDevCommData::DoCmdConstructor()
1.382 + {
1.383 + DestroyData();
1.384 + TRAPD(err, iBusDevComm=new (ELeave) RBusDevComm());
1.385 + return err;
1.386 + }
1.387 +
1.388 +void CT_RBusDevCommData::DoCmdDestructor()
1.389 + {
1.390 + DestroyData();
1.391 + }
1.392 +
1.393 +void CT_RBusDevCommData::DoCmdBreak(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.394 + {
1.395 + TInt timeOut=0;
1.396 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.397 +
1.398 + TInt time;
1.399 + if ( !GetIntFromConfig(aSection, KFldTime, time) )
1.400 + {
1.401 + ERR_PRINTF2(KLogMissingParameter, &KFldTime());
1.402 + SetBlockResult(EFail);
1.403 + }
1.404 + else
1.405 + {
1.406 + INFO_PRINTF1(_L("Break"));
1.407 + iBusDevComm->Break(iCallbackBreak->iStatus, time);
1.408 + iCallbackBreak->Activate(aAsyncErrorIndex, timeOut);
1.409 + IncOutstanding();
1.410 + }
1.411 + }
1.412 +
1.413 +void CT_RBusDevCommData::DoCmdBreakCancel()
1.414 + {
1.415 + INFO_PRINTF1(_L("BreakCancel"));
1.416 + iBusDevComm->BreakCancel();
1.417 + }
1.418 +
1.419 +void CT_RBusDevCommData::DoCmdCapsL(const TDesC& aSection)
1.420 + {
1.421 + TPtrC dataName;
1.422 + if ( GetStringFromConfig(aSection, KFldCaps, dataName) )
1.423 + {
1.424 + CT_TCommCapsV01Data* wrapper=static_cast<CT_TCommCapsV01Data*>(GetDataWrapperL(dataName));
1.425 + TDes8* data=wrapper->Descriptor();
1.426 + if ( data!=NULL )
1.427 + {
1.428 + INFO_PRINTF1(_L("Caps"));
1.429 + iBusDevComm->Caps(*data);
1.430 + }
1.431 + else
1.432 + {
1.433 + ERR_PRINTF2(KLogNullCapsData, &dataName);
1.434 + SetBlockResult(EFail);
1.435 + }
1.436 + }
1.437 + else
1.438 + {
1.439 + ERR_PRINTF2(KLogMissingParameter, &KFldCaps());
1.440 + SetBlockResult(EFail);
1.441 + }
1.442 + }
1.443 +
1.444 +void CT_RBusDevCommData::DoCmdConfigL(const TDesC& aSection)
1.445 + {
1.446 + TPtrC dataName;
1.447 + if ( GetStringFromConfig(aSection, KFldConfig, dataName) )
1.448 + {
1.449 + CT_TCommConfigV01Data* wrapper=static_cast<CT_TCommConfigV01Data*>(GetDataWrapperL(dataName));
1.450 + TDes8* data=wrapper->Descriptor();
1.451 + if ( data!=NULL )
1.452 + {
1.453 + INFO_PRINTF1(_L("Config"));
1.454 + iBusDevComm->Config(*data);
1.455 + }
1.456 + else
1.457 + {
1.458 + ERR_PRINTF2(KLogNullConfigData, &dataName);
1.459 + SetBlockResult(EFail);
1.460 + }
1.461 + }
1.462 + else
1.463 + {
1.464 + ERR_PRINTF2(KLogMissingParameter, &KFldConfig());
1.465 + SetBlockResult(EFail);
1.466 + }
1.467 + }
1.468 +
1.469 +void CT_RBusDevCommData::DoCmdMinTurnaroundTime(const TDesC& aSection)
1.470 + {
1.471 + TUint actual=iBusDevComm->MinTurnaroundTime();
1.472 + INFO_PRINTF2(_L("MinTurnaroundTime : %d"), actual);
1.473 +
1.474 + TUint expected;
1.475 + if ( GetUintFromConfig(aSection, KFldExpected(), expected) )
1.476 + {
1.477 + if ( expected!=actual )
1.478 + {
1.479 + ERR_PRINTF1(KLogErrorExpectedValue);
1.480 + SetBlockResult(EFail);
1.481 + }
1.482 + }
1.483 +
1.484 + TBool save=EFalse;
1.485 + GetBoolFromConfig(aSection, KFldSave(), save);
1.486 + if ( save )
1.487 + {
1.488 + iMinTurnaroundTime=actual;
1.489 + }
1.490 + }
1.491 +
1.492 +void CT_RBusDevCommData::DoCmdNotifyReceiveDataAvailable(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.493 + {
1.494 + TInt timeOut=0;
1.495 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.496 +
1.497 + INFO_PRINTF1(_L("NotifyReceiveDataAvailable"));
1.498 + iBusDevComm->NotifyReceiveDataAvailable(iCallbackNotifyReceiveDataAvailable->iStatus);
1.499 + iCallbackNotifyReceiveDataAvailable->Activate(aAsyncErrorIndex, timeOut);
1.500 + IncOutstanding();
1.501 + }
1.502 +
1.503 +void CT_RBusDevCommData::DoCmdNotifyReceiveDataAvailableCancel()
1.504 + {
1.505 + INFO_PRINTF1(_L("NotifyReceiveDataAvailableCancel"));
1.506 + iBusDevComm->NotifyReceiveDataAvailableCancel();
1.507 + }
1.508 +
1.509 +void CT_RBusDevCommData::DoCmdNotifySignalChange(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.510 + {
1.511 + TInt timeOut=0;
1.512 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.513 +
1.514 + iHasNotifySignalsExpected=GetOrFromConfig(aSection, KFldExpected(), iEnumTableSignals, iNotifySignalsExpected);
1.515 +
1.516 + TUint mask;
1.517 + if ( GetOrFromConfig(aSection, KFldMask(), iEnumTableSignals, mask) )
1.518 + {
1.519 + INFO_PRINTF1(_L("NotifySignalChange with mask"));
1.520 + iBusDevComm->NotifySignalChange(iCallbackNotifySignalChange->iStatus, iNotifySignals, mask);
1.521 + }
1.522 + else
1.523 + {
1.524 + INFO_PRINTF1(_L("NotifySignalChange without mask"));
1.525 + iBusDevComm->NotifySignalChange(iCallbackNotifySignalChange->iStatus, iNotifySignals);
1.526 + }
1.527 + iCallbackNotifySignalChange->Activate(aAsyncErrorIndex, timeOut);
1.528 + IncOutstanding();
1.529 + }
1.530 +
1.531 +void CT_RBusDevCommData::DoCmdNotifySignalChangeCancel()
1.532 + {
1.533 + INFO_PRINTF1(_L("NotifySignalChangeCancel"));
1.534 + iBusDevComm->NotifySignalChangeCancel();
1.535 + }
1.536 +
1.537 +TInt CT_RBusDevCommData::DoCmdOpen(const TDesC& aSection)
1.538 + {
1.539 + TBool dataOk=ETrue;
1.540 +
1.541 + TPtrC pdd;
1.542 + if ( GetStringFromConfig(aSection, KFldPortPDD, pdd) && pdd.Length()!=0 )
1.543 + {
1.544 + TInt errLoad=User::LoadPhysicalDevice(pdd);
1.545 + if ( (errLoad!=KErrNone) && (errLoad!=KErrAlreadyExists) )
1.546 + {
1.547 + dataOk=EFalse;
1.548 + ERR_PRINTF3(KLogLoadPhysicalDeviceError, &pdd, errLoad);
1.549 + SetBlockResult(EFail);
1.550 + }
1.551 + }
1.552 +
1.553 + TPtrC ldd;
1.554 + if ( GetStringFromConfig(aSection, KFldPortLDD, ldd) && ldd.Length()!=0 )
1.555 + {
1.556 + TInt errLoad=User::LoadLogicalDevice(ldd);
1.557 + if ( (errLoad!=KErrNone) && (errLoad!=KErrAlreadyExists) )
1.558 + {
1.559 + dataOk=EFalse;
1.560 + ERR_PRINTF3(KLogLoadLogicalDeviceError, &ldd, errLoad);
1.561 + SetBlockResult(EFail);
1.562 + }
1.563 + }
1.564 +
1.565 + TInt unit;
1.566 + if ( !GetIntFromConfig(aSection, KFldUnit, unit) )
1.567 + {
1.568 + dataOk=EFalse;
1.569 + ERR_PRINTF2(KLogMissingParameter, &KFldUnit());
1.570 + SetBlockResult(EFail);
1.571 + }
1.572 +
1.573 + TInt err=KErrNone;
1.574 + if ( dataOk )
1.575 + {
1.576 + INFO_PRINTF1(_L("Open"));
1.577 + err=iBusDevComm->Open(unit);
1.578 + }
1.579 +
1.580 + return err;
1.581 + }
1.582 +
1.583 +TInt CT_RBusDevCommData::DoCmdQueryReceiveBuffer(const TDesC& aSection)
1.584 + {
1.585 + INFO_PRINTF1(_L("QueryReceiveBuffer"));
1.586 + TInt actual=iBusDevComm->QueryReceiveBuffer();
1.587 + TInt ret=KErrNone;
1.588 + if ( actual<0 )
1.589 + {
1.590 + ret=actual;
1.591 + }
1.592 + else
1.593 + {
1.594 + TInt expected;
1.595 + if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
1.596 + {
1.597 + if ( expected!=actual )
1.598 + {
1.599 + ERR_PRINTF1(KLogErrorExpectedValue);
1.600 + SetBlockResult(EFail);
1.601 + }
1.602 + }
1.603 +
1.604 + TBool isEmpty;
1.605 + if ( GetBoolFromConfig(aSection, KFldIsEmpty(), isEmpty) )
1.606 + {
1.607 + if ( isEmpty )
1.608 + {
1.609 + if ( actual!=0 )
1.610 + {
1.611 + ERR_PRINTF1(KLogErrorExpectedValue);
1.612 + SetBlockResult(EFail);
1.613 + }
1.614 + }
1.615 + else
1.616 + {
1.617 + if ( actual==0 )
1.618 + {
1.619 + ERR_PRINTF1(KLogErrorExpectedValue);
1.620 + SetBlockResult(EFail);
1.621 + }
1.622 + }
1.623 + }
1.624 +
1.625 + TBool save=EFalse;
1.626 + GetBoolFromConfig(aSection, KFldSave(), save);
1.627 + if ( save )
1.628 + {
1.629 + iBufferLength=actual;
1.630 + }
1.631 + }
1.632 +
1.633 + return ret;
1.634 + }
1.635 +
1.636 +void CT_RBusDevCommData::DoCmdReadL(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.637 + {
1.638 + TInt timeOut=0;
1.639 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.640 +
1.641 + TBool useLength=EFalse;
1.642 + GetBoolFromConfig(aSection, KFldUseLength(), useLength);
1.643 +
1.644 + PrepareReadExpectedBufferLengthL(*iCallbackRead, aSection);
1.645 + if ( iBufferLength>0 )
1.646 + {
1.647 + delete iBufferRead;
1.648 + iBufferRead=HBufC8::New(iBufferLength);
1.649 +
1.650 + iBufferReadPtr.Set(iBufferRead->Des());
1.651 + if ( useLength )
1.652 + {
1.653 + INFO_PRINTF2(_L("Read with length %d"), iBufferLength);
1.654 + iBusDevComm->Read(iCallbackRead->iStatus, iBufferReadPtr, iBufferLength);
1.655 + }
1.656 + else
1.657 + {
1.658 + INFO_PRINTF1(_L("Read without length"));
1.659 + iBusDevComm->Read(iCallbackRead->iStatus, iBufferReadPtr);
1.660 + }
1.661 + iCallbackRead->Activate(aAsyncErrorIndex, timeOut);
1.662 + IncOutstanding();
1.663 + }
1.664 + }
1.665 +
1.666 +void CT_RBusDevCommData::DoCmdReadCancel()
1.667 + {
1.668 + INFO_PRINTF1(_L("ReadCancel"));
1.669 + iBusDevComm->ReadCancel();
1.670 + }
1.671 +
1.672 +void CT_RBusDevCommData::DoCmdReadOneOrMoreL(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.673 + {
1.674 + TInt timeOut=0;
1.675 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.676 +
1.677 + PrepareReadExpectedBufferLengthL(*iCallbackReadOneOrMore, aSection);
1.678 + if ( iBufferLength>0 )
1.679 + {
1.680 + delete iBufferRead;
1.681 + iBufferRead=HBufC8::New(iBufferLength);
1.682 +
1.683 + iBufferReadPtr.Set(iBufferRead->Des());
1.684 + iBufferReadPtr.SetLength(iBufferLength);
1.685 + iBufferReadOneOrMorePtr.Set(iBufferRead->Des());
1.686 + iBufferReadOneOrMorePtr.SetLength(iBufferLength);
1.687 + iReadOneOrMoreLeft=iBufferLength;
1.688 + INFO_PRINTF2(_L("iBufferLength=%d"), iBufferLength);
1.689 + INFO_PRINTF2(_L("iBufferRead->MaxLength=%d"), iBufferRead->Des().MaxLength());
1.690 + INFO_PRINTF2(_L("iBufferReadPtr.Length=%d"), iBufferReadPtr.Length());
1.691 + INFO_PRINTF2(_L("iBufferReadPtr.MaxLength=%d"), iBufferReadPtr.MaxLength());
1.692 + INFO_PRINTF1(_L("ReadOneOrMore"));
1.693 + iBusDevComm->ReadOneOrMore(iCallbackReadOneOrMore->iStatus, iBufferReadPtr);
1.694 + iCallbackReadOneOrMore->Activate(aAsyncErrorIndex, timeOut);
1.695 + IncOutstanding();
1.696 + }
1.697 + }
1.698 +
1.699 +void CT_RBusDevCommData::DoCmdReceiveBufferLength(const TDesC& aSection)
1.700 + {
1.701 + TInt actual=iBusDevComm->ReceiveBufferLength();
1.702 + INFO_PRINTF2(_L("ReceiveBufferLength : %d"), actual);
1.703 +
1.704 + TInt expected;
1.705 + if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
1.706 + {
1.707 + if ( expected!=actual )
1.708 + {
1.709 + ERR_PRINTF1(KLogErrorExpectedValue);
1.710 + SetBlockResult(EFail);
1.711 + }
1.712 + }
1.713 +
1.714 + TBool save=EFalse;
1.715 + GetBoolFromConfig(aSection, KFldSave(), save);
1.716 + if ( save )
1.717 + {
1.718 + iReceiveBufferLength=actual;
1.719 + }
1.720 + }
1.721 +
1.722 +void CT_RBusDevCommData::DoCmdResetBuffers()
1.723 + {
1.724 + INFO_PRINTF1(_L("ResetBuffers"));
1.725 + iBusDevComm->ResetBuffers();
1.726 + }
1.727 +
1.728 +TInt CT_RBusDevCommData::DoCmdSetConfigL(const TDesC& aSection)
1.729 + {
1.730 + TInt ret=KErrNone;
1.731 +
1.732 + TPtrC dataName;
1.733 + if ( GetStringFromConfig(aSection, KFldConfig, dataName) )
1.734 + {
1.735 + CT_TCommConfigV01Data* wrapper=static_cast<CT_TCommConfigV01Data*>(GetDataWrapperL(dataName));
1.736 + TDes8* data=wrapper->Descriptor();
1.737 + if ( data!=NULL )
1.738 + {
1.739 + INFO_PRINTF1(_L("SetConfig"));
1.740 + ret=iBusDevComm->SetConfig(*data);
1.741 + }
1.742 + else
1.743 + {
1.744 + ERR_PRINTF2(KLogNullConfigData, &dataName);
1.745 + SetBlockResult(EFail);
1.746 + }
1.747 + }
1.748 + else
1.749 + {
1.750 + ERR_PRINTF2(KLogMissingParameter, &KFldConfig());
1.751 + SetBlockResult(EFail);
1.752 + }
1.753 +
1.754 + return ret;
1.755 + }
1.756 +
1.757 +TInt CT_RBusDevCommData::DoCmdSetMinTurnaroundTime(const TDesC& aSection)
1.758 + {
1.759 + TUint value=iMinTurnaroundTime;
1.760 + GetUintFromConfig(aSection, KFldValue(), value);
1.761 +
1.762 + INFO_PRINTF1(_L("SetMinTurnaroundTime"));
1.763 + return iBusDevComm->SetMinTurnaroundTime(value);
1.764 + }
1.765 +
1.766 +TInt CT_RBusDevCommData::DoCmdSetReceiveBufferLength(const TDesC& aSection)
1.767 + {
1.768 + TInt value=iReceiveBufferLength;
1.769 + GetIntFromConfig(aSection, KFldValue(), value);
1.770 +
1.771 + INFO_PRINTF1(_L("SetReceiveBufferLength"));
1.772 + return iBusDevComm->SetReceiveBufferLength(value);
1.773 + }
1.774 +
1.775 +void CT_RBusDevCommData::DoCmdSetSignals(const TDesC& aSection)
1.776 + {
1.777 + TUint setMask=iSignals;
1.778 + GetOrFromConfig(aSection, KFldSetMask(), iEnumTableSignals, setMask);
1.779 +
1.780 + TUint clearMask=~setMask;
1.781 + GetOrFromConfig(aSection, KFldClearMask(), iEnumTableSignals, clearMask);
1.782 +
1.783 + INFO_PRINTF1(_L("SetSignals"));
1.784 + iBusDevComm->SetSignals(setMask, clearMask);
1.785 + }
1.786 +
1.787 +void CT_RBusDevCommData::DoCmdSignals(const TDesC& aSection)
1.788 + {
1.789 + TUint actual=iBusDevComm->Signals();
1.790 + INFO_PRINTF2(_L("Signals:0x%x"), actual);
1.791 +
1.792 + TUint expected;
1.793 + if ( GetOrFromConfig(aSection, KFldExpected(), iEnumTableSignals, expected) )
1.794 + {
1.795 + if ( expected!=actual )
1.796 + {
1.797 + ERR_PRINTF1(KLogErrorExpectedValue);
1.798 + SetBlockResult(EFail);
1.799 + }
1.800 + }
1.801 +
1.802 + TBool save=EFalse;
1.803 + GetBoolFromConfig(aSection, KFldSave(), save);
1.804 + if ( save )
1.805 + {
1.806 + iSignals=actual;
1.807 + }
1.808 + }
1.809 +
1.810 +void CT_RBusDevCommData::DoCmdVersionRequired(const TDesC& aSection)
1.811 + {
1.812 + TVersion version=iBusDevComm->VersionRequired();
1.813 + TBuf<KMaxVersionName> versionName(version.Name());
1.814 +
1.815 + INFO_PRINTF2(_L("Version name : %S"), &versionName);
1.816 + INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild);
1.817 + INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor);
1.818 + INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor);
1.819 +
1.820 + TPtrC expectedVersionName;
1.821 + if( GetStringFromConfig(aSection, KFldVersionName(), expectedVersionName) )
1.822 + {
1.823 + if( version.Name() != expectedVersionName )
1.824 + {
1.825 + ERR_PRINTF3(_L("Expected Version Name (%S) != Actual Version Name (%S)"), &expectedVersionName, &versionName);
1.826 + SetBlockResult(EFail);
1.827 + }
1.828 + }
1.829 +
1.830 + TInt intTemp;
1.831 + if( GetIntFromConfig(aSection, KFldVersionBuild(), intTemp) )
1.832 + {
1.833 + if( version.iBuild != intTemp )
1.834 + {
1.835 + ERR_PRINTF3(_L("Expected Version Build (%d) != Actual Version Build (%d)"), intTemp, version.iBuild);
1.836 + SetBlockResult(EFail);
1.837 + }
1.838 + }
1.839 +
1.840 + if( GetIntFromConfig(aSection, KFldVersionMajor(), intTemp) )
1.841 + {
1.842 + if( version.iMajor != intTemp )
1.843 + {
1.844 + ERR_PRINTF3(_L("Expected Version Major (%d) != Actual Version Major (%d)"), intTemp, version.iMajor);
1.845 + SetBlockResult(EFail);
1.846 + }
1.847 + }
1.848 +
1.849 + if( GetIntFromConfig(aSection, KFldVersionMinor(), intTemp) )
1.850 + {
1.851 + if( version.iMinor != intTemp )
1.852 + {
1.853 + ERR_PRINTF3(_L("Expected Version Minor (%d) != Actual Version Minor (%d)"), intTemp, version.iMinor);
1.854 + SetBlockResult(EFail);
1.855 + }
1.856 + }
1.857 +
1.858 + if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0)
1.859 + {
1.860 + ERR_PRINTF1(_L("Some version fields are not set!"));
1.861 + SetBlockResult(EFail);
1.862 + }
1.863 + }
1.864 +
1.865 +void CT_RBusDevCommData::DoCmdWriteL(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.866 + {
1.867 + TBool dataOk=ETrue;
1.868 + TBool useLength=EFalse;
1.869 + GetBoolFromConfig(aSection, KFldUseLength(), useLength);
1.870 +
1.871 + TInt timeOut=0;
1.872 + GetIntFromConfig(aSection, KFldTimeOut, timeOut);
1.873 +
1.874 + TInt repeat=1;
1.875 + GetIntFromConfig(aSection, KFldRepeat, repeat);
1.876 +
1.877 + TPtrC data;
1.878 + if ( GetStringFromConfig(aSection, KFldData, data) )
1.879 + {
1.880 + iCallbackWrite->PrepareFromStringL(repeat, data);
1.881 + }
1.882 + else
1.883 + {
1.884 + if ( GetStringFromConfig(aSection, KFldFile, data) )
1.885 + {
1.886 + iCallbackWrite->PrepareFromFileL(repeat, data);
1.887 + }
1.888 + else
1.889 + {
1.890 + dataOk=EFalse;
1.891 + ERR_PRINTF2(KLogMissingParameter, &KFldData);
1.892 + ERR_PRINTF2(KLogMissingParameter, &KFldFile);
1.893 + SetBlockResult(EFail);
1.894 + }
1.895 + }
1.896 +
1.897 + if ( dataOk )
1.898 + {
1.899 + iBufferLength=iCallbackWrite->BufferLength();
1.900 +
1.901 + if ( useLength )
1.902 + {
1.903 + INFO_PRINTF2(_L("Write with length %d"), iBufferLength);
1.904 + iBusDevComm->Write(iCallbackWrite->iStatus, iCallbackWrite->Buffer(), iBufferLength);
1.905 + }
1.906 + else
1.907 + {
1.908 + INFO_PRINTF1(_L("Write without length"));
1.909 + iBusDevComm->Write(iCallbackWrite->iStatus, iCallbackWrite->Buffer());
1.910 + }
1.911 + iCallbackWrite->Activate(aAsyncErrorIndex, timeOut);
1.912 + IncOutstanding();
1.913 + }
1.914 + }
1.915 +
1.916 +void CT_RBusDevCommData::DoCmdWriteCancel()
1.917 + {
1.918 + INFO_PRINTF1(_L("WriteCancel"));
1.919 + iBusDevComm->WriteCancel();
1.920 + }
1.921 +
1.922 +void CT_RBusDevCommData::RunL(CActive* aActive, TInt aIndex)
1.923 +/**
1.924 + Virtual RunL - Called on completion of an asynchronous command
1.925 + @internalComponent
1.926 + @see MTPActiveCallback
1.927 + @param aActive Active Object that RunL has been called on
1.928 + @pre N/A
1.929 + @post N/A
1.930 + @leave system wide error code
1.931 +*/
1.932 + {
1.933 + TBool activeOk=ETrue;
1.934 + TInt err=KErrNone;
1.935 +
1.936 + if ( aActive!=NULL )
1.937 + {
1.938 + err=aActive->iStatus.Int();
1.939 + }
1.940 +
1.941 + if ( aActive==iCallbackRead )
1.942 + {
1.943 + iCallbackRead->KillTimer();
1.944 + INFO_PRINTF1(_L("RunL: Read()"));
1.945 +
1.946 + if ( err==KErrNone )
1.947 + {
1.948 + TInt length=iBufferReadPtr.Length();
1.949 + HBufC* bufferRead=HBufC::NewLC(length);
1.950 + bufferRead->Des().Copy(iBufferReadPtr);
1.951 + INFO_PRINTF2(_L("Received Data Length:%d"), length);
1.952 + if ( iHasReadExpected )
1.953 + {
1.954 + const TDesC8& expectedBuffer=iCallbackRead->Buffer();
1.955 + if ( expectedBuffer.Match(iBufferReadPtr)!=0 )
1.956 + {
1.957 + for ( TInt index=0; index<length; ++index )
1.958 + {
1.959 + const TUint8& actual=(*iBufferRead)[index];
1.960 + const TUint8& expected=expectedBuffer[index];
1.961 + if ( actual!=expected )
1.962 + {
1.963 + ERR_PRINTF4(_L("Index:%d Read:%d Expected:%d"), index, (TInt)actual, (TInt)expected);
1.964 + SetBlockResult(EFail);
1.965 + }
1.966 + }
1.967 + }
1.968 + }
1.969 + CleanupStack::PopAndDestroy(bufferRead);
1.970 + }
1.971 + }
1.972 + else if ( aActive==iCallbackReadOneOrMore )
1.973 + {
1.974 + INFO_PRINTF1(_L("RunL: ReadOneOrMore()"));
1.975 +
1.976 + if ( err==KErrNone )
1.977 + {
1.978 + TInt length=iBufferReadPtr.Length();
1.979 + if ( iReadOneOrMoreLeft!=length )
1.980 + {
1.981 + iBufferReadPtr.SetLength(iReadOneOrMoreLeft);
1.982 + iReadOneOrMoreLeft-=length;
1.983 + INFO_PRINTF2(_L("iReadOneOrMoreLeft:%d"), iReadOneOrMoreLeft);
1.984 + iBufferReadPtr.Set(iBufferReadPtr.RightTPtr(iReadOneOrMoreLeft));
1.985 + iBufferReadPtr.SetLength(iReadOneOrMoreLeft);
1.986 + INFO_PRINTF1(_L("ReadOneOrMore"));
1.987 + iBusDevComm->ReadOneOrMore(iCallbackReadOneOrMore->iStatus, iBufferReadPtr);
1.988 + iCallbackReadOneOrMore->Activate(aIndex);
1.989 + IncOutstanding();
1.990 + }
1.991 + else
1.992 + {
1.993 + iCallbackReadOneOrMore->KillTimer();
1.994 + HBufC* bufferRead=HBufC::NewLC(iBufferLength);
1.995 + bufferRead->Des().Copy(iBufferReadOneOrMorePtr);
1.996 + if ( iHasReadExpected )
1.997 + {
1.998 + const TDesC8& expectedBuffer=iCallbackReadOneOrMore->Buffer();
1.999 + if ( expectedBuffer.Match(iBufferReadOneOrMorePtr)!=0 )
1.1000 + {
1.1001 + for ( TInt index=0; index<iBufferLength; ++index )
1.1002 + {
1.1003 + const TUint8& actual=(*iBufferRead)[index];
1.1004 + const TUint8& expected=expectedBuffer[index];
1.1005 + if ( actual!=expected )
1.1006 + {
1.1007 + ERR_PRINTF4(_L("Index:%d Read:%d Expected:%d"), index, (TInt)actual, (TInt)expected);
1.1008 + }
1.1009 + }
1.1010 +
1.1011 + ERR_PRINTF1(KLogErrorExpectedValue);
1.1012 + SetBlockResult(EFail);
1.1013 + }
1.1014 + }
1.1015 + CleanupStack::PopAndDestroy(bufferRead);
1.1016 + }
1.1017 + }
1.1018 + }
1.1019 + else if ( aActive==iCallbackBreak )
1.1020 + {
1.1021 + iCallbackBreak->KillTimer();
1.1022 + INFO_PRINTF1(_L("RunL: Break()"));
1.1023 + }
1.1024 + else if ( aActive==iCallbackNotifySignalChange )
1.1025 + {
1.1026 + iCallbackNotifySignalChange->KillTimer();
1.1027 + INFO_PRINTF1(_L("RunL: NotifySignalChange()"));
1.1028 +
1.1029 + if ( err==KErrNone )
1.1030 + {
1.1031 + INFO_PRINTF2(_L("Signals Changed=0x%x"), iNotifySignals);
1.1032 + if ( iHasNotifySignalsExpected )
1.1033 + {
1.1034 + if ( iNotifySignals!=iNotifySignalsExpected )
1.1035 + {
1.1036 + ERR_PRINTF3(KLogErrorExpectedSignal, iNotifySignals, iNotifySignalsExpected);
1.1037 + SetBlockResult(EFail);
1.1038 + }
1.1039 + }
1.1040 + }
1.1041 + }
1.1042 + else if ( aActive==iCallbackWrite )
1.1043 + {
1.1044 + iCallbackWrite->KillTimer();
1.1045 + INFO_PRINTF1(_L("RunL: Write()"));
1.1046 + }
1.1047 + else if ( aActive==iCallbackNotifyReceiveDataAvailable )
1.1048 + {
1.1049 + iCallbackNotifyReceiveDataAvailable->KillTimer();
1.1050 + INFO_PRINTF1(_L("RunL: NotifyReceiveDataAvailable()"));
1.1051 + }
1.1052 + else
1.1053 + {
1.1054 + CT_RBusLogicalChannelData::RunL(aActive, aIndex);
1.1055 + activeOk=EFalse;
1.1056 + }
1.1057 +
1.1058 + if ( activeOk )
1.1059 + {
1.1060 + DecOutstanding();
1.1061 + }
1.1062 +
1.1063 + if ( err!=KErrNone )
1.1064 + {
1.1065 + ERR_PRINTF2(_L("RunL Error %d"), err);
1.1066 + SetAsyncError(aIndex, err);
1.1067 + }
1.1068 + }
1.1069 +
1.1070 +void CT_RBusDevCommData::DoCancel(CActive* aActive, TInt aIndex)
1.1071 +/**
1.1072 + Virtual DoCancel - Request to cancel the asynchronous command
1.1073 + @internalComponent
1.1074 + @see - MTPActiveCallback
1.1075 + @param aActive Active Object that DoCancel has been called on
1.1076 + @pre - N/A
1.1077 + @post - N/A
1.1078 + @leave system wide error code
1.1079 +*/
1.1080 + {
1.1081 + TBool activeOk=ETrue;
1.1082 + SetBlockResult(EFail);
1.1083 +
1.1084 + if ( aActive==iCallbackRead )
1.1085 + {
1.1086 + ERR_PRINTF1(_L("ReadCancel Called"));
1.1087 + iBusDevComm->ReadCancel();
1.1088 + }
1.1089 + else if ( aActive==iCallbackReadOneOrMore )
1.1090 + {
1.1091 + ERR_PRINTF1(_L("ReadCancel Called"));
1.1092 + iBusDevComm->ReadCancel();
1.1093 + }
1.1094 + else if ( aActive==iCallbackBreak )
1.1095 + {
1.1096 + ERR_PRINTF1(_L("BreakCancel Called"));
1.1097 + iBusDevComm->BreakCancel();
1.1098 + }
1.1099 + else if ( aActive==iCallbackNotifySignalChange )
1.1100 + {
1.1101 + ERR_PRINTF1(_L("NotifySignalChangeCancel Called"));
1.1102 + iBusDevComm->NotifySignalChangeCancel();
1.1103 + }
1.1104 + else if ( aActive==iCallbackWrite )
1.1105 + {
1.1106 + ERR_PRINTF1(_L("WriteCancel Called"));
1.1107 + iBusDevComm->WriteCancel();
1.1108 + }
1.1109 + else if ( aActive==iCallbackNotifyReceiveDataAvailable )
1.1110 + {
1.1111 + ERR_PRINTF1(_L("NotifyReceiveDataAvailableCancel Called"));
1.1112 + iBusDevComm->NotifyReceiveDataAvailableCancel();
1.1113 + }
1.1114 + else
1.1115 + {
1.1116 + activeOk=EFalse;
1.1117 + CT_RBusLogicalChannelData::DoCancel(aActive, aIndex);
1.1118 + }
1.1119 +
1.1120 + if ( activeOk )
1.1121 + {
1.1122 + DecOutstanding();
1.1123 + }
1.1124 + }