mmserv/radioutility/radioserver/Server/Src/RadioServerShutdown.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:08:46 +0200
changeset 0 71ca22bcf22a
child 16 43d09473c595
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  This class implements the shutdown timer that is used by the RadioServer
*				 to shutdown the server 2 seconds after the last client has disconnected.
*
*/



// INCLUDE FILES
#include    "RadioServerShutdown.h"
#include    "RadioDebug.h"

// CONSTANTS
const TInt KServerShutdownDelay = 1000000;	// 1 secs

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CRadioServerShutdown::CRadioServerShutdown
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CRadioServerShutdown::CRadioServerShutdown()
	:	CTimer(EPriorityStandard)
    {
    }

// -----------------------------------------------------------------------------
// CRadioServerShutdown::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CRadioServerShutdown::ConstructL()
    {
	RADIO_RDEBUG(_L("[RADIO-SVR] CRadioServerShutdown::ConstructL()"));
	CTimer::ConstructL();
	CActiveScheduler::Add(this);
    }

// -----------------------------------------------------------------------------
// CRadioServerShutdown::NewL
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CRadioServerShutdown* CRadioServerShutdown::NewL()
    {
    CRadioServerShutdown* self = new( ELeave ) CRadioServerShutdown();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
    }

// Destructor
CRadioServerShutdown::~CRadioServerShutdown()
    {
	if ( IsActive() )
		{
		Cancel();
		}
    }

// -----------------------------------------------------------------------------
// CRadioServerShutdown::Start
// -----------------------------------------------------------------------------
//
void CRadioServerShutdown::Start()
    {
	if ( !IsActive() )
		{
		After(KServerShutdownDelay);
		}
    }

// -----------------------------------------------------------------------------
// CRadioServerShutdown::DoCancel
// -----------------------------------------------------------------------------
//
void CRadioServerShutdown::DoCancel()
    {
    }

// -----------------------------------------------------------------------------
// CRadioServerShutdown::RunL
// -----------------------------------------------------------------------------
//
void CRadioServerShutdown::RunL()
    {
	RADIO_RDEBUG(_L("[RADIO-SVR] CRadioServerShutdown::RunL()"));
	CActiveScheduler::Stop();
    }

//  End of File