os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,112 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Implements a Session of a Symbian OS server for the RUsbMassStorage API
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file
    1.25 + @internalTechnology
    1.26 +*/
    1.27 +
    1.28 +#include <e32cmn.h>
    1.29 +#include <e32base.h>
    1.30 +
    1.31 +#include "tmslog.h"
    1.32 +#include "msmanclientserver.h"
    1.33 +
    1.34 +#include <f32file.h>
    1.35 +#include <d32usbdi_hubdriver.h>
    1.36 +#include <d32otgdi.h>
    1.37 +#include "usbtypes.h"
    1.38 +
    1.39 +#include "cusbhostao.h"
    1.40 +#include "cusbhost.h"
    1.41 +
    1.42 +
    1.43 +#include "cusbhostserver.h"
    1.44 +#include "cusbhostsession.h"
    1.45 +
    1.46 +
    1.47 +CUsbHostSession* CUsbHostSession::NewL()
    1.48 +	{
    1.49 +    __MSFNSLOG
    1.50 +	CUsbHostSession* r = new (ELeave) CUsbHostSession();
    1.51 +	CleanupStack::PushL(r);
    1.52 +	r->ConstructL();
    1.53 +	CleanupStack::Pop();
    1.54 +	return r;
    1.55 +	}
    1.56 +
    1.57 +
    1.58 +CUsbHostSession::CUsbHostSession()
    1.59 +	{
    1.60 +    __MSFNSLOG
    1.61 +
    1.62 +	}
    1.63 +
    1.64 +void CUsbHostSession::ConstructL()
    1.65 +	{
    1.66 +    __MSFNSLOG
    1.67 + 	}
    1.68 +
    1.69 +
    1.70 +void CUsbHostSession::CreateL()
    1.71 +	{
    1.72 +    __MSFNSLOG
    1.73 +    Server().AddSession();
    1.74 +	}
    1.75 +
    1.76 +
    1.77 +CUsbHostSession::~CUsbHostSession()
    1.78 +	{
    1.79 +    __MSFNSLOG
    1.80 +    Server().RemoveSession();
    1.81 +	}
    1.82 +
    1.83 +
    1.84 +void CUsbHostSession::ServiceL(const RMessage2& aMessage)
    1.85 +	{
    1.86 +    __MSFNSLOG
    1.87 +	DispatchMessageL(aMessage);
    1.88 +	}
    1.89 +
    1.90 +
    1.91 +void CUsbHostSession::DispatchMessageL(const RMessage2& aMessage)
    1.92 +	{
    1.93 +    __MSFNSLOG
    1.94 +	TInt ret = KErrNone;
    1.95 +
    1.96 +	switch (aMessage.Function())
    1.97 +		{
    1.98 +	case EUsbHostStart:
    1.99 +		ret = Start(aMessage);
   1.100 +		break;
   1.101 +	default:
   1.102 +		aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC);
   1.103 +		break;
   1.104 +		}
   1.105 +
   1.106 +	aMessage.Complete(ret);
   1.107 +	}
   1.108 +
   1.109 +
   1.110 +TInt CUsbHostSession::Start(const RMessage2& aMessage)
   1.111 +	{
   1.112 +    __MSFNSLOG
   1.113 +    Server().iUsbHost->Start();
   1.114 +	return KErrNone;
   1.115 +	}