Mac Developer Library

Developer

DRDevice Class Reference

Options
Deployment Target:

On This Page
Language:

DRDevice

Represents a CD or DVD burner connected to the computer. More...

Inheritance


Conforms To


Import Statement


import DiscRecording @import DiscRecording;

Availability


Available in OS X v10.2 and later.
  • Attempts to acquire an exclusive access session with the device.

    Declaration

    Swift

    func acquireExclusiveAccess() -> Bool

    Objective-C

    - (BOOL)acquireExclusiveAccess

    Return Value

    Returns YES if the exclusinve access is acquired and NO if not.

    Discussion

    Acquiring exclusive access to the device prevents any process other than the one acquiring access from communicating with the device. So once exclusive access is granted, the device is unusable by any other process. Because of this all volumes mounted from media in the drive must be unmounted before exclusive access can be granted.

    Exclusive access can be acquired multiple times. Each time this method is called, a call to releaseExclusiveAccess > must be made at a later time, otherwise the process will never release its exclusive access.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Indicate an interest in the blank media reservation.

    Declaration

    Swift

    func acquireMediaReservation()

    Objective-C

    - (void)acquireMediaReservation

    Discussion

    Blank media participates in a reservation system that allows applications to express their claim on blank media to other applications. Indicating an interest in the reservation isn't enough to assume it's been acquired, as there are likely to be other applications in the system who have also indicated an interest in the blank media reservation. You will receive a DRDeviceStatusChangedNotification in DRDevice.h Reference with a value of TRUE for the DRDeviceMediaIsReservedKey in DRDevice.h Reference when the blank media reservation has been acquired.

    This function may be called multiple times. Each time it is called, a call to releaseMediaReservation must be made at a later time, otherwise the process will never fully rescind its interest in the blank media reservation.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Commands the device to close its tray.

    Declaration

    Swift

    func closeTray() -> Bool

    Objective-C

    - (BOOL)closeTray

    Return Value

    Returns YES if the tray could be closed and NO if not.

    Discussion

    Does nothing if the device does not have a tray (slotload).

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Commands the device to eject the media.

    Declaration

    Swift

    func ejectMedia() -> Bool

    Objective-C

    - (BOOL)ejectMedia

    Return Value

    Returns YES if the media could be ejected and NO if not.

    Discussion

    This command first unmounts any volumes associated with the media and then ejects the media from the drive. If the media could not be ejected, most likely this is because a volume associated with the media could not be unmounted.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Returns a dictionary of information describing the device.

    Declaration

    Swift

    func info() -> [NSObject : AnyObject]!

    Objective-C

    - (NSDictionary *)info

    Return Value

    An NSDictionary containing device information.

    Discussion

    The information returned include the types of media the device can write to, how it's connected and its identifying information such as the vendor and product name.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Compares the receiver to another device.

    Declaration

    Swift

    func isEqualToDevice(_ otherDevice: DRDevice!) -> Bool

    Objective-C

    - (BOOL)isEqualToDevice:(DRDevice *)otherDevice

    Parameters

    otherDevice

    Another DRDevice instance to compare to the receiver.

    Return Value

    Returns YES if the receiver is equal to otherDevice.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Returns whether or not the device represented by the receiver is still attached to the computer.

    Declaration

    Swift

    func isValid() -> Bool

    Objective-C

    - (BOOL)isValid

    Return Value

    Returns YES if device is valid and NO if not.

    Discussion

    Because of the way some physical interconnects work, a device which is unplugged and replugged in does not necessarily look like the same device to the computer and would be invalid in that instance.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Commands the device to open its tray.

    Declaration

    Swift

    func openTray() -> Bool

    Objective-C

    - (BOOL)openTray

    Return Value

    Returns YES if the tray could be opened and NO if not.

    Discussion

    Does nothing if the device does not have a tray (slotload). If there is media in the drive this method will do nothing and return false. In this case use ejectMedia to eject the media and open the tray.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Releases the latest exclusive access request for the device.

    Declaration

    Swift

    func releaseExclusiveAccess()

    Objective-C

    - (void)releaseExclusiveAccess

    Discussion

    A call to this method must be made for every call to acquireExclusiveAccess , otherwise the process will never release its exclusive access.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Releases any media reservation that might be in place for the device.

    Declaration

    Swift

    func releaseMediaReservation()

    Objective-C

    - (void)releaseMediaReservation

    Discussion

    If media is inserted and reserved, then the reservation will be passed on to the next process with a reservation request.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Returns a dictionary of information describing the media in the device.

    Declaration

    Swift

    func status() -> [NSObject : AnyObject]!

    Objective-C

    - (NSDictionary *)status

    Return Value

    An NSDictionary containing media information.

    Discussion

    In addition to information about the media (type, space available/used, etc), the dictionary returned includes those pieces of information about the device itself which are in part determined by the media (i.e., maximum burn speed).

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Obtains a DRDevice for the device corresponding to the bsd /dev node.

    Declaration

    Swift

    init!(forBSDName bsdName: String!) -> DRDevice

    Objective-C

    + (DRDevice *)deviceForBSDName:(NSString *)bsdName

    Parameters

    bsdName

    The bsd /dev node name.

    Return Value

    An autoreleased DRDevice object.

    Discussion

    If the device is not an authoring device (i.e., CDR, CDRW, DVR-R, etc), returns nil.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Obtains a DRDevice for the device at the path.

    Declaration

    Swift

    init!(forIORegistryEntryPath path: String!) -> DRDevice

    Objective-C

    + (DRDevice *)deviceForIORegistryEntryPath:(NSString *)path

    Parameters

    path

    The IORegistry path to the device you wish to obtain a DRDEvice for.

    Return Value

    An autoreleased DRDevice object.

    Discussion

    If the device is not an authoring device (i.e., CDR, CDRW, DVR-R, etc), returns nil.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.

  • Obtains a static list of devices connected to the computer.

    Declaration

    Swift

    class func devices() -> [AnyObject]!

    Objective-C

    + (NSArray *)devices

    Return Value

    An NSArray of DRDevices.

    Discussion

    Returns all CD/DVD devices connected to the computer at the time this method is called. Since devices can come and go at any time, the output of this method is simply a snapshot of the set of devices connected.

    Import Statement

    import DiscRecording

    Availability

    Available in OS X v10.2 and later.