camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_symbian_p.cpp
changeset 51 ccc0e7e3344f
parent 45 24fd82631616
equal deleted inserted replaced
45:24fd82631616 51:ccc0e7e3344f
    72 */
    72 */
    73 CxeGeoTaggingTrailPrivate::~CxeGeoTaggingTrailPrivate()
    73 CxeGeoTaggingTrailPrivate::~CxeGeoTaggingTrailPrivate()
    74 {
    74 {
    75     CX_DEBUG_ENTER_FUNCTION();
    75     CX_DEBUG_ENTER_FUNCTION();
    76 
    76 
    77     // stop trail and close location utility session
    77     // close the location utility session
    78     stop(true);
    78     mLocationTrail.Close();
    79 
    79 
    80     CX_DEBUG_EXIT_FUNCTION();
    80     CX_DEBUG_EXIT_FUNCTION();
    81 }
    81 }
    82 
    82 
    83 
    83 
   111             }
   111             }
   112         }
   112         }
   113 
   113 
   114         if (err) {
   114         if (err) {
   115             CX_DEBUG(("CxeGeoTaggingTrailPrivate::start <> FAILED: error = %d ", err));
   115             CX_DEBUG(("CxeGeoTaggingTrailPrivate::start <> FAILED: error = %d ", err));
   116             stop(true);
   116             mLocationTrail.Close();
   117         }        
   117         }        
   118     } else {
   118     } else {
   119         // geotagging setting off, do nothing.
   119         // geotagging setting off, do nothing.
   120         CX_DEBUG(("CxeGeoTaggingTrail <> start -- Geotagging setting OFF, do nothing.."));
   120         CX_DEBUG(("CxeGeoTaggingTrail <> start -- Geotagging setting OFF, do nothing.."));
   121     }
   121     }
   123     CX_DEBUG_EXIT_FUNCTION();
   123     CX_DEBUG_EXIT_FUNCTION();
   124 }
   124 }
   125 
   125 
   126 /*!
   126 /*!
   127 * Stop location trail.
   127 * Stop location trail.
   128 * @ param closeSession, indicates if we are willing to close the location utility session.
   128 */
   129 */
   129 void CxeGeoTaggingTrailPrivate::stop()
   130 void CxeGeoTaggingTrailPrivate::stop(bool closeSession)
       
   131 {
   130 {
   132     CX_DEBUG_ENTER_FUNCTION();
   131     CX_DEBUG_ENTER_FUNCTION();
   133 
   132 
   134     bool ok2StopTrail = canStopTrail();
   133     bool ok2StopTrail = canStopTrail();
   135 
   134 
   141             // stop location trail timer.
   140             // stop location trail timer.
   142             mStopLocationTrailTimer.stop();
   141             mStopLocationTrailTimer.stop();
   143             mLocationTrail.StopLocationTrail();
   142             mLocationTrail.StopLocationTrail();
   144             setState(CxeGeoTaggingTrail::Connected);
   143             setState(CxeGeoTaggingTrail::Connected);
   145         }
   144         }
   146         
   145 
   147         if (closeSession && state() == CxeGeoTaggingTrail::Connected) {
       
   148             CX_DEBUG(("CxeGeoTaggingTrailPrivate <> disconnect location trail utility"));
       
   149             mLocationTrail.Close();
       
   150             setState(CxeGeoTaggingTrail::NotConnected);
       
   151         }
       
   152     } else {
   146     } else {
   153         // not ready to stop the location trail, TrailStarted the timer.
   147         // not ready to stop the location trail, TrailStarted the timer.
   154         if (!mPendingStopTrailSession) {
       
   155             mPendingStopTrailSession = closeSession;
       
   156         }
       
   157         mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL);
   148         mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL);
   158     }
   149     }
   159     
   150     
   160     CX_DEBUG_EXIT_FUNCTION();
   151     CX_DEBUG_EXIT_FUNCTION();
   161 }
   152 }
   186 void CxeGeoTaggingTrailPrivate::timeout()
   177 void CxeGeoTaggingTrailPrivate::timeout()
   187 {
   178 {
   188     CX_DEBUG_ENTER_FUNCTION();
   179     CX_DEBUG_ENTER_FUNCTION();
   189     
   180     
   190     // stop the pending location trail utility
   181     // stop the pending location trail utility
   191     stop(mPendingStopTrailSession);
   182     stop();
   192     
   183     
   193     CX_DEBUG_EXIT_FUNCTION();
   184     CX_DEBUG_EXIT_FUNCTION();
   194 }
   185 }
   195 
   186 
   196 /*!
   187 /*!
   226 void CxeGeoTaggingTrailPrivate::handleGeoTaggingPropertyEvent(long int uid,
   217 void CxeGeoTaggingTrailPrivate::handleGeoTaggingPropertyEvent(long int uid,
   227                                                               unsigned long int key,
   218                                                               unsigned long int key,
   228                                                               QVariant value)
   219                                                               QVariant value)
   229 {
   220 {
   230     CX_DEBUG_ENTER_FUNCTION();
   221     CX_DEBUG_ENTER_FUNCTION();
   231 
   222     bool stateOk = (state() == CxeGeoTaggingTrail::DataAvailable || state() == CxeGeoTaggingTrail::TrailStarted);
   232     if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState) {
   223     if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState && stateOk) {
   233         CX_DEBUG(("Location trail: new state = %d ", value.toInt()));
   224         CX_DEBUG(("Location trail: new state = %d ", value.toInt()));
   234 
   225 
   235         RLocationTrail::TTrailState newState = 
   226         RLocationTrail::TTrailState newState = 
   236                 static_cast<RLocationTrail::TTrailState>(value.toInt());
   227                 static_cast<RLocationTrail::TTrailState>(value.toInt());
   237 
   228