CDiskNotifyHandler Class Reference
class CDiskNotifyHandler : public CBase |
Disk Notification API provides an easy-to-use implementation of a wrapper to handle file server notifications. It contains all required active objects needed for handling the notifications. In the most cases, it automatically resubscribes the notifications. The API consists of classes CDiskNotifyHandler and MDiskNotifyHandlerCallback. The user of CDiskNotifyHandler class needs to implement relevant MDiskNotifyHandlerCallback interface methods to handle the notifications.
Usage:
Initialization example (from a class that implements
MDiskNotifyHandlerCallback interface):
// iFsSession contains open file server session
iNotifyHandler = CDiskNotifyHandler::NewL( *this, iFsSession );
User::LeaveIfError( iNotifyHandler->NotifyDisk() ); // Subscribe disk notifications
// Note that also the other notifications can be subcribed simultaneously using
// the same disk notify handler
Uninitialization example:
delete iNotifyHandler; // Cancel all notifications set by this handler
Handler method implementation example:
// Implement just the needed callback methods
void CMyDiskNotifyTest::HandleNotifyDisk( TInt aError, const TDiskEvent& aEvent )
{
// Print out the event data
RDebug::Print( _L("Error: %d, Disk %d changed, Change type: %d"),
aError, aEvent.iDrive, aEvent.iType );
}
disknotifyhandler.lib
- Since
- S60 5.0
Constructor & Destructor Documentation
CDiskNotifyHandler()
CDiskNotifyHandler | ( | ) | [private] |
~CDiskNotifyHandler()
IMPORT_C | ~CDiskNotifyHandler | ( | ) | |
Member Functions Documentation
AllowDismount(TInt)
When this method is called, the CDiskNotifyHandler allows the dismount of given drive. If it is not listening the dismount of given drive, nothing happens.
This method must be called only from MDiskNotifyHandlerCallback's HandleNotifyDismount to inform file server that dismount of the drive can be done.
Parameters
TInt aDrive | A drive identifier specified by TDriveNumber |
CancelNotifyDisk()
IMPORT_C void | CancelNotifyDisk | ( | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for disk notifications. If it is not listening disk notifications, nothing happens.
CancelNotifyDiskSpace(const TInt64 &, TInt)
IMPORT_C void | CancelNotifyDiskSpace | ( | const TInt64 & | aThreshold, |
| TInt | aDrive |
| ) | |
When this method is called, the CDiskNotifyHandler cancels listening for disk space notification of given drive with given threshold. If it is not listening the disk space of given drive with given threshold, nothing happens.
Parameters
const TInt64 & aThreshold | A threshold that causes notification when crossed. |
TInt aDrive | A drive identifier specified by TDriveNumber |
CancelNotifyDiskSpace(TInt)
IMPORT_C void | CancelNotifyDiskSpace | ( | TInt | aDrive | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for all disk space notifications of given drive. If it is not listening the disk space of given drive, nothing happens.
Parameters
TInt aDrive | A drive identifier specified by TDriveNumber |
CancelNotifyDiskSpace()
IMPORT_C void | CancelNotifyDiskSpace | ( | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for all disk space notifications that are set by this handler. If it is not listening any disk space notifications, nothing happens.
CancelNotifyDismount(TInt)
IMPORT_C void | CancelNotifyDismount | ( | TInt | aDrive | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for dismount notification of given drive. If it is not listening the dismount of given drive, nothing happens.
Parameters
TInt aDrive | A drive identifier specified by TDriveNumber |
CancelNotifyDismount()
IMPORT_C void | CancelNotifyDismount | ( | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for all dismount notifications that are set by this handler. If it is not listening any dismount notifications, nothing happens.
CancelNotifyEntry(TNotifyType, const TDesC &)
When this method is called, the CDiskNotifyHandler cancels listening for change notification of given entry with notify type. If it is not listening the given entry with notify type, nothing happens.
Parameters
TNotifyType aType | A type of notification specified by TNotifyType. |
const TDesC & aEntry | A full path of the file or folder entry to listen. |
CancelNotifyEntry(const TDesC &)
IMPORT_C void | CancelNotifyEntry | ( | const TDesC & | aEntry | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for all change notifications of given entry. If it is not listening the given entry, nothing happens.
Parameters
const TDesC & aEntry | A full path of the file or folder to be listened. |
CancelNotifyEntry()
IMPORT_C void | CancelNotifyEntry | ( | ) | |
When this method is called, the CDiskNotifyHandler cancels listening for entry notifications that are set by this handler. If it is not listening any entry notifications, nothing happens.
CancelStartedDismount(TInt)
IMPORT_C void | CancelStartedDismount | ( | TInt | aDrive | ) | |
When this method is called, the CDiskNotifyHandler cancels started dismount of given drive. If dismount of given drive was not started, nothing happens.
Parameters
TInt aDrive | A drive identifier specified by TDriveNumber |
CancelStartedDismount()
IMPORT_C void | CancelStartedDismount | ( | ) | |
When this method is called, the CDiskNotifyHandler cancels all started dismounts. If any dismount was not started, nothing happens.
ConstructL(MDiskNotifyHandlerCallback &, RFs &)
Symbian two-phased constructor.
NewL(MDiskNotifyHandlerCallback &, RFs &)
This is a two-phase constructor method that is used to create a new instance for listening to the disk changes.
Parameters
MDiskNotifyHandlerCallback & aCallback | Reference to a callback instance, MDiskNotifyHandlerCallback |
RFs & aFs | Reference to an open file server session, RFs Do not close this session until all CDiskNotifyHandler instances referring to it have been deleted. |
NotifyDisk()
IMPORT_C TInt | NotifyDisk | ( | ) | |
When this method is called, the CDiskNotifyHandler starts listening for disk notifications. If it is already listening disk notifications, KErrAlreadyExists is returned.
This notification is automatically resubscibed until explicitly canceled or error has happened. The notifications and errors are informed using MDiskNotifyHandlerCallback's HandleNotifyDisk method.
NotifyDiskSpace(const TInt64 &, TInt)
When this method is called, the CDiskNotifyHandler starts listening for disk space notifications. If it is already listening disk space for given drive with given threshold, KErrAlreadyExists is returned.
This notification is automatically resubscibed until explicitly canceled or error has happened. The notification and error are informed using MDiskNotifyHandlerCallback's HandleNotifyDiskSpace method.
Parameters
const TInt64 & aThreshold | A threshold that causes notification when crossed. |
TInt aDrive | A drive identifier specified by TDriveNumber |
NotifyDismount(TInt)
When this method is called, the CDiskNotifyHandler starts listening for dismount notification. If it is already listening dismount notification for given drive, KErrAlreadyExists is returned.
This notification is not resubscibed because drive is not available anymore after dismount notification. The notification and error are informed using MDiskNotifyHandlerCallback's HandleNotifyDismount method.
Parameters
TInt aDrive | A drive identifier specified by TDriveNumber |
NotifyEntry(TNotifyType, const TDesC &)
When this method is called, the CDiskNotifyHandler starts listening for entry (i.e. file or folder) change notifications. If it is already listening any type of change notification for given entry with given notification type, KErrAlreadyExists is returned.
A given folder entry's full path must include backslash ending.
This notification is automatically resubscibed until explicitly canceled or error has happened. The notification and error are informed using MDiskNotifyHandlerCallback's HandleNotifyEntry method.
Parameters
TNotifyType aType | A type of notification specified by TNotifyType. |
const TDesC & aEntry | A full path of the file or folder to be listened. |
StartDismount(TInt, TTimeIntervalMicroSeconds32)
When this method is called, the CDiskNotifyHandler starts dismount with sending notification to registered clients. If dismount is pending after given timeout, forced dismount is done. If dismount of given drive was already started, KErrAlreadyExists is returned.
This notification is not resubscibed because drive is not available anymore after dismount. The notification and error are informed using MDiskNotifyHandlerCallback's HandleNotifyDismountFinished method.
Member Data Documentation
CDiskNotifyHandlerImpl * iImpl
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.