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