os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/server/cusbotgserver.cpp
First public contribution.
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 Symbian OS server that exposes the RUsbMassStorage API
28 #include <d32usbdi_hubdriver.h>
34 #include "msmanclientserver.h"
35 #include "cusbotgserver.h"
36 #include "cusbotgsession.h"
40 CUsbOtgServer* CUsbOtgServer::NewLC()
43 CUsbOtgServer* r = new (ELeave) CUsbOtgServer();
44 CleanupStack::PushL(r);
50 CUsbOtgServer::CUsbOtgServer()
51 : CServer2(EPriorityLow)
57 void CUsbOtgServer::ConstructL()
61 iUsbOtg = CUsbOtg::NewL();
62 StartL(KUsbOtgServerName);
66 CUsbOtgServer::~CUsbOtgServer()
73 CSession2* CUsbOtgServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const
76 TVersion v(KUsbOtgSrvMajorVersionNumber, KUsbOtgSrvMinorVersionNumber, KUsbOtgSrvBuildVersionNumber);
78 if (!User::QueryVersionSupported(v, aVersion))
79 User::Leave(KErrNotSupported);
81 CUsbOtgSession* session = CUsbOtgSession::NewL();
88 TInt CUsbOtgServer::RunError(TInt aError)
92 Message().Complete(aError);
98 void CUsbOtgServer::AddSession()
104 void CUsbOtgServer::RemoveSession()
107 if (--iSessionCount == 0)
109 User::After(1000000);
110 CActiveScheduler::Stop();