servicediscoveryandcontrol/pnp/test/upnp/IntegTest/testdelay/src/testdelay.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 // Contains implementation of CTestUPnPManager class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #include "testdelay.h"
       
    24 
       
    25 
       
    26 /*
       
    27   Constructor:
       
    28   @internalTechnology
       
    29   @test
       
    30 */
       
    31 CTestUPnPManager::CTestUPnPManager()
       
    32 :	CTestStep()
       
    33 	{
       
    34 	}
       
    35 
       
    36 /*
       
    37    Initializes all member vaiables.
       
    38    @param		None.
       
    39    @return		None.
       
    40 */
       
    41 void CTestUPnPManager::InitializeL()
       
    42 	{
       
    43 	iScheduler = new (ELeave) CActiveScheduler;
       
    44 	CActiveScheduler::Install(iScheduler);
       
    45 	}
       
    46 
       
    47 /*
       
    48    Destructor
       
    49    @internalTechnology
       
    50    @test
       
    51 */
       
    52 CTestUPnPManager::~CTestUPnPManager()
       
    53 	{
       
    54 	CActiveScheduler::Install(NULL);
       
    55 	delete iScheduler;
       
    56 	}
       
    57 
       
    58 /*
       
    59    Implementation of CTestStep base class virtual and this is used for doing all
       
    60    initialisation common
       
    61     to derived classes here.
       
    62    @param  None
       
    63    @return TVerdict
       
    64  */
       
    65 TVerdict CTestUPnPManager::doTestStepPreambleL()
       
    66 	{
       
    67 	InitializeL();
       
    68 	return CTestStep::doTestStepPreambleL();
       
    69 	}
       
    70 
       
    71 /*
       
    72    Implementation of CTestStep base class virtual and it is used for doing all
       
    73    after test treatment common to derived classes in here.
       
    74    @return TVerdict
       
    75  */
       
    76 TVerdict CTestUPnPManager::doTestStepPostambleL()
       
    77 	{
       
    78 	return CTestStep::doTestStepPostambleL();
       
    79 	}
       
    80 
       
    81 
       
    82 TVerdict CTestUPnPManager::doTestStepL()
       
    83 	{
       
    84 	return TestStepResult();	
       
    85 	}
       
    86 
       
    87 
       
    88 
       
    89 CUPnPTimer::CUPnPTimer()
       
    90 : CActive(EPriorityIdle), iRequestPending(EFalse)
       
    91     {
       
    92     CActiveScheduler::Add(this);
       
    93     }
       
    94 
       
    95 
       
    96 CUPnPTimer::~CUPnPTimer()
       
    97     {
       
    98 	if(PendingRequest())
       
    99 		{
       
   100 		Cancel();
       
   101 		}
       
   102     }
       
   103 
       
   104 
       
   105 CUPnPTimer* CUPnPTimer::NewL()
       
   106     {
       
   107 	CUPnPTimer* self = new (ELeave) CUPnPTimer();
       
   108 	CleanupStack::PushL(self);
       
   109 	self->ConstructL();
       
   110 	CleanupStack::Pop();
       
   111 	return self;
       
   112     }
       
   113 
       
   114 void CUPnPTimer::ConstructL()
       
   115 	{
       
   116 	}
       
   117 
       
   118 
       
   119 void CUPnPTimer::IssueRequestL(TTimeIntervalMicroSeconds32 anInterval)
       
   120     {
       
   121 	iTimer.CreateLocal();
       
   122     iTimer.After(iStatus, anInterval);
       
   123  	iRequestPending = ETrue;
       
   124     SetActive();
       
   125     }
       
   126 
       
   127 TBool CUPnPTimer::PendingRequest()
       
   128     {
       
   129     return iRequestPending;
       
   130     }
       
   131 
       
   132 
       
   133 void CUPnPTimer::RunL()
       
   134 	{
       
   135 	iRequestPending = EFalse;
       
   136 	CActiveScheduler::Stop();
       
   137 	}
       
   138 
       
   139 void CUPnPTimer::DoCancel()
       
   140 	{
       
   141 	if(PendingRequest())
       
   142 		{
       
   143 		Cancel();
       
   144 		}
       
   145 	}