IMMRemovableMedia

The IMMRemovableMedia class provides all of the common behavior for all removable media devices. The main purpose of this class is to provide functions for devices that have physical media that is replaceable. Some examples of devices that might inherit from this are videoDiscs, CD players, cassette players, and VCRs. There are functions for loading or ejecting media, determining if media is present, and locking and unlocking a door on the device. Derived classes can use the virtual functions mediaLoaded and mediaUnloaded for determining if the user is changing the media.


IMMRemovableMedia - Member Functions and Data by Group

Constructors & Destructor

Derived classes can use these members to create objects of this class.


[view class]
~IMMRemovableMedia
public:
virtual ~IMMRemovableMedia()

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
IMMRemovableMedia


Overload 1
protected:
IMMRemovableMedia( const IString& deviceName, bool openNow, unsigned long instance, bool openShareable )

A derived class can construct an IMMRemovableMedia from the following:

deviceName
You must specify what device you want to construct.
openNow
If true, it causes the device to automatically open the device before returning from the constructor; otherwise, you have to call one of the open functions to open the device yourself.
instance
You can provide your own instance number instead of letting IMMRemovableMedia generate one.
openShareable
If true, it allows the hardware device to be shared by different programs; otherwise, the hardware cannot be shared.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Overload 2
protected:
IMMRemovableMedia( unsigned long deviceIdentifier, const IString& newAlias = IString ( ) )

A derived class can construct an IMMRemovableMedia from the following:

deviceIdentifier
The value the system uses to identify the device.
newAlias
The name you can use to associate a string to the device. Optional.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Door and Presence

Use these members to open, close, lock, and unlock the door on the removable media device.


[view class]
closeDoor
public:
virtual IMMRemovableMedia& closeDoor(CallType call = wait)

Retracts the tray and closes the door, if possible.

Exception

IAccessError The device identifier is not valid; possibly the device is closed.
IAccessError The device cannot acquire access to the hardware device; possibly another device of this same type was acquired for exclusive use in this or another process.
IAccessError An internal driver error occurred.
IInvalidRequest The device must be in the open state before calling this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
isMediaPresent
public:
bool isMediaPresent(CallType call = wait) const

Returns true if media is inserted in the device; otherwise, it returns false.

Exception

IAccessError The device identifier is not valid; possibly the device is closed.
IAccessError The device cannot acquire access to the hardware device; possibly another device of this same type was acquired for exclusive use in this or another process.
IAccessError An internal driver error occurred.
IInvalidRequest The device must be in the open state before calling this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
lockDoor
public:
virtual IMMRemovableMedia& lockDoor( bool lock = true, CallType call = wait )

Locks the media cover on the device, if any. This disables manual ejection of the media from the device.

Exception

IAccessError The device identifier is not valid; possibly the device is closed.
IAccessError The device cannot acquire access to the hardware device; possibly another device of this same type was acquired for exclusive use in this or another process.
IAccessError An internal driver error occurred.
IInvalidRequest The device must be in the open state before calling this function.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
openDoor
public:
virtual IMMRemovableMedia& openDoor( bool open = true, CallType call = wait )

Opens the door and ejects the tray, if possible.

Exception

IAccessError The device identifier is not valid; possibly the device is closed.
IAccessError The device cannot acquire access to the hardware device; possibly another device of this same type was acquired for exclusive use in this or another process.
IAccessError An internal driver error occurred.
IInvalidRequest The device must be in the open state before calling this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
unlockDoor
public:
virtual IMMRemovableMedia& unlockDoor(CallType call = wait)

Unlocks the media cover on the device, if any. This enables manual ejection of the media from the device.

Exception

IAccessError The device identifier is not valid; possibly the device is closed.
IAccessError The device cannot acquire access to the hardware device; possibly another device of this same type was acquired for exclusive use in this or another process.
IAccessError An internal driver error occurred.
IInvalidRequest The device must be in the open state before calling this function.

Supported Platforms

Windows OS/2 AIX
No Yes No


Event Dispatching

Event-dispatching members interact with the notification handlers for this device.


[view class]
enableNotification
public:
virtual IMMRemovableMedia& enableNotification( bool enabled = true )

Flags this object as being ready to accept notifications. A Notifier, like IMMRemovableMedia, does not send notifications to observer objects until it is enabled.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
notificationHandler
protected:
IMMRemovableMediaNotifyHandler* notificationHandler() const

Returns a pointer to the notification handler.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
setNotificationHandler
protected:
IMMRemovableMedia& setNotificationHandler( IMMRemovableMediaNotifyHandler* notifyHandler )

Sets the notification handler to the passed value.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Notification Event Descriptions

This INotificationId string is used for notifications that IMMRemovableMedia provides to its observers.


[view class]
mediaLoadedId
public:
static INotificationId const mediaLoadedId

Notification identifier provided to observers when the current media-loaded state changes. IMMRemovableMedia provides a boolean value in the eventData field of the INotificationEvent. This value is true if the media is loaded and false, if the media is unloaded.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


IMMRemovableMedia - Inherited Member Functions and Data

Inherited Public Functions

IMMDevice
IMMPlayableDevice
INotifier
IStandardNotifier

Inherited Public Data

INotifier
IMMDevice

Inherited Protected Functions

INotifier
IStandardNotifier
IMMDevice
IMMPlayableDevice

Inherited Protected Data