harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 16 9422ed56ee45
parent 14 3e156c80c15d
child 18 63c982fb92f2
equal deleted inserted replaced
14:3e156c80c15d 16:9422ed56ee45
   143     iManualPauseEnabled = EFalse;
   143     iManualPauseEnabled = EFalse;
   144     iFastHarvestNeeded = EFalse;
   144     iFastHarvestNeeded = EFalse;
   145     iHarvestingPlaceholders = EFalse;
   145     iHarvestingPlaceholders = EFalse;
   146     
   146     
   147     iUnmountDetected = EFalse;
   147     iUnmountDetected = EFalse;
       
   148     iPriorityInterruptDetected = EFalse;
   148     }
   149     }
   149      
   150      
   150 // ---------------------------------------------------------------------------
   151 // ---------------------------------------------------------------------------
   151 // ~CHarvesterAO
   152 // ~CHarvesterAO
   152 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   910 		        iPHArray.Insert( hd, 0 );
   911 		        iPHArray.Insert( hd, 0 );
   911 		        }
   912 		        }
   912 		    iTempReadyPHArray.Reset();
   913 		    iTempReadyPHArray.Reset();
   913 		    CleanupStack::PopAndDestroy( &mdeObjectArray );
   914 		    CleanupStack::PopAndDestroy( &mdeObjectArray );
   914 		    return;
   915 		    return;
       
   916 		    }
       
   917 	    // Check for priority interrupt
       
   918 	    // If priority interrupt occures, drop current operation to handle the priority item first,
       
   919 	    // and continue from current situation after that
       
   920 		else if( iPriorityInterruptDetected )
       
   921 		    {
       
   922             WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - Priority interrupt during execution!" );
       
   923             const TInt currentPHArrayCount( iPHArray.Count() );
       
   924             for( TInt y( iTempReadyPHArray.Count() -1 ); y >=0; y-- )
       
   925                 {
       
   926                 CHarvesterData* hd = iTempReadyPHArray[y];
       
   927                 if( currentPHArrayCount )
       
   928                     {
       
   929                     // Leave the first item in the array as it is the priority item
       
   930                     iPHArray.Insert( hd, 1 );
       
   931                     }
       
   932                 else
       
   933                     {
       
   934                     iPHArray.Insert( hd, 0 );
       
   935                     }
       
   936                 }
       
   937             iTempReadyPHArray.Reset();
       
   938             CleanupStack::PopAndDestroy( &mdeObjectArray );
       
   939             return;		
   915 		    }
   940 		    }
   916 		
   941 		
   917 		if( objDefStr.Length() == 0 ||
   942 		if( objDefStr.Length() == 0 ||
   918 		    ( objDefStr == KInUse ) )
   943 		    ( objDefStr == KInUse ) )
   919 			{
   944 			{
  1642     	iNextRequest = ERequestIdle;
  1667     	iNextRequest = ERequestIdle;
  1643     	}
  1668     	}
  1644     
  1669     
  1645     // Reset unmount flag, as unmount is handled before RunL is called again after aborted harvesting run
  1670     // Reset unmount flag, as unmount is handled before RunL is called again after aborted harvesting run
  1646     iUnmountDetected = EFalse;
  1671     iUnmountDetected = EFalse;
       
  1672     // Reset priority flag, as interrupt is handled automatically first when RunL is called again 
       
  1673     iPriorityInterruptDetected = EFalse;
  1647     
  1674     
  1648     User::LeaveIfError( iStatus.Int() );
  1675     User::LeaveIfError( iStatus.Int() );
  1649     switch( iNextRequest )
  1676     switch( iNextRequest )
  1650         {
  1677         {
  1651         // no more items in queue
  1678         // no more items in queue
  2106 
  2133 
  2107     if( iQueue )
  2134     if( iQueue )
  2108         {
  2135         {
  2109         iQueue->Append( hd );
  2136         iQueue->Append( hd );
  2110         
  2137         
       
  2138         iPriorityInterruptDetected = ETrue;
       
  2139         
  2111         // signal to start harvest if harvester idles
  2140         // signal to start harvest if harvester idles
  2112         if ( !IsServerPaused() )
  2141         if ( !IsServerPaused() && iNextRequest == ERequestIdle )
  2113             {
  2142             {
  2114             SetNextRequest( CHarvesterAO::ERequestHarvest );
  2143             SetNextRequest( CHarvesterAO::ERequestHarvest );
  2115             }
  2144             }
  2116         }
  2145         }
  2117     else
  2146     else
  2284     if( iQueue )
  2313     if( iQueue )
  2285     	{
  2314     	{
  2286     	iQueue->Append( hd );
  2315     	iQueue->Append( hd );
  2287 
  2316 
  2288     	// signal to start harvest if harvester idles
  2317     	// signal to start harvest if harvester idles
  2289     	if ( !IsServerPaused() )
  2318     	if ( !IsServerPaused() && iNextRequest == ERequestIdle )
  2290     		{
  2319     		{
  2291     		SetNextRequest( CHarvesterAO::ERequestHarvest );
  2320     		SetNextRequest( CHarvesterAO::ERequestHarvest );
  2292     		}
  2321     		}
  2293     	}
  2322     	}
  2294     else
  2323     else
  3056         // Other objects are set to be in default location by default
  3085         // Other objects are set to be in default location by default
  3057         TBool inDefaultFolder( ETrue );
  3086         TBool inDefaultFolder( ETrue );
  3058         aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
  3087         aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
  3059         }
  3088         }
  3060     }
  3089     }
       
  3090 
       
  3091 CHarvesterAO::TRequest CHarvesterAO::GetHarvesterAORunState()
       
  3092     {
       
  3093     return iNextRequest;
       
  3094     }
       
  3095