harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 14 646a02f170b9
parent 8 6752808b2036
child 15 3cebc1a84278
equal deleted inserted replaced
8:6752808b2036 14:646a02f170b9
    51 _LIT( KTAGDaemonName, "ThumbAGDaemon" );
    51 _LIT( KTAGDaemonName, "ThumbAGDaemon" );
    52 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
    52 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
    53 
    53 
    54 _LIT(KVideo, "Video");
    54 _LIT(KVideo, "Video");
    55 _LIT(KInUse, "InUse");
    55 _LIT(KInUse, "InUse");
       
    56 
       
    57 _LIT(KUndefinedMime, " ");
    56 
    58 
    57 _LIT( KExtensionMp4,   "mp4" );
    59 _LIT( KExtensionMp4,   "mp4" );
    58 _LIT( KExtensionMpg4,  "mpg4" );
    60 _LIT( KExtensionMpg4,  "mpg4" );
    59 _LIT( KExtensionMpeg4, "mpeg4" );
    61 _LIT( KExtensionMpeg4, "mpeg4" );
    60 _LIT( KExtension3gp,   "3gp" );
    62 _LIT( KExtension3gp,   "3gp" );
   834             {
   836             {
   835             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, mimeType );
   837             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, mimeType );
   836             }
   838             }
   837         else
   839         else
   838             {
   840             {
   839             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KNullDesC );
   841             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime );
   840             }
   842             }
   841 		
   843 		
   842 	    TPtrC name;
   844 	    TPtrC name;
   843 	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
   845 	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
   844 
   846 
  1765 	
  1767 	
  1766 		WRITELOG1( "RHarvesterClient::HarvestFile - add location: %d", addLocation );
  1768 		WRITELOG1( "RHarvesterClient::HarvestFile - add location: %d", addLocation );
  1767     
  1769     
  1768     CHarvesterData* hd = NULL;
  1770     CHarvesterData* hd = NULL;
  1769     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  1771     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  1770     if ( err != KErrNone )
  1772     if ( err != KErrNone || !hd )
  1771         {
  1773         {
  1772         WRITELOG( "CHarvesterAO::HarvestFile - creating harvUri failed" );
  1774         WRITELOG( "CHarvesterAO::HarvestFile - creating harvUri failed" );
  1773         albumIds.Close();
  1775         albumIds.Close();
  1774         delete uri;
  1776         delete uri;
  1775         uri = NULL;
  1777         uri = NULL;
  1796     else
  1798     else
  1797         {
  1799         {
  1798         WRITELOG( "CHarvesterAO::HarvestFile - creating clientData failed" );
  1800         WRITELOG( "CHarvesterAO::HarvestFile - creating clientData failed" );
  1799         }
  1801         }
  1800 
  1802 
  1801     if( iQueue && hd )
  1803     if( iQueue )
  1802         {
  1804         {
  1803         iQueue->Append( hd );
  1805         iQueue->Append( hd );
  1804         
  1806         
  1805         // signal to start harvest if harvester idles
  1807         // signal to start harvest if harvester idles
  1806         if ( !IsServerPaused() )
  1808         if ( !IsServerPaused() )
  1808             SetNextRequest( CHarvesterAO::ERequestHarvest );
  1810             SetNextRequest( CHarvesterAO::ERequestHarvest );
  1809             }
  1811             }
  1810         }
  1812         }
  1811     else
  1813     else
  1812         {
  1814         {
       
  1815         delete hd;
  1813         err = KErrUnknown;
  1816         err = KErrUnknown;
  1814         }
  1817         }
  1815     
  1818     
  1816     if (!aMessage.IsNull())
  1819     if (!aMessage.IsNull())
  1817         {
  1820         {
  1941     
  1944     
  1942         WRITELOG1( "RHarvesterClient::HarvestFileWithUID - add location: %d", addLocation );
  1945         WRITELOG1( "RHarvesterClient::HarvestFileWithUID - add location: %d", addLocation );
  1943     
  1946     
  1944     CHarvesterData* hd = NULL;
  1947     CHarvesterData* hd = NULL;
  1945     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  1948     TRAP( err, hd = CHarvesterData::NewL( uri ) );
  1946     if ( err != KErrNone )
  1949     if ( err != KErrNone || !hd )
  1947         {
  1950         {
  1948         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
  1951         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating harvUri failed" );
  1949         albumIds.Close();
  1952         albumIds.Close();
  1950         delete uri;
  1953         delete uri;
  1951         uri = NULL;
  1954         uri = NULL;
  1972     else
  1975     else
  1973         {
  1976         {
  1974         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
  1977         WRITELOG( "CHarvesterAO::HarvestFileWithUID - creating clientData failed" );
  1975         }
  1978         }
  1976 
  1979 
  1977     if( iQueue && hd )
  1980     if( iQueue )
  1978     	{
  1981     	{
  1979     	iQueue->Append( hd );
  1982     	iQueue->Append( hd );
  1980 
  1983 
  1981     	// signal to start harvest if harvester idles
  1984     	// signal to start harvest if harvester idles
  1982     	if ( !IsServerPaused() )
  1985     	if ( !IsServerPaused() )
  1984     		SetNextRequest( CHarvesterAO::ERequestHarvest );
  1987     		SetNextRequest( CHarvesterAO::ERequestHarvest );
  1985     		}
  1988     		}
  1986     	}
  1989     	}
  1987     else
  1990     else
  1988         {
  1991         {
       
  1992         delete hd;
  1989         err = KErrUnknown;
  1993         err = KErrUnknown;
  1990         }
  1994         }
  1991 
  1995 
  1992     if (!aMessage.IsNull())
  1996     if (!aMessage.IsNull())
  1993         {
  1997         {
  2202     WRITELOG( "CHarvesterAO::ContextSnapshotStatus()" );
  2206     WRITELOG( "CHarvesterAO::ContextSnapshotStatus()" );
  2203     
  2207     
  2204     HarvestCompleted( aHD->ClientId(), aHD->Uri(), aHD->ErrorCode() );
  2208     HarvestCompleted( aHD->ClientId(), aHD->Uri(), aHD->ErrorCode() );
  2205 
  2209 
  2206     const TInt errorCode = aHD->ErrorCode();
  2210     const TInt errorCode = aHD->ErrorCode();
  2207     if( errorCode != KErrNone )
  2211     if( errorCode != KErrNone && errorCode != KErrCompletion )
  2208     	{
  2212     	{
  2209         WRITELOG1( "CHarvesterAO::ContextSnapshotStatus() - error occurred: %d", errorCode );    	
  2213         WRITELOG1( "CHarvesterAO::ContextSnapshotStatus() - error occurred: %d", errorCode );    	
  2210     	}
  2214     	}
  2211     else
  2215     else
  2212     	{
  2216     	{
  2213         WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
  2217         if( errorCode == KErrCompletion )
       
  2218             {
       
  2219             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - snapshot could not be completed" );
       
  2220             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - processing non-context data anyway" );   
       
  2221             }
       
  2222         else
       
  2223             {
       
  2224             WRITELOG( "CHarvesterAO::ContextSnapshotStatus() - successfully completed" );
       
  2225             }
  2214         if( aHD->Origin() == MdeConstants::Object::ECamera )
  2226         if( aHD->Origin() == MdeConstants::Object::ECamera )
  2215         	{
  2227         	{
  2216             aHD->MdeObject().SetPlaceholder( EFalse );
  2228             aHD->MdeObject().SetPlaceholder( EFalse );
  2217         	TRAPD(mdeError, iMdeObjectHandler->SetMetadataObjectL( *aHD ) );
  2229         	TRAPD(mdeError, iMdeObjectHandler->SetMetadataObjectL( *aHD ) );
  2218         	if(mdeError != KErrNone)
  2230         	if(mdeError != KErrNone)
  2296 
  2308 
  2297 void CHarvesterAO::BootPartialRestoreScanL()
  2309 void CHarvesterAO::BootPartialRestoreScanL()
  2298 	{
  2310 	{
  2299 	// check if partial restore was done before last boot
  2311 	// check if partial restore was done before last boot
  2300 	TBool partialRestore = iRestoreWatcher->Register();
  2312 	TBool partialRestore = iRestoreWatcher->Register();
  2301 		
  2313 	
       
  2314 #ifdef __WINSCW__
       
  2315 	partialRestore = ETrue;
       
  2316 #endif
       
  2317 	
  2302 	if ( !partialRestore )
  2318 	if ( !partialRestore )
  2303 		{
  2319 		{
  2304 		return;
  2320 		return;
  2305 		}
  2321 		}
  2306 	
  2322