os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp
Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // scsiprimarycmds.cpp
29 #include "mtransport.h"
30 #include "mprotocol.h"
32 #include "tscsiclientreq.h"
33 #include "tscsiprimarycmds.h"
36 // **** TEST UNIT READY ****
37 TInt TScsiClientTestUnitReadyReq::EncodeRequestL(TDes8& aBuffer) const
40 __SCSIPRINT(_L("<-- SCSI TEST UNIT READY"));
41 TInt length = TScsiClientReq::EncodeRequestL(aBuffer);
46 // **** REQUEST SENSE ****
47 void TScsiClientRequestSenseResp::DecodeSenseInfo(const TDesC8& aPtr)
50 iResponseCode = static_cast<TResponseCode>(aPtr[0]);
51 iSenseInfo.iSenseCode = aPtr[02];
52 iSenseInfo.iAdditional = aPtr[12];
53 iSenseInfo.iQualifier = aPtr[13];
57 void TScsiClientRequestSenseResp::DecodeL(const TDesC8& aPtr)
60 __SCSIPRINT(_L("--> SCSI REQUEST SENSE"));
61 if (aPtr.Length() < KResponseLength)
64 // The data not transferred is assumed to be zero.
66 // Create full size buffer
67 TBuf8<KResponseLength> buffer;
69 // Copy data into buffer
71 // Fill remainder with 0's
72 buffer.AppendFill(0, KResponseLength - aPtr.Length());
74 DecodeSenseInfo(buffer);
78 DecodeSenseInfo(aPtr);
84 void TScsiClientInquiryResp::DecodeInquiry(const TDesC8& aPtr)
87 __SCSIPRINT(_L("--> SCSI INQUIRY"));
88 iPeripheralInfo.iRemovable = (aPtr[1] & 0x80) ? ETrue : EFalse;
90 iPeripheralInfo.iPeripheralQualifier = aPtr[0] >> 5;
91 iPeripheralInfo.iPeripheralDeviceType = aPtr[0] & 0x1F;
92 iPeripheralInfo.iVersion = aPtr[2];
93 iPeripheralInfo.iResponseDataFormat = aPtr[3] & 0x0F;
95 TPtrC8 vendorId(&aPtr[8], 8);
96 iPeripheralInfo.iIdentification.iVendorId.Copy(vendorId);
98 TPtrC8 productId(&aPtr[16], 16);
99 iPeripheralInfo.iIdentification.iProductId.Copy(productId);
101 TPtrC8 productRev(&aPtr[32], 4);
102 iPeripheralInfo.iIdentification.iProductRev.Copy(productRev);
106 void TScsiClientInquiryResp::DecodeL(const TDesC8& aPtr)
109 __SCSIPRINT(_L("--> SCSI INQUIRY"));
110 if (aPtr.Length() < KResponseLength)
112 // Handle short data.
113 // The data not transferred is assumed to be zero.
115 // Create zeroed buffer
116 TBuf8<KResponseLength> buffer;
117 buffer.FillZ(KResponseLength);
119 // Copy data into buffer
121 buffer.SetLength(KResponseLength);
123 DecodeInquiry(buffer);
132 // **** PREVENT MEDIA REMOVAL ****
133 TInt TScsiClientPreventMediaRemovalReq::EncodeRequestL(TDes8& aBuffer) const
136 __SCSIPRINT(_L("<-- SCSI PREVENT MEDIA REMOVAL"));
137 TInt length = TScsiClientReq::EncodeRequestL(aBuffer);