//
// BwgBurn - CD-R/CD-RW/DVD-R/DVD-RW burning program for DotNet
//
// Copyright (C) 2006 by Jack W. Griffin (butchg@comcast.net)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the
//
// Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Bwg.Scsi
{
///
/// This class represents the ATIP information read from the disk
///
public class AtipInfo : Result
{
///
/// The target write power for the disk
///
public readonly byte IndicativeTargetWritingPower;
///
///
///
public readonly byte ReferenceSpeed;
///
/// If true, this is a double density CD
///
public readonly bool IsDDCD;
///
/// If true, this disk is for unrestricted use
///
public readonly bool UnrestrictedUse;
///
/// If true, the media is CDRW, otherwise it is CDR
///
public readonly bool MediaCDRW;
///
/// The CD/RW media subtype
///
public readonly byte MediaSubtype;
///
///
///
public readonly bool A1Valid;
///
///
///
public readonly bool A2Valid;
///
///
///
public readonly bool A3Valid;
///
/// The ATIP value for the starting leadin time
///
public readonly MinuteSecondFrame StartTimeOfLeadin;
///
/// This is the address for the last possible leadout
///
public readonly MinuteSecondFrame LastPossibleStartOfLeadout;
///
/// The data from the A1 field
///
public readonly byte[] A1Values;
///
/// The data from the A1 field
///
public readonly byte[] A2Values;
///
/// The data from the A3 field
///
public readonly byte[] A3Values;
///
/// This constructs the ATIP infomation
///
///
///
public AtipInfo(IntPtr buffer, int size) : base(buffer, size)
{
byte b;
if (size < 4)
return;
b = Get8(4);
IndicativeTargetWritingPower = (byte)((b >> 4) & 0x0f);
IsDDCD = GetBit(4, 3);
ReferenceSpeed = (byte)(b & 0x07);
b = Get8(5);
UnrestrictedUse = GetBit(5, 6);
b = Get8(6);
MediaCDRW = GetBit(6, 6);
MediaSubtype = (byte)((b >> 3) & 0x07);
A1Valid = GetBit(6, 2);
A2Valid = GetBit(6, 1);
A3Valid = GetBit(6, 0);
StartTimeOfLeadin = new MinuteSecondFrame(Get8(8), Get8(9), Get8(10));
LastPossibleStartOfLeadout = new MinuteSecondFrame(Get8(12), Get8(13), Get8(14));
A1Values = new byte[3];
for (int i = 0; i < 3; i++)
A1Values[i] = Get8(i + 16);
A2Values = new byte[3];
for (int i = 0; i < 3; i++)
A2Values[i] = Get8(i + 20);
A3Values = new byte[3];
for (int i = 0; i < 3; i++)
A3Values[i] = Get8(i + 24);
}
}
}