DRErase Class Reference

Inherits from
Conforms to
Availability
Available in OS X v10.2 and later.
Declared in
DRErase.h

Overview

A DRErase object handles the process of erasing a rewritable CD or DVD disc.

Each time you want to erase a disc, an instance of this class needs to be created.

When an instance is created, you pass in an instance of DRDevice to let the object know what device to erase. This object is retained for the life of the DRErase instance.

A DRErase object will send out notifications through the DRNotificationCenter mechanism to broadcast the erase state to any interested observers. However, if for some reason you don't want to use notifications, you can poll the erase object at any time for the current status using status . This is not recommended in any application using a run loop, because it involves polling.

Here's an example that shows you how to use this class:

- (void) doErase <br/> { <br/> DRDevice* device; <br/> DRErase* erase; <br/>

...determine correct device to erase... <br/>

erase = [[DRErase alloc] initWithDevice:device]; <br/>

// we'll do a quick erase. It's typically all that's needed. <br/> [erase setEraseType:DREraseTypeQuick]; <br/>

// register to receive notification about the erase status. <br/> [[DRNotificationCenter currentRunLoopCenter] addObserver:self <br/> selector:&#x40;selector(eraseNotification:) <br/> name:DREraseStatusChangedNotification <br/> object:erase]; <br/>

// start the erase <br/> [erase start]; <br/> }

- (void) eraseNotification:(NSNotification*)notification <br/> { <br/> DRErase* erase = [notification object]; <br/> NSDictionary* status = [notification userInfo]; <br/>

...do what you wish with the notification... <br/> }

Tasks

Miscellaneous

Class Methods

eraseForDevice:

Creates and returns an erase object.

+ (DRErase*) eraseForDevice:(DRDevice*)device;
Parameters
device

Device to use for the erase.

Return Value

An autoreleased DRErase object.

Discussion

An erase object created with this method is ready to erase media.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

Instance Methods

device

Returns the device being used for the erase.

- (DRDevice*) device;
Return Value

The DRDevice the erase will use.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

initWithDevice:

Initializes an erase object.

- (id) initWithDevice:(DRDevice*)device;
Parameters
device

Device to use for the erase.

Return Value

A DRErase object.

Discussion

An erase object created with this method is ready to erase media.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

properties

Returns the properties dictionary of the erase.

- (NSDictionary*) properties;
Return Value

An NSDictionary containing the properties of the erase.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

setProperties:

Sets the properties dictionary of the erase

- (void) setProperties:(NSDictionary*)properties;
Parameters
properties

NSDictionary of the properties to set.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

start

Begin the process of erasing media.

- (void) start;
Discussion

This method only kicks off the erase. Once the erasure starts, control returns to the caller. The caller can monitor the progress of the erase by listening for a notification or by polling status .

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h

status

Returns a dictionary containing the status of the erase.

- (NSDictionary*) status;
Return Value

An NSDictionary containing the status of the erase.

Discussion

The same dictionary is returned through the DREraseStatusChangedNotification notification.

Availability
  • Available in OS X v10.2 and later.
Declared In
DRErase.h