25
|
1 |
/*
|
29
|
2 |
* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
|
25
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include <usb/usblogger.h>
|
|
24 |
#include <e32cmn.h>
|
|
25 |
|
|
26 |
#include "srvdef.h"
|
|
27 |
#include "msmmindicatorclient.h"
|
29
|
28 |
#include "OstTraceDefinitions.h"
|
|
29 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
30 |
#include "msmmindicatorclientTraces.h"
|
|
31 |
#endif
|
|
32 |
|
25
|
33 |
|
|
34 |
|
|
35 |
// Costants
|
|
36 |
const TInt KConnectRetry = 0x2;
|
|
37 |
|
|
38 |
|
|
39 |
//---------------------------------------------------------------------------
|
|
40 |
// RHostMassStorage
|
|
41 |
//
|
|
42 |
// Public member functions
|
|
43 |
|
|
44 |
EXPORT_C TInt RHostMassStorage::Connect()
|
|
45 |
{
|
29
|
46 |
OstTraceFunctionEntry0( RHOSTMASSSTORAGE_CONNECT_ENTRY );
|
25
|
47 |
|
|
48 |
TInt retry = KConnectRetry; // Attempt to add a session to MSMM Server twice
|
|
49 |
TInt ret(KErrNone);
|
|
50 |
FOREVER
|
|
51 |
{
|
|
52 |
ret = CreateSession(KMsmmServerName, Version(), KDefaultMessageSlots);
|
|
53 |
// We are not allowed to start the server
|
|
54 |
if ((KErrNotFound == ret) || (KErrServerTerminated == ret))
|
|
55 |
{
|
29
|
56 |
OstTrace1( TRACE_NORMAL, RHOSTMASSSTORAGE_CONNECT,
|
|
57 |
"Underlying error value = %d", ret );
|
25
|
58 |
return KErrNotReady;
|
|
59 |
}
|
|
60 |
if ( KErrNone == ret )
|
|
61 |
{
|
|
62 |
break;
|
|
63 |
}
|
|
64 |
if ((--retry) == 0)
|
|
65 |
{
|
|
66 |
break;
|
|
67 |
}
|
|
68 |
}
|
29
|
69 |
OstTraceFunctionExit0( RHOSTMASSSTORAGE_CONNECT_EXIT );
|
25
|
70 |
return ret;
|
|
71 |
}
|
|
72 |
|
|
73 |
EXPORT_C TInt RHostMassStorage::Disconnect()
|
|
74 |
{
|
29
|
75 |
OstTraceFunctionEntry0( RHOSTMASSSTORAGE_DISCONNECT_ENTRY );
|
25
|
76 |
|
|
77 |
Close();
|
29
|
78 |
OstTraceFunctionExit0( RHOSTMASSSTORAGE_DISCONNECT_EXIT );
|
25
|
79 |
return KErrNone;
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Called to validate the version of the server we require for this API
|
|
84 |
* @return TVersion The version of MSMM Server that supports this API
|
|
85 |
*/
|
|
86 |
EXPORT_C TVersion RHostMassStorage::Version() const
|
|
87 |
{
|
29
|
88 |
OstTraceFunctionEntry0( RHOSTMASSSTORAGE_VERSION_ENTRY );
|
25
|
89 |
|
|
90 |
return TVersion(KMsmmServMajorVersionNumber,
|
|
91 |
KMsmmServMinorVersionNumber,
|
|
92 |
KMsmmServBuildVersionNumber);
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status
|
|
97 |
* The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase
|
|
98 |
* @return Error code of IPC.
|
|
99 |
*/
|
|
100 |
|
|
101 |
EXPORT_C TInt RHostMassStorage::EjectUsbDrives()
|
|
102 |
{
|
29
|
103 |
OstTraceFunctionEntry0( RHOSTMASSSTORAGE_EJECTUSBDRIVES_ENTRY );
|
25
|
104 |
|
|
105 |
TInt ret(KErrNone);
|
|
106 |
|
|
107 |
TIpcArgs usbmsIpcArgs;
|
|
108 |
|
|
109 |
ret = Send(EHostMsmmServerEjectUsbDrives, usbmsIpcArgs);
|
|
110 |
|
29
|
111 |
OstTraceFunctionExit0( RHOSTMASSSTORAGE_EJECTUSBDRIVES_EXIT );
|
25
|
112 |
return ret;
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
// End of file
|