sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Shared client/server definitions
|
sl@0
|
15 |
//
|
sl@0
|
16 |
// WARNING: This file contains some APIs which are internal and are subject
|
sl@0
|
17 |
// to change without notice. Such APIs should therefore not be used
|
sl@0
|
18 |
// outside the Kernel and Hardware Services package.
|
sl@0
|
19 |
//
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
@internalAll
|
sl@0
|
24 |
@released
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef __USBMSSHARED_H__
|
sl@0
|
28 |
#define __USBMSSHARED_H__
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <e32std.h>
|
sl@0
|
31 |
#include <f32file.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
|
sl@0
|
34 |
const TInt KUsbMsSrvMajorVersionNumber = 1;
|
sl@0
|
35 |
const TInt KUsbMsSrvMinorVersionNumber = 0;
|
sl@0
|
36 |
const TInt KUsbMsSrvBuildVersionNumber = 0;
|
sl@0
|
37 |
|
sl@0
|
38 |
const TInt KUsbMsResourceVersion = 0;
|
sl@0
|
39 |
|
sl@0
|
40 |
_LIT(KUsbMsServerName, "usbmsserver");
|
sl@0
|
41 |
|
sl@0
|
42 |
class TMassStorageConfig
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
TBuf<8> iVendorId;
|
sl@0
|
46 |
TBuf<16> iProductId;
|
sl@0
|
47 |
TBuf<4> iProductRev;
|
sl@0
|
48 |
};
|
sl@0
|
49 |
|
sl@0
|
50 |
/** Types of requests USB mass storage class controller can make */
|
sl@0
|
51 |
enum TUsbMsReqType
|
sl@0
|
52 |
{
|
sl@0
|
53 |
EUsbMsStart,
|
sl@0
|
54 |
EUsbMsStop,
|
sl@0
|
55 |
EUsbMsShutdown,
|
sl@0
|
56 |
};
|
sl@0
|
57 |
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
@publishedPartner
|
sl@0
|
60 |
@released
|
sl@0
|
61 |
|
sl@0
|
62 |
The USB Class Controller identifier.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
const TUid KUsbMsClassControllerUID={0x10204BBC};
|
sl@0
|
65 |
|
sl@0
|
66 |
/**
|
sl@0
|
67 |
@publishedPartner
|
sl@0
|
68 |
@released
|
sl@0
|
69 |
|
sl@0
|
70 |
The Publish & Subscribe Category for all USB Mass Storage events.
|
sl@0
|
71 |
*/
|
sl@0
|
72 |
const TUid KUsbMsDriveState_Category={KFileServerUidValue};
|
sl@0
|
73 |
|
sl@0
|
74 |
/**
|
sl@0
|
75 |
@publishedPartner
|
sl@0
|
76 |
@released
|
sl@0
|
77 |
|
sl@0
|
78 |
The Publish & Subscribe event subkey enumeration.
|
sl@0
|
79 |
*/
|
sl@0
|
80 |
enum TUsbMsDriveState_Subkey
|
sl@0
|
81 |
{
|
sl@0
|
82 |
EUsbMsDriveState_DriveStatus,
|
sl@0
|
83 |
EUsbMsDriveState_KBytesRead,
|
sl@0
|
84 |
EUsbMsDriveState_KBytesWritten,
|
sl@0
|
85 |
EUsbMsDriveState_MediaError
|
sl@0
|
86 |
};
|
sl@0
|
87 |
|
sl@0
|
88 |
/**
|
sl@0
|
89 |
@publishedPartner
|
sl@0
|
90 |
@released
|
sl@0
|
91 |
|
sl@0
|
92 |
Possible values for each of EUsbMsDriveState_DriveStatus status codes.
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
enum EUsbMsDriveStates
|
sl@0
|
95 |
{
|
sl@0
|
96 |
/** File system not available for Mass Storage */
|
sl@0
|
97 |
EUsbMsDriveState_Disconnected =0x0,
|
sl@0
|
98 |
/** Host has required connection */
|
sl@0
|
99 |
EUsbMsDriveState_Connecting =0x1,
|
sl@0
|
100 |
/** File system available to Mass Storage */
|
sl@0
|
101 |
EUsbMsDriveState_Connected =0x2,
|
sl@0
|
102 |
/** Disconnecting from Mass Storage */
|
sl@0
|
103 |
EUsbMsDriveState_Disconnecting =0x3,
|
sl@0
|
104 |
/** Critical write - do not remove card */
|
sl@0
|
105 |
EUsbMsDriveState_Active =0x4,
|
sl@0
|
106 |
/** Connected, but locked with a password */
|
sl@0
|
107 |
EUsbMsDriveState_Locked =0x5,
|
sl@0
|
108 |
/** Connected, but card not present */
|
sl@0
|
109 |
EUsbMsDriveState_MediaNotPresent=0x6,
|
sl@0
|
110 |
/** Card removed while active */
|
sl@0
|
111 |
EUsbMsDriveState_Removed =0x7,
|
sl@0
|
112 |
/** General error */
|
sl@0
|
113 |
EUsbMsDriveState_Error =0x8
|
sl@0
|
114 |
};
|
sl@0
|
115 |
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
@publishedPartner
|
sl@0
|
118 |
@released
|
sl@0
|
119 |
|
sl@0
|
120 |
The maximum number of removable drives supported by Mass Storage.
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
const TUint KUsbMsMaxDrives=8;
|
sl@0
|
123 |
|
sl@0
|
124 |
/**
|
sl@0
|
125 |
@publishedPartner
|
sl@0
|
126 |
@released
|
sl@0
|
127 |
|
sl@0
|
128 |
A buffer to receive the EUsbMsDriveState_DriveStatus property.
|
sl@0
|
129 |
For each drive there is a pair of bytes; the drive number
|
sl@0
|
130 |
followed by the EUsbMsDriveStates status code.
|
sl@0
|
131 |
*/
|
sl@0
|
132 |
typedef TBuf8<2*KUsbMsMaxDrives> TUsbMsDrivesStatus;
|
sl@0
|
133 |
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
@publishedPartner
|
sl@0
|
136 |
@released
|
sl@0
|
137 |
|
sl@0
|
138 |
A collection of integers, contained in a TBuf8 for compatibility
|
sl@0
|
139 |
with RProperty. Used for the EUsbMsDriveState_KBytesRead/Written
|
sl@0
|
140 |
events.
|
sl@0
|
141 |
*/
|
sl@0
|
142 |
class TUsbMsBytesTransferred : public TBuf8<KUsbMsMaxDrives*sizeof(TInt)>
|
sl@0
|
143 |
{
|
sl@0
|
144 |
public:
|
sl@0
|
145 |
inline TUsbMsBytesTransferred();
|
sl@0
|
146 |
inline TInt& operator[](TUint aLun);
|
sl@0
|
147 |
};
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
@publishedPartner
|
sl@0
|
150 |
@released */
|
sl@0
|
151 |
TUsbMsBytesTransferred::TUsbMsBytesTransferred()
|
sl@0
|
152 |
{
|
sl@0
|
153 |
SetLength(MaxLength());
|
sl@0
|
154 |
Fill(0);
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
/**
|
sl@0
|
158 |
@publishedPartner
|
sl@0
|
159 |
@released
|
sl@0
|
160 |
|
sl@0
|
161 |
Return one of the integers contained in this buffer.
|
sl@0
|
162 |
@return Bytes transferred count for the specified drive.
|
sl@0
|
163 |
@param aLun Drive index
|
sl@0
|
164 |
*/
|
sl@0
|
165 |
TInt& TUsbMsBytesTransferred::operator[](TUint aLun)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
__ASSERT_DEBUG(aLun < static_cast<TUint>(MaxLength()), User::Invariant());
|
sl@0
|
168 |
return *(reinterpret_cast<TInt*>(const_cast<TUint8*>(Ptr())) + aLun);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
#endif //__USBMSSHARED_H__
|