Coverage Report - org.jscsi.target.scsi.sense.senseDataDescriptor.senseKeySpecific.ProgressIndicationSenseKeySpecificData
 
Classes in this File Line Coverage Branch Coverage Complexity
ProgressIndicationSenseKeySpecificData
0%
0/5
N/A
1
 
 1  
 package org.jscsi.target.scsi.sense.senseDataDescriptor.senseKeySpecific;
 2  
 
 3  
 
 4  
 import java.nio.ByteBuffer;
 5  
 
 6  
 import org.jscsi.target.util.ReadWrite;
 7  
 
 8  
 
 9  
 /**
 10  
  * Progress indication sense-key-specific data is used to communicate the progress of a previously issued SCSI command
 11  
  * (e.g. <code>FORMAT UNIT</code>).
 12  
  * 
 13  
  * @author Andreas Ergenzinger
 14  
  */
 15  
 public final class ProgressIndicationSenseKeySpecificData extends SenseKeySpecificData {
 16  
 
 17  
     /**
 18  
      * The byte position of the PROGRESS INDICATION field.
 19  
      */
 20  
     private static final int PROGRESS_INDICATION_FIELD_INDEX = 1;
 21  
 
 22  
     /**
 23  
      * The PROGRESS INDICATION field is a percent complete indication in which the returned value is a numerator that
 24  
      * has 65 536 (10000h) as its denominator. The progress indication shall be based upon the total operation.
 25  
      * <p>
 26  
      * The progress indication should be time related, however this is not an absolute requirement. (E.g., since format
 27  
      * time varies with the number of defects encountered, etc., it is reasonable for the device server to assign values
 28  
      * to various steps within the process. The granularity of these steps should be small enough to provide reasonable
 29  
      * assurances to the application client that progress is being made.)
 30  
      */
 31  
     private final short progressIndication;
 32  
 
 33  
     /**
 34  
      * The consctructor.
 35  
      * 
 36  
      * @param senseKeySpecificDataValid <code>true</code> if and only if the <i>progressIndication</i> parameter is to
 37  
      *            be considered valid
 38  
      * @param progressIndication specifies the progress, the integer must lie in the interval [0, 65536]
 39  
      */
 40  
     public ProgressIndicationSenseKeySpecificData (final boolean senseKeySpecificDataValid, final int progressIndication) {
 41  0
         super(senseKeySpecificDataValid);
 42  0
         this.progressIndication = (short) progressIndication;
 43  0
     }
 44  
 
 45  
     @Override
 46  
     protected void serializeSpecificFields (ByteBuffer byteBuffer, int index) {
 47  
 
 48  0
         ReadWrite.writeTwoByteInt(byteBuffer, progressIndication, index + PROGRESS_INDICATION_FIELD_INDEX);
 49  0
     }
 50  
 }