Writing a Backup Engine Client (CSBEClient)

The Backup Engine exports conn::CSBEClient, which provides data to a host PC for backup and receives data from a host PC while restoring data. Device creators can call this API to write a backup server that handles PC requests for backup and restore.

The Backup Engine Overview provides an overview of the backup and restore architecture as well as components and APIs for using conn::CSBEClient. It also shows that a backup server (conn::CSBEClient) interacts with a host PC and the Backup Engine.

The Backup Engine Concepts introduces different types of backup and restore.

The File Locks describes the concepts of public data and private data.

After a phone connects to a PC, the phone user can select to back up or restore data from PC-side software. The backup software on the device side responds to the requests by working with a set of components.

Requests during a backup or a restore are usually initiated from a host PC to a backup server on a device. The backup server handles the PC requests and calls conn::CSBEClient for backup and restore. The conn::CSBEClient then interacts with the Backup Engine which in turn calls data owner applications for data request or supply. The backup server finally transfers the data to and from the host PC.

In the CSBEClient API, RequestDataL() and SupplyDataL() are two major functions for backup and restore:

  • For a backup, the backup server calls the CSBEClient::RequestDataL() function which gets the data from the Backup Engine. The backup server can then transfer the data to the host for a backup.

  • For a restore, the backup server gets the data from the host PC. The backup server then calls the CSBEClient::SupplyDataL() function which supplies the data to the Backup Engine for a restore.

A particular type of conn::CSBGenericTransferType is passed to these functions depending on the data to be transferred, such as a snapshot or incremental data. Refer to the Creating transfer types section for an example.

The backup and restore sections below describe the conn::CSBEClient function calls. The sequence of the calls depends on the requests from the host PC and the backup server, but the recommended sequence is listed below.