25
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
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"
|
|
28 |
|
|
29 |
#ifdef __FLOG_ACTIVE
|
|
30 |
_LIT8(KLogComponent, "UsbHostMsmmIndicatorClient");
|
|
31 |
#endif
|
|
32 |
|
|
33 |
// Costants
|
|
34 |
const TInt KConnectRetry = 0x2;
|
|
35 |
|
|
36 |
|
|
37 |
//---------------------------------------------------------------------------
|
|
38 |
// RHostMassStorage
|
|
39 |
//
|
|
40 |
// Public member functions
|
|
41 |
|
|
42 |
EXPORT_C TInt RHostMassStorage::Connect()
|
|
43 |
{
|
|
44 |
LOG_FUNC
|
|
45 |
|
|
46 |
TInt retry = KConnectRetry; // Attempt to add a session to MSMM Server twice
|
|
47 |
TInt ret(KErrNone);
|
|
48 |
FOREVER
|
|
49 |
{
|
|
50 |
ret = CreateSession(KMsmmServerName, Version(), KDefaultMessageSlots);
|
|
51 |
// We are not allowed to start the server
|
|
52 |
if ((KErrNotFound == ret) || (KErrServerTerminated == ret))
|
|
53 |
{
|
|
54 |
LOGTEXT2(_L("Underlying error value = %d"), ret)
|
|
55 |
return KErrNotReady;
|
|
56 |
}
|
|
57 |
if ( KErrNone == ret )
|
|
58 |
{
|
|
59 |
break;
|
|
60 |
}
|
|
61 |
if ((--retry) == 0)
|
|
62 |
{
|
|
63 |
break;
|
|
64 |
}
|
|
65 |
}
|
|
66 |
return ret;
|
|
67 |
}
|
|
68 |
|
|
69 |
EXPORT_C TInt RHostMassStorage::Disconnect()
|
|
70 |
{
|
|
71 |
LOG_FUNC
|
|
72 |
|
|
73 |
Close();
|
|
74 |
return KErrNone;
|
|
75 |
}
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Called to validate the version of the server we require for this API
|
|
79 |
* @return TVersion The version of MSMM Server that supports this API
|
|
80 |
*/
|
|
81 |
EXPORT_C TVersion RHostMassStorage::Version() const
|
|
82 |
{
|
|
83 |
LOG_FUNC
|
|
84 |
|
|
85 |
return TVersion(KMsmmServMajorVersionNumber,
|
|
86 |
KMsmmServMinorVersionNumber,
|
|
87 |
KMsmmServBuildVersionNumber);
|
|
88 |
}
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status
|
|
92 |
* The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase
|
|
93 |
* @return Error code of IPC.
|
|
94 |
*/
|
|
95 |
|
|
96 |
EXPORT_C TInt RHostMassStorage::EjectUsbDrives()
|
|
97 |
{
|
|
98 |
LOG_FUNC
|
|
99 |
|
|
100 |
TInt ret(KErrNone);
|
|
101 |
|
|
102 |
TIpcArgs usbmsIpcArgs;
|
|
103 |
|
|
104 |
ret = Send(EHostMsmmServerEjectUsbDrives, usbmsIpcArgs);
|
|
105 |
|
|
106 |
return ret;
|
|
107 |
}
|
|
108 |
|
|
109 |
|
|
110 |
// End of file
|