os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/client/rusbhostsession.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.
27 #include "msmanclientserver.h"
28 #include "rusbhostsession.h"
33 TVersion RUsbHostSession::Version() const
36 return(TVersion(KUsbHostSrvMajorVersionNumber,
37 KUsbHostSrvMinorVersionNumber,
38 KUsbHostSrvBuildVersionNumber));
42 EXPORT_C RUsbHostSession::RUsbHostSession()
48 EXPORT_C TInt RUsbHostSession::Connect()
55 TInt r = CreateSession(KUsbHostServerName, Version());
56 if ((r != KErrNotFound) && (r != KErrServerTerminated))
66 if ((r != KErrNone) && (r != KErrAlreadyExists))
74 TInt RUsbHostSession::StartServer()
78 const TUidType serverUid(KNullUid, KNullUid, KUsbHostServerUid3);
80 // Create the server process
82 TInt r = server.Create(KUsbHostServerName, KNullDesC, serverUid);
88 // Create the rendezvous request with the server process
89 TRequestStatus status;
90 server.Rendezvous(status);
91 if (status != KRequestPending)
93 User::WaitForRequest(status);
94 server.Kill(0); // If the outstanding request is not pending then kill the server
99 server.SetPriority(EPriorityHigh);
100 server.Resume(); // start the server
102 // Test whether the process has ended and if it has ended, return how it ended.
103 User::WaitForRequest(status);
105 if (status == KRequestPending)
117 EXPORT_C TInt RUsbHostSession::Start()
119 return SendReceive(EUsbHostStart);