sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #include sl@0: #include "debug.h" sl@0: #include "msdebug.h" sl@0: sl@0: #include "msctypes.h" sl@0: #include "mtransport.h" sl@0: #include "mprotocol.h" sl@0: #include "tscsiclientreq.h" sl@0: #include "tscsiprimarycmds.h" sl@0: #include "tscsiblockcmds.h" sl@0: #include "tspcclientinterface.h" sl@0: sl@0: sl@0: /** sl@0: Constructor. sl@0: sl@0: @param aTransport Referance to the transport interface to be used to send the sl@0: SCSI SPC message sl@0: */ sl@0: TSpcClientInterface::TSpcClientInterface(MTransport& aTransport) sl@0: : iTransport(aTransport) sl@0: { sl@0: __MSFNLOG sl@0: } sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: TSpcClientInterface::~TSpcClientInterface() sl@0: { sl@0: __MSFNLOG sl@0: } sl@0: sl@0: /** sl@0: Create a SCSI INQUIRY command and send the command via the transport layer. The sl@0: function leaves if the device response is not compliant with the protocol sl@0: standard. sl@0: sl@0: @param aInfo The returned information by the peripheral device sl@0: sl@0: @return TInt KErrNone if successful otherwise KErrCommandFailed to indicate a sl@0: device status error sl@0: */ sl@0: TInt TSpcClientInterface::InquiryL(TPeripheralInfo& aInfo) sl@0: { sl@0: __MSFNLOG sl@0: TScsiClientInquiryReq inquiryReq; sl@0: sl@0: TScsiClientInquiryResp inquiryResp(aInfo); sl@0: sl@0: TInt err = iTransport.SendControlCmdL(&inquiryReq, &inquiryResp); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Create a SCSI REQUEST SENSE command and send the command via the transport sl@0: layer. The function leaves if the device response is not compliant with the sl@0: protocol standard. sl@0: sl@0: @param aSenseInfo The returned SENSE INFO sl@0: sl@0: @return TInt TInt KErrNone if successful otherwise KErrCommandFailed to indicate sl@0: a device status error sl@0: */ sl@0: TInt TSpcClientInterface::RequestSenseL(TSenseInfo& aSenseInfo) sl@0: { sl@0: __MSFNLOG sl@0: TScsiClientRequestSenseReq requestSenseReq; sl@0: TScsiClientRequestSenseResp requestSenseResp; sl@0: sl@0: TInt err = iTransport.SendControlCmdL(&requestSenseReq, &requestSenseResp); sl@0: aSenseInfo = requestSenseResp.iSenseInfo; sl@0: sl@0: __SCSIPRINT4(_L("SCSI SENSE INFO Response%08x Code=%08x, Qual=%08x Add=%08x"), sl@0: requestSenseResp.iResponseCode, sl@0: aSenseInfo.iSenseCode, aSenseInfo.iQualifier, aSenseInfo.iAdditional); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Create a SCSI TEST UNIT READY command and send the command via the transport sl@0: layer. The function leaves if the device response is not compliant with the sl@0: protocol standard. sl@0: sl@0: @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a sl@0: device status error sl@0: */ sl@0: TInt TSpcClientInterface::TestUnitReadyL() sl@0: { sl@0: __MSFNLOG sl@0: TScsiClientTestUnitReadyReq testUnitReadyReq; sl@0: sl@0: TInt err = iTransport.SendControlCmdL(&testUnitReadyReq); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Creates a SCSI PREVENT ALLOW MEDIUM REMOVAL command and sends the command via sl@0: the transport layer. The function leaves if the device response is not sl@0: compliant with the protocol standard. sl@0: sl@0: @param aPrevent Set the PREVENT flag sl@0: sl@0: @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a sl@0: device status error sl@0: */ sl@0: TInt TSpcClientInterface::PreventAllowMediumRemovalL(TBool aPrevent) sl@0: { sl@0: __MSFNLOG sl@0: TScsiClientPreventMediaRemovalReq preventAllowMediaRemovalReq(aPrevent); sl@0: TInt err = iTransport.SendControlCmdL(&preventAllowMediaRemovalReq); sl@0: return err; sl@0: } sl@0: sl@0: sl@0: