servicediscoveryandcontrol/pnp/test/upnp/IntegTest/testupnp/src/testrcontrolchannel.cpp
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 // testupnpmanager.cpp
       
    15 // Contains implementation of CTestRControlChannel class
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalTechnology
       
    22 */
       
    23 
       
    24 #include "testrcontrolchannel.h"
       
    25 #include "testupnpmanager.h"
       
    26 #include <e32base.h>
       
    27 
       
    28 /*
       
    29   Constructor:
       
    30   @internalTechnology
       
    31   @test
       
    32 */
       
    33 CTestRControlChannel::CTestRControlChannel()
       
    34 :	CTestStep()
       
    35 	{
       
    36 	}
       
    37 
       
    38 /*
       
    39    Initializes all member vaiables.
       
    40    @param		None.
       
    41    @return		None.
       
    42 */
       
    43 void CTestRControlChannel::InitializeL()
       
    44 	{
       
    45 	_LIT(KInfoLogFile, "CTestRControlChannel::InitializeL().... \n");
       
    46 	INFO_PRINTF1(KInfoLogFile);
       
    47 	iScheduler = new (ELeave) CActiveScheduler;
       
    48 	CActiveScheduler::Install(iScheduler);
       
    49 	iTimer = NULL;
       
    50 	iTimer  = CPeriodic::NewL(CActive::EPriorityStandard);
       
    51 	}
       
    52 
       
    53 /*
       
    54    Destructor
       
    55    @internalTechnology
       
    56    @test
       
    57 */
       
    58 CTestRControlChannel::~CTestRControlChannel()
       
    59 	{
       
    60 	_LIT(KInfoLogFile, "~CTestRControlChannel().... \n");
       
    61 	INFO_PRINTF1(KInfoLogFile);
       
    62 	iPublisher.Close();
       
    63 //	CActiveScheduler::Install(NULL); //Testing for ONB hangs
       
    64 	delete iScheduler;
       
    65 	iScheduler = NULL;
       
    66 	_LIT(KInfoLogFile1, "CTestRControlChannel active Scheduler.... \n");
       
    67 	INFO_PRINTF1(KInfoLogFile1);
       
    68 	CleanUpObserverArray();
       
    69 	if (iTimer != NULL)
       
    70 		{
       
    71 		delete iTimer;
       
    72 		iTimer = NULL;
       
    73 		}
       
    74 	_LIT(KInfoLogFile2, "~CTestRControlChannel() End.... \n");
       
    75 	INFO_PRINTF1(KInfoLogFile2);
       
    76 	
       
    77 	iConnection.Close ();
       
    78 	iSocketServ.Close ();
       
    79 	}
       
    80 
       
    81 void CTestRControlChannel::SavePreviousLogFileL()
       
    82 	{
       
    83 	_LIT(KInfoLogFile, "Saving Previous logs If any.... \n");
       
    84 	INFO_PRINTF1(KInfoLogFile);
       
    85 	RFs fileserv;
       
    86 	TInt error = fileserv.Connect();
       
    87 	if(!error)
       
    88 		{
       
    89 		_LIT(KlogFile, "C:\\logs\\log.txt");
       
    90 		_LIT(KPrefixLog, "C:\\logs\\");
       
    91 		_LIT(KSuffix, "_UDEB");
       
    92 		_LIT(KExtn, ".txt");
       
    93 		
       
    94 		CFileMan* fMan = NULL;
       
    95 		TRAP_IGNORE(fMan = CFileMan::NewL(fileserv));
       
    96 		if(fMan != NULL)
       
    97 			{
       
    98 			CleanupStack::PushL(fMan);
       
    99 			RBuf newFileName;
       
   100 			const TInt KTwenty = 20;
       
   101 			newFileName.Create(ConfigSection().Length() + KTwenty );
       
   102 			newFileName.Copy(KPrefixLog);
       
   103 			//Script file name
       
   104 			iScriptName.Copy(ConfigSection());
       
   105 			newFileName.Append(iScriptName);
       
   106 			newFileName.Append(KSuffix);
       
   107 			newFileName.Append(KExtn);
       
   108 			
       
   109 			TInt error = fMan->Rename(KlogFile, newFileName);
       
   110 			if (error != KErrNone)
       
   111 				{
       
   112 				_LIT(KErrInfo, "Unable to Save Previous logs...May be NO Previous logs exist \n");
       
   113 				ERR_PRINTF1(KErrInfo);
       
   114 				}
       
   115 			else
       
   116 				{
       
   117 				_LIT(KSavingInfo, "Saved Previous logs with File Name: %S \n");
       
   118 				INFO_PRINTF2(KSavingInfo, &newFileName);
       
   119 				}
       
   120 			CleanupStack::PopAndDestroy(fMan);
       
   121 			newFileName.Close();
       
   122 			}
       
   123 		}
       
   124 	fileserv.Close();
       
   125 	_LIT(KInfoLogFile1, "Saving Previous logs End.... \n");
       
   126 	INFO_PRINTF1(KInfoLogFile1);
       
   127 	}
       
   128 
       
   129 void CTestRControlChannel::CleanUpObserverArray()
       
   130 	{
       
   131 	_LIT(KInfoLogFile, "CleanUpObserverArray....\n");
       
   132 	INFO_PRINTF1(KInfoLogFile);
       
   133 	if (iObserverArray.Count() > 0 )
       
   134 		{
       
   135 		iObserverArray.ResetAndDestroy();
       
   136 		}
       
   137 	else
       
   138 		{
       
   139 		iObserverArray.Close();
       
   140 		}
       
   141 	_LIT(KInfoLogFile1, "CleanUpObserverArray End....\n");
       
   142 	INFO_PRINTF1(KInfoLogFile1);
       
   143 	}
       
   144 
       
   145 /*
       
   146    Implementation of CTestStep base class virtual and this is used for doing all
       
   147    initialisation common
       
   148     to derived classes here.
       
   149    @param  None
       
   150    @return TVerdict
       
   151  */
       
   152 TVerdict CTestRControlChannel::doTestStepPreambleL()
       
   153 	{
       
   154 	InitializeL();
       
   155 	SavePreviousLogFileL();
       
   156 	return CTestStep::doTestStepPreambleL();
       
   157 	}
       
   158 
       
   159 /*
       
   160    Implementation of CTestStep base class virtual and it is used for doing all
       
   161    after test treatment common to derived classes in here.
       
   162    @return TVerdict
       
   163  */
       
   164 TVerdict CTestRControlChannel::doTestStepPostambleL()
       
   165 	{
       
   166 	return CTestStep::doTestStepPostambleL();
       
   167 	}
       
   168 
       
   169 
       
   170 /*
       
   171 	Opens a handle to a RPnPServicePublisher object and append the same to Publisher array
       
   172 	@param			None.
       
   173 	@return			None.
       
   174  */
       
   175 TVerdict CTestRControlChannel::doTestStepL()
       
   176 	{
       
   177 	SequenceOperationsL();
       
   178 	return TestStepResult();
       
   179 	}
       
   180 	
       
   181 void CTestRControlChannel::InitiateControlL()
       
   182 	{
       
   183 	RControlChannel controlChannel;
       
   184 	TInt err =-1;
       
   185 	err = iPublisher.InitiateControl(controlChannel);
       
   186 	_LIT(KInfoLogFile, "Initiating Publisher control returned value %d .... \n");
       
   187 	INFO_PRINTF2(KInfoLogFile,err);
       
   188 	CUPnPRControlChannelAO *rControlAO;
       
   189     rControlAO = new(ELeave) CUPnPRControlChannelAO(controlChannel,this);
       
   190 	rControlAO->RecvdataL();
       
   191    	CActiveScheduler::Start();
       
   192 	_LIT(KInfoLogFile1, "CTestRControlChannel::doTestStepL() End.... \n");
       
   193 	INFO_PRINTF1(KInfoLogFile1);
       
   194 	controlChannel.Close();
       
   195 //	delete rControlAO;
       
   196 
       
   197 	}
       
   198 /*
       
   199    This function performs operations based on sequence specified in the ini file
       
   200    @param  None
       
   201    @return None
       
   202 */
       
   203 void CTestRControlChannel::SequenceOperationsL()
       
   204 	{
       
   205 	_LIT(KInfoLogFile, "CTestRControlChannel::SequenceOperationsL().... \n");
       
   206 	INFO_PRINTF1(KInfoLogFile);
       
   207 	RArray<TPtrC> sequenceList;
       
   208 	CleanupClosePushL(sequenceList);
       
   209 	TPtrC listOfSequences;
       
   210 	_LIT(KListOfSequences, "listofsequences");
       
   211 	GetStringFromConfig(ConfigSection(), KListOfSequences, listOfSequences);
       
   212 
       
   213 	TokenizeStringL(listOfSequences, sequenceList);
       
   214 	TInt numOperations = sequenceList.Count();
       
   215 
       
   216 	for(TInt i(0); i < numOperations; i++)
       
   217 		{
       
   218 //		SetCurrentSection(sequenceList[i]);
       
   219 		PerformDesiredOperationsL(sequenceList[i]);
       
   220 		}
       
   221 	CleanupStack::PopAndDestroy(); 
       
   222 	_LIT(KInfoLogFile1, "CTestRControlChannel::SequenceOperationsL() End.... \n");
       
   223 	INFO_PRINTF1(KInfoLogFile1);
       
   224 	}
       
   225 	
       
   226 	
       
   227 /*
       
   228    Parses a comma separated string and constructs a list out of the values
       
   229    @param	aString a reference to a string to be tokenized
       
   230    @param	aList is an out parameter to store a list of tokens in an arry
       
   231    @param	aSeparator is a character used to delimit the tokens
       
   232   */
       
   233 void CTestRControlChannel::TokenizeStringL(const TDesC& aString, RArray<TPtrC>& aList, TChar aSeparator)
       
   234 	{
       
   235 	TLex lexer(aString);
       
   236 
       
   237 	while(!lexer.Eos())
       
   238 		{
       
   239 		lexer.SkipSpaceAndMark();
       
   240 
       
   241 		while(!lexer.Eos() && lexer.Get() != aSeparator)
       
   242 			{
       
   243 			}
       
   244 
       
   245 		if(!lexer.Eos())
       
   246 			{
       
   247 			lexer.UnGet();
       
   248 			}
       
   249 		aList.AppendL(lexer.MarkedToken());
       
   250 		lexer.Inc();
       
   251 		}
       
   252 	}
       
   253 	
       
   254 /*
       
   255    This function performs desired operations specified as a parameter
       
   256    @param  aOperation string representing operation to be performed
       
   257    @return None
       
   258 */
       
   259 void CTestRControlChannel::PerformDesiredOperationsL(const TDesC& aOperation)
       
   260 	{
       
   261 	const TInt KMatch = 0;
       
   262 	TPtrC operationType;
       
   263 	_LIT(KOperationType, "operationtype");
       
   264 	GetStringFromConfig(aOperation, KOperationType, operationType);
       
   265 
       
   266 	if ( iConnection.SubSessionHandle () == 0 )
       
   267 		{
       
   268 		TestUtils::LoadESockL ( iSocketServ, iConnection );
       
   269 		}
       
   270 		
       
   271 	if(operationType.Compare(KPublishService) == KMatch)
       
   272 		{
       
   273 		PublishServiceL(aOperation);
       
   274 		}
       
   275 	}
       
   276 
       
   277 
       
   278 void CTestRControlChannel::OpenPublisherL()
       
   279 	{
       
   280 	_LIT(KInfoLogFile, "CTestRControlChannel::OpenPublisherL.... \n");
       
   281 	INFO_PRINTF1(KInfoLogFile);
       
   282  	
       
   283 	TInt openStatus = 0;
       
   284 	for(TInt i=0;i<3;i++)	
       
   285 		{
       
   286 		openStatus = iPublisher.Open(KTierId);
       
   287 		if(openStatus == KErrNone)
       
   288 			{
       
   289 			break;
       
   290 			}
       
   291 		}
       
   292 	if( openStatus != KErrNone ) 
       
   293 		{
       
   294 		_LIT(KOpenDiscovererFailed, "Publisher open failed with error %d :");
       
   295 		ERR_PRINTF2(KOpenDiscovererFailed, openStatus);
       
   296 		}
       
   297 	else
       
   298 		{
       
   299 		_LIT(KOpenPublisherSuccess, "Service publisher was successfully started with return value %d :");
       
   300 		INFO_PRINTF2(KOpenPublisherSuccess, openStatus);
       
   301 		}
       
   302 	}
       
   303 
       
   304 /*
       
   305 	Tests whether Publishing a Service/Device is performing as specified in UPnP specifications.
       
   306 	@param			aOperationType is reference to a section name in ini file where required parameters
       
   307 					needs to be referred for this operation.
       
   308 	@return			None.
       
   309  */
       
   310 void CTestRControlChannel::PublishServiceL (const TDesC& aOperationType)
       
   311 	{
       
   312 	_LIT(KInfoLogFile, "CTestRControlChannel::PublishServiceL ().... \n");
       
   313 	INFO_PRINTF1(KInfoLogFile);
       
   314 	CRControlChannelObserver* upnpObserver = CRControlChannelObserver::NewL(this);
       
   315 	CleanupStack::PushL( upnpObserver );
       
   316 	iObserverArray.Append(upnpObserver);
       
   317 
       
   318 	RPnPParameterBundle pnpBundle ;
       
   319 	pnpBundle.Open();
       
   320     CleanupClosePushL( pnpBundle );
       
   321     pnpBundle.SetPnPObserver((MPnPObserver*)upnpObserver);
       
   322     RParameterFamily family = pnpBundle.CreateFamilyL(EUPnPServiceRegisterParamSet);
       
   323    	CUPnPServiceRegisterParamSet* registerServiceParamSet = CUPnPServiceRegisterParamSet::NewL(family );
       
   324 
       
   325    	_LIT(KParentDeviceUid, "ParentDeviceUid");
       
   326    	TPtrC parentDeviceUid;
       
   327 	GetStringFromConfig(aOperationType, KParentDeviceUid, parentDeviceUid);
       
   328 
       
   329 	RBuf8 parentDeviceUidBuf;
       
   330 	parentDeviceUidBuf.Create(parentDeviceUid.Length());
       
   331 	parentDeviceUidBuf.Copy(parentDeviceUid);
       
   332 	registerServiceParamSet->SetDeviceUidL (parentDeviceUidBuf);
       
   333 
       
   334 
       
   335 	TPtrC serviceType;
       
   336 	GetStringFromConfig(aOperationType, KServiceType, serviceType);
       
   337 	RBuf8 serviceTypeBuf;
       
   338 	serviceTypeBuf.Create(serviceType.Length());
       
   339 	serviceTypeBuf.Copy(serviceType);
       
   340 	registerServiceParamSet->SetUriL ( serviceTypeBuf );
       
   341 
       
   342 
       
   343 	TInt duration;
       
   344 	GetIntFromConfig(aOperationType, KCacheControl, duration);
       
   345 	registerServiceParamSet->SetCacheControlData (duration);
       
   346 
       
   347 	ExtractServiceDescriptionL (aOperationType, *registerServiceParamSet);
       
   348 
       
   349 	_LIT8(KInitialMessage, "Initial notification message");
       
   350 	registerServiceParamSet->SetInitialMessageL(KInitialMessage);
       
   351 	
       
   352 	OpenPublisherL();
       
   353 
       
   354 	iPublisher.Publish( pnpBundle );
       
   355 	CActiveScheduler::Start();
       
   356 
       
   357 	serviceTypeBuf.Close();
       
   358 	parentDeviceUidBuf.Close();
       
   359 	CleanupStack::PopAndDestroy( &pnpBundle );
       
   360 	CleanupStack::Pop( upnpObserver );
       
   361 	
       
   362 	InitiateControlL();
       
   363 	_LIT(KInfoLogFile1, "CTestRControlChannel::PublishServiceL () Stop.... \n");
       
   364 	INFO_PRINTF1(KInfoLogFile1);
       
   365 	
       
   366 	}
       
   367 
       
   368 
       
   369 /*
       
   370 	Extract service description available in a file, copy it to the buffer and append the same to service register paramset.
       
   371 	@param			aConfigSection - reference to a section name in ini file where required parameters that needs to be referred for this operation.
       
   372 					aServiceRegisterParamSet - Storage for the description buffer
       
   373 	@return			None.
       
   374  */
       
   375 
       
   376 void CTestRControlChannel::ExtractServiceDescriptionL (const TDesC& aConfigSection, CUPnPServiceRegisterParamSet& aServiceRegisterParamSet)
       
   377 	{
       
   378 	RFs fs;
       
   379 	RFile file;
       
   380 	RBuf8 buf;
       
   381 
       
   382 	User::LeaveIfError(fs.Connect());
       
   383 	CleanupClosePushL(fs);
       
   384 
       
   385 	TPtrC descriptionPath;
       
   386 	_LIT(KDescriptionPath, "Description_Path");
       
   387 	GetStringFromConfig(aConfigSection, KDescriptionPath, descriptionPath);
       
   388 
       
   389 	TInt err = file.Open(fs, descriptionPath, EFileShareReadersOnly);
       
   390 	
       
   391 	// For Hardware system path is c:, so descriptionPath value present in '.ini' is referring 'c:'
       
   392 	if ( err == KErrPathNotFound )
       
   393 		{				
       
   394 		RBuf fileName;
       
   395 		TDriveName aSystemDrive;
       
   396 		TDriveUnit driveunit(RFs::GetSystemDrive());
       
   397 		aSystemDrive.Zero();
       
   398 		aSystemDrive=driveunit.Name();				
       
   399 		fileName.CreateL ( descriptionPath.Length () );
       
   400 		fileName.Zero();
       
   401 		fileName.Append(aSystemDrive);
       
   402 		fileName.Append ( descriptionPath.Mid ( aSystemDrive.Length () ) );				
       
   403 		
       
   404 		err = file.Open(fs, fileName, EFileShareReadersOnly);
       
   405 		}
       
   406 	if (err != KErrNone)
       
   407 		{
       
   408 		User::LeaveIfError(err);
       
   409 		}
       
   410 
       
   411 	CleanupClosePushL(file);
       
   412 	TInt fileSize = 0;
       
   413 	file.Size(fileSize);
       
   414 
       
   415 	buf.Create(fileSize);
       
   416 
       
   417 	err = file.Read(buf, fileSize);
       
   418 	aServiceRegisterParamSet.SetServiceDescriptionL ( buf );
       
   419 
       
   420 	CleanupStack::PopAndDestroy(2 );
       
   421 	buf.Close();
       
   422 	_LIT(KInfoLogFile, "CRControlChannelObserver::ExtractServiceDescriptionL End.... \n");
       
   423 	INFO_PRINTF1(KInfoLogFile);
       
   424 	}
       
   425 
       
   426 
       
   427 CUPnPRControlChannelAO::CUPnPRControlChannelAO(RControlChannel& aControlChannel,CTestRControlChannel* aManager)
       
   428 	:CActive(EPriorityStandard),iControlChannel(aControlChannel),iManager(aManager)
       
   429     {
       
   430 	CActiveScheduler::Add(this);
       
   431     }    
       
   432 
       
   433 void CUPnPRControlChannelAO::RecvdataL()
       
   434     {
       
   435     // create the timer object
       
   436 	iTimer = CPeriodic::NewL ( CActive::EPriorityLow );
       
   437 	
       
   438 	_LIT(KInfoLogFile, "CUPnPRControlChannelAO::RecvdataL().... \n");
       
   439 	iManager->INFO_PRINTF1(KInfoLogFile);
       
   440     iIncomingActionBuffer.CreateMaxL( 1024 );
       
   441    	iInComingAction.SetMessageDes (iIncomingActionBuffer);
       
   442 	iControlChannel.Recv(iInComingAction, iStatus);
       
   443 	iState = ERecv;
       
   444 	SetActive();
       
   445 	
       
   446 	TCallBack callback ( &CUPnPRControlChannelAO::TimerCallbackL, this );
       
   447 	const TInt timeout = 60436607; // rounded-conversion of 600seconds to clockticks
       
   448 	iTimer->Start( TTimeIntervalMicroSeconds32 ( timeout ), TTimeIntervalMicroSeconds32 ( timeout ), callback );
       
   449 	
       
   450 	_LIT(KInfoLogFile1, "CUPnPRControlChannelAO::RecvdataL() End.... \n");
       
   451 	iManager->INFO_PRINTF1(KInfoLogFile1);
       
   452     }
       
   453 
       
   454 TInt CUPnPRControlChannelAO::TimerCallbackL ( TAny* aPtr )
       
   455 	{
       
   456 	CUPnPRControlChannelAO* self = static_cast<CUPnPRControlChannelAO*> ( aPtr );
       
   457 	if ( self->iState == ERecv )
       
   458 		{
       
   459 		CActiveScheduler::Stop ();
       
   460 		_LIT ( KInfoLogFile1, "CUPnPRControlChannelAO::RunL() Stop.... \n" );
       
   461 		self->iManager->INFO_PRINTF1 ( KInfoLogFile1 );
       
   462 		self->iTimer->Cancel ();
       
   463 		}
       
   464 		
       
   465 	return KErrNone;
       
   466 	}
       
   467 	
       
   468 
       
   469 void CUPnPRControlChannelAO::SenddataL()
       
   470     {
       
   471 	_LIT(KInfoLogFile, "CUPnPRControlChannelAO::SenddataL().... \n");
       
   472 	iManager->INFO_PRINTF1(KInfoLogFile);
       
   473     ExtractSoapResponse(iOutgoingActionBuffer);
       
   474     iInComingAction.SetMessageDes (iOutgoingActionBuffer);
       
   475     iInComingAction.SetLast();
       
   476     TInt newLen = iOutgoingActionBuffer.Length( );
       
   477     iInComingAction.SetMaxLength(newLen);
       
   478     iControlChannel.Send(iInComingAction, iStatus);
       
   479 	SetActive();
       
   480 	_LIT(KInfoLogFile1, "CUPnPRControlChannelAO::SenddataL() End.... \n");
       
   481 	iManager->INFO_PRINTF1(KInfoLogFile1);
       
   482     }
       
   483 
       
   484 CUPnPRControlChannelAO::~CUPnPRControlChannelAO()
       
   485     {
       
   486     iTimer->Cancel ();
       
   487 	delete iTimer;	
       
   488     }
       
   489 
       
   490 void CUPnPRControlChannelAO::RunL()
       
   491     {
       
   492      switch ( iState )
       
   493     	 {
       
   494 	     case ERecv:
       
   495 	    	 {
       
   496 	    	 iTimer->Cancel ();
       
   497 	    	 if( iInComingAction.MaxLength() != KErrUnknown )
       
   498 	             {
       
   499 	             if ( iCompleteBuffer.Length() == 0 )
       
   500 		       		{
       
   501 		    		iCompleteBuffer.CreateL(iInComingAction.MessageDes().Length());
       
   502 		   	       	}
       
   503 		   	     else
       
   504 		   	     	{
       
   505 		   	     	TInt oldLen = iCompleteBuffer.Length();
       
   506 		   	     	iCompleteBuffer.ReAlloc ( oldLen + iInComingAction.MessageDes().Length() );
       
   507 		   	     	}
       
   508 	    	     iCompleteBuffer.Append(iInComingAction.MessageDes());
       
   509 	
       
   510 	    	     if( iCompleteBuffer.Length() == iInComingAction.MaxLength() )
       
   511 	    	       	{
       
   512 					iInComingAction.ClearFlags();
       
   513 	    	       	SenddataL();
       
   514 	    	       	iState = EStop;
       
   515 	    	       	}
       
   516 	    	     else
       
   517 	    	       	{
       
   518 	    	       	iControlChannel.Recv(iInComingAction, iStatus);
       
   519 	    	       	iState = ERecv;
       
   520 	    	       	SetActive();
       
   521 	    	       	}
       
   522 	             }
       
   523 	          else
       
   524 	    	     {
       
   525 	    	     iExepecteBufLen = iInComingAction.MaxLength();
       
   526 	    	     RBuf8 completeData;
       
   527 	    	     completeData.CreateL( iExepecteBufLen );
       
   528 	    	     completeData.Append(iInComingAction.MessageDes());
       
   529 	    	     iControlChannel.Recv(iInComingAction, iStatus);
       
   530 	    	     SenddataL();
       
   531 	    	     iState = EStop;
       
   532 	    	     }
       
   533 			_LIT(KInfoLogFile, "CUPnPRControlChannelAO::RunL().... \n");
       
   534 			iManager->INFO_PRINTF1(KInfoLogFile);
       
   535 	    	 }
       
   536 	    break;
       
   537 
       
   538        case EStop:
       
   539     	   {
       
   540 			CActiveScheduler::Stop();
       
   541 			_LIT(KInfoLogFile1, "CUPnPRControlChannelAO::RunL() Stop.... \n");
       
   542 			iManager->INFO_PRINTF1(KInfoLogFile1);    	   
       
   543     	   }
       
   544         break;
       
   545         }
       
   546     }
       
   547 
       
   548 
       
   549 void CUPnPRControlChannelAO::DoCancel()
       
   550 	{
       
   551 	//Nothing
       
   552 	}
       
   553 
       
   554 void CUPnPRControlChannelAO::ExtractSoapResponse(RBuf8& aSoapResponse)
       
   555 	{
       
   556 	aSoapResponse.Create(iCompleteBuffer);
       
   557 	}
       
   558 
       
   559 
       
   560 /*
       
   561   Constructor:
       
   562   @internalTechnology
       
   563   @test
       
   564 */
       
   565 CRControlChannelObserver::CRControlChannelObserver()
       
   566 	{
       
   567 	}
       
   568 
       
   569 /*
       
   570   Destructor
       
   571   @internalTechnology
       
   572   @test
       
   573 */
       
   574 CRControlChannelObserver::~CRControlChannelObserver()
       
   575 	{
       
   576 	}
       
   577 
       
   578 
       
   579 /*
       
   580 	Static factory constructor. Uses two phase construction and leaves nothing on the
       
   581 	CleanupStack. Creates a CTestControlPointService object.
       
   582 	@param			aManager	A pointer to a CTestRControlChannel object.
       
   583 	@return			A pointer to the newly created CPnPObserver object.
       
   584 	@post			A fully constructed and initialized CPnPObserver object.
       
   585  */
       
   586 
       
   587 CRControlChannelObserver* CRControlChannelObserver::NewL(CTestRControlChannel* aManager)
       
   588 	{
       
   589 	CRControlChannelObserver* self = new(ELeave) CRControlChannelObserver;
       
   590 	CleanupStack::PushL(self);
       
   591 	self->ConstructL(aManager);
       
   592 	CleanupStack::Pop(self);
       
   593 	return self;
       
   594 	}
       
   595 
       
   596 /*
       
   597 	Second phase of two-phase construction method. Does any allocations required to fully construct
       
   598 	the object.
       
   599 	@pre 		First phase of construction is complete.
       
   600 	@param		aManager	A pointer to a CTestRControlChannel object.
       
   601 	@post		The object is fully constructed and initialized.
       
   602  */
       
   603 void CRControlChannelObserver::ConstructL(CTestRControlChannel* aManager)
       
   604 	{
       
   605 	iManager = aManager;
       
   606 	}
       
   607 
       
   608 
       
   609 
       
   610 /*
       
   611    This method returns a reference to the CTestRControlChannel object.
       
   612    @param None
       
   613    return a reference to the CTestRControlChannel object
       
   614  */
       
   615 CTestRControlChannel& CRControlChannelObserver::Manager()
       
   616 	{
       
   617 	return *iManager;
       
   618 	}
       
   619 
       
   620 /*
       
   621    This is called when callback hits. And this method stores the bundle results
       
   622    and meta information related to that results into results array
       
   623    @param  aParameterBundle a reference to CPnPParameterBundleBase
       
   624    @return None
       
   625  */
       
   626 void CRControlChannelObserver::OnPnPEventL ( RPnPParameterBundleBase& aParameterBundle)
       
   627 	{
       
   628 	RParameterFamily family = aParameterBundle.GetFamilyAtIndex(0);	
       
   629 	_LIT(KInfoLogFile, "Service Published successfully...\n");
       
   630 	Manager().INFO_PRINTF1(KInfoLogFile);
       
   631 
       
   632 	CActiveScheduler::Stop();
       
   633 	_LIT(KInfoLogFile1, "CRControlChannelObserver::OnPnPEventL.... \n");
       
   634 	Manager().INFO_PRINTF1(KInfoLogFile1);
       
   635 	}
       
   636 
       
   637 
       
   638 void CRControlChannelObserver::OnPnPError(TInt aError)
       
   639 	{
       
   640 	TInt error = aError;
       
   641 	_LIT(KErrorMessage, "Error occurred in the UPnP Observer : %d \n");
       
   642 	Manager().INFO_PRINTF2(KErrorMessage, error);
       
   643 	}
       
   644 
       
   645