Public and Subscribe Events for Backup and Restore

This section describes the subscribe and publish flag for backup and restore.

Description

Applications and servers are made aware that a backup or restore takes place through the Publish and Subscribe (P&S) events. The P&S server maintains a list of subscribers expressing an interest in the backup and restore status flag. Any published changes to this flag by the Backup Engine notifies all the subscribers. The flag provides information on whether a backup or restore operation is in progress, whether a backup is base or incremental, and whether the operation is full or partial.

RProperty::Subscribe() is used to subscribe to a flag. The function must be used in conjunction with an active object to be notified when the value changes. The following category and key values must be used (defined in epoc32\include\connect\sbdefs.h):

Category: KUidSystemCategoryValue

Key: KUidBackupRestoreKey

#include <e32property.h> 

RProperty iProperty;

iProperty.Attach(KUidSystemCategory, KUidBackupRestoreKey);
CActiveScheduler::Add(this);
iStatus = KRequestPending;
iProperty.Subscribe(iStatus);
SetActive();

// In RunL, to get the state: TInt
backupStateValue = 0;
iProperty.Get(backupStateValue);