MHarvestObserver Class Reference

class MHarvestObserver

Observer interface to inform when fast harvesting is completed with the HarvestingComplete callback.

Example of MHarvestObserver and RHarvesterClient::HarvestFile usage:

Client application (like Camera) which wants to observe the completion of harvesting requests (issued with RHarvesterClient::Harvestile method) needs implement the interface MHarvestObserver::HarvestingComplete. Callback HarvestingComplete provides the name of the harvested file (aURI) and also possible error code (aError).

class CHarvestingObserver : public MHarvestObserver { void HarvestingComplete( TDesC& aURI, TInt aError ); // from MHarvestObserver void IssueHarvestingRequests();

RHarvesterClient iHClient; }

void CHarvestObserver::ConstructL() { // connecting to Harvester server iHClient.Connect(); }

void CHarvestObserver::IssueHarvestingRequests() { // new harvesting request data _LIT( KNewFile, "C:\\Data\\ThisIsANewFile1.jpg" ); RArray<TItemId> defaultPhotoAlbums; defaultPhotoAlbums.Append( 123 ); defaultPhotoAlbums.Append( 456 ); defaultPhotoAlbums.Append( 789 );

// setting this class as the observer for the fast harvesting calls iHClient.SetObserver(this);

// issu new harvesting request and requesting location data to be harvested iHClient.HarvestFile( KNewFile, defaultPhotoAlbums, ETrue ); }

void CHarvestObserver::HarvestingComplete( TDesC& aURI, TInt aError ) { _LIT( KExpectedFile, "C:\\Data\\ThisIsANewFile1.jpg" );

// Checking if an error occurred and if this was the expected file if ((aError == KErrNone) && (aURI.CompareC(KExpectedFile) == 0)) { // do something } }

Public Member Functions
voidHarvestingComplete(TDesC &, TInt)

Member Functions Documentation

HarvestingComplete(TDesC &, TInt)

voidHarvestingComplete(TDesC &aURI,
TIntaError
)[pure virtual]

Callback to inform when fast harvesting of a file is complete.

Parameters

TDesC & aURIURI of the harvested file.
TInt aErrorError code of the fast harvesting. KErrNone is expected if fast harvesting succeeded. Otherwise some system wide error code.