kerneltest/f32test/shostmassstorage/msman/server/cusbhostserver.cpp
author Mike Kinghan <mikek@symbian.org>
Thu, 25 Nov 2010 14:35:45 +0000
branchGCC_SURGE
changeset 305 1ba12ef4ef89
parent 0 a41df078684a
child 297 b2826f67641f
permissions -rw-r--r--
Enhance the base/rom extension to generate the symbol file of the rom built. The symbol file is placed in epoc32/rom/<baseport_name>, along with the rom log and final oby file.

// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "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:
// Implements a Symbian OS server that exposes the RUsbMassStorage API
// 
//



/**
 @file
 @internalTechnology
*/

#include <e32svr.h>
#include <f32file.h>

#include <d32usbdi_hubdriver.h>
#include <d32otgdi.h>

#include "usbtypes.h"

#include "cusbhostao.h"
#include "cusbhost.h"


#include "msmanclientserver.h"
#include "cusbhostserver.h"
#include "cusbhostsession.h"

#include "tmslog.h"

CUsbHostServer* CUsbHostServer::NewLC()
	{
    __MSFNSLOG
	CUsbHostServer* r = new (ELeave) CUsbHostServer();
	CleanupStack::PushL(r);
    r->ConstructL();
	return r;
	}


CUsbHostServer::CUsbHostServer()
:   CServer2(EPriorityLow)
	{
    __MSFNSLOG
	}


void CUsbHostServer::ConstructL()
    {
    __MSFNSLOG
    iUsbHost = CUsbHost::NewL();
	StartL(KUsbHostServerName);
    }


CUsbHostServer::~CUsbHostServer()
	{
    __MSFNSLOG
    delete iUsbHost;
	}


CSession2* CUsbHostServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const
	{
    __MSFNSLOG
	TVersion v(KUsbHostSrvMajorVersionNumber, KUsbHostSrvMinorVersionNumber, KUsbHostSrvBuildVersionNumber);

	if (!User::QueryVersionSupported(v, aVersion))
		User::Leave(KErrNotSupported);

	CUsbHostSession* session = CUsbHostSession::NewL();

	return session;
	}



TInt CUsbHostServer::RunError(TInt aError)
	{
    __MSFNSLOG

	Message().Complete(aError);
	ReStart();
    return KErrNone;
	}


void CUsbHostServer::AddSession()
    {
    __MSFNSLOG
    ++iSessionCount;
    }

void CUsbHostServer::RemoveSession()
    {
    __MSFNSLOG
    if (--iSessionCount == 0)
        {
        User::After(1000000);
        CActiveScheduler::Stop();
        }
    }