OSDL::CDROMDrive Class Reference

A CD-ROM drive allows to control a particular CD-ROM device attached to the system. More...

#include <OSDLCDROMDrive.h>

List of all members.

Public Types

enum  Status {
  TrayEmpty, Stopped, Playing, Paused,
  InError
}
 

Describes the status possibilites of a CD drive.

More...

Public Member Functions

virtual void open ()
 Opens for access this CD-ROM drive, so that the CD that must be in it can be directly read afterwards, a bit like 'mounting' this device.
virtual void close ()
 Closes this CD-ROM drive, a bit like 'unmounting' this device.
virtual void eject () const
 Ejects the CD-ROM which is in the drive.
virtual Status getStatus ()
 Returns the current status of this drive.
virtual Status getConstStatus () const
 Returns the current status of this drive.
virtual bool isCDInDrive ()
 Tells whether there is a CD in drive.
virtual TrackNumber getTracksCount () const
 Returns the number of tracks in the CD in this drive.
virtual FrameCount getTrackDuration (TrackNumber targetTrack) const
 Returns the duration, in frames, of the specified track.
virtual CDTrackgetTrack (TrackNumber targetTrack) const
 Returns the CD track of specified number.
virtual void playFrames (FrameCount startingFrame, FrameCount durationInFrames)
 Plays the CD-ROM in drive, starting from specified CD frame, for specified duration.
virtual void playTracks (TrackNumber startingTrack, TrackNumber numberOfTracks, FrameCount startingFrameOffset=0, FrameCount stoppingFrameOffset=0)
 Plays the CD-ROM in drive, starting from specified CD track, for specified number of tracks.
virtual void pause () const
 Pauses play on this CD-ROM.
virtual void resume () const
 Resumes play on this CD-ROM.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this drive.

Static Public Member Functions

static std::list< std::string > GetListOfInsertedMedia ()
 Returns a list of inserted disc media, such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs.
static FrameCount ConvertTimeToFrameCount (Ceylan::System::Second duration)
 Returns the number of CD frames corresponding to the specified time.
static Ceylan::System::Second ConvertFrameCountToTime (FrameCount duration)
 Returns the duration in seconds corresponding to the specified number of CD frames.

Static Public Attributes

static const FrameCount FramesPerSecond = 75
 Tells how many CD frames make one second.

Protected Attributes

CDROMDriveNumber _driveNumber
 Records the number associated with this drive object.

Private Member Functions

 CDROMDrive (CDROMDriveNumber driveNumber)
 A CD-ROM drive object (CDROMDrive) will be associated uniquely to a CD-ROM device.
virtual ~CDROMDrive () throw ()
 Virtual destructor.
 CDROMDrive (const CDROMDrive &source)
 Copy constructor made private to ensure that it will be never called.
CDROMDriveoperator= (const CDROMDrive &source)
 Assignment operator made private to ensure that it will be never called.

Private Attributes

bool _statusUpdated
 Telles whether track information about the CD is available.
LowLevelCDROM_driveStatus
 Gathers some informations about this drive and its status.

Friends

class CDROMDriveHandler

Detailed Description

A CD-ROM drive allows to control a particular CD-ROM device attached to the system.

Definition at line 213 of file OSDLCDROMDrive.h.


Member Enumeration Documentation

Describes the status possibilites of a CD drive.

Enumerator:
TrayEmpty 
Stopped 
Playing 
Paused 
InError 

Definition at line 232 of file OSDLCDROMDrive.h.


Constructor & Destructor Documentation

CDROMDrive::CDROMDrive ( CDROMDriveNumber  driveNumber  )  [explicit, private]

A CD-ROM drive object (CDROMDrive) will be associated uniquely to a CD-ROM device.

This constructor is private so that the factory gets total control onto drive instance creations.

Parameters:
driveNumber the drive number to take control of.
Exceptions:
CDROMDriveException if specified drive number is not in licit range.

Definition at line 265 of file OSDLCDROMDrive.cc.

CDROMDrive::~CDROMDrive (  )  throw () [private, virtual]

Virtual destructor.

Definition at line 283 of file OSDLCDROMDrive.cc.

References _driveStatus, and close().

OSDL::CDROMDrive::CDROMDrive ( const CDROMDrive source  )  [explicit, private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void CDROMDrive::close (  )  [virtual]

Closes this CD-ROM drive, a bit like 'unmounting' this device.

Note:
This has nothing to do with the drive tray.
Exceptions:
CDROMDriveException if the drive could not be opened, for example if it is busy and not opened.

Definition at line 314 of file OSDLCDROMDrive.cc.

References _driveStatus.

Referenced by ~CDROMDrive().

Ceylan::System::Second CDROMDrive::ConvertFrameCountToTime ( FrameCount  duration  )  [static]

Returns the duration in seconds corresponding to the specified number of CD frames.

Parameters:
duration the duration in seconds to convert into CD frames.
The returned number of second is rounded.

Definition at line 706 of file OSDLCDROMDrive.cc.

References FramesPerSecond.

Referenced by OSDL::CDTrack::toString().

FrameCount CDROMDrive::ConvertTimeToFrameCount ( Ceylan::System::Second  duration  )  [static]

Returns the number of CD frames corresponding to the specified time.

Parameters:
duration the duration in seconds to convert into CD frames.

Definition at line 696 of file OSDLCDROMDrive.cc.

References FramesPerSecond.

void CDROMDrive::eject (  )  const [virtual]

Ejects the CD-ROM which is in the drive.

The drive must be already opened.

Exceptions:
CDROMDriveException if an error occured, for example if drive was not open.

Definition at line 334 of file OSDLCDROMDrive.cc.

References _driveStatus, and OSDL::Utils::getBackendLastError().

CDROMDrive::Status CDROMDrive::getConstStatus (  )  const [virtual]

Returns the current status of this drive.

Exceptions:
CDROMDriveException if drive not already open.
Note:
Cannot update the status flag.

Definition at line 365 of file OSDLCDROMDrive.cc.

References _driveStatus, InError, Paused, Playing, Stopped, and TrayEmpty.

Referenced by getStatus(), and toString().

std::list< std::string > CDROMDrive::GetListOfInsertedMedia (  )  [static]

Returns a list of inserted disc media, such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs.

Exceptions:
CDROMDriveException if the operation failed.
Note:
Only filesystems are searched for, thus for example an audio CD will not be returned, unless there is a mounted filesystem track on it.

Definition at line 666 of file OSDLCDROMDrive.cc.

References OSDL::EmbeddedFileSystemManager::SecureEmbeddedFileSystemManager().

CDROMDrive::Status CDROMDrive::getStatus (  )  [virtual]

Returns the current status of this drive.

Exceptions:
CDROMDriveException if drive not already open.

This method cannot be 'const' since status update flag has to be updated.

Definition at line 352 of file OSDLCDROMDrive.cc.

References _statusUpdated, and getConstStatus().

Referenced by isCDInDrive(), and playTracks().

CDTrack & CDROMDrive::getTrack ( TrackNumber  targetTrack  )  const [virtual]

Returns the CD track of specified number.

Parameters:
targetTrack the track to return.
Note:
The caller must deallocate the returned track when finished with it.
Exceptions:
CDROMDriveException if the operation failed.

Definition at line 470 of file OSDLCDROMDrive.cc.

References _driveStatus, getTracksCount(), and OSDL::Video::Pixels::toString().

FrameCount CDROMDrive::getTrackDuration ( TrackNumber  targetTrack  )  const [virtual]

Returns the duration, in frames, of the specified track.

Parameters:
targetTrack the track whose duration is to be known.
Exceptions:
CDROMDriveException if an error occured, for example if an invalid track number is given.

Definition at line 447 of file OSDLCDROMDrive.cc.

References _driveStatus, getTracksCount(), and OSDL::Video::Pixels::toString().

TrackNumber CDROMDrive::getTracksCount (  )  const [virtual]

Returns the number of tracks in the CD in this drive.

Exceptions:
CDROMDriveException if an error occured, for example if the drive is not already opened.

Definition at line 426 of file OSDLCDROMDrive.cc.

References _driveStatus.

Referenced by getTrack(), getTrackDuration(), and toString().

bool CDROMDrive::isCDInDrive (  )  [virtual]

Tells whether there is a CD in drive.

Returns:
true iff there is a CD in drive.
Exceptions:
CDROMDriveException if drive not already open.

Cannot be 'const' since 'getStatus' neither.

Definition at line 415 of file OSDLCDROMDrive.cc.

References getStatus(), InError, and TrayEmpty.

void CDROMDrive::open (  )  [virtual]

Opens for access this CD-ROM drive, so that the CD that must be in it can be directly read afterwards, a bit like 'mounting' this device.

Note:
This has nothing to do with opening the drive tray.
Exceptions:
CDROMDriveException if the drive could not be opened, for example if it is busy, or with no disc, or already opened.

Definition at line 293 of file OSDLCDROMDrive.cc.

References _driveNumber, _driveStatus, and OSDL::Utils::getBackendLastError().

CDROMDrive& OSDL::CDROMDrive::operator= ( const CDROMDrive source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void CDROMDrive::pause (  )  const [virtual]

Pauses play on this CD-ROM.

Exceptions:
CDROMDriveException if an error occured.

Definition at line 538 of file OSDLCDROMDrive.cc.

References _driveStatus, and OSDL::Utils::getBackendLastError().

void CDROMDrive::playFrames ( FrameCount  startingFrame,
FrameCount  durationInFrames 
) [virtual]

Plays the CD-ROM in drive, starting from specified CD frame, for specified duration.

Parameters:
startingFrame the frame to start.
durationInFrames the duration, specified in frames.
Exceptions:
CDROMDriveException if an error occured.

Definition at line 494 of file OSDLCDROMDrive.cc.

References _driveStatus, and OSDL::Utils::getBackendLastError().

void CDROMDrive::playTracks ( TrackNumber  startingTrack,
TrackNumber  numberOfTracks,
FrameCount  startingFrameOffset = 0,
FrameCount  stoppingFrameOffset = 0 
) [virtual]

Plays the CD-ROM in drive, starting from specified CD track, for specified number of tracks.

Frame offsets can be used to start after the beginning of the starting track and to stop after the stopping track.

Note:
Data tracks are ignored.
Parameters:
startingTrack the track to start with.
numberOfTracks the number of tracks to play from 'startingTrack'.
startingFrameOffset the frame offset, from the beginning of 'startingTrack', at which to start.
stoppingFrameOffset the frame offset, from the beginning of the last track (startingTrack+numberOfTracks), at which to end playing.
Exceptions:
CDROMDriveException if an error occured.

Definition at line 514 of file OSDLCDROMDrive.cc.

References _driveStatus, _statusUpdated, OSDL::Utils::getBackendLastError(), and getStatus().

void CDROMDrive::resume (  )  const [virtual]

Resumes play on this CD-ROM.

Exceptions:
CDROMDriveException if an error occured.

Definition at line 557 of file OSDLCDROMDrive.cc.

References _driveStatus, and OSDL::Utils::getBackendLastError().

const string CDROMDrive::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this drive.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 576 of file OSDLCDROMDrive.cc.

References _driveNumber, _driveStatus, generate_master_palette::count, getConstStatus(), getTracksCount(), InError, Paused, Playing, Stopped, OSDL::CDTrack::toString(), OSDL::Video::Pixels::toString(), and TrayEmpty.


Friends And Related Function Documentation

friend class CDROMDriveHandler [friend]

Definition at line 218 of file OSDLCDROMDrive.h.


Member Data Documentation

Records the number associated with this drive object.

Definition at line 491 of file OSDLCDROMDrive.h.

Referenced by open(), and toString().

Gathers some informations about this drive and its status.

Tells too whether the drive is open for access (if non-null) or not (if null).

Definition at line 512 of file OSDLCDROMDrive.h.

Referenced by close(), eject(), getConstStatus(), getTrack(), getTrackDuration(), getTracksCount(), open(), pause(), playFrames(), playTracks(), resume(), toString(), and ~CDROMDrive().

Telles whether track information about the CD is available.

Definition at line 501 of file OSDLCDROMDrive.h.

Referenced by getStatus(), and playTracks().

Tells how many CD frames make one second.

Definition at line 227 of file OSDLCDROMDrive.h.

Referenced by ConvertFrameCountToTime(), and ConvertTimeToFrameCount().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:05:26 2010 for OSDL by  doxygen 1.6.3