os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/client/rusbotgsession.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 // rusbhostmsdevice.cpp
29 #include "msmanclientserver.h"
30 #include "rusbotgsession.h"
35 TVersion RUsbOtgSession::Version() const
38 return(TVersion(KUsbOtgSrvMajorVersionNumber,
39 KUsbOtgSrvMinorVersionNumber,
40 KUsbOtgSrvBuildVersionNumber));
44 EXPORT_C RUsbOtgSession::RUsbOtgSession()
50 EXPORT_C RUsbOtgSession::RUsbOtgSession(TInt /* aParam */)
55 EXPORT_C TInt RUsbOtgSession::Connect()
62 TInt r = CreateSession(KUsbOtgServerName, Version());
63 if ((r != KErrNotFound) && (r != KErrServerTerminated))
73 if ((r != KErrNone) && (r != KErrAlreadyExists))
81 TInt RUsbOtgSession::StartServer()
85 const TUidType serverUid(KNullUid, KNullUid, KUsbOtgServerUid3);
87 // Create the server process
89 TInt r = server.Create(KUsbOtgServerName, KNullDesC, serverUid);
95 // Create the rendezvous request with the server process
96 TRequestStatus status;
97 server.Rendezvous(status);
98 if (status != KRequestPending)
100 User::WaitForRequest(status);
101 server.Kill(0); // If the outstanding request is not pending then kill the server
106 server.SetPriority(EPriorityHigh);
107 server.Resume(); // start the server
109 // Test whether the process has ended and if it has ended, return how it ended.
110 User::WaitForRequest(status);
112 if (status == KRequestPending)
123 EXPORT_C TBool RUsbOtgSession::DeviceInserted()
126 TPckgBuf<TBool> pckg;
127 TIpcArgs args(&pckg);
129 SendReceive(EUsbOtgDeviceInserted, args);
135 EXPORT_C void RUsbOtgSession::NotifyChange(TBool& /* aChanged */, TRequestStatus& aStatus)
138 TPckgBuf<TBool> pckg;
139 TIpcArgs args(&pckg);
141 SendReceive(EUsbOtgNotifyChange, args, aStatus);
145 EXPORT_C TInt RUsbOtgSession::NotifyChangeCancel()
148 return SendReceive(EUsbOtgNotifyChangeCancel);
152 EXPORT_C TInt RUsbOtgSession::BusDrop()
155 return SendReceive(EUsbOtgBusDrop);