userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp
equal
deleted
inserted
replaced
|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <e32base_private.h> |
|
23 #include "debug.h" |
|
24 #include "msdebug.h" |
|
25 #include "mprotocol.h" |
|
26 #include "tscsiclientreq.h" |
|
27 |
|
28 |
|
29 TInt TScsiClientReq::EncodeRequestL(TDes8& aBuffer) const |
|
30 { |
|
31 __MSFNSLOG |
|
32 TInt length = 0; |
|
33 switch (GetGroupCode()) |
|
34 { |
|
35 case 0: |
|
36 // 6 byte commands |
|
37 length = 6; |
|
38 break; |
|
39 case 1: |
|
40 case 2: |
|
41 // 10 byte commands |
|
42 length = 10; |
|
43 break; |
|
44 default: |
|
45 User::Leave(KErrNotSupported); |
|
46 break; |
|
47 } |
|
48 aBuffer.SetLength(length); |
|
49 aBuffer.FillZ(); |
|
50 |
|
51 // OPERATION CODE |
|
52 aBuffer[0] = iOperationCode; |
|
53 |
|
54 // CONTROL byte is last element of Command |
|
55 aBuffer[length - 1] = GetControlByte(); |
|
56 return length; |
|
57 } |
|
58 |