diff -r f23c07ec56e2 -r 85f623e1ef41 locationmanager/locationtrail/src/clocationrecord.cpp --- a/locationmanager/locationtrail/src/clocationrecord.cpp Tue Aug 31 15:37:30 2010 +0300 +++ b/locationmanager/locationtrail/src/clocationrecord.cpp Wed Sep 01 12:24:24 2010 +0100 @@ -509,7 +509,7 @@ if ( !iTrailStarted || iState == RLocationTrail::ETrailStopped) { - LOG("CLocationRecord::Position(), trail not started/stopped"); + LOG("trail not started/stopped"); iPositionInfo->Stop(); return; } @@ -533,24 +533,24 @@ case KPositionQualityLoss: { // Location is stored, even if it may not be valid. - LOG("CLocationRecord::Position(), Partial update"); + LOG("Partial update"); if ( iState != RLocationTrail::EWaitingGPSData && iState != RLocationTrail::ETrailStopping ) { SetCurrentState( RLocationTrail::EWaitingGPSData ); - LOG("CLocationRecord::Position(), Trail waiting for gps"); + LOG("Trail waiting for gps"); } break; } case KErrNone: { - LOG("CLocationRecord::Position(), Good GPS coordinates"); + LOG("Good GPS coordinates"); iGpsDataAvailableFlag = ETrue; if ( iState != RLocationTrail::ETrailStarted ) { if ( iRemapper ) { - LOG("CLocationRecord::Position(), Start remapping"); + LOG("Start remapping"); iRemapper->StartRemappingObjects( iNewItem.iLocationData ); if( iObserver->WaitForPositioningStopTimeout() && !RemappingNeeded() ) @@ -571,7 +571,7 @@ } default: { - LOG1("CLocationRecord::Position(), Searching GPS, aError %d", aError ); + LOG1("Searching GPS, aError %d", aError ); if ( iState != RLocationTrail::ESearchingGPS && iState != RLocationTrail::ETrailStopping ) { @@ -582,12 +582,12 @@ } } TBool fixState = CheckGPSFix( positionSatelliteInfo ); - LOG1( "CLocationRecord::Position(), fixState %d", fixState ); - LOG1( "CLocationRecord::Position(), iLastGPSFixState %d", iLastGPSFixState ); + LOG1( "fixState %d", fixState ); + LOG1( "iLastGPSFixState %d", iLastGPSFixState ); if ( iObserver && iLastGPSFixState != fixState ) { - LOG("CLocationRecord::Position(), Quality changed"); + LOG("Quality changed"); iObserver->GPSSignalQualityChanged( positionSatelliteInfo ); } @@ -968,7 +968,7 @@ { // no n/w info... put it into remap. // remove the last appended element. - LOG("CLocationRecord::LocationSnapshotL(), No network info (offline mode + no GPS fix), keep for remapping"); + LOG("No network info (offline mode + no GPS fix), keep for remapping"); TRemapItem remapItem; remapItem.iObjectId = aObjectId; remapItem.iTime = timestamp; @@ -977,12 +977,7 @@ TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; iMediaItems.Remove(iMediaItems.Count() - 1); iMediaItems.Compress(); - if( firstPtr == newItem) - { - newItem = NULL; - } - delete firstPtr; - firstPtr = NULL; + delete firstPtr; } else { @@ -993,7 +988,6 @@ else if ( Math::IsNaN( locationData.iPosition.Latitude() ) && Math::IsNaN( locationData.iPosition.Longitude() )) { - LOG("CLocationRecord::LocationSnapshotL(), coordinates empty with or without cellular info") // coordinates empty, with or without cellular info if ( net->iCellId == 0 && @@ -1001,7 +995,7 @@ net->iCountryCode.Length() == 0 && net->iNetworkId.Length() == 0 ) { - LOG("CLocationRecord::LocationSnapshotL(), No network info (offline mode + no GPS fix), keep for remapping"); + LOG("No network info (offline mode + no GPS fix), keep for remapping"); TRemapItem remapItem; remapItem.iObjectId = aObjectId; remapItem.iTime = timestamp; @@ -1010,12 +1004,7 @@ TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; iMediaItems.Remove(iMediaItems.Count() - 1); iMediaItems.Compress(); - if( firstPtr == newItem) - { - newItem = NULL; - } - delete firstPtr; - firstPtr = NULL; + delete firstPtr; } // check match for last created locationobject #ifdef LOC_REVERSEGEOCODE @@ -1025,7 +1014,6 @@ else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0) #endif //LOC_REVERSEGEOCODE { - LOG("CLocationRecord::LocationSnapshotL(), last created locationobject match" ); TLocationData lastLocationData = iLastMediaItem.iLocationData; CTelephony::TNetworkInfoV1* lastnet = &lastLocationData.iNetworkInfo; @@ -1050,16 +1038,11 @@ TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; iMediaItems.Remove(iMediaItems.Count() - 1); iMediaItems.Compress(); - if( firstPtr == newItem) - { - newItem = NULL; - } - delete firstPtr; - firstPtr = NULL; + delete firstPtr; } } - if ( newItem && !previousMatch ) + if ( !previousMatch ) { // go for n/w based newItem->iFlag |= KNetQueryBit; @@ -1070,7 +1053,6 @@ else if ( lastLocationId != 0 && ((iLastMediaItem.iFlag & KSnapMediaFile) > 0)) { - LOG("CLocationRecord::LocationSnapshotL(), valid coordinates found"); TLocationData lastLocationData = iLastMediaItem.iLocationData; CTelephony::TNetworkInfoV1* lastnet = &lastLocationData.iNetworkInfo; @@ -1096,7 +1078,7 @@ if ( distance < iLocationDelta ) { - LOG("CLocationRecord::LocationSnapshotL(), location close to the previous one"); + LOG("location close to the previous one"); previousMatch = ETrue; CreateRelationL( aObjectId, lastLocationId ); @@ -1109,14 +1091,9 @@ TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; iMediaItems.Remove(iMediaItems.Count() - 1); iMediaItems.Compress(); - if( firstPtr == newItem) - { - newItem = NULL; - } - delete firstPtr; - firstPtr = NULL; + delete firstPtr; } - else if (newItem) + else { // country tag not found.. go for reverse geocoding.. newItem->iLocationId = lastLocationId; @@ -1140,12 +1117,7 @@ TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; iMediaItems.Remove(iMediaItems.Count() - 1); iMediaItems.Compress(); - if( firstPtr == newItem) - { - newItem = NULL; - } - delete firstPtr; - firstPtr = NULL; + delete firstPtr; #endif //LOC_REVERSEGEOCODE } @@ -1221,7 +1193,7 @@ || (iMediaItems.Count() <= 0)) { // query is in progress or queue is empty - LOG1( "CLocationRecord::FindLocationFromDBL(), Count - %d", iMediaItems.Count() ); + LOG1( "query is in progress or queue is empty. Count - %d", iMediaItems.Count() ); return; } if ( (iMediaItems[0]->iFlag & KNetQueryBit) > 0 ) @@ -1264,10 +1236,10 @@ CMdELogicCondition& cond = iLocationQuery->Conditions(); cond.SetOperator( ELogicConditionOperatorAnd ); - LOG1( "CLocationRecord::FindLocationFromDBL(), latitude: %f", latitude); - LOG1( "CLocationRecord::FindLocationFromDBL(), latdelta: %f", latDelta); - LOG1( "CLocationRecord::FindLocationFromDBL(), longitude: %f", longitude); - LOG1( "CLocationRecord::FindLocationFromDBL(), londelta: %f", lonDelta); + LOG1( "latitude: %f", latitude); + LOG1( "latdelta: %f", latDelta); + LOG1( "longitude: %f", longitude); + LOG1( "londelta: %f", lonDelta); cond.AddPropertyConditionL( *iLatitudeDef, TMdERealBetween( latitude - latDelta, latitude + latDelta )); @@ -1357,14 +1329,14 @@ locationObject->AddTextPropertyL( itemTypeDef, Location::KLocationItemType ); locationObject->AddInt16PropertyL( offSetDef, timeOffset.Int() / 60 ); - LOG1( "CLocationRecord::DoCreateLocationL(), Location created with stamp: %Ld", timestamp.Int64() ); + LOG1( "Location created with stamp: %Ld", timestamp.Int64() ); // location related properties if ( !Math::IsNaN( aLocationData.iPosition.Latitude() ) && !Math::IsNaN( aLocationData.iPosition.Longitude() )) { - LOG1("CLocationRecord::DoCreateLocationL(), Lan - %f", aLocationData.iPosition.Latitude()); - LOG1("CLocationRecord::DoCreateLocationL(), Lon - %f", aLocationData.iPosition.Longitude()); + LOG1("Lan - %f", aLocationData.iPosition.Latitude()); + LOG1("Lon - %f", aLocationData.iPosition.Longitude()); locationObject->AddReal64PropertyL( *iLatitudeDef, aLocationData.iPosition.Latitude() ); locationObject->AddReal64PropertyL( *iLongitudeDef, aLocationData.iPosition.Longitude() ); @@ -1389,44 +1361,29 @@ // network related properties if ( aLocationData.iNetworkInfo.iAccess != CTelephony::ENetworkAccessUnknown ) { - LOG1("CLocationRecord::DoCreateLocationL(), Cell id - %d", aLocationData.iNetworkInfo.iCellId); + LOG1("Cell id - %d", aLocationData.iNetworkInfo.iCellId); locationObject->AddUint32PropertyL( cellIdDef, aLocationData.iNetworkInfo.iCellId ); } if ( aLocationData.iNetworkInfo.iAreaKnown && aLocationData.iNetworkInfo.iLocationAreaCode != 0 && aLocationData.iNetworkInfo.iAccess != CTelephony::ENetworkAccessUnknown ) { - LOG1("CLocationRecord::DoCreateLocationL(), Areacode - %d", aLocationData.iNetworkInfo.iLocationAreaCode); + LOG1("Areacode - %d", aLocationData.iNetworkInfo.iLocationAreaCode); locationObject->AddUint32PropertyL( locationCodeDef, aLocationData.iNetworkInfo.iLocationAreaCode ); } #ifdef _DEBUG - - if ( aLocationData.iNetworkInfo.iCountryCode.Length() > 0 ) - { - TLex lexer( aLocationData.iNetworkInfo.iCountryCode ); - TUint countryCode = 0; - TRAP_IGNORE(lexer.Val( countryCode, EDecimal)); - LOG1("CLocationRecord::DoCreateLocationL(), Country code - %d", countryCode); - } - else - { - LOG("CLocationRecord::DoCreateLocationL(), No Country code"); - } + TLex lexer( aLocationData.iNetworkInfo.iCountryCode ); + TUint countryCode = 0; + + User::LeaveIfError( lexer.Val( countryCode, EDecimal) ); + LOG1("Country code - %d", countryCode); //Set mobile network code - if ( aLocationData.iNetworkInfo.iNetworkId.Length() > 0 ) - { - TLex lexer = aLocationData.iNetworkInfo.iNetworkId; - TUint networkCode = 0; - TRAP_IGNORE(lexer.Val( networkCode, EDecimal)); - LOG1("CLocationRecord::DoCreateLocationL(), Network id - %d", networkCode); - } - else - { - LOG("CLocationRecord::DoCreateLocationL(), No network code"); - } - + lexer = aLocationData.iNetworkInfo.iNetworkId; + TUint networkCode = 0; + User::LeaveIfError( lexer.Val( networkCode, EDecimal) ); + LOG1("Network id - %d", networkCode); #endif if ( aLocationData.iNetworkInfo.iCountryCode.Length() > 0 ) { @@ -1441,7 +1398,7 @@ // Add the location object to the database. locationObjectId = iMdeSession->AddObjectL( *locationObject ); - LOG1("CLocationRecord::DoCreateLocationL(), Location id - %d", locationObjectId); + LOG1("Location id - %d", locationObjectId); CleanupStack::PopAndDestroy( locationObject ); LOG( "CLocationRecord::DoCreateLocationL(), end" ); @@ -2240,11 +2197,6 @@ CMdEProperty* property = NULL; object = iMdeSession->GetObjectL( aObjectId ); - if( !object ) - { - User::Leave( KErrNotFound ); - } - CleanupStack::PushL( object ); object->Property( timeDef, property, 0 ); if ( !property ) @@ -2254,10 +2206,7 @@ const TTime timeValue( property->TimeValueL() ); CleanupStack::PopAndDestroy( object ); - - LOG( "CLocationRecord::GetMdeObjectTimeL(), end" ); return timeValue; - }