userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp
changeset 297 b2826f67641f
parent 33 0173bcd7697c
equal deleted inserted replaced
296:94f2adf59133 297:b2826f67641f
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17  @file
    17  @file
    18  @internalTechnology
    18  @internalTechnology
    19 */
    19 */
    20 
    20 
    21 #include <e32base.h>
    21 #include <e32base.h>
    22 #include "debug.h"
    22 
    23 #include "msdebug.h"
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "tspcclientinterfaceTraces.h"
       
    26 #endif
    24 
    27 
    25 #include "msctypes.h"
    28 #include "msctypes.h"
    26 #include "mtransport.h"
    29 #include "mtransport.h"
    27 #include "mprotocol.h"
    30 #include "mprotocol.h"
    28 #include "tscsiclientreq.h"
    31 #include "tscsiclientreq.h"
    38 SCSI SPC message
    41 SCSI SPC message
    39 */
    42 */
    40 TSpcClientInterface::TSpcClientInterface(MTransport& aTransport)
    43 TSpcClientInterface::TSpcClientInterface(MTransport& aTransport)
    41 :   iTransport(aTransport)
    44 :   iTransport(aTransport)
    42     {
    45     {
    43 	__MSFNLOG
       
    44     }
    46     }
    45 
    47 
    46 /**
    48 /**
    47 Destructor.
    49 Destructor.
    48 */
    50 */
    49 TSpcClientInterface::~TSpcClientInterface()
    51 TSpcClientInterface::~TSpcClientInterface()
    50     {
    52     {
    51 	__MSFNLOG
       
    52     }
    53     }
    53 
    54 
    54 /**
    55 /**
    55 Create a SCSI INQUIRY command and send the command via the transport layer. The
    56 Create a SCSI INQUIRY command and send the command via the transport layer. The
    56 function leaves if the device response is not compliant with the protocol
    57 function leaves if the device response is not compliant with the protocol
    61 @return TInt KErrNone if successful otherwise KErrCommandFailed to indicate a
    62 @return TInt KErrNone if successful otherwise KErrCommandFailed to indicate a
    62 device status error
    63 device status error
    63 */
    64 */
    64 TInt TSpcClientInterface::InquiryL(TPeripheralInfo& aInfo)
    65 TInt TSpcClientInterface::InquiryL(TPeripheralInfo& aInfo)
    65     {
    66     {
    66 	__MSFNLOG
       
    67     TScsiClientInquiryReq inquiryReq;
    67     TScsiClientInquiryReq inquiryReq;
    68 
    68 
    69     TScsiClientInquiryResp inquiryResp(aInfo);
    69     TScsiClientInquiryResp inquiryResp(aInfo);
    70 
    70 
    71     TInt err = iTransport.SendControlCmdL(&inquiryReq, &inquiryResp);
    71     TInt err = iTransport.SendControlCmdL(&inquiryReq, &inquiryResp);
    72 	return err;
    72     return err;
    73     }
    73     }
    74 
    74 
    75 
    75 
    76 /**
    76 /**
    77 Create a SCSI REQUEST SENSE command and send the command via the transport
    77 Create a SCSI REQUEST SENSE command and send the command via the transport
    83 @return TInt TInt KErrNone if successful otherwise KErrCommandFailed to indicate
    83 @return TInt TInt KErrNone if successful otherwise KErrCommandFailed to indicate
    84 a device status error
    84 a device status error
    85 */
    85 */
    86 TInt TSpcClientInterface::RequestSenseL(TSenseInfo& aSenseInfo)
    86 TInt TSpcClientInterface::RequestSenseL(TSenseInfo& aSenseInfo)
    87     {
    87     {
    88 	__MSFNLOG
       
    89     TScsiClientRequestSenseReq requestSenseReq;
    88     TScsiClientRequestSenseReq requestSenseReq;
    90     TScsiClientRequestSenseResp requestSenseResp;
    89     TScsiClientRequestSenseResp requestSenseResp;
    91 
    90 
    92     TInt err = iTransport.SendControlCmdL(&requestSenseReq, &requestSenseResp);
    91     TInt err = iTransport.SendControlCmdL(&requestSenseReq, &requestSenseResp);
    93     aSenseInfo = requestSenseResp.iSenseInfo;
    92     aSenseInfo = requestSenseResp.iSenseInfo;
    94 
    93 
    95     __SCSIPRINT4(_L("SCSI SENSE INFO Response%08x Code=%08x, Qual=%08x Add=%08x"),
    94     OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSPCCLIENTINTERFACE_10,
    96                  requestSenseResp.iResponseCode,
    95                  "SCSI SENSE INFO Response %x Code=%x",
    97                  aSenseInfo.iSenseCode, aSenseInfo.iQualifier, aSenseInfo.iAdditional);
    96                  (TUint32)requestSenseResp.iResponseCode, (TUint32)aSenseInfo.iSenseCode);
    98 	return err;
    97     OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSPCCLIENTINTERFACE_11,
       
    98                  "                Qual=%08x Add=%08x",
       
    99                  (TUint32)aSenseInfo.iQualifier, (TUint32)aSenseInfo.iAdditional);
       
   100     return err;
    99     }
   101     }
   100 
   102 
   101 
   103 
   102 /**
   104 /**
   103 Create a SCSI TEST UNIT READY command and send the command via the transport
   105 Create a SCSI TEST UNIT READY command and send the command via the transport
   107 @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a
   109 @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a
   108 device status error
   110 device status error
   109 */
   111 */
   110 TInt TSpcClientInterface::TestUnitReadyL()
   112 TInt TSpcClientInterface::TestUnitReadyL()
   111     {
   113     {
   112 	__MSFNLOG
       
   113     TScsiClientTestUnitReadyReq testUnitReadyReq;
   114     TScsiClientTestUnitReadyReq testUnitReadyReq;
   114 
   115 
   115     TInt err = iTransport.SendControlCmdL(&testUnitReadyReq);
   116     TInt err = iTransport.SendControlCmdL(&testUnitReadyReq);
   116 	return err;
   117     return err;
   117     }
   118     }
   118 
   119 
   119 
   120 
   120 /**
   121 /**
   121 Creates a SCSI PREVENT ALLOW MEDIUM REMOVAL command and sends the command via
   122 Creates a SCSI PREVENT ALLOW MEDIUM REMOVAL command and sends the command via
   127 @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a
   128 @return TInt KErrNone if successful or otherwise KErrCommandFailed to indicate a
   128 device status error
   129 device status error
   129 */
   130 */
   130 TInt TSpcClientInterface::PreventAllowMediumRemovalL(TBool aPrevent)
   131 TInt TSpcClientInterface::PreventAllowMediumRemovalL(TBool aPrevent)
   131     {
   132     {
   132 	__MSFNLOG
       
   133     TScsiClientPreventMediaRemovalReq preventAllowMediaRemovalReq(aPrevent);
   133     TScsiClientPreventMediaRemovalReq preventAllowMediaRemovalReq(aPrevent);
   134     TInt err = iTransport.SendControlCmdL(&preventAllowMediaRemovalReq);
   134     TInt err = iTransport.SendControlCmdL(&preventAllowMediaRemovalReq);
   135 	return err;
   135     return err;
   136     }
   136     }
   137 
   137 
   138 
   138 
   139 
   139