Coverage Report - org.jscsi.target.scsi.cdb.SelfTestCode
 
Classes in this File Line Coverage Branch Coverage Complexity
SelfTestCode
0%
0/15
0%
0/4
2
 
 1  
 package org.jscsi.target.scsi.cdb;
 2  
 
 3  
 /**
 4  
  * The SELF-TEST CODE field is a member of SEND DIAGNOSTIC CDBs.
 5  
  * <p>
 6  
  * A {@link SendDiagnosticCdb#selfTest} bit set to zero specifies that the device server shall perform the diagnostic
 7  
  * operation specified by the {@link SendDiagnosticCdb#selfTestCode} field.
 8  
  * <p>
 9  
  * The {@link SelfTestCode} field has a length of three bits.
 10  
  * 
 11  
  * @see SendDiagnosticCdb
 12  
  * @author Andreas Ergenzinger
 13  
  */
 14  0
 public enum SelfTestCode {
 15  
     /**
 16  
      * This value shall be used when the {@link SendDiagnosticCdb#selfTest} bit is set to one, or when the SELFTEST bit
 17  
      * is set to zero and the PF bit is set to one.
 18  
      */
 19  0
     ALL_ZEROS((byte) 0),
 20  
     /**
 21  
      * The device server shall start its short self-test in the background mode. The
 22  
      * {@link SendDiagnosticCdb#parameterListLength} field shall contain zero.
 23  
      */
 24  0
     BACKGROUND_SHORT_SELF_TEST((byte) 1),
 25  
     /**
 26  
      * The device server shall start its extended self-test (see 5.5.2) in the background mode (see 5.5.3.3). The
 27  
      * {@link SendDiagnosticCdb#parameterListLength} field shall contain zero.
 28  
      */
 29  0
     BACKGROUND_EXTENDED_SELF_TEST((byte) 2),
 30  
     /**
 31  
      * The device server shall abort the current self-test running in background mode. The
 32  
      * {@link SendDiagnosticCdb#parameterListLength} field shall contain zero. This value is only valid if a previous
 33  
      * SEND DIAGNOSTIC command specified a background self-test function and that self-test has not completed. If either
 34  
      * of these conditions is not met, the command shall be terminated with CHECK CONDITION status, with the sense key
 35  
      * set to ILLEGAL REQUEST, and the additional sense code set to INVALID FIELD IN CDB.
 36  
      */
 37  0
     ABORT_BACKGROUND_SELF_TEST((byte) 4),
 38  
     /**
 39  
      * The device server shall start its short self-test (see 5.5.2) in the foreground mode. The
 40  
      * {@link SendDiagnosticCdb#parameterListLength} field shall contain zero.
 41  
      */
 42  0
     FOREGROUND_SELF_TEST((byte) 5),
 43  
     /**
 44  
      * The device server shall start its extended self-test in the foreground mode. The
 45  
      * {@link SendDiagnosticCdb#parameterListLength} field shall contain zero.
 46  
      */
 47  0
     FOREGROUND_EXTENDED_SELF_TEST((byte) 6);
 48  
     // all other values (011b and 111b) are reserved
 49  
 
 50  
     /**
 51  
      * The serialized value of this object.
 52  
      */
 53  
     private final byte value;
 54  
 
 55  0
     private SelfTestCode (final byte value) {
 56  0
         this.value = value;
 57  0
     }
 58  
 
 59  
     public byte getValue () {
 60  0
         return value;
 61  
     }
 62  
 
 63  
     /**
 64  
      * Returns the {@link SelfTestCode} corresponding to the passed value.
 65  
      * 
 66  
      * @param value the value of a SELF-TEST CODE field
 67  
      * @return the {@link SelfTestCode} corresponding to the passed value or <code>null</code> if none exists
 68  
      */
 69  
     public static SelfTestCode getValue (int value) {
 70  0
         SelfTestCode[] values = values();
 71  0
         for (int i = 0; i < values.length; ++i)
 72  0
             if (value == values[i].getValue()) return values[i];
 73  0
         return null;
 74  
     }
 75  
 }