os/kernelhwsrv/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiserverreq.cpp
Update contrib.
1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #include "tscsiserverreq.h"
25 #include "tscsiservercmds.h"
29 TScsiServerReq* TScsiServerReq::CreateL(TScsiServerReq::TOperationCode aOperationCode,
33 TScsiServerReq* req = NULL;
35 __SCSIPRINT1(_L("SCSI CMD 0x%x"), aOperationCode);
37 switch (aOperationCode)
41 req = new (ELeave) TScsiServerTestUnitReadyReq;
46 req = new (ELeave) TScsiServerRequestSenseReq;
51 req = new (ELeave) TScsiServerInquiryReq;
56 req = new (ELeave) TScsiServerModeSense6Req;
61 req = new (ELeave) TScsiServerStartStopUnitReq;
64 case EPreventMediaRemoval:
66 req = new (ELeave) TScsiServerPreventMediaRemovalReq;
69 case EReadFormatCapacities:
71 req = new (ELeave) TScsiServerReadFormatCapacitiesReq;
76 req = new (ELeave) TScsiServerReadCapacity10Req;
82 req = new (ELeave) TScsiServerRead10Req;
87 req = new (ELeave) TScsiServerWrite10Req;
92 __SCSIPRINT(_L("NOT SUPPORTED!"));
93 User::Leave(KErrNotSupported);
99 CleanupStack::PushL(req);
100 // got a class into which it can parse itself from the protocol
102 CleanupStack::Pop(req);
108 void TScsiServerReq::DecodeL(const TDesC8& aPtr)
112 iOperationCode = static_cast<TOperationCode>(aPtr[0]);
116 switch (GetGroupCode())
128 User::Leave(KErrNotSupported);
133 // CONTROL byte is last element of Command
134 TUint8 control = aPtr[length - 1];
136 iLink = control & 0x04 ? ETrue : EFalse;
137 iNaca = control & 0x01 ? ETrue : EFalse;