telephonyserver/etelserverandcore/DSTD/ACQUIRE.CPP
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "../DSTD/DSTD.H"
       
    17 #include "../DSTD/ACQUIRE.H"
       
    18 #include "../DSTD/DACQDEF.H"
       
    19 #include <e32def.h>
       
    20 #include <f32file.h>
       
    21 
       
    22 void TsyPanic(TTsyPanic aPanic)
       
    23 //
       
    24 // Panic in tsy
       
    25 //
       
    26 	{
       
    27 	_LIT(KTsyPanic,"Tsy Panic");
       
    28 	User::Panic(KTsyPanic,aPanic);
       
    29 	}
       
    30 
       
    31 TTsyTimer::TTsyTimer()
       
    32 	{
       
    33 	iPending=EFalse;
       
    34 	}
       
    35 //
       
    36 // CAcquireEntry class
       
    37 //
       
    38 CAcquireEntry* CAcquireEntry::NewL(const TTsyReqHandle aTsyReqHandle)
       
    39 //
       
    40 //	Create new request entry
       
    41 //
       
    42 	{
       
    43 	return new(ELeave) CAcquireEntry(aTsyReqHandle);
       
    44 	}
       
    45 
       
    46 CAcquireEntry::CAcquireEntry(const TTsyReqHandle aTsyReqHandle)
       
    47 //
       
    48 //	 constructor
       
    49 //
       
    50 	{
       
    51 	iTsyReqHandle=aTsyReqHandle;
       
    52 	}
       
    53 
       
    54 CAcquireEntry::~CAcquireEntry()
       
    55 //
       
    56 //	destructor
       
    57 //
       
    58 	{}
       
    59 
       
    60 void CAcquireEntry::Deque()
       
    61 //
       
    62 //	Deque  list
       
    63 //
       
    64 	{
       
    65 	iLink.Deque();
       
    66 	iLink.iPrev=iLink.iNext=NULL;
       
    67 	}
       
    68 
       
    69 CAcquireOwnerList::CAcquireOwnerList()
       
    70 	{}
       
    71 
       
    72 CAcquireOwnerList::~CAcquireOwnerList()
       
    73 	{}
       
    74 
       
    75 CAcquireOwnerList* CAcquireOwnerList::NewL()
       
    76 //
       
    77 //	Static function to create new call
       
    78 //
       
    79 	{
       
    80 	CAcquireOwnerList* ac=new(ELeave) CAcquireOwnerList();
       
    81 	CleanupStack::PushL(ac);
       
    82 	ac->ConstructL();
       
    83 	CleanupStack::Pop();
       
    84 	return ac;
       
    85 	}
       
    86 
       
    87 void CAcquireOwnerList::ConstructL()
       
    88 	{
       
    89 	iAcquireList.SetOffset(_FOFF(CAcquireEntry,iLink));
       
    90 	}
       
    91 
       
    92 CAcquireEntry* CAcquireOwnerList::FindByTsyReqHandle(const TTsyReqHandle aTsyReqHandle)
       
    93 	{
       
    94 	CAcquireEntry* entry;
       
    95 	TDblQueIter<CAcquireEntry> iter(iAcquireList);
       
    96 	while(entry = iter++, entry!=NULL)
       
    97 		{
       
    98 		if(entry->iTsyReqHandle==aTsyReqHandle)
       
    99 			return entry;
       
   100 		}
       
   101 	return NULL;
       
   102 	}
       
   103 
       
   104 void CAcquireOwnerList::Remove(CAcquireEntry* aEntry)
       
   105 	{
       
   106 	aEntry->Deque();
       
   107 	delete aEntry;
       
   108 	}
       
   109 
       
   110 //
       
   111 // CFaxDummyBase
       
   112 //
       
   113 CFaxDummyBase::CFaxDummyBase(CPhoneFactoryDummyBase* aFac)
       
   114 	{
       
   115 	iFac=aFac;
       
   116 	}
       
   117 
       
   118 CFaxDummyBase::~CFaxDummyBase()
       
   119 	{
       
   120 	iFac->RemoveTimer(iRead);
       
   121 	iFac->RemoveTimer(iWrite);
       
   122 	iFac->RemoveTimer(iWaitForEndOfPage);
       
   123 	iFac->RemoveTimer(iProgressNotification);
       
   124 	}
       
   125 
       
   126 TInt CFaxDummyBase::RegisterNotification(const TInt /*aIpc*/)
       
   127 	{
       
   128 	return KErrNone;
       
   129 	}
       
   130 
       
   131 TInt CFaxDummyBase::DeregisterNotification(const TInt /*aIpc*/)
       
   132 	{
       
   133 	return KErrNone;
       
   134 	}
       
   135 
       
   136 CTelObject::TReqMode CFaxDummyBase::ReqModeL(const TInt aIpc)
       
   137 //
       
   138 //	mode request for fax
       
   139 //
       
   140 	{
       
   141 	CTelObject::TReqMode ret=0;
       
   142 	switch (aIpc)
       
   143 		{
       
   144 	case EEtelFaxTerminateFaxSession:
       
   145 	case EEtelFaxWaitForEndOfPage:
       
   146 		break;
       
   147 	case EEtelFaxRead:
       
   148 	case EEtelFaxWrite:
       
   149 		ret=KReqModeFlowControlObeyed;
       
   150 		break;
       
   151 	default:
       
   152 		User::Leave(KErrNotSupported);
       
   153 		break;
       
   154 		}
       
   155 	return ret;
       
   156 	}
       
   157 
       
   158 CFaxDummyBase* CFaxDummyBase::This(TAny* aPtr)
       
   159 	{
       
   160 	return REINTERPRET_CAST(CFaxDummyBase*,aPtr);
       
   161 	}
       
   162 
       
   163 TInt CFaxDummyBase::WaitForEndOfPageHandler(TAny* aPtr)
       
   164 //
       
   165 //	Completed	req
       
   166 //
       
   167 	{
       
   168 	This(aPtr)->iFac->ResetPending( This(aPtr)->iWaitForEndOfPage);
       
   169 	This(aPtr)->ReqCompleted(This(aPtr)->iWaitForEndOfPage.iTsyReqHandle,KErrNone);
       
   170 	return KErrNone;
       
   171 	}
       
   172 
       
   173 TInt CFaxDummyBase::WaitForEndOfPage(const TTsyReqHandle aTsyReqHandle)
       
   174 	{
       
   175 	iFac->QueueTimer(iWaitForEndOfPage,aTsyReqHandle,DACQ_ASYN_TIMEOUT,CFaxDummyBase::WaitForEndOfPageHandler,this);
       
   176 	return KErrNone;
       
   177 	}
       
   178 
       
   179 TInt CFaxDummyBase::Read(const TTsyReqHandle aTsyReqHandle,TDes8* aDes)
       
   180 //
       
   181 //	Fax	read
       
   182 //
       
   183 	{
       
   184 	iReadParams=aDes;
       
   185 	iFac->QueueTimer(iRead,aTsyReqHandle,DACQ_ASYN_TIMEOUT,CFaxDummyBase::ReadHandler,this);
       
   186 	return KErrNone;
       
   187 	}
       
   188 
       
   189 TInt CFaxDummyBase::ReadHandler(TAny* aPtr)
       
   190 //
       
   191 //	Completed Request
       
   192 //
       
   193 	{
       
   194 	This(aPtr)->iReadParams->Copy(DACQ_FAX_BUF_DATA);
       
   195 	This(aPtr)->iFac->ResetPending( This(aPtr)->iRead);
       
   196 	This(aPtr)->ReqCompleted(This(aPtr)->iRead.iTsyReqHandle,KErrNone);
       
   197 	return KErrNone;
       
   198 	}
       
   199 
       
   200 TInt CFaxDummyBase::TerminateFaxSession(const TTsyReqHandle aTsyReqHandle)
       
   201 	{
       
   202 	if (iFac->RemoveTimer(iRead))
       
   203 		ReqCompleted(iRead.iTsyReqHandle,KErrCancel);
       
   204 
       
   205 	if (iFac->RemoveTimer(iWrite))
       
   206 		ReqCompleted(iWrite.iTsyReqHandle,KErrCancel);
       
   207 
       
   208 	if (iFac->RemoveTimer(iWaitForEndOfPage))
       
   209 		ReqCompleted(iWaitForEndOfPage.iTsyReqHandle,KErrCancel);
       
   210 
       
   211 //	if (iFac->RemoveTimer(iProgressNotification))
       
   212 //		ReqCompleted(iProgressNotification.iTsyReqHandle,KErrCancel);
       
   213 
       
   214 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   215 	return KErrNone;
       
   216 	}
       
   217 
       
   218 TInt CFaxDummyBase::Write(const TTsyReqHandle aTsyReqHandle,TDesC8* aDes)
       
   219 	{
       
   220 	if (aDes->Compare(DACQ_FAX_BUF_DATA)!=KErrNone)
       
   221 		TsyPanic(KTsyPanicDataCorrupted);
       
   222 	iFac->QueueTimer(iWrite,aTsyReqHandle,DACQ_ASYN_TIMEOUT,CFaxDummyBase::WriteHandler,this);
       
   223 	return KErrNone;
       
   224 	}
       
   225 
       
   226 TInt CFaxDummyBase::WriteHandler(TAny* aPtr)
       
   227 	{
       
   228 	This(aPtr)->iFac->ResetPending( This(aPtr)->iWrite);
       
   229 	This(aPtr)->ReqCompleted(This(aPtr)->iWrite.iTsyReqHandle,KErrNone);
       
   230 	return KErrNone;
       
   231 	}
       
   232 
       
   233 TInt CFaxDummyBase::GetProgress(const TTsyReqHandle aTsyReqHandle,RFax::TProgress* aProgress)
       
   234 	{
       
   235 	aProgress->iSpeed=DACQ_GET_PROGRESS_SPEED;
       
   236 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   237 	return KErrNone;
       
   238 	}
       
   239 
       
   240 TInt CFaxDummyBase::ProgressNotificationHandler(TAny* aPtr)
       
   241 	{
       
   242 	This(aPtr)->iFac->ResetPending( This(aPtr)->iProgressNotification);
       
   243 	This(aPtr)->ReqCompleted(This(aPtr)->iProgressNotification.iTsyReqHandle,KErrNone);
       
   244 	return KErrNone;
       
   245 	}
       
   246 
       
   247 TInt CFaxDummyBase::ProgressNotification(const TTsyReqHandle aTsyReqHandle, RFax::TProgress* aProgress)
       
   248 	{
       
   249 	iProgressNotificationParams=aProgress;
       
   250 	iFac->QueueTimer(iProgressNotification,aTsyReqHandle,DACQ_ASYN_TIMEOUT,CFaxDummyBase::ProgressNotificationHandler,this);
       
   251 	return KErrNone;
       
   252 	}
       
   253 
       
   254 TInt CFaxDummyBase::ProgressNotificationCancel(const TTsyReqHandle aTsyReqHandle)
       
   255 	{
       
   256 	if(aTsyReqHandle==iProgressNotification.iTsyReqHandle)
       
   257 		{
       
   258 		iFac->RemoveTimer(iProgressNotification);
       
   259 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   260 		return KErrNone;
       
   261 		}
       
   262 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   263 	return KErrNone;
       
   264 	}
       
   265 
       
   266 //
       
   267 // CCallDummyBase
       
   268 //
       
   269 CCallDummyBase::CCallDummyBase(CPhoneFactoryDummyBase* aFac)
       
   270 	{
       
   271 	iFac=aFac;
       
   272 	}
       
   273 
       
   274 void CCallDummyBase::ConstructL()
       
   275 	{
       
   276 	iList=CAcquireOwnerList::NewL();
       
   277 	}
       
   278 
       
   279 CCallDummyBase::~CCallDummyBase()
       
   280 	{
       
   281 	delete iList;
       
   282 	iFac->RemoveTimer(iNotifyHookChange);
       
   283 	iFac->RemoveTimer(iNotifyStatusChange);
       
   284 	iFac->RemoveTimer(iDial);
       
   285 	iFac->RemoveTimer(iConnect);
       
   286 	iFac->RemoveTimer(iAnswer);
       
   287 	iFac->RemoveTimer(iHangUp);
       
   288 	}
       
   289 
       
   290 TInt CCallDummyBase::RegisterNotification(const TInt /*aIpc*/)
       
   291 	{
       
   292 	return KErrNone;
       
   293 	}
       
   294 TInt CCallDummyBase::DeregisterNotification(const TInt /*aIpc*/)
       
   295 	{
       
   296 	return KErrNone;
       
   297 	}
       
   298 	
       
   299 CCallDummyBase* CCallDummyBase::This(TAny* aPtr)
       
   300 	{
       
   301 	return REINTERPRET_CAST(CCallDummyBase*,aPtr);
       
   302 	}
       
   303 
       
   304 CPhoneFactoryDummyBase* CCallDummyBase::FacPtr() const
       
   305 	{
       
   306 	return iFac;
       
   307 	}
       
   308 
       
   309 TInt CCallDummyBase::CancelSubSession()
       
   310 	{
       
   311 	return KErrNone;
       
   312 	}
       
   313 
       
   314 TInt CCallDummyBase::ProcessingOwnership()
       
   315 	{
       
   316 	if (iList)
       
   317 		{	
       
   318 		if(iList->iAcquireList.IsEmpty()) // no one interested in this call !
       
   319 			{
       
   320 			SetUnowned();
       
   321 			return KErrNone;
       
   322 			}
       
   323 
       
   324 		CAcquireEntry* entry=iList->iAcquireList.First();
       
   325 		if (entry) // someone interested in this call
       
   326 			{
       
   327 			SetOwnership(entry->iTsyReqHandle);
       
   328 			ReqCompleted(entry->iTsyReqHandle,KErrNone);
       
   329 			iList->Remove(entry);
       
   330 			}
       
   331 		return KErrNone;
       
   332 		}
       
   333 	else
       
   334 		return KErrNotFound;
       
   335 	}
       
   336 
       
   337 TInt CCallDummyBase::RelinquishOwnership()
       
   338 	{
       
   339 	ProcessingOwnership();
       
   340 	RelinquishOwnershipCompleted(KErrNone);
       
   341 	return KErrNone;
       
   342 	}
       
   343 
       
   344 TInt CCallDummyBase::TransferOwnership(const TTsyReqHandle aTsyReqHandle)
       
   345 //
       
   346 //	Transfer Call Ownership
       
   347 //
       
   348 	{
       
   349 	if (CheckOwnership(aTsyReqHandle)!=CCallBase::EOwnedTrue)
       
   350 		{
       
   351 		ReqCompleted(aTsyReqHandle,KErrEtelNotCallOwner);
       
   352 		return KErrNone;
       
   353 		}
       
   354 
       
   355 	if(iList->iAcquireList.IsEmpty()) // no one interested in this call !
       
   356 		{
       
   357 		ReqCompleted(aTsyReqHandle,KErrEtelNoClientInterestedInThisCall);
       
   358 		return KErrNone;
       
   359 		}
       
   360 
       
   361 	CAcquireEntry* entry=iList->iAcquireList.First();
       
   362 	if (entry) // someone interested in this call
       
   363 		{
       
   364 		SetOwnership(entry->iTsyReqHandle);
       
   365 		ReqCompleted(entry->iTsyReqHandle,KErrNone);
       
   366 		iList->Remove(entry);
       
   367 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   368 		}
       
   369 	return KErrNone;
       
   370 	}
       
   371 
       
   372 TInt CCallDummyBase::AcquireOwnership(const TTsyReqHandle aTsyReqHandle)
       
   373 //
       
   374 //	Acquire call Ownership
       
   375 //
       
   376 	{
       
   377 	TInt ret(KErrNone);
       
   378 	if (CheckOwnership(aTsyReqHandle)==CCallBase::EOwnedUnowned)
       
   379 		{
       
   380 		SetOwnership(aTsyReqHandle);
       
   381 		ReqCompleted(aTsyReqHandle,KErrNone);
       
   382 		}
       
   383 	else
       
   384 		{
       
   385 		if(iList->iAcquireList.IsEmpty())
       
   386 			// List is empty. Client is the first one to request ownership of the call.
       
   387 			{
       
   388 			CAcquireEntry* entry=NULL;
       
   389 			TRAP(ret, entry=CAcquireEntry::NewL(aTsyReqHandle));
       
   390 			if (ret==KErrNone)
       
   391 				iList->iAcquireList.AddLast(*entry);
       
   392 			}
       
   393 		else
       
   394 			// List is not empty. Another client has already requested to acquire ownership of the call.
       
   395 			// Only one client can be waiting to acquire ownership at any one time.
       
   396 			return KErrInUse;
       
   397 		}
       
   398 	return ret;
       
   399 	}
       
   400 
       
   401 TInt CCallDummyBase::AcquireOwnershipCancel(const TTsyReqHandle aTsyReqHandle)
       
   402 //
       
   403 //	Cancel Acquire Call Ownership
       
   404 //
       
   405 	{
       
   406 	CAcquireEntry* entry=iList->FindByTsyReqHandle(aTsyReqHandle);
       
   407 	if (entry)
       
   408 		{
       
   409 		ReqCompleted(entry->iTsyReqHandle,KErrCancel);
       
   410 		iList->Remove(entry);
       
   411 		}
       
   412 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   413 	return KErrNone;
       
   414 	}
       
   415 
       
   416 TInt CCallDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
       
   417 	{
       
   418 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
       
   419 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
       
   420 	return KErrNone;
       
   421 	}
       
   422 
       
   423 TInt CCallDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RCall::TCaps*)
       
   424 	{
       
   425 	iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   426 						CCallDummyBase::NotifyCapsChangeHandler,this);
       
   427 	return KErrNone;
       
   428 	}
       
   429 
       
   430 TInt CCallDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   431 	{
       
   432 	if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
       
   433 		{
       
   434 		iFac->RemoveTimer(iNotifyCapsChange);
       
   435 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   436 		return KErrNone;
       
   437 		}
       
   438 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   439 	return KErrNone;
       
   440 	}
       
   441 
       
   442 TInt CCallDummyBase::NotifyHookChange(const TTsyReqHandle aTsyReqHandle,RCall::THookStatus* aHookStatus)
       
   443 	{
       
   444 	iNotifyHookChangeParams=aHookStatus;
       
   445 	iFac->QueueTimer(iNotifyHookChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   446 						CCallDummyBase::NotifyHookChangeHandler,this);
       
   447 	return KErrNone;
       
   448 	}
       
   449 
       
   450 TInt CCallDummyBase::NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   451 	{
       
   452 	if (aTsyReqHandle==iNotifyHookChange.iTsyReqHandle)
       
   453 		{
       
   454 		iFac->RemoveTimer(iNotifyHookChange);
       
   455 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   456 		return KErrNone;
       
   457 		}
       
   458 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   459 	return KErrNone;
       
   460 	}
       
   461 
       
   462 TInt CCallDummyBase::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
       
   463 	{
       
   464 	iNotifyStatusChangeParams=aStatus;
       
   465 	iFac->QueueTimer(iNotifyStatusChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   466 						CCallDummyBase::NotifyStatusChangeHandler,this);
       
   467 	return KErrNone;
       
   468 	}
       
   469 
       
   470 TInt CCallDummyBase::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   471 	{
       
   472 	if (aTsyReqHandle==iNotifyStatusChange.iTsyReqHandle)
       
   473 		{
       
   474 		iFac->RemoveTimer(iNotifyStatusChange);
       
   475 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   476 		return KErrNone;
       
   477 		}
       
   478 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   479 	return KErrNone;
       
   480 	}
       
   481 
       
   482 
       
   483 TInt CCallDummyBase::NotifyDurationChange(const TTsyReqHandle aTsyReqHandle,TTimeIntervalSeconds*)
       
   484 	{
       
   485 	iFac->QueueTimer(iNotifyDurationChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   486 						CCallDummyBase::NotifyDurationChangeHandler,this);
       
   487 	return KErrNone;
       
   488 	}
       
   489 
       
   490 TInt CCallDummyBase::NotifyDurationChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   491 	{
       
   492 	if (aTsyReqHandle==iNotifyDurationChange.iTsyReqHandle)
       
   493 		{
       
   494 		iFac->RemoveTimer(iNotifyDurationChange);
       
   495 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   496 		return KErrNone;
       
   497 		}
       
   498 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   499 	return KErrNone;
       
   500 	}
       
   501 
       
   502 TInt CCallDummyBase::NotifyDurationChangeHandler(TAny* aPtr)
       
   503 	{
       
   504 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyDurationChange);
       
   505 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyDurationChange.iTsyReqHandle,KErrNone);
       
   506 	return KErrNone;
       
   507 	}
       
   508 
       
   509 TInt CCallDummyBase::DialHandler(TAny* aPtr)
       
   510 	{
       
   511 	This(aPtr)->iFac->ResetPending( This(aPtr)->iDial);
       
   512 	This(aPtr)->ReqCompleted(This(aPtr)->iDial.iTsyReqHandle,KErrNone);
       
   513 	return KErrNone;
       
   514 	}
       
   515 
       
   516 TInt CCallDummyBase::ConnectHandler(TAny* aPtr)
       
   517 	{
       
   518 	This(aPtr)->iFac->ResetPending( This(aPtr)->iConnect);
       
   519 	This(aPtr)->ReqCompleted(This(aPtr)->iConnect.iTsyReqHandle,KErrNone);
       
   520 	return KErrNone;
       
   521 	}
       
   522 
       
   523 TInt CCallDummyBase::AnswerHandler(TAny* aPtr)
       
   524 	{
       
   525 	This(aPtr)->iFac->ResetPending( This(aPtr)->iAnswer);
       
   526 	This(aPtr)->ReqCompleted(This(aPtr)->iAnswer.iTsyReqHandle,KErrNone);
       
   527 	return KErrNone;
       
   528 	}
       
   529 
       
   530 TInt CCallDummyBase::HangUpHandler(TAny* aPtr)
       
   531 	{
       
   532 	This(aPtr)->SetUnowned();
       
   533 	This(aPtr)->iFac->ResetPending( This(aPtr)->iHangUp);
       
   534 	This(aPtr)->ReqCompleted(This(aPtr)->iHangUp.iTsyReqHandle,KErrNone);
       
   535 	return KErrNone;
       
   536 	}
       
   537 
       
   538 TInt CCallDummyBase::NotifyHookChangeHandler(TAny* aPtr)
       
   539 	{
       
   540 	//test server Up call
       
   541 	__ASSERT_ALWAYS(This(aPtr)->UpCallOption(20,NULL)==KErrNotSupported,TsyPanic(KTsyPanicUnexpectedReturnValue));
       
   542 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyHookChange);
       
   543 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyHookChange.iTsyReqHandle,KErrNone);
       
   544 	return KErrNone;
       
   545 	}
       
   546 
       
   547 TInt CCallDummyBase::NotifyStatusChangeHandler(TAny* aPtr)
       
   548 	{
       
   549 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyStatusChange);
       
   550 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyStatusChange.iTsyReqHandle,KErrNone);
       
   551 	return KErrNone;
       
   552 	}
       
   553 
       
   554 TInt CCallDummyBase::LoanDataPortHandler(TAny* aPtr)
       
   555 	{
       
   556 	This(aPtr)->iFac->ResetPending( This(aPtr)->iLoanDataPortTimer);
       
   557 	This(aPtr)->ReqCompleted(This(aPtr)->iLoanDataPortTimer.iTsyReqHandle,KErrNone);
       
   558 	return KErrNone;
       
   559 	}
       
   560 
       
   561 TInt CCallDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RCall::TCallInfo* /*aCallInfo*/)
       
   562 	{
       
   563 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   564 	return KErrNone;
       
   565 	}
       
   566 
       
   567 TInt CCallDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
       
   568 	{
       
   569 	*aStatus=DACQ_CALL_STATUS;
       
   570 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   571 	return KErrNone;
       
   572 	}
       
   573 
       
   574 TInt CCallDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RCall::TCaps*)
       
   575 	{
       
   576 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   577 	return KErrNone;
       
   578 	}
       
   579 
       
   580 TInt CCallDummyBase::LoanDataPort(const TTsyReqHandle aTsyReqHandle,RCall::TCommPort*)
       
   581 	{
       
   582 	iFac->QueueTimer(iLoanDataPortTimer,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   583 						CCallDummyBase::LoanDataPortHandler,this);
       
   584 	return KErrNone;
       
   585 	}
       
   586 
       
   587 TInt CCallDummyBase::LoanDataPortCancel(const TTsyReqHandle aTsyReqHandle)
       
   588 	{
       
   589 	if (aTsyReqHandle==iDial.iTsyReqHandle)
       
   590 		{
       
   591 		iFac->RemoveTimer(iDial);
       
   592 		SetUnowned();
       
   593 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   594 		return KErrNone;
       
   595 		}
       
   596 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   597 	return KErrNone;
       
   598 	}
       
   599 
       
   600 TInt CCallDummyBase::RecoverDataPortAndRelinquishOwnership()
       
   601 	{
       
   602 	ProcessingOwnership();
       
   603 	RecoverDataPortAndRelinquishOwnershipCompleted(KErrNone);
       
   604 	return KErrNone;
       
   605 	}
       
   606 
       
   607 TInt CCallDummyBase::RecoverDataPort(const TTsyReqHandle aTsyReqHandle)
       
   608 	{
       
   609 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   610 	return KErrNone;
       
   611 	}
       
   612 
       
   613 TInt CCallDummyBase::Dial(const TTsyReqHandle aTsyReqHandle,const TDesC8* /*aParams*/,TDesC* aNumber)
       
   614 	{
       
   615 	
       
   616 	if (CheckOwnership(aTsyReqHandle)==CCallBase::EOwnedUnowned)
       
   617 		{
       
   618 		SetOwnership(aTsyReqHandle);
       
   619 		if(aNumber->Compare(DACQ_PHONE_NUMBER_TO_DIAL)!=KErrNone)
       
   620 			TsyPanic(KTsyPanicDataCorrupted);
       
   621 		iFac->QueueTimer(iDial,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   622 						CCallDummyBase::DialHandler,this);
       
   623 		}
       
   624 	else if (CheckOwnership(aTsyReqHandle)==CCallBase::EOwnedFalse)
       
   625 		ReqCompleted(aTsyReqHandle,KErrEtelNotCallOwner);
       
   626 	else
       
   627 		ReqCompleted(aTsyReqHandle,KErrEtelCallAlreadyActive);
       
   628 
       
   629 	return KErrNone;
       
   630 	}
       
   631 
       
   632 TInt CCallDummyBase::Connect(const TTsyReqHandle aTsyReqHandle,const TDesC8*)
       
   633 	{
       
   634 	iFac->QueueTimer(iConnect,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   635 						CCallDummyBase::ConnectHandler,this);
       
   636 	return KErrNone;
       
   637 	}
       
   638 
       
   639 TInt CCallDummyBase::AnswerIncomingCall(const TTsyReqHandle aTsyReqHandle,const TDesC8*)
       
   640 	{
       
   641 	iFac->QueueTimer(iAnswer,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   642 						CCallDummyBase::AnswerHandler,this);
       
   643 	return KErrNone;
       
   644 	}
       
   645 
       
   646 TInt CCallDummyBase::HangUp(const TTsyReqHandle aTsyReqHandle)
       
   647 	{
       
   648 	if (CheckOwnership(aTsyReqHandle)==CCallBase::EOwnedTrue)
       
   649 		{
       
   650 		iFac->QueueTimer(iHangUp,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   651 						CCallDummyBase::HangUpHandler,this);
       
   652 		return KErrNone;
       
   653 		}
       
   654 	else
       
   655 		return KErrEtelNotCallOwner;
       
   656 	}
       
   657 
       
   658 TInt CCallDummyBase::DialCancel(const TTsyReqHandle aTsyReqHandle)
       
   659 	{
       
   660 	if (aTsyReqHandle==iDial.iTsyReqHandle)
       
   661 		{
       
   662 		iFac->RemoveTimer(iDial);
       
   663 		SetUnowned();
       
   664 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   665 		return KErrNone;
       
   666 		}
       
   667 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   668 	return KErrNone;
       
   669 	}
       
   670 
       
   671 TInt CCallDummyBase::ConnectCancel(const TTsyReqHandle aTsyReqHandle)
       
   672 	{
       
   673 	if (aTsyReqHandle==iConnect.iTsyReqHandle)
       
   674 		{
       
   675 		iFac->RemoveTimer(iConnect);
       
   676 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   677 		return KErrNone;
       
   678 		}
       
   679 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   680 	return KErrNone;
       
   681 	}
       
   682 
       
   683 TInt CCallDummyBase::AnswerIncomingCallCancel(const TTsyReqHandle aTsyReqHandle)
       
   684 	{
       
   685 	if (aTsyReqHandle==iAnswer.iTsyReqHandle)
       
   686 		{
       
   687 		iFac->RemoveTimer(iAnswer);
       
   688 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   689 		return KErrNone;
       
   690 		}
       
   691 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   692 	return KErrNone;
       
   693 	}
       
   694 
       
   695 TInt CCallDummyBase::HangUpCancel(const TTsyReqHandle aTsyReqHandle)
       
   696 	{
       
   697 	if (aTsyReqHandle==iHangUp.iTsyReqHandle)
       
   698 		{
       
   699 		iFac->RemoveTimer(iHangUp);
       
   700 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   701 		return KErrNone;
       
   702 		}
       
   703 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   704 	return KErrNone;
       
   705 	}
       
   706 
       
   707 TInt CCallDummyBase::GetBearerServiceInfo(const TTsyReqHandle aTsyReqHandle,RCall::TBearerService* aService)
       
   708 	{
       
   709 	aService->iBearerSpeed=DACQ_CALL_BEARER_SPEED;
       
   710 	aService->iBearerCaps=DACQ_CALL_BEARER_CAPS;
       
   711 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   712 	return KErrNone;
       
   713 	}
       
   714 
       
   715 TInt CCallDummyBase::GetCallParams(const TTsyReqHandle aTsyReqHandle, TDes8*)
       
   716 	{
       
   717 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   718 	return KErrNone;
       
   719 	}
       
   720 
       
   721 TInt CCallDummyBase::GetCallDuration(const TTsyReqHandle aTsyReqHandle, TTimeIntervalSeconds* aTime)
       
   722 	{
       
   723 	*aTime = 5;
       
   724 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   725 	return KErrNone;
       
   726 	}
       
   727 
       
   728 TInt CCallDummyBase::GetFaxSettings(const TTsyReqHandle aTsyReqHandle,
       
   729 									RCall::TFaxSessionSettings* aSettings)
       
   730 	{
       
   731 	aSettings->iFaxId=DACQ_MYFAX;
       
   732 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   733 	return KErrNone;
       
   734 	}
       
   735 
       
   736 TInt CCallDummyBase::SetFaxSettings(const TTsyReqHandle aTsyReqHandle,
       
   737 									const RCall::TFaxSessionSettings* aSettings)
       
   738 	{
       
   739 	if (aSettings->iFaxId.Compare(DACQ_MYFAX)!=KErrNone)
       
   740 		TsyPanic(KTsyPanicDataCorrupted);
       
   741 
       
   742 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   743 	return KErrNone;
       
   744 	}
       
   745 	
       
   746 TInt CCallDummyBase::SetFaxSharedHeaderFile(const TTsyReqHandle aTsyReqHandle, CFaxSharedFileHandles* aFaxSharedFileHandles)
       
   747 	{
       
   748 	TBuf8<25> line;
       
   749 	TInt ret = aFaxSharedFileHandles->File().Read(0, line);
       
   750 
       
   751 	if(ret!=KErrNone || line.Compare(DACQ_MFAXFILE) != KErrNone)
       
   752 		TsyPanic(KTsyPanicDataCorrupted);
       
   753 	
       
   754 	delete aFaxSharedFileHandles;
       
   755 	aFaxSharedFileHandles = NULL;
       
   756 	
       
   757 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   758 	return KErrNone;
       
   759 	}
       
   760 
       
   761 
       
   762 //
       
   763 // CLineDummyBase
       
   764 //
       
   765 CLineDummyBase::CLineDummyBase(CPhoneFactoryDummyBase* aFac)
       
   766 	{
       
   767 	iFac=aFac;
       
   768 	}
       
   769 
       
   770 void CLineDummyBase::ConstructL()
       
   771 	{}
       
   772 
       
   773 CLineDummyBase::~CLineDummyBase()
       
   774 	{
       
   775 	iFac->RemoveTimer(iNotifyIncomingCall);
       
   776 	iFac->RemoveTimer(iNotifyHookChange);
       
   777 	iFac->RemoveTimer(iNotifyStatusChange);
       
   778 	}
       
   779 
       
   780 TInt CLineDummyBase::RegisterNotification(const TInt /*aIpc*/)
       
   781 	{
       
   782 	return KErrNone;
       
   783 	}
       
   784 TInt CLineDummyBase::DeregisterNotification(const TInt /*aIpc*/)
       
   785 	{
       
   786 	return KErrNone;
       
   787 	}
       
   788 
       
   789 CLineDummyBase* CLineDummyBase::This(TAny* aPtr)
       
   790 	{
       
   791 	return REINTERPRET_CAST(CLineDummyBase*,aPtr);
       
   792 	}
       
   793 
       
   794 TInt CLineDummyBase::CancelSubSession()
       
   795 	{
       
   796 	return KErrNone;
       
   797 	}
       
   798 
       
   799 CTelObject::TReqMode CLineDummyBase::ReqModeL(const TInt aIpc) 
       
   800 //
       
   801 //	Mode Request for Line
       
   802 //
       
   803 	{
       
   804 	CTelObject::TReqMode ret=0;
       
   805 	switch (aIpc)
       
   806 		{
       
   807 	case EEtelLineNotifyIncomingCall:
       
   808 	case EEtelLineNotifyHookChange:
       
   809 	case EEtelLineNotifyStatusChange:
       
   810 		ret=KReqModeMultipleCompletionEnabled;
       
   811 		break;
       
   812 
       
   813 
       
   814 	case EEtelLineGetHookStatus:
       
   815 	case EEtelLineGetCaps:
       
   816 	case EEtelLineGetStatus:
       
   817 	case EEtelLineGetInfo:
       
   818 	case EEtelLineEnumerateCall:
       
   819 	case EEtelLineGetCallInfo:
       
   820 		ret=KReqModeFlowControlObeyed;
       
   821 		break;
       
   822 
       
   823 	default:
       
   824 		User::Leave(KErrNotSupported); // Server error = Should not call this
       
   825 		break;
       
   826 		}
       
   827 	return ret;
       
   828 	}
       
   829 
       
   830 TInt CLineDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
       
   831 	{
       
   832 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
       
   833 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
       
   834 	return KErrNone;
       
   835 	}
       
   836 
       
   837 TInt CLineDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RLine::TCaps*)
       
   838 	{
       
   839 	iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   840 						CLineDummyBase::NotifyCapsChangeHandler,this);
       
   841 	return KErrNone;
       
   842 	}
       
   843 
       
   844 TInt CLineDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   845 	{
       
   846 	if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
       
   847 		{
       
   848 		iFac->RemoveTimer(iNotifyCapsChange);
       
   849 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   850 		return KErrNone;
       
   851 		}
       
   852 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   853 	return KErrNone;
       
   854 	}
       
   855 
       
   856 TInt CLineDummyBase::NotifyStatusChangeHandler(TAny* aPtr)
       
   857 	{
       
   858 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyStatusChange);
       
   859 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyStatusChange.iTsyReqHandle,KErrNone);
       
   860 	return KErrNone;
       
   861 	}
       
   862 
       
   863 TInt CLineDummyBase::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
       
   864 	{
       
   865 	iStatusParams=aStatus;
       
   866 	iFac->QueueTimer(iNotifyStatusChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   867 						CLineDummyBase::NotifyStatusChangeHandler,this);
       
   868 	return KErrNone;
       
   869 	}
       
   870 
       
   871 TInt CLineDummyBase::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   872 	{
       
   873 	if (aTsyReqHandle==iNotifyStatusChange.iTsyReqHandle)
       
   874 		{
       
   875 		iFac->RemoveTimer(iNotifyStatusChange);
       
   876 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   877 		return KErrNone;
       
   878 		}
       
   879 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   880 	return KErrNone;
       
   881 	}
       
   882 
       
   883 TInt CLineDummyBase::NotifyIncomingCall(const TTsyReqHandle aTsyReqHandle, TName*)
       
   884 	{
       
   885 	iFac->QueueTimer(iNotifyIncomingCall,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   886 						CLineDummyBase::NotifyIncomingCallHandler,this);
       
   887 	return KErrNone;
       
   888 	}
       
   889 
       
   890 TInt CLineDummyBase::NotifyIncomingCallCancel(const TTsyReqHandle aTsyReqHandle)
       
   891 	{
       
   892 	if (aTsyReqHandle==iNotifyIncomingCall.iTsyReqHandle)
       
   893 		{
       
   894 		iFac->RemoveTimer(iNotifyIncomingCall);
       
   895 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   896 		return KErrNone;
       
   897 		}
       
   898 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   899 	return KErrNone;
       
   900 	}
       
   901 
       
   902 TInt CLineDummyBase::NotifyIncomingCallHandler(TAny* aPtr)
       
   903 	{
       
   904 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyIncomingCall);
       
   905 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyIncomingCall.iTsyReqHandle,KErrNone);
       
   906 	return KErrNone;
       
   907 	}
       
   908 
       
   909 TInt CLineDummyBase::NotifyHookChange(const TTsyReqHandle aTsyReqHandle, RCall::THookStatus* aHookStatus)
       
   910 	{
       
   911 	iHookStatusParams=aHookStatus;
       
   912 	iFac->QueueTimer(iNotifyHookChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   913 						CLineDummyBase::NotifyHookChangeHandler,this);
       
   914 	return KErrNone;
       
   915 	}
       
   916 
       
   917 TInt CLineDummyBase::NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
   918 	{
       
   919 	if (aTsyReqHandle==iNotifyHookChange.iTsyReqHandle)
       
   920 		{
       
   921 		iFac->RemoveTimer(iNotifyHookChange);
       
   922 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   923 		return KErrNone;
       
   924 		}
       
   925 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   926 	return KErrNone;
       
   927 	}
       
   928 
       
   929 TInt CLineDummyBase::NotifyHookChangeHandler(TAny* aPtr)
       
   930 	{
       
   931 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyHookChange);
       
   932 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyHookChange.iTsyReqHandle,KErrNone);
       
   933 	return KErrNone;
       
   934 	}
       
   935 
       
   936 TInt CLineDummyBase::NotifyCallAdded(const TTsyReqHandle aTsyReqHandle, TName* /*aName*/)
       
   937 	{
       
   938 	iFac->QueueTimer(iNotifyCallAdded,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
   939 						CLineDummyBase::NotifyCallAddedHandler,this);
       
   940 	return KErrNone;
       
   941 	}
       
   942 
       
   943 TInt CLineDummyBase::NotifyCallAddedCancel(const TTsyReqHandle aTsyReqHandle)
       
   944 	{
       
   945 	if (aTsyReqHandle==iNotifyCallAdded.iTsyReqHandle)
       
   946 		{
       
   947 		iFac->RemoveTimer(iNotifyCallAdded);
       
   948 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
   949 		return KErrNone;
       
   950 		}
       
   951 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
   952 	return KErrNone;
       
   953 	}
       
   954 
       
   955 TInt CLineDummyBase::NotifyCallAddedHandler(TAny* aPtr)
       
   956 	{
       
   957 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCallAdded);
       
   958 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCallAdded.iTsyReqHandle,KErrNone);
       
   959 	return KErrNone;
       
   960 	}
       
   961 
       
   962 TInt CLineDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RLine::TCaps*)
       
   963 	{
       
   964 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   965 	return KErrNone;
       
   966 	}
       
   967 
       
   968 TInt CLineDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RLine::TLineInfo* /*aLineInfo*/)
       
   969 	{
       
   970 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   971 	return KErrNone;
       
   972 	}
       
   973 
       
   974 TInt CLineDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus)
       
   975 	{
       
   976 	*aStatus=DACQ_LINE_STATUS;
       
   977 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   978 	return KErrNone;
       
   979 	}
       
   980 
       
   981 CPhoneFactoryDummyBase* CLineDummyBase::FacPtr() const
       
   982 	{
       
   983 	return iFac;
       
   984 	}
       
   985 
       
   986 TInt CLineDummyBase::GetHookStatus(const TTsyReqHandle aTsyReqHandle,RCall::THookStatus*)
       
   987 	{
       
   988 	ReqCompleted(aTsyReqHandle,KErrNone);
       
   989 	return KErrNone;
       
   990 	}
       
   991 
       
   992 //
       
   993 // CPhoneDummyBase
       
   994 //
       
   995 CPhoneDummyBase::CPhoneDummyBase(CPhoneFactoryDummyBase* aFac)
       
   996 	{
       
   997 	iFac=aFac;
       
   998 	}
       
   999 
       
  1000 void CPhoneDummyBase::ConstructL()
       
  1001 	{
       
  1002 	}
       
  1003 CPhoneDummyBase::~CPhoneDummyBase()
       
  1004 	{
       
  1005 	iFac->RemoveTimer(iNotifyPhoneDetected);
       
  1006 	}
       
  1007 
       
  1008 CPhoneDummyBase* CPhoneDummyBase::This(TAny* aPtr)
       
  1009 	{
       
  1010 	return REINTERPRET_CAST(CPhoneDummyBase*,aPtr);
       
  1011 	}
       
  1012 
       
  1013 TInt CPhoneDummyBase::RegisterNotification(const TInt /*aIpc*/)
       
  1014 	{
       
  1015 	return KErrNone;
       
  1016 	}
       
  1017 TInt CPhoneDummyBase::DeregisterNotification(const TInt /*aIpc*/)
       
  1018 	{
       
  1019 	return KErrNone;
       
  1020 	}
       
  1021 
       
  1022 TInt CPhoneDummyBase::CancelSubSession()
       
  1023 	{
       
  1024 	return KErrNone;
       
  1025 	}
       
  1026 
       
  1027 TInt CPhoneDummyBase::ControlledInitialisation(const TTsyReqHandle aTsyReqHandle)
       
  1028 	{
       
  1029 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1030 	return KErrNone;
       
  1031 	}
       
  1032 
       
  1033 TInt CPhoneDummyBase::ControlledInitialisationCancel(const TTsyReqHandle aTsyReqHandle)
       
  1034 	{
       
  1035 	ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1036 	return KErrNone;
       
  1037 	}
       
  1038 
       
  1039 void CPhoneDummyBase::Dummy()
       
  1040 	{
       
  1041 	RPhone::TPhoneInfo dummy0;
       
  1042 	TPckg<RPhone::TPhoneInfo> dummy1(dummy0);
       
  1043 	dummy1.Zero();
       
  1044 	}
       
  1045 
       
  1046 TInt CPhoneDummyBase::NotifyCapsChangeHandler(TAny* aPtr)
       
  1047 	{
       
  1048 	This(aPtr)->iFac->ResetPending( This(aPtr)->iNotifyCapsChange);
       
  1049 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyCapsChange.iTsyReqHandle,KErrNone);
       
  1050 	return KErrNone;
       
  1051 	}
       
  1052 
       
  1053 TInt CPhoneDummyBase::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RPhone::TCaps*)
       
  1054 	{
       
  1055 	iFac->QueueTimer(iNotifyCapsChange,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
  1056 						CPhoneDummyBase::NotifyCapsChangeHandler,this);
       
  1057 	return KErrNone;
       
  1058 	}
       
  1059 
       
  1060 TInt CPhoneDummyBase::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
       
  1061 	{
       
  1062 	if (aTsyReqHandle==iNotifyCapsChange.iTsyReqHandle)
       
  1063 		{
       
  1064 		iFac->RemoveTimer(iNotifyCapsChange);
       
  1065 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1066 		return KErrNone;
       
  1067 		}
       
  1068 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
  1069 	return KErrNone;
       
  1070 	}
       
  1071 
       
  1072 TInt CPhoneDummyBase::NotifyPhoneDetectedHandler(TAny* aPtr)
       
  1073 	{
       
  1074 	This(aPtr)->iFac->ResetPending(This(aPtr)->iNotifyPhoneDetected);
       
  1075 	This(aPtr)->ReqCompleted(This(aPtr)->iNotifyPhoneDetected.iTsyReqHandle,KErrNone);
       
  1076 	return KErrNone;
       
  1077 	}
       
  1078 
       
  1079 TInt CPhoneDummyBase::NotifyModemDetected(const TTsyReqHandle aTsyReqHandle,RPhone::TModemDetection* aDetection)
       
  1080 	{
       
  1081 	iDetectionParams=aDetection;
       
  1082 	iFac->QueueTimer(iNotifyPhoneDetected,aTsyReqHandle,DACQ_ASYN_TIMEOUT,
       
  1083 						CPhoneDummyBase::NotifyPhoneDetectedHandler,this);
       
  1084 	return KErrNone;
       
  1085 	}
       
  1086 
       
  1087 TInt CPhoneDummyBase::NotifyModemDetectedCancel(const TTsyReqHandle aTsyReqHandle)
       
  1088 	{
       
  1089 	if (aTsyReqHandle==iNotifyPhoneDetected.iTsyReqHandle)
       
  1090 		{
       
  1091 		iFac->RemoveTimer(iNotifyPhoneDetected);
       
  1092 		ReqCompleted(aTsyReqHandle,KErrCancel);
       
  1093 		return KErrNone;
       
  1094 		}
       
  1095 	TsyPanic(KTsyPanicNotRecognisedCancelHandle);
       
  1096 	return KErrNone;
       
  1097 	}
       
  1098 
       
  1099 TInt CPhoneDummyBase::GetInfo(const TTsyReqHandle aTsyReqHandle, RPhone::TPhoneInfo* /*aPhoneInfo*/)
       
  1100 	{
       
  1101 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1102 	return KErrNone;
       
  1103 	}
       
  1104 
       
  1105 TInt CPhoneDummyBase::GetStatus(const TTsyReqHandle aTsyReqHandle,RPhone::TStatus* aPhoneStat)
       
  1106 	{
       
  1107 	aPhoneStat->iModemDetected=DACQ_PHONE_STATUS;
       
  1108 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1109 	return KErrNone;
       
  1110 	}
       
  1111 
       
  1112 TInt CPhoneDummyBase::GetCaps(const TTsyReqHandle aTsyReqHandle,RPhone::TCaps*)
       
  1113 	{
       
  1114 	ReqCompleted(aTsyReqHandle,KErrNone);
       
  1115 	return KErrNone;
       
  1116 	}
       
  1117 
       
  1118 CPhoneFactoryDummyBase* CPhoneDummyBase::FacPtr() const
       
  1119 	{
       
  1120 	return iFac;
       
  1121 	}
       
  1122 
       
  1123 //
       
  1124 //	CPhoneFactoryDummyBase
       
  1125 //
       
  1126 CPhoneFactoryDummyBase::CPhoneFactoryDummyBase()
       
  1127 	{
       
  1128 	}
       
  1129 
       
  1130 void CPhoneFactoryDummyBase::ConstructL()
       
  1131 	{
       
  1132 	iTimer=CDeltaTimer::NewL(CActive::EPriorityHigh,KEtelTimerGranularity);
       
  1133 	}
       
  1134 
       
  1135 CPhoneFactoryDummyBase::~CPhoneFactoryDummyBase()
       
  1136 	{
       
  1137 	delete iTimer;
       
  1138 	}
       
  1139 
       
  1140 void CPhoneFactoryDummyBase::QueueTimer(TTsyTimer& aTsyTimer,
       
  1141 						const TTsyReqHandle aTsyReqHandle,
       
  1142 						TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,
       
  1143 						TInt (*aFunction)(TAny *aPtr),TAny* aPtr)
       
  1144 	{
       
  1145 	TCallBack callBackFn(aFunction,aPtr);
       
  1146  	aTsyTimer.iEntry.Set(callBackFn);
       
  1147 
       
  1148 	aTsyTimer.iPending=ETrue;
       
  1149 	aTsyTimer.iTsyReqHandle=aTsyReqHandle;
       
  1150 	aTimeInMicroSeconds=aTimeInMicroSeconds.Int()+(KEtelTimerGranularity>>2);
       
  1151 	if(aTimeInMicroSeconds.Int()<100000)
       
  1152 		aTimeInMicroSeconds=aTimeInMicroSeconds.Int()+KEtelTimerGranularity;
       
  1153 	iTimer->Queue(aTimeInMicroSeconds,aTsyTimer.iEntry);
       
  1154 	}
       
  1155 
       
  1156 TBool CPhoneFactoryDummyBase::RemoveTimer(TTsyTimer& aTsyTimer)
       
  1157 	{
       
  1158 	if (aTsyTimer.iPending)
       
  1159 		{
       
  1160 		aTsyTimer.iPending=EFalse;
       
  1161 		iTimer->Remove(aTsyTimer.iEntry);
       
  1162 		return ETrue;
       
  1163 		}
       
  1164 	return EFalse;
       
  1165 	}
       
  1166 
       
  1167 void CPhoneFactoryDummyBase::ResetPending(TTsyTimer& aTsyTimer)
       
  1168 	{
       
  1169 	aTsyTimer.iPending=EFalse;
       
  1170 	}
       
  1171 
       
  1172 TBool CPhoneFactoryDummyBase::IsSupported(const TInt /*aMixin*/)
       
  1173 	{
       
  1174 	return EFalse;
       
  1175 	}
       
  1176 
       
  1177 CSubSessionExtDummyBase::CSubSessionExtDummyBase(CPhoneFactoryDummyBase* aFac)
       
  1178 	{
       
  1179 	iFac=aFac;
       
  1180 	}
       
  1181 
       
  1182 CSubSessionExtDummyBase::~CSubSessionExtDummyBase()
       
  1183 	{}
       
  1184 
       
  1185 CPhoneFactoryDummyBase* CSubSessionExtDummyBase::FacPtr() const
       
  1186 	{
       
  1187 	return iFac;
       
  1188 	}
       
  1189 
       
  1190 TInt CSubSessionExtDummyBase::CancelSubSession()
       
  1191 	{
       
  1192 	return KErrNone;
       
  1193 	}
       
  1194 
       
  1195 TInt CSubSessionExtDummyBase::RegisterNotification(const TInt /*aIpc*/)
       
  1196 	{
       
  1197 	return KErrNone;
       
  1198 	}
       
  1199 TInt CSubSessionExtDummyBase::DeregisterNotification(const TInt /*aIpc*/)
       
  1200 	{
       
  1201 	return KErrNone;
       
  1202 	}