diff -r 000000000000 -r a41df078684a kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,140 @@ +// 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 Session of a Symbian OS server for the RUsbMassStorage API +// +// + + + +/** + @file + @internalTechnology +*/ + +#include +#include + +#include "tmslog.h" +#include "msmanclientserver.h" + +#include +#include +#include +#include "usbtypes.h" + +#include "cusbotg.h" + +#include "cusbotgserver.h" +#include "cusbotgsession.h" + + +CUsbOtgSession* CUsbOtgSession::NewL() + { + __MSFNSLOG + CUsbOtgSession* r = new (ELeave) CUsbOtgSession(); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } + + +CUsbOtgSession::CUsbOtgSession() + { + __MSFNSLOG + + } + +void CUsbOtgSession::ConstructL() + { + __MSFNSLOG + } + + +void CUsbOtgSession::CreateL() + { + __MSFNSLOG + Server().AddSession(); + } + + +CUsbOtgSession::~CUsbOtgSession() + { + __MSFNSLOG + Server().RemoveSession(); + } + + +void CUsbOtgSession::ServiceL(const RMessage2& aMessage) + { + __MSFNSLOG + DispatchMessageL(aMessage); + } + + +void CUsbOtgSession::DispatchMessageL(const RMessage2& aMessage) + { + __MSFNSLOG + TInt ret = KErrNone; + + switch (aMessage.Function()) + { + case EUsbOtgDeviceInserted: + DeviceInsertedL(aMessage); + break; + case EUsbOtgNotifyChange: + NotifyChange(aMessage); + break; + case EUsbOtgNotifyChangeCancel: + NotifyChangeCancel(); + break; + case EUsbOtgBusDrop: + ret = BusDrop(); + break; + default: + aMessage.Panic(KUsbOtgClientPncCat, EUsbOtgPanicIllegalIPC); + break; + } + + aMessage.Complete(ret); + } + + +void CUsbOtgSession::DeviceInsertedL(const RMessage2& aMessage) + { + __MSFNSLOG + TBool inserted = Server().iUsbOtg->DeviceInserted(); + TPckgBuf p(inserted); + aMessage.WriteL(0,p); + } + +void CUsbOtgSession::NotifyChange(const RMessage2& aMessage) + { + __MSFNSLOG + Server().iUsbOtg->NotifyChange(aMessage); + } + + +void CUsbOtgSession::NotifyChangeCancel() + { + __MSFNSLOG + Server().iUsbOtg->NotifyChangeCancel(); + } + + +TInt CUsbOtgSession::BusDrop() + { + __MSFNSLOG + return Server().iUsbOtg->BusDrop(); + }