locationmanager/server/src/clocationgeotagtimerao.cpp
changeset 45 a93990e5815e
parent 36 aa5a574040a4
child 56 fd6cce931a8a
--- a/locationmanager/server/src/clocationgeotagtimerao.cpp	Tue Jul 06 14:44:37 2010 +0300
+++ b/locationmanager/server/src/clocationgeotagtimerao.cpp	Wed Aug 18 10:12:07 2010 +0300
@@ -70,7 +70,7 @@
             new( ELeave ) CLocationGeoTagTimerAO(aMdeSession, aObserver);
        CleanupStack::PushL( self );
        self->ConstructL();
-       CleanupStack::Pop();
+       CleanupStack::Pop(); //self
        
        return self;
     }
@@ -108,11 +108,11 @@
         
         //3 AM in seconds
         TInt targetTimeInSeconds = GEOTAGGING_TIME_IN_HOURS * HOUR_VALUE_IN_SECONDS;
-        TInt timeDifference;
+        TInt timeDifference = 0;
         
         //Find the time difference in seconds between current time to 3.00 AM 
         //Either on same day or next day.
-        if ( currentHr <= GEOTAGGING_TIME_IN_HOURS )
+        if ( currentHr < GEOTAGGING_TIME_IN_HOURS )
         {
            timeDifference = targetTimeInSeconds - 
                     ( ( currentHr * HOUR_VALUE_IN_SECONDS  ) + ( currentMin * HOUR_VALUE_IN_MINUTES ) + currentSec );
@@ -145,30 +145,26 @@
     {
     LOG ("CLocationGeoTagTimerAO::RunL(), begin");
     TInt status = iStatus.Int();
+    LOG1 ("Timedout error - %d", status);
    
     switch( status )
         {
-        case KErrAbort:
-            StartTimer();
-            break;
-        case KErrUnderflow:
-        case KErrOverflow:
-            StartTimer();
-            break;
         case KErrNone:
             {
             //Trigger the reverse geocoding and start the timer again
             //Create the instance of geotagger class
-            if(iGeoTagger)
+            if(iGeoTagger != NULL)
                 {
                 delete iGeoTagger;
                 iGeoTagger = NULL;
                 }
             iGeoTagger = CGeoTagger::NewL( this, NULL );
             iGeoTagger->CreateGeoTagsL();
+            LOG ("Started 3:00 AM geotagging.");
             break;
             }
         default:
+            StartTimer();
             break;      
        }
     LOG ("CLocationGeoTagTimerAO::RunL(), end");
@@ -181,8 +177,6 @@
 void CLocationGeoTagTimerAO::GeoTaggingCompleted(  const TInt aError )
     {    
     LOG ("CLocationGeoTagTimerAO::GeoTaggingCompleted(), begin");
-    delete iGeoTagger;
-    iGeoTagger = NULL;
     StartTimer();
     iObserver.GeoTaggingCompleted(aError);
     LOG ("CLocationGeoTagTimerAO::GeoTaggingCompleted(), end");