Move the device routines which don't refer to an object private info

(e.g. closign a tray) out of the Device class.
This commit is contained in:
rocky
2006-01-25 07:21:52 +00:00
parent 9011bba7ef
commit 3f39a667b2
6 changed files with 244 additions and 331 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: device.cpp,v 1.2 2005/11/11 12:26:57 rocky Exp $
$Id: device.cpp,v 1.3 2006/01/25 07:21:52 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -105,7 +105,7 @@ main(int argc, const char *argv[])
CdioDevice device;
if (device.open(NULL)) {
char *default_device = device.getDefaultDevice();
char *default_device = device.getDevice();
cdio_drive_read_cap_t i_read_cap;
cdio_drive_write_cap_t i_write_cap;
cdio_drive_misc_cap_t i_misc_cap;

View File

@@ -1,5 +1,5 @@
/*
$Id: drives.cpp,v 1.1 2006/01/25 06:30:22 rocky Exp $
$Id: drives.cpp,v 1.2 2006/01/25 07:21:52 rocky Exp $
Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@panix.com>
@@ -57,7 +57,7 @@ main(int argc, const char *argv[])
/* Print out a list of CD-drives */
printf("All CD-ROM/DVD drives...\n");
ppsz_cd_drives = getDevices(DRIVER_DEVICE);
ppsz_cd_drives = getDevices();
if (NULL != ppsz_cd_drives)
for( c = ppsz_cd_drives; *c != NULL; c++ ) {
printf("Drive %s\n", *c);

View File

@@ -1,5 +1,5 @@
/*
$Id: eject.cpp,v 1.5 2006/01/18 20:58:53 rocky Exp $
$Id: eject.cpp,v 1.6 2006/01/25 07:21:52 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -51,30 +51,30 @@ main(int argc, const char *argv[])
psz_drive = strdup(argv[1]);
if (!psz_drive) {
psz_drive = device.getDefaultDevice(driver_id);
psz_drive = getDefaultDevice(driver_id);
if (!psz_drive) {
printf("Can't find a CD-ROM to perform eject operation\n");
exit(1);
}
}
try {
device.ejectMedia(psz_drive);
ejectMedia(psz_drive);
printf("CD in CD-ROM drive %s ejected.\n", psz_drive);
}
catch ( CdioDevice::DriverOpUninit e ) {
catch ( DriverOpUninit e ) {
printf("Can't Eject CD from CD-ROM drive: driver is not initialized.\n",
psz_drive);
}
catch ( CdioDevice::DriverOpException e ) {
catch ( DriverOpException e ) {
printf("Ejecting CD from CD-ROM drive %s operation error:\n\t%s.\n",
psz_drive, e.get_msg());
}
try {
device.closeTray(psz_drive);
closeTray(psz_drive);
printf("Closed CD-ROM %s tray.\n", psz_drive);
}
catch ( CdioDevice::DriverOpException e ) {
catch ( DriverOpException e ) {
printf("Closing CD-ROM %s tray operation error error:\n\t%s.\n",
psz_drive, e.get_msg());
}