os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmsserver.cpp
Update contrib.
1 // Copyright (c) 2008-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 // cusbhostmsderver.cpp
26 #include "msgservice.h"
27 #include "usbmshostpanic.h"
28 #include "cusbhostmssession.h"
29 #include "cusbhostmsserver.h"
32 #include "securitypolicy.h"
35 Constructs a USB mass storage Server
37 CUsbHostMsServer* CUsbHostMsServer::NewLC()
40 CUsbHostMsServer* r = new (ELeave) CUsbHostMsServer();
41 CleanupStack::PushL(r);
42 r->StartL(KUsbHostMsServerName);
49 CUsbHostMsServer::~CUsbHostMsServer()
52 // Intentionally left blank
59 CUsbHostMsServer::CUsbHostMsServer()
60 : CPolicyServer(EPriorityHigh,KUsbMsServerPolicy, EGlobalSharableSessions)
67 Create a new session on this server.
69 @param aVersion Version of client
70 @param aMessage& Not used
72 @return CSession2* A pointer to a session object to be used for the client
74 CSession2* CUsbHostMsServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const
77 TVersion v(KUsbHostMsSrvMajorVersionNumber,
78 KUsbHostMsSrvMinorVersionNumber,
79 KUsbHostMsSrvBuildVersionNumber);
80 if (!User::QueryVersionSupported(v, aVersion))
81 User::Leave(KErrNotSupported);
83 CUsbHostMsServer* ncThis = const_cast<CUsbHostMsServer*>(this);
85 CUsbHostMsSession* sess = CUsbHostMsSession::NewL(*ncThis);
92 Inform the client there has been an error.
94 @param aError The error that has occurred
96 void CUsbHostMsServer::Error(TInt aError)
99 __HOSTPRINT1(_L("CUsbHostMsServer::Error [aError=%d]\n"), aError);
101 Message().Complete(aError);
106 Increment the open session count (iSessionCount) by one.
108 @post The number of open sessions is incremented by one
110 void CUsbHostMsServer::IncrementSessionCount()
113 __HOSTPRINT1(_L("CUsbHostMsServer::IncrementSessionCount %d\n"), iSessionCount);
114 __ASSERT_DEBUG(iSessionCount >= 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC));
118 __HOSTPRINT(_L("CUsbHostMsServer::IncrementSessionCount\n"));
122 Decrement the open session count (iSessionCount) by one.
124 @post The number of open sessions is decremented by one
126 void CUsbHostMsServer::DecrementSessionCount()
129 __HOSTPRINT1(_L("CUsbHostMsServer::DecrementSessionCount %d\n"), iSessionCount);
131 __ASSERT_DEBUG(iSessionCount > 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC));