Ejemplo n.º 1
0
        public static ModePage_0D?DecodeModePage_0D(byte[] pageResponse)
        {
            if ((pageResponse?[0] &0x40) == 0x40)
            {
                return(null);
            }

            if ((pageResponse?[0] &0x3F) != 0x0D)
            {
                return(null);
            }

            if (pageResponse[1] + 2 != pageResponse.Length)
            {
                return(null);
            }

            if (pageResponse.Length < 8)
            {
                return(null);
            }

            var decoded = new ModePage_0D();

            decoded.PS |= (pageResponse[0] & 0x80) == 0x80;
            decoded.InactivityTimerMultiplier = (byte)(pageResponse[3] & 0xF);
            decoded.SecondsPerMinute          = (ushort)((pageResponse[4] << 8) + pageResponse[5]);
            decoded.FramesPerSecond           = (ushort)((pageResponse[6] << 8) + pageResponse[7]);

            return(decoded);
        }
Ejemplo n.º 2
0
        public static string PrettifyModePage_0D(ModePage_0D?modePage)
        {
            if (!modePage.HasValue)
            {
                return(null);
            }

            ModePage_0D page = modePage.Value;
            var         sb   = new StringBuilder();

            sb.AppendLine("SCSI CD-ROM parameters page:");

            if (page.PS)
            {
                sb.AppendLine("\tParameters can be saved");
            }

            switch (page.InactivityTimerMultiplier)
            {
            case 0:
                sb.AppendLine("\tDrive will remain in track hold state a vendor-specified time after a seek or read");

                break;

            case 1:
                sb.AppendLine("\tDrive will remain in track hold state 125 ms after a seek or read");

                break;

            case 2:
                sb.AppendLine("\tDrive will remain in track hold state 250 ms after a seek or read");

                break;

            case 3:
                sb.AppendLine("\tDrive will remain in track hold state 500 ms after a seek or read");

                break;

            case 4:
                sb.AppendLine("\tDrive will remain in track hold state 1 second after a seek or read");

                break;

            case 5:
                sb.AppendLine("\tDrive will remain in track hold state 2 seconds after a seek or read");

                break;

            case 6:
                sb.AppendLine("\tDrive will remain in track hold state 4 seconds after a seek or read");

                break;

            case 7:
                sb.AppendLine("\tDrive will remain in track hold state 8 seconds after a seek or read");

                break;

            case 8:
                sb.AppendLine("\tDrive will remain in track hold state 16 seconds after a seek or read");

                break;

            case 9:
                sb.AppendLine("\tDrive will remain in track hold state 32 seconds after a seek or read");

                break;

            case 10:
                sb.AppendLine("\tDrive will remain in track hold state 1 minute after a seek or read");

                break;

            case 11:
                sb.AppendLine("\tDrive will remain in track hold state 2 minutes after a seek or read");

                break;

            case 12:
                sb.AppendLine("\tDrive will remain in track hold state 4 minutes after a seek or read");

                break;

            case 13:
                sb.AppendLine("\tDrive will remain in track hold state 8 minutes after a seek or read");

                break;

            case 14:
                sb.AppendLine("\tDrive will remain in track hold state 16 minutes after a seek or read");

                break;

            case 15:
                sb.AppendLine("\tDrive will remain in track hold state 32 minutes after a seek or read");

                break;
            }

            if (page.SecondsPerMinute > 0)
            {
                sb.AppendFormat("\tEach minute has {0} seconds", page.SecondsPerMinute).AppendLine();
            }

            if (page.FramesPerSecond > 0)
            {
                sb.AppendFormat("\tEach second has {0} frames", page.FramesPerSecond).AppendLine();
            }

            return(sb.ToString());
        }