os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp
Update contrib.
1 // Copyright (c) 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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Implements a Session of a Symbian OS server for the RUsbMassStorage API
29 #include "msmanclientserver.h"
32 #include <d32usbdi_hubdriver.h>
38 #include "cusbotgserver.h"
39 #include "cusbotgsession.h"
42 CUsbOtgSession* CUsbOtgSession::NewL()
45 CUsbOtgSession* r = new (ELeave) CUsbOtgSession();
46 CleanupStack::PushL(r);
53 CUsbOtgSession::CUsbOtgSession()
59 void CUsbOtgSession::ConstructL()
65 void CUsbOtgSession::CreateL()
68 Server().AddSession();
72 CUsbOtgSession::~CUsbOtgSession()
75 Server().RemoveSession();
79 void CUsbOtgSession::ServiceL(const RMessage2& aMessage)
82 DispatchMessageL(aMessage);
86 void CUsbOtgSession::DispatchMessageL(const RMessage2& aMessage)
91 switch (aMessage.Function())
93 case EUsbOtgDeviceInserted:
94 DeviceInsertedL(aMessage);
96 case EUsbOtgNotifyChange:
97 NotifyChange(aMessage);
99 case EUsbOtgNotifyChangeCancel:
100 NotifyChangeCancel();
106 aMessage.Panic(KUsbOtgClientPncCat, EUsbOtgPanicIllegalIPC);
110 aMessage.Complete(ret);
114 void CUsbOtgSession::DeviceInsertedL(const RMessage2& aMessage)
117 TBool inserted = Server().iUsbOtg->DeviceInserted();
118 TPckgBuf<TBool> p(inserted);
119 aMessage.WriteL(0,p);
122 void CUsbOtgSession::NotifyChange(const RMessage2& aMessage)
125 Server().iUsbOtg->NotifyChange(aMessage);
129 void CUsbOtgSession::NotifyChangeCancel()
132 Server().iUsbOtg->NotifyChangeCancel();
136 TInt CUsbOtgSession::BusDrop()
139 return Server().iUsbOtg->BusDrop();