os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/server/cusbhostserver.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 Symbian OS server that exposes the RUsbMassStorage API
28 #include <d32usbdi_hubdriver.h>
33 #include "cusbhostao.h"
37 #include "msmanclientserver.h"
38 #include "cusbhostserver.h"
39 #include "cusbhostsession.h"
43 CUsbHostServer* CUsbHostServer::NewLC()
46 CUsbHostServer* r = new (ELeave) CUsbHostServer();
47 CleanupStack::PushL(r);
53 CUsbHostServer::CUsbHostServer()
54 : CServer2(EPriorityLow)
60 void CUsbHostServer::ConstructL()
63 iUsbHost = CUsbHost::NewL();
64 StartL(KUsbHostServerName);
68 CUsbHostServer::~CUsbHostServer()
75 CSession2* CUsbHostServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const
78 TVersion v(KUsbHostSrvMajorVersionNumber, KUsbHostSrvMinorVersionNumber, KUsbHostSrvBuildVersionNumber);
80 if (!User::QueryVersionSupported(v, aVersion))
81 User::Leave(KErrNotSupported);
83 CUsbHostSession* session = CUsbHostSession::NewL();
90 TInt CUsbHostServer::RunError(TInt aError)
94 Message().Complete(aError);
100 void CUsbHostServer::AddSession()
106 void CUsbHostServer::RemoveSession()
109 if (--iSessionCount == 0)
111 User::After(1000000);
112 CActiveScheduler::Stop();