# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282202441 -10800 # Node ID b732521885346040b630022f8d90b3cf34994368 # Parent 63c982fb92f2bd5300bd8d3514b3487c6ffcc9f7 Revision: 201031 Kit: 201033 diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFDbItemContainer.cpp --- a/clfwrapper/ClientSrc/CCLFDbItemContainer.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFDbItemContainer.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -65,6 +65,7 @@ CCLFContainerItem::~CCLFContainerItem() { delete iMdEObject; + iMdEObject = NULL; } // ----------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFDbItemProvider.cpp --- a/clfwrapper/ClientSrc/CCLFDbItemProvider.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFDbItemProvider.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -84,6 +84,7 @@ { Cancel(); delete iObjectQuery; + iObjectQuery = NULL; iItemArray.ResetAndDestroy(); } diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFEngineImpl.cpp --- a/clfwrapper/ClientSrc/CCLFEngineImpl.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFEngineImpl.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -105,14 +105,21 @@ CCLFEngineImpl::~CCLFEngineImpl() { delete iItemProvider; + iItemProvider = NULL; delete iUpdateStartEventHandler; + iUpdateStartEventHandler = NULL; delete iUpdateEndEventHandler; + iUpdateEndEventHandler = NULL; delete iDbItemContainer; + iDbItemContainer = NULL; delete iCLFServerProxy; + iCLFServerProxy = NULL; iChangedItemObserverArray.Close(); iProcessObserverArray.Close(); delete iQueryAdapter; + iQueryAdapter = NULL; delete iMdESession; + iMdESession = NULL; } // ----------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFItemImpl.cpp --- a/clfwrapper/ClientSrc/CCLFItemImpl.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFItemImpl.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -521,6 +521,7 @@ for ( HBufC* const* p = hashIter.NextValue(); p; p = hashIter.NextValue() ) { delete *p; + p = NULL; } iTextMap.Close(); } diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp --- a/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -157,7 +157,9 @@ { iChangedItemProvider.RemoveChangedItemProviderObserver( this ); delete iMimeTypeArray; + iMimeTypeArray = NULL; delete iMediaTypeArray; + iMediaTypeArray = NULL; iItemArray.ResetAndDestroy(); delete iItemProvider; iResultArray.Close(); diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFQueryAdapter.cpp --- a/clfwrapper/ClientSrc/CCLFQueryAdapter.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFQueryAdapter.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -255,8 +255,8 @@ } aStatus = KRequestPending; - iStatusArray.Append( &aStatus ); - iQueryArray.Append( aQuery ); + iStatusArray.AppendL( &aStatus ); + iQueryArray.AppendL( aQuery ); // Check that we can actually execute the query. We can if we have at least one query condition. if ( rootCondition.Count() > 0 ) diff -r 63c982fb92f2 -r b73252188534 clfwrapper/ClientSrc/CCLFServerProxy.cpp --- a/clfwrapper/ClientSrc/CCLFServerProxy.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFServerProxy.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -758,7 +758,9 @@ TRAP_IGNORE( iMdESession.RemoveObjectPresentObserverL( *this )); iUpdateItemsHandlerArray.ResetAndDestroy(); delete iUriArray; + iUriArray = NULL; delete iExtensionArray; + iExtensionArray = NULL; iFs.Close(); iHC.RemoveHarvesterEventObserver( *this ); diff -r 63c982fb92f2 -r b73252188534 contextengine/group/contextengine.mmp --- a/contextengine/group/contextengine.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/contextengine/group/contextengine.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -47,7 +47,7 @@ #if defined(WINS) deffile ../bwincw/contextenginewinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/contextenginearm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp --- a/contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -89,12 +89,15 @@ { WRITELOG( "CCalendarContextPlugin::~CCalendarContextPlugin -- ENTER" ); delete iCalInstanceView; + iCalInstanceView = NULL; delete iCalSession; + iCalSession = NULL; if( iInitTimer ) { iInitTimer->Cancel(); delete iInitTimer; + iInitTimer = NULL; } WRITELOG( "CCalendarContextPlugin::~CCalendarContextPlugin -- RETURN" ); diff -r 63c982fb92f2 -r b73252188534 contextengine/plugins/contextplugininterface/group/contextplugininterface.mmp --- a/contextengine/plugins/contextplugininterface/group/contextplugininterface.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/contextengine/plugins/contextplugininterface/group/contextplugininterface.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -39,7 +39,7 @@ #if defined(WINS) deffile ../bwincw/contextplugininterfacewinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/contextplugininterfacearm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 contextengine/src/contextengine.cpp --- a/contextengine/src/contextengine.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/contextengine/src/contextengine.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -109,6 +109,7 @@ { // destroy the singleton and free TLS delete data; + data = NULL; UserSvr::DllFreeTls( KContextEngineTLSKey ); } } @@ -132,6 +133,7 @@ { // destroy the singleton and free TLS delete data; + data = NULL; UserSvr::DllFreeTls( KContextEngineTLSKey ); } } @@ -144,6 +146,7 @@ { WRITELOG( "CContextEngine::~CContextEngine" ); // DEBUG INFO delete iContextEngineAO; + iContextEngineAO = NULL; MdsUtils::CleanupPtrArray( &iSnapshotQueue ); REComSession::FinalClose(); // we are done @@ -279,6 +282,7 @@ if ( iSnapshotQueue.Append( aItem ) != KErrNone ) { delete aItem; + aItem = NULL; return; } diff -r 63c982fb92f2 -r b73252188534 group/bld.inf --- a/group/bld.inf Thu Jul 15 19:07:24 2010 +0300 +++ b/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -17,6 +17,7 @@ #include +#include "../locationmanager/inc/locplatsupport.mmh" #include "../metadataengine/group/bld.inf" #include "../locationmanager/group/bld.inf" @@ -34,7 +35,22 @@ DEFAULT PRJ_EXPORTS -../rom/mds.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) + +#if defined(_LOC_GEOTAGGING_CELLID) +#ifdef _LOC_REVERSEGEOCODE +../rom/mds_cellid_reverse_geocode_enabled.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) +#else +../rom/mds_cellidenabled.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) +#endif +#elif defined(_LOC_REVERSEGEOCODE) +#ifdef _LOC_GEOTAGGING_CELLID +../rom/mds_cellid_reverse_geocode_enabled.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) +#else +../rom/mds_reverse_geocode_enabled_only.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) +#endif +#else +../rom/mds.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds.iby) +#endif #ifdef RD_MDS_2_5 ../rom/ContentListingFramework.iby CORE_MW_LAYER_IBY_EXPORT_PATH( ContentListingFramework.iby ) diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistclient/group/blacklistclient.mmp --- a/harvester/blacklistclient/group/blacklistclient.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistclient/group/blacklistclient.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -44,7 +44,7 @@ deffile ../bwincw/blacklistclientwinscw.def #else -#if defined(ARMCC) +#if defined(EABI) deffile ../eabi/blacklistclientarm.def #endif diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistclient/src/blacklistclient.cpp --- a/harvester/blacklistclient/src/blacklistclient.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistclient/src/blacklistclient.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -278,6 +278,7 @@ if ( err != KErrNone ) { delete item; + item = NULL; } @@ -300,6 +301,7 @@ { CBlacklistItem* item = iBlacklistMemoryTable[index]; delete item; + item = NULL; iBlacklistMemoryTable.Remove( index ); } diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistclient/traces/OstTraceDefinitions.h --- a/harvester/blacklistclient/traces/OstTraceDefinitions.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistclient/traces/OstTraceDefinitions.h Thu Aug 19 10:20:41 2010 +0300 @@ -3,5 +3,5 @@ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistserver/src/blacklistserver.cpp --- a/harvester/blacklistserver/src/blacklistserver.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistserver/src/blacklistserver.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -217,6 +217,7 @@ iBlacklistServerChunk.Close(); delete iSqLiteConnection; + iSqLiteConnection = NULL; WRITELOG( "CBlacklistServer::~CBlacklistServer - end" ); OstTrace0( TRACE_NORMAL, DUP1_CBLACKLISTSERVER_CBLACKLISTSERVER, "CBlacklistServer::~CBlacklistServer -end " ); @@ -291,6 +292,7 @@ { TRAP(result, CBlacklistServer::ExeMainL()); delete cleanup; + cleanup = NULL; } __UHEAP_MARKEND; WRITELOG( "CBlacklistServer::E32Main - end" ); @@ -495,6 +497,7 @@ if ( err != KErrNone ) { delete item; + item = NULL; } WRITELOG( "CBlacklistServer::AddToMemoryTableL - end" ); @@ -518,6 +521,7 @@ { CBlacklistItem * item = iBlacklistMemoryTable[index]; delete item; + item = NULL; iBlacklistMemoryTable.Remove( index ); } @@ -723,7 +727,7 @@ variables->AppendL( TColumn( lcBuf ) ); variables->AppendL( TColumn( aMediaId ) ); - iBufferedRemoveItems.Append( variables ); // transfer ownership + iBufferedRemoveItems.AppendL( variables ); // transfer ownership iDBUpdateNeeded = ETrue; CleanupStack::Pop( lcBuf ); CleanupStack::Pop( 2, variables ); @@ -768,7 +772,7 @@ rowData->AppendL( TColumn( lcBuf ) ); rowData->AppendL( TColumn( aMediaId ) ); - iBufferedAddedItems.Append( rowData ); // transfer ownership + iBufferedAddedItems.AppendL( rowData ); // transfer ownership iDBUpdateNeeded = ETrue; CleanupStack::Pop( lcBuf ); CleanupStack::Pop( 2, rowData ); diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistserver/src/blacklistsession.cpp --- a/harvester/blacklistserver/src/blacklistsession.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistserver/src/blacklistsession.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -140,7 +140,7 @@ void CBlacklistSession::RemoveL( const RMessage2& aMessage ) { RBuf uri; - uri.Create( aMessage.GetDesLength( 1 ) ); + User::LeaveIfError( uri.Create( aMessage.GetDesLength( 1 ) ) ); CleanupClosePushL( uri ); aMessage.ReadL( 1, uri ); @@ -162,7 +162,7 @@ void CBlacklistSession::RemoveFromDBL( const RMessage2& aMessage ) { RBuf uri; - uri.Create( aMessage.GetDesLength( 1 ) ); + User::LeaveIfError( uri.Create( aMessage.GetDesLength( 1 ) ) ); CleanupClosePushL( uri ); aMessage.ReadL( 1, uri ); diff -r 63c982fb92f2 -r b73252188534 harvester/blacklistserver/traces/OstTraceDefinitions.h --- a/harvester/blacklistserver/traces/OstTraceDefinitions.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/blacklistserver/traces/OstTraceDefinitions.h Thu Aug 19 10:20:41 2010 +0300 @@ -3,5 +3,5 @@ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r 63c982fb92f2 -r b73252188534 harvester/client/group/harvesterclient.mmp --- a/harvester/client/group/harvesterclient.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/group/harvesterclient.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -29,7 +29,7 @@ #if defined(WINSCW) deffile ../bwincw/harvesterclientwinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/harvesterclientarm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/client/src/harvesterclient.cpp --- a/harvester/client/src/harvesterclient.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/src/harvesterclient.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -54,10 +54,11 @@ WRITELOG( "RHarvesterClient::RHarvesterClient() - Constructor" ); OstTrace0( TRACE_NORMAL, RHARVESTERCLIENT_RHARVESTERCLIENT, "RHarvesterClient::RHarvesterClient" ); - iHarvesterClientAO = NULL; iObserver = NULL; iHEO = NULL; iRequestQueue = NULL; + iHarvesterClientAO = NULL; + iSessionWatcher = NULL; } // ---------------------------------------------------------------------------------------- @@ -69,7 +70,6 @@ WRITELOG( "RHarvesterClient::Connect()" ); OstTrace0( TRACE_NORMAL, RHARVESTERCLIENT_CONNECT, "RHarvesterClient::Connect" ); - RProperty property; const TInt error( property.Attach( KHarvesterPSShutdown, KShutdown, EOwnerThread ) ); TInt value = 0; @@ -114,28 +114,29 @@ } else { + WRITELOG1( "RHarvesterClient::Connect() - Server is not running or could not be started, error &d", err ); + delete iRequestQueue; + iRequestQueue = NULL; delete iHarvesterClientAO; iHarvesterClientAO = NULL; - delete iRequestQueue; - iRequestQueue = NULL; + return err; } -#ifdef _DEBUG - if ( err != KErrNone ) + if( err != KErrNone ) { - WRITELOG1( "RHarvesterClient::Connect() - Server is not running or could not be started, error &d", err ); + WRITELOG1( "RHarvesterClient::Connect() - Session creation failed, error &d", err ); + delete iRequestQueue; + iRequestQueue = NULL; + delete iHarvesterClientAO; + iHarvesterClientAO = NULL; } - else - { - WRITELOG( "RHarvesterClient::Connect() - no errors" ); - } - WRITELOG( "RHarvesterClient::Connect() - end" ); -#endif - + iHEO = NULL; iSessionWatcher = NULL; + WRITELOG( "RHarvesterClient::Connect() - end" ); + return err; } @@ -182,27 +183,37 @@ delete iSessionWatcher; iSessionWatcher = NULL; + + if( iRequestQueue && iRequestQueue->RequestsPending() ) + { + iRequestQueue->Cancel(); + } // cancels Harvest Complete request if it exist at server - UnregisterHarvestComplete(); + if( iObserver ) + { + RemoveObserver( iObserver ); + } WRITELOG( "RHarvesterClient::Close() - UnregisterHarvest done" ); if( iRequestQueue && iRequestQueue->RequestsPending() ) { - iRequestQueue->Cancel(); + WRITELOG( "RHarvesterClient::Close() - Pending harvesting requests detected -> ForceHarvest" ); iRequestQueue->ForceRequests(); } + WRITELOG( "RHarvesterClient::Close() - ForceHarvest done" ); + delete iRequestQueue; iRequestQueue = NULL; + delete iHEO; + iHEO = NULL; + delete iHarvesterClientAO; iHarvesterClientAO = NULL; - delete iHEO; - iHEO = NULL; - WRITELOG( "RHarvesterClient::Close() - Closing session" ); RSessionBase::Close(); @@ -219,8 +230,8 @@ if ( iHarvesterClientAO ) { - iHarvesterClientAO->SetObserver( aObserver ); - } + iHarvesterClientAO->SetObserver( aObserver ); + } iObserver = aObserver; } @@ -233,18 +244,16 @@ WRITELOG( "RHarvesterClient::RemoveObserver()" ); OstTrace0( TRACE_NORMAL, RHARVESTERCLIENT_REMOVEOBSERVER, "RHarvesterClient::RemoveObserver" ); - if ( iHarvesterClientAO ) - { - iHarvesterClientAO->RemoveObserver( aObserver ); - } - - if ( aObserver == iObserver ) + if ( aObserver == iObserver && iObserver ) { - if ( iObserver ) - { - WRITELOG( "CHarvesterClientAO::RemoveObserver() - deleting observer" ); - iObserver = NULL; - } + WRITELOG( "RHarvesterClient::RemoveObserver() - deleting observer" ); + + if ( iHarvesterClientAO ) + { + iHarvesterClientAO->RemoveObserver( aObserver ); + } + + iObserver = NULL; } } @@ -300,7 +309,6 @@ WRITELOG1( "RHarvesterClient::HarvestFile() - file %S", &aURI ); OstTrace0( TRACE_NORMAL, RHARVESTERCLIENT_HARVESTFILE, "RHarvesterClient::HarvestFile" ); - HBufC8* paramBuf = NULL; TRAPD( err, paramBuf = SerializeArrayL( aAlbumIds ) ); if ( err ) @@ -335,11 +343,13 @@ WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrServerBusy ); iObserver->HarvestingComplete( const_cast(aURI), KErrServerBusy ); delete harvestFileActive; + harvestFileActive = NULL; } else if( err ) { WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrServerBusy ); delete harvestFileActive; + harvestFileActive = NULL; } else { @@ -352,11 +362,13 @@ WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrDisconnected ); iObserver->HarvestingComplete( const_cast(aURI), KErrDisconnected ); delete harvestFileActive; + harvestFileActive = NULL; } else { WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrDisconnected ); delete harvestFileActive; + harvestFileActive = NULL; } WRITELOG( "RHarvesterClient::HarvestFile() - end" ); } @@ -408,11 +420,13 @@ WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrServerBusy ); iObserver->HarvestingComplete( const_cast(aURI), KErrServerBusy ); delete harvestFileActive; + harvestFileActive = NULL; } else if( err ) { WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrServerBusy ); delete harvestFileActive; + harvestFileActive = NULL; } else { @@ -424,11 +438,13 @@ WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrDisconnected ); iObserver->HarvestingComplete( const_cast(aURI), KErrDisconnected ); delete harvestFileActive; + harvestFileActive = NULL; } else { WRITELOG1( "RHarvesterClient::HarvestFile() - cannot not send harvest request to server, error: %d", KErrDisconnected ); delete harvestFileActive; + harvestFileActive = NULL; } } @@ -464,11 +480,10 @@ // ---------------------------------------------------------------------------------------- // void RHarvesterClient::RegisterHarvestComplete(TDes& aURI, TRequestStatus& aStatus) - { + { TIpcArgs ipcArgs( &aURI ); OstTrace0( TRACE_NORMAL, RHARVESTERCLIENT_REGISTERHARVESTCOMPLETE, "RHarvesterClient::RegisterHarvestComplete" ); - if( !iHandle ) { return; @@ -488,7 +503,7 @@ return; } - Send( EUnregisterHarvestComplete ); + SendReceive( EUnregisterHarvestComplete ); } // ---------------------------------------------------------------------------------------- @@ -498,7 +513,10 @@ void RHarvesterClient::HarvestFile( TInt& aService, TIpcArgs& aArgs, TRequestStatus& aStatus ) { // send to server harvesting complete observer - iHarvesterClientAO->Active(); + if( iObserver && iHarvesterClientAO ) + { + iHarvesterClientAO->Active(); + } SendReceive( aService, aArgs, aStatus ); } @@ -508,8 +526,6 @@ // void RHarvesterClient::ForceHarvestFile( TInt& aService, TIpcArgs& aArgs ) { - // send to server harvesting complete observer - iHarvesterClientAO->Active(); SendReceive( aService, aArgs ); } diff -r 63c982fb92f2 -r b73252188534 harvester/client/src/harvesterclientao.cpp --- a/harvester/client/src/harvesterclientao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/src/harvesterclientao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -97,19 +97,16 @@ // RemoveObserver // --------------------------------------------------------------------------- // -void CHarvesterClientAO::RemoveObserver( MHarvestObserver* aObserver ) +void CHarvesterClientAO::RemoveObserver( MHarvestObserver* /*aObserver*/ ) { WRITELOG( "CHarvesterClientAO::RemoveObserver()" ); - OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_REMOVEOBSERVER, "CHarvesterClientAO::RemoveObserver" ); - - if ( aObserver == iObserver ) - { - if ( iObserver ) - { - WRITELOG( "CHarvesterClientAO::RemoveObserver() - deleting observer" ); - iObserver = NULL; - } - } + if ( iObserver ) + { + WRITELOG( "CHarvesterClientAO::RemoveObserver() - deleting observer" ); + iObserver = NULL; + } + + Cancel(); } // --------------------------------------------------------------------------- @@ -120,7 +117,7 @@ { WRITELOG( "CHarvesterClientAO::DoCancel()" ); OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_DOCANCEL, "CHarvesterClientAO::DoCancel" ); - + iHarvesterClient.UnregisterHarvestComplete(); } // --------------------------------------------------------------------------- @@ -129,7 +126,7 @@ // void CHarvesterClientAO::Active() { - if (!IsActive()) + if ( iObserver && !IsActive()) { iHarvesterClient.RegisterHarvestComplete(iURI, iStatus); SetActive(); @@ -144,7 +141,6 @@ { WRITELOG( "CHarvesterClientAO::RunL()" ); OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_RUNL, "CHarvesterClientAO::RunL" ); - const TInt status = iStatus.Int(); @@ -161,7 +157,7 @@ } // if the request was not canceled or server is not terminated, Activating AO again - if ( status != KErrCancel && status != KErrServerTerminated ) + if ( status != KErrCancel && status != KErrServerTerminated && iObserver ) { Active(); } diff -r 63c982fb92f2 -r b73252188534 harvester/client/src/harvestereventobserverao.cpp --- a/harvester/client/src/harvestereventobserverao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/src/harvestereventobserverao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -126,6 +126,7 @@ iHarvesterClient.Send( EUnregisterHarvesterEvent, ipcArgs ); iObservers.Remove( i ); delete observer; + observer = NULL; } } diff -r 63c982fb92f2 -r b73252188534 harvester/client/src/harvesterrequestactive.cpp --- a/harvester/client/src/harvesterrequestactive.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/src/harvesterrequestactive.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -32,14 +32,11 @@ if( IsActive() ) { Cancel(); - if( iObserver ) - { - iObserver->HarvestingComplete( iUri, KErrCancel ); - } - iRequestCompleted = ETrue; } + iRequestCompleted = ETrue; delete iAlbumIds; + iAlbumIds = NULL; } // --------------------------------------------------------------------------- @@ -79,10 +76,16 @@ // void CHarvesterRequestActive::RunL() { + if( iStatus.Int() == KErrCancel ) + { + return; + } + if( iStatus.Int() && iObserver ) { iObserver->HarvestingComplete( iUri, iStatus.Int() ); } + iRequestCompleted = ETrue; if( iRequestQueue ) { @@ -104,7 +107,8 @@ if( iObserver ) { iObserver->HarvestingComplete( iUri, aError ); - } + } + iRequestCompleted = ETrue; return KErrNone; } @@ -116,6 +120,7 @@ void CHarvesterRequestActive::DoCancel() { iCancelled = ETrue; + iObserver = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 harvester/client/src/harvestersessionwatcher.cpp --- a/harvester/client/src/harvestersessionwatcher.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/src/harvestersessionwatcher.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -38,6 +38,7 @@ CHarvesterSessionWatcher::~CHarvesterSessionWatcher() // destruct { Cancel(); + iObserver = NULL; } // --------------------------------------------------------------------------- @@ -105,7 +106,10 @@ case ERunning: { // server terminated, notify clients - iObserver->HarvesterServerTerminated(); + if( iObserver ) + { + iObserver->HarvesterServerTerminated(); + } break; } diff -r 63c982fb92f2 -r b73252188534 harvester/client/traces/OstTraceDefinitions.h --- a/harvester/client/traces/OstTraceDefinitions.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/traces/OstTraceDefinitions.h Thu Aug 19 10:20:41 2010 +0300 @@ -3,5 +3,5 @@ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r 63c982fb92f2 -r b73252188534 harvester/client/traces/fixed_id.definitions --- a/harvester/client/traces/fixed_id.definitions Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/traces/fixed_id.definitions Thu Aug 19 10:20:41 2010 +0300 @@ -4,7 +4,6 @@ [TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_CONSTRUCTL=0x10 [TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_DOCANCEL=0x13 [TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_NEWL=0xd -[TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_REMOVEOBSERVER=0x12 [TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_RUNL=0x14 [TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_SETOBSERVER=0x11 [TRACE]TRACE_NORMAL[0x3]_DUP1_CHARVESTERCLIENTAO_CHARVESTERCLIENTAO=0xf @@ -20,3 +19,4 @@ [TRACE]TRACE_NORMAL[0x3]_RHARVESTERCLIENT_SETOBSERVER=0x6 [TRACE]TRACE_NORMAL[0x3]__CREATESERVERPROCESS=0xc [TRACE]TRACE_NORMAL[0x3]__STARTSERVER=0xb +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CHARVESTERCLIENTAO_REMOVEOBSERVER=0x12 diff -r 63c982fb92f2 -r b73252188534 harvester/client/traces/harvesterclientaoTraces.h --- a/harvester/client/traces/harvesterclientaoTraces.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/client/traces/harvesterclientaoTraces.h Thu Aug 19 10:20:41 2010 +0300 @@ -11,7 +11,6 @@ #define DUP1_CHARVESTERCLIENTAO_CHARVESTERCLIENTAO 0x3000f #define CHARVESTERCLIENTAO_CONSTRUCTL 0x30010 #define CHARVESTERCLIENTAO_SETOBSERVER 0x30011 -#define CHARVESTERCLIENTAO_REMOVEOBSERVER 0x30012 #define CHARVESTERCLIENTAO_DOCANCEL 0x30013 #define CHARVESTERCLIENTAO_RUNL 0x30014 diff -r 63c982fb92f2 -r b73252188534 harvester/common/bwincw/harvestercommonwinscw.def --- a/harvester/common/bwincw/harvestercommonwinscw.def Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/bwincw/harvestercommonwinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -66,4 +66,5 @@ ?HandleObjectPropertyL@CMdeObjectWrapper@@SAXAAVCMdEObject@@AAVCMdEPropertyDef@@PAXH@Z @ 65 NONAME ; void CMdeObjectWrapper::HandleObjectPropertyL(class CMdEObject &, class CMdEPropertyDef &, void *, int) ?SendHarvestingStatusEventL@CHarvesterPluginFactory@@QAEXH@Z @ 66 NONAME ; void CHarvesterPluginFactory::SendHarvestingStatusEventL(int) ?PauseHarvester@CHarvesterPluginFactory@@QAEXH@Z @ 67 NONAME ; void CHarvesterPluginFactory::PauseHarvester(int) + ?GetObjectDefL@CHarvesterPluginFactory@@QAEXPAVCHarvesterData@@AAVTDes16@@@Z @ 68 NONAME ; void CHarvesterPluginFactory::GetObjectDefL(class CHarvesterData *, class TDes16 &) diff -r 63c982fb92f2 -r b73252188534 harvester/common/eabi/harvestercommonarm.def --- a/harvester/common/eabi/harvestercommonarm.def Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/eabi/harvestercommonarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -86,4 +86,5 @@ _ZN18CHarvesterExifUtilD1Ev @ 85 NONAME _ZN18CHarvesterExifUtilD2Ev @ 86 NONAME _ZN23CHarvesterPluginFactory14PauseHarvesterEi @ 87 NONAME + _ZN23CHarvesterPluginFactory13GetObjectDefLEP14CHarvesterDataR6TDes16 @ 88 NONAME diff -r 63c982fb92f2 -r b73252188534 harvester/common/group/harvestercommon.mmp --- a/harvester/common/group/harvestercommon.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/group/harvestercommon.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -29,7 +29,7 @@ #if defined(WINSCW) deffile ../bwincw/harvestercommonwinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/harvestercommonarm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/common/group/harvesterdata.mmp --- a/harvester/common/group/harvesterdata.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/group/harvesterdata.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -29,7 +29,7 @@ #if defined(WINSCW) deffile ../bwincw/harvesterdatawinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/harvesterdataarm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/common/group/harvesterplugininterface.mmp --- a/harvester/common/group/harvesterplugininterface.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/group/harvesterplugininterface.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -46,7 +46,7 @@ #if defined(WINS) deffile ../bwincw/harvesterplugininterfacewinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/harvesterplugininterfacearm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvestdata.inl --- a/harvester/common/inc/harvestdata.inl Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvestdata.inl Thu Aug 19 10:20:41 2010 +0300 @@ -80,9 +80,55 @@ // void CObjectDataArray::Append( CMdEObject* aMdeObject, CLocationData* aLocationData, CMdEQuery* aQuery ) { - iMdeObjectArray.Append( aMdeObject ); - iLocationArray.Append( aLocationData ); - iQueryArray.Append( aQuery ); + TInt mdeObjectIndex(KErrNone); + TInt locationDataIndex(KErrNone); + + mdeObjectIndex = iMdeObjectArray.Append( aMdeObject ); + + if( mdeObjectIndex != KErrNone ) + { + delete aMdeObject; + aMdeObject = NULL; + + delete aLocationData; + aLocationData = NULL; + + delete aQuery; + aQuery = NULL; + } + else + { + locationDataIndex = iLocationArray.Append( aLocationData ); + + if( locationDataIndex != KErrNone ) + { + iMdeObjectArray.Remove( mdeObjectIndex ); + delete aMdeObject; + aMdeObject = NULL; + + delete aLocationData; + aLocationData = NULL; + + delete aQuery; + aQuery = NULL; + } + else + { + if( iQueryArray.Append( aQuery ) != KErrNone ) + { + iMdeObjectArray.Remove( mdeObjectIndex ); + delete aMdeObject; + aMdeObject = NULL; + + iLocationArray.Remove( locationDataIndex ); + delete aLocationData; + aLocationData = NULL; + + delete aQuery; + aQuery = NULL; + } + } + } } // --------------------------------------------------------------------------- @@ -96,8 +142,14 @@ return; } delete iMdeObjectArray[aIndex]; + iMdeObjectArray[aIndex] = NULL; + delete iLocationArray[aIndex]; + iLocationArray[aIndex] = NULL; + delete iQueryArray[aIndex]; + iQueryArray[aIndex] = NULL; + iMdeObjectArray.Remove( aIndex ); iLocationArray.Remove( aIndex ); iQueryArray.Remove( aIndex ); diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvestercenreputil.h --- a/harvester/common/inc/harvestercenreputil.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvestercenreputil.h Thu Aug 19 10:20:41 2010 +0300 @@ -28,7 +28,7 @@ { TUint32 iPreinstalled; HBufC* iPath; - ~TScanItem() { delete iPath; } + ~TScanItem() { delete iPath; iPath = NULL;} }; // CLASS DECLARATION diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvestercommon.h --- a/harvester/common/inc/harvestercommon.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvestercommon.h Thu Aug 19 10:20:41 2010 +0300 @@ -98,6 +98,7 @@ const TInt KOriginIgnored = 255; const TInt KOriginFastHarvest = 254; +const TInt KOriginIgnoreAttribsChanged = 253; const CActive::TPriority KHarvesterPriorityContextEngine = CActive::EPriorityUserInput; const CActive::TPriority KHarvesterPriorityMonitorPlugin = CActive::EPriorityUserInput; @@ -106,6 +107,9 @@ // Between Standard and UserInput to allow components to react to important events correctly const TInt KHarvesterCustomImportantPriority = 5; +// Higher than MonitorPlugin priority but lower than High to ensure server can answer to all +// connection requests as fast as possible +const TInt KHarvesterServerSessionPriority = 11; #endif diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvestereventmanager.h --- a/harvester/common/inc/harvestereventmanager.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvestereventmanager.h Thu Aug 19 10:20:41 2010 +0300 @@ -154,6 +154,7 @@ virtual ~CHarvesterEventManagerStaticData() { delete iHEM; + iHEM = NULL; } protected: diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvesterpluginfactory.h --- a/harvester/common/inc/harvesterpluginfactory.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvesterpluginfactory.h Thu Aug 19 10:20:41 2010 +0300 @@ -44,6 +44,8 @@ IMPORT_C void SendHarvestingStatusEventL( TBool aStarted ); IMPORT_C void PauseHarvester( TBool aPaused ); + + IMPORT_C void GetObjectDefL( CHarvesterData* aHD, TDes& aObjectDef ); private: CHarvesterPluginFactory(); diff -r 63c982fb92f2 -r b73252188534 harvester/common/inc/harvesterplugininfo.h --- a/harvester/common/inc/harvesterplugininfo.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/inc/harvesterplugininfo.h Thu Aug 19 10:20:41 2010 +0300 @@ -27,6 +27,7 @@ virtual ~CHarvesterPluginInfo() { delete iPlugin; + iPlugin = NULL; iExtensions.ResetAndDestroy(); iExtensions.Close(); iObjectTypes.ResetAndDestroy(); diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/blacklistitem.cpp --- a/harvester/common/src/blacklistitem.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/blacklistitem.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -51,6 +51,7 @@ CBlacklistItem::~CBlacklistItem() { delete iUri; + iUri = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvestercenreputil.cpp --- a/harvester/common/src/harvestercenreputil.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvestercenreputil.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -198,7 +198,9 @@ continue; } HBufC* pathBuf = path.AllocL(); - aPaths.Append( pathBuf ); + CleanupStack::PushL( pathBuf ); + aPaths.AppendL( pathBuf ); + CleanupStack::Pop( pathBuf ); } CleanupStack::PopAndDestroy( &scanPathKeys ); @@ -214,14 +216,17 @@ repo->FindL( aPartialKey, KSearchMask, scanPathKeys ); TBuf path; + for( TInt i = scanPathKeys.Count() - 1; i >=0; i-- ) { const TInt error( repo->Get( scanPathKeys[i], path ) ); + if( error != KErrNone ) { continue; } TUint32 preinstalled = MdeConstants::MediaObject::ENotPreinstalled; + if( path[ path.Length() - 1 ] != TChar('\\') ) { User::LeaveIfError( repo->GetMeta( scanPathKeys[i], preinstalled ) ); @@ -231,7 +236,7 @@ item->iPath = path.AllocL(); item->iPreinstalled = preinstalled; CleanupStack::Pop( item ); - aItems.Append( item ); // ownership is transferred + aItems.AppendL( item ); // ownership is transferred } CleanupStack::PopAndDestroy( &scanPathKeys ); diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvesterdata.cpp --- a/harvester/common/src/harvesterdata.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvesterdata.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -29,7 +29,11 @@ CHarvesterData::CHarvesterData( const HBufC* aUri ) { iUri = aUri; + iClientData = NULL; + iMdeObject = NULL; + iLocationData = NULL; iIsBinary = ETrue; + iClientId = KNullUid; } //========================================================================== @@ -39,9 +43,13 @@ CHarvesterData::~CHarvesterData() { delete iUri; + iUri = NULL; delete iClientData; + iClientData = NULL; delete iMdeObject; + iMdeObject = NULL; delete iLocationData; + iLocationData = NULL; } //========================================================================== @@ -225,6 +233,11 @@ // EXPORT_C void CHarvesterData::SetMdeObject( CMdEObject* aMdeObject ) { + if( iMdeObject ) + { + delete iMdeObject; + iMdeObject = NULL; + } iMdeObject = aMdeObject; } diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvestereventmanager.cpp --- a/harvester/common/src/harvestereventmanager.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvestereventmanager.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -93,6 +93,7 @@ { // destroy the singleton and free TLS delete data; + data = NULL; UserSvr::DllFreeTls( KHarvesterEventManagerTLSKey ); } } @@ -439,6 +440,7 @@ iRegisteredObservers.Remove( i ); delete observer; + observer = NULL; } // Find if any other observer is using the same queue else @@ -468,6 +470,7 @@ iEventQueues.Remove( mid ); queue->Close(); delete queue; + queue = NULL; break; } else if( compare > 0 ) diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvesterexifutil.cpp --- a/harvester/common/src/harvesterexifutil.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvesterexifutil.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -156,6 +156,7 @@ } delete reader; + reader = NULL; WRITELOG( "CHarvesterExifUtil::IsValidExifData end" ); OstTrace0( TRACE_NORMAL, DUP2_CHARVESTEREXIFUTIL_ISVALIDEXIFDATA, "CHarvesterExifUtil::IsValidExifData end" ); diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvestermediaidutil.cpp --- a/harvester/common/src/harvestermediaidutil.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvestermediaidutil.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -136,8 +136,10 @@ if (data->iRefCount <= 0) { delete data->iMediaIdUtil; + data->iMediaIdUtil = NULL; delete data; + data = NULL; UserSvr::DllFreeTls(KHarvesterMediaIdTLSKey); } } diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvesterplugin.cpp --- a/harvester/common/src/harvesterplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvesterplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -144,13 +144,13 @@ { if( iQueue->Count() == 0 ) { - SetNextRequest( EHarvesterIdle ); if( iHarvesting ) { TRAP_IGNORE( iFactory->SendHarvestingStatusEventL( EFalse ) ); iHarvesting = EFalse; } iQueue->Compress(); + SetNextRequest( EHarvesterIdle ); } else { @@ -162,6 +162,11 @@ CHarvesterData* hd = (*iQueue)[0]; iQueue->Remove( 0 ); + if( !hd ) + { + SetNextRequest( EHarvesterGathering ); + break; + } const TDesC& uri = hd->Uri(); TUint32 mediaId = hd->MdeObject().MediaId(); @@ -194,7 +199,7 @@ TRAP_IGNORE( SetDefaultPropertiesL( *hd ) ); WRITELOG1("CHarvesterPlugin::RunL - Calling HarvestL for file: %S", &uri); - TRAPD(err, HarvestL( hd ) ); + TRAPD( err, HarvestL( hd ) ); if ( iBlacklist ) { diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/harvesterpluginfactory.cpp --- a/harvester/common/src/harvesterpluginfactory.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/harvesterpluginfactory.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -93,50 +93,9 @@ // GetObjectDef // --------------------------------------------------------------------------- // -EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData& aHD, TDes& aObjectDef ) +EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData& /*aHD*/, TDes& aObjectDef ) { - TPtrC extPtr; - if( MdsUtils::GetExt( aHD.Uri(), extPtr ) ) - { - RPointerArray supportedPlugins; - CleanupClosePushL( supportedPlugins ); - GetSupportedPluginsL( supportedPlugins, extPtr ); - - const TInt sCount = supportedPlugins.Count(); - if( sCount == 1 ) - { - CHarvesterPluginInfo* info = supportedPlugins[0]; - if( info->iObjectTypes.Count() == 1 ) - { - aObjectDef.Copy( *(info->iObjectTypes[0]) ); - aHD.SetHarvesterPluginInfo( info ); - CleanupStack::PopAndDestroy( &supportedPlugins ); - return; - } - } - for( TInt i = sCount - 1; i >=0; i-- ) - { - CHarvesterPluginInfo* info = supportedPlugins[i]; - if ( !(info->iPlugin) ) - { - info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid ); - info->iPlugin->SetQueue( info->iQueue ); - info->iPlugin->SetHarvesterPluginFactory( *this ); - info->iPlugin->SetBlacklist( *iBlacklist ); - } - info->iPlugin->GetObjectType( aHD.Uri(), aObjectDef ); - if( aObjectDef.Length() > 0 ) - { - aHD.SetHarvesterPluginInfo( info ); - break; - } - } - CleanupStack::PopAndDestroy( &supportedPlugins ); - } - else - { - aObjectDef.Zero(); - } + aObjectDef.Zero(); } // --------------------------------------------------------------------------- @@ -209,7 +168,8 @@ if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera ) { - hpi->iQueue.Insert( aHD, 0 ); + hpi->iQueue.InsertL( aHD, 0 ); + if( !hpi->iPlugin->IsActive() ) { hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 1 ); @@ -328,11 +288,9 @@ pluginInfo->iPluginUid = aPluginUid; -#ifdef MDS_HARVESTERPLUGINS_ON_BOOT pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid ); pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue ); pluginInfo->iPlugin->SetHarvesterPluginFactory( *this ); -#endif iHarvesterPluginInfoArray.AppendL( pluginInfo ); CleanupStack::Pop( pluginInfo ); @@ -491,3 +449,54 @@ } } +EXPORT_C void CHarvesterPluginFactory::GetObjectDefL( CHarvesterData* aHD, TDes& aObjectDef ) + { + TPtrC extPtr; + if( MdsUtils::GetExt( aHD->Uri(), extPtr ) ) + { + RPointerArray supportedPlugins; + CleanupClosePushL( supportedPlugins ); + GetSupportedPluginsL( supportedPlugins, extPtr ); + + const TInt sCount = supportedPlugins.Count(); + if( sCount == 1 ) + { + CHarvesterPluginInfo* info = supportedPlugins[0]; + if( info->iObjectTypes.Count() == 1 ) + { + aObjectDef.Copy( *(info->iObjectTypes[0]) ); + aHD->SetHarvesterPluginInfo( info ); + CleanupStack::PopAndDestroy( &supportedPlugins ); + return; + } + } + for( TInt i = sCount - 1; i >=0; i-- ) + { + CHarvesterPluginInfo* info = supportedPlugins[i]; + if ( !(info->iPlugin) ) + { + info->iPlugin = CHarvesterPlugin::NewL( info->iPluginUid ); + info->iPlugin->SetQueue( info->iQueue ); + info->iPlugin->SetHarvesterPluginFactory( *this ); + info->iPlugin->SetBlacklist( *iBlacklist ); + } + info->iPlugin->GetObjectType( aHD->Uri(), aObjectDef ); + if( aHD && aObjectDef.Length() > 0 ) + { + aHD->SetHarvesterPluginInfo( info ); + break; + } + else if( !aHD ) + { + break; + } + } + CleanupStack::PopAndDestroy( &supportedPlugins ); + } + else + { + aObjectDef.Zero(); + } + } + + diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/placeholderdata.cpp --- a/harvester/common/src/placeholderdata.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/placeholderdata.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -50,6 +50,7 @@ CPlaceholderData::~CPlaceholderData() { delete iUri; + iUri = NULL; } //========================================================================== @@ -86,6 +87,7 @@ EXPORT_C void CPlaceholderData::SetUri( const TDesC& aUri ) { delete iUri; + iUri = NULL; iUri = aUri.Alloc(); } diff -r 63c982fb92f2 -r b73252188534 harvester/common/src/propertywatcher.cpp --- a/harvester/common/src/propertywatcher.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/src/propertywatcher.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -66,6 +66,7 @@ if ( me ) { delete me; + me = NULL; Dll::SetTls( NULL ); // Free TLS. } diff -r 63c982fb92f2 -r b73252188534 harvester/common/traces/OstTraceDefinitions.h --- a/harvester/common/traces/OstTraceDefinitions.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/common/traces/OstTraceDefinitions.h Thu Aug 19 10:20:41 2010 +0300 @@ -3,5 +3,5 @@ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r 63c982fb92f2 -r b73252188534 harvester/composerplugins/composerplugininterface/group/composerplugininterface.mmp --- a/harvester/composerplugins/composerplugininterface/group/composerplugininterface.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/composerplugins/composerplugininterface/group/composerplugininterface.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -39,7 +39,7 @@ #if defined(WINS) deffile ../bwincw/composerplugininterfacewinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/composerplugininterfacearm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/composerplugins/imagecomposer/inc/imagecomposerao.h --- a/harvester/composerplugins/imagecomposer/inc/imagecomposerao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/composerplugins/imagecomposer/inc/imagecomposerao.h Thu Aug 19 10:20:41 2010 +0300 @@ -267,6 +267,8 @@ CHarvesterExifUtil* iExifUtil; RFs iFs; + + TBool iFastModeEnabled; }; #endif // __CIMAGECOMPOSERAO_H__ diff -r 63c982fb92f2 -r b73252188534 harvester/composerplugins/imagecomposer/src/composerimageplugin.cpp --- a/harvester/composerplugins/imagecomposer/src/composerimageplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/composerplugins/imagecomposer/src/composerimageplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -48,10 +48,13 @@ WRITELOG( "CComposerImagePlugin::~CComposerImagePlugin()" ); delete iImageComposerAO; + iImageComposerAO = NULL; delete iLocationRelationObserver; + iLocationRelationObserver = NULL; delete iImagePresentObserver; - + iImagePresentObserver = NULL; delete iMdEHarvesterSession; + iMdEHarvesterSession = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp --- a/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -71,16 +71,20 @@ if ( iMdeObject ) { delete iMdeObject; + iMdeObject = NULL; } if ( iExifUtil ) { delete iExifUtil; + iExifUtil = NULL; } delete iRelationQuery; + iRelationQuery = NULL; iFs.Close(); delete iMdEHarvesterSession; + iMdEHarvesterSession = NULL; } // --------------------------------------------------------------------------- @@ -110,6 +114,7 @@ CActiveScheduler::Add( this ); iExifUtil = CHarvesterExifUtil::NewL(); + iFastModeEnabled = EFalse; User::LeaveIfError( iFs.Connect() ); } @@ -241,6 +246,10 @@ if( iItemQueue.Count() <= 0 ) { iItemQueue.Compress(); + if( iFastModeEnabled ) + { + SetPriority( KHarvesterPriorityComposerPlugin ); + } SetNextRequest( ERequestReady ); } else @@ -250,6 +259,20 @@ if ( err == KErrNone ) { + CMdEProperty* prop = NULL; + CMdEPropertyDef& originPropDef = iMdeObject->Def().GetPropertyDefL( Object::KOriginProperty ); + iMdeObject->Property( originPropDef, prop ); + if( prop && prop->Uint8ValueL() == MdeConstants::Object::ECamera && !iFastModeEnabled ) + { + iFastModeEnabled = ETrue; + SetPriority( KHarvesterPriorityMonitorPlugin ); + } + else if( iFastModeEnabled ) + { + iFastModeEnabled = EFalse; + SetPriority( KHarvesterPriorityComposerPlugin ); + } + SetNextRequest( ERequestCompose ); } // if object does not exists, find next @@ -746,8 +769,13 @@ // Check whether the file is open TBool isOpen( EFalse ); - iFs.IsFileOpen( uri, isOpen ); - if ( isOpen ) + const TInt openError = iFs.IsFileOpen( uri, isOpen ); + if( openError != KErrNone ) + { + WRITELOG( "CImageComposerAO::DoWriteExifL() - check for open file failed!" ); + User::Leave( openError ); + } + else if ( isOpen ) { WRITELOG( "CImageComposerAO::DoWriteExifL() - file handle is open!" ); User::Leave( KErrInUse ); diff -r 63c982fb92f2 -r b73252188534 harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp --- a/harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/composerplugins/imagecomposer/src/locationrelationobserver.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -47,6 +47,7 @@ { iQuery->Cancel(); delete iQuery; + iQuery = NULL; } } @@ -208,6 +209,7 @@ } delete relation; + relation = NULL; } ) } diff -r 63c982fb92f2 -r b73252188534 harvester/data/default_origin_mappings.db --- a/harvester/data/default_origin_mappings.db Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/data/default_origin_mappings.db Thu Aug 19 10:20:41 2010 +0300 @@ -8,9 +8,9 @@ 101FFA86 1 2000D16B 1 10208A6D 1 -101f857a 1 -10003a3f 2 -101f4d90 2 +101F857A 1 +10003A3F 2 +101F4D90 2 1028242D 2 1028242E 2 101FFB51 2 @@ -29,11 +29,12 @@ 10281FA7 4 10281FA5 4 10281FA6 4 +101FFC31 253 101FFA91 254 20026F35 254 20026F2F 254 200009F5 255 2000A7AE 255 200071BE 255 -101f7771 255 -1020e519 255 +101F7771 255 +1020E519 255 diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h --- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -66,10 +66,11 @@ private: CHarvesterAudioPluginPropertyDefs(); - void ConstructL(CMdEObjectDef& aObjectDef); + void ConstructL( CMdEObjectDef& aObjectDef ); public: - static CHarvesterAudioPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterAudioPluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef ); }; class CHarvesterAudioPlugin : public CHarvesterPlugin, @@ -148,6 +149,8 @@ */ void GetMusicPropertiesL( CHarvesterData* aHD, TBool aIsAdd, TPtrC aMimeType ); + void InitPropDefsL( CMdEObjectDef& aObjectDef ); + private: CAudioMDParser* iAudioParser; diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -37,52 +37,55 @@ const TUid KHarvesterRepoUid = { 0x200009FE }; const TUint32 KEnableAlbumArtHarvest = 0x00090001; -CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase() +CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } void CHarvesterAudioPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) { - CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); + SetByObjectDefL( aObjectDef ); + } + +CHarvesterAudioPluginPropertyDefs* CHarvesterAudioPluginPropertyDefs::NewL() + { + CHarvesterAudioPluginPropertyDefs* self = + new (ELeave) CHarvesterAudioPluginPropertyDefs(); + return self; + } - // Common property definitions - CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject ); - iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); - iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); - iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); - iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); - iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); +void CHarvesterAudioPluginPropertyDefs::SetByObjectDefL(CMdEObjectDef& aObjectDef) + { + CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); + + // Common property definitions + CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject ); + iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); + iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty ); iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ); - // Media property definitions - CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); - iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty ); - iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); - iArtistPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); - iDurationPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDurationProperty ); - iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KCopyrightProperty ); - iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty ); - iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty ); - iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty ); + // Media property definitions + CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); + iRatingPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KRatingProperty ); + iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); + iArtistPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); + iDurationPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDurationProperty ); + iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KCopyrightProperty ); + iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty ); + iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty ); + iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty ); iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty ); - // Audio property definitions - CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject ); - iAlbumPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); - iComposerPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); - iOriginalArtistPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KOriginalArtistProperty ); - } - -CHarvesterAudioPluginPropertyDefs* CHarvesterAudioPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterAudioPluginPropertyDefs* self = - new (ELeave) CHarvesterAudioPluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } + // Audio property definitions + CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + iAlbumPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); + iComposerPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); + iOriginalArtistPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KOriginalArtistProperty ); + } using namespace MdeConstants; @@ -119,11 +122,16 @@ WRITELOG( "CHarvesterAudioPlugin::~CHarvesterAudioPlugin()" ); delete iAudioParser; + iAudioParser = NULL; delete iPropDefs; + iPropDefs = NULL; delete iTNM; + iTNM = NULL; delete iPhoneSoundsPath; + iPhoneSoundsPath = NULL; delete iMmcSoundsPath; + iMmcSoundsPath = NULL; } // --------------------------------------------------------------------------- @@ -145,6 +153,8 @@ { TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) ); } + + iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL(); SetPriority( KHarvesterPriorityHarvestingPlugin - 2 ); @@ -289,13 +299,7 @@ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); TTime localModifiedDate = entry.iModified + timeOffsetSeconds; - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + InitPropDefsL( mdeObject.Def() ); CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd ); @@ -324,13 +328,7 @@ if ( mapping && !mdeObject.Placeholder() ) { - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + InitPropDefsL( mdeObject.Def() ); CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iItemTypePropertyDef, (TAny*)&(mapping->iMimeType), aIsAdd ); @@ -356,13 +354,7 @@ CMdEObject& mdeObject = aHD->MdeObject(); const TDesC& uri = mdeObject.Uri(); - if( !iPropDefs ) - { - CMdEObjectDef& audioObjectDef = mdeObject.Def(); - iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + InitPropDefsL( mdeObject.Def() ); TBool possiblyProtectedContent( EFalse ); if( aMimeType.Length() > 0 ) @@ -536,6 +528,7 @@ CleanupStack::Pop(); // jpegBuf iTNM->CreateThumbnails( *tnmSource ); delete tnmSource; + tnmSource = NULL; TBool thumbnailPresent( ETrue ); CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iThumbnailPropertyDef, &thumbnailPresent, aIsAdd ); @@ -555,5 +548,15 @@ #endif } +void CHarvesterAudioPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); + } + } + // End of file diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -74,6 +74,7 @@ CAudioMDParser::~CAudioMDParser() { delete iMetaDataUtility; + iMetaDataUtility = NULL; iMimeTypeMappings.Close(); iWantedMetadataFields.Close(); diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h --- a/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -102,10 +102,11 @@ private: CHarvesterImagePluginPropertyDefs(); - void ConstructL(CMdEObjectDef& aObjectDef); + void ConstructL( CMdEObjectDef& aObjectDef ); public: - static CHarvesterImagePluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterImagePluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef) ; }; class CHarvesterImagePlugin : public CHarvesterPlugin @@ -168,7 +169,9 @@ // 2nd phase constructor void ConstructL(); - + + void InitPropDefsL( CMdEObjectDef& aObjectDef ); + private: enum TImageMetadataHandling diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp --- a/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -69,87 +69,90 @@ const TUid KBGPSUid = { 0x0ADC2480 }; #endif -CHarvesterImagePluginPropertyDefs::CHarvesterImagePluginPropertyDefs() : CBase() +CHarvesterImagePluginPropertyDefs::CHarvesterImagePluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } -void CHarvesterImagePluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) +void CHarvesterImagePluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef ) { - CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); - - // Image property definitions - CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject ); - iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty ); - iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); - iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty ); - iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty ); - iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty ); - iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder ); - - // Media property definitions - CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject ); - iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty ); - iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty ); - iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); - iCommentPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCommentProperty ); - iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty ); - iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty ); - iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty ); - iResolutionUnitPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KResolutionUnitProperty ); - iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty ); - - // Image property definitions - CMdEObjectDef& imageDef = nsDef.GetObjectDefL( Image::KImageObject ); - iPixelYDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelYDimensionProperty ); - iPixelXDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelXDimensionProperty ); - iBitsPerSamplePropertyDef = &imageDef.GetPropertyDefL( Image::KBitsPerSampleProperty ); - iFrameCountPropertyDef = &imageDef.GetPropertyDefL( Image::KFrameCountProperty ); - iDateTimeOriginalPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeOriginalProperty ); - iDateTimeDigitizedPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeDigitizedProperty ); - iDateTimePropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeProperty ); - iWhiteBalancePropertyDef = &imageDef.GetPropertyDefL( Image::KWhiteBalanceProperty ); - iFlashPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashProperty ); - iExposureProgramPropertyDef = &imageDef.GetPropertyDefL( Image::KExposureProgramProperty ); - iMakePropertyDef = &imageDef.GetPropertyDefL( Image::KMakeProperty ); - iModelPropertyDef = &imageDef.GetPropertyDefL( Image::KModelProperty ); - iOrientationPropertyDef = &imageDef.GetPropertyDefL( Image::KOrientationProperty ); - iXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KXResolutionProperty ); - iYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KYResolutionProperty ); - iYCbCrPositioningPropertyDef = &imageDef.GetPropertyDefL( Image::KYCbCrPositioningProperty ); - iExposureTimePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureTimeProperty ); - iFNumberPropertyDef = &imageDef.GetPropertyDefL( Image::KFNumberProperty ); - iExifVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KExifVersionProperty ); - iShutterSpeedValuePropertyDef = &imageDef.GetPropertyDefL( Image::KShutterSpeedValueProperty ); - iApertureValuePropertyDef = &imageDef.GetPropertyDefL( Image::KApertureValueProperty ); - iFocalLengthPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthProperty ); - iFlashPixVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashPixVersionProperty ); - iColourSpacePropertyDef = &imageDef.GetPropertyDefL( Image::KColourSpaceProperty ); - iISOSpeedRatingsPropertyDef = &imageDef.GetPropertyDefL( Image::KISOSpeedRatingsProperty ); - iComponentsConfigurationPropertyDef = &imageDef.GetPropertyDefL( Image::KComponentsConfigurationProperty ); - iExposureBiasValuePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureBiasValueProperty ); - iSamplesPerPixelPropertyDef = &imageDef.GetPropertyDefL( Image::KSamplesPerPixelProperty ); - iThumbCompressionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbCompressionProperty ); - iThumbXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbXResolutionProperty ); - iThumbYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbYResolutionProperty ); - iThumbResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbResolutionUnitProperty ); - iFocalLengthIn35mmFilmPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthIn35mmFilmProperty ); - iMeteringModePropertyDef = &imageDef.GetPropertyDefL( Image::KMeteringModeProperty ); - iRelatedSoundFilePropertyDef = &imageDef.GetPropertyDefL( Image::KRelatedSoundFileProperty ); - iFocalPlaneResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneResolutionUnitProperty ); - iFocalPlaneXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneXResolutionProperty ); - iFocalPlaneYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneYResolutionProperty ); - iDraftPropertyDef = &imageDef.GetPropertyDefL( Image::KDraftProperty ); + SetByObjectDefL( aObjectDef ); } -CHarvesterImagePluginPropertyDefs* CHarvesterImagePluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterImagePluginPropertyDefs* self = - new (ELeave) CHarvesterImagePluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } +CHarvesterImagePluginPropertyDefs* CHarvesterImagePluginPropertyDefs::NewL() + { + CHarvesterImagePluginPropertyDefs* self = + new (ELeave) CHarvesterImagePluginPropertyDefs(); + return self; + } + +void CHarvesterImagePluginPropertyDefs::SetByObjectDefL(CMdEObjectDef& aObjectDef) + { + CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); + + // Image property definitions + CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject ); + iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty ); + iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); + iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty ); + iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty ); + iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty ); + iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder ); + + // Media property definitions + CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject ); + iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty ); + iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty ); + iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); + iCommentPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCommentProperty ); + iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty ); + iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty ); + iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty ); + iResolutionUnitPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KResolutionUnitProperty ); + iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty ); + + // Image property definitions + CMdEObjectDef& imageDef = nsDef.GetObjectDefL( Image::KImageObject ); + iPixelYDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelYDimensionProperty ); + iPixelXDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelXDimensionProperty ); + iBitsPerSamplePropertyDef = &imageDef.GetPropertyDefL( Image::KBitsPerSampleProperty ); + iFrameCountPropertyDef = &imageDef.GetPropertyDefL( Image::KFrameCountProperty ); + iDateTimeOriginalPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeOriginalProperty ); + iDateTimeDigitizedPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeDigitizedProperty ); + iDateTimePropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeProperty ); + iWhiteBalancePropertyDef = &imageDef.GetPropertyDefL( Image::KWhiteBalanceProperty ); + iFlashPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashProperty ); + iExposureProgramPropertyDef = &imageDef.GetPropertyDefL( Image::KExposureProgramProperty ); + iMakePropertyDef = &imageDef.GetPropertyDefL( Image::KMakeProperty ); + iModelPropertyDef = &imageDef.GetPropertyDefL( Image::KModelProperty ); + iOrientationPropertyDef = &imageDef.GetPropertyDefL( Image::KOrientationProperty ); + iXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KXResolutionProperty ); + iYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KYResolutionProperty ); + iYCbCrPositioningPropertyDef = &imageDef.GetPropertyDefL( Image::KYCbCrPositioningProperty ); + iExposureTimePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureTimeProperty ); + iFNumberPropertyDef = &imageDef.GetPropertyDefL( Image::KFNumberProperty ); + iExifVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KExifVersionProperty ); + iShutterSpeedValuePropertyDef = &imageDef.GetPropertyDefL( Image::KShutterSpeedValueProperty ); + iApertureValuePropertyDef = &imageDef.GetPropertyDefL( Image::KApertureValueProperty ); + iFocalLengthPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthProperty ); + iFlashPixVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashPixVersionProperty ); + iColourSpacePropertyDef = &imageDef.GetPropertyDefL( Image::KColourSpaceProperty ); + iISOSpeedRatingsPropertyDef = &imageDef.GetPropertyDefL( Image::KISOSpeedRatingsProperty ); + iComponentsConfigurationPropertyDef = &imageDef.GetPropertyDefL( Image::KComponentsConfigurationProperty ); + iExposureBiasValuePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureBiasValueProperty ); + iSamplesPerPixelPropertyDef = &imageDef.GetPropertyDefL( Image::KSamplesPerPixelProperty ); + iThumbCompressionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbCompressionProperty ); + iThumbXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbXResolutionProperty ); + iThumbYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbYResolutionProperty ); + iThumbResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbResolutionUnitProperty ); + iFocalLengthIn35mmFilmPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthIn35mmFilmProperty ); + iMeteringModePropertyDef = &imageDef.GetPropertyDefL( Image::KMeteringModeProperty ); + iRelatedSoundFilePropertyDef = &imageDef.GetPropertyDefL( Image::KRelatedSoundFileProperty ); + iFocalPlaneResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneResolutionUnitProperty ); + iFocalPlaneXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneXResolutionProperty ); + iFocalPlaneYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneYResolutionProperty ); + iDraftPropertyDef = &imageDef.GetPropertyDefL( Image::KDraftProperty ); + } /** * Default constructor @@ -185,17 +188,22 @@ { iDecoder->Reset(); delete iDecoder; + iDecoder = NULL; } if (iExifUtil) { delete iExifUtil; + iExifUtil = NULL; } delete iPropDefs; + iPropDefs = NULL; delete iPhoneImagesPath; + iPhoneImagesPath = NULL; delete iMmcImagesPath; + iMmcImagesPath = NULL; iMimeTypeMappings.Close(); iFbs.Disconnect(); @@ -211,6 +219,8 @@ iExifUtil = CHarvesterExifUtil::NewL(); User::LeaveIfError( iFbs.Connect() ); + iPropDefs = CHarvesterImagePluginPropertyDefs::NewL(); + TLinearOrder< TMimeTypeMapping > cmp( TMimeTypeMapping::CompareFunction); @@ -396,13 +406,8 @@ { CMdEProperty* prop = NULL; CMdEObjectDef& objectDef = *aFileData.iImageDef; - - if( !iPropDefs ) - { - iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + + InitPropDefsL( objectDef ); aMetadataObject.Property( *iPropDefs->iSizePropertyDef, prop ); if( prop ) @@ -692,13 +697,8 @@ WRITELOG( "CHarvesterImagePlugin::HandleObjectPropertiesL() - New MdE object" ); CMdEObject& mdeObject = aHarvesterData.MdeObject(); - - if( !iPropDefs ) - { - iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( mdeObject.Def() ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + + InitPropDefsL( mdeObject.Def() ); TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); @@ -1084,3 +1084,14 @@ return KErrNotSupported; } + +void CHarvesterImagePlugin::InitPropDefsL( CMdEObjectDef& aObjectDef ) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); + } + } + diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp --- a/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -73,9 +73,13 @@ { WRITELOG("CHarvesterMessagePlugin::~CHarvesterMessagePlugin()"); delete iMmsMtm; + iMmsMtm = NULL; delete iSmsMtm; + iSmsMtm = NULL; delete iMtmReg; - delete iMsvSession; + iMtmReg = NULL; + delete iMsvSession; + iMsvSession = NULL; } /** diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp --- a/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -47,6 +47,7 @@ LIBRARY euser.lib LIBRARY efsrv.lib +LIBRARY imageconversion.lib LIBRARY caf.lib LIBRARY cafutils.lib LIBRARY harvesterplugininterface.lib diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h --- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -18,13 +18,17 @@ #ifndef __CHARVESTEROMADRMPLUGIN_H__ #define __CHARVESTEROMADRMPLUGIN_H__ +#include #include #include -#include "harvesterplugin.h" +#include +#include +#include + // FORWARD DECLARATION -class CMdEObjectDef; -class CMdEObject; +class CFileData; +class CHarvestData; /** * A data transfer class for harvested drm metadata. @@ -84,14 +88,20 @@ CMdEPropertyDef* iAuthorPropertyDef; CMdEPropertyDef* iGenrePropertyDef; CMdEPropertyDef* iDefaultFolderPropertyDef; + CMdEPropertyDef* iWidthPropertyDef; + CMdEPropertyDef* iHeightPropertyDef; + // Image property definitions + CMdEPropertyDef* iFrameCountPropertyDef; + CMdEPropertyDef* iBitsPerSamplePropertyDef; private: CHarvesterOmaDrmPluginPropertyDefs(); void ConstructL(CMdEObjectDef& aObjectDef); public: - static CHarvesterOmaDrmPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterOmaDrmPluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef) ; }; class CHarvesterOMADRMPlugin : public CHarvesterPlugin @@ -126,35 +136,62 @@ private: /** + * Gathers data from file to meta data object. + * + * @param aMetadataObject A reference to meta data object to gather the data. + * @param aDRMharvestData + * @param aFileData + * @param aHarvestData + */ + TInt GatherDataL( CMdEObject& aMetadataObject, CDRMHarvestData& aDRMharvestData, + CFileData& aFileData, CHarvestData& aHarvestData ); + + + + /** + * C++ constructor - not exported; * implicitly called from NewL() * * @return an instance of CHarvesterOMADRMPlugin. */ - CHarvesterOMADRMPlugin(); + + /** + * Handle addition of new mde video objects. + * + * @param aMetadataObject A reference to meta data object to gather the data. + * @param aDRMharvestData + * @param aFileData + * @param aHarvestData + */ + void HandleObjectPropertiesL( CHarvestData& aHarvestData, CDRMHarvestData& aDRMharvestData, CFileData& aFileData, + CHarvesterData& aHarvesterData, TBool aIsAdd ); - /** - * 2nd phase construction, called by NewLC() + // Default constructor + CHarvesterOMADRMPlugin(); + /** + * 2nd phase construction, called by NewLC() */ void ConstructL(); - /** - * Gathers data from file to meta data object. - * - * @param aMetadataObject A reference to meta data object to gather the data. - * @param aHarvestData An object to store harvested video file data. - */ - void GatherDataL( CMdEObject& aMetadataObject, CDRMHarvestData& aHarvestData ); + void InitPropDefsL( CMdEObjectDef& aObjectDef ); + + protected: + /** + * Handle to File server session. + */ + RFs iFs; + + private: + /** + * image decoder + */ + + - /** - * Handle addition of new mde video objects. - * - * @param aMetadataObject A reference to meta data object to gather the data. - * @param aHarvestData An object containing harvested video file data. - */ - void HandleObjectPropertiesL( CHarvesterData& aHD, CDRMHarvestData& aVHD, TBool aIsAdd ); + - private: + CHarvesterOmaDrmPluginPropertyDefs* iPropDefs; TInt iMaxTextLength; @@ -167,6 +204,7 @@ HBufC* iPhoneSoundsPath; HBufC* iMmcSoundsPath; + }; #endif // __CHarvesterOMADRMPlugin_H__ diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp --- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -20,6 +20,7 @@ #include #include "mdsutils.h" +#include "harvesterexifutil.h" #include "harvesteromadrmplugin.h" #include "harvesterlog.h" #include "harvestercommon.h" @@ -33,6 +34,9 @@ #include #include #include +#include + +using namespace MdeConstants; _LIT(KImage, "Image"); _LIT(KVideo, "Video"); @@ -44,11 +48,24 @@ _LIT(KInUse, "InUse"); -CHarvesterOmaDrmPluginPropertyDefs::CHarvesterOmaDrmPluginPropertyDefs() : CBase() +CHarvesterOmaDrmPluginPropertyDefs::CHarvesterOmaDrmPluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } -void CHarvesterOmaDrmPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) +void CHarvesterOmaDrmPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef ) + { + SetByObjectDefL( aObjectDef ); + } + +CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL() + { + CHarvesterOmaDrmPluginPropertyDefs* self = + new (ELeave) CHarvesterOmaDrmPluginPropertyDefs(); + return self; + } + +void CHarvesterOmaDrmPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef ) { CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); @@ -65,17 +82,16 @@ iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty ); iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty ); iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty ); - iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); - } + + // Media property definitions + iWidthPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KWidthProperty ); + iHeightPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KHeightProperty ); -CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterOmaDrmPluginPropertyDefs* self = - new (ELeave) CHarvesterOmaDrmPluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; + // Image property definitions + CMdEObjectDef& imageDef = nsDef.GetObjectDefL( MdeConstants::Image::KImageObject ); + iBitsPerSamplePropertyDef = &imageDef.GetPropertyDefL( MdeConstants::Image::KBitsPerSampleProperty ); + iFrameCountPropertyDef = &imageDef.GetPropertyDefL( MdeConstants::Image::KFrameCountProperty ); + iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); } /** @@ -108,16 +124,25 @@ { WRITELOG("CHarvesterOMADRMPlugin::~CHarvesterOMADRMPlugin()"); + iFs.Close(); + + delete iPropDefs; + iPropDefs = NULL; + delete iPhoneImagesPath; + iPhoneImagesPath = NULL; delete iMmcImagesPath; + iMmcImagesPath = NULL; delete iPhoneVideosPath; + iPhoneVideosPath = NULL; delete iMmcVideosPath; + iMmcVideosPath = NULL; delete iPhoneSoundsPath; + iPhoneSoundsPath = NULL; delete iMmcSoundsPath; - - delete iPropDefs; + iMmcSoundsPath = NULL; } /** @@ -127,7 +152,11 @@ { WRITELOG( "CHarvesterOMADRMPlugin::ConstructL()" ); SetPriority( KHarvesterPriorityHarvestingPlugin - 1 ); + + User::LeaveIfError( iFs.Connect() ); + iPropDefs = CHarvesterOmaDrmPluginPropertyDefs::NewL(); + TFileName phoneRoot = PathInfo::PhoneMemoryRootPath(); TFileName mmcRoot = PathInfo::MemoryCardRootPath(); @@ -162,25 +191,33 @@ iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL(); } -void CHarvesterOMADRMPlugin::HarvestL( CHarvesterData* aHD ) +void CHarvesterOMADRMPlugin::HarvestL( CHarvesterData* aHarvesterData ) { - CMdEObject& mdeObject = aHD->MdeObject(); - CDRMHarvestData* fileData = CDRMHarvestData::NewL(); + WRITELOG( "CHarvesterImagePlugin::HarvestL()" ); + CMdEObject& mdeObject = aHarvesterData->MdeObject(); + CDRMHarvestData* drmHarvestData = CDRMHarvestData::NewL(); + CleanupStack::PushL( drmHarvestData ); + + CFileData* fileData = CFileData::NewL(); CleanupStack::PushL( fileData ); - TRAPD( error, GatherDataL( mdeObject, *fileData ) ); - if ( error == KErrNone || error == KErrCompletion ) - { - TBool isNewObject( mdeObject.Id() == 0 ); + CHarvestData* harvestData = CHarvestData::NewL(); + CleanupStack::PushL( harvestData ); - if ( isNewObject || mdeObject.Placeholder() ) + TInt errorCode( KErrNone ); + + TRAPD( error, errorCode = GatherDataL( mdeObject, *drmHarvestData, *fileData, *harvestData ) ); + + if ( error == KErrNone && (errorCode == KErrNone || errorCode == KErrCompletion ) ) // ok, something got harvested + { + if ( mdeObject.Id() == 0 || mdeObject.Placeholder() ) // is a new object or placeholder { - TRAP( error, HandleObjectPropertiesL( *aHD, *fileData, ETrue ) ); + TRAP_IGNORE( HandleObjectPropertiesL( *harvestData, *drmHarvestData, *fileData, *aHarvesterData, ETrue ) ); mdeObject.SetPlaceholder( EFalse ); } - else + else // not a new object { - TRAP( error, HandleObjectPropertiesL( *aHD, *fileData, EFalse ) ); + TRAP_IGNORE( HandleObjectPropertiesL( *harvestData, *drmHarvestData, *fileData, *aHarvesterData, EFalse ) ); } if ( error != KErrNone ) @@ -190,21 +227,21 @@ } else { - WRITELOG1( "CHarvesterOMADRMPlugin::HarvestL() - TRAP error: %d", error ); + WRITELOG1( "CHarvesterOMADRMPlugin::HarvestL() - TRAP error: %d, errorCode %d", error ); TInt convertedError = KErrNone; MdsUtils::ConvertTrapError( error, convertedError ); - aHD->SetErrorCode( convertedError ); + aHarvesterData->SetErrorCode( convertedError ); } - CleanupStack::PopAndDestroy( fileData ); + CleanupStack::PopAndDestroy( 3, drmHarvestData ); } // --------------------------------------------------------------------------- // GatherDataL // --------------------------------------------------------------------------- // -void CHarvesterOMADRMPlugin::GatherDataL( CMdEObject& aMetadataObject, - CDRMHarvestData& aVHD ) +TInt CHarvesterOMADRMPlugin::GatherDataL( CMdEObject& aMetadataObject, CDRMHarvestData& aDRMharvestData, + CFileData& aFileData, CHarvestData& /*aHarvestData*/ ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL" ); @@ -214,8 +251,8 @@ const TDesC& uri = aMetadataObject.Uri(); User::LeaveIfError( iFs.Entry( uri, *entry ) ); - aVHD.iModified = entry->iModified; - aVHD.iFileSize = (TUint)entry->iSize; + aDRMharvestData.iModified = entry->iModified; + aDRMharvestData.iFileSize = (TUint)entry->iSize; CleanupStack::PopAndDestroy( entry ); ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri ); @@ -232,106 +269,126 @@ User::LeaveIfError( data->GetStringAttributeSet(attrSet) ); - TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription ); + TInt err = attrSet.GetValue( ContentAccess::EDescription, aDRMharvestData.iDescription ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting description failed %d", err ); } - if ( aVHD.iDescription.Length() <= 0 ) + if ( aDRMharvestData.iDescription.Length() <= 0 ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no description" ); } - err = attrSet.GetValue( ContentAccess::EMimeType, aVHD.iMimetype ); + err = attrSet.GetValue( ContentAccess::EMimeType, aDRMharvestData.iMimetype ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting mimetype failed %d", err ); } - if ( aVHD.iMimetype.Length() <= 0 ) + if ( aDRMharvestData.iMimetype.Length() <= 0 ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no mimetype" ); } - err = attrSet.GetValue( ContentAccess::ETitle, aVHD.iTitle ); + err = attrSet.GetValue( ContentAccess::ETitle, aDRMharvestData.iTitle ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting title failed %d", err ); } - if ( aVHD.iTitle.Length() <= 0 ) + if ( aDRMharvestData.iTitle.Length() <= 0 ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no title" ); } - err = attrSet.GetValue( ContentAccess::EAuthor, aVHD.iAuthor ); + err = attrSet.GetValue( ContentAccess::EAuthor, aDRMharvestData.iAuthor ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting author failed %d", err ); } - if ( aVHD.iAuthor.Length() <= 0 ) + if ( aDRMharvestData.iAuthor.Length() <= 0 ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" ); } - err = attrSet.GetValue( ContentAccess::EGenre, aVHD.iGenre ); + err = attrSet.GetValue( ContentAccess::EGenre, aDRMharvestData.iGenre ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting genre failed %d", err ); } - if ( aVHD.iGenre.Length() <= 0 ) + if ( aDRMharvestData.iGenre.Length() <= 0 ) { WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no genre" ); } - err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected ); + err = content->GetAttribute( ContentAccess::EIsProtected, aDRMharvestData.iDrmProtected ); if ( err != KErrNone) { WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err ); } - - CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet + + CImageDecoder* decoder = NULL; + + TRAP( err, decoder = CImageDecoder::FileNewL( iFs, uri, ContentAccess::EPeek, + ( CImageDecoder::TOptions )( CImageDecoder::EPreferFastDecode ))); + + CleanupStack::PushL( decoder ); + + if(decoder && !err) + { + WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." ); + // Get image width, frame count, height and bits per pixel from image decoder. + const TFrameInfo info = decoder->FrameInfo( 0 ); + const TSize imageSize = info.iOverallSizeInPixels; + const TInt framecount = decoder->FrameCount(); + aFileData.iFrameCount = framecount; + aFileData.iImageWidth = imageSize.iWidth; + aFileData.iImageHeight = imageSize.iHeight; + aFileData.iBitsPerPixel = info.iBitsPerPixel; + } + else + { + WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: decoder %d", err ); + } + + CleanupStack::PopAndDestroy( 4 ); // content, data, attrSet, imagedecoder + return KErrNone; } // --------------------------------------------------------------------------- // HandleObjectPropertiesL // --------------------------------------------------------------------------- // -void CHarvesterOMADRMPlugin::HandleObjectPropertiesL( - CHarvesterData& aHD, - CDRMHarvestData& aVHD, - TBool aIsAdd ) +void CHarvesterOMADRMPlugin::HandleObjectPropertiesL( CHarvestData& /*aHarvestData*/, CDRMHarvestData& aDRMharvestData, CFileData& aFileData, + CHarvesterData& aHarvesterData, TBool aIsAdd ) { WRITELOG("CHarvesterOMADRMPlugin - HandleNewObject "); - CMdEObject& mdeObject = aHD.MdeObject(); + CMdEObject& mdeObject = aHarvesterData.MdeObject(); - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterOmaDrmPluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); - } + InitPropDefsL( mdeObject.Def() ); TTimeIntervalSeconds timeOffset = User::UTCOffset(); + TPtrC objectDefName( mdeObject.Def().Name()); + if( ! mdeObject.Placeholder() ) { // Creation date - TTime localTime = aVHD.iModified + timeOffset; + TTime localTime = aDRMharvestData.iModified + timeOffset; CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &localTime, aIsAdd ); // Last modified date CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iLastModifiedDatePropertyDef, &aVHD.iModified, aIsAdd ); + *iPropDefs->iLastModifiedDatePropertyDef, &aDRMharvestData.iModified, aIsAdd ); // File size CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd ); + *iPropDefs->iSizePropertyDef, &aDRMharvestData.iFileSize, aIsAdd ); - TPtrC objectDefName( mdeObject.Def().Name() ); + TPtrC objectDefName( mdeObject.Def().Name()); + if( objectDefName == MdeConstants::Image::KImageObject ) { const TDesC& uri = mdeObject.Uri(); @@ -382,7 +439,7 @@ } // Item Type - if(aVHD.iMimetype.Length() > 0) + if(aDRMharvestData.iMimetype.Length() > 0) { TBool isAdd( EFalse ); CMdEProperty* prop = NULL; @@ -392,36 +449,59 @@ isAdd = ETrue; } CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iItemTypePropertyDef, &aVHD.iMimetype, isAdd ); + *iPropDefs->iItemTypePropertyDef, &aDRMharvestData.iMimetype, isAdd ); } // DRM protection CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd ); + *iPropDefs->iDrmPropertyDef, &aDRMharvestData.iDrmProtected, aIsAdd ); // Title (is set from URI by default) - if( aVHD.iTitle.Length() > 0 && aVHD.iTitle.Length() < KMaxTitleFieldLength ) + if( aDRMharvestData.iTitle.Length() > 0 && aDRMharvestData.iTitle.Length() < KMaxTitleFieldLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iTitlePropertyDef, &aVHD.iTitle, EFalse ); + *iPropDefs->iTitlePropertyDef, &aDRMharvestData.iTitle, EFalse ); } // Description - if( aVHD.iDescription.Length() > 0 && aVHD.iDescription.Length() < iMaxTextLength ) + if( aDRMharvestData.iDescription.Length() > 0 && aDRMharvestData.iDescription.Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, + *iPropDefs->iDescriptionPropertyDef, &aDRMharvestData.iDescription, aIsAdd ); + } + // Author + if( aDRMharvestData.iAuthor.Length() > 0 && aDRMharvestData.iAuthor.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iDescriptionPropertyDef, &aVHD.iDescription, aIsAdd ); - } - // Author - if( aVHD.iAuthor.Length() > 0 && aVHD.iAuthor.Length() < iMaxTextLength ) - { - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd ); + *iPropDefs->iAuthorPropertyDef, &aDRMharvestData.iAuthor, aIsAdd ); } // Genre - if( aVHD.iGenre.Length() > 0 && aVHD.iGenre.Length() < iMaxTextLength ) + if( aDRMharvestData.iGenre.Length() > 0 && aDRMharvestData.iGenre.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, - *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd ); + *iPropDefs->iGenrePropertyDef, &aDRMharvestData.iGenre, aIsAdd ); + } + + if( objectDefName == MdeConstants::Image::KImageObject ) + { + // Image - Bits per Sample + if (aFileData.iBitsPerPixel != 0) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitsPerSamplePropertyDef, &aFileData.iBitsPerPixel, aIsAdd ); + } + + // Image - Framecount + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFrameCountPropertyDef, &aFileData.iFrameCount, aIsAdd ); + + // MediaObject - Width + if (aFileData.iImageWidth != 0) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWidthPropertyDef, &aFileData.iImageWidth, aIsAdd ); + } + + if (aFileData.iImageHeight != 0) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iHeightPropertyDef, &aFileData.iImageHeight, aIsAdd ); + } } } @@ -439,6 +519,7 @@ { err = content->GetStringAttribute( ContentAccess::EMimeType, mime ); delete content; + content = NULL; } #ifdef _DEBUG @@ -559,6 +640,17 @@ { err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType ); delete content; + content = NULL; } } +void CHarvesterOMADRMPlugin::InitPropDefsL( CMdEObjectDef& aObjectDef ) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); + } + } + diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h --- a/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/RTPPlugin/inc/harvesterrtpplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -59,7 +59,8 @@ void ConstructL(CMdEObjectDef& aObjectDef); public: - static CHarvesterRtpPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterRtpPluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef) ; }; /** @@ -225,6 +226,8 @@ /** */ void HandleObjectPropertiesL( CHarvesterData& aHD, CHarvesterRtpClipDetails& aClipDetails, TBool aIsAdd); + + void InitPropDefsL( CMdEObjectDef& aObjectDef ); private: // data CHarvesterRtpPluginPropertyDefs* iPropDefs; diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/RTPPlugin/src/harvesterrtpmetadatareader.cpp --- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpmetadatareader.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpmetadatareader.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -46,6 +46,7 @@ { WRITELOG( "CHarvesterRtpMetaDataReader::~CHarvesterRtpMetaDataReader()" ); delete iMetaData; + iMetaData = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp --- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -35,11 +35,24 @@ // Enough size to recognize file and read metaheader const TInt KFileBufferSize( KMaxMetaHeaderLength ); -CHarvesterRtpPluginPropertyDefs::CHarvesterRtpPluginPropertyDefs() : CBase() +CHarvesterRtpPluginPropertyDefs::CHarvesterRtpPluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } -void CHarvesterRtpPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) +void CHarvesterRtpPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef ) + { + SetByObjectDefL( aObjectDef ); + } + +CHarvesterRtpPluginPropertyDefs* CHarvesterRtpPluginPropertyDefs::NewL() + { + CHarvesterRtpPluginPropertyDefs* self = + new (ELeave) CHarvesterRtpPluginPropertyDefs(); + return self; + } + +void CHarvesterRtpPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef ) { CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); @@ -61,16 +74,6 @@ iRecordingFlagsPropertyDef = &videoDef.GetPropertyDefL( MdeConstants::Video::KRecordingFlagsProperty ); } -CHarvesterRtpPluginPropertyDefs* CHarvesterRtpPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterRtpPluginPropertyDefs* self = - new (ELeave) CHarvesterRtpPluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } - // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -89,6 +92,7 @@ { WRITELOG( "CHarvesterRtpPlugin::ConstructL()" ); SetPriority( KHarvesterPriorityHarvestingPlugin - 1 ); + iPropDefs = CHarvesterRtpPluginPropertyDefs::NewL(); } // --------------------------------------------------------------------------- @@ -262,12 +266,8 @@ WRITELOG( "CHarvesterRtpPlugin::HandleObjectPropertiesL()" ); CMdEObject& mdeObject = aHD.MdeObject(); - - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterRtpPluginPropertyDefs::NewL( objectDef ); - } + + InitPropDefsL( mdeObject.Def() ); TTimeIntervalSeconds timeOffset = User::UTCOffset(); TTime localModifiedTime = aClipDetails.iModifiedDate + timeOffset; @@ -340,3 +340,13 @@ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iRecordingFlagsPropertyDef, &flags, aIsAdd ); } + +void CHarvesterRtpPlugin::InitPropDefsL( CMdEObjectDef& aObjectDef ) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + } + } + + diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h --- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -101,13 +101,20 @@ ~CVideoHarvestData() { delete iCopyright; + iCopyright = NULL; delete iAuthor; + iAuthor = NULL; delete iGenre; + iGenre = NULL; delete iPerformer; + iPerformer = NULL; delete iDescription; + iDescription = NULL; delete iTitle; + iTitle = NULL; delete iMimeBuf; + iMimeBuf = NULL; } }; @@ -155,7 +162,8 @@ void ConstructL(CMdEObjectDef& aObjectDef); public: - static CHarvesterVideoPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterVideoPluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef ); }; class CHarvesterVideoPlugin : public CHarvesterPlugin @@ -232,6 +240,8 @@ void CheckForCodecSupport( HBufC* aMimeBuffer, CVideoHarvestData& aVHD ); + void InitPropDefsL( CMdEObjectDef& aObjectDef ); + private: RArray iMimeTypeMappings; diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp --- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -85,58 +85,61 @@ const TInt KKiloBytes = 1024; const TReal32 KThousandReal = 1000.0; -CHarvesterVideoPluginPropertyDefs::CHarvesterVideoPluginPropertyDefs() : CBase() +CHarvesterVideoPluginPropertyDefs::CHarvesterVideoPluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } void CHarvesterVideoPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) { - CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); - - // Common property definitions - CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject ); - iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty ); - iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); - iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty ); - iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty ); - iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty ); - iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty ); - iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder ); - - CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject ); - iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty ); - iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty ); - iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty ); - iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty ); - iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty ); - iBitratePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KBitrateProperty ); - iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty ); - iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KAuthorProperty ); - iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty ); - iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty ); - iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); - iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty ); - - iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty ); - - // Video property definitions - CMdEObjectDef& videoDef = nsDef.GetObjectDefL( Video::KVideoObject ); - iFrameratePropertyDef = &videoDef.GetPropertyDefL( Video::KFramerateProperty ); - - // Audio property definitions - CMdEObjectDef& audioDef = nsDef.GetObjectDefL( Audio::KAudioObject ); - iSamplingFrequencyPropertyDef = &audioDef.GetPropertyDefL( Audio::KSamplingFrequencyProperty ); + SetByObjectDefL( aObjectDef ); } -CHarvesterVideoPluginPropertyDefs* CHarvesterVideoPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterVideoPluginPropertyDefs* self = - new (ELeave) CHarvesterVideoPluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } +CHarvesterVideoPluginPropertyDefs* CHarvesterVideoPluginPropertyDefs::NewL() + { + CHarvesterVideoPluginPropertyDefs* self = + new (ELeave) CHarvesterVideoPluginPropertyDefs(); + return self; + } + +void CHarvesterVideoPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef ) + { + CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); + + // Common property definitions + CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject ); + iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty ); + iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); + iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty ); + iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty ); + iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty ); + iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty ); + iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder ); + + CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject ); + iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty ); + iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty ); + iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty ); + iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty ); + iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty ); + iBitratePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KBitrateProperty ); + iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty ); + iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KAuthorProperty ); + iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty ); + iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty ); + iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); + iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty ); + + iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty ); + + // Video property definitions + CMdEObjectDef& videoDef = nsDef.GetObjectDefL( Video::KVideoObject ); + iFrameratePropertyDef = &videoDef.GetPropertyDefL( Video::KFramerateProperty ); + + // Audio property definitions + CMdEObjectDef& audioDef = nsDef.GetObjectDefL( Audio::KAudioObject ); + iSamplingFrequencyPropertyDef = &audioDef.GetPropertyDefL( Audio::KSamplingFrequencyProperty ); + } /** * Default constructor @@ -165,11 +168,14 @@ CHarvesterVideoPlugin::~CHarvesterVideoPlugin() { delete iPropDefs; + iPropDefs = NULL; iMimeTypeMappings.Close(); RMediaIdUtil::ReleaseInstance(); delete iPhoneVideosPath; + iPhoneVideosPath = NULL; delete iMmcVideosPath; + iMmcVideosPath = NULL; WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()"); } @@ -181,6 +187,8 @@ { WRITELOG( "CHarvesterVideoPlugin::ConstructL() - begin" ); + iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL(); + TLinearOrder< THarvestingHandling > cmp( THarvestingHandling::CompareFunction ); // MPEG4 @@ -548,22 +556,41 @@ if( !dataExtracted ) { - TEntry entry; - const TInt errorcode = iFs.Entry( uri, entry ); - - if ( errorcode != KErrNone ) + // If file could be opened, use file handle to fetch base data, otherwise + // attempt to fetch the data from TEntry + if( error == KErrNone ) + { + User::LeaveIfError( file.Modified( aVHD.iModified ) ); + User::LeaveIfError( file.Size( aVHD.iFileSize ) ); + } + else { - WRITELOG1( "CHarvesterVideoPlugin - Error getting entry: %d", errorcode ); - CleanupStack::PopAndDestroy( &file ); - User::Leave( errorcode ); + TEntry entry; + const TInt errorcode = iFs.Entry( uri, entry ); + + if ( errorcode != KErrNone ) + { + WRITELOG1( "CHarvesterVideoPlugin - Error getting entry: %d", errorcode ); + CleanupStack::PopAndDestroy( &file ); + User::Leave( errorcode ); + } + + aVHD.iModified = entry.iModified; + aVHD.iFileSize = (TUint)entry.iSize; } - aVHD.iModified = entry.iModified; - aVHD.iFileSize = (TUint)entry.iSize; - WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize ); } + aVHD.iVideoObject = aMetadataObject.Def().Name().Compare( KVideo ) == 0; + + if( error != KErrNone ) + { + WRITELOG1( "CHarvesterVideoPlugin - File open error: %d", error ); + CleanupStack::PopAndDestroy( &file ); + User::Leave( KErrCompletion ); + } + // now the minimum information has been harvested // from now on the harvested data should always be stored @@ -574,15 +601,6 @@ CleanupStack::PopAndDestroy( &file ); User::Leave( KErrNotFound ); } - - aVHD.iVideoObject = aMetadataObject.Def().Name().Compare( KVideo ) == 0; - - if( error != KErrNone ) - { - WRITELOG1( "CHarvesterVideoPlugin - File open error: %d", error ); - CleanupStack::PopAndDestroy( &file ); - User::Leave( KErrCompletion ); - } if ( mapping->iHandler.iLibrary == TVideoMetadataHandling::EHexilMetadataHandling ) { @@ -591,10 +609,10 @@ CleanupClosePushL( mimes ); TPtrC ext; - MdsUtils::GetExt( uri, ext ); + const TBool exists = MdsUtils::GetExt( uri, ext ); // Check for possibly protected content - if( ext.CompareF( KExtensionWmv ) == 0 ) + if( exists && ext.CompareF( KExtensionWmv ) == 0 ) { ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri ); ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek ); @@ -607,6 +625,9 @@ CleanupStack::PushL( helixMetadata ); TRAP( error, helixMetadata->OpenFileL( file ) ); + + // No need for the file handle anymore so closing it + file.Close(); if ( error == KErrNone ) { @@ -789,6 +810,7 @@ aVHD.iMimeBuf = mime.Alloc(); } + helixMetadata->ResetL(); CleanupStack::PopAndDestroy( helixMetadata ); // don't destory mime type pointers just clean array @@ -982,14 +1004,8 @@ WRITELOG("CHarvesterVideoPlugin::HandleObjectPropertiesL "); CMdEObject& mdeObject = aHD.MdeObject(); - - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); - } + + InitPropDefsL( mdeObject.Def() ); TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); TTime localModifiedDate = aVHD.iModified + timeOffsetSeconds; @@ -1217,9 +1233,6 @@ { TBool possibleVideo = EFalse; - CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL(); - CleanupStack::PushL( helixMetadata ); - TFileName tempName; TUint32 mediaId( 0 ); TInt blackListError( KErrNone ); @@ -1227,9 +1240,12 @@ blackListError = GetFileFullNameAndMediaId( aFile, tempName, mediaId ); if( blackListError == KErrNone ) { - AddFileToBlackList( tempName, mediaId ); + blackListError = AddFileToBlackList( tempName, mediaId ); } + CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL(); + CleanupStack::PushL( helixMetadata ); + TRAPD( err, helixMetadata->OpenFileL( aFile ) ); if( err == KErrNone ) @@ -1313,13 +1329,15 @@ { aType.Copy( KVideo ); } + + helixMetadata->ResetL(); + CleanupStack::PopAndDestroy( helixMetadata ); if( blackListError == KErrNone ) { RemoveFileFromBlackList( tempName, mediaId ); } - CleanupStack::PopAndDestroy( helixMetadata ); } TInt CHarvesterVideoPlugin::AddFileToBlackList( const TFileName& aFullName, const TUint32& aMediaId ) @@ -1331,7 +1349,7 @@ if( blackListError == KErrNone ) { WRITELOG( "CHarvesterVideoPlugin::AddFileToBlackList - Adding URI to blacklist" ); - iBlacklist->AddFile( aFullName, aMediaId, modified ); + blackListError = iBlacklist->AddFile( aFullName, aMediaId, modified ); } return blackListError; @@ -1429,5 +1447,15 @@ return; } +void CHarvesterVideoPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); + } + } + // End of file diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h --- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -55,7 +55,8 @@ void ConstructL(CMdEObjectDef& aObjectDef); public: - static CHarvesterWmvPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterWmvPluginPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef ); }; /** @@ -180,6 +181,7 @@ CHarvesterWmvClipDetails& aClipDetails, TBool aIsAdd); + void InitPropDefsL( CMdEObjectDef& aObjectDef ); private: // data CHarvesterWmvPluginPropertyDefs* iPropDefs; diff -r 63c982fb92f2 -r b73252188534 harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp --- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -31,11 +31,24 @@ #include "mdetextproperty.h" #include "mdeobjectwrapper.h" -CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase() +CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase(), + iCreationDatePropertyDef( NULL ) { } -void CHarvesterWmvPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) +void CHarvesterWmvPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef ) + { + SetByObjectDefL( aObjectDef ); + } + +CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL() + { + CHarvesterWmvPluginPropertyDefs* self = + new (ELeave) CHarvesterWmvPluginPropertyDefs(); + return self; + } + +void CHarvesterWmvPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef ) { CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); @@ -55,16 +68,6 @@ iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); } -CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterWmvPluginPropertyDefs* self = - new (ELeave) CHarvesterWmvPluginPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } - // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- @@ -89,9 +92,12 @@ { WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" ); delete iPropDefs; + iPropDefs = NULL; delete iPhoneVideosPath; + iPhoneVideosPath = NULL; delete iMmcVideosPath; + iMmcVideosPath = NULL; } // --------------------------------------------------------------------------- @@ -151,6 +157,7 @@ { err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType ); delete content; + content = NULL; } } @@ -170,6 +177,8 @@ { WRITELOG( "CHarvesterWMVPlugin::ConstructL()" ); + iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL(); + TFileName videos = PathInfo::VideosPath(); TFileName phonePath = PathInfo::PhoneMemoryRootPath(); @@ -294,13 +303,7 @@ CMdEObject& mdeObject = aHD.MdeObject(); - if( !iPropDefs ) - { - CMdEObjectDef& objectDef = mdeObject.Def(); - iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef ); - // Prefetch max text lengt for validity checking - iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); - } + InitPropDefsL( mdeObject.Def() ); if( ! mdeObject.Placeholder() ) { @@ -366,3 +369,13 @@ } } +void CHarvesterWMVPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef) + { + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( aObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); + } + } + diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/group/filemonitorplugin.mmp --- a/harvester/monitorplugins/fileplugin/group/filemonitorplugin.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/group/filemonitorplugin.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -59,6 +59,7 @@ LIBRARY harvesterdata.lib LIBRARY harvestercommon.lib LIBRARY centralrepository.lib +LIBRARY platformenv.lib OPTION ARMCC -O3 -OTime diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h --- a/harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/inc/fileeventhandlerao.h Thu Aug 19 10:20:41 2010 +0300 @@ -172,11 +172,13 @@ void ReadCacheSizeFromCenrepL(); /** - * Set MdE object's title with aNewUrl + * Update MDS objects data if needed */ void SetTitleL( CMdEObject* aOldObject, const TDesC& aNewUrl ); void SetModifiedTimeL( CMdEObject* aOldObject, const TDesC& aNewUrl ); + + void CheckDefaultFolderL( CMdEObject* aOldObject ); private: @@ -237,6 +239,16 @@ CMdEPropertyDef* iOriginPropertyDef; CMdEPropertyDef* iTitlePropertyDef; CMdEPropertyDef* iTimePropertyDef; + CMdEPropertyDef* iDefaultFolderPropertyDef; + + HBufC* iPhoneImagesPath; + HBufC* iMmcImagesPath; + + HBufC* iPhoneVideosPath; + HBufC* iMmcVideosPath; + + HBufC* iPhoneSoundsPath; + HBufC* iMmcSoundsPath; }; #endif // __FILEEVENTHANDLERAO_H__ diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp --- a/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -38,7 +38,9 @@ CRenameItem::~CRenameItem() { delete iOldName; + iOldName = NULL; delete iNewName; + iNewName = NULL; iFileEvents.ResetAndDestroy(); } @@ -63,9 +65,14 @@ { TMdsFSPStatus* event = NULL; event = new TMdsFSPStatus(aEvent); + if (event) { - iFileEvents.Append(event); + if(iFileEvents.Append(event) != KErrNone) + { + delete event; + event = NULL; + } } } @@ -157,7 +164,10 @@ iRenamedFolders.Remove(0); TRAP_IGNORE(currItem->HandleFileEventsL(iCFileEventHandlerAO)); delete currItem; + currItem = NULL; + SetNextRequest(ERenameStateIdle); + if (iRenamedFolders.Count() == 0) { iIsRunning = EFalse; diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp --- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -16,6 +16,7 @@ #include #include +#include #include "fileeventhandlerao.h" #include "harvesterlog.h" @@ -83,12 +84,46 @@ User::LeaveIfError( error ); TRAP( error, ReadCacheSizeFromCenrepL() ); + if ( error == KErrNone ) { iQueue.Reserve( iCacheSize ); } iEventArray = new (ELeave) CArrayFixSeg< TMdsFSPStatus >( KMaxEventsGranularity ); + + TFileName phoneRoot = PathInfo::PhoneMemoryRootPath(); + TFileName mmcRoot = PathInfo::MemoryCardRootPath(); + + TFileName images = PathInfo::ImagesPath(); + + TFileName phoneImagePath( phoneRoot ); + phoneImagePath.Append( images ); + iPhoneImagesPath = phoneImagePath.AllocL(); + + TFileName mmcImagePath( mmcRoot ); + mmcImagePath.Append( images ); + iMmcImagesPath = mmcImagePath.Right( mmcImagePath.Length() - 1 ).AllocL(); + + TFileName videos = PathInfo::VideosPath(); + + TFileName phoneVideoPath( phoneRoot ); + phoneVideoPath.Append( videos ); + iPhoneVideosPath = phoneVideoPath.AllocL(); + + TFileName mmcVideoPath( mmcRoot ); + mmcVideoPath.Append( videos ); + iMmcVideosPath = mmcVideoPath.Right( mmcVideoPath.Length() - 1 ).AllocL(); + + TFileName sounds = PathInfo::SoundsPath(); + + TFileName phoneSoundPath( phoneRoot ); + phoneSoundPath.Append( sounds ); + iPhoneSoundsPath = phoneSoundPath.AllocL(); + + TFileName mmcSoundPath( mmcRoot ); + mmcSoundPath.Append( sounds ); + iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL(); } // --------------------------------------------------------------------------- @@ -104,16 +139,37 @@ iFs.Close(); delete iMapper; + iMapper = NULL; + delete iMoveTimer; + iMoveTimer = NULL; + delete iFolderRenamer; + iFolderRenamer = NULL; delete iEventArray; + iEventArray = NULL; iQueue.ResetAndDestroy(); iQueue.Close(); iUriArray.ResetAndDestroy(); iUriArray.Close(); + + delete iPhoneImagesPath; + iPhoneImagesPath = NULL; + delete iMmcImagesPath; + iMmcImagesPath = NULL; + + delete iPhoneVideosPath; + iPhoneVideosPath = NULL; + delete iMmcVideosPath; + iMmcVideosPath = NULL; + + delete iPhoneSoundsPath; + iPhoneSoundsPath = NULL; + delete iMmcSoundsPath; + iMmcSoundsPath = NULL; } @@ -146,6 +202,7 @@ ResetEvent(); item->GetAsFspStatus(iEvent); delete item; + item = NULL; if( iEvent.iFileEventType == EMdsFileDeleted ) { @@ -243,6 +300,14 @@ WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName ); return; } + + if( (origin == KOriginIgnoreAttribsChanged || + origin == MdeConstants::Object::ECamera ) && + aEvent.iFileEventType == EMdsFileAttribsChanged ) + { + WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored attribs changed event for %S", &status.iFileName ); + return; + } } // ignore created file event if extension is not supported by any harverter plugin @@ -281,6 +346,7 @@ break; case EMdsFileModified: + case EMdsFileAttribsChanged: { WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - EmdsFileModified: %S", &status.iFileName ); ModifyL( status.iFileName, origin, fastHarvest ); @@ -441,6 +507,7 @@ newObject->Id() ); if ( removedId != KNoId ) { + SetTitleL( oldObject , aNewUrl ); oldObject->SetUriL( aNewUrl ); TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl ); oldObject->SetMediaId( mediaId ); @@ -454,6 +521,7 @@ if ( oldObject ) { + CheckDefaultFolderL( oldObject ); SetModifiedTimeL( oldObject, aNewUrl ); TOrigin origin = OriginFromMdEObjectL( *oldObject ); if( origin == MdeConstants::Object::EOther) @@ -631,8 +699,10 @@ CleanupStack::PushL( oldObject ); SetTitleL( oldObject , aNewUrl ); oldObject->SetUriL( aNewUrl ); + CheckDefaultFolderL( oldObject ); TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl ); oldObject->SetMediaId( mediaId ); + SetModifiedTimeL( oldObject, aNewUrl ); TOrigin origin = OriginFromMdEObjectL( *oldObject ); if( origin == MdeConstants::Object::EOther) { @@ -653,6 +723,7 @@ CleanupStack::PushL( oldObject ); SetTitleL( oldObject , aNewUrl ); oldObject->SetUriL( aNewUrl ); + CheckDefaultFolderL( oldObject ); TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl ); oldObject->SetMediaId( mediaId ); SetModifiedTimeL( oldObject, aNewUrl ); @@ -973,3 +1044,60 @@ } } +//--------------------------------------------------------------------------- +// CFileEventHandlerAO::CheckDefaultFolderL() +// --------------------------------------------------------------------------- +// +void CFileEventHandlerAO::CheckDefaultFolderL( CMdEObject* aOldObject ) + { + if( !iDefaultFolderPropertyDef ) + { + iDefaultFolderPropertyDef = &aOldObject->Def().GetPropertyDefL( + MdeConstants::Object::KInDefaultFolder ); + } + + CMdEProperty* folderProp = NULL; + aOldObject->Property( *iDefaultFolderPropertyDef, folderProp ); + + TBool inDefaultFolder( EFalse ); + TPtrC objectDefName( aOldObject->Def().Name() ); + if( objectDefName == MdeConstants::Image::KImageObject ) + { + const TDesC& uri = aOldObject->Uri(); + if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound || + uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound || + uri.FindF( KDCIMFolder ) != KErrNotFound ) + { + inDefaultFolder = ETrue; + } + } + else if( objectDefName == MdeConstants::Video::KVideoObject ) + { + const TDesC& uri = aOldObject->Uri(); + if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound || + uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound || + uri.FindF( KDCIMFolder ) != KErrNotFound ) + { + inDefaultFolder = ETrue; + } + } + else if( objectDefName == MdeConstants::Audio::KAudioObject ) + { + const TDesC& uri = aOldObject->Uri(); + if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound || + uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound ) + { + inDefaultFolder = ETrue; + } + } + + if( folderProp ) + { + folderProp->SetBoolValueL( inDefaultFolder ); + } + else + { + aOldObject->AddBoolPropertyL( *iDefaultFolderPropertyDef, inDefaultFolder ); + } + } + diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/src/filemonitorao.cpp --- a/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -71,6 +71,7 @@ StopMonitoring(); delete iMdeSession; + iMdeSession = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/src/filemonitorplugin.cpp --- a/harvester/monitorplugins/fileplugin/src/filemonitorplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/filemonitorplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -40,6 +40,7 @@ CFileMonitorPlugin::~CFileMonitorPlugin() { delete iFileMonitor; + iFileMonitor = NULL; } // --------------------------------------------------------------------------- @@ -67,6 +68,7 @@ TRAP( err, cenRepoUtil->AddIgnorePathsToFspL( KDrive, KMonitorPath )); } delete cenRepoUtil; + cenRepoUtil = NULL; } return success && err == KErrNone; } diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp --- a/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -59,6 +59,7 @@ CProcessOriginMapper::~CProcessOriginMapper() { delete iLineBuffer; + iLineBuffer = NULL; iProcessOriginMap.Close(); iReadStream.Close(); iWriteStream.Close(); diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/inc/mdsfileserverpluginclient.h --- a/harvester/monitorplugins/inc/mdsfileserverpluginclient.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/inc/mdsfileserverpluginclient.h Thu Aug 19 10:20:41 2010 +0300 @@ -50,7 +50,8 @@ EMdsFileDeleted, EMdsDriveFormatted, EMdsFileUnknown, - EMdsDirRenamed + EMdsDirRenamed, + EMdsFileAttribsChanged }; typedef TPckgBuf TMdsFSPStatusPckg; diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/inc/mdsfspqueue.inl --- a/harvester/monitorplugins/inc/mdsfspqueue.inl Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/inc/mdsfspqueue.inl Thu Aug 19 10:20:41 2010 +0300 @@ -15,7 +15,7 @@ */ -#include "mdsfspqueue.h" + //----------------------------------------------------------------------------- // CMdsFSPQueueItem::NewL() @@ -67,10 +67,13 @@ if( iFileName ) { delete iFileName; + iFileName = NULL; } + if( iNewFileName ) { delete iNewFileName; + iNewFileName = NULL; } iFileName = aStatus.iFileName.AllocL(); @@ -85,6 +88,8 @@ CMdsFSPQueueItem::~CMdsFSPQueueItem() { delete iFileName; + iFileName = NULL; delete iNewFileName; + iNewFileName = NULL; } - \ No newline at end of file + diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp --- a/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -339,6 +339,7 @@ { fileEventType = EMdsFileCreated; delete iCreatedFiles[i]; + iCreatedFiles[i] = NULL; iCreatedFiles.Remove( i ); //Have to check whether file has been hidden @@ -433,6 +434,7 @@ if ( MdsUtils::Compare( iFileName, *(iModifiedFiles[i]) ) == 0 ) { delete iModifiedFiles[i]; + iModifiedFiles[i] = NULL; iModifiedFiles.Remove( i ); found = ETrue; } @@ -448,7 +450,7 @@ return KErrNone; } - fileEventType = EMdsFileModified; + fileEventType = EMdsFileAttribsChanged; } break; diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp --- a/harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/messageplugin/src/messagemonitorplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -64,7 +64,9 @@ { WRITELOG("ENTER ~CMessageMonitorPlugin"); delete iMsvSession; + iMsvSession = NULL; delete iMessageScannerAO; + iMessageScannerAO = NULL; WRITELOG("END ~CMessageMonitorPlugin"); } @@ -465,6 +467,7 @@ iMdeSession->AddEventL( *event ); delete event; + event = NULL; } WRITELOG( "CMessageMonitorPlugin::RemoveObjectL return" ); diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mmcplugin/inc/mmcmounttaskao.h --- a/harvester/monitorplugins/mmcplugin/inc/mmcmounttaskao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/inc/mmcmounttaskao.h Thu Aug 19 10:20:41 2010 +0300 @@ -46,8 +46,8 @@ static CMMCMountTaskAO* NewL(); virtual ~CMMCMountTaskAO(); - void StartMount( TMountData& aMountData ); - void StartUnmount( TMountData& aMountData ); + void StartMountL( TMountData& aMountData ); + void StartUnmountL( TMountData& aMountData ); void SetMonitorObserver( MMonitorPluginObserver& aObserver ); void SetMdeSession( CMdEHarvesterSession* aSession ); void SetHarvesterPluginFactory( CHarvesterPluginFactory* aPluginFactory ); diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp --- a/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -94,7 +94,7 @@ CleanupResetAndDestroyPushL( aEntryArray ); - CDesCArrayFlat* path = new(ELeave) CDesCArrayFlat( 10 ); + CDesCArrayFlat* path = new(ELeave) CDesCArrayFlat( 30 ); CleanupStack::PushL( path ); TFileName firstPath; firstPath.Copy( aDrivePath ); diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp --- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -60,21 +60,26 @@ { iMMCMonitor->StopMonitoring(); delete iMMCMonitor; + iMMCMonitor = NULL; } if (iUsbMonitor) { iUsbMonitor->StopMonitoring(); delete iUsbMonitor; + iUsbMonitor = NULL; } if (iMountTask) { delete iMountTask; + iMountTask = NULL; } delete iMmcScanner; + iMmcScanner = NULL; delete iHddScanner; + iHddScanner = NULL; iFs.Close(); } @@ -219,6 +224,7 @@ TMountData* mountData = NULL; mountData = new TMountData; + if ( !mountData ) { return; @@ -248,7 +254,56 @@ { WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EMounted" ); mountData->iMountType = TMountData::EMount; - iMountTask->StartMount( *mountData ); + + // If mass storage mounting was delayed in boot so that mount event + // occures in mmc monitor, update the mass storage media id in the + // db in case factory settings were reseted and mass storage formatted + TInt drive( -1 ); + TInt internalMassStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); + if( internalMassStorageError == KErrNone ) + { + TVolumeInfo internalMassStorageVolumeInfo; + internalMassStorageError = iFs.Volume( internalMassStorageVolumeInfo, drive ); + if( internalMassStorageError == KErrNone ) + { + const TUint32 massStorageMediaId( internalMassStorageVolumeInfo.iUniqueID ); + TUint32 mmcMediaId( 0 ); + TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ) ); + if( mmcError == KErrNone ) + { + TVolumeInfo mmcVolumeInfo; + mmcError = iFs.Volume( mmcVolumeInfo, drive ); + if( mmcError == KErrNone ) + { + mmcMediaId = mmcVolumeInfo.iUniqueID; + } + } + + // If removable storage is not found, assume internal mass storage was mounted + if( mmcError ) + { + if( massStorageMediaId != 0 && + massStorageMediaId == aMediaID ) + { + iMdEClient->CheckMassStorageMediaId( massStorageMediaId ); + } + } + else if( massStorageMediaId != mmcMediaId && + massStorageMediaId != 0 && + massStorageMediaId == aMediaID ) + { + iMdEClient->CheckMassStorageMediaId( massStorageMediaId ); + } + } + } + + TRAPD(err, iMountTask->StartMountL( *mountData )) + + if(err != KErrNone ) + { + delete mountData; + mountData = NULL; + } } break; @@ -262,7 +317,13 @@ { WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EDismounted" ); mountData->iMountType = TMountData::EUnmount; - iMountTask->StartUnmount( *mountData ); + TRAPD(err, iMountTask->StartUnmountL( *mountData )); + + if(err != KErrNone ) + { + delete mountData; + mountData = NULL; + } } else { @@ -276,7 +337,13 @@ { WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EFormatted" ); mountData->iMountType = TMountData::EFormat; - iMountTask->StartUnmount( *mountData ); + TRAPD(err, iMountTask->StartUnmountL( *mountData )); + + if(err != KErrNone) + { + delete mountData; + mountData = NULL; + } } break; diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp --- a/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -79,6 +79,7 @@ iHarvestEntryArray.Close(); delete iMdeSession; + iMdeSession = NULL; Deinitialize(); @@ -88,6 +89,7 @@ } delete iMmcFileList; + iMmcFileList = NULL; iHdArray.ResetAndDestroy(); iHdArray.Close(); } @@ -108,17 +110,19 @@ iHarvesterPluginFactory = aPluginFactory; } -void CMMCMountTaskAO::StartMount( TMountData& aMountData ) +void CMMCMountTaskAO::StartMountL( TMountData& aMountData ) { WRITELOG("CMMCMountTaskAO::StartMount"); - iMountDataQueue.Append( &aMountData ); + + User::LeaveIfError( iMountDataQueue.Append( &aMountData )); + if ( iNextRequest == ERequestIdle ) { SetNextRequest( ERequestStartTask ); } } -void CMMCMountTaskAO::StartUnmount(TMountData& aMountData) +void CMMCMountTaskAO::StartUnmountL(TMountData& aMountData) { WRITELOG("CMMCMountTaskAO::StartUnmount"); @@ -132,7 +136,8 @@ } } - iMountDataQueue.Append( &aMountData ); + User::LeaveIfError( iMountDataQueue.Append( &aMountData )); + SetNextRequest( ERequestStartTask ); } @@ -146,7 +151,10 @@ { if ( iMountData ) { - iMountDataQueue.Insert( iMountData, 0 ); + if( iMountDataQueue.Insert( iMountData, 0 ) != KErrNone) + { + delete iMountData; + } iMountData = NULL; } Deinitialize(); @@ -205,7 +213,11 @@ TRAPD( err, iMmcFileList->BuildFileListL( iFs, iMountData->iDrivePath, iEntryArray )); if ( err == KErrNoMemory ) { - iMountDataQueue.Insert( iMountData, 0 ); + if( iMountDataQueue.Insert( iMountData, 0 ) != KErrNone) + { + delete iMountData; + } + iMountData = NULL; Deinitialize(); SetNextRequest( ERequestStartTask ); @@ -284,9 +296,14 @@ { if( err == KErrNoMemory ) { - iMountDataQueue.Insert( iMountData, 0 ); + if(iMountDataQueue.Insert( iMountData, 0 ) != KErrNone) + { + delete iMountData; + } + iMountData = NULL; } + Deinitialize(); SetNextRequest( ERequestStartTask ); break; @@ -437,6 +454,7 @@ hd->SetEventType( EHarvesterEdit ); hd->SetObjectType( ENormal ); delete ei; + ei = NULL; } else { @@ -445,7 +463,12 @@ hd->SetClientData( ei ); } - iHdArray.Append( hd ); + if(iHdArray.Append( hd ) != KErrNone ) + { + delete hd; + hd = NULL; + } + aArray.Remove( i ); } diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp --- a/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -82,6 +82,7 @@ // Delete instance variables if any delete iMmcFileList; + iMmcFileList = NULL; iEntryArray.ResetAndDestroy(); iEntryArray.Close(); @@ -248,6 +249,7 @@ hd->SetEventType( EHarvesterEdit ); hd->SetObjectType( ENormal ); delete ei; + ei = NULL; } else { @@ -255,7 +257,12 @@ hd->SetObjectType( EPlaceholder ); hd->SetClientData( ei ); } - iHdArray.Append( hd ); + + if(iHdArray.Append( hd ) != KErrNone ) + { + delete hd; + hd = NULL; + } iHarvestEntryArray.Remove( i ); } diff -r 63c982fb92f2 -r b73252188534 harvester/monitorplugins/monitorplugininterface/group/monitorplugininterface.mmp --- a/harvester/monitorplugins/monitorplugininterface/group/monitorplugininterface.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/monitorplugins/monitorplugininterface/group/monitorplugininterface.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -43,7 +43,7 @@ #if defined(WINS) deffile ../bwincw/monitorplugininterfacewinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/monitorplugininterfacearm.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 harvester/server/inc/harvesterao.h --- a/harvester/server/inc/harvesterao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/inc/harvesterao.h Thu Aug 19 10:20:41 2010 +0300 @@ -74,7 +74,8 @@ void ConstructL(CMdEObjectDef& aObjectDef); public: - static CHarvesterAoPropertyDefs* NewL(CMdEObjectDef& aObjectDef); + static CHarvesterAoPropertyDefs* NewL(); + void SetByObjectDefL( CMdEObjectDef& aObjectDef ); }; /** @@ -555,8 +556,6 @@ CHarvesterAoPropertyDefs* iPropDefs; - TBool iMassMemoryIdChecked; - // Own. CDesCArray* iCameraExtensionArray; diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/harvesterao.cpp --- a/harvester/server/src/harvesterao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/harvesterao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -53,6 +53,7 @@ const TInt KPlaceholderQueueSize = 99; const TInt KContainerPlaceholderQueueSize = 10; +const TInt KReadyPlaceholderQueueSize = 10; const TInt KObjectDefStrSize = 20; _LIT( KTAGDaemonName, "ThumbAGDaemon" ); @@ -76,32 +77,34 @@ void CHarvesterAoPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) { - CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); - - // Common property definitions - CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject ); - iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); - iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); - iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); - iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); - iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); - iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); - iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ); - - CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); - iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty ); + SetByObjectDefL( aObjectDef ); } -CHarvesterAoPropertyDefs* CHarvesterAoPropertyDefs::NewL(CMdEObjectDef& aObjectDef) - { - CHarvesterAoPropertyDefs* self = - new (ELeave) CHarvesterAoPropertyDefs(); - CleanupStack::PushL( self ); - self->ConstructL( aObjectDef ); - CleanupStack::Pop( self ); - return self; - } +CHarvesterAoPropertyDefs* CHarvesterAoPropertyDefs::NewL() + { + CHarvesterAoPropertyDefs* self = + new (ELeave) CHarvesterAoPropertyDefs(); + return self; + } + +void CHarvesterAoPropertyDefs::SetByObjectDefL(CMdEObjectDef& aObjectDef) + { + CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); + // Common property definitions + CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject ); + iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); + iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); + iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ); + + CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); + iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty ); + } + // --------------------------------------------------------------------------- // NewLC // --------------------------------------------------------------------------- @@ -186,14 +189,18 @@ DeleteComposers(); delete iDiskFullNotifier; + iDiskFullNotifier = NULL; delete iBackupSubscriber; + iBackupSubscriber = NULL; if (iBlacklist) { iBlacklist->CloseDatabase(); delete iBlacklist; + iBlacklist = NULL; } delete iReHarvester; + iReHarvester = NULL; if ( iHarvestFileMessages.Count() > 0 ) { @@ -222,26 +229,43 @@ iTempReadyPHArray.Close(); delete iHarvesterOomAO; + iHarvesterOomAO = NULL; delete iRestoreWatcher; + iRestoreWatcher = NULL; delete iOnDemandAO; + iOnDemandAO = NULL; delete iMdEHarvesterSession; + iMdEHarvesterSession = NULL; delete iMdESession; + iMdESession = NULL; delete iQueue; + iQueue = NULL; delete iHarvesterPluginFactory; + iHarvesterPluginFactory = NULL; delete iMdeObjectHandler; + iMdeObjectHandler = NULL; delete iUnmountHandlerAO; + iUnmountHandlerAO = NULL; delete iPropDefs; + iPropDefs = NULL; delete iCameraExtensionArray; + iCameraExtensionArray = NULL; delete iPhoneImagesPath; + iPhoneImagesPath = NULL; delete iMmcImagesPath; + iMmcImagesPath = NULL; delete iPhoneVideosPath; + iPhoneVideosPath = NULL; delete iMmcVideosPath; + iMmcVideosPath = NULL; delete iPhoneSoundsPath; + iPhoneSoundsPath = NULL; delete iMmcSoundsPath; + iMmcSoundsPath = NULL; RMediaIdUtil::ReleaseInstance(); @@ -293,6 +317,8 @@ // Reset harvesting status for clients in case blacklisted file was handled iHarvesterPluginFactory->SendHarvestingStatusEventL( EFalse ); + iPropDefs = CHarvesterAoPropertyDefs::NewL(); + iCameraExtensionArray = new ( ELeave ) CDesCArraySeg( 6 ); iCameraExtensionArray->InsertIsqL( KExtensionMp4 ); iCameraExtensionArray->InsertIsqL( KExtensionMpg4 ); @@ -354,8 +380,7 @@ CleanupStack::PushL( cleanupItem ); CMonitorPlugin::ListImplementationsL( infoArray ); - TInt count( 0 ); - count = infoArray.Count(); + const TInt count( infoArray.Count() ); CMonitorPlugin* plugin = NULL; for ( TInt i = 0; i < count; i++ ) @@ -410,7 +435,6 @@ { WRITELOG( "CHarvesterAO::StartMonitoring()" ); OstTrace0( TRACE_NORMAL, CHARVESTERAO_STARTMONITORING, "CHarvesterAO::StartMonitoring" ); - const TInt count( iMonitorPluginArray.Count() ); for ( TInt i = 0; i < count; i++ ) @@ -429,10 +453,8 @@ WRITELOG( "CHarvesterAO::StopMonitoring()" ); OstTrace0( TRACE_NORMAL, CHARVESTERAO_STOPMONITORING, "CHarvesterAO::StopMonitoring" ); - - const TInt count( iMonitorPluginArray.Count() ); - for ( TInt i = 0; i < count; i++ ) + for( TInt i = iMonitorPluginArray.Count() - 1; i >=0; i-- ) { iMonitorPluginArray[i]->StopMonitoring(); } @@ -447,12 +469,11 @@ WRITELOG( "CHarvesterAO::PauseMonitoring()" ); OstTrace0( TRACE_NORMAL, CHARVESTERAO_PAUSEMONITORING, "CHarvesterAO::PauseMonitoring" ); - const TInt count( iMonitorPluginArray.Count() ); - - for ( TInt i = 0; i=0; i-- ) { iMonitorPluginArray[i]->PauseMonitoring(); } + OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_PAUSEMONITORING, "CHarvesterAO::PauseMonitoring - end" ); WRITELOG( "CHarvesterAO::PauseMonitoring() - end" ); } @@ -518,6 +539,7 @@ WRITELOG1( "CHarvesterAO::HandleUnmount() remove iReadyPHArray %d", i); OstTrace1( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iReadyPHArray %d", i ); + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrCancel ); delete hd; hd = NULL; iReadyPHArray.Remove( i ); @@ -555,6 +577,7 @@ WRITELOG1( "CHarvesterAO::HandleUnmount() remove iPHArray %d", i); OstTrace1( TRACE_NORMAL, DUP5_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iPHArray %d", i ); + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrCancel ); delete hd; hd = NULL; iPHArray.Remove( i ); @@ -591,6 +614,7 @@ WRITELOG1( "CHarvesterAO::HandleUnmount() remove iContainerPHArray %d", i); OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount remove iContainerPHArray %d", i ); + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrCancel ); delete hd; hd = NULL; iContainerPHArray.Remove( i ); @@ -622,6 +646,7 @@ if( err == KErrNone && mediaId == aMediaId ) { WRITELOG1( "CHarvesterAO::HandleUnmount() remove iTempReadyPHArray %d", i); + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrCancel ); delete hd; hd = NULL; iTempReadyPHArray.Remove( i ); @@ -681,6 +706,7 @@ TRAP_IGNORE( iMdESession->CancelObjectL( mdeobj ) ); + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrCancel ); delete hd; hd = NULL; } @@ -825,22 +851,31 @@ iPHArray.Count() < KPlaceholderQueueSize && hd->ObjectType() == EPlaceholder ) { - iPHArray.Append( hd ); - if( hd->Origin() == MdeConstants::Object::ECamera || - hd->ObjectType() == EFastHarvest ) + if(iPHArray.Append( hd ) != KErrNone) + { + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete hd; + hd = NULL; + } + else { - if( !iFastHarvestNeeded ) - { - iFastHarvestNeeded = ETrue; - // Fast harvest event must be handled even if MMC handling would be ongoing - SetPriority( KHarvesterPriorityMonitorPlugin ); - } - break; - } - else if( iFastHarvestNeeded ) - { - iFastHarvestNeeded = EFalse; - SetPriority( KHarvesterCustomImportantPriority ); + if( hd->Origin() == MdeConstants::Object::ECamera || + hd->ObjectType() == EFastHarvest ) + { + if( !iFastHarvestNeeded ) + { + iFastHarvestNeeded = ETrue; + // Fast harvest event must be handled even if MMC handling would be ongoing + SetPriority( KHarvesterPriorityMonitorPlugin ); + } + break; + } + else if( iFastHarvestNeeded ) + { + iFastHarvestNeeded = EFalse; + SetPriority( KHarvesterCustomImportantPriority ); + } } hd = iQueue->GetNextItem(); } @@ -849,11 +884,14 @@ { TRAPD( err, HandlePlaceholdersL( ETrue ) ); - // make sure that when HandlePlaceholdersL leaves, iPHArray is cleared + // make sure that when HandlePlaceholdersL leaves unexpectedly, iPHArray is cleared if ( err != KErrNone ) { - iPHArray.ResetAndDestroy(); - iTempReadyPHArray.ResetAndDestroy(); + if( err != KErrDiskFull ) + { + iPHArray.ResetAndDestroy(); + iTempReadyPHArray.ResetAndDestroy(); + } User::Leave( err ); } @@ -877,16 +915,21 @@ { if( hd->ObjectType() == EPlaceholder ) { - iPHArray.Append( hd ); + if( iPHArray.Append( hd ) != KErrNone ) + { + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete hd; + hd = NULL; + } } else { - CheckFileExtensionAndHarvestL( hd ); - if( iUnmountDetected ) - { - iQueue->Append( hd ); - return; - } + if( iReadyPHArray.Append( hd ) != KErrNone) + { + delete hd; + hd = NULL; + } } } @@ -894,11 +937,14 @@ { TRAPD( err, HandlePlaceholdersL( ETrue ) ); - // make sure that when HandlePlaceholdersL leaves, iPHArray is cleared + // make sure that when HandlePlaceholdersL leaves unexpectedly, iPHArray is cleared if ( err != KErrNone ) { - iPHArray.ResetAndDestroy(); - iTempReadyPHArray.ResetAndDestroy(); + if( err != KErrDiskFull ) + { + iPHArray.ResetAndDestroy(); + iTempReadyPHArray.ResetAndDestroy(); + } User::Leave( err ); } } @@ -911,7 +957,7 @@ } iHarvestingPlaceholders = EFalse; CheckFileExtensionAndHarvestL( hd ); - if( iUnmountDetected ) + if( iUnmountDetected && hd ) { iQueue->Append( hd ); } @@ -932,6 +978,8 @@ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); + CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); + TInt endindex( iPHArray.Count() ); for( TInt i = 0; i < endindex; i++ ) { @@ -939,17 +987,25 @@ if( aCheck && iHarvesterPluginFactory->IsContainerFileL( hd->Uri() ) ) { - iContainerPHArray.Append( hd ); + if( iContainerPHArray.Append( hd ) != KErrNone ) + { + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete hd; + hd = NULL; + } + iPHArray.Remove( i ); - i--; - endindex--; + i--; + endindex--; continue; } + TBuf objDefStr; if( !CheckForCameraItem( hd, objDefStr ) ) { - iHarvesterPluginFactory->GetObjectDefL( *hd, objDefStr ); + iHarvesterPluginFactory->GetObjectDefL( hd, objDefStr ); } // GetObjectDef can cause context switch, and if unmount happens when this execution is @@ -960,8 +1016,15 @@ WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - Unmount detected during execution!" ); for( TInt y( iTempReadyPHArray.Count() -1 ); y >=0; y-- ) { - CHarvesterData* hd = iTempReadyPHArray[y]; - iPHArray.Insert( hd, 0 ); + CHarvesterData* tempHd = iTempReadyPHArray[y]; + + if(iPHArray.Insert( tempHd, 0 ) != KErrNone) + { + HarvestCompleted( tempHd->ClientId(), tempHd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete tempHd; + tempHd = NULL; + } } iTempReadyPHArray.Reset(); CleanupStack::PopAndDestroy( &mdeObjectArray ); @@ -976,21 +1039,41 @@ const TInt currentPHArrayCount( iPHArray.Count() ); for( TInt y( iTempReadyPHArray.Count() -1 ); y >=0; y-- ) { - CHarvesterData* hd = iTempReadyPHArray[y]; - if( currentPHArrayCount ) + CHarvesterData* tempHd = iTempReadyPHArray[y]; + if(iPHArray.Insert( tempHd, 0 ) != KErrNone) { - // Leave the first item in the array as it is the priority item - iPHArray.Insert( hd, 1 ); - } - else - { - iPHArray.Insert( hd, 0 ); + HarvestCompleted( tempHd->ClientId(), tempHd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete tempHd; + tempHd = NULL; } } iTempReadyPHArray.Reset(); CleanupStack::PopAndDestroy( &mdeObjectArray ); return; } + // Check if disk is full + // If disk is detected to be full, no items can be added to MDS db, thus abort the run, and start over + // when disk space is available to make sure the arrays are valid. + else if( iDiskFull ) + { + WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - No disk space available!" ); + for( TInt y( iTempReadyPHArray.Count() -1 ); y >=0; y-- ) + { + CHarvesterData* tempHd = iTempReadyPHArray[y]; + + if(iPHArray.Insert( tempHd, 0 ) != KErrNone) + { + HarvestCompleted( tempHd->ClientId(), tempHd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete tempHd; + tempHd = NULL; + } + } + iTempReadyPHArray.Reset(); + CleanupStack::PopAndDestroy( &mdeObjectArray ); + User::Leave( KErrDiskFull ); + } if( objDefStr.Length() == 0 || ( objDefStr == KInUse ) ) @@ -1008,10 +1091,12 @@ continue; } - CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr ); - CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, hd->Uri() ); + HBufC* hdUri = hd->Uri().AllocL(); + CleanupStack::PushL( hdUri ); + CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, *hdUri ); + CleanupStack::PopAndDestroy( hdUri ); CleanupStack::PushL( mdeObject ); CPlaceholderData* phData = NULL; @@ -1080,10 +1165,10 @@ // set placeholder mdeObject->SetPlaceholder( ETrue ); - if( !iPropDefs ) - { - iPropDefs = CHarvesterAoPropertyDefs::NewL( defNS.GetObjectDefL( MdeConstants::Object::KBaseObject ) ); - } + if( !iPropDefs->iCreationDatePropertyDef ) + { + iPropDefs->SetByObjectDefL( defNS.GetObjectDefL( MdeConstants::Object::KBaseObject ) ); + } // set file size mdeObject->AddUint32PropertyL( *iPropDefs->iSizePropertyDef, phData->FileSize() ); @@ -1172,33 +1257,68 @@ CleanupStack::Pop( mdeObject ); - iTempReadyPHArray.Append( hd ); + if(iTempReadyPHArray.Append( hd ) != KErrNone) + { + HarvestCompleted( hd->ClientId(), hd->Uri(), KErrNoMemory ); + delete hd; + hd = NULL; + } iPHArray.Remove( i ); i--; endindex--; } - const TInt tempArrayCount( iTempReadyPHArray.Count() ); - for( TInt i( 0 ); i < tempArrayCount; i++ ) - { - CHarvesterData* hd = iTempReadyPHArray[i]; - iReadyPHArray.Append( hd ); - } - iTempReadyPHArray.Reset(); - const TInt objectCount = mdeObjectArray.Count(); if( objectCount > 0 ) { // add object to mde iMdEHarvesterSession->AutoLockL( mdeObjectArray ); - const TInt addError( iMdESession->AddObjectsL( mdeObjectArray ) ); + TInt addError( KErrNone ); + TRAPD( addFailure, addError = iMdESession->AddObjectsL( mdeObjectArray ) ); + if( addFailure == KErrDiskFull ) + { + WRITELOG( "CHarvesterAO::HandlePlaceholdersL() - No disk space available!" ); + for( TInt y( iTempReadyPHArray.Count() -1 ); y >=0; y-- ) + { + CHarvesterData* tempHd = iTempReadyPHArray[y]; + + if(iPHArray.Insert( tempHd, 0 ) != KErrNone) + { + HarvestCompleted( tempHd->ClientId(), tempHd->Uri(), KErrNoMemory ); + iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + delete tempHd; + tempHd = NULL; + } + } + iTempReadyPHArray.Reset(); + CleanupStack::PopAndDestroy( &mdeObjectArray ); + User::Leave( KErrDiskFull ); + } + else if( addFailure != KErrNone ) + { + User::Leave( addFailure ); + } + if( addError != KErrNone ) { // If some error occures, retry iMdESession->AddObjectsL( mdeObjectArray ); } + const TInt tempArrayCount( iTempReadyPHArray.Count() ); + for( TInt i( 0 ); i < tempArrayCount; i++ ) + { + CHarvesterData* tempHd = iTempReadyPHArray[i]; + if(iReadyPHArray.Append( tempHd ) != KErrNone) + { + HarvestCompleted( tempHd->ClientId(), tempHd->Uri(), KErrNoMemory ); + delete tempHd; + tempHd = NULL; + } + } + iTempReadyPHArray.Reset(); + iHarvesterEventManager->IncreaseItemCount( EHEObserverTypePlaceholder, objectCount ); iHarvesterEventManager->SendEventL( EHEObserverTypePlaceholder, EHEStateStarted, @@ -1234,17 +1354,17 @@ const TDesC& uri = aHD->Uri(); TBool objectExisted = ETrue; - if( ! mdeObject ) + if( !mdeObject ) { objectExisted = EFalse; WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - no mdeobject. URI: %S", &uri ); TBuf objDefStr; - iHarvesterPluginFactory->GetObjectDefL( *aHD, objDefStr ); + iHarvesterPluginFactory->GetObjectDefL( aHD, objDefStr ); // GetObjectDef can cause context switch, and if unmount happens when this execution is // interrupted, the ph data can be invalid. Thus, abort whole run, and start over to make sure // the data is valid. - if( iUnmountDetected ) + if( !aHD ) { return; } @@ -1349,9 +1469,16 @@ { iMdESession->RemoveObjectL( aHD->Uri() ); } + + // If context swich occures just right due to RemoveObjectL, check aHD for validity + if( !aHD ) + { + return; + } TInt pluginErr = KErrNone; TRAPD( err, pluginErr = iHarvesterPluginFactory->HarvestL( aHD )); + if ( err != KErrNone ) { WRITELOG1( "CHarvesterAO::CheckFileExtensionAndHarvestL() - plugin error: %d", err ); @@ -1381,8 +1508,6 @@ WRITELOG1("CHarvesterAO::CheckFileExtensionAndHarvestL() - ends with error %d", pluginErr ); OstTrace1( TRACE_NORMAL, DUP8_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL, "CHarvesterAO::CheckFileExtensionAndHarvestL) - ends with error %d", pluginErr ); - - SetNextRequest( ERequestHarvest ); } // --------------------------------------------------------------------------- @@ -1512,8 +1637,6 @@ OstTrace0( TRACE_NORMAL, DUP12_CHARVESTERAO_HARVESTINGCOMPLETED, "==============================ERROR done =========================" ); } - - SetNextRequest( ERequestHarvest ); } // --------------------------------------------------------------------------- @@ -1660,25 +1783,41 @@ TRAP_IGNORE( BootPartialRestoreScanL() ); #endif - if( !iMassMemoryIdChecked ) + // Store the internal mass memory media ID to DB, and update data if necessary + TInt drive( -1 ); + TInt internalMassStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); + if( internalMassStorageError == KErrNone ) { - TInt drive( -1 ); - TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); - if( massStorageError == KErrNone ) + TVolumeInfo internalMassStorageVolumeInfo; + internalMassStorageError = iFs.Volume( internalMassStorageVolumeInfo, drive ); + if( internalMassStorageError == KErrNone ) { - TVolumeInfo massStorageVolumeInfo; - iFs.Volume( massStorageVolumeInfo, drive ); - const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID ); - massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); - if( massStorageError == KErrNone ) + const TUint32 massStorageMediaId( internalMassStorageVolumeInfo.iUniqueID ); + TUint32 mmcMediaId( 0 ); + TInt mmcError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ) ); + if( mmcError == KErrNone ) { - iFs.Volume( massStorageVolumeInfo, drive ); - // Update mass storage media id if the mass storage is not memory card - if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 ) + TVolumeInfo mmcVolumeInfo; + mmcError = iFs.Volume( mmcVolumeInfo, drive ); + if( mmcError == KErrNone ) + { + mmcMediaId = mmcVolumeInfo.iUniqueID; + } + } + + // If removable storage is not found, assume internal mass storage was mounted + if( mmcError ) + { + if( massStorageMediaId != 0 ) { iMdEHarvesterSession->CheckMassStorageMediaId( massStorageMediaId ); - } + } } + else if( massStorageMediaId != mmcMediaId && + massStorageMediaId != 0 ) + { + iMdEHarvesterSession->CheckMassStorageMediaId( massStorageMediaId ); + } } } } @@ -1818,7 +1957,7 @@ WRITELOG( "CHarvesterAO::RunL - ERequestHarvest" ); OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - ERequestHarvest" ); - // harvest new items first... + // harvest new items first if ( iQueue->ItemsInQueue() > 0 ) { WRITELOG( "CHarvesterAO::RunL - Items in queue - calling ReadItemFromQueueL()" ); @@ -1831,9 +1970,29 @@ else { WRITELOG( "CHarvesterAO::RunL - No items in main queue" ); + // If interrupts occured, check the normal placeholder array for possible items to + // be handled before moving on to container or ready placeholders + if( iPHArray.Count() > 0 ) + { + WRITELOG( "CHarvesterAO::RunL - Items found in placeholder array" ); + TRAPD( err, HandlePlaceholdersL( ETrue ) ); + + // make sure that when HandlePlaceholdersL leaves unexpectedly, iPHArray is cleared + if ( err != KErrNone ) + { + if( err != KErrDiskFull ) + { + iPHArray.ResetAndDestroy(); + iTempReadyPHArray.ResetAndDestroy(); + } + User::Leave( err ); + } + SetNextRequest( ERequestHarvest ); + break; + } // All registered fast harvested items or placeholders handled at this point // if container files to harvest, handle those next - if( iContainerPHArray.Count() > 0 ) + else if( iContainerPHArray.Count() > 0 ) { WRITELOG( "CHarvesterAO::RunL - Items in iContainterPHArray - requesting ERequestContainerPlaceholder handling" ); iFastHarvestNeeded = EFalse; @@ -1864,8 +2023,8 @@ WRITELOG1("CHarvesterAO::RunL - items in ready pharray: %d", arrayCount ); OstTrace1( TRACE_NORMAL, DUP3_CHARVESTERAO_RUNL, "CHarvesterAO::RunL - items in ready pharray: %d", arrayCount ); #endif - TInt endIndex( KPlaceholderQueueSize ); - if( arrayCount < KPlaceholderQueueSize ) + TInt endIndex( KReadyPlaceholderQueueSize ); + if( arrayCount < KReadyPlaceholderQueueSize ) { endIndex = arrayCount; } @@ -1913,14 +2072,17 @@ } TRAPD( err, HandlePlaceholdersL( EFalse ) ); - // make sure that when HandlePlaceholdersL leaves, iPHArray is cleared - if ( err != KErrNone ) - { - iContainerPHArray.ResetAndDestroy(); - iPHArray.ResetAndDestroy(); - iTempReadyPHArray.ResetAndDestroy(); - User::Leave( err ); - } + // make sure that when HandlePlaceholdersL leaves unexpectedly, iPHArray is cleared + if ( err != KErrNone ) + { + if( err != KErrDiskFull ) + { + iContainerPHArray.ResetAndDestroy(); + iPHArray.ResetAndDestroy(); + iTempReadyPHArray.ResetAndDestroy(); + } + User::Leave( err ); + } SetNextRequest( ERequestHarvest ); } break; @@ -1980,7 +2142,7 @@ // TInt CHarvesterAO::RunError( TInt aError ) { - WRITELOG( "CHarvesterAO::RunError" ); + WRITELOG1( "CHarvesterAO::RunError, error: %d", aError ); OstTrace0( TRACE_NORMAL, CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError" ); switch( iNextRequest ) @@ -1989,6 +2151,21 @@ { WRITELOG( "CHarvesterAO::RunError - state ERequestHarvest" ); OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - state ERequestHarvest" ); + if( aError == KErrDiskFull || aError == KErrNoMemory ) + { + SetNextRequest( ERequestIdle ); + } + } + break; + + case ERequestContainerPlaceholder: + { + WRITELOG( "CHarvesterAO::RunError - state ERequestContainerPlaceholder" ); + OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_RUNERROR, "CHarvesterAO::RunError - state ERequestContainerPlaceholder" ); + if( aError == KErrDiskFull || aError == KErrNoMemory ) + { + SetNextRequest( ERequestIdle ); + } } break; @@ -2105,14 +2282,14 @@ if( MMdSHarvesterDiskSpaceObserver::EMore == aDiskSpaceDirection ) { - WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk full"); - OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk full" ); + WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk space available"); + OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk space available" ); iDiskFull = EFalse; } else { - WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk space available"); - OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk space available" ); + WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk full"); + OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERAO_HANDLEDISKSPACENOTIFICATIONL, "CHarvesterAO::HandleDiskSpaceNotificationL - disk full" ); iDiskFull = ETrue; if( iServerPaused ) { @@ -2320,6 +2497,7 @@ else { delete hd; + hd = NULL; err = KErrUnknown; } @@ -2327,6 +2505,10 @@ { aMessage.Complete( err ); } + else if( err != KErrNone ) + { + HarvestCompleted( aMessage.Identity(), uri->Des(), err ); + } albumIds.Close(); } @@ -2517,6 +2699,7 @@ else { delete hd; + hd = NULL; err = KErrUnknown; } @@ -2524,6 +2707,10 @@ { aMessage.Complete( err ); } + else if( err != KErrNone ) + { + HarvestCompleted( aMessage.Identity(), uri->Des(), err ); + } albumIds.Close(); } @@ -2941,25 +3128,6 @@ { WRITELOG("CHarvesterAO::BootScanL() - begin"); OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - begin" ); - - TInt drive( -1 ); - TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); - if( massStorageError == KErrNone ) - { - TVolumeInfo massStorageVolumeInfo; - iFs.Volume( massStorageVolumeInfo, drive ); - const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID ); - massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); - if( massStorageError == KErrNone ) - { - iFs.Volume( massStorageVolumeInfo, drive ); - // Update mass storage media id if the mass storage is not memory card - if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 ) - { - iMdEHarvesterSession->CheckMassStorageMediaId( massStorageMediaId ); - } - } - } TVolumeInfo volumeInfo; iFs.Volume( volumeInfo, EDriveC ); @@ -3041,9 +3209,11 @@ WRITELOG("CHarvesterAO::BootScanL() - scanFolders.AppendL"); OstTrace0( TRACE_NORMAL, DUP2_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - scanFolders.AppendL" ); TScanItem* item = new (ELeave) TScanItem(); + CleanupStack::PushL( item ); item->iPath = name->AllocL(); item->iPreinstalled = MdeConstants::MediaObject::ENotPreinstalled; - aScanItems.AppendL( item ); + CleanupStack::Pop( item ); + aScanItems.AppendL( item ); // ownership is transferred } } else @@ -3103,7 +3273,12 @@ hd->SetClientData( phData ); CleanupStack::Pop( phData ); - hdArray.Append( hd ); + + if(hdArray.Append( hd ) != KErrNone ) + { + delete hd; + hd = NULL; + } } CleanupStack::PopAndDestroy( &results ); CleanupStack::PopAndDestroy( &fileInfos ); @@ -3128,8 +3303,6 @@ iMdEHarvesterSession->RemoveFilesNotPresent( volumeInfo.iUniqueID, ETrue ); - iMassMemoryIdChecked = ETrue; - WRITELOG("CHarvesterAO::BootScanL() - end"); OstTrace0( TRACE_NORMAL, DUP5_CHARVESTERAO_BOOTSCANL, "CHarvesterAO::BootScanL - end" ); } diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/harvesterqueue.cpp --- a/harvester/server/src/harvesterqueue.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/harvesterqueue.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -174,6 +174,7 @@ if ( aItem->ObjectType() == EFastHarvest || aItem->Origin() == MdeConstants::Object::ECamera ) { err = iItemQueue.Insert( aItem, 0 ); + if( !iHarvesterAO->IsActive() ) { iHarvesterAO->SetPriority( KHarvesterPriorityMonitorPlugin ); diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/harvesterserver.cpp --- a/harvester/server/src/harvesterserver.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/harvesterserver.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -162,7 +162,7 @@ WRITELOG( "CHarvesterServer::NewLC() - begin" ); CHarvesterServer* self = new (ELeave) CHarvesterServer( - CActive::EPriorityUserInput, KHarvesterServerPolicy, + KHarvesterServerSessionPriority, KHarvesterServerPolicy, ESharableSessions ); CleanupStack::PushL( self ); self->ConstructL(); @@ -444,8 +444,11 @@ OstTrace0( TRACE_NORMAL, CHARVESTERSERVER_CHARVESTERSERVER, "CHarvesterServer::~CHarvesterServer" ); delete iHarvesterAO; + iHarvesterAO = NULL; delete iPauseObserverAO; + iPauseObserverAO = NULL; delete iShutdownObserver; + iShutdownObserver = NULL; OstTrace0( TRACE_NORMAL, DUP1_CHARVESTERSERVER_CHARVESTERSERVER, "CHarvesterServer::~CHarvesterServer end" ); WRITELOG( "CHarvesterServer::~CHarvesterServer() end" ); diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/mdeobjecthandler.cpp --- a/harvester/server/src/mdeobjecthandler.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/mdeobjecthandler.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -126,7 +126,7 @@ CMdERelation* relation = iMdeSession->NewRelationLC( albumRelationDef, albumId, objectId, 0 ); - relationEventArray.Append( STATIC_CAST( CMdEInstanceItem*, relation ) ); + relationEventArray.AppendL( STATIC_CAST( CMdEInstanceItem*, relation ) ); CleanupStack::Pop(); //relation } } @@ -140,7 +140,7 @@ { CMdEEvent* event = iMdeSession->NewEventLC( *eventDef, objectId, time ); - relationEventArray.Append( STATIC_CAST( CMdEInstanceItem*, event ) ); + relationEventArray.AppendL( STATIC_CAST( CMdEInstanceItem*, event ) ); CleanupStack::Pop(); // event } } diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/ondemandao.cpp --- a/harvester/server/src/ondemandao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/ondemandao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -64,6 +64,7 @@ if( iMdEHarvesterSession ) { delete iMdEHarvesterSession; + iMdEHarvesterSession = NULL; } // Delete instance variables if any } @@ -115,8 +116,14 @@ hd->SetEventType( EHarvesterEdit ); hd->SetObjectType( EFastHarvest ); queue.Remove( k ); - queue.Insert( hd, 0 ); - found = ETrue; + + if(queue.Insert( hd, 0 ) != KErrNone) + { + delete hd; + hd = NULL; + } + + found = ETrue; } } } diff -r 63c982fb92f2 -r b73252188534 harvester/server/src/reharvesterao.cpp --- a/harvester/server/src/reharvesterao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/src/reharvesterao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -19,8 +19,8 @@ #include "mdeobject.h" #include "mdsutils.h" -const TInt KResumeTime = 2000000; //microseconds -const TInt KTimeIncrease = 500000; //microseconds +const TInt KResumeTime = 3000000; //microseconds +const TInt KTimeIncrease = 1000000; //microseconds const TInt KTimeLimit = 30000000; //microseconds // --------------------------------------------------------------------------- @@ -165,6 +165,7 @@ WRITELOG1("CReHarvesterAO::AddItem() - %S already exists in re-harvester queue", &aItem->Uri() ); #endif delete aItem; + aItem = NULL; return; } } @@ -173,11 +174,16 @@ if( mdeObject ) { delete mdeObject; + mdeObject = NULL; aItem->SetMdeObject( NULL ); } - iItems.Append( aItem ); - + if(iItems.Append( aItem ) != KErrNone ) + { + delete aItem; + aItem = NULL; + } + iDelay = KResumeTime; const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay ); @@ -206,6 +212,7 @@ // found matching item iItems.Remove( i ); delete item; + item = NULL; } if ( iItems.Count() == 0 ) diff -r 63c982fb92f2 -r b73252188534 harvester/server/traces/OstTraceDefinitions.h --- a/harvester/server/traces/OstTraceDefinitions.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/traces/OstTraceDefinitions.h Thu Aug 19 10:20:41 2010 +0300 @@ -3,5 +3,5 @@ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler // REMOVE BEFORE CHECK-IN TO VERSION CONTROL #define OST_TRACE_COMPILER_IN_USE -#include +#include #endif diff -r 63c982fb92f2 -r b73252188534 harvester/server/traces/fixed_id.definitions --- a/harvester/server/traces/fixed_id.definitions Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/traces/fixed_id.definitions Thu Aug 19 10:20:41 2010 +0300 @@ -168,6 +168,7 @@ [TRACE]TRACE_NORMAL[0x3]_DUP5_CHARVESTERAO_HARVESTFILEWITHUID=0x77 [TRACE]TRACE_NORMAL[0x3]_DUP5_CHARVESTERAO_HARVESTINGCOMPLETED=0x33 [TRACE]TRACE_NORMAL[0x3]_DUP5_CHARVESTERAO_REGISTERPROCESSORIGIN=0x82 +[TRACE]TRACE_NORMAL[0x3]_DUP5_CHARVESTERAO_RUNERROR=0xc4 [TRACE]TRACE_NORMAL[0x3]_DUP5_CHARVESTERAO_RUNL=0x56 [TRACE]TRACE_NORMAL[0x3]_DUP6_CHARVESTERAO_CHECKFILEEXTENSIONANDHARVESTL=0x2c [TRACE]TRACE_NORMAL[0x3]_DUP6_CHARVESTERAO_HANDLESESSIONOPENED=0x42 diff -r 63c982fb92f2 -r b73252188534 harvester/server/traces/harvesteraoTraces.h --- a/harvester/server/traces/harvesteraoTraces.h Thu Jul 15 19:07:24 2010 +0300 +++ b/harvester/server/traces/harvesteraoTraces.h Thu Aug 19 10:20:41 2010 +0300 @@ -164,6 +164,7 @@ #define DUP5_CHARVESTERAO_BOOTSCANL 0x3009c #define CHARVESTERAO_MEMORYLOW 0x3009d #define CHARVESTERAO_MEMORYGOOD 0x3009e +#define DUP5_CHARVESTERAO_RUNERROR 0x300c4 #endif diff -r 63c982fb92f2 -r b73252188534 iadstoprestart/src/iadrestart.cpp --- a/iadstoprestart/src/iadrestart.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/iadstoprestart/src/iadrestart.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -55,6 +55,7 @@ TRAP(err, MainL()); delete cleanup; + cleanup = NULL; __UHEAP_MARKEND; return err; } diff -r 63c982fb92f2 -r b73252188534 iadstoprestart/src/iadstop.cpp --- a/iadstoprestart/src/iadstop.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/iadstoprestart/src/iadstop.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -158,6 +158,7 @@ TRAP(err, MainL()); delete cleanup; + cleanup = NULL; __UHEAP_MARKEND; return err; } diff -r 63c982fb92f2 -r b73252188534 inc/mdscommoninternal.h --- a/inc/mdscommoninternal.h Thu Jul 15 19:07:24 2010 +0300 +++ b/inc/mdscommoninternal.h Thu Aug 19 10:20:41 2010 +0300 @@ -50,7 +50,7 @@ const TInt KMaxTitleFieldLength = 255; -const TInt KTriggerDbMaintenanceTreasholdValue( 2500 ); +const TInt KTriggerDbMaintenanceTreasholdValue( 3000 ); _LIT( KMdSServerName,"!MdSServer" ); // Server name _LIT( KMdSServerProcessString,"!MdSServer*" ); diff -r 63c982fb92f2 -r b73252188534 inc/mdssqliteconnection.h --- a/inc/mdssqliteconnection.h Thu Jul 15 19:07:24 2010 +0300 +++ b/inc/mdssqliteconnection.h Thu Aug 19 10:20:41 2010 +0300 @@ -237,11 +237,15 @@ /** * cleanup method (from TBase) - * according to status does Commit/Rollback/nothing + * according to status does Rollback or nothing if commit was succesfull */ inline void Close() { - if ( iErrorState != KErrNone ) + // Internal error state is KErrNone if the transaction could be created successfully, + // and the state is resetted if the transaction is committed succesfully. Only if the + // transaction is started succesfully but not committed, it needs to be rolled back + // to close the ongoing transaction + if ( iErrorState == KErrNone ) { TRAP( iErrorState, iConnection.TransactionRollbackL() ); } @@ -259,17 +263,6 @@ } /** - * Rolls back the transaction explicitly - * - possibility to receive leave - * eliminates actions on destructor. - */ - inline void RollbackL() - { - iConnection.TransactionRollbackL(); - Reset(); - } - - /** * Resets the transaction * (does not commit or rollback or do anything) */ diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/data/2002DD11.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/data/2002DD11.rss Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource file used to register ecom dll's with registry. +* +*/ + +#include + +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x2002DD11; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2002DD13; + implementations = + { + // Info for Reverse GeoCoder + IMPLEMENTATION_INFO + { + implementation_uid = 0x2002DD12; + version_no = 1; + display_name = "Reverse GeoCoder"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +//End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file provides the information required for building the plugin +* +*/ + +PRJ_PLATFORMS + + +PRJ_EXPORTS + + +PRJ_MMPFILES +reversegeocoderplugin.mmp + + + +//End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/group/reversegeocoderplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/group/reversegeocoderplugin.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project file for ECom ReverseGeoCoderPlugin plug-in +* +*/ + +#include +#include + +TARGET reversegeocoderplugin.dll +TARGETTYPE PLUGIN + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x2002DD11 +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE proxy.cpp +SOURCE reversegeocoderplugin.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../ReverseGeocode/inc + + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/stdapis + + +SOURCEPATH ../data +START RESOURCE 2002DD11.rss +TARGET reversegeocoderplugin.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY reversegeocode.lib +LIBRARY libc.lib + +PAGED +BYTEPAIRCOMPRESSTARGET +OPTION ARMCC -O3 -OTime + +//End of File + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/inc/reversegeocoderplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/inc/reversegeocoderplugin.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The header file for ReverseGeoCoderPlugin that creates the ReverseGeocoder +* +*/ + + +#ifndef __REVERSEGEOCODERPLUGIN_H__ +#define __REVERSEGEOCODERPLUGIN_H__ + +// INCLUDES +#include + +#include "reversegeocode.h" + +/** + * CReverseGeoCoderPlugin + * + * An implementation of the CReverseGeoCoderPlugin definition. + * Encapsulates the reverse goecoding functionality + * This is concrete class, instance of which + * ECOM framework gives to ECOM clients. + */ +class CReverseGeoCoderPlugin : public CBase + { +public: + + /** + * Create instance of concrete implementation. + * @return: Instance of this class. + */ + static CReverseGeoCoderPlugin* NewL(); + + /** + * Static constructor. + * @return: Instance of this class. + */ + static CReverseGeoCoderPlugin* NewLC(); + + /** + * Destructor. + */ + ~CReverseGeoCoderPlugin(); + + +protected: + + /** + * The default constructor + * Perform the first phase of two phase construction + */ + CReverseGeoCoderPlugin(); + + /** + * Perform the second phase construction of a + * CImplementationClassPlus object. + */ + void ConstructL(); + +public: + + /** + * Creates the instance of Reverse Geocoder + * + */ + void CreateReverseGeoCoderL(); + + /** + * Initializes the ReverseGeoCodeObserver + * @param: aObserver The observer class instance that is to be notified when reverse geocoding completes + * + */ + virtual void AddObserverL(MReverseGeocodeObserver& aObserver); + + /** + * A wrapper API to fetch the address from geocoordinates + * Internally calls the ReverseGeoCoder + * @param aLocality A TLocality object that contains the geocoordinate information + * @param aOption Indicates if the connection is silent connection or not + * + */ + virtual void GetAddressByCoordinateL( TLocality aLocality,const TConnectionOption aOption ); + + /** + * Wrapper API to check if the ReverseGeoCoder allows a silent connection + * @return:TBool Indicates if a silent connection is allowed + * + */ + virtual TBool SilentConnectionAllowed(); + +private: + + /** + * iRevGeocoder + * An instance of the CReverseGeocode class to fetch the place name from geocoordinates + */ + CReverseGeocode *iRevGeocoder; + + /* + * iObserver + * An instance of the class that is to be notified once Reverse Geocoding is completed + */ + MReverseGeocodeObserver* iObserver; + /** + * iDtorKey + * Identification of the plugin on cleanup + */ + TUid iDtorKey; + + }; + + +#endif //__REVERSEGEOCODERPLUGIN_H__ + +//End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/sis/ReverseGeoCoderPlugin_stub.sis Binary file locationmanager/ReverseGeoCoderPlugin/sis/ReverseGeoCoderPlugin_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for ReverseGeoCoderPlugin + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"ReverseGeoCoder Plugin Patch"},(0x2002DD11), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\epoc32\RELEASE\armv5\UREL\ReverseGeoCoderPlugin.dll"-"c:\sys\bin\ReverseGeoCoderPlugin.dll" +"\epoc32\data\z\resource\plugins\reversegeocoderplugin.rsc"-"c:\resource\plugins\reversegeocoderplugin.rsc" diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"reversegeocoderplugin"}, (0x2002DD11), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/src/proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/src/proxy.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file is the standard proxy for the ECOM plugin +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "reversegeocoderplugin.h" + + +// ---------------------------------------------------------------------------- +// Provides a key value pair table, this is used to identify +// the correct construction function for the requested interface. +// ---------------------------------------------------------------------------- +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x2002DD12, CReverseGeoCoderPlugin::NewL) + }; + +// ---------------------------------------------------------------------------- +// ImplementationGroupProxy +// Function used to return an instance of the proxy table. +// ---------------------------------------------------------------------------- + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +//End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeoCoderPlugin/src/reversegeocoderplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeoCoderPlugin/src/reversegeocoderplugin.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The source file for ReverseGeoCoderPlugin that creates the ReverseGeocoder +* +*/ + +// INCLUDE FILES +#include +#include + + +#include "reversegeocoderplugin.h" +#include "reversegeocode.h" +#include "geotagger.h" +#include "locationmanagerdebug.h" + + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::NewL +// Create instance of concrete ECOM interface implementation +// ---------------------------------------------------------------------------- +// +CReverseGeoCoderPlugin* CReverseGeoCoderPlugin::NewL() + { + LOG( "CReverseGeoCoderPlugin::NewL" ); + CReverseGeoCoderPlugin* self = CReverseGeoCoderPlugin::NewLC(); + CleanupStack::Pop(self); + return self; + } + + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::NewLC +// Create instance of concrete ECOM interface implementation +// ---------------------------------------------------------------------------- +// +CReverseGeoCoderPlugin* CReverseGeoCoderPlugin::NewLC() + { + LOG( "CReverseGeoCoderPlugin::NewLC" ); + CReverseGeoCoderPlugin* self = new (ELeave) CReverseGeoCoderPlugin; + CleanupStack::PushL (self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::CReverseGeoCoderPlugin() +// The default constructor +// ---------------------------------------------------------------------------- +// +CReverseGeoCoderPlugin::CReverseGeoCoderPlugin() + : iRevGeocoder(NULL), + iObserver(NULL) + { + } + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::ConstructL +// Second phase construction. +// ---------------------------------------------------------------------------- +// +void CReverseGeoCoderPlugin::ConstructL() + { + LOG( "CReverseGeoCoderPlugin::ConstructL" ); + } + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin +// Destructor +// ---------------------------------------------------------------------------- +// +CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin() + { + LOG( "CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin,begin" ); + delete iRevGeocoder; + iRevGeocoder = NULL; + iObserver = NULL; + LOG( "CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin,end" ); + } + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::CreateReverseGeoCoderL +// Creates an instance of the ReverseGeoCoder +// ---------------------------------------------------------------------------- +// +void CReverseGeoCoderPlugin::CreateReverseGeoCoderL() + { + LOG( "CReverseGeoCoderPlugin::CreateReverseGeoCoderL,begin" ); + if(iObserver) + { + iRevGeocoder = CReverseGeocode::NewL(*iObserver); + } + LOG( "CReverseGeoCoderPlugin::CreateReverseGeoCoderL,end" ); + } + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::AddObserverL +// Initializes the ReverseGeoCodeObserver +// ---------------------------------------------------------------------------- +// +void CReverseGeoCoderPlugin::AddObserverL(MReverseGeocodeObserver& aObserver) + { + LOG( "CReverseGeoCoderPlugin::AddObserverL,begin" ); + iObserver = &aObserver; + + if(!iRevGeocoder) + { + CreateReverseGeoCoderL(); + } + LOG( "CReverseGeoCoderPlugin::AddObserverL,end" ); + } + + +// ---------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::GetAddressByCoordinateL +// Gets the address for the given geo-coordinaates. +// ---------------------------------------------------------------------------- +// +void CReverseGeoCoderPlugin::GetAddressByCoordinateL( TLocality aLocality, + const TConnectionOption aOption ) + { + LOG( "CReverseGeoCoderPlugin::GetAddressByCoordinateL,begin" ); + if(iRevGeocoder) + { + iRevGeocoder->GetAddressByCoordinateL(aLocality, aOption); + } + LOG( "CReverseGeoCoderPlugin::GetAddressByCoordinateL,end" ); + } + + + // ---------------------------------------------------------------------------- + // CReverseGeoCoderPlugin::SilentConnectionAllowed + // Wrapper API to check if the ReverseGeoCoder allows a silent connection + // ---------------------------------------------------------------------------- + // +TBool CReverseGeoCoderPlugin::SilentConnectionAllowed() + { + LOG( "CReverseGeoCoderPlugin::SilentConnectionAllowed,begin" ); + TBool ret = EFalse; + if(iRevGeocoder) + { + ret = iRevGeocoder->SilentConnectionAllowed(); + } + LOG1( "CReverseGeoCoderPlugin::SilentConnectionAllowed,end ret - %d", ret ); + return ret; + } + + + + //End of File + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/bwincw/reversegeocodewinscw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/bwincw/reversegeocodewinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CReverseGeocode@@SAPAV1@AAVMReverseGeocodeObserver@@@Z @ 1 NONAME ; class CReverseGeocode * CReverseGeocode::NewL(class MReverseGeocodeObserver &) + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/eabi/reversegeocodearm.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/eabi/reversegeocodearm.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _ZN15CReverseGeocode4NewLER23MReverseGeocodeObserver @ 1 NONAME + _ZTI23CConnectionTimerHandler @ 2 NONAME + _ZTV23CConnectionTimerHandler @ 3 NONAME + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +reversegeocode.mmp + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/group/reversegeocode.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/group/reversegeocode.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + +#include +#include + +#if defined(WINSCW) +deffile ../bwincw/reversegeocodewinscw.def +#elif defined(EABI) +deffile ../eabi/reversegeocodearm.def +#endif +nostrictdef + +VERSION 10.0 +TARGET reversegeocode.dll +TARGETTYPE dll +UID 0x1000008d 0xEF7E39A4 + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../inc + + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/stdapis + +SOURCEPATH ../src + +SOURCE clientengine.cpp +SOURCE xmlhandler.cpp +SOURCE internalreversegeocode.cpp +SOURCE internaladdressinfo.cpp +SOURCE reversegeocode.cpp +SOURCE connectiontimerhandler.cpp + +LIBRARY cone.lib +LIBRARY netmeta.lib +LIBRARY euser.lib +LIBRARY insock.lib +LIBRARY inetprotutil.lib +LIBRARY http.lib +LIBRARY ecom.lib // for HTTP Client API +LIBRARY bafl.lib +LIBRARY commdb.lib +LIBRARY cmmanager.lib // ALR / SNAP +LIBRARY xmlframework.lib +LIBRARY esock.lib +LIBRARY lbs.lib +LIBRARY charconv.lib +LIBRARY extendedconnpref.lib +LIBRARY etel.lib +LIBRARY etelmm.lib +LIBRARY libc.lib + +PAGED +BYTEPAIRCOMPRESSTARGET +OPTION ARMCC -O3 -OTime + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/clientengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/clientengine.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HTTP client engine, which takes of doing an Http GET request for +* the maps server. +*/ + +#ifndef __CLIENTENGINE_H__ +#define __CLIENTENGINE_H__ + +#include +#include +#include +#include +#include +#include +#include + +#include "reversegeocode.h" + +class RHTTPSession; +class RHTTPTransaction; + +const TInt KDefaultBufferSize = 256; + +/* + * Enumration for the different states of HTTP GET request. + */ +enum THttpStatus + { + EHttpSessionError =0, + EHttpExitingApp, + EHttpConnecting, + EHttpTxCancelled, + EHttpHdrReceived, + EHttpBytesReceieved, + EHttpBodyReceieved, + EHttpTxCompleted, + EHttpTxSuccess, + EHttpTxFailed, + EHttpConnectionFailure, + EHttpUnknownEvent, + EHttpMhfRunError, + EHttpAuthNote, + EHttpAuthFailed, + EHttpAuthRequired, + }; + +enum TMobileRoamingStatus + { + EMobileNotRegistered = 0x00, + EMobileRegHomeNetwork, // home network + EMobileNationalRoaming, + EMobileInternationalRoaming + }; + +/* +* MClientObserver +* CClientEngine passes events and responses body data with this interface. +* An instance of this class must be provided for construction of CClientEngine. +*/ +class MClientObserver + { + public: + /* + * ClientEvent() + * + * Called when event occurs in CClientEngine. + * + * @params aEvent Status of the event. + */ + virtual void ClientEvent( const THttpStatus& aEvent ) = 0; + + /* + * ClientBodyReceived() + * + * Called when a part of the HTTP body is received. + * + * @param aBodyData Part of the body data received. (e.g. part of + * the received HTML page) + */ + virtual void ClientBodyReceived( const TDesC8& aBodyData ) = 0; + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + virtual RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw() = 0; + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + virtual TBool IsRegisteredAtHomeNetwork() = 0; + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + virtual const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) = 0; + }; + + +/* +* Provides simple interface to HTTP Client API. +*/ +NONSHARABLE_CLASS( CClientEngine ): public CActive, + public MHTTPTransactionCallback, + public MMobilityProtocolResp + { + + //Internal Engine state + enum TEngineState + { + EIdle = 0, + EGet + }; + + public: + /* + * Create a CClientEngine object. + * + * @params iObserver refernce to the MClientObservers implementation + * + * @returns A pointer to the created instance of CClientEngine + */ + static CClientEngine* NewL( MClientObserver& iObserver ); + + /* + * Create a CClientEngine object. This leaves the object on the clean up + * stack. + * + * @params iObserver refernce to the MClientObservers implementation + * + * @returns A pointer to the created instance of CClientEngine + */ + static CClientEngine* NewLC( MClientObserver& iObserver ); + + /* + * Destroy the object + * + */ + ~CClientEngine(); + + /* + * Starts a new HTTP GET transaction. + * + * @param aUri URI to get request. (e.g. http://host.org") + */ + void IssueHTTPGetL( const TDesC8& aUri, const TConnectionOption aOption ); + + /* + * Closes currently running transaction and frees resources related to it. + */ + void CancelTransaction(); + + /* + * Closes the connection + */ + void CloseConnection(); + + + /* + * checks if silent connection is allowed + * @return ETrue if silent connection is allowed + */ + TBool SilentConnectionAllowed(); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + /* + * Perform the second phase construction of a CClientEngine object. + */ + void ConstructL(); + + /* + * Performs the first phase of two phase construction. + * @param iObserver The observer that is notified after the HTTP transcation is over + */ + CClientEngine( MClientObserver& iObserver ); + + /* + * Sets header value of an HTTP request. + * + * @param aHeaders Headers of the HTTP request + * @param aHdrField Enumerated HTTP header field, e.g. HTTP::EUserAgent + * @param aHdrValue New value for header field. + */ + void SetHeaderL( RHTTPHeaders aHeaders, TInt aHdrField, + const TDesC8& aHdrValue ); + + /* + * Sets up the connection + * @param aOption The connection option + */ + void SetupConnectionL( const TConnectionOption aOption ); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + //From MHTTPSessionEventCallback + /* + * Called by framework to notify about transaction events. + * + * @param aTransaction Transaction, where the event occured. + * @param aEvent Occured event. + */ + void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent ); + + /* + * Called by framework to notify about transaction events. + * + * @param aTransaction Transaction, where the event occured. + * @param aError Error status code. + * @param aEvent The event that was being processed when leave occured. + * + * @retuen KErrNone, if the error was handled. Otherwise the value of aError, or + * some other error value. Returning error value causes causes + * HTTP-CORE 6 panic. + */ + TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent ); + + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + // from MMobilityProtocolResp + void PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless ); + void NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless ); + void Error( TInt aError ); + + TBool IsDataConnectionAskAlwaysL(); + TMobileRoamingStatus UeRegNetworkStatus(); + TBool IsVisitorNetwork(const TMobileRoamingStatus& aRoamingStatus) const; + TBool IsWlanOnly(const TMobileRoamingStatus& aRoamingStatus, + const TCmGenConnSettings& aGenConnSettings) const; + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + + /** + * RunL + * This method is called on completion of the active object request + */ + + void RunL(); + + /** + * DoCancel + * Cancels any outstanding requests + */ + void DoCancel(); + + /** + * This method is called if the RunL leaves + * @param aError The errcode with which it leaves + */ + TInt RunError(TInt aError); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + + /** + * Submits a HTTP transaction + */ + void DoHTTPGetL(); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + // declare members + RSocketServ iSocketServ; + RConnection iConnection; + TUint32 iSelectedIap; + + RHTTPSession iSession; + RHTTPTransaction iTransaction; + + MClientObserver& iObserver; // Used for passing body data and events to UI + TBool iRunning; // ETrue, if transaction running + TBool iConnectionSetupDone; + + TInt iPrevProfileId; + + CActiveCommsMobilityApiExt* iMobility; + TBool iTransactionOpen; + TEngineState iEngineState; + HBufC8* iUri; + RCmManager iCmManager; + + }; + +#endif // __CLIENTENGINE_H__ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/connectiontimerhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/connectiontimerhandler.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Handle connection close +* +*/ + +#ifndef __CONNECTIONTIMERHANDLER_H__ +#define __CONNECTIONTIMERHANDLER_H__ + + +// INCLUDES +#include +#include + +class MConnectionTimeoutHandlerInterface + { + public: + + /** + * Handles the timedout event + * @param aErrorCode the errcode for time out + */ + virtual void HandleTimedoutEvent(TInt aErrorCode) = 0; + }; + +class CConnectionTimerHandler : public CTimer +{ + +public: + + /** + * @param aConnectionTimeoutHandlerInterface the interace class that handles the timeout events + */ + static CConnectionTimerHandler* NewL(MConnectionTimeoutHandlerInterface& aConnectionTimeoutHandlerInterface); + + /** + * Destructor + */ + ~CConnectionTimerHandler(); + + /** + * starts a timer + * @param aTimeoutVal the time after which the timer will expire + */ + void StartTimer(const TInt aTimeoutVal); + + +protected: + + /** + * RunL + * from CActive + */ + void RunL(); + + private: + + /** + * Second phase construction + */ + void ConstructL(); + + /** + * @param aConnectionTimeoutHandlerInterface the interace class that handles the timeout events + */ + CConnectionTimerHandler(MConnectionTimeoutHandlerInterface& aConnectionTimeoutHandlerInterface); + + + +private: + + /** + * An instance of the interace class that handles the timeout events + */ + MConnectionTimeoutHandlerInterface& iConnectionTimeoutHandlerInterface; +}; + + +#endif /*__CONNECTIONTIMERHANDLER_H__*/ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/internaladdressinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/internaladdressinfo.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class from the CAddressInfo abstract class. +*/ + +#ifndef INTERNALADDRESSINFO_H_ +#define INTERNALADDRESSINFO_H_ + +#include "reversegeocode.h" +/* + * Internal implementation class for theCAddressInfo abstract class. + */ +NONSHARABLE_CLASS( CInternalAddressInfo ) : public MAddressInfo + { + public: + //from CAddressInfo class + + /** + * Gets the country name + * @return The country name + */ + virtual TDesC& GetCountryName(); + + /** + * Gets the state name + * @return The state name + */ + virtual TDesC& GetState(); + + /** + * Gets the city name + * @return The city name + */ + virtual TDesC& GetCity(); + + /** + * Gets the district name + * @return The district name + */ + virtual TDesC& GetDistrict(); + + /** + * Gets the pincode + * @return The cpincode + */ + virtual TDesC& GetPincode(); + + /** + * Gets the Thoroughfare name + * @return The Thoroughfare name + */ + virtual TDesC& GetThoroughfareName(); + + /** + * Gets the ThoroughfareNumber + * @return The ThoroughfareNumber + */ + virtual TDesC& GetThoroughfareNumber(); + + protected: + + /** + * Performs the secondphase construction + */ + void ConstructL(); + + /** + * Constructor + */ + CInternalAddressInfo(); + + public: + + + /** + * Factory function to create the instance + * @return A pointer to the CInternalAddressInfo + */ + static CInternalAddressInfo* NewL(); + + + /** + * Destructor + */ + ~CInternalAddressInfo(); + + // internal setter utilities to + // set the different attributes of the address. + + /** + * Sets the country name + * @param aCountryName The country name + */ + void SetCountryName( const TDesC& aCountryName ); + + /** + * Sets the state name + * @param aStateName The state name + */ + void SetState( const TDesC& aStateName ); + + /** + * Sets the City name + * @param aCityName The City name + */ + void SetCity( const TDesC& aCityName ); + + /** + * Sets the District name + * @param aDistrictName The District name + */ + void SetDistrict( const TDesC& aDistrictName ); + + /** + * Sets the Pincode + * @param aPincode The Pincode\ + */ + void SetPincode( const TDesC& aPincode ); + + /** + * Sets the Thoroughfare name + * @param aTFName The Thoroughfare name + */ + void SetThoroughfareName( const TDesC& aTFName ); + /** + * Sets the ThoroughfareNumber + * @param aTFNumber The ThoroughfareNumber + */ + void SetThoroughfareNumber( const TDesC& aTFNumber ); + + /** + * Resets the address info + */ + void ResetAddressInfoL(); + + private: + HBufC* iCountryName; + HBufC* iState; + HBufC* iCity; + HBufC* iDistrict; + HBufC* iPin; + HBufC* iTFName; + HBufC* iTFNumber; + }; +#endif /* INTERNALADDRESSINFO_H_ */ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/internalreversegeocode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/internalreversegeocode.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementaion class for the CReverseGeocode class. +*/ +#ifndef _INTERNALREVERSEGEOCODE_H_ +#define _INTERNALREVERSEGEOCODE_H_ + +#include + +#include "reversegeocode.h" +#include "xmlhandler.h" +#include "clientengine.h" +#include "connectiontimerhandler.h" + + +/* + * Internal implementation class for the CReverseGeocode class. + */ +NONSHARABLE_CLASS( CInternalReverseGeocode ) : public CReverseGeocode, + public MClientObserver, + public MXmlHandlerObserver, + public MConnectionTimeoutHandlerInterface + { +public: + /** + * Factory function to create the instance + * @param aObserver The observer instance that is to be notified when reverse geocoding is over + * @return A pointer to the CInternalReverseGeocode instance + */ + static CInternalReverseGeocode* NewL( MReverseGeocodeObserver& aObserver ); + + /** + * Gets the address for the given geo-coordinaates. + * @param aLocality The locality information + * aOption The connection option whether its silent or not + */ + virtual void GetAddressByCoordinateL( TLocality aLocality, const TConnectionOption aOption ); + + /** + * Checks if a silent connection is allowed + * @return ETrue If silentconnection is allowed + */ + virtual TBool SilentConnectionAllowed(); + + /** + * Helper function to get the appropriate language for the request. + * @param aLanguage The language for the request + */ + void GetLanguageForTheRequest( TDes8& aLanguage ); + + + /** + * destructor + * + */ + ~CInternalReverseGeocode(); + + // MConnectionTimeoutHandlerInterface + /** + * Closes the connection once it times out + * @param aErrorCode The Error code + */ + void HandleTimedoutEvent(TInt aErrorCode); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + protected: +#endif + + /** + * Second phase construction + */ + void ConstructL(); + + /** + * First phase construction. + * @param aObserver The observer instance that is to be notified when reverse geocoding is over + */ + CInternalReverseGeocode( MReverseGeocodeObserver& aObserver ); + + //From MClientObserver + /** + * callback which notifies progess of HTTP request + * @param aEvent The Httpstatus + */ + void ClientEvent( const THttpStatus& aEvent ); + + /** + * callback through which the HTTP body data is recieved. + * @param aBodyData The body recieved + */ + void ClientBodyReceived(const TDesC8& aBodyData); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + + //From MXmlHandlerObserver + /** + * callback which notifys the completion of parsing. + * @param aError The err code + * aAddressInfo The address info obtained after parsing + */ + void OnParseCompletedL( TInt aError, MAddressInfo& aAddressInfo ); + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + TBool IsRegisteredAtHomeNetwork(); + + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + + /** + * Starts the timer + */ + void StartTimer(); + + /** + * Closes the http connection and notifies the observer + */ + void CloseConnection(); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + CXmlHandler *iXmlHandler; + CClientEngine *iClientEngine; + CInternalAddressInfo *iAddressInfo; + HBufC8* iXMLBuf; + MReverseGeocodeObserver& iObserver; + CConnectionTimerHandler* iTimer; + + // Optimize the buffer len..?? + TBuf8 iQueryString; + TBuf8 iAuthCode; + TBuf8 iRefURL; + TBuf8 iLang; + TBool iStartTimerFlag; +}; + +#endif //_INTERNALREVERSEGEOCODE_H_ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/reversegeocode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/reversegeocode.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Reverse Geocode utility which converts the geo coordinates in to +* the actual address information. +*/ + +#ifndef REVERSEGEOCODE_H_ +#define REVERSEGEOCODE_H_ + +#include +#include +#include +#include +#include "geotagger.h" + +/* + * Data class to get the address details. An handle to this type will be given to the + * user through MReverseGeocodeObserver::ReverseGeocodeComplete callback, through which + * user can retrieve the address details using the following interfaces. + * + **/ +class MAddressInfo + { + public: + /* + * Gets the reference to the country name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the Country Name. + */ + virtual TDesC& GetCountryName()= 0; + + /* + * Gets the reference to the State. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the State name. + */ + virtual TDesC& GetState()= 0; + + /* + * Gets the reference to the City. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the City Name. + */ + virtual TDesC& GetCity()= 0; + + /* + * Gets the reference to the District name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the District Name. + */ + virtual TDesC& GetDistrict()= 0; + + /* + * Gets the reference to the postal code. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the postal code. + */ + virtual TDesC& GetPincode()= 0; + + /* + * Gets the reference to the thoroughfare name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the thoroughfare name. + */ + virtual TDesC& GetThoroughfareName()= 0; + + /* + * Gets the reference to the thoroughfare number. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the thoroughfare number. + */ + virtual TDesC& GetThoroughfareNumber() = 0; + }; + +/* + * Observer class which exposes callbacks to notify the completion of reversegeocoding event. + * + **/ +class MReverseGeocodeObserver + { + public: + /* + * Callback function which notifys the completion of reverse geocode event. This signals the completion + * of the asynchronous function CReverseGeoCode::GetAddressByCoordinate. + * + * @param aErrorcode Error status KErrNone in case of success or other system specific errorcodes + * in case of failures. + * + * @param aAddressInfo refrence to the address stucture, through which user can access the + * address information. + */ + + virtual void ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ) =0; + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + virtual RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw() = 0; + + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + virtual TBool IsRegisteredAtHomeNetwork() = 0; + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + virtual const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) = 0; + }; + +/* + * CReverseGeocode + * Concrete class which exposes interfaces to convert the geo-coordinates information + * in to the address information. + * + **/ +class CReverseGeocode : public CBase + { + public: + /* + * Factory function to create the instance of CReverseGeocode Class. This also registers + * observer for getting the reverse geocode completion notifications. + * + * @param aObserver refrence to the instance MReverseGeocodeObserver's + * implementation class. + * @return pointer to the instance of CReverseGeocode. + */ + IMPORT_C static CReverseGeocode* NewL( MReverseGeocodeObserver& aObserver ); + + /* + * Gets the address information for the given geo coordinates. This is an asynchronous function + * Whose completion will be notified by the MReverseGeocodeObserver::ReverseGeocodeComplete callback. + * + * @param aObserver refrence to the instance MReverseGeocodeObserver's + * implementation class. + */ + virtual void GetAddressByCoordinateL( TLocality aLocality, + const TConnectionOption aOption = ESilent ) = 0; + + /* + * checks if silent connection is allowed + * @return ETrue if silent connection is allowed + */ + virtual TBool SilentConnectionAllowed() = 0; + }; + +#endif /* REVERSEGEOCODE_H_ */ diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/inc/xmlhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/inc/xmlhandler.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XMLHandler class to parse the resultant reverse geocoded +* information. +*/ + +#ifndef __XMLHANDLER_H__ +#define __XMLHANDLER_H__ + +// INCLUDE FILES +#include +#include // for mcontenthandler +#include // for cparser +using namespace Xml; + +//Forward declarations +class CAddressInfo; +class CInternalAddressInfo; + +/* + * Category of the address information. This is used for + * internal parsing procedure. + */ +namespace xmlhandler + { + enum TLocationInfoType + { + ENone = 0, + ECountryName, + EState, + ECity, + EDistrict, + EPostalCode, + EThoroughfareName, + EThoroughfareNumber + }; + } + +/** + * MXmlHandlerObserver, an observer to CXmlHandler class. + */ +class MXmlHandlerObserver + { + public: + /* + * Signifies the completion of parsing of the output data. + * + * @param aError error status of parsing part. + * @param aLocationInfo reference to the resultant address information structure. + */ + virtual void OnParseCompletedL( TInt aError, MAddressInfo& aLocationInfo ) = 0; + }; + +/** + * CXmlHandler, a class to parse XML file and then output log information + * to a buffer. + */ +NONSHARABLE_CLASS( CXmlHandler ) : public MContentHandler + { + public: // Constructors and destructor + + /** + * 1st phase constructor + * + * @param aObserver The observer class to be notified after xml parsing is done + * aAddressInfo The address info + */ + static CXmlHandler* NewL( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ); + + /** + * 1st phase constructor pushes the object into cleanup stack + * @param aObserver The observer class to be notified after xml parsing is done + * aAddressInfo The address info + */ + static CXmlHandler* NewLC( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ); + + /** + * Destructor + */ + virtual ~CXmlHandler(); + + public: // Public methods + + /** + * Starts parsing the xml content + * @param aBuf The xml data + */ + + void StartParsingL( HBufC8 *aBuf ); + + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + + /** + * @param aObserver The observer class to be notified after xml parsing is done + * @param aAddressInfo The address info + */ + + CXmlHandler( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ); + + /** + * Second phase construction + */ + void ConstructL(); + + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: +#endif + // from MContentHandler + + /** + * This method is a callback to indicate the start of the document + * @param aDocParam Specifies the various parameters of the document. + * @param aErrorCode The error code. If this is not KErrNone then special action may be required. + * + */ + void OnStartDocumentL( const RDocumentParameters &aDocParam, TInt aErrorCode ); + + /** + * This method is a callback to indicate the end of the document + * @param aErrorCode The error code. If this is not KErrNone then special action may be required. + */ + void OnEndDocumentL( TInt aErrorCode ); + + /** + * This method is a callback to indicate an element has been parsed. + * @param aElement Is a handle to the element's details. + * @param aAttributes Contains the attributes for the element + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnStartElementL( const RTagInfo &aElement, const RAttributeArray &aAttributes, TInt aErrorCode ); + + /** + * This method is a callback to indicate the end of the element has been reached. + * @param aElement Is a handle to the element's details. + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + + void OnEndElementL( const RTagInfo &aElement, TInt aErrorCode ); + + /** + * This method is a callback that sends the content of the element + * @param aBytes the raw content data for the element + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnContentL( const TDesC8 &aBytes, TInt aErrorCode ); + + /** + * This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping + * @param aPrefix the Namespace prefix being declared + * @param aUri the Namespace URI the prefix is mapped to + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnStartPrefixMappingL( const RString &aPrefix, const RString &aUri, TInt aErrorCode ); + + /** + * This method is a notification of the end of the scope of a prefix-URI mapping + * @param aPrefix the Namespace prefix being declared + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnEndPrefixMappingL( const RString &aPrefix, TInt aErrorCode ); + + /** + * This method is a notification of ignorable whitespace in element content + * @param aBytes the ignored bytes from the document being parsed + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnIgnorableWhiteSpaceL( const TDesC8 &aBytes, TInt aErrorCode ); + + /** + * This method is a notification of a skipped entity + * @param aName the name of the skipped entity. + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnSkippedEntityL( const RString &aName, TInt aErrorCode ); + + /** + * This method is a receive notification of a processing instruction. + * @param aTarget the processing instruction target + * @param aData the processing instruction data + * @param aErrorCode The error code. If this is not KErrNone then special action may be required + */ + void OnProcessingInstructionL( const TDesC8 &aTarget, const TDesC8 &aData, TInt aErrorCode); + + /** + * This method indicates an error has occurred + * @param aErrorCode The error code. + */ + void OnError( TInt aErrorCode ); + + /** + * This method obtains the interface matching the specified uid. + * @param aUid the uid identifying the required interface + */ + TAny *GetExtendedInterface( const TInt32 aUid ); + +#ifdef REVERSEGEOCODE_UNIT_TESTCASE + public: +#else + private: // Private data +#endif + + MXmlHandlerObserver& iObserver; + CParser* iParser; + HBufC8* iBuffer; + CInternalAddressInfo *iAddressInfo; + xmlhandler::TLocationInfoType iCurrentElement; + TBool iThoroughfare ; + }; + +#endif /* __XMLHANDLER_H__ */ + +// End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/sis/ReverseGeocode_stub.sis Binary file locationmanager/ReverseGeocode/sis/ReverseGeocode_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for ReverseGeocode + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"ReverseGeocode Patch"},(0xEF7E39A4), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\ReverseGeocode.dll" -"c:\sys\bin\ReverseGeocode.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"reversegeocode"}, (0xEF7E39A4), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/clientengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/clientengine.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,673 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of HTTP Client Engine. +*/ + +//Symbian headers +#include +#include +#include +#include +#include +#include // voice call notification +#include // kmmtsymodulename +#include "locationmanagerdebug.h" +#include "clientengine.h" + +// Used user agent for requests +_LIT8(KUserAgent, "SimpleClient 1.0"); + +// This client accepts all content types. +_LIT8(KAccept, "*/*"); + +// ---------------------------------------------------------------------------- +// CClientEngine::NewL() +// ---------------------------------------------------------------------------- +CClientEngine* CClientEngine::NewL( MClientObserver& aObserver) + { + LOG("CClientEngine::NewL ,begin"); + CClientEngine* self = CClientEngine::NewLC( aObserver); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CClientEngine::NewLC() +// ---------------------------------------------------------------------------- +CClientEngine* CClientEngine::NewLC(MClientObserver& aObserver) + { + LOG("CClientEngine::NewLC ,begin"); + CClientEngine* self = new ( ELeave ) CClientEngine( aObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// CClientEngine::CClientEngine() +// ---------------------------------------------------------------------------- +CClientEngine::CClientEngine( MClientObserver& aObserver): + CActive( CActive::EPriorityStandard ), + iObserver( aObserver ), + iConnectionSetupDone( EFalse ), + iPrevProfileId( -1 ), + iMobility(NULL), + iTransactionOpen( EFalse ), + iUri(NULL) + { + } + +// ---------------------------------------------------------------------------- +// CClientEngine::~CClientEngine() +// ---------------------------------------------------------------------------- +CClientEngine::~CClientEngine() + { + LOG("CClientEngine::~CClientEngine ,begin"); + Cancel(); + + if ( iTransactionOpen ) + { + iTransaction.Close(); + iTransactionOpen = EFalse; + } + + if ( iMobility ) + { + iMobility->Cancel(); + } + delete iMobility; + iMobility = NULL; + + if(iConnectionSetupDone) + { + iSession.Close(); + iConnection.Close(); + iSocketServ.Close(); + } + delete iUri; + iUri = NULL; + + iCmManager.Close(); + + + // DON'T cose RMobilePhone object + + LOG("CClientEngine::~CClientEngine ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::ConstructL() +// ---------------------------------------------------------------------------- +void CClientEngine::ConstructL() + { + LOG("CClientEngine::ConstructL ,begin"); + CActiveScheduler::Add(this); + iCmManager.OpenL(); + LOG("CClientEngine::ConstructL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::CloseConnection() +// ---------------------------------------------------------------------------- +void CClientEngine::CloseConnection() + { + LOG("CClientEngine::CloseConnection ,begin" ); + if ( iTransactionOpen ) + { + iTransaction.Close(); + iTransactionOpen = EFalse; + } + + if ( iMobility ) + { + iMobility->Cancel(); + delete iMobility; + iMobility = NULL; + } + + if(iConnectionSetupDone) + { + iSession.Close(); + iConnection.Close(); + iSocketServ.Close(); + + iConnectionSetupDone = EFalse; + } + LOG("CClientEngine::CloseConnection ,end"); + } + + +// ---------------------------------------------------------------------------- +// CClientEngine::IsVisitorNetwork() +// ---------------------------------------------------------------------------- +TBool CClientEngine::IsVisitorNetwork(const TMobileRoamingStatus& aRegNetworkStatus) const + { + LOG1("CClientEngine::IsVisitorNetwork. reg network status - %d", + (TInt) aRegNetworkStatus); + + return (aRegNetworkStatus == EMobileNationalRoaming || + aRegNetworkStatus== EMobileInternationalRoaming); + + } + +// ---------------------------------------------------------------------------- +// CClientEngine::IsWlanOnly() +// ---------------------------------------------------------------------------- +TBool CClientEngine::IsWlanOnly(const TMobileRoamingStatus& aRoamingStatus, + const TCmGenConnSettings& aGenConnSettings) const + { + LOG1("CClientEngine::IsVisitorNetwork. reg network status - %d",(TInt) aRoamingStatus); + TBool wlanOnlyFlag = EFalse; + switch(aRoamingStatus) + { + case EMobileRegHomeNetwork: + LOG("Home network"); + wlanOnlyFlag = (aGenConnSettings.iCellularDataUsageHome == ECmCellularDataUsageDisabled); + break; + case EMobileNationalRoaming: + case EMobileInternationalRoaming: + LOG("Visitor network"); + wlanOnlyFlag = (aGenConnSettings.iCellularDataUsageVisitor == ECmCellularDataUsageDisabled); + break; + default: + break; + } // end of switch + LOG1("Wlan only flag - %d", wlanOnlyFlag ? 1 : 0); + return wlanOnlyFlag; + } + + +// ---------------------------------------------------------------------------- +// CClientEngine::UeRegNetworkStatus() +// ---------------------------------------------------------------------------- +TMobileRoamingStatus CClientEngine::UeRegNetworkStatus() + { + LOG("CClientEngine::UeRegNetworkStatus() ,begin"); + TMobileRoamingStatus roamingStatus = EMobileNotRegistered; + if(iObserver.IsRegisteredAtHomeNetwork()) + { + // home network. + roamingStatus = EMobileRegHomeNetwork; + LOG("UE registered in home network"); + } + else + { + // roaming network + TBool homeNwInfoAvailableFlag = EFalse; + const RMobilePhone::TMobilePhoneNetworkInfoV1& homeNwInfo = + iObserver.GetHomeNetworkInfo(homeNwInfoAvailableFlag); + if(homeNwInfoAvailableFlag) + { + RMobilePhone::TMobilePhoneNetworkCountryCode countryCode = + iObserver.GetCurrentRegisterNw().iCountryCode; + if(countryCode.Compare(homeNwInfo.iCountryCode) == 0) + { + // national roaming.. + LOG("UE is in nation roaming"); + roamingStatus = EMobileNationalRoaming; + } + else + { + // international roaming. + LOG("UE is in international roaming"); + roamingStatus = EMobileInternationalRoaming; + } + } + } + if(roamingStatus == EMobileNotRegistered) + { + LOG("UE is not registered with the network. Offline mode."); + } + LOG("CClientEngine::UeRegNetworkStatus ,end"); + return roamingStatus; + } + +// ---------------------------------------------------------------------------- +// CClientEngine::IsDataConnectionAskAlwaysL() +// ---------------------------------------------------------------------------- +TBool CClientEngine::IsDataConnectionAskAlwaysL() + { + LOG("CClientEngine::IsDataConnectionAskAlwaysL ,begin"); + TMobileRoamingStatus roamingStatus = UeRegNetworkStatus(); + + TCmGenConnSettings genConnSettings; + TBool retVal = EFalse; + iCmManager.ReadGenConnSettingsL(genConnSettings); + + LOG1("wlan usage - %d", genConnSettings.iUsageOfWlan); + LOG1("Home usage - %d", genConnSettings.iCellularDataUsageHome); + LOG1("Visitor usage - %d", genConnSettings.iCellularDataUsageVisitor); + + if((IsWlanOnly(roamingStatus, genConnSettings) && genConnSettings.iUsageOfWlan == ECmUsageOfWlanManual) // wlan + || (roamingStatus == EMobileRegHomeNetwork && // home + genConnSettings.iCellularDataUsageHome == ECmCellularDataUsageConfirm) + || (IsVisitorNetwork(roamingStatus) && // roaming + genConnSettings.iCellularDataUsageVisitor == ECmCellularDataUsageConfirm) + ) + { + retVal = ETrue; + } + LOG("CClientEngine::IsDataConnectionAskAlwaysL ,end"); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CClientEngine::SetupConnectionL() +// ---------------------------------------------------------------------------- +void CClientEngine::SetupConnectionL( const TConnectionOption aOption ) + { + LOG("CClientEngine::SetupConnectionL ,begin"); + if ( aOption == ESilent && IsDataConnectionAskAlwaysL()) + { + LOG("Silent mode. connection setup is asked always."); + if ( iConnectionSetupDone ) + { + LOG("Already connected. Close the connection\n"); + CloseConnection(); + } + User::Leave(KErrNotSupported); + } + if ( iConnectionSetupDone ) + { + // Connection setup is done + LOG("Already connected.\n"); + User::Leave(KErrAlreadyExists); + } + + + LOG1("SetupConnectionL: connection option: %d\n", aOption ); + + // Open HTTP Session + iSession.OpenL(); + User::LeaveIfError(iSocketServ.Connect()); + User::LeaveIfError(iConnection.Open(iSocketServ)); + + if ( aOption == ESilent ) + { + // Create overrides + TConnPrefList prefList; + TExtendedConnPref prefs; + prefs.SetSnapPurpose( CMManager::ESnapPurposeInternet ); + prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent ); + prefList.AppendL( &prefs ); + + iConnection.Start(prefList, iStatus); + } + else + { + iConnection.Start( iStatus ); + } + + + SetActive(); + LOG("CClientEngine::SetupConnectionL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::SetHeaderL() +// ---------------------------------------------------------------------------- +void CClientEngine::SetHeaderL( RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue ) + { + LOG("CClientEngine::SetHeaderL ,begin"); + RStringF valStr = iSession.StringPool().OpenFStringL( aHdrValue ); + CleanupClosePushL( valStr ); + THTTPHdrVal val(valStr); + aHeaders.SetFieldL( iSession.StringPool().StringF( aHdrField, RHTTPSession::GetTable()), val); + CleanupStack::PopAndDestroy(); // valStr + LOG("CClientEngine::SetHeaderL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::IssueHTTPGetL() +// ---------------------------------------------------------------------------- +void CClientEngine::IssueHTTPGetL( const TDesC8& aUri, const TConnectionOption aOption ) + { + LOG("CClientEngine::IssueHTTPGetL ,begin"); + if ( IsActive() ) + { + // If there is some request in pending state + // return with out further processing + // Should we leave here !? + LOG("Client engine is already active"); + return; + } + + delete iUri; + iUri = NULL; + + iUri = aUri.AllocL(); + + // Create HTTP connection + TRAPD( err, SetupConnectionL( aOption ) ); + //If the Err is KErrNone, It will lead to RunL and + //hence jump to the DoHTTPGetL() from there. + + if( err == KErrAlreadyExists ) + { + DoHTTPGetL(); + } + else if( err != KErrNone ) + { + LOG("Connection failure. Leaving."); + iObserver.ClientEvent( EHttpConnectionFailure ); + User::Leave(err); + } + iEngineState = EGet; + LOG("CClientEngine::IssueHTTPGetL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::DoHTTPGetL() +// ---------------------------------------------------------------------------- +void CClientEngine::DoHTTPGetL() + { + LOG("CClientEngine::DoHTTPGetL ,begin"); + // Parse string to URI (as defined in RFC2396) + TUriParser8 uri; + uri.Parse( *iUri ); + + // Get request method string for HTTP GET + RStringF method = iSession.StringPool().StringF( HTTP::EGET,RHTTPSession::GetTable() ); + + // Open transaction with previous method and parsed uri. This class will + // receive transaction events in MHFRunL and MHFRunError. + iTransaction = iSession.OpenTransactionL( uri, *this, method ); + iTransactionOpen = ETrue; + + // Set headers for request; user agent and accepted content type + RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); + SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent ); + SetHeaderL( hdr, HTTP::EAccept, KAccept ); + + // Submit the transaction. After this the framework will give transaction + // events via MHFRunL and MHFRunError. + iTransaction.SubmitL(); + + iObserver.ClientEvent( EHttpConnecting ); + LOG("CClientEngine::DoHTTPGetL ,end"); +} + +// ---------------------------------------------------------------------------- +// CClientEngine::CancelTransaction() +// ---------------------------------------------------------------------------- +void CClientEngine::CancelTransaction() + { + LOG("CClientEngine::CancelTransaction ,begin"); + iEngineState = EIdle; + delete iUri; + iUri = NULL; + + // Close() also cancels transaction (Cancel() can also be used but + // resources allocated by transaction must be still freed with Close()) + if( iTransactionOpen ) + { + iTransaction.Close(); + iTransactionOpen = EFalse; + + iObserver.ClientEvent( EHttpTxCancelled ); + } + LOG("CClientEngine::CancelTransaction ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::MHFRunL() +// ---------------------------------------------------------------------------- +void CClientEngine::MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent ) + { + LOG("CClientEngine::MHFRunL ,begin"); + switch ( aEvent.iStatus ) + { + case THTTPEvent::EGotResponseHeaders: + { + // HTTP response headers have been received. Use + // aTransaction.Response() to get the response. However, it's not + // necessary to do anything with the response when this event occurs. + iObserver.ClientEvent( EHttpHdrReceived ); + break; + } + case THTTPEvent::EGotResponseBodyData: + { + // Part (or all) of response's body data received. Use + // aTransaction.Response().Body()->GetNextDataPart() to get the actual + // body data. + + // Get the body data supplier + MHTTPDataSupplier* body = aTransaction.Response().Body(); + TPtrC8 dataChunk; + + // GetNextDataPart() returns ETrue, if the received part is the last + // one. + TBool isLast = body->GetNextDataPart(dataChunk); + iObserver.ClientBodyReceived(dataChunk); + + iObserver.ClientEvent( EHttpBytesReceieved ); + + // NOTE: isLast may not be ETrue even if last data part received. + // (e.g. multipart response without content length field) + // Use EResponseComplete to reliably determine when body is completely + // received. + if( isLast ) + { + iObserver.ClientEvent( EHttpBodyReceieved ); + } + // Always remember to release the body data. + body->ReleaseData(); + break; + } + case THTTPEvent::EResponseComplete: + { + // Indicates that header & body of response is completely received. + // No further action here needed. + + iObserver.ClientEvent( EHttpTxCompleted ); + break; + } + case THTTPEvent::ESucceeded: + { + // Indicates that transaction succeeded. + iObserver.ClientEvent( EHttpTxSuccess ); + // Transaction can be closed now. It's not needed anymore. + aTransaction.Close(); + iTransactionOpen = EFalse; + break; + } + case THTTPEvent::EFailed: + { + // Transaction completed with failure. + iObserver.ClientEvent( EHttpTxFailed ); + aTransaction.Close(); + iTransactionOpen = EFalse; + break; + } + default: + // There are more events in THTTPEvent, but they are not usually + // needed. However, event status smaller than zero should be handled + // correctly since it's error. + { + if ( aEvent.iStatus < 0 ) + { + iObserver.ClientEvent( EHttpConnectionFailure ); + // Close the transaction on errors + aTransaction.Close(); + iTransactionOpen = EFalse; + } + break; + } + } + LOG("CClientEngine::MHFRunL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::MHFRunError() +// ---------------------------------------------------------------------------- +TInt CClientEngine::MHFRunError( TInt /*aError*/, RHTTPTransaction /*aTransaction*/, const THTTPEvent& /*aEvent*/ ) + { + LOG("CClientEngine::MHFRunError ,begin"); + // Just notify about the error and return KErrNone. + CloseConnection(); + iObserver.ClientEvent(EHttpMhfRunError); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CClientEngine::PreferredCarrierAvailable() +// ---------------------------------------------------------------------------- +void CClientEngine::PreferredCarrierAvailable( TAccessPointInfo /*aOldAPInfo*/, + TAccessPointInfo /*aNewAPInfo*/, + TBool /*aIsUpgrade*/, + TBool aIsSeamless ) + { + LOG("CClientEngine::PreferredCarrierAvailable ,begin"); + if( !aIsSeamless && iMobility) + { + iMobility->MigrateToPreferredCarrier(); + } + LOG("CClientEngine::PreferredCarrierAvailable ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::NewCarrierActive() +// ---------------------------------------------------------------------------- +void CClientEngine::NewCarrierActive( TAccessPointInfo /*aNewAPInfo*/, + TBool aIsSeamless ) + { + LOG("CClientEngine::NewCarrierActive ,begin"); + if( !aIsSeamless && iMobility) + { + iMobility->NewCarrierAccepted(); + } + LOG("CClientEngine::NewCarrierActive ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::Error() +// ---------------------------------------------------------------------------- +void CClientEngine::Error(TInt /*aError*/) + { + LOG("CClientEngine::Error"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::DoCancel() +// ---------------------------------------------------------------------------- +void CClientEngine::DoCancel() + { + LOG("CClientEngine::DoCancel"); + iConnection.Stop(); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::DoCancel() +// ---------------------------------------------------------------------------- +TInt CClientEngine::RunError(TInt /*aError*/) + { + LOG("CClientEngine::RunError"); + // Just notify about the error and return KErrNone. + CloseConnection(); + iObserver.ClientEvent( EHttpTxFailed ); + return KErrNone; + } +// ---------------------------------------------------------------------------- +// CClientEngine::RunL() +// ---------------------------------------------------------------------------- +void CClientEngine::RunL() + { + LOG1("CClientEngine::RunL: error is: %d\n", iStatus.Int() ); + TInt statusCode = iStatus.Int(); + if ( statusCode == KErrNone ) + { + // Connection done ok + iConnectionSetupDone = ETrue; + + RStringPool strPool = iSession.StringPool(); + + // Remove first session properties just in case. + RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); + + // Clear RConnection and Socket Server instances + connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable())); + connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable())); + + // Clear the proxy settings + connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable())); + connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable())); + + // RConnection and Socket Server + connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ, + RHTTPSession::GetTable()), + THTTPHdrVal (iSocketServ.Handle()) ); + + TInt connPtr1 = REINTERPRET_CAST(TInt, &iConnection); + connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ), THTTPHdrVal (connPtr1) ); + + // Register for mobility API + if(iMobility) + { + delete iMobility; + iMobility = NULL ; + } + iMobility = CActiveCommsMobilityApiExt::NewL( iConnection, *this ); + // Start selected HTTP action + switch( iEngineState ) + { + case EIdle: + { + // + CancelTransaction(); + break; + } + case EGet: + { + DoHTTPGetL(); + break; + } + }; + } + else + { + //handle error + if ( statusCode == KErrPermissionDenied ) + { + iObserver.ClientEvent( EHttpAuthFailed ); + } + else + { + //Throw some general Transaction falure error! + iObserver.ClientEvent( EHttpTxFailed ); + } + CloseConnection(); + } + LOG("CClientEngine::RunL ,end"); + } + +// ---------------------------------------------------------------------------- +// CClientEngine::SilentConnectionAllowed() +// ---------------------------------------------------------------------------- +TBool CClientEngine::SilentConnectionAllowed() + { + LOG("CClientEngine::SilentConnectionAllowed ,begin"); + TBool retVal = EFalse; + TRAPD(err, retVal = IsDataConnectionAskAlwaysL()); + if(err == KErrNone) + { + // data connection is always ask... Silent connection is not allowed + retVal = !retVal; + } + LOG1("CClientEngine::SilentConnectionAllowed ,end. Ret - %d", retVal); + return retVal; + } + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/connectiontimerhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/connectiontimerhandler.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Connection close timer handler +*/ + +#include "connectiontimerhandler.h" +#include "locationmanagerdebug.h" + + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::CConnectionTimerHandler() +// ---------------------------------------------------------------------------- + + +CConnectionTimerHandler::CConnectionTimerHandler(MConnectionTimeoutHandlerInterface& aConnectionTimeoutHandlerInterface): + CTimer(EPriorityStandard ), + iConnectionTimeoutHandlerInterface(aConnectionTimeoutHandlerInterface) +{ + +} + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::~CConnectionTimerHandler() +// ---------------------------------------------------------------------------- +CConnectionTimerHandler::~CConnectionTimerHandler() + { + } + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::NewL() +// ---------------------------------------------------------------------------- +CConnectionTimerHandler* CConnectionTimerHandler::NewL(MConnectionTimeoutHandlerInterface& aConnectionTimeoutHandlerInterface) + { + LOG("CConnectionTimerHandler::NewL ,begin"); + CConnectionTimerHandler* self = new( ELeave ) CConnectionTimerHandler(aConnectionTimeoutHandlerInterface); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + + return self; + } + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::ConstructL() +// ---------------------------------------------------------------------------- +void CConnectionTimerHandler::ConstructL() + { + LOG("CConnectionTimerHandler::ConstructL ,begin"); + CActiveScheduler::Add(this); + CTimer::ConstructL(); + LOG("CConnectionTimerHandler::ConstructL ,end"); + } + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::StartTimer +// starts a timer +// ---------------------------------------------------------------------------- +void CConnectionTimerHandler::StartTimer(const TInt aTimeoutVal) + { + LOG("CConnectionTimerHandler::StartTimer ,begin"); + if(!IsActive()) + { + // already active. + LOG("Timer started"); + After(aTimeoutVal); + } + LOG("CConnectionTimerHandler::StartTimer ,end"); + } + +// ---------------------------------------------------------------------------- +// CConnectionTimerHandler::RunL +// ---------------------------------------------------------------------------- +void CConnectionTimerHandler::RunL( ) + { + LOG("CConnectionTimerHandler::RunL ,begin"); + iConnectionTimeoutHandlerInterface.HandleTimedoutEvent(iStatus.Int()); + LOG("CConnectionTimerHandler::RunL ,end"); + } + + + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/internaladdressinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/internaladdressinfo.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Internal address info structure. +*/ + +#include "internaladdressinfo.h" +#include "locationmanagerdebug.h" + + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::CInternalAddressInfo() +// Constructor +// ---------------------------------------------------------------------------- +CInternalAddressInfo::CInternalAddressInfo(): iCountryName( NULL ), + iState( NULL ), + iCity( NULL ), + iDistrict( NULL ), + iPin( NULL ), + iTFName( NULL ), + iTFNumber( NULL ) + + { + + + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::~CInternalAddressInfo() +// Destructor +// ---------------------------------------------------------------------------- +CInternalAddressInfo::~CInternalAddressInfo() + { + LOG("CInternalAddressInfo::~CInternalAddressInfo ,begin"); + if (iCountryName) + { + delete iCountryName; + iCountryName = NULL ; + } + if (iState) + { + delete iState; + iState= NULL ; + } + if (iCity) + { + delete iCity; + iCity= NULL ; + } + if (iDistrict) + { + delete iDistrict; + iDistrict = NULL ; + } + if (iPin) + { + delete iPin; + iPin = NULL ; + } + if (iTFName) + { + delete iTFName; + iTFName = NULL ; + } + if (iTFNumber) + { + delete iTFNumber; + iTFNumber = NULL ; + } + + LOG("CInternalAddressInfo::~CInternalAddressInfo ,end"); + } + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::NewL() +// Factory function to create the instance +// ---------------------------------------------------------------------------- +CInternalAddressInfo* CInternalAddressInfo::NewL() + { + LOG("CInternalAddressInfo::NewL ,begin"); + CInternalAddressInfo *self = new (ELeave) CInternalAddressInfo(); + CleanupStack::PushL(self); + self->ConstructL(); + + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::ConstructL() +// Second phase construction. +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::ConstructL() + { + LOG("CInternalAddressInfo::ConstructL ,begin"); + //Copy all with the empty strings; + ResetAddressInfoL(); + LOG("CInternalAddressInfo::ConstructL ,end"); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetCountryName() +// Gets Country name +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetCountryName() + { + return *iCountryName; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetState() +// Gets State name +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetState() + { + return *iState; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetCity() +// Gets City name. +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetCity() + { + return *iCity; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetDistrict() +// Gets District name of the address. +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetDistrict() + { + return *iDistrict; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetPincode() +// Gets the postal code. +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetPincode() + { + return *iPin; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetThoroughfareName() +// Gets thoroughfare name +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetThoroughfareName() + { + return *iTFName; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::GetThoroughfareNumber() +// Gets thoroughfare number +// ---------------------------------------------------------------------------- +TDesC& CInternalAddressInfo::GetThoroughfareNumber() + { + return *iTFNumber; + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetCountryName() +// Sets the country name information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetCountryName( const TDesC& aCountryName ) + { + if( iCountryName ) + { + delete iCountryName; + } + iCountryName = aCountryName.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetState() +// Sets the State name information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetState( const TDesC& aState ) + { + if( iState ) + { + delete iState; + } + iState = aState.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetCity() +// Sets the City name information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetCity( const TDesC& aCity ) + { + if( iCity ) + { + delete iCity; + } + iCity = aCity.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetDistrict() +// Sets the District name information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetDistrict( const TDesC& aDisrict ) + { + if( iDistrict ) + { + delete iDistrict; + } + iDistrict = aDisrict.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetPincode() +// Sets the Postal code information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetPincode( const TDesC& aPincode ) + { + if( iPin ) + { + delete iPin; + } + iPin = aPincode.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetThoroughfareName() +// Sets the thoroughfare name information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetThoroughfareName( const TDesC& aTFName ) + { + if( iTFName ) + { + delete iTFName; + } + iTFName = aTFName.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::SetThoroughfareNumber() +// Sets the thoroughfare number information +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::SetThoroughfareNumber( const TDesC& aTFNumber ) + { + if( iTFNumber ) + { + delete iTFNumber; + } + iTFNumber = aTFNumber.Alloc(); + } + + +// ---------------------------------------------------------------------------- +// CInternalAddressInfo::ResetAddressInfoL() +// resets the address info +// ---------------------------------------------------------------------------- +void CInternalAddressInfo::ResetAddressInfoL() + { + // Allocate empty buffer to avoid crash on get method + + // Free memory + if(iCountryName) + { + delete iCountryName; + iCountryName = NULL; + } + if(iState) + { + delete iState; + iState = NULL; + } + if(iCity) + { + delete iCity; + iCity = NULL; + } + if(iDistrict) + { + delete iDistrict; + iDistrict = NULL; + } + if(iPin) + { + delete iPin; + iPin = NULL; + } + if(iTFName) + { + delete iTFName; + iTFName = NULL; + } + if(iTFNumber) + { + delete iTFNumber; + iTFNumber = NULL; + } + // Allocate empty strings, + iCountryName = KNullDesC().AllocL(); + iCity = KNullDesC().AllocL(); + iState = KNullDesC().AllocL(); + iDistrict = KNullDesC().AllocL(); + iPin = KNullDesC().AllocL(); + iTFName = KNullDesC().AllocL(); + iTFNumber = KNullDesC().AllocL(); + + } + + +//end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/internalreversegeocode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/internalreversegeocode.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,463 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of reversegeocodea achieved using HTTP get +* request to the Maps server. +*/ + +#include "internalreversegeocode.h" +#include "internaladdressinfo.h" +#include "locationmanagerdebug.h" + + +//Maximum length for the response buffer size +const int KMaxResponseLength = 2048; +//Authentication token for the Maps server +//This authentication in specific to our photo-tagging feature +_LIT8( KAuthenticationToken, "eb0ae60051e27d3cfcae94e7b47e9eff" ); +//Static RefererURL which shows that request has been made from this app +_LIT8( KRefererURL, "s60_app_photos" ); + +//Language option for the REST request +_LIT8( KDefaultLanguage, "eng" ); + + +//Format of the HTTP request for the reverse geocode +_LIT8( KRequestFormat, "http://loc.mobile.maps.svc.ovi.com/geocoder/rgc/1.0?token=%S&referer=%S&n=10&lat=%f&long=%f&lg=%S&output=xml" ); + + +// http://www.loc.gov/marc/languages/ +// These are the nokia language id converted to MARC language strings. + static const char Marc_Table[ 104 ][ 4 ] = { + " ", // dummy + "ENG", // 1 English + "FRE", // 2 French + "GER", // 3 German + "SPA", // 4 Spanish + "ITA", // 5 Italian + "SWE", // 6 Swedish + "DAN", // 7 Danish + "NOR", // 8 Norwegian + "FIN", // 9 Finnish + "010", // 10 American + "011", // 11 Swiss French + "GSW", // 12 Swiss German + "POR", // 13 Portuguese + "TUR", // 14 Turkish + "ICE", // 15 Icelandic + "RUS", // 16 Russian + "HUN", // 17 Hungarian + "DUT", // 18 Dutch + "019", // 19 Flemish + "020", // 20 Australian English + "021", // 21 Belgian French + "022", // 22 Austrian German + "023", // 23 New Zealand English + "FRE", // 24 International French + "CZE", // 25 Czech + "SLO", // 26 Slovak + "POL", // 27 Polish + "SLV", // 28 Slovenian + "029", // 29 TaiwanChinese + "CHT", // 30 HongKongChinese + "CHI", // 31 PeoplesRepublicOfChina Chinese + "JPN", // 32 Japanese + "THA", // 33 Thai + "AFR", // 34 Afrikaans + "ALB", // 35 Albanian + "AMH", // 36 Amharic + "ARA", // 37 Arabic + "ARM", // 38 Armenian + "TGL", // 39 Tagalog + "BEL", // 40 Belarusian + "BEN", // 41 Bengali + "BUL", // 42 Bulgarian + "BUR", // 43 Burmese + "CAT", // 44 Catalan + "SCR", // 45 Croatian + "046", // 46 Canadian English + "ENG", // 47 International English + "048", // 48 SouthAfrican English + "EST", // 49 Estonian + "PER", // 50 Persian (Farsi) + "051", // 51 Canadian French + "GAE", // 52 Scots Gaelic + "GEO", // 53 Georgian + "GRE", // 54 Greek + "055", // 55 Cyprus Greek + "GUJ", // 56 Gujarati + "HEB", // 57 Hebrew + "HIN", // 58 Hindi + "IND", // 59 Bahasa indonesia + "GLE", // 60 Irish + "061", // 61 Swiss Italian + "KAN", // 62 Kannada + "KAZ", // 63 Kazakh + "KHM", // 64 Khmer + "KOR", // 65 Korean + "LAO", // 66 Lao + "LAV", // 67 Latvian + "LIT", // 68 Lithuanian + "MAC", // 69 Macedonian + "070", // 70 Bahasa Malaysia + "MAL", // 71 Malayalam + "MAR", // 72 Marathi + "MOL", // 73 Moldavian + "MON", // 74 Mongolian + "NNO", // 75 Norwegian Nynorsk + "076", // 76 Brazilian Portuguese + "PAN", // 77 Punjabi + "RUM", // 78 Romanian + "SCC", // 79 Serbian + "SNH", // 80 Sinhalese + "SOM", // 81 Somali + "082", // 82 International Spanish + "083", // 83 LatinAmerican Spanish + "SWA", // 84 Swahili + "085", // 85 Finland Swedish + "TAJ", // 86 Tajik + "TAM", // 87 Tamil + "TEL", // 88 Telugu + "TIB", // 89 Tibetan + "TIR", // 90 Tigrinya + "091", // 91 Cyprus Turkish + "TUK", // 92 Turkmen + "UKR", // 93 Ukrainian + "URD", // 94 Urdu + "UZB", // 95 Uzbek + "VIE", // 96 Vietnamese + "WEL", // 97 Welsh + "ZUL", // 98 Zulu + "UND", // 99 Other + "UND", // 100 Undef + "UND", // 101 Undef + "BAQ", // 102 Basque + "103", // 103 Galician + }; + + // Timer interval + const TInt KInterval = 15000000; // 15 seconds + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::NewL() +// Factory function to create the instance +// ---------------------------------------------------------------------------- +CInternalReverseGeocode* CInternalReverseGeocode::NewL( MReverseGeocodeObserver& aObserver ) + { + LOG( "CInternalReverseGeocode::NewL,begin" ); + CInternalReverseGeocode *self = new (ELeave) CInternalReverseGeocode( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::CInternalReverseGeocode() +// Constructor +// ---------------------------------------------------------------------------- +CInternalReverseGeocode::CInternalReverseGeocode( MReverseGeocodeObserver& aObserver ): + iXmlHandler ( NULL ), + iClientEngine ( NULL ), + iXMLBuf ( NULL ), + iObserver( aObserver ), + iTimer( NULL ), + iStartTimerFlag(EFalse) + { + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::~CInternalReverseGeocode() +// Destructor +// ---------------------------------------------------------------------------- +CInternalReverseGeocode::~CInternalReverseGeocode() + { + LOG( "CInternalReverseGeocode::~CInternalReverseGeocode,begin" ); + if ( iTimer) + { + iTimer->Cancel(); + delete iTimer; + iTimer = NULL; + } + delete iXMLBuf; + iXMLBuf = NULL; + delete iXmlHandler; + iXmlHandler = NULL; + delete iClientEngine; + iClientEngine = NULL; + delete iAddressInfo; + iAddressInfo = NULL; + + LOG( "CInternalReverseGeocode::~CInternalReverseGeocode,end" ); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::GetAddressByCoordinateL() +// Gets the address for the given geo-coordinaates. +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::GetAddressByCoordinateL( TLocality aLocality, + const TConnectionOption aOption ) + { + LOG("CInternalReverseGeocode::GetAddressByCoordinateL ,begin"); + TReal64 latitude = aLocality.Latitude(); + TReal64 longitude = aLocality.Longitude(); + + iAuthCode.Copy( KAuthenticationToken ); + iRefURL.Copy( KRefererURL ); + + + GetLanguageForTheRequest( iLang ); + + //Form the request URI + iQueryString.Format( KRequestFormat, &iAuthCode, &iRefURL, latitude, longitude, &iLang ); + TInt err = KErrNone; + TRAP(err, iClientEngine->IssueHTTPGetL( iQueryString, aOption )); + + if ( iTimer && iTimer->IsActive() ) + { + iTimer->Cancel(); + } + if(err == KErrNone || err == KErrNotSupported) + { + // connection is closed because of data usage is set to manual + iStartTimerFlag = EFalse; + } + LOG("CInternalReverseGeocode::GetAddressByCoordinateL ,end"); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::ConstructL() +// second phase construction. +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::ConstructL() + { + LOG( "CInternalReverseGeocode::ConstructL,begin" ); + iXMLBuf = HBufC8::NewL( KMaxResponseLength ); + + //Address Info + iAddressInfo = CInternalAddressInfo::NewL(); + + iXmlHandler = CXmlHandler::NewL( *this, iAddressInfo ); + + iClientEngine = CClientEngine::NewL( *this ); + + iTimer = CConnectionTimerHandler::NewL(*this); + + LOG( "CInternalReverseGeocode::ConstructL,end" ); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::OnParseCompletedL() +// callback which notifys the completion of parsing. +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::OnParseCompletedL( TInt aError, MAddressInfo& aLocationInfo ) + { + LOG( "CInternalReverseGeocode::OnParseCompletedL,begin" ); + ARG_USED(aLocationInfo); + iStartTimerFlag = ETrue; + iObserver.ReverseGeocodeComplete( aError, *iAddressInfo ); + if(iStartTimerFlag) + { + StartTimer(); + } + LOG( "CInternalReverseGeocode::OnParseCompletedL,end" ); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::ClientEvent() +// callback which notifys progess of HTTP request +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::ClientEvent( const THttpStatus& aEvent ) + { + LOG1( "CInternalReverseGeocode::ClientEvent,begin. Err - %d", aEvent); + TInt err = KErrNone; + //Have a Switch here + switch( aEvent ) + { + case EHttpTxCompleted: + //Reading is done + //Parse the String and get the restults + if( iXmlHandler ) + { + TRAP_IGNORE( iXmlHandler->StartParsingL( iXMLBuf ) ); + } + break; + //All these cases will in turn lead to + //generic failure due to connection/Tx related problems + case EHttpConnectionFailure: + // May happen if Socket connection fails + err = KErrCouldNotConnect; + iObserver.ReverseGeocodeComplete( err , *iAddressInfo ); + break; + case EHttpTxFailed: + case EHttpMhfRunError: + // May happen if Socket connection fails + // Complete the RGC with generic error. + err = KErrGeneral; + iObserver.ReverseGeocodeComplete( err , *iAddressInfo ); + break; + case EHttpTxCancelled: + //On Cancellation of request. + err = KErrCancel; + iObserver.ReverseGeocodeComplete( err , *iAddressInfo ); + break; + case EHttpAuthFailed: + //On Cancellation of request. + err = KErrPermissionDenied; + iObserver.ReverseGeocodeComplete( err , *iAddressInfo ); + break; + } + if(err != KErrNone) + { + LOG("Error occur while getting data."); + StartTimer(); + } + LOG( "CInternalReverseGeocode::ClientEvent,end" ); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::ClientBodyReceived() +// callback through which the HTTP body data is recieved. +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::ClientBodyReceived( const TDesC8& aBodyData ) + { + LOG( "CInternalReverseGeocode::ClientBodyReceived" ); + //Dump the contents here + TPtr8 ptr = iXMLBuf->Des(); + ptr.Zero(); + ptr.Append( aBodyData ); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::GetLanguageForTheRequest() +// Gets the appropriate language based on the Phone language setting +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::GetLanguageForTheRequest( TDes8& aLanguage ) + { + LOG( "CInternalReverseGeocode::GetLanguageForTheRequest,begin" ); + //get the current phone langauge + TInt phoneLangIndex = User::Language(); + + // Get the converted language + if ( phoneLangIndex < sizeof( Marc_Table ) / sizeof( Marc_Table[ 0 ] ) ) + { + aLanguage = (const TUint8*) Marc_Table[ phoneLangIndex ]; + } + else + { + //By default language will be Eng + aLanguage.Copy( KDefaultLanguage ); + } + LOG( "CInternalReverseGeocode::GetLanguageForTheRequest,begin" ); + } + + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::CloseConnection() +// Closes the http connection and notifies the observer +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::CloseConnection() + { + LOG( "CInternalReverseGeocode::CloseConnection ,begin" ); + if(iClientEngine) + { + iClientEngine->CloseConnection(); + LOG( "Connection closed\n" ); + TInt err = KErrCouldNotConnect; + iObserver.ReverseGeocodeComplete( err , *iAddressInfo ); + } + LOG( "CInternalReverseGeocode::CloseConnection,end" ); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::StartTimer() +// starts the timer +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::StartTimer() + { + LOG( "CInternalReverseGeocode::StartTimer ,begin" ); + if(iTimer) + { + iTimer->StartTimer( KInterval); + LOG( "Timer started" ); + } + LOG( "CInternalReverseGeocode::StartTimer,end" ); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::HandleTimedoutEvent() +// Closes the connection once it times out +// ---------------------------------------------------------------------------- +void CInternalReverseGeocode::HandleTimedoutEvent(TInt aErrorCode) + { + LOG( "CInternalReverseGeocode::HandleTimedoutEvent" ); + ARG_USED(aErrorCode); + CloseConnection(); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::SilentConnectionAllowed() +// Checks if a silent connection is allowed +// ---------------------------------------------------------------------------- +TBool CInternalReverseGeocode::SilentConnectionAllowed() + { + LOG( "CInternalReverseGeocode::SilentConnectionAllowed ,begin" ); + TBool retVal = EFalse; + if(iClientEngine) + { + retVal = iClientEngine->SilentConnectionAllowed(); + } + LOG1("Silent connection allowed ,end- %d", (TInt)retVal); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CInternalReverseGeocode::GetCurrentRegisterNw() + { + LOG( "CInternalReverseGeocode::GetCurrentRegisterNw ,begin" ); + return iObserver.GetCurrentRegisterNw(); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::IsRegisteredAtHomeNetwork() +// ---------------------------------------------------------------------------- +TBool CInternalReverseGeocode::IsRegisteredAtHomeNetwork() + { + LOG( "CInternalReverseGeocode::IsRegisteredAtHomeNetwork" ); + return iObserver.IsRegisteredAtHomeNetwork(); + } + +// ---------------------------------------------------------------------------- +// CInternalReverseGeocode::GetHomeNetworkInfo() +// ---------------------------------------------------------------------------- +const RMobilePhone::TMobilePhoneNetworkInfoV1& + CInternalReverseGeocode::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) + { + LOG( "CInternalReverseGeocode::GetHomeNetworkInfo" ); + return iObserver.GetHomeNetworkInfo(aHomeNwInfoAvailableFlag); + } + + +//end of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/reversegeocode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/reversegeocode.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of exported interface class of reverse geo-code +*/ + +#include "reversegeocode.h" +#include "internalreversegeocode.h" +#include "locationmanagerdebug.h" + +// -------------------------------------------------------------------------- +// CReverseGeocode::NewL() +// factory class to create the instance +// -------------------------------------------------------------------------- + +EXPORT_C CReverseGeocode* CReverseGeocode::NewL( MReverseGeocodeObserver& aObserver ) + { + LOG("CReverseGeocode::NewL ,begin"); + CInternalReverseGeocode *self = CInternalReverseGeocode::NewL( aObserver ); + + return self; + } + +//End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/ReverseGeocode/src/xmlhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/ReverseGeocode/src/xmlhandler.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,391 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the Parser +*/ + + + + +#include +#include "internaladdressinfo.h" +#include "xmlhandler.h" +#include "locationmanagerdebug.h" + +using namespace xmlhandler; + +// CONSTANTS +_LIT8( KXmlMimeType, "text/xml" ); +_LIT8( KCountry, "country" ); +_LIT8( KState, "state" ); +_LIT8( KDistrict, "district" ); +_LIT8( KCity, "city" ); +_LIT8( KPostalCode, "postCode" ); +_LIT8( KThoroughfare, "thoroughfare" ); +_LIT8( KNameTag, "name" ); +_LIT8( KNumberTag, "number" ); + +// METHODS DEFINITION + +// -------------------------------------------------------------------------- +// CXmlHandler::NewL +// -------------------------------------------------------------------------- +CXmlHandler* CXmlHandler::NewL( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ) + { + LOG("CXmlHandler::NewL ,begin"); + CXmlHandler* self = CXmlHandler::NewLC( aObserver, aAddressInfo ); + CleanupStack::Pop(); //self + return self; + } + +// -------------------------------------------------------------------------- +// CXmlHandler::NewLC +// -------------------------------------------------------------------------- + +CXmlHandler* CXmlHandler::NewLC( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ) + { + LOG("CXmlHandler::NewLC ,begin"); + CXmlHandler* self = new ( ELeave ) CXmlHandler( aObserver, aAddressInfo ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// -------------------------------------------------------------------------- +// CXmlHandler::~CXmlHandler +// -------------------------------------------------------------------------- +CXmlHandler::~CXmlHandler() + { + LOG("CXmlHandler::~CXmlHandler"); + delete iParser; + iParser = NULL; + delete iBuffer; + iBuffer = NULL; + } + +// -------------------------------------------------------------------------- +// CXmlHandler::CXmlHandler +// -------------------------------------------------------------------------- +CXmlHandler::CXmlHandler( MXmlHandlerObserver& aObserver, CInternalAddressInfo *aAddressInfo ): + iObserver( aObserver ), + iParser( NULL ), + iBuffer( NULL ), + iAddressInfo( aAddressInfo ), + iThoroughfare( EFalse ) + { + } + +// -------------------------------------------------------------------------- +// CXmlHandler::ConstructL +// -------------------------------------------------------------------------- +void CXmlHandler::ConstructL() + { + LOG("CXmlHandler::ConstructL ,begin"); + iParser = CParser::NewL( KXmlMimeType, *this ); + + } + +// -------------------------------------------------------------------------- +// CXmlHandler::StartParsingL() +// -------------------------------------------------------------------------- +void CXmlHandler::StartParsingL( HBufC8 *aBuf ) + { + LOG("CXmlHandler::StartParsingL ,begin"); + //Reset the address values before starting new content parsing + iAddressInfo->ResetAddressInfoL(); + + if( iBuffer ) + { + delete iBuffer; + iBuffer = NULL; + } + + iBuffer = HBufC8::NewL( aBuf->Size() ); + TPtr8 ptr = iBuffer->Des(); + ptr.Copy( aBuf->Ptr() , aBuf->Size() ); + + // Now, we have the whole file content in iBuffer. + // We are ready to parse the XML content. + iParser->ParseBeginL(); + iParser->ParseL( *iBuffer ); + + // Since we read the whole file contents within one-shot, + // we can call ParseEndL() right after calling ParseL(). + iParser->ParseEndL(); + LOG("CXmlHandler::StartParsingL ,end"); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnStartDocumentL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, + TInt aErrorCode ) + { + LOG1("CXmlHandler::OnStartDocumentL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + LOG("CXmlHandler::OnStartDocumentL ,end"); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnEndDocumentL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnEndDocumentL( TInt aErrorCode ) + { + LOG1("CXmlHandler::OnEndDocumentL ,Errcode - %d", aErrorCode); + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnStartElementL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnStartElementL( const RTagInfo& aElement, + const RAttributeArray& /*aAttributes*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnStartElementL , Errorcode - %d", aErrorCode); + if ( KErrNone == aErrorCode ) + { + // If we find the start of an element, we write to the screen, + // for example: "" + + if( !aElement.LocalName().DesC().Compare( KCountry ) ) + { + iCurrentElement = ECountryName; + } + else if( !aElement.LocalName().DesC().Compare( KState ) ) + { + iCurrentElement = EState; + } + else if( !aElement.LocalName().DesC().Compare( KCity ) ) + { + iCurrentElement = ECity; + } + else if( !aElement.LocalName().DesC().Compare( KDistrict ) ) + { + iCurrentElement = EDistrict; + } + else if( !aElement.LocalName().DesC().Compare( KPostalCode ) ) + { + iCurrentElement = EPostalCode; + } + else if( !aElement.LocalName().DesC().Compare( KThoroughfare ) ) + { + iThoroughfare = ETrue; + } + else if( !aElement.LocalName().DesC().Compare( KNameTag ) && iThoroughfare ) + { + iCurrentElement = EThoroughfareName; + } + else if( !aElement.LocalName().DesC().Compare( KNumberTag ) && iThoroughfare ) + { + iCurrentElement = EThoroughfareNumber; + } + else + { + ///Do something + } + } + else + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + LOG("CXmlHandler::OnStartElementL ,end"); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnEndElementL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnEndElementL ,Error code - %d", aErrorCode); + if( KErrNone == aErrorCode ) + { + // at the end of the tag + //Set it to ENone + iCurrentElement = ENone; + iThoroughfare = EFalse; + } + else + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnContentL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnContentL( const TDesC8 &aBytes, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnContentL ,Errorcode - %d", aErrorCode); + if( KErrNone == aErrorCode ) + { + + if( iCurrentElement == ENone ) + { + //ignore if the current element is not there + return; + } + + // convert the content to UCS-2 + // from UTF-8 + RBuf buffer; + buffer.CreateL( aBytes.Length() ); + CleanupClosePushL(buffer); + CnvUtfConverter::ConvertToUnicodeFromUtf8( buffer , aBytes ); + + if( iCurrentElement == ECountryName ) + { + iAddressInfo->SetCountryName( buffer ); + } + else if( iCurrentElement == EState ) + { + iAddressInfo->SetState( buffer ); + } + else if( iCurrentElement == EDistrict ) + { + iAddressInfo->SetDistrict( buffer ); + } + else if( iCurrentElement == ECity ) + { + iAddressInfo->SetCity( buffer ); + } + else if( iCurrentElement == EPostalCode ) + { + iAddressInfo->SetPincode( buffer ); + } + else if( iCurrentElement == EThoroughfareName ) + { + iAddressInfo->SetThoroughfareName( buffer ); + } + else if( iCurrentElement == EThoroughfareNumber ) + { + iAddressInfo->SetThoroughfareNumber( buffer ); + } + else + { + ///Do something + } + CleanupStack::PopAndDestroy(); // buffer + } + else + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + LOG("CXmlHandler::OnContentL ,end"); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnStartPrefixMappingL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnStartPrefixMappingL( const RString& /*aPrefix*/, + const RString& /*aUri*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnStartPrefixMappingL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnEndPrefixMappingL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnEndPrefixMappingL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnIgnorableWhiteSpaceL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/,TInt aErrorCode ) + { + LOG1("CXmlHandler::OnIgnorableWhiteSpaceL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnSkippedEntityL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnSkippedEntityL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnProcessingInstructionL() +// -------------------------------------------------------------------------- +void CXmlHandler::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode ) + { + LOG1("CXmlHandler::OnProcessingInstructionL ,Error code - %d", aErrorCode); + if( KErrNone != aErrorCode ) + { + iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ); + } + else + { + // Do nothing + } + } + +// -------------------------------------------------------------------------- +// CXmlHandler::OnError() +// -------------------------------------------------------------------------- +void CXmlHandler::OnError( TInt aErrorCode ) + { + LOG1("CXmlHandler::OnError ,Error code - %d", aErrorCode); + TRAP_IGNORE( iObserver.OnParseCompletedL( aErrorCode, *iAddressInfo ) ); + } + +// -------------------------------------------------------------------------- +// CXmlHandler::GetExtendedInterface() +// -------------------------------------------------------------------------- +TAny* CXmlHandler::GetExtendedInterface( const TInt32 /*aUid*/ ) + { + return 0; + } + +// End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/bwincw/locationmanagerclientwinscw.def --- a/locationmanager/client/bwincw/locationmanagerclientwinscw.def Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/bwincw/locationmanagerclientwinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -29,4 +29,10 @@ ?StopTrackLog@RTrackLog@@QAEXXZ @ 28 NONAME ; void RTrackLog::StopTrackLog(void) ?TrackLogName@RTrackLog@@QAEHAAVTDes16@@@Z @ 29 NONAME ; int RTrackLog::TrackLogName(class TDes16 &) ?LocationSnapshot@RLocationObjectManipulator@@QAEHK@Z @ 30 NONAME ; int RLocationObjectManipulator::LocationSnapshot(unsigned long) + ?GeoTagStaus@RLocationGeoTagger@@QAEXAAVTRequestStatus@@AAW4TGeoTaggingSatus@@@Z @ 31 NONAME ; void RLocationGeoTagger::GeoTagStaus(class TRequestStatus &, enum TGeoTaggingSatus &) + ?CancelGeoTaggingRequest@RLocationGeoTagger@@QAEXXZ @ 32 NONAME ; void RLocationGeoTagger::CancelGeoTaggingRequest(void) + ?StartGeoTagging@RLocationGeoTagger@@QAEXAAVTRequestStatus@@W4TConnectionOption@@@Z @ 33 NONAME ; void RLocationGeoTagger::StartGeoTagging(class TRequestStatus &, enum TConnectionOption) + ??1RLocationGeoTagger@@QAE@XZ @ 34 NONAME ; RLocationGeoTagger::~RLocationGeoTagger(void) + ??0RLocationGeoTagger@@QAE@XZ @ 35 NONAME ; RLocationGeoTagger::RLocationGeoTagger(void) + ?CancelTagPendingRequest@RLocationGeoTagger@@QAEXXZ @ 36 NONAME ; void RLocationGeoTagger::CancelTagPendingRequest(void) diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/eabi/locationmanagerclientarm.def --- a/locationmanager/client/eabi/locationmanagerclientarm.def Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/eabi/locationmanagerclientarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -35,4 +35,12 @@ _ZTI19CTrackLogObserverAO @ 34 NONAME ABSENT; ## _ZTV19CTrackLogObserverAO @ 35 NONAME ABSENT; ## _ZN26RLocationObjectManipulator16LocationSnapshotEm @ 36 NONAME + _ZN18RLocationGeoTagger11GeoTagStausER14TRequestStatusR16TGeoTaggingSatus @ 37 NONAME + _ZN18RLocationGeoTagger15StartGeoTaggingER14TRequestStatus17TConnectionOption @ 38 NONAME + _ZN18RLocationGeoTagger23CancelGeoTaggingRequestEv @ 39 NONAME + _ZN18RLocationGeoTagger23CancelTagPendingRequestEv @ 40 NONAME + _ZN18RLocationGeoTaggerC1Ev @ 41 NONAME + _ZN18RLocationGeoTaggerC2Ev @ 42 NONAME + _ZN18RLocationGeoTaggerD1Ev @ 43 NONAME + _ZN18RLocationGeoTaggerD2Ev @ 44 NONAME diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/group/locationmanagerclient.mmp --- a/locationmanager/client/group/locationmanagerclient.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/group/locationmanagerclient.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -20,7 +20,7 @@ #if defined(WINSCW) deffile ../bwincw/locationmanagerclientwinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/locationmanagerclientarm.def #endif nostrictdef @@ -40,9 +40,10 @@ SOURCEPATH ../src SOURCE rlocationmanager.cpp SOURCE rlocationtrail.cpp -SOURCE rlocationobjectmanipulator.cpp -SOURCE CTrackLogObserverAO.cpp -SOURCE rtracklog.cpp +SOURCE rlocationobjectmanipulator.cpp +SOURCE CTrackLogObserverAO.cpp +SOURCE rtracklog.cpp +SOURCE rlocationgeotagger.cpp MW_LAYER_SYSTEMINCLUDE @@ -55,3 +56,5 @@ BYTEPAIRCOMPRESSTARGET OPTION ARMCC -O3 -OTime +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/client/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS LocationManager Client + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/sis/locationmanagerclient_stub.sis Binary file locationmanager/client/sis/locationmanagerclient_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/client/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"LocationManagerClient Patch"},(0x200071BF), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/client/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"LocationManagerClient"}, (0x200071BF), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/src/rlocationgeotagger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/client/src/rlocationgeotagger.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:An interface to Location Manager geo tagger +* +*/ + +#include +#include +#include + +#include +#include "rlocationgeotagger.h" +#include "locationmanagerdefs.h" +#include "locationmanagerdebug.h" + +EXPORT_C RLocationGeoTagger::RLocationGeoTagger() + : iTagPendingData (NULL) + { + } + +EXPORT_C RLocationGeoTagger::~RLocationGeoTagger() + { + delete iTagPendingData; + } + +// -------------------------------------------------------------------------- +// RLocationGeoTagger::IsTagPending +// -------------------------------------------------------------------------- +// +EXPORT_C void RLocationGeoTagger::GeoTagStaus( TRequestStatus& aStatus, + TGeoTaggingSatus& aTagPendingFlag ) + { + LOG( "RLocationGeoTagger::IsTagPending(), begin" ); + + delete iTagPendingData; + iTagPendingData = new TPckg( aTagPendingFlag); + + if ( iHandle && iTagPendingData ) + { + SendReceive( ELocManTagPending, TIpcArgs( iTagPendingData ), aStatus ); + } + else + { + if ( !iTagPendingData ) + { + CompleteRequest(aStatus, KErrNoMemory); + } + else + { + CompleteRequest(aStatus, KErrDisconnected); + } + } + LOG( "RLocationGeoTagger::IsTagPending(), end" ); + } + +// -------------------------------------------------------------------------- +// RLocationGeoTagger::StartGeoTagging +// -------------------------------------------------------------------------- +// +EXPORT_C void RLocationGeoTagger::StartGeoTagging + (TRequestStatus& aStatus, const TConnectionOption aConnectionOption ) + { + LOG( "RLocationGeoTagger::StartGeoTaggingL(), begin" ); + + if ( iHandle ) + { + SendReceive( ELocManStartGeoTaging, TIpcArgs( aConnectionOption ), aStatus); + } + LOG( "RLocationGeoTagger::StartGeoTaggingL(), end" ); + } + +// -------------------------------------------------------------------------- +// RLocationGeoTagger::CancelTagPendingRequest +// -------------------------------------------------------------------------- +// +EXPORT_C void RLocationGeoTagger::CancelTagPendingRequest() + { + LOG( "RLocationGeoTagger::CancelTagPendingRequest(), begin" ); + + if ( iHandle ) + { + SendReceive( ELocManCancelTagPendingReq); + } + LOG( "RLocationGeoTagger::CancelTagPendingRequest(), end" ); + } + + +// -------------------------------------------------------------------------- +// RLocationGeoTagger::CancelTagPendingRequest +// -------------------------------------------------------------------------- +// +EXPORT_C void RLocationGeoTagger::CancelGeoTaggingRequest() + { + LOG( "RLocationGeoTagger::CancelGeoTaggingRequest(), begin" ); + if ( iHandle ) + { + SendReceive( ELocManCancelGeoTaggingReq); + } + LOG( "RLocationGeoTagger::CancelGeoTaggingRequest(), end" ); + } + + +//End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/src/rlocationmanager.cpp --- a/locationmanager/client/src/rlocationmanager.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/src/rlocationmanager.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -33,19 +33,31 @@ { LOG( "RLocationManager::LaunchServer begin" ); - // DLL launch - RProcess server; - TInt ret = server.Create( KLocServerFileName, KNullDesC ); + TFindServer findLocServer( KLocServerName ); + TFullName name; - if ( ret != KErrNone ) // Loading failed. + TInt result = findLocServer.Next( name ); + if ( result == KErrNone ) { - return ret; + LOG( "StartServer() - Server already running" ); + + // Server already running + return KErrNone; } - TRequestStatus status( KErrNone ); - server.Rendezvous( status ); - - if ( status != KRequestPending ) + RProcess server; + result = server.Create( KLocServerFileName, KNullDesC ); + if ( result != KErrNone ) + { + LOG1( "CreateServerProcess() - failed to create server process, error: %d", result ); + return result; + } + + // Process created successfully + TRequestStatus stat( KErrNone ); + server.Rendezvous( stat ); + + if ( stat != KRequestPending ) { LOG( "RLocationManager::LaunchServer Failed" ); server.Kill( 0 ); // Abort startup. @@ -54,15 +66,17 @@ { server.Resume(); // Logon OK - start the server. } - - User::WaitForRequest( status ); // wait for start or death + + User::WaitForRequest( stat ); // wait for start or death // we can't use the 'exit reason' if the server panicked as this // is the panic 'reason' and may be '0' wehich cannot be distinguished // from KErrNone - ret = ( server.ExitType() == EExitPanic ) ? KErrCommsBreak : status.Int(); + result = ( server.ExitType() == EExitPanic ) ? KErrCommsBreak : stat.Int(); server.Close(); + LOG( "RLocationManager::LaunchServer end" ); - return ret; + + return result; } // -------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/src/rlocationobjectmanipulator.cpp --- a/locationmanager/client/src/rlocationobjectmanipulator.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/src/rlocationobjectmanipulator.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -114,6 +114,7 @@ } delete paramBuf; + paramBuf = NULL; LOG( "RLocationObject::CopyLocationData end" ); } // -------------------------------------------------------------------------- @@ -146,6 +147,7 @@ { LOG( "RLocationObject::CopyLocationData CMdCSerializationBuffer creation failed" ); delete uriBuffer; + uriBuffer = NULL; CompleteRequest( aStatus, error ); return; } @@ -177,6 +179,7 @@ } delete uriBuffer; + uriBuffer = NULL; LOG( "RLocationObject::CopyLocationData end" ); } diff -r 63c982fb92f2 -r b73252188534 locationmanager/client/src/rlocationtrail.cpp --- a/locationmanager/client/src/rlocationtrail.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/client/src/rlocationtrail.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -31,6 +31,7 @@ EXPORT_C RLocationTrail::~RLocationTrail() { delete iCurrentLocData; + iCurrentLocData = NULL; } // -------------------------------------------------------------------------- @@ -148,6 +149,7 @@ LOG( "RLocationTrail::CurrentLocation(), begin" ); delete iCurrentLocData; + iCurrentLocData = NULL; iCurrentLocData = new TPckg( aLocationData ); if ( iHandle && iCurrentLocData ) diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/bwincw/geoconverterwinscw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/bwincw/geoconverterwinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + ?ConvertL@CGeoConverter@@QAEXABVTNetworkInfoV1@CTelephony@@@Z @ 1 NONAME ; void CGeoConverter::ConvertL(class CTelephony::TNetworkInfoV1 const &) + ??1CGeoConverter@@UAE@XZ @ 2 NONAME ; CGeoConverter::~CGeoConverter(void) + ?NewL@CGeoConverter@@SAPAV1@AAVMGeoConverterObserver@@@Z @ 3 NONAME ; class CGeoConverter * CGeoConverter::NewL(class MGeoConverterObserver &) + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/eabi/geoconverterarm.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/eabi/geoconverterarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,9 @@ +EXPORTS + _ZN13CGeoConverter4NewLER21MGeoConverterObserver @ 1 NONAME + _ZN13CGeoConverter8ConvertLERKN10CTelephony14TNetworkInfoV1E @ 2 NONAME + _ZN13CGeoConverterD0Ev @ 3 NONAME + _ZN13CGeoConverterD1Ev @ 4 NONAME + _ZN13CGeoConverterD2Ev @ 5 NONAME + _ZTI13CGeoConverter @ 6 NONAME + _ZTV13CGeoConverter @ 7 NONAME + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + + +PRJ_MMPFILES +geoconverter.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/group/geoconverter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/group/geoconverter.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +VERSION 10.0 +TARGET geoconverter.dll +TARGETTYPE DLL +UID 0x1000008d 0x2002E6A1 + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + + +#if defined(WINSCW) +deffile ../bwincw/geoconverterwinscw.def +#elif defined(EABI) +deffile ../eabi/geoconverterarm.def +#endif +nostrictdef + + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../inc + +SYSTEMINCLUDE /epoc32/include/stdapis +SYSTEMINCLUDE /epoc32/include/platform/lbs +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE cgeoconverter.cpp + + +LIBRARY euser.lib +LIBRARY etel3rdparty.lib + +#include "../../inc/locplatsupport.mmh" +#ifdef _LOC_GEOTAGGING_CELLID +MACRO LOC_GEOTAGGING_CELLID +LIBRARY lbslocationinfoconverter.lib +LIBRARY lbslocationinfodatatypes.lib +#endif +LIBRARY lbs.lib +LIBRARY libc.lib + +PAGED +BYTEPAIRCOMPRESSTARGET +OPTION ARMCC -O3 -OTime + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/inc/cgeoconverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/inc/cgeoconverter.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class for converting CGI Info to lat, long. +* +*/ + +#ifndef C_GEOCONVERTER_H +#define C_GEOCONVERTER_H + +/** + * + * @since S60 9.2 + */ +#ifdef LOC_GEOTAGGING_CELLID +#include +#include +#endif +#include +#include + +class MGeoConverterObserver + { +public: + /** + * This method is used for notifying completion of geotagging + * @param aError error code + * @param aPosition position (lat/lon) for the correcponding n/w info + */ + virtual void ConversionCompletedL( const TInt aError, TLocality& aPosition ) = 0; + + /** + * This method is used to handle any error during conversion + * @param aError the error code + */ + virtual void HandleConversionError(TInt aError) = 0; + }; + +// Class to handle conversion operations +class CGeoConverter : public CBase +#ifdef LOC_GEOTAGGING_CELLID + , public MLbsLocationInfoConverterObserver +#endif + { +public: + /** + * 2-phased constructor. + */ + IMPORT_C static CGeoConverter* NewL( MGeoConverterObserver& aObserver ); + /** + * C++ destructor. + */ + IMPORT_C virtual ~CGeoConverter(); + + IMPORT_C void ConvertL( const CTelephony::TNetworkInfoV1& aNetworkInfo ); + +#ifdef GEOCONVERTER_UNIT_TESTCASE + public: +#else +protected: +#endif + // From MLbsLocationInfoConverterObserver + void OnConversionComplete( TInt aStatusCode ); + +#ifdef GEOCONVERTER_UNIT_TESTCASE + public: +#else + private: +#endif + + /** + * C++ constructor. + */ + CGeoConverter( MGeoConverterObserver& aObserver ); + /** + * 2nd phase constructor. + */ + void ConstructL(); + +#ifdef GEOCONVERTER_UNIT_TESTCASE + public: +#else + private: +#endif + + MGeoConverterObserver& iObserver; +#ifdef LOC_GEOTAGGING_CELLID + CLbsLocationInfoConverter* iLocConverter; + CLbsLocationInfo* iLocInfo; + CLbsGsmCellInfo* iGsmCellInfo; + CLbsWcdmaCellInfo* iWcdmaCellInfo; +#endif + }; + +#endif // C_GEOCONVERTER_H + +// End of file. diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS GeoConverter + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/sis/geoconverter_stub.sis Binary file locationmanager/geoconverter/sis/geoconverter_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"GeoConverter Patch"},(0x2002E6A1), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\geoconverter.dll" -"c:\sys\bin\geoconverter.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"geoconverter"}, (0x2002E6A1), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geoconverter/src/cgeoconverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geoconverter/src/cgeoconverter.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class for creating country and city tags for media files +* +*/ + +//#include "locationmanagerdebug.h" +#include "cgeoconverter.h" +#include "locationmanagerdebug.h" + + + +// -------------------------------------------------------------------------- +// CGeoConverter::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CGeoConverter* CGeoConverter::NewL( MGeoConverterObserver& aObserver ) + { + LOG("CGeoConverter::NewL"); + CGeoConverter* self = new( ELeave ) CGeoConverter( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; + } + +// -------------------------------------------------------------------------- +// CGeoConverter::CGeoConverter() +// -------------------------------------------------------------------------- +// +CGeoConverter::CGeoConverter( MGeoConverterObserver& aObserver ) + :iObserver( aObserver ) +#ifdef LOC_GEOTAGGING_CELLID + ,iLocConverter(NULL), + iLocInfo(NULL), + iGsmCellInfo(NULL), + iWcdmaCellInfo(NULL) +#endif + { + } + +// -------------------------------------------------------------------------- +// CGeoConverter::~CGeoConverter +// -------------------------------------------------------------------------- +// +EXPORT_C CGeoConverter::~CGeoConverter() + { + LOG("CGeoConverter::~CGeoConverter, begin"); +#ifdef LOC_GEOTAGGING_CELLID + delete iGsmCellInfo; + iGsmCellInfo = NULL; + delete iWcdmaCellInfo; + iWcdmaCellInfo = NULL; + delete iLocInfo; + iLocInfo = NULL; + delete iLocConverter; + iLocConverter = NULL; +#endif + LOG("CGeoConverter::~CGeoConverter, end"); + } + +// -------------------------------------------------------------------------- +// CGeoConverter::OnConversionComplete() +// -------------------------------------------------------------------------- +// +void CGeoConverter::OnConversionComplete( TInt aStatusCode ) + { + LOG("CGeoConverter::OnConversionComplete, begin"); +#ifdef LOC_GEOTAGGING_CELLID + //16. Retrieve position estimate that is updated by Location Monitor server + //after a conversion operation is completed successfully. + RLbsAreaInfoBaseArray posInfoList; + TLocality position; + + + LOG1("Status Code - %d",aStatusCode); + + if( KErrNone == aStatusCode ) + { + TRAP_IGNORE(iLocInfo->GetAreaInfoL( posInfoList, CLbsLocationInfo::ELbsPosInfo );) + + //Get geo-coordinates. + + LOG1("PposInfoList Count - %d",posInfoList.Count()); + if ( posInfoList.Count() ) + { + static_cast(posInfoList[0])->GetLocality(position); + } + else + { + aStatusCode = KErrNotFound; + } + } + TRAPD(err,iObserver.ConversionCompletedL( aStatusCode, position);) + if(err != KErrNone) + { + iObserver.HandleConversionError(err); + } + posInfoList.Close(); +#endif + LOG("CGeoConverter::OnConversionComplete, end"); + } + +// -------------------------------------------------------------------------- +// CGeoConverter::ConstructL() +// -------------------------------------------------------------------------- +// +void CGeoConverter::ConstructL() + { + LOG("CGeoConverter::ConstructL, begin"); +#ifdef LOC_GEOTAGGING_CELLID + iLocInfo = CLbsLocationInfo::NewL(); + TUid pluginUid = TUid::Uid( 0x20027011 ); + LOG("CGeoConverter::ConstructL"); + iLocConverter = CLbsLocationInfoConverter::NewL( *this, pluginUid ); +#endif + LOG("CGeoConverter::ConstructL, end"); + } + +// -------------------------------------------------------------------------- +// CGeoConverter::ConvertL() +// -------------------------------------------------------------------------- +// +EXPORT_C void CGeoConverter::ConvertL( const CTelephony::TNetworkInfoV1& aNetworkInfo ) + { + LOG("CGeoConverter::ConvertL, begin"); +#ifdef LOC_GEOTAGGING_CELLID + + //Set mobile country code + TLex lexer( aNetworkInfo.iCountryCode ); + TUint countryCode = 0; + + User::LeaveIfError( lexer.Val( countryCode, EDecimal) ); + //Set mobile network code + lexer = aNetworkInfo.iNetworkId; + TUint networkCode = 0; + User::LeaveIfError( lexer.Val( networkCode, EDecimal) ); + LOG1("Network mode - %d", aNetworkInfo.iMode); + CLbsAreaInfoBase* areaInfoBase = NULL; + switch(aNetworkInfo.iAccess) + { + case CTelephony::ENetworkAccessGsm: + case CTelephony::ENetworkAccessGsmCompact: + { + LOG("2G network."); + if(iGsmCellInfo == NULL) + { + iGsmCellInfo = CLbsGsmCellInfo::NewL(); + } + iGsmCellInfo->SetMobileCountryCode( countryCode ); + + iGsmCellInfo->SetMobileNetworkCode( networkCode ); + //Set cell id + iGsmCellInfo->SetCellId( aNetworkInfo.iCellId ); + + if(aNetworkInfo.iAreaKnown) + { + //Set location area code + iGsmCellInfo->SetLocationAreaCode( aNetworkInfo.iLocationAreaCode ); + } + + areaInfoBase = iGsmCellInfo; + } + break; + case CTelephony::ENetworkAccessUtran: + { + LOG("3G network."); + if(iWcdmaCellInfo == NULL) + { + iWcdmaCellInfo = CLbsWcdmaCellInfo::NewL(); + } + iWcdmaCellInfo->SetMobileCountryCode(countryCode); + iWcdmaCellInfo->SetMobileNetworkCode(networkCode); + iWcdmaCellInfo->SetUniqueCellId(aNetworkInfo.iCellId); + areaInfoBase = iWcdmaCellInfo; + } + break; + default: + LOG("Unknown network mode"); + User::Leave(KErrNotSupported); + } + //Add the cell information to the location info class. This class + //would be sent to the Location Monitor server that would perform the + //requested conversion and update the position estimate + if(areaInfoBase != NULL) // self check + { + // reset previous one.. to clear the local info. + iLocInfo->ResetAreaInfo(CLbsLocationInfo::ELbsAreaInfoAll); + iLocInfo->AddAreaInfoL( areaInfoBase ); + //ownership is transferred. + iWcdmaCellInfo = NULL; + iGsmCellInfo = NULL; + //Request conversion of GSM cell information to corresponding coordinate information + iLocConverter->ConvertLocationInfoL( *iLocInfo, ELbsConversionSilent, + ELbsConversionOutputPosition ); + } +#endif + LOG("CGeoConverter::ConvertL, end"); + } + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/bwins/geotagger.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/bwins/geotagger.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + ?NewL@CInternalGeoTagger@@SAPAV1@PAVCMdESession@@PAVMGeoTaggerObserver@@@Z @ 1 NONAME ; class CInternalGeoTagger * CInternalGeoTagger::NewL(class CMdESession *, class MGeoTaggerObserver *) + ?NewL@CGeoTagger@@SAPAV1@PAVMGeoTaggerObserver@@PAVCMdESession@@@Z @ 2 NONAME ; class CGeoTagger * CGeoTagger::NewL(class MGeoTaggerObserver *, class CMdESession *) + ??1CInternalGeoTagger@@UAE@XZ @ 3 NONAME ; CInternalGeoTagger::~CInternalGeoTagger(void) + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/eabi/geotaggerarm.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/eabi/geotaggerarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,6 @@ +EXPORTS + _ZN10CGeoTagger4NewLEP18MGeoTaggerObserverP11CMdESession @ 1 NONAME + _ZN18CInternalGeoTagger4NewLEP11CMdESessionP18MGeoTaggerObserver @ 2 NONAME + _ZTI18CInternalGeoTagger @ 3 NONAME + _ZTV18CInternalGeoTagger @ 4 NONAME + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +geotagger.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/group/geotagger.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/group/geotagger.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + +#include +#include +#include "../../inc/locplatsupport.mmh" + +VERSION 10.0 +TARGET geotagger.dll +TARGETTYPE DLL +UID 0x1000008d 0x2002700E + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +#if defined(WINSCW) +#elif defined(EABI) +deffile ../eabi/geotaggerarm.def +#endif +nostrictdef + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../inc + + +#ifdef _LOC_GEOTAGGING_CELLID +MACRO LOC_GEOTAGGING_CELLID +USERINCLUDE ../../geoconverter/inc +#endif + +#ifdef _LOC_REVERSEGEOCODE +MACRO LOC_REVERSEGEOCODE +USERINCLUDE ../../tagcreator/inc +USERINCLUDE ../../ReverseGeocode/inc +USERINCLUDE ../../ReverseGeoCoderPlugin/inc +#endif + + +SOURCEPATH ../src +SOURCE cgeotagger.cpp +SOURCE cinternalgeotagger.cpp + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/platform/lbs +SYSTEMINCLUDE /epoc32/include/stdapis + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY lbs.lib +LIBRARY mdeclient.lib +LIBRARY etel3rdparty.lib +LIBRARY estor.lib +LIBRARY platformenv.lib + +LIBRARY ecom.lib +LIBRARY libc.lib + +#ifdef _LOC_GEOTAGGING_CELLID +LIBRARY geoconverter.lib +#endif + +#ifdef _LOC_REVERSEGEOCODE +LIBRARY reversegeocode.lib +LIBRARY tagcreator.lib +#endif + +PAGED +BYTEPAIRCOMPRESSTARGET +OPTION ARMCC -O3 -OTime + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/inc/cinternalgeotagger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/inc/cinternalgeotagger.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#ifndef C_CINTERNALGEOTAGGER_H +#define C_CINTERNALGEOTAGGER_H + +#include +#include +#include +#include +#include + +#include "mdccommon.h" +#include "mdesession.h" +#include "mdenamespacedef.h" +#include "mdeobjectdef.h" +#include "mdepropertydef.h" +#include "mderelation.h" +#include "mdequery.h" + +#ifdef LOC_GEOTAGGING_CELLID +#include "cgeoconverter.h" +#endif + +#ifdef LOC_REVERSEGEOCODE +#include "ctagcreator.h" +#include "reversegeocode.h" +class CReverseGeoCoderPlugin; +#endif + + +/** + * GeoTagger converts a given cell ID(CGI Info) to geo-coordinates. + * Does reverse geocoding to get country and city name. + * Creates country and city tag for image/video files. + * @since S60 9.2 + */ + +class CInternalGeoTagger : public CGeoTagger, + public MMdESessionObserver, + public MMdEQueryObserver +#ifdef LOC_GEOTAGGING_CELLID + ,public MGeoConverterObserver +#endif +#ifdef LOC_REVERSEGEOCODE + ,public MReverseGeocodeObserver +#endif + { +public: + + /** + * 2-phased constructor. + * @param aMdeSession An instance of the CMdESession + * @param aObserver The observer that is to be notified when geotagging is over + */ + IMPORT_C static CInternalGeoTagger* NewL( CMdESession* aMdeSession, + MGeoTaggerObserver* aObserver ); + + /** + * C++ destructor. + */ + IMPORT_C virtual ~CInternalGeoTagger(); + + +public: //exported API + // CGeoTagger + /** + * Harvests location tags. + * @param aObserver, observer for geotagging. + * @return None. + */ + virtual void CreateGeoTagsL( const TConnectionOption = EInteractive ); + + /** + * Checks if there is any untagged photos with location info and tags them. + * @param aTagInProgress, boolean value to indicate if geotagging is in progress. + * @return None. + */ + virtual void PendingGeoTagsL( TBool aTagInProgress ); + +public: //observer methods + + // From MMdEQueryObserver + + /** + * @param aQuery the query type + * @param aFirstNewItemIndex The new item index + * @param aNewItemCount The new item count + */ + void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount); + + /** + * This method is called on completion of a query + * @param aQuery the query type + * @param aError Error if any + */ + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); + + +#ifdef LOC_REVERSEGEOCODE + /** + * Get location objects, where lat, long not populated. + * @param aCountryTagId The country tagId + * @param aCityTagId The city tagId + */ + void AddressInfoL( const TItemId aCountryTagId, const TItemId aCityTagId ); + + + //MReverseGeocodeObserver + /** + * This method is called when reverse geocoding is completed + *@param aErrorcode Error if any + *@param aAddressInfo the reverse geocoded address + */ + void ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + TBool IsRegisteredAtHomeNetwork(); + + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); + +#endif //LOC_REVERSEGEOCODE + + // From MMdESessionObserver + + /** + * Handles session opening + *@param aSession A reference of the CMdESession + *@param aError error if any + */ + void HandleSessionOpened(CMdESession& aSession, TInt aError); + + /** + * Handles any error in session opening + *@param aSession A reference of the CMdESession + *@param aError error if any + */ + void HandleSessionError(CMdESession& aSession, TInt aError); + +#ifdef LOC_GEOTAGGING_CELLID +public: // MGeoConverterObserver + /** + * This method is used for notifying completion of geotagging + * @param aError error code + * @param aPosition position (lat/lon) for the correcponding n/w info + */ + void ConversionCompletedL( const TInt aError, TLocality& aPosition ); + + + /** + * This method is used to handle the conversion error + * @param aError the error code + */ + void HandleConversionError(TInt aError); + +private: + /** + * Update media object with GPS info. + */ + void UpdateGPSInfoL(const TLocality& aPosition); + +#endif //LOC_GEOTAGGING_CELLID + +private: + + /** + * C++ constructor. + * @param aMdeSession An instance of the CMdESession + * @param aObserver The observer that is to be notified when geotagging is over + */ + CInternalGeoTagger( CMdESession* aMdeSession, MGeoTaggerObserver* aObserver ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Get all relation objects associated with this location + * @param aLocID The locationId whose relation is to be fetched + */ + void GetRelationObjectsL(TItemId aLocID); + + /** + * get tags for this image + * @param aImageID The imageIs whose tag is to be fetched + */ + void GetTagsL( TItemId aImageID ); + + /** + * Get location objects, where lat, long not populated. + */ + void GetAllLocationsL( ); + + /** + * checks if the session is ready + * @return ETrue If the session is ready + */ + TBool IsSessionReady(); + + /** + * Fetches the location information + */ + void GetLocationInfoL(); + + /** + * starts geotagging of objects + */ + void StartGeoTaggingL(); + + /** + * Checks if Location atg exists for an object + * @return ETrue if location tag is found + */ + TBool LocationTagExists(); + + /** + * Moves to the next location for reverse geocoding + */ + void IterateNextLocation(); + + /** + * @return ETrue if item had valid lat/lon else EFalse + */ + TBool GPSInfoExists(); +private: + /** + * A session to Metadata Engine for creating and manipulating location objects. + */ + CMdESession* iMdeSession; + + /** + * This query object is used to find existing locations + */ + CMdEObjectQuery* iLocationQuery; + /** @var iRelationQuery. */ + CMdERelationQuery* iRelationQuery; + CMdERelationQuery* iTagQuery; + + TInt iIndex; + + TBool iSessionReady; + + MGeoTaggerObserver* iObserver; + + TLocationData iLocationData; + + TItemId iLocationId; + + TConnectionOption iConnectionOption; + + + /** + * An active scheduler wait loop for waiting a session to MdE to open. + */ + CActiveSchedulerWait* iASW; + TBool iMdeSessionOwnFlag; + TBool iTagPendingHandlerFlag; +#ifdef LOC_GEOTAGGING_CELLID + /* + * Geo converter + */ + CGeoConverter* iGeoConverter; +#endif +#ifdef LOC_REVERSEGEOCODE + CTagCreator* iTagCreator; + CReverseGeoCoderPlugin* iRevGeocoderPlugin; + TUid iDtorKey; +#endif //LOC_REVERSEGEOCODE + }; + +#endif // C_CGEOTAGGER_H + +// End of file. diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS GeoTagger + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/sis/geotagger_stub.sis Binary file locationmanager/geotagger/sis/geotagger_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"GeoTagger Patch"},(0x2002700E), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\geotagger.dll" -"c:\sys\bin\geotagger.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"geotagger"}, (0x2002700E), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/src/cgeotagger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/src/cgeotagger.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#include +#include "cinternalgeotagger.h" +#include "locationmanagerdebug.h" + + +// -------------------------------------------------------------------------- +// CGeoTagger::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CGeoTagger* CGeoTagger::NewL( MGeoTaggerObserver* aObserver, + CMdESession* aMdeSession) + { + LOG("CGeoTagger::NewL, begin"); + CInternalGeoTagger* self = CInternalGeoTagger::NewL( aMdeSession, aObserver ); + + return self; + } + + + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/geotagger/src/cinternalgeotagger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/geotagger/src/cinternalgeotagger.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,958 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#include +#include +#include +#include + +#include "locationmanagerdebug.h" +#include "mdeconstants.h" +#include "mdesession.h" +#include "cinternalgeotagger.h" +#ifdef LOC_REVERSEGEOCODE +#include "reversegeocoderplugin.h" +const TUid KReverseGeoCodeUid = {0x2002DD12}; +#endif + +using namespace MdeConstants; + +_LIT ( KCountry, "country:"); // country:india + +const TReal64 KZeroLatLon (0.000000 ); + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CInternalGeoTagger* CInternalGeoTagger::NewL( CMdESession* aMdeSession, + MGeoTaggerObserver* aObserver ) + { + CInternalGeoTagger* self = + new (ELeave) CInternalGeoTagger( aMdeSession, aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::CInternalGeoTagger +// -------------------------------------------------------------------------- +// +CInternalGeoTagger::CInternalGeoTagger( CMdESession* aMdeSession, + MGeoTaggerObserver* aObserver ) + : iMdeSession(aMdeSession), + iLocationQuery(NULL), + iRelationQuery(NULL), + iTagQuery(NULL), + iIndex(0), + iSessionReady( EFalse ), + iObserver( aObserver ), + iASW(NULL), + iTagPendingHandlerFlag(EFalse) +#ifdef LOC_GEOTAGGING_CELLID + ,iGeoConverter(NULL) +#endif +#ifdef LOC_REVERSEGEOCODE + ,iTagCreator(NULL) + ,iRevGeocoderPlugin(NULL) +#endif + { + iMdeSessionOwnFlag = (iMdeSession == NULL); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::ConstructL +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::ConstructL() + { + LOG("CInternalGeoTagger::ConstructL ,begin"); + if(iMdeSession != NULL) + { + LOG("Not owning mds session"); + iMdeSessionOwnFlag = EFalse; + //object is not owning iMdeSession + iSessionReady = ETrue; +#ifdef LOC_REVERSEGEOCODE + iTagCreator = CTagCreator::NewL(); + + iTagCreator->SetSession( iMdeSession ); +#endif //LOC_REVERSEGEOCODE + } + else + { + iMdeSessionOwnFlag = ETrue; + iASW = new (ELeave) CActiveSchedulerWait(); + iMdeSession = CMdESession::NewL( *this ); + //for creating tags +#ifdef LOC_REVERSEGEOCODE + iTagCreator = CTagCreator::NewL(); +#endif + + iASW->Start(); + delete iASW; + iASW = NULL; + } + + //for reverse geocoding (geo-tagging) + +#ifdef LOC_REVERSEGEOCODE + + TRAP_IGNORE( + iRevGeocoderPlugin = reinterpret_cast( + REComSession::CreateImplementationL(KReverseGeoCodeUid, iDtorKey));) + + if( iRevGeocoderPlugin ) + { + iRevGeocoderPlugin->AddObserverL(*this); + } + +#endif //LOC_REVERSEGEOCODE + + LOG("CInternalGeoTagger::ConstructL ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::~CInternalGeoTagger +// -------------------------------------------------------------------------- +// +CInternalGeoTagger::~CInternalGeoTagger() + { + LOG("CInternalGeoTagger::~CInternalGeoTagger ,begin"); +#ifdef LOC_GEOTAGGING_CELLID + if(iGeoConverter) + { + delete iGeoConverter; + iGeoConverter = NULL; + } +#endif + if(iRelationQuery) + { + iRelationQuery->RemoveObserver(*this); + iRelationQuery->Cancel(); + delete iRelationQuery; + iRelationQuery = NULL; + } + if(iLocationQuery) + { + iLocationQuery->RemoveObserver(*this); + iLocationQuery->Cancel(); + delete iLocationQuery; + iLocationQuery = NULL; + } + if(iTagQuery) + { + iTagQuery->RemoveObserver(*this); + iTagQuery->Cancel(); + delete iTagQuery; + iTagQuery = NULL; + } +#ifdef LOC_REVERSEGEOCODE + delete iTagCreator; + iTagCreator = NULL; + delete iRevGeocoderPlugin; + iRevGeocoderPlugin = NULL; + REComSession::DestroyedImplementation(iDtorKey); +#endif //LOC_REVERSEGEOCODE + if(iMdeSessionOwnFlag) + { + delete iMdeSession; + iMdeSession = NULL; + delete iASW; + iASW = NULL; + } + LOG("CInternalGeoTagger::~CInternalGeoTagger ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::CreateGeoTags +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::CreateGeoTagsL( const TConnectionOption aOption ) + { + LOG("CInternalGeoTagger::CreateGeoTagsL ,begin"); + if ( !IsSessionReady() ) + { + User::Leave( KErrNotReady ); + } + + iConnectionOption = aOption; + iIndex = 0; + GetAllLocationsL(); + + LOG("CInternalGeoTagger::CreateGeoTagsL ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::HandleSessionOpened +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError) + { + LOG("CInternalGeoTagger::HandleSessionOpened ,begin"); + if ( iASW && iASW->IsStarted() ) + { + iASW->AsyncStop(); + } + + if ( KErrNone == aError ) + { + iSessionReady = ETrue; + +#ifdef LOC_REVERSEGEOCODE + iTagCreator->SetSession( iMdeSession ); +#endif + } + else + { + delete iMdeSession; + iMdeSession = NULL; + } + LOG("CInternalGeoTagger::HandleSessionOpened ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::HandleSessionError +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/) + { + LOG("CInternalGeoTagger::HandleSessionError ,begin"); + if (iASW && iASW->IsStarted() ) + { + iASW->AsyncStop(); + } + iSessionReady = EFalse; + + delete iMdeSession; + iMdeSession = NULL; + + LOG("CInternalGeoTagger::HandleSessionError ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::IsSessionReady +// -------------------------------------------------------------------------- +// +TBool CInternalGeoTagger::IsSessionReady() + { + return iSessionReady; + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::GetRelationObjectsL() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::GetRelationObjectsL(TItemId aLocID) + { + LOG("CInternalGeoTagger::GetRelationObjectsL ,begin"); + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageObjDef = namespaceDef.GetObjectDefL( Image::KImageObject ); + + if(iRelationQuery) + { + iRelationQuery->RemoveObserver(*this); + iRelationQuery->Cancel(); + delete iRelationQuery; + iRelationQuery = NULL; + } + + iRelationQuery = iMdeSession->NewRelationQueryL( namespaceDef, this ); + User::LeaveIfNull( iRelationQuery ); + + iRelationQuery->SetResultMode( EQueryResultModeItem ); + + // both left and right condition must match + CMdERelationCondition& filterCond = iRelationQuery->Conditions(). + AddRelationConditionL( ERelationConditionSideRight ); + + // left one must be any image object. + filterCond.LeftL().AddObjectConditionL( imageObjDef ); + + // right one must be this location object + filterCond.RightL().AddObjectConditionL( aLocID ); + + iRelationQuery->FindL(); // results to a call to HandleQueryCompleted() + LOG("CInternalGeoTagger::GetRelationObjectsL ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::HandleQueryNewResults() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::HandleQueryNewResults(CMdEQuery& /*aQuery*/, TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/) + { + LOG("CInternalGeoTagger::HandleQueryNewResults ,begin"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::HandleQueryCompleted() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) + { + LOG("CInternalGeoTagger::HandleQueryCompleted ,begin"); + + TInt count = aQuery.Count(); + LOG1("CInternalGeoTagger::HandleQueryCompleted count: %d", count); + + if ( &aQuery == iLocationQuery ) + { + if ( count ) + { + iLocationId = iLocationQuery->ResultId( iIndex++ ); + TRAP_IGNORE( GetRelationObjectsL( iLocationId ) ); + } + else + { + iIndex = 0; + iObserver->GeoTaggingCompleted( aError ); + if(iTagPendingHandlerFlag) + { + iTagPendingHandlerFlag = EFalse; + iObserver->PendingGeoTagReqComplete(KErrNone); + } + } + } + else if ( &aQuery == iRelationQuery ) + { + //if it is a relation query, then update gps info of location object. + + if ( iRelationQuery->Count() ) + { + TInt err = KErrNone; + TRAP(err, StartGeoTaggingL( ) ); + if(err != KErrNone) + { + IterateNextLocation(); + } + } + else + { + IterateNextLocation(); + } + + } + + else if ( &aQuery == iTagQuery ) + { + + if ( LocationTagExists() ) //nothing to do for this location + { + IterateNextLocation(); //Go through next location + } + else //do reverse geocoding + { + if(iTagPendingHandlerFlag) + { + iIndex = 0; + iTagPendingHandlerFlag = EFalse; + iObserver->PendingGeoTagReqComplete(KErrNotFound); + return; + } + + //Find the address for this geo-coordinate + if(GPSInfoExists()) + { + // GPS info exist go for reverse geo coding. +#ifdef LOC_REVERSEGEOCODE + if(iRevGeocoderPlugin) + { + TRAP_IGNORE( + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationData.iPosition, iConnectionOption ) ); + } + else +#endif //LOC_REVERSEGEOCODE + { + IterateNextLocation(); //Go through next location + } + } + else + { + if ( iLocationData.iNetworkInfo.iCellId > 0 && + iLocationData.iNetworkInfo.iCountryCode.Length() > 0 && + iLocationData.iNetworkInfo.iNetworkId.Length() > 0 ) + { + // valid n/w information.. go for cell id based geo coding. +#ifdef LOC_GEOTAGGING_CELLID + TInt err = KErrNone; + if(iGeoConverter == NULL) + { + TRAP(err, iGeoConverter = CGeoConverter::NewL(*this)); + } + + if(err == KErrNone && iGeoConverter != NULL) + { + // there is no field to store type of network. + // but it's safe to take decission based on area code. + if(iLocationData.iNetworkInfo.iLocationAreaCode > 0) + { + LOG("Valid areacode. Treat as GSM n/w"); + iLocationData.iNetworkInfo.iAccess = CTelephony::ENetworkAccessGsm; + } + else + { + LOG("Areacode is 0. Treat as 3G n/w"); + iLocationData.iNetworkInfo.iAccess = CTelephony::ENetworkAccessUtran; + } + TRAP(err, iGeoConverter->ConvertL(iLocationData.iNetworkInfo);) + } + LOG1("Error - %d", err); + if(err != KErrNone) + { + HandleConversionError(err); + } +#else + IterateNextLocation(); //Go through next location +#endif + } + else + { + IterateNextLocation(); //Go through next location + } + } + } + + } + + LOG("CInternalGeoTagger::HandleQueryCompleted ,end"); + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::GPSInfoExists() +// -------------------------------------------------------------------------- +// +TBool CInternalGeoTagger::GPSInfoExists() + { + LOG("CInternalGeoTagger::GPSInfoExists"); + TBool gpsInfoExists = EFalse; + if ( !Math::IsNaN( iLocationData.iPosition.Latitude() ) && + !Math::IsNaN( iLocationData.iPosition.Longitude() ) && + KZeroLatLon != iLocationData.iPosition.Latitude() && + KZeroLatLon != iLocationData.iPosition.Longitude() ) //lat, long is there + { + + LOG("Valid lat/lon\n"); + gpsInfoExists = ETrue; + } + return gpsInfoExists; + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::StartGeoTagging() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::StartGeoTaggingL( ) + { + LOG("CInternalGeoTagger::StartGeoTaggingL ,start"); + GetLocationInfoL(); + + CMdERelation& relation = iRelationQuery->Result( 0 ); + + GetTagsL( relation.LeftObjectId() ); + + LOG("CInternalGeoTagger::StartGeoTaggingL ,end"); + } +// -------------------------------------------------------------------------- +// CInternalGeoTagger::GetLocationInfoL() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::GetLocationInfoL() + { + LOG("CInternalGeoTagger::GetLocationInfoL, begin"); + + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef& locationObjectDef = namespaceDef.GetObjectDefL( Location::KLocationObject ); + + CMdEPropertyDef& latitudeDef = locationObjectDef.GetPropertyDefL( + Location::KLatitudeProperty ); + CMdEPropertyDef& longitudeDef = locationObjectDef.GetPropertyDefL( + Location::KLongitudeProperty ); + CMdEPropertyDef& cellIdDef = locationObjectDef.GetPropertyDefL( + Location::KCellIdProperty ); + CMdEPropertyDef& lacCodeDef = locationObjectDef.GetPropertyDefL( + Location::KLocationAreaCodeProperty ); + CMdEPropertyDef& countryCodeDef = locationObjectDef.GetPropertyDefL( + Location::KCountryCodeProperty ); + CMdEPropertyDef& networkCodeDef = locationObjectDef.GetPropertyDefL( + Location::KNetworkCodeProperty ); + + CMdEObject* locationObject = NULL; + CMdEProperty* latProp = NULL; + CMdEProperty* lonProp = NULL; + CMdEProperty* cellProp = NULL; + CMdEProperty* lacProp = NULL; + CMdEProperty* countryProp = NULL; + CMdEProperty* networkProp = NULL; + + locationObject = iMdeSession->GetObjectL( iLocationId, locationObjectDef ); + + locationObject->Property( latitudeDef, latProp, 0 ); + locationObject->Property( longitudeDef, lonProp, 0 ); + if ( latProp && lonProp ) + { + iLocationData.iPosition.SetCoordinate( latProp->Real64ValueL(), + lonProp->Real64ValueL() ); + } + else + { + iLocationData.iPosition.SetCoordinate( KZeroLatLon, + KZeroLatLon ); + } + + locationObject->Property( cellIdDef, cellProp, 0 ); + locationObject->Property( lacCodeDef, lacProp, 0 ); + locationObject->Property( countryCodeDef, countryProp, 0 ); + locationObject->Property( networkCodeDef, networkProp, 0 ); + if ( cellProp && countryProp && networkProp) + { + iLocationData.iNetworkInfo.iCellId = cellProp->Uint32ValueL(); + iLocationData.iNetworkInfo.iCountryCode = countryProp->TextValueL(); + iLocationData.iNetworkInfo.iNetworkId = networkProp->TextValueL(); + } + else + { + // set to invalid values. + iLocationData.iNetworkInfo.iCellId = 0; + iLocationData.iNetworkInfo.iAccess = CTelephony::ENetworkAccessUnknown; + iLocationData.iNetworkInfo.iLocationAreaCode = 0; + iLocationData.iNetworkInfo.iAreaKnown = EFalse; + iLocationData.iNetworkInfo.iCountryCode.Zero(); + iLocationData.iNetworkInfo.iNetworkId.Zero(); + } + + iLocationData.iNetworkInfo.iAreaKnown = EFalse; + if(lacProp) + { + iLocationData.iNetworkInfo.iLocationAreaCode = lacProp->Uint32ValueL(); + if(iLocationData.iNetworkInfo.iLocationAreaCode > 0) + { + iLocationData.iNetworkInfo.iAreaKnown = ETrue; + } + } + delete locationObject; + LOG("CInternalGeoTagger::GetLocationInfoL ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::LocationTagExists() +// -------------------------------------------------------------------------- +// +TBool CInternalGeoTagger::LocationTagExists() + { + LOG("CInternalGeoTagger::LocationTagExists ,begin"); + + TBool tagFound = EFalse; + TInt error = KErrNone; + const TInt count = iTagQuery->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + CMdERelation& relation = static_cast( iTagQuery->ResultItem( i ) ); + + TItemId tagId = relation.RightObjectId(); + CMdEObject* object = NULL; + TRAP_IGNORE( object = iMdeSession->GetObjectL( tagId ) ); + if(object) + { + error = object->Uri().Find( KCountry ); + delete object; + if ( error == KErrNone ) + { + i = count; + tagFound = ETrue; + break; + } + } + } + + + LOG("CInternalGeoTagger::LocationTagExists ,end"); + return tagFound; + + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::IterateNextLocation() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::IterateNextLocation() + { + LOG("CInternalGeoTagger::IterateNextLocation ,begin"); + + if (iIndex < iLocationQuery->Count()) + { + iLocationId = iLocationQuery->ResultId( iIndex++ ); + TRAP_IGNORE( GetRelationObjectsL( iLocationId ) ); + } + else + { + if ( iObserver ) + { + iIndex = 0; + TInt error = KErrNone; + iObserver->GeoTaggingCompleted( error ); + if(iTagPendingHandlerFlag) + { + iTagPendingHandlerFlag = EFalse; + iObserver->PendingGeoTagReqComplete(KErrNone); + } + } + } + LOG("CInternalGeoTagger::IterateNextLocation ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::GetAllLocationsL() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::GetAllLocationsL() + { + LOG("CInternalGeoTagger::GetAllLocationsL ,begin"); + + CMdENamespaceDef& defaultNamespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& locObjDef = defaultNamespaceDef.GetObjectDefL( + MdeConstants::Location::KLocationObject ); + CMdEPropertyDef& cellIdPropDef = locObjDef.GetPropertyDefL( + MdeConstants::Location::KCellIdProperty ); + + if(iLocationQuery) + { + iLocationQuery->RemoveObserver(*this); + iLocationQuery->Cancel(); + delete iLocationQuery; + iLocationQuery = NULL; + } + // query objects with object definition "Image" + iLocationQuery = iMdeSession->NewObjectQueryL( defaultNamespaceDef, locObjDef, this ); + + //Define the result order + iLocationQuery->AppendOrderRuleL(TMdEOrderRule(cellIdPropDef, ESortAscending)); + + iLocationQuery->SetResultMode( EQueryResultModeId ); + iLocationQuery->FindL(); + + LOG("CInternalGeoTagger::GetAllLocationsL ,end"); + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::GetTagsL() +// Get tags related to this image/video object +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::GetTagsL( TItemId aImageID ) + { + LOG("CInternalGeoTagger::GetTagsL ,begin"); + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& tagObjectDef = namespaceDef.GetObjectDefL( Tag::KTagObject ); + + if(iTagQuery) + { + iTagQuery->RemoveObserver(*this); + iTagQuery->Cancel(); + delete iTagQuery; + iTagQuery = NULL; + } + + iTagQuery = iMdeSession->NewRelationQueryL( namespaceDef, this ); + User::LeaveIfNull( iTagQuery ); + + iTagQuery->SetResultMode( EQueryResultModeItem ); + + // both left and right condition must match + CMdERelationCondition& filterCond = iTagQuery->Conditions(). + AddRelationConditionL( ERelationConditionSideRight ); + + // left one must be this image object. + filterCond.LeftL().AddObjectConditionL( aImageID ); + + // right one must be tag object + filterCond.RightL().AddObjectConditionL( tagObjectDef ); + + iTagQuery->FindL(); // results to a call to HandleQueryCompleted() + LOG("CInternalGeoTagger::GetTagsL ,end"); + } + +#ifdef LOC_GEOTAGGING_CELLID + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::UpdateGPSInfoL() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::UpdateGPSInfoL(const TLocality& aPosition) + { + + LOG("CInternalGeoTagger::UpdateGPSInfoL ,start"); + if(Math::IsNaN( aPosition.Latitude()) || + Math::IsNaN( aPosition.Longitude()) ) + { + LOG("Not a valid location info."); + LOG("CInternalGeoTagger::UpdateGPSInfoL ,end"); + return; + } + + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& locObjDef = namespaceDef.GetObjectDefL( Location::KLocationObject ); + CMdEObject* location = iMdeSession->OpenObjectL(iLocationId, locObjDef); + CleanupStack::PushL( location ); + + CMdEPropertyDef& propLatDef = locObjDef.GetPropertyDefL( Location::KLatitudeProperty ); + CMdEPropertyDef& propLongDef = locObjDef.GetPropertyDefL( Location::KLongitudeProperty ); + CMdEPropertyDef& propAltDef = locObjDef.GetPropertyDefL( Location::KAltitudeProperty ); + CMdEPropertyDef& qualityDef = locObjDef.GetPropertyDefL( Location::KQualityProperty ); + + if (location->PropertyCount(propLatDef) == 0) + { + location->AddReal64PropertyL(propLatDef, aPosition.Latitude() ); //iLatitude + } + if (location->PropertyCount(propLongDef) == 0) + { + location->AddReal64PropertyL(propLongDef, aPosition.Longitude() ); //iLongitude + } + if (location->PropertyCount(propAltDef) == 0 && + !Math::IsNaN( aPosition.Altitude()) ) + { + location->AddReal64PropertyL(propAltDef, aPosition.Altitude()); + } + LOG1( "Updating quality - %d", aPosition.HorizontalAccuracy()); + if (location->PropertyCount(qualityDef) == 0 ) + { + location->AddReal32PropertyL(qualityDef, aPosition.HorizontalAccuracy()); + } + + CMdEProperty* modProp = NULL; + CMdEObjectDef& objImageDef = namespaceDef.GetObjectDefL( Image::KImageObject ); + CMdEPropertyDef& propModifiedDef = objImageDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); + location->Property( propModifiedDef, modProp, 0 ); + if ( modProp ) + { + TTime timestamp( 0 ); + timestamp.UniversalTime(); + modProp->SetTimeValueL( timestamp ); + } + // commit to DB + iMdeSession->CommitObjectL(*location); + CleanupStack::PopAndDestroy( location ); + + // update the relation + const TInt count = iRelationQuery->Count(); + LOG1("Relation count - %d", count); + for ( TInt i = 0; i < count; i++ ) + { + CMdERelation& relation = iRelationQuery->Result( i ); + // update relation timestamp, composer will then update exif data + + TTime timestamp( 0 ); + timestamp.UniversalTime(); + relation.SetLastModifiedDate( timestamp ); + iMdeSession->UpdateRelationL( relation ); + } + LOG("CInternalGeoTagger::UpdateGPSInfoL ,end"); + } + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::ConversionCompletedL() +// -------------------------------------------------------------------------- +// + +void CInternalGeoTagger::ConversionCompletedL( const TInt aError, + TLocality& aPosition ) + { + LOG1("CInternalGeoTagger::ConversionCompletedL, begin. Error - %d", aError); + if(aError == KErrNone) + { + iLocationData.iPosition.SetCoordinate + ( aPosition.Latitude(), aPosition.Longitude(), aPosition.Altitude()); + iLocationData.iQuality = aPosition.HorizontalAccuracy(); + UpdateGPSInfoL(aPosition); +#ifdef LOC_REVERSEGEOCODE + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationData.iPosition, iConnectionOption ) ; + } + else +#endif //LOC_REVERSEGEOCODE + { + IterateNextLocation(); //Go through next location + } + } + else + { + IterateNextLocation(); //Go through next location + } + LOG("CInternalGeoTagger::ConversionCompletedL, end"); + } + + +//----------------------------------------------------------------- +// CInternalGeoTagger::HandleConversionError +//------------------------------------------------------------------ +// +void CInternalGeoTagger::HandleConversionError(TInt aError) + { + LOG("CInternalGeoTagger::HandleConversionError, begin"); + ARG_USED(aError); + IterateNextLocation(); //Go through next location + LOG("CInternalGeoTagger::HandleConversionError, end"); + } + +#endif //LOC_GEOTAGGING_CELLID + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::PendingGeoTagsL() +// Is there any untagged photos with location info?. +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::PendingGeoTagsL( TBool aTagInProgress ) + { + LOG("CInternalGeoTagger::PendingGeoTagsL ,begin"); + iIndex = 0; + if ( aTagInProgress ) + { + //Tagging is going through location trail, so photo does not need to do tagging now + LOG("Geo tagging in progress.\n"); + iObserver->PendingGeoTagReqComplete( KErrInUse ); + } + else + { + if(!iTagPendingHandlerFlag && iIndex <= 0) + { + LOG("Processing the request.\n"); + // tag pending request is not going on + iTagPendingHandlerFlag = ETrue; + CreateGeoTagsL(); + } + else + { + // req osn progress, don't do anything. + LOG("Request in progress.\n"); + iObserver->PendingGeoTagReqComplete( KErrInUse ); + } + } + LOG("CInternalGeoTagger::PendingGeoTagsL ,end"); + } + + +#ifdef LOC_REVERSEGEOCODE +// -------------------------------------------------------------------------- +// CInternalGeoTagger::AddressInfo() +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::AddressInfoL( const TItemId aCountryTagId, const TItemId aCityTagId ) + { + LOG("CInternalGeoTagger::AddressInfoL ,begin"); + + const TInt count = iRelationQuery->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + CMdERelation& relation = iRelationQuery->Result( i ); + TItemId imageId = relation.LeftObjectId(); + + if ( !GPSInfoExists() ) //to update EXIF + { + // update relation timestamp, composer will then update exif data + TTime timestamp( 0 ); + timestamp.UniversalTime(); + relation.SetLastModifiedDate( timestamp ); + iMdeSession->UpdateRelationL( relation ); + } + + iTagCreator->AttachTagsL( imageId, aCountryTagId, aCityTagId ); + } + + LOG("CInternalGeoTagger::AddressInfoL ,end"); + } + + +// -------------------------------------------------------------------------- +// CInternalGeoTagger::ReverseGeocodeComplete() +// Get address details like street, city, state, etc. +// -------------------------------------------------------------------------- +// +void CInternalGeoTagger::ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ) + { + LOG("CInternalGeoTagger::ReverseGeocodeComplete ,begin"); + TItemId countryTagId(0); + TItemId cityTagId(0); + + // create country and city tags + if( aErrorcode == KErrNone ) + { + TPtrC countryPtr( aAddressInfo.GetCountryName() ); + TPtrC cityPtr( aAddressInfo.GetCity() ); + + TRAP_IGNORE( iTagCreator->CreateLocationTagsL( countryPtr, countryTagId, cityPtr, cityTagId ) ); + + TRAP_IGNORE(AddressInfoL( countryTagId, cityTagId )); + + IterateNextLocation(); + } + else + { + LOG1("Reverse geocode err - %d", aErrorcode); + + IterateNextLocation(); + } + + + LOG("CInternalGeoTagger::ReverseGeocodeComplete ,end"); + } + +// ---------------------------------------------------------------------------- +// CInternalGeoTagger::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CInternalGeoTagger::GetCurrentRegisterNw() + { + LOG( "CInternalGeoTagger::GetCurrentRegisterNw ,begin" ); + return iObserver->GetCurrentRegisterNw(); + } + +// ---------------------------------------------------------------------------- +// CInternalGeoTagger::IsRegisteredAtHomeNetwork() +// ---------------------------------------------------------------------------- +TBool CInternalGeoTagger::IsRegisteredAtHomeNetwork() + { + LOG( "CInternalGeoTagger::IsRegisteredAtHomeNetwork" ); + return iObserver->IsRegisteredAtHomeNetwork(); + } + +// ---------------------------------------------------------------------------- +// CInternalGeoTagger::GetHomeNetworkInfo() +// ---------------------------------------------------------------------------- +const RMobilePhone::TMobilePhoneNetworkInfoV1& + CInternalGeoTagger::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) + { + LOG( "CInternalReverseGeocode::GetHomeNetworkInfo" ); + return iObserver->GetHomeNetworkInfo(aHomeNwInfoAvailableFlag); + } + +#endif //LOC_REVERSEGEOCODE + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/group/bld.inf --- a/locationmanager/group/bld.inf Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -14,7 +14,19 @@ * Description: Build information file * */ +#include "../inc/locplatsupport.mmh" +#ifdef _LOC_GEOTAGGING_CELLID +#include "../geoconverter/group/bld.inf" +#endif + +#ifdef _LOC_REVERSEGEOCODE +#include "../tagcreator/group/bld.inf" +#include "../ReverseGeocode/group/bld.inf" +#include "../ReverseGeoCoderPlugin/group/bld.inf" +#endif + +#include "../geotagger/group/bld.inf" #include "../locationtrail/group/bld.inf" #include "../server/group/bld.inf" #include "../client/group/bld.inf" diff -r 63c982fb92f2 -r b73252188534 locationmanager/inc/locationmanagerdebug.h --- a/locationmanager/inc/locationmanagerdebug.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/inc/locationmanagerdebug.h Thu Aug 19 10:20:41 2010 +0300 @@ -39,6 +39,8 @@ #define __CLOGGING__ #endif +// Added to remove compilation warnings. +#define ARG_USED(a) (void)(a) // Then actual definitions depending on the diff -r 63c982fb92f2 -r b73252188534 locationmanager/inc/locationmanagerdefs.h --- a/locationmanager/inc/locationmanagerdefs.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/inc/locationmanagerdefs.h Thu Aug 19 10:20:41 2010 +0300 @@ -18,7 +18,7 @@ #ifndef __LOCATIONMANAGERDEFS_H__ #define __LOCATIONMANAGERDEFS_H__ -_LIT( KLocServerFileName, "LocationManagerServer.exe"); +_LIT( KLocServerFileName, "locationmanagerserver.exe"); _LIT( KLocServerName, "LocationManagerServer" ); const TInt KLocationManagerServerMinor = 0; @@ -51,7 +51,11 @@ ELocManTrackLogName, ELocManRegObserver, ELocManGetCaptureSetting, - ELocManCancelTrackLogNotify + ELocManCancelTrackLogNotify, + ELocManTagPending, + ELocManStartGeoTaging, + ELocManCancelTagPendingReq, + ELocManCancelGeoTaggingReq }; /** Message argument indices */ @@ -62,6 +66,8 @@ EArgumentState }; +const TInt KLocManagerSessionPriority = 5; + #endif // __LOCATIONMANAGERDEFS_H__ // End of file. diff -r 63c982fb92f2 -r b73252188534 locationmanager/inc/locplatsupport.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/inc/locplatsupport.mmh Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition file for Location Manager. +* +*/ + +#ifndef __LOCPLATSUPPORT_MMH__ +#define __LOCPLATSUPPORT_MMH__ + +/* +* Define this flag when platform supports cellid based location. +*/ + +#define _LOC_GEOTAGGING_CELLID + +/* +* Define this flag when platform supports reverse geotagging. +*/ +#define _LOC_REVERSEGEOCODE + + +#endif // __LOCPLATSUPPORT_MMH__ + +// End of file. + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/bwincw/locationtrailwinscw.def --- a/locationmanager/locationtrail/bwincw/locationtrailwinscw.def Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/bwincw/locationtrailwinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -15,7 +15,7 @@ ?GetTrackLogName@CTrackLog@@QAEXAAV?$TBuf@$0BAA@@@@Z @ 14 NONAME ; void CTrackLog::GetTrackLogName(class TBuf<256> &) ?IsRecording@CTrackLog@@QAEHXZ @ 15 NONAME ; int CTrackLog::IsRecording(void) ?LocationTrailState@CLocationRecord@@QAEXAAW4TTrailState@RLocationTrail@@@Z @ 16 NONAME ; void CLocationRecord::LocationTrailState(enum RLocationTrail::TTrailState &) - ?NewL@CLocationRecord@@SAPAV1@XZ @ 17 NONAME ; class CLocationRecord * CLocationRecord::NewL(void) + ?NewL@CLocationRecord@@SAPAV1@AAVMGeoTaggerObserver@@AAVRMobilePhone@@@Z @ 17 NONAME ; class CLocationRecord * CLocationRecord::NewL(class MGeoTaggerObserver &, class RMobilePhone &) ?NewL@CNetworkInfo@@SAPAV1@PAVMNetworkInfoObserver@@@Z @ 18 NONAME ; class CNetworkInfo * CNetworkInfo::NewL(class MNetworkInfoObserver *) ?NewL@CPositionInfo@@SAPAV1@PAVMPositionInfoObserver@@@Z @ 19 NONAME ; class CPositionInfo * CPositionInfo::NewL(class MPositionInfoObserver *) ?NewL@CTrackLog@@SAPAV1@XZ @ 20 NONAME ; class CTrackLog * CTrackLog::NewL(void) @@ -31,5 +31,12 @@ ?SetStateToStopping@CLocationRecord@@QAEXXZ @ 30 NONAME ; void CLocationRecord::SetStateToStopping(void) ?LocationSnapshotL@CLocationRecord@@QAEXABI@Z @ 31 NONAME ; void CLocationRecord::LocationSnapshotL(unsigned int const &) ?RemappingNeeded@CLocationRecord@@QAEHXZ @ 32 NONAME ; int CLocationRecord::RemappingNeeded(void) - ?IsLowBattery@CLocationRecord@@QAEHXZ @ 33 NONAME ; int CLocationRecord::IsLowBattery(void) + ?StartGeoTagging@CLocationRecord@@QAEHW4TConnectionOption@@@Z @ 33 NONAME ; int CLocationRecord::StartGeoTagging(enum TConnectionOption) + ?StartNwInfoChangeNotifier@CNetworkInfo@@QAEXXZ @ 34 NONAME ; void CNetworkInfo::StartNwInfoChangeNotifier(void) + ?StopNwInfoChangeNotifier@CNetworkInfo@@QAEXXZ @ 35 NONAME ; void CNetworkInfo::StopNwInfoChangeNotifier(void) + ?CancelGeoTagging@CLocationRecord@@QAEXXZ @ 36 NONAME ; void CLocationRecord::CancelGeoTagging(void) + ?TaggingInProgress@CLocationRecord@@QAEHXZ @ 37 NONAME ; int CLocationRecord::TaggingInProgress(void) + ?MapNetworkInfo@CNetworkInfo@@SAXPAVTNetworkInfoV1@CTelephony@@PAVTMobilePhoneNetworkInfoV2@RMobilePhone@@PAVTMobilePhoneLocationAreaV1@5@@Z @ 38 NONAME ; void CNetworkInfo::MapNetworkInfo(class CTelephony::TNetworkInfoV1 *, class RMobilePhone::TMobilePhoneNetworkInfoV2 *, class RMobilePhone::TMobilePhoneLocationAreaV1 *) + ?GetCurrentRegisteredNw@CLocationRecord@@QAEAAVTMobilePhoneNetworkInfoV2@RMobilePhone@@XZ @ 39 NONAME ; class RMobilePhone::TMobilePhoneNetworkInfoV2 & CLocationRecord::GetCurrentRegisteredNw(void) + ?IsLowBattery@CLocationRecord@@QAEHXZ @ 40 NONAME ; int CLocationRecord::IsLowBattery(void) diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/eabi/locationtrailarm.def --- a/locationmanager/locationtrail/eabi/locationtrailarm.def Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/eabi/locationtrailarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -10,7 +10,7 @@ _ZN15CLocationRecord18LocationTrailStateERN14RLocationTrail11TTrailStateE @ 9 NONAME _ZN15CLocationRecord21CancelLocationRequestEv @ 10 NONAME _E32Dll @ 11 NONAME ABSENT - _ZN15CLocationRecord4NewLEv @ 12 NONAME + _ZN15CLocationRecord4NewLER18MGeoTaggerObserverR12RMobilePhone @ 12 NONAME _ZN15CLocationRecord4StopEv @ 13 NONAME _ZN15CLocationRecord6StartLEN14RLocationTrail20TTrailCaptureSettingE @ 14 NONAME _ZN9CTrackLog11IsRecordingEv @ 15 NONAME @@ -53,5 +53,12 @@ _ZN9CTrackLogD0Ev @ 52 NONAME _ZN9CTrackLogD1Ev @ 53 NONAME _ZN9CTrackLogD2Ev @ 54 NONAME - _ZN15CLocationRecord12IsLowBatteryEv @ 55 NONAME + _ZN12CNetworkInfo24StopNwInfoChangeNotifierEv @ 55 NONAME + _ZN12CNetworkInfo25StartNwInfoChangeNotifierEv @ 56 NONAME + _ZN15CLocationRecord15StartGeoTaggingE17TConnectionOption @ 57 NONAME + _ZN15CLocationRecord16CancelGeoTaggingEv @ 58 NONAME + _ZN15CLocationRecord17TaggingInProgressEv @ 59 NONAME + _ZN12CNetworkInfo14MapNetworkInfoEPN10CTelephony14TNetworkInfoV1EPN12RMobilePhone25TMobilePhoneNetworkInfoV2EPNS3_26TMobilePhoneLocationAreaV1E @ 60 NONAME + _ZN15CLocationRecord22GetCurrentRegisteredNwEv @ 61 NONAME + _ZN15CLocationRecord12IsLowBatteryEv @ 62 NONAME diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/group/locationtrail.mmp --- a/locationmanager/locationtrail/group/locationtrail.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/group/locationtrail.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -17,6 +17,7 @@ #include #include +#include "../../inc/locplatsupport.mmh" VERSION 10.0 TARGET LocationTrail.dll @@ -28,7 +29,7 @@ #if defined(WINSCW) deffile ../bwincw/locationtrailwinscw.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/locationtrailarm.def #endif nostrictdef @@ -37,6 +38,24 @@ USERINCLUDE ../../inc USERINCLUDE ../../../inc +#ifdef _LOC_REVERSEGEOCODE +MACRO LOC_REVERSEGEOCODE +USERINCLUDE ../../tagcreator/inc +USERINCLUDE ../../ReverseGeocode/inc +USERINCLUDE ../../ReverseGeoCoderPlugin/inc +#endif + +#ifdef _LOC_GEOTAGGING_CELLID +MACRO LOC_GEOTAGGING_CELLID +USERINCLUDE ../../geoconverter/inc +#endif + +SYSTEMINCLUDE /epoc32/include/stdapis +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/platform/lbs + +MW_LAYER_SYSTEMINCLUDE + SOURCEPATH ../src SOURCE clocationrecord.cpp SOURCE cnetworkinfo.cpp @@ -45,19 +64,35 @@ SOURCE cgpxconverterao.cpp SOURCE locationremappingao.cpp -MW_LAYER_SYSTEMINCLUDE - LIBRARY euser.lib LIBRARY efsrv.lib LIBRARY lbs.lib LIBRARY etel3rdparty.lib -LIBRARY mdeclient.lib +LIBRARY etel.lib +LIBRARY etelmm.lib +LIBRARY mdeclient.lib LIBRARY estor.lib -LIBRARY PlatformEnv.lib -LIBRARY centralrepository.lib +LIBRARY PlatformEnv.lib +LIBRARY centralrepository.lib +LIBRARY ecom.lib +LIBRARY commsdat.lib + +LIBRARY geotagger.lib +LIBRARY libc.lib + +#ifdef _LOC_REVERSEGEOCODE +LIBRARY reversegeocode.lib +LIBRARY tagcreator.lib +#endif + +#ifdef _LOC_GEOTAGGING_CELLID +LIBRARY geoconverter.lib +#endif + PAGED BYTEPAIRCOMPRESSTARGET OPTION ARMCC -O3 -OTime - +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/inc/cgpxconverterao.h --- a/locationmanager/locationtrail/inc/cgpxconverterao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/inc/cgpxconverterao.h Thu Aug 19 10:20:41 2010 +0300 @@ -100,11 +100,14 @@ /** * Adds temp-file and possible pre-calculated boundaries * into processing queue + * @param aFileName The temp file name + * @param aBoundaries The pre-calculated boundaries */ void AddToQueueL( const TDesC& aFileName, TBoundaries* aBoundaries = NULL ); /** * Adds observer for GPX file creation notifications + * @param aObserver The observer that recieves the file creation notifications */ void AddObserver( MGpxConversionObserver* aObserver ); @@ -122,11 +125,13 @@ /** * Set next state for RunL + * @param aState The next processing state */ void SetState( TProcessingState aState ); /** * Resolve where to save tracklog file + * aFileName The name of the file */ void GetTrackLogPathL( TDes& aFileName ); diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/inc/clocationrecord.h --- a/locationmanager/locationtrail/inc/clocationrecord.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/inc/clocationrecord.h Thu Aug 19 10:20:41 2010 +0300 @@ -22,6 +22,11 @@ #include #include + +#include +#include +#include + #include "rlocationtrail.h" #include "locationdatatype.h" #include "cnetworkinfo.h" @@ -37,6 +42,17 @@ #include "mdequery.h" #include "locationremappingao.h" +#ifdef LOC_GEOTAGGING_CELLID +#include "cgeoconverter.h" +#endif + +#ifdef LOC_REVERSEGEOCODE +#include +#include "ctagcreator.h" +#include "reversegeocode.h" +class CReverseGeoCoderPlugin; +#endif + typedef RLocationTrail::TTrailState TLocTrailState; class CTelephony; @@ -55,11 +71,22 @@ * This method is used to notify about location trail state changes. */ virtual void LocationTrailStateChange() = 0; - + + /** + * This method is used to fetch the current location + * @param aSatelliteInfo The satellite information + * @param aNetworkInfo The network informatiom + * @param aError ErrCode if any + */ virtual void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo, const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError ) = 0; - + + + /** + * This method is used to notify about GPS signal quality changes. + * @param aSatelliteInfo The satellite information + */ virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) = 0; /** @@ -86,6 +113,21 @@ TLocTrailState iTrailState; // Trail state for this item. }; +/** +* Location snap shot item class. +*/ +class TLocationSnapshotItem + { + public: + TLocationData iLocationData; // Location info & network info + TItemId iObjectId; // current media object id. + TItemId iLocationId; + TUint iFlag; //indicator for various scenarios +#ifdef LOC_REVERSEGEOCODE + TItemId iCountryTagId; + TItemId iCityTagId; +#endif + }; class MLocationAddObserver { public: @@ -107,14 +149,21 @@ public MNetworkInfoObserver, public MPositionInfoObserver, public MMdEQueryObserver +#ifdef LOC_GEOTAGGING_CELLID + ,public MGeoConverterObserver +#endif +#ifdef LOC_REVERSEGEOCODE + ,public MReverseGeocodeObserver +#endif { public: /** * 2-phased constructor. + * @param aGeoTaggerObserver The observer that is notified after geotagging * @since S60 3.1 */ - IMPORT_C static CLocationRecord* NewL(); - + IMPORT_C static CLocationRecord* NewL(MGeoTaggerObserver& aGeoTaggerObserver, RMobilePhone& aPhone); + /** * C++ destructor. * @since S60 3.1 @@ -195,66 +244,178 @@ /** * Set observer (TrackLog) for notifying new locations in location trail + * @param aObserver, An observer for location changes */ IMPORT_C void SetAddObserver( MLocationAddObserver* aObserver ); - + + + /** + * Update network information + * + */ static TInt UpdateNetworkInfo( TAny* aAny ); + + /* + * creates a location object from the given location data and objectId + * @param aLocationData the location data + * @param aObjectId the object Id + */ IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData, const TUint& aObjectId ); - + + + /** + * Handle the photos taken by phone camera. + * @param aObjectId Object id + */ IMPORT_C void LocationSnapshotL( const TUint& aObjectId ); - + + /** + * Creates a location object with given location data + * @param aLocationData The location data + * @return The locationId + */ TItemId DoCreateLocationL( const TLocationData& aLocationData ); - + + /** + * Creates a "contains" relation for the given ObjectId and LocationId and adds it to the iMdeSession + * @param aObjectId Object id + * @param aLocationId location id + * @return item id + */ TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId ); - + /** + * Sets the CMdESession for tagcreation + * @param aSession The CMdESession object + */ IMPORT_C void SetMdeSession( CMdESession* aSession ); + /** + * Sets the current location trail state to Stop + */ IMPORT_C void SetStateToStopping(); + /** + * returns the timevalue of the CMdEObject corresponding to a given ObjectId + * @param aObjectId the objectId + * @return the timevalue associated with given object + */ TTime GetMdeObjectTimeL( TItemId aObjectId ); - + + /** + * Checks if Remapping is needed + * @return Boolean to indicate if remapping is needed or not + */ IMPORT_C TBool RemappingNeeded(); - + + IMPORT_C TBool IsLowBattery(); + /** + * Checks if geotagging is in progress + * @return Boolean to indicate if geotagging is in progress + */ + IMPORT_C TBool TaggingInProgress(); + + + /** + * Initiates geotagging + * @param aConnectionOption connection option,silent or not + * @return Etrue if geotagging is started + */ + IMPORT_C TBool StartGeoTagging(const TConnectionOption aConnectionOption); + + /** + * Cancels the geotagging + */ + IMPORT_C void CancelGeoTagging(); + public: // from MNetworkInfoObserver. /** * + * NetworkInfo + * This method is used for setting the network cell id to the * @since S60 3.1 - * @param - * @return + * @param aNetworkInfo N/W info + * @param aError Error code */ void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ); + + /** + * Get mobile phone object for network info object + * @return mobile phone object + */ + RMobilePhone& GetMobilePhone4NwInfo(); public: // from MPositionInfoObserver /** - * + * This method is used for setting the position info to the + * location trail. * @since S60 3.1 - * @param - * @return + * @param aPositionInfo the position information + * @param aError Captures the errcode if any */ void Position( const TPositionInfo& aPositionInfo, const TInt aError ); public: // From MMdEQueryObserver + /** + * Handle query new results + * @param aQuery Query object + * @param aFirstNewItemIndex new item index + * @param aNewItemCount item count + */ void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, TInt aNewItemCount); - + + + /* + * This method is called when any of the location/image/tag query is completed + * @param aQuery The Query type + * @param aError Indicates if the query was completed successfully or with any err + * + */ void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); + +#ifdef LOC_GEOTAGGING_CELLID +public: // MGeoConverterObserver + /** + * This method is used for notifying completion of geotagging + * @param aError error code + * @param aPosition position (lat/lon) for the correcponding n/w info + */ + void ConversionCompletedL( const TInt aError, TLocality& aPosition ); + + /** + * This method is used to handle the conversion error + * @param aError the error code + */ + void HandleConversionError(TInt aError); -private: +#endif +public: + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + IMPORT_C RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisteredNw(); + + +private: /** * Stores the location info into the array. + * @param aSatelliteInfo Satellite information */ - void StoreLocation( /*const TPosition& aPosition, const TCourse& aCourse,*/ - const TPositionSatelliteInfo& aSatelliteInfo ); + void StoreLocation( const TPositionSatelliteInfo& aSatelliteInfo ); /** * Changes the current state. New state is published in P&S and * possible observer is notified. + * @param aState The location trail state that is to be set */ void SetCurrentState( TLocTrailState aState ); @@ -262,15 +423,18 @@ * Returns the requested location via callback method, if the location * is valid. Otherwise new location value is requested until the value * is succesful, or the time out limit has been reached. + * @param aSatelliteInfo The satelliteInfo object + * @param aError Indicates any error in handling the location request * */ void HandleLocationRequest( const TPositionSatelliteInfo& aSatelliteInfo /*TLocality& aPosition*/, const TInt aError ); /** * C++ constructor. + * @param aGeoTaggerObserver The observer that is to be notified when geotagging completes */ - CLocationRecord(); - + CLocationRecord(MGeoTaggerObserver& aGeoTaggerObserver, RMobilePhone& aPhone); + /** * 2nd phase constructor. */ @@ -282,12 +446,157 @@ * @param aValue, Read value */ void ReadCenRepValueL(TInt aKey, TInt& aValue); - + + /** + * Validates the lat lon values recieved + * @param aSatelliteInfo The satelliteInfo object + * @return ETrue if the lat=lon are valid + */ TBool CheckGPSFix( const TPositionSatelliteInfo& aSatelliteInfo ); - + + + /** + * Starts the network info timer + */ void StartTimerL(); + + /** + * Fetches the location info from the db + */ + + void FindLocationFromDBL(); + + + /** + * Find location entry + * @param aQuery query type for the tag + * @param aLocationId Location Id + */ + void FindAnyLocationMatchesL( CMdEQuery& aQuery, TUint& aLocationId ); + + /** + * Remaps the location objects when GPS is available + * @param aGPSInfoAvailable Boolean value to indicate if GPS is available + */ + void RemapObjectsL( TBool aGPSInfoAvailable ); + + /** + * Check any location object already exists with same network info + */ + void FindLocationWithSameNetInfoL(); + + /** + * Initialises the location object definitions + */ + void InitialiseL(); + + /** + * handle network location related query on complete + * @param aQuery the query type + */ + void HandleNetLocationQueryL( CMdEQuery& aQuery ); + + + /** + * handle the location query on location query complete + * @param aQuery the query type + */ + void HandleLocationQueryL( CMdEQuery& aQuery ); + + /** + * Callback method on geotagging complete + */ + void GeoTaggingCompleted(); + +#ifdef LOC_REVERSEGEOCODE + /** + * Get any imagefor this location object + * @param aLocID, location object Id + */ + void GetRelatedImageL( TItemId aLocID ); + + /** + * Get tags for this image + * @param aImageID, image object Id + */ + void GetTagsL( TItemId aImageID ); + + /** + * handle the tag query on complete + * @param aQuery the query type + */ + void HandleTagQueryL( CMdEQuery& aQuery ); + + + // MReverseGeocodeObserver + //from reverse-geocode observer + /* + * Call back method from reverse geo coder with address details like country, city.. + * @param aErrorcode Indicates any error in Reverse geocoding + * aAddressInfo address info + */ + void ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + TBool IsRegisteredAtHomeNetwork(); + + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); + + /** + * Find country & city tags id + * @param aQuery query type for the tag + * @param aCountryTagId country tag Id + * @param aCityTagId city tag Id + */ + void FindCountryAndCityTagL( CMdEQuery& aQuery, TItemId& aCountryTagId, TItemId& aCityTagId ); + +#endif // LOC_REVERSEGEOCODE + + /** + * Handle n/w related information on taken photograph + * + */ + void NetworkInfoSnapshotL(); + + /** + * Find location from DB within the non leaving method + */ + void HandleFindLocationFromDB(); + + /** + * handle MDS query failure sceenario + */ + void HandleQueryFailure(); + + private: + enum TRemapState + { + ERemapProgressNone = 0x00, + ERemapRevGeoCodeInProgress, + ERemapRevGeoCodePending, + ERemapNwGeoConverterInProgress, + ERemapNwGeoConverterPending + }; /** * A session to Metadata Engine for creating and manipulating location objects. */ @@ -309,7 +618,7 @@ * An array to collect location values. * Own. */ - RArray iTrail; + RPointerArray iTrail; /** * P&S key property. @@ -321,7 +630,7 @@ * Active class to get network information. * Own. */ - CNetworkInfo* iNetworkInfo; + CNetworkInfo* iNetworkInfoChangeListener; /** * Active class to get position information. @@ -357,14 +666,10 @@ TBool iRequestCurrentLoc; TBool iTrailStarted; - TUint iLastNumberOfSatellitesUsed; - TReal32 iLastHDOP; - TReal32 iLastVDOP; TBool iLastGPSFixState; TInt iLocationDelta; TLocationData iLastLocation; - TItemId iLastLocationId; TItemId iObjectId; TLocationData iLocationData; @@ -373,6 +678,83 @@ * This query object is used to find existing locations */ CMdEObjectQuery* iLocationQuery; + + + /** + * Net location query + */ + CMdEObjectQuery* iNetLocationQuery; + + + TRemapState iRemapState; + + + /** + * Database definitions. + */ + CMdENamespaceDef* iNamespaceDef; + CMdEObjectDef* iLocationObjectDef; + CMdEPropertyDef* iLatitudeDef; + CMdEPropertyDef* iLongitudeDef; + CMdEPropertyDef* iAltitudeDef; + + /** + * An array to collect downloaded object + * and its location details. + */ + RPointerArray iMediaItems; + + TLocationSnapshotItem iLastMediaItem; + + TInt iMediaHandlingFlag; + RMobilePhone& iPhone; + + /* + * Flag to track GPS data availability to update camera location icon. + */ + TBool iGpsDataAvailableFlag; + + MGeoTaggerObserver& iGeoTaggerObserver; + +#ifdef LOC_GEOTAGGING_CELLID + /* + * Geo converter + */ + CGeoConverter* iGeoConverter; + TBool iConvertRetry; +#endif + +#ifdef LOC_REVERSEGEOCODE + + TConnectionOption iConnectionOption; + + /** + * query object for getting an image/video object + */ + CMdERelationQuery* iImageQuery; + /** + * query object for getting country and city tags + */ + CMdERelationQuery* iTagQuery; + TLocationSnapshotItem iLastLocationItem; + RPointerArray iLocationItems; + /** + * to create/attach tags + */ + CTagCreator *iTagCreator; + /* + * Flag to track last reverse geocode failure sceenario + */ + TBool iLastReverseGeocodeFails; + + /* + * Reverse geo coder plugin object + */ + CReverseGeoCoderPlugin* iRevGeocoderPlugin; + TUid iDtorKey; + +#endif + }; #endif // C_CLOCATIONRECORD_H diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/inc/cnetworkinfo.h --- a/locationmanager/locationtrail/inc/cnetworkinfo.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/inc/cnetworkinfo.h Thu Aug 19 10:20:41 2010 +0300 @@ -20,6 +20,8 @@ #define C_CNETWORKINFO_H #include +#include +#include /** * An observer interface, which is used for getting current network cell id. @@ -34,6 +36,12 @@ * location trail. */ virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) = 0; + + /** + * Get mobile phone object for network info object + * @return mobile phone object + */ + virtual RMobilePhone& GetMobilePhone4NwInfo() = 0; }; /** @@ -55,6 +63,33 @@ */ IMPORT_C virtual ~CNetworkInfo(); + /** + * Listen to n/w info change + * @since S60 9.2 + */ + IMPORT_C void StartNwInfoChangeNotifier(); + + /** + * Stop n/w info change listener + * @since S60 9.2 + */ + IMPORT_C void StopNwInfoChangeNotifier(); + + /** + * Map etel to ctelephony + * @since S60 9.2 + */ + IMPORT_C static void MapNetworkInfo(CTelephony::TNetworkInfoV1* aISVNetworkInfo, + RMobilePhone::TMobilePhoneNetworkInfoV2* aMMNetworkInfo, + RMobilePhone::TMobilePhoneLocationAreaV1* aMMArea); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + protected: /** * Run error implementation in case of RunL leaving. @@ -85,6 +120,13 @@ void RunL(); private: + typedef enum + { + ENetworkInfoNoOptState = 0x00, + ENetworkInfoOptGetState, + ENetworkInfoOptNotifyState + }TNetworkInfoOptState; + /** * An observer interface to set current cell id to the location trail. * Not own. @@ -92,18 +134,23 @@ MNetworkInfoObserver* iTrail; /** - * Flag to indicate that we retrieve network info for the first time. + * phone object to retrieve modem parameters */ - TBool iFirstTime; - + RMobilePhone& iMobilePhone; + /** - * Interface to phone's telephony system to get Cell Id. - * Own. - */ - CTelephony* iTelephony; - + * Maintain the operation state. + */ + TNetworkInfoOptState iState; + + /* + * Retained this object just to give backward compatibility + */ CTelephony::TNetworkInfoV1 iNetworkInfoV1; - CTelephony::TNetworkInfoV1Pckg iNetworkInfoV1Pckg; + + RMobilePhone::TMobilePhoneNetworkInfoV2 iMMNetworkInfo; + RMobilePhone::TMobilePhoneNetworkInfoV2Pckg iMMNetworkInfoPckg; + RMobilePhone::TMobilePhoneLocationAreaV1 iMMArea; }; #endif // C_CNETWORKINFO_H diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/inc/cpositioninfo.h --- a/locationmanager/locationtrail/inc/cpositioninfo.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/inc/cpositioninfo.h Thu Aug 19 10:20:41 2010 +0300 @@ -82,7 +82,12 @@ * @return None. */ void Stop(); - + + /** + * Handle remap completed event + * @since S60 9.2 + */ + void HandleRemapComplete(); protected: /** * Run error implementation in case of RunL leaving. @@ -113,6 +118,12 @@ void RunL(); private: + typedef enum + { + EPositionOptStateNone = 0x00, + EPositionOptStateGetLastKnownPosition, + EPositionOptStateNotifyUpdate + }TPositionOptState; /** * An observer interface to set current position to the location trail. * Not own. @@ -137,7 +148,8 @@ TInt iUpdateInterval; - TBool iFirstInterval; + TPositionOptState iState; + TBool iConnectedPositionServer; }; #endif // C_CPOSITIONINFO_H diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/inc/locationremappingao.h --- a/locationmanager/locationtrail/inc/locationremappingao.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/inc/locationremappingao.h Thu Aug 19 10:20:41 2010 +0300 @@ -28,7 +28,9 @@ #include "rlocationtrail.h" #include "locationmanagerdebug.h" #include "locationtraildefs.h" - +#ifdef LOC_REVERSEGEOCODE +#include "ctagcreator.h" +#endif class TRemapItem { @@ -128,6 +130,19 @@ * @param aLocationId, locationId for relations */ void UpdateRelationsL( TItemId aLocationId ); + +#ifdef LOC_REVERSEGEOCODE + /** + * AttachGeoTagsL + * Attaches the country and city tags to all objects + * @param aTagCreator An instance of the tag creator + * @param aCountryTagId country tagId + * @param aCityTagId city tag Id + */ + void AttachGeoTagsL( CTagCreator *aTagCreator, + const TItemId aCountryTagId, + const TItemId aCityTagId ); +#endif private: /** @@ -245,3 +260,5 @@ #endif /*LOCATIONREMAPPINGAO_H_*/ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/locationtrail/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS LocationTrail + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/sis/locationtrail_stub.sis Binary file locationmanager/locationtrail/sis/locationtrail_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/locationtrail/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"LocationTrail Patch"},(0x200071BD), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/locationtrail/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"locationtrail"}, (0x200071BD), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/cgpxconverterao.cpp --- a/locationmanager/locationtrail/src/cgpxconverterao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/cgpxconverterao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -22,6 +22,7 @@ #include "locationmanagerdebug.h" // --------------------------------------------------------------------------- +// CGpxConverterAO::CGpxConverterAO() // Default constructor. // --------------------------------------------------------------------------- // @@ -32,6 +33,7 @@ } // --------------------------------------------------------------------------- +// CGpxConverterAO::NewL // Standard NewL for first phase construction. // --------------------------------------------------------------------------- // @@ -46,18 +48,19 @@ } // --------------------------------------------------------------------------- +// CGpxConverterAO::ConstructL // 2nd phase construction. // --------------------------------------------------------------------------- // void CGpxConverterAO::ConstructL() { - LOG( "CGpxConverterAO::ConstructL" ); + LOG( "CGpxConverterAO::ConstructL ,begin" ); CActiveScheduler::Add( this ); User::LeaveIfError( iFs.Connect() ); iWriteBuf = HBufC8::NewL( KWriteBufSize ); iFormatBuf = HBufC::NewL( KWriteBufSize ); - + LOG( "CGpxConverterAO::ConstructL ,end" ); } // --------------------------------------------------------------------------- @@ -66,7 +69,7 @@ // CGpxConverterAO::~CGpxConverterAO() { - LOG( "CGpxConverterAO::~CGpxConverterAO" ); // DEBUG INFO + LOG( "CGpxConverterAO::~CGpxConverterAO ,begin" ); Cancel(); iFs.Close(); @@ -79,13 +82,19 @@ iBoundQueue.Close(); delete iTempFile; + iTempFile = NULL; delete iBoundaries; + iBoundaries = NULL; delete iWriteBuf; + iWriteBuf = NULL; delete iFormatBuf; + iFormatBuf = NULL; + LOG( "CGpxConverterAO::~CGpxConverterAO ,end" ); } // --------------------------------------------------------------------------- +// CGpxConverterAO::RunError // From CActive. // --------------------------------------------------------------------------- // @@ -100,6 +109,7 @@ } // --------------------------------------------------------------------------- +// CGpxConverterAO::DoCancel // From CActive. // --------------------------------------------------------------------------- // @@ -108,13 +118,15 @@ LOG( "CGpxConverterAO::DoCancel" ); } -/** - * Adds temp-file and possible pre-calculated boundaries - * into processing queue - */ +// --------------------------------------------------------------------------- +// CGpxConverterAO::AddToQueueL +// Adds temp-file and possible pre-calculated boundaries +// into processing queue +// --------------------------------------------------------------------------- +// void CGpxConverterAO::AddToQueueL( const TDesC& aFileName, TBoundaries* aBoundaries ) { - LOG("CGpxConverterAO::AddToQueueL"); + LOG("CGpxConverterAO::AddToQueueL ,begin"); TFileName *filename = new (ELeave) TFileName(aFileName); CleanupStack::PushL( filename ); iFileQueue.AppendL( filename ); @@ -125,11 +137,15 @@ { SetState( ENextFile ); } + + LOG("CGpxConverterAO::AddToQueueL ,end"); } -/** - * Set next state for RunL - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::SetState + // Set next state for RunL + // --------------------------------------------------------------------------- void CGpxConverterAO::SetState( TProcessingState aState ) { LOG1( "CGpxConverterAO::SetState: %d", aState ); @@ -141,11 +157,13 @@ TRequestStatus* ptrStatus = &iStatus; User::RequestComplete( ptrStatus, KErrNone ); } + LOG("CGpxConverterAO::SetState ,end"); } -/** - * RunL - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::RunL() + // --------------------------------------------------------------------------- void CGpxConverterAO::RunL() { switch( iState ) @@ -164,7 +182,9 @@ TInt err; iFixLost = ETrue; delete iTempFile; + iTempFile = NULL; delete iBoundaries; + iBoundaries = NULL; // get next temp-file from queue iTempFile = iFileQueue[0]; iBoundaries = iBoundQueue[0]; @@ -310,12 +330,14 @@ } } -/** - * Read Tag Id from temp-file - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::ReadTagIdL + // Read Tag Id from temp-file + // --------------------------------------------------------------------------- void CGpxConverterAO::ReadTagIdL() { - LOG("CGpxConverterAO::ReadTagIdL"); + LOG("CGpxConverterAO::ReadTagIdL ,begin"); TUint32 low( 0 ); TUint32 high( 0 ); @@ -323,11 +345,15 @@ high = iReader.ReadUint32L(); iTagId = MAKE_TINT64( high, low ); + + LOG("CGpxConverterAO::ReadTagIdL ,end"); } -/** - * Calculate min and max coordinates for tracklog - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::CalculateBoundaries + // Calculate min and max coordinates for tracklog + // --------------------------------------------------------------------------- void CGpxConverterAO::CalculateBoundaries() { LOG("CGpxConverterAO::CalculateBoundaries start"); @@ -372,11 +398,14 @@ LOG("CGpxConverterAO::CalculateBoundaries end"); } -/** - * Writes header tags for GPX file - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::WriteStartingTags + // Writes header tags for GPX file + // --------------------------------------------------------------------------- void CGpxConverterAO::WriteStartingTags() { + LOG("CGpxConverterAO::WriteStartingTags ,begin"); TPtr8 writePtr = iWriteBuf->Des(); TPtr formatter = iFormatBuf->Des(); @@ -411,13 +440,17 @@ writePtr.Copy( KTagTrackStart ); iGpxFile.Write( writePtr ); + LOG("CGpxConverterAO::WriteStartingTags ,end"); } -/** - * Writes single trackpoint to GPX file - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::WriteItemToFile + // Writes single trackpoint to GPX file + // --------------------------------------------------------------------------- void CGpxConverterAO::WriteItemToFile() { + LOG("CGpxConverterAO::WriteItemToFile ,begin"); TTime timeStamp; TPtr8 writePtr = iWriteBuf->Des(); @@ -503,14 +536,16 @@ writePtr.Copy( KTagTrkPointEnd ); iGpxFile.Write( writePtr ); } - + LOG("CGpxConverterAO::WriteItemToFile ,end"); } -/** - * Close GPX file - */ + // --------------------------------------------------------------------------- + // CGpxConverterAO::WriteClosingTags + // Close GPX file + // --------------------------------------------------------------------------- void CGpxConverterAO::WriteClosingTags() { + LOG("CGpxConverterAO::WriteClosingTags ,begin"); TPtr8 writePtr = iWriteBuf->Des(); // end segment @@ -525,11 +560,14 @@ writePtr.Append( KTagGpxEnd ); iGpxFile.Write( writePtr ); + LOG("CGpxConverterAO::WriteClosingTags ,end"); } -/** - * Resolve where to save tracklog file - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::GetTrackLogPathL + // Resolve where to save tracklog file + // --------------------------------------------------------------------------- void CGpxConverterAO::GetTrackLogPathL( TDes& aFileName ) { LOG("CGpxConverterAO::GetTrackLogPathL start"); @@ -560,11 +598,15 @@ LOG("CGpxConverterAO::GetTrackLogPathL end"); } -/** - * Adds observer for GPX file creation notifications - */ + + // --------------------------------------------------------------------------- + // CGpxConverterAO::AddObserver + // Adds observer for GPX file creation notifications + // --------------------------------------------------------------------------- void CGpxConverterAO::AddObserver( MGpxConversionObserver* aObserver ) { iObservers.Append( aObserver ); } + +//End of File diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/clocationrecord.cpp --- a/locationmanager/locationtrail/src/clocationrecord.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/clocationrecord.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -18,6 +18,12 @@ #include #include #include +#include +#include +#include +#ifdef LOC_GEOTAGGING_CELLID +#include +#endif //LOC_GEOTAGGING_CELLID #include "rlocationtrail.h" #include "clocationrecord.h" @@ -26,30 +32,50 @@ #include "locationtraildefs.h" #include "locationtrailpskeys.h" #include "mdeconstants.h" -#include -#include +#ifdef LOC_REVERSEGEOCODE +#include "reversegeocoderplugin.h" +const TUid KReverseGeoCodeUid = {0x2002DD12}; +#endif using namespace MdeConstants; +const TUint KNetQueryBit = 1; // 1 bit +const TUint KDownloadMediaFile = 2; // 2 bit +const TUint KSnapMediaFile = 4; // 3 bit +const TUint KLocationQueryInProgress = 1; // 1 bit +#ifdef LOC_REVERSEGEOCODE +const TUint KReverseGeoCodingInProgress = 2; // 2 bit +_LIT ( KCountry, "country:"); // country:india +_LIT ( KCity, "city:"); // city:bangalore|country:india +#endif +const TUint KSnapGeoConvertInProgress = 4; // 3 bit +#ifdef LOC_GEOTAGGING_CELLID +const TUint KSnapGeoConvertInPendingState = 8; // 4 bit +#endif + + + // -------------------------------------------------------------------------- // CLocationRecord::NewL // -------------------------------------------------------------------------- // -EXPORT_C CLocationRecord* CLocationRecord::NewL() +EXPORT_C CLocationRecord* CLocationRecord::NewL(MGeoTaggerObserver& aGeoTaggerObserver, + RMobilePhone& aPhone) { - CLocationRecord* self = new (ELeave) CLocationRecord(); + CLocationRecord* self = new (ELeave) CLocationRecord(aGeoTaggerObserver, aPhone); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); return self; } - + // -------------------------------------------------------------------------- // CLocationRecord::CLocationRecord // -------------------------------------------------------------------------- // -CLocationRecord::CLocationRecord() +CLocationRecord::CLocationRecord(MGeoTaggerObserver& aGeoTaggerObserver, + RMobilePhone& aPhone) : iNetworkInfoTimer( NULL ), iState( RLocationTrail::ETrailStopped ), iTrailCaptureSetting( RLocationTrail::ECaptureAll ), @@ -57,7 +83,30 @@ iRequestCurrentLoc( EFalse ), iTrailStarted( EFalse ), iLastGPSFixState( EFalse ), - iLastLocationId( 0 ) + iLocationQuery(NULL), + iNetLocationQuery(NULL), + iRemapState( ERemapProgressNone), + iNamespaceDef(NULL), + iLocationObjectDef(NULL), + iLatitudeDef(NULL), + iLongitudeDef(NULL), + iAltitudeDef(NULL), + iMediaHandlingFlag(0), + iPhone(aPhone), + iGpsDataAvailableFlag(EFalse), + iGeoTaggerObserver(aGeoTaggerObserver) +#ifdef LOC_GEOTAGGING_CELLID + ,iGeoConverter(NULL) + , iConvertRetry(ETrue) +#endif +#ifdef LOC_REVERSEGEOCODE + ,iConnectionOption(ESilent) + ,iImageQuery(NULL) + ,iTagQuery(NULL) + ,iTagCreator( NULL ) + ,iLastReverseGeocodeFails(EFalse) + ,iRevGeocoderPlugin( NULL ) +#endif { iMaxTrailSize = KMaxTrailLength / KUpdateInterval; } @@ -68,6 +117,7 @@ // void CLocationRecord::ConstructL() { + LOG( "CLocationRecord::ConstructL(), begin" ); const TInt KMillion = 1000000; TInt err = iProperty.Define( KPSUidLocationTrail, KLocationTrailState, RProperty::EInt ); if ( err != KErrNone && err != KErrAlreadyExists ) @@ -77,18 +127,34 @@ User::LeaveIfError( iProperty.Set( KPSUidLocationTrail, KLocationTrailState, (TInt) RLocationTrail::ETrailStopped ) ); - iNetworkInfo = CNetworkInfo::NewL( this ); + + iNetworkInfoChangeListener = CNetworkInfo::NewL( this ); iPositionInfo = CPositionInfo::NewL( this ); iRemapper = CLocationRemappingAO::NewL(); iNetworkInfoTimer = CPeriodic::NewL( CActive::EPriorityStandard ); - + +#ifdef LOC_REVERSEGEOCODE + iTagCreator = CTagCreator::NewL(); + + iRevGeocoderPlugin = reinterpret_cast( + REComSession::CreateImplementationL(KReverseGeoCodeUid,iDtorKey)); + if( iRevGeocoderPlugin ) + { + iRevGeocoderPlugin->AddObserverL(*this); + } + + + + #endif + + TInt interval( 0 ); TRAP(err, ReadCenRepValueL(KIntervalKey, interval)); - LOG1("CLocationManagerServer::ConstructL, cenrep interval value:%d", interval); + LOG1("Cenrep interval value:%d", interval); if (interval == 0 || err != KErrNone ) { - LOG1("CLocationManagerServer::ConstructL, cenrep interval err:%d", err); + LOG1("Cenrep interval err:%d", err); iInterval = KUpdateInterval; } else @@ -97,14 +163,25 @@ } TRAP(err, ReadCenRepValueL(KLocationDeltaKey, iLocationDelta)); - LOG1("CLocationManagerServer::ConstructL, location delta value:%d", iLocationDelta); + LOG1("Location delta value:%d", iLocationDelta); if (iLocationDelta == 0) { - LOG1("CLocationManagerServer::ConstructL, location delta err:%d", err); + LOG1("Location delta err:%d", err); iLocationDelta = KLocationDelta; } + iLastMediaItem.iFlag = 0; + iLastMediaItem.iLocationId = 0; +#ifdef LOC_REVERSEGEOCODE + iLastMediaItem.iCityTagId= 0; + iLastMediaItem.iCountryTagId = 0; + iLastLocationItem.iFlag = 0; + iLastLocationItem.iCityTagId= 0; + iLastLocationItem.iCountryTagId = 0; + iLastLocationItem.iLocationId = 0; +#endif + LOG( "CLocationRecord::ConstructL(), end" ); } // -------------------------------------------------------------------------- @@ -113,19 +190,76 @@ // EXPORT_C CLocationRecord::~CLocationRecord() { + LOG( "CLocationRecord::~CLocationRecord(), begin" ); Stop(); iProperty.Delete( KPSUidLocationTrail, KLocationTrailState ); iProperty.Close(); + iTrail.ResetAndDestroy(); iTrail.Close(); - - delete iNetworkInfo; + iMediaItems.ResetAndDestroy(); + iMediaItems.Close(); +#ifdef LOC_REVERSEGEOCODE + iLocationItems.ResetAndDestroy(); + iLocationItems.Close(); +#endif + delete iNetworkInfoChangeListener; + iNetworkInfoChangeListener = NULL; delete iPositionInfo; + iPositionInfo = NULL; delete iNetworkInfoTimer; - if (iRemapper) + iNetworkInfoTimer = NULL; +#ifdef LOC_GEOTAGGING_CELLID + if(iGeoConverter) + { + delete iGeoConverter; + iGeoConverter = NULL; + } +#endif + if (iRemapper) { iRemapper->StopRemapping(); delete iRemapper; + iRemapper = NULL; } + if(iLocationQuery) + { + iLocationQuery->RemoveObserver(*this); + iLocationQuery->Cancel(); + delete iLocationQuery; + iLocationQuery = NULL; + } + +if(iNetLocationQuery) + { + iNetLocationQuery->RemoveObserver(*this); + iNetLocationQuery->Cancel(); + delete iNetLocationQuery; + iNetLocationQuery = NULL; + } + + +#ifdef LOC_REVERSEGEOCODE + if(iImageQuery) + { + iImageQuery->RemoveObserver(*this); + iImageQuery->Cancel(); + delete iImageQuery; + iImageQuery = NULL; + } + if(iTagQuery) + { + iTagQuery->RemoveObserver(*this); + iTagQuery->Cancel(); + delete iTagQuery; + iTagQuery = NULL; + } + delete iTagCreator; + // set the pointer to NULL, ECOM will destroy object. + delete iRevGeocoderPlugin; + iRevGeocoderPlugin = NULL; + REComSession::DestroyedImplementation(iDtorKey); +#endif + LOG( "CLocationRecord::~CLocationRecord(), end" ); } // -------------------------------------------------------------------------- @@ -145,12 +279,17 @@ { LOG( "CLocationRecord::StartL(), begin" ); iTrailCaptureSetting = aCaptureSetting; + iGpsDataAvailableFlag = EFalse; if ( aCaptureSetting == RLocationTrail::ECaptureAll && !iPositionInfo->IsActive() ) { if( iState == RLocationTrail::ETrailStopped ) { - iTrail.Reset(); + iTrail.ResetAndDestroy(); } + // Capture at least one location with n/w info else we wouldn't be able to tag the immediate taken photograph + // incase LBS didn't provide any valid position data. Without this there may be a leave from GetLocationByTimeL + // method while calling this from LocationSnapshotL method + UpdateNetworkInfo( this ); iPositionInfo->StartL( aCaptureSetting, iInterval ); } else if ( aCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) @@ -167,11 +306,9 @@ StartTimerL(); } - iLastLocationId = 0; - + iTrailStarted = ETrue; SetCurrentState( RLocationTrail::ETrailStarting ); - iTrailStarted = ETrue; LOG( "CLocationRecord::StartL(), end" ); } @@ -183,8 +320,8 @@ { LOG( "CLocationRecord::StopL(), begin" ); iPositionInfo->Stop(); + iGpsDataAvailableFlag = EFalse; iTrailStarted = EFalse; - if ( iNetworkInfoTimer && iNetworkInfoTimer->IsActive() ) { iNetworkInfoTimer->Cancel(); @@ -231,14 +368,14 @@ TTimeIntervalSeconds nextInterval; for ( TInt i(iTrail.Count()-1) ; i >= 0 && !posFound ; i-- ) { - TInt err = iTrail[i].iTimeStamp.SecondsFrom( aTime, interval ); + TInt err = iTrail[i]->iTimeStamp.SecondsFrom( aTime, interval ); TInt timeDiff = Abs( interval.Int() ); #ifdef _DEBUG - LOG1( "CLocationRecord::GetLocationByTimeL - Trail timestamp: %Ld", iTrail[i].iTimeStamp.Int64() ); + LOG1( "CLocationRecord::GetLocationByTimeL - Trail timestamp: %Ld", iTrail[i]->iTimeStamp.Int64() ); TBuf str; - iTrail[i].iTimeStamp.FormatL( str, KDateTimeFormat ); + iTrail[i]->iTimeStamp.FormatL( str, KDateTimeFormat ); LOG1( "CLocationRecord::GetLocationByTimeL - Trail timestamp: %S", &str ); LOG1( "CLocationRecord::GetLocationByTimeL - timeDiff: %d", timeDiff ); #endif @@ -248,25 +385,25 @@ // The nearest time is in iTrail[i] or in iTrail[i-1]. if ( i > 0 ) { - iTrail[i-1].iTimeStamp.SecondsFrom( aTime, nextInterval ); + iTrail[i-1]->iTimeStamp.SecondsFrom( aTime, nextInterval ); TInt nextDiff = Abs( nextInterval.Int() ); if ( nextDiff < timeDiff ) { - aLocationData = iTrail[i-1].iLocationData; - aState = iTrail[i-1].iTrailState; + aLocationData = iTrail[i-1]->iLocationData; + aState = iTrail[i-1]->iTrailState; } else { - aLocationData = iTrail[i].iLocationData; - aState = iTrail[i].iTrailState; + aLocationData = iTrail[i]->iLocationData; + aState = iTrail[i]->iTrailState; } } else { - aLocationData = iTrail[i].iLocationData; - aState = iTrail[i].iTrailState; + aLocationData = iTrail[i]->iLocationData; + aState = iTrail[i]->iTrailState; } posFound = ETrue; } @@ -284,11 +421,15 @@ // EXPORT_C void CLocationRecord::RequestLocationL() { + LOG( "CLocationRecord::RequestLocationL(), begin" ); iRequestCurrentLoc = ETrue; if ( iTrailCaptureSetting != RLocationTrail::ECaptureNetworkInfo && !iPositionInfo->IsActive() ) { iPositionInfo->StartL( iTrailCaptureSetting, iInterval ); + SetCurrentState( RLocationTrail::ETrailStarting ); + + iTrailStarted = ETrue; } else if ( iTrailCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) { @@ -298,6 +439,7 @@ iObserver->CurrentLocation( posInfo, network, KErrNone ); iRequestCurrentLoc = EFalse; } + LOG( "CLocationRecord::RequestLocationL(), end" ); } // -------------------------------------------------------------------------- @@ -306,11 +448,14 @@ // EXPORT_C void CLocationRecord::CancelLocationRequest() { + LOG( "CLocationRecord::CancelLocationRequest(), begin" ); iRequestCurrentLoc = EFalse; if ( !iTrailStarted ) { + iGpsDataAvailableFlag = EFalse; iPositionInfo->Stop(); } + LOG( "CLocationRecord::CancelLocationRequest(), end" ); } @@ -351,6 +496,7 @@ void CLocationRecord::Position( const TPositionInfo& aPositionInfo, const TInt aError ) { + LOG( "CLocationRecord::Position(), begin" ); const TPositionSatelliteInfo& positionSatelliteInfo = static_cast(aPositionInfo); @@ -358,56 +504,59 @@ { HandleLocationRequest( positionSatelliteInfo, aError ); } - if( iState == RLocationTrail::ETrailStopped ) - { - LOG("CLocationRecord::Position - trail stopped"); - return; - } + + iGpsDataAvailableFlag = EFalse; - if ( !iTrailStarted ) + if ( !iTrailStarted || iState == RLocationTrail::ETrailStopped) { - iPositionInfo->NextPosition(); + LOG("trail not started/stopped"); + iPositionInfo->Stop(); return; } + // all cases store the location.. + StoreLocation( positionSatelliteInfo ); + + if ( RemappingNeeded() ) + { + //either network or gps signal is available + if ( ( iNetwork.iCellId != 0 && + iNetwork.iCountryCode.Length() != 0 && + iNetwork.iNetworkId.Length() != 0 ) || ( aError == KErrNone ) ) + { + //no error means gps info available + TRAP_IGNORE( RemapObjectsL( aError == KErrNone ) ); + } + } switch ( aError ) { case KPositionPartialUpdate: // fall through case KPositionQualityLoss: { // Location is stored, even if it may not be valid. - StoreLocation( positionSatelliteInfo ); - 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: { - StoreLocation( positionSatelliteInfo ); - LOG("CLocationRecord::Position - good GPS coordinates"); + LOG("Good GPS coordinates"); + iGpsDataAvailableFlag = ETrue; if ( iState != RLocationTrail::ETrailStarted ) { if ( iRemapper ) { - LOG("CLocationRecord::Position start remapping"); - iLastLocationId = 0; - TBool createLocation = iRemapper->CheckQueue(); - if( createLocation ) - { - TRAP_IGNORE( - TItemId locationId = DoCreateLocationL( iNewItem.iLocationData ); - iRemapper->UpdateRelationsL( locationId ); - ) - } + LOG("Start remapping"); iRemapper->StartRemappingObjects( iNewItem.iLocationData ); if( iObserver->WaitForPositioningStopTimeout() && !RemappingNeeded() ) { iObserver->RemapedCompleted(); + iPositionInfo->HandleRemapComplete(); return; } @@ -415,47 +564,135 @@ if ( iState != RLocationTrail::ETrailStopping ) { SetCurrentState( RLocationTrail::ETrailStarted ); - LOG("CLocationRecord::Position trail started"); + LOG("Trail started"); } } break; } default: { - StoreLocation( positionSatelliteInfo ); - LOG1("CLocationRecord::Position - searching GPS, aError %d", aError ); + LOG1("Searching GPS, aError %d", aError ); if ( iState != RLocationTrail::ESearchingGPS && iState != RLocationTrail::ETrailStopping ) { SetCurrentState( RLocationTrail::ESearchingGPS ); - LOG("CLocationRecord::Position trail searching gps"); + LOG("Trail searching gps"); } break; } } 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 ); } iLastGPSFixState = fixState; - iPositionInfo->NextPosition(); + LOG( "CLocationRecord::Position(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::RemapObjectsL +// Remaps the location objects when GPS is available +// -------------------------------------------------------------------------- +// +void CLocationRecord::RemapObjectsL( TBool aGPSInfoAvailable ) + { + LOG( "CLocationRecord::RemapObjectsL(), begin" ); + TBool createLocation = EFalse; + + if (iRemapper) + { + createLocation = iRemapper->CheckQueue(); + } + + if ( !createLocation || iRemapper == NULL) + { + return; + } + + + if ( aGPSInfoAvailable ) + { + TItemId locationId = DoCreateLocationL( iNewItem.iLocationData ); + iRemapper->UpdateRelationsL( locationId ); +#ifdef LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + iRemapState = ERemapRevGeoCodeInProgress; + //Find the address by coordinate, results a call to ReverseGeocodeComplete() + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL( iNewItem.iLocationData.iPosition, iConnectionOption ); + } + } + else + { + // make this as pending state so that on rev geo code complete + // it will take the priority over the next item within the location + // item in location queue. + iRemapState = ERemapRevGeoCodePending; + } +#endif //LOC_REVERSEGEOCODE + } + else + { + //call location m/w API to convert cell ID to lat, long +#ifdef LOC_GEOTAGGING_CELLID + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0) + { + iRemapState = ERemapNwGeoConverterPending; + } + else + { + // go for cell id based geo coding. + iRemapState = ERemapNwGeoConverterInProgress; + if(iGeoConverter == NULL) + { + iGeoConverter = CGeoConverter::NewL(*this); + } + iGeoConverter->ConvertL(iNewItem.iLocationData.iNetworkInfo); + iMediaHandlingFlag |= KSnapGeoConvertInProgress; + } +#endif + } +#ifdef LOC_REVERSEGEOCODE + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 || + (iMediaHandlingFlag & KReverseGeoCodingInProgress) > 0) +#else + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 ) +#endif //LOC_REVERSEGEOCODE + { + // stop n/w info change listener, since device may connect to n/w + // and local trail will receive so many call backs on current n/w info change. + iNetworkInfoChangeListener->StopNwInfoChangeNotifier(); + } + else + { + iNetworkInfoChangeListener->StartNwInfoChangeNotifier(); + } + LOG( "CLocationRecord::RemapObjectsL(), end" ); + } TBool CLocationRecord::CheckGPSFix( const TPositionSatelliteInfo& aSatelliteInfo ) { + LOG("CLocationRecord::CheckGPSFix, begin"); TPosition position; aSatelliteInfo.GetPosition( position ); - LOG1( "CLocationRecord::CheckGPSFix latitude %f", position.Latitude() ); - LOG1( "CLocationRecord::CheckGPSFix longitude %f", position.Longitude() ); + LOG1( "latitude %f", position.Latitude() ); + LOG1( "longitude %f", position.Longitude() ); TBool ret = ( Math::IsNaN(position.Latitude()) || Math::IsNaN(position.Longitude()) ) ? EFalse : ETrue; + LOG1("CLocationRecord::CheckGPSFix, end. Ret - %d", ret); return ret; } @@ -467,7 +704,7 @@ void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) { - LOG("CLocationRecord::NetworkInfo"); + LOG("CLocationRecord::NetworkInfo, begin"); if ( aError == KErrNone ) { LOG("CLocationRecord::NetworkInfo - KErrNone"); @@ -476,10 +713,12 @@ { iNetwork.iLocationAreaCode = 0; } +#ifdef LOC_GEOTAGGING_CELLID if ( iState == RLocationTrail::ETrailStarting && iTrailStarted ) { SetCurrentState( RLocationTrail::ETrailStarted ); } +#endif } else { @@ -492,6 +731,17 @@ iNetwork.iCountryCode.Zero(); iNetwork.iNetworkId.Zero(); } + LOG( "CLocationRecord::NetworkInfo(), end" ); + } + +// -------------------------------------------------------------------------- +// CLocationRecord::GetMobilePhone4NwInfo +// -------------------------------------------------------------------------- +// +RMobilePhone& CLocationRecord::GetMobilePhone4NwInfo() + { + LOG( "CLocationRecord::GetMobilePhone4NwInfo()" ); + return iPhone; } // -------------------------------------------------------------------------- @@ -500,6 +750,7 @@ // void CLocationRecord::StoreLocation( const TPositionSatelliteInfo& aSatelliteInfo ) { + LOG( "CLocationRecord::StoreLocation(), begin" ); aSatelliteInfo.GetPosition( iNewItem.iLocationData.iPosition ); aSatelliteInfo.GetCourse( iNewItem.iLocationData.iCourse ); iNewItem.iLocationData.iSatellites = aSatelliteInfo.NumSatellitesUsed(); @@ -511,7 +762,13 @@ iNewItem.iTimeStamp.UniversalTime(); iNewItem.iTrailState = iState; - TInt error = iTrail.Append( iNewItem ); + TLocationTrailItem *item = new TLocationTrailItem(); + TInt error = KErrNone; + if(item != NULL) + { + *item = iNewItem; + error = iTrail.Append( item ); + } // If appending an item to the trail fails because of OOM, remove oldest trail items // until the new item fits or there's only one item left in the trail. @@ -519,18 +776,22 @@ { LOG("CLocationRecord::StoreLocation - Out of memory! Shortening trail!"); iTrail.Remove( 0 ); - error = iTrail.Append( iNewItem ); + error = iTrail.Append( item ); } if ( iTrail.Count() > iMaxTrailSize ) { + item = iTrail[0]; iTrail.Remove( 0 ); + iTrail.Compress(); + delete item; } if( iAddObserver ) { iAddObserver->LocationAdded( iNewItem, aSatelliteInfo ); } + LOG( "CLocationRecord::StoreLocation(), end" ); } // -------------------------------------------------------------------------- @@ -541,7 +802,36 @@ { LOG1( "CLocationRecord::SetCurrentState(), begin, state:%d", aState ); iState = aState; - iProperty.Set( KPSUidLocationTrail, KLocationTrailState, (TInt) aState ); + if( iTrailStarted ) + { + // Set the property only when trail is started to avoid icon flickering and wrong icon update in UI + if( iGpsDataAvailableFlag +#ifdef LOC_GEOTAGGING_CELLID + || ( iNetwork.iCellId > 0 && + ((iNetwork.iLocationAreaCode == 0 && iNetwork.iAccess == CTelephony::ENetworkAccessUtran) || // 3G + (iNetwork.iLocationAreaCode > 0 && (iNetwork.iAccess == CTelephony::ENetworkAccessGsm || // 2G + iNetwork.iAccess == CTelephony::ENetworkAccessGsmCompact))) && + iNetwork.iCountryCode.Length() > 0 && + iNetwork.iNetworkId.Length() > 0 ) +#endif // LOC_GEOTAGGING_CELLID + ) + { + // set the value 3 to have Geo tag available icon else not available. + iProperty.Set( KPSUidLocationTrail, KLocationTrailState, + (TInt) RLocationTrail::ETrailStarted ); + } + else + { + iProperty.Set( KPSUidLocationTrail, KLocationTrailState, + (TInt) RLocationTrail::ETrailStopped ); + } + } + else + { + iProperty.Set( KPSUidLocationTrail, KLocationTrailState, + (TInt) RLocationTrail::ETrailStopped ); + } + if ( iObserver ) { iObserver->LocationTrailStateChange(); @@ -556,6 +846,7 @@ void CLocationRecord::HandleLocationRequest( const TPositionSatelliteInfo& aSatelliteInfo, const TInt aError ) { + LOG( "CLocationRecord::HandleLocationRequest(), begin" ); CTelephony::TNetworkInfoV1 network = CTelephony::TNetworkInfoV1(); if ( aError == KErrNone ) { @@ -564,6 +855,7 @@ iRequestCurrentLoc = EFalse; if ( !iTrailStarted ) { + iGpsDataAvailableFlag = EFalse; iPositionInfo->Stop(); } } @@ -577,12 +869,19 @@ iLocationCounter = 0; if ( !iTrailStarted ) { + iGpsDataAvailableFlag = EFalse; iPositionInfo->Stop(); } } - } + } + LOG( "CLocationRecord::HandleLocationRequest(), end" ); } + +// -------------------------------------------------------------------------- +// CLocationRecord::UpdateNetworkInfo +// -------------------------------------------------------------------------- +// TInt CLocationRecord::UpdateNetworkInfo( TAny* aAny ) { TPositionSatelliteInfo nullPositionInfo; @@ -595,124 +894,167 @@ EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData, const TUint& aObjectId ) { - TItemId locationId = DoCreateLocationL( aLocationData ); - CreateRelationL( aObjectId, locationId ); + LOG( "CLocationRecord::CreateLocationObjectL(), begin" ); + TLocationSnapshotItem* newItem = new (ELeave) TLocationSnapshotItem; + newItem->iObjectId = aObjectId; + newItem->iLocationData = aLocationData; + + // for downloaded files, network informations are not valid. + // Do location handling only based on lat/lon + // all all n/w information to invalid value. + newItem->iLocationData.iNetworkInfo.iCellId = 0; + newItem->iLocationData.iNetworkInfo.iAccess = CTelephony::ENetworkAccessUnknown; + newItem->iLocationData.iNetworkInfo.iLocationAreaCode = 0; + newItem->iLocationData.iNetworkInfo.iCountryCode.Zero(); + newItem->iLocationData.iNetworkInfo.iNetworkId.Zero(); + newItem->iFlag = KDownloadMediaFile; + + iMediaItems.Append( newItem ); + FindLocationFromDBL(); + GeoTaggingCompleted(); + LOG( "CLocationRecord::CreateLocationObjectL(), end" ); + } - +// -------------------------------------------------------------------------- +// CLocationRecord::LocationSnapshotL +// -------------------------------------------------------------------------- +// EXPORT_C void CLocationRecord::LocationSnapshotL( const TUint& aObjectId ) { - LOG("CLocationRecord::LocationSnapshotL"); - + LOG( "CLocationRecord::LocationSnapshotL(), begin" ); TBool previousMatch = EFalse; - CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); // get locationdata from trail with object time TTime timestamp = GetMdeObjectTimeL( aObjectId ); TLocationData locationData; TLocTrailState state; - GetLocationByTimeL( timestamp, locationData, state ); - - iObjectId = aObjectId; - iLocationData = locationData; + TRAPD(err, GetLocationByTimeL( timestamp, locationData, state )); + if(err != KErrNone && iTrailStarted) + { + // Execution shouldn't come over here. + // Handling error case in worst sceenario.. + StartL(iTrailCaptureSetting); + // this case may apprear, when cache data is not within the delta limit because someone call stop trail. + // sceenario, take photograph, then stop taking for sometime, again take photograph. + // during this time, if there is no change in position (because someone stop trail) and n/w, then cache has old value. + // go with the n/w based. + LOG( "Old trail cache. go for n/w based." ); + UpdateNetworkInfo( this ); + // again read the location. + GetLocationByTimeL( timestamp, locationData, state ); + } + TLocationSnapshotItem* newItem = new (ELeave) TLocationSnapshotItem; + newItem->iObjectId = aObjectId; + newItem->iLocationData = locationData; + newItem->iFlag = KSnapMediaFile; + + iMediaItems.Append( newItem ); + TItemId lastLocationId = 0; + if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0) + { + lastLocationId = iLastMediaItem.iLocationId; + } + + CTelephony::TNetworkInfoV1* net = &locationData.iNetworkInfo; // capture only network data if ( iTrailCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) { - CTelephony::TNetworkInfoV1* net = &locationData.iNetworkInfo; + if ( net->iCellId == 0 && + net->iLocationAreaCode == 0 && + net->iCountryCode.Length() == 0 && + net->iNetworkId.Length() == 0 ) + { + // no n/w info... put it into remap. + // remove the last appended element. + LOG("No network info (offline mode + no GPS fix), keep for remapping"); + TRemapItem remapItem; + remapItem.iObjectId = aObjectId; + remapItem.iTime = timestamp; + iRemapper->Append( remapItem ); + TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + delete firstPtr; + } + else + { + // n/w info available + NetworkInfoSnapshotL(); + } + } + else if ( Math::IsNaN( locationData.iPosition.Latitude() ) && + Math::IsNaN( locationData.iPosition.Longitude() )) + { + // coordinates empty, with or without cellular info + if ( net->iCellId == 0 && net->iLocationAreaCode == 0 && net->iCountryCode.Length() == 0 && net->iNetworkId.Length() == 0 ) { - // nothing to do - LOG("CLocationRecord::LocationSnapshotL - no network info available"); - } - else if ( iLastLocationId != 0 ) - { - CTelephony::TNetworkInfoV1* lastnet = &iLastLocation.iNetworkInfo; - - // compare to previous network info - TItemId locationId = iLastLocationId; - if ( lastnet->iCellId != net->iCellId || - lastnet->iLocationAreaCode != net->iLocationAreaCode || - lastnet->iCountryCode != net->iCountryCode || - lastnet->iNetworkId != net->iNetworkId ) - { - LOG("CLocationRecord::LocationSnapshotL - network info changed"); - locationId = DoCreateLocationL( locationData ); - } - CreateRelationL( aObjectId, locationId ); - } - else - { - // new location - TItemId locationId = DoCreateLocationL( locationData ); - CreateRelationL( aObjectId, locationId ); - } - return; - } - - // coordinates empty (will be remapped) - if ( Math::IsNaN( locationData.iPosition.Latitude() ) && - Math::IsNaN( locationData.iPosition.Longitude() )) - { - TRemapItem remapItem; - remapItem.iObjectId = aObjectId; - remapItem.iTime = timestamp; + LOG("No network info (offline mode + no GPS fix), keep for remapping"); + TRemapItem remapItem; + remapItem.iObjectId = aObjectId; + remapItem.iTime = timestamp; + iRemapper->Append( remapItem ); - CTelephony::TNetworkInfoV1* net = &locationData.iNetworkInfo; - - // no network info (offline mode + no GPS fix) - if ( net->iCellId == 0 && - net->iLocationAreaCode == 0 && - net->iCountryCode.Length() == 0 && - net->iNetworkId.Length() == 0 ) - { - LOG("CLocationRecord::LocationSnapshotL - empty remap item created"); + TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + delete firstPtr; } // check match for last created locationobject - else if ( iLastLocationId != 0 ) +#ifdef LOC_REVERSEGEOCODE + else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 && + iLastMediaItem.iCountryTagId > 0) +#else + else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0) +#endif //LOC_REVERSEGEOCODE { - TItemId locationId; - CTelephony::TNetworkInfoV1* lastnet = &iLastLocation.iNetworkInfo; + TLocationData lastLocationData = iLastMediaItem.iLocationData; + CTelephony::TNetworkInfoV1* lastnet = &lastLocationData.iNetworkInfo; // networkinfo changed from last location - if ( lastnet->iCellId != net->iCellId || - lastnet->iLocationAreaCode != net->iLocationAreaCode || - lastnet->iCountryCode != net->iCountryCode || - lastnet->iNetworkId != net->iNetworkId ) + if ( lastnet->iCellId == net->iCellId && + lastnet->iLocationAreaCode == net->iLocationAreaCode && + lastnet->iCountryCode == net->iCountryCode && + lastnet->iNetworkId == net->iNetworkId ) { - LOG("CLocationRecord::LocationSnapshotL - remap with new network info"); - locationId = DoCreateLocationL( locationData ); - } - else - { - LOG("CLocationRecord::LocationSnapshotL - remap with previous network info"); - locationId = iLastLocationId; + // same network. + previousMatch = ETrue; + CreateRelationL( aObjectId, lastLocationId ); + // attach same tags associated to last location +#ifdef LOC_REVERSEGEOCODE + if ( iLastMediaItem.iCountryTagId ) //found from DB last time + { + iTagCreator->AttachTagsL( aObjectId, + iLastMediaItem.iCountryTagId, iLastMediaItem.iCityTagId ); + } +#endif //LOC_REVERSEGEOCODE + // remove the current item. + TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + delete firstPtr; } - TItemId relationId = CreateRelationL( aObjectId, locationId ); - remapItem.iLocationId = locationId; - remapItem.iRelationId = relationId; } - else - { - // new location with only network data - TItemId locationId = DoCreateLocationL( locationData ); - TItemId relationId = CreateRelationL( aObjectId, locationId ); - remapItem.iLocationId = locationId; - remapItem.iRelationId = relationId; - } - iRemapper->Append( remapItem ); - return; + + if ( !previousMatch ) + { + // go for n/w based + newItem->iFlag |= KNetQueryBit; + } } - + // valid coordinates found - if ( iLastLocationId != 0 ) + else if ( lastLocationId != 0 && + ((iLastMediaItem.iFlag & KSnapMediaFile) > 0)) { - CTelephony::TNetworkInfoV1* net = &locationData.iNetworkInfo; - CTelephony::TNetworkInfoV1* lastnet = &iLastLocation.iNetworkInfo; + TLocationData lastLocationData = iLastMediaItem.iLocationData; + CTelephony::TNetworkInfoV1* lastnet = &lastLocationData.iNetworkInfo; // first check if networkinfo matches last created location if ( lastnet->iCellId == net->iCellId && @@ -720,23 +1062,64 @@ lastnet->iCountryCode == net->iCountryCode && lastnet->iNetworkId == net->iNetworkId ) { - LOG("CLocationRecord::LocationSnapshotL - network info matches"); // if both locations have valid coordinates, calculate distance between points - if ( !Math::IsNaN( iLastLocation.iPosition.Latitude() ) && - !Math::IsNaN( iLastLocation.iPosition.Longitude() ) && + if ( +#ifdef LOC_REVERSEGEOCODE + !iLastReverseGeocodeFails && +#endif //LOC_REVERSEGEOCODE + !Math::IsNaN( lastLocationData.iPosition.Latitude() ) && + !Math::IsNaN( lastLocationData.iPosition.Longitude() ) && !Math::IsNaN( locationData.iPosition.Latitude() ) && !Math::IsNaN( locationData.iPosition.Longitude() )) { TReal32 distance; - TInt err = locationData.iPosition.Distance(iLastLocation.iPosition, distance); + TInt err = locationData.iPosition.Distance(lastLocationData.iPosition, distance); if ( distance < iLocationDelta ) { - LOG("CLocationRecord::LocationSnapshotL - location close to the previous one"); + LOG("location close to the previous one"); previousMatch = ETrue; - CreateRelationL( aObjectId, iLastLocationId ); - LOG("CLocationRecord::CreateLocationObjectL - last location matched"); + CreateRelationL( aObjectId, lastLocationId ); + +#ifdef LOC_REVERSEGEOCODE + // attach same tags associated to last location + if ( iLastMediaItem.iCountryTagId ) + { + iTagCreator->AttachTagsL( + aObjectId, iLastMediaItem.iCountryTagId, iLastMediaItem.iCityTagId ); + TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + delete firstPtr; + } + else + { + // country tag not found.. go for reverse geocoding.. + newItem->iLocationId = lastLocationId; + iLocationItems.Append( newItem ); + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationItems[0]->iLocationData.iPosition, + iConnectionOption); + } + } + } +#else + // remove from the queue + TLocationSnapshotItem* firstPtr = iMediaItems[iMediaItems.Count() - 1]; + iMediaItems.Remove(iMediaItems.Count() - 1); + iMediaItems.Compress(); + delete firstPtr; + +#endif //LOC_REVERSEGEOCODE } } } @@ -745,109 +1128,192 @@ // last location did not match, find existing one from DB if( !previousMatch ) { - LOG("CLocationRecord::LocationSnapshotL - query location"); - const TReal64 KMeterInDegrees = 0.000009; - const TReal64 KPi = 3.14159265358979; - const TReal32 K180Degrees = 180.0; - - TReal64 latitude = locationData.iPosition.Latitude(); - TReal64 longitude = locationData.iPosition.Longitude(); - // calculate distance in degrees - TReal64 cosine; - Math::Cos(cosine, locationData.iPosition.Latitude() * KPi / K180Degrees ); - TReal64 latDelta = iLocationDelta * KMeterInDegrees; - TReal64 lonDelta = latDelta * cosine; - - CMdEObjectDef& locationObjectDef = namespaceDef.GetObjectDefL( Location::KLocationObject ); - - CMdEPropertyDef& latitudeDef = locationObjectDef.GetPropertyDefL( - Location::KLatitudeProperty ); - CMdEPropertyDef& longitudeDef = locationObjectDef.GetPropertyDefL( - Location::KLongitudeProperty ); - CMdEPropertyDef& cellIdDef = locationObjectDef.GetPropertyDefL( - Location::KCellIdProperty ); - CMdEPropertyDef& locationCodeDef = locationObjectDef.GetPropertyDefL( - Location::KLocationAreaCodeProperty ); - CMdEPropertyDef& countryCodeDef = locationObjectDef.GetPropertyDefL( - Location::KCountryCodeProperty ); - CMdEPropertyDef& networkCodeDef = locationObjectDef.GetPropertyDefL( - Location::KNetworkCodeProperty ); - - iLocationQuery = iMdeSession->NewObjectQueryL( namespaceDef, locationObjectDef, this ); - CMdELogicCondition& cond = iLocationQuery->Conditions(); - cond.SetOperator( ELogicConditionOperatorAnd ); - - LOG1( "CLocationRecord::LocationSnapshotL latitude: %f", latitude); - LOG1( "CLocationRecord::LocationSnapshotL latdelta: %f", latDelta); - LOG1( "CLocationRecord::LocationSnapshotL longitude: %f", longitude); - LOG1( "CLocationRecord::LocationSnapshotL londelta: %f", lonDelta); - - cond.AddPropertyConditionL( latitudeDef, - TMdERealBetween( latitude - latDelta, latitude + latDelta )); - cond.AddPropertyConditionL( longitudeDef, - TMdERealBetween( longitude - lonDelta, longitude + lonDelta )); - cond.AddPropertyConditionL( cellIdDef, - TMdEUintEqual( locationData.iNetworkInfo.iCellId) ); - cond.AddPropertyConditionL( locationCodeDef, - TMdEUintEqual( locationData.iNetworkInfo.iLocationAreaCode) ); - cond.AddPropertyConditionL( countryCodeDef, ETextPropertyConditionCompareEquals, - locationData.iNetworkInfo.iCountryCode ); - cond.AddPropertyConditionL( networkCodeDef, ETextPropertyConditionCompareEquals, - locationData.iNetworkInfo.iNetworkId ); - - iLocationQuery->FindL(); + FindLocationFromDBL(); } + LOG( "CLocationRecord::LocationSnapshotL(), end" ); } - -TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) + +// -------------------------------------------------------------------------- +// CLocationRecord::NetworkInfoSnapshotL +// -------------------------------------------------------------------------- +// +void CLocationRecord::NetworkInfoSnapshotL() + { + LOG( "CLocationRecord::NetworkInfoSnapshotL(), begin" ); + // n/w info available.. always act on last element within the queue + TInt lastItemIndex = iMediaItems.Count() - 1; + if ( lastItemIndex >= 0 && + (iMediaItems[lastItemIndex]->iFlag & KSnapMediaFile) > 0 ) + { + CTelephony::TNetworkInfoV1* net = &iMediaItems[lastItemIndex]->iLocationData.iNetworkInfo; + //only for snap item. + if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 ) + { + CTelephony::TNetworkInfoV1* lastnet = &iLastMediaItem.iLocationData.iNetworkInfo; + + // compare to previous network info + TItemId locationId = iLastMediaItem.iLocationId; + if ( lastnet->iCellId != net->iCellId || + lastnet->iLocationAreaCode != net->iLocationAreaCode || + lastnet->iCountryCode != net->iCountryCode || + lastnet->iNetworkId != net->iNetworkId ) + { + // last one is not matching. + // let's check the database of any existing etry. + iMediaItems[lastItemIndex]->iFlag |= KNetQueryBit; + } + else + { + // matching with the last entry. Just create a relation. + CreateRelationL( iMediaItems[lastItemIndex]->iObjectId, locationId ); + TLocationSnapshotItem* firstPtr = iMediaItems[lastItemIndex]; + iMediaItems.Remove(lastItemIndex); + delete firstPtr; + } + } + else + { + // let's check the database of any existing etry. + iMediaItems[lastItemIndex]->iFlag |= KNetQueryBit; + } + } + LOG( "CLocationRecord::NetworkInfoSnapshotL(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::FindLocationFromDBL +// -------------------------------------------------------------------------- +// +void CLocationRecord::FindLocationFromDBL() + { + LOG( "CLocationRecord::FindLocationFromDBL(), begin" ); + if(((iMediaHandlingFlag & KLocationQueryInProgress)> 0) + || (iMediaItems.Count() <= 0)) + { + // query is in progress or queue is empty + LOG1( "query is in progress or queue is empty. Count - %d", iMediaItems.Count() ); + return; + } + if ( (iMediaItems[0]->iFlag & KNetQueryBit) > 0 ) + { + // n/w based. + FindLocationWithSameNetInfoL(); + return; + } + + const TReal64 KMeterInDegrees = 0.000009; + const TReal64 KPi = 3.14159265358979; + const TReal32 K180Degrees = 180.0; + + TReal64 latitude = iMediaItems[0]->iLocationData.iPosition.Latitude(); + TReal64 longitude = iMediaItems[0]->iLocationData.iPosition.Longitude(); + // calculate distance in degrees + TReal64 cosine; + Math::Cos(cosine, latitude * KPi / K180Degrees ); + TReal64 latDelta = iLocationDelta * KMeterInDegrees; + TReal64 lonDelta = latDelta * cosine; + + //get network related defs + CMdEPropertyDef& cellIdDef = iLocationObjectDef->GetPropertyDefL( + Location::KCellIdProperty ); + CMdEPropertyDef& locationCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KLocationAreaCodeProperty ); + CMdEPropertyDef& countryCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KCountryCodeProperty ); + CMdEPropertyDef& networkCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KNetworkCodeProperty ); + if(iLocationQuery) + { + iLocationQuery->RemoveObserver(*this); + iLocationQuery->Cancel(); + delete iLocationQuery; + iLocationQuery = NULL; + } + iLocationQuery = iMdeSession->NewObjectQueryL( *iNamespaceDef, *iLocationObjectDef, this ); + + CMdELogicCondition& cond = iLocationQuery->Conditions(); + cond.SetOperator( ELogicConditionOperatorAnd ); + + LOG1( "latitude: %f", latitude); + LOG1( "latdelta: %f", latDelta); + LOG1( "longitude: %f", longitude); + LOG1( "londelta: %f", lonDelta); + + cond.AddPropertyConditionL( *iLatitudeDef, + TMdERealBetween( latitude - latDelta, latitude + latDelta )); + cond.AddPropertyConditionL( *iLongitudeDef, + TMdERealBetween( longitude - lonDelta, longitude + lonDelta )); + + if ( iMediaItems[0]->iLocationData.iNetworkInfo.iCellId > 0 ) + { + cond.AddPropertyConditionL( cellIdDef, + TMdEUintEqual( iMediaItems[0]->iLocationData.iNetworkInfo.iCellId) ); + } + if ( iMediaItems[0]->iLocationData.iNetworkInfo.iLocationAreaCode > 0 ) + { + cond.AddPropertyConditionL( locationCodeDef, + TMdEUintEqual( iMediaItems[0]->iLocationData.iNetworkInfo.iLocationAreaCode) ); + } + if ( iMediaItems[0]->iLocationData.iNetworkInfo.iCountryCode.Length() > 0 ) + { + cond.AddPropertyConditionL( countryCodeDef, ETextPropertyConditionCompareEquals, + iMediaItems[0]->iLocationData.iNetworkInfo.iCountryCode ); + } + if ( iMediaItems[0]->iLocationData.iNetworkInfo.iNetworkId.Length() > 0 ) + { + cond.AddPropertyConditionL( networkCodeDef, ETextPropertyConditionCompareEquals, + iMediaItems[0]->iLocationData.iNetworkInfo.iNetworkId ); + } + iMediaHandlingFlag |= KLocationQueryInProgress; + iLocationQuery->FindL(); + + LOG( "CLocationRecord::FindLocationFromDBL(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::DoCreateLocationL +// -------------------------------------------------------------------------- +// +TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) { - LOG("CLocationRecord::DoCreateLocationL - start"); + LOG( "CLocationRecord::DoCreateLocationL(), begin" ); TItemId locationObjectId; - CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); - - CMdEObjectDef& locationObjectDef = namespaceDef.GetObjectDefL( Location::KLocationObject ); - // required object properties - CMdEPropertyDef& creationDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& creationDef = iLocationObjectDef->GetPropertyDefL( Object::KCreationDateProperty ); - CMdEPropertyDef& modifiedDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& modifiedDef = iLocationObjectDef->GetPropertyDefL( Object::KLastModifiedDateProperty ); - CMdEPropertyDef& sizeDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& sizeDef = iLocationObjectDef->GetPropertyDefL( Object::KSizeProperty ); - CMdEPropertyDef& itemTypeDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& itemTypeDef = iLocationObjectDef->GetPropertyDefL( Object::KItemTypeProperty ); - CMdEPropertyDef& offSetDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& offSetDef = iLocationObjectDef->GetPropertyDefL( Object::KTimeOffsetProperty ); // location related properties - CMdEPropertyDef& cellIdDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& cellIdDef = iLocationObjectDef->GetPropertyDefL( Location::KCellIdProperty ); - CMdEPropertyDef& latitudeDef = locationObjectDef.GetPropertyDefL( - Location::KLatitudeProperty ); - CMdEPropertyDef& longitudeDef = locationObjectDef.GetPropertyDefL( - Location::KLongitudeProperty ); - CMdEPropertyDef& altitudeDef = locationObjectDef.GetPropertyDefL( - Location::KAltitudeProperty ); - - CMdEPropertyDef& directionDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& directionDef = iLocationObjectDef->GetPropertyDefL( Location::KDirectionProperty ); - CMdEPropertyDef& speedDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& speedDef = iLocationObjectDef->GetPropertyDefL( Location::KSpeedProperty ); - CMdEPropertyDef& locationCodeDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& locationCodeDef = iLocationObjectDef->GetPropertyDefL( Location::KLocationAreaCodeProperty ); - CMdEPropertyDef& countryCodeDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& countryCodeDef = iLocationObjectDef->GetPropertyDefL( Location::KCountryCodeProperty ); - CMdEPropertyDef& networkCodeDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& networkCodeDef = iLocationObjectDef->GetPropertyDefL( Location::KNetworkCodeProperty ); - CMdEPropertyDef& qualityDef = locationObjectDef.GetPropertyDefL( + CMdEPropertyDef& qualityDef = iLocationObjectDef->GetPropertyDefL( Location::KQualityProperty ); // location object CMdEObject* locationObject = NULL; - locationObject = iMdeSession->NewObjectL( locationObjectDef, Object::KAutomaticUri ); + locationObject = iMdeSession->NewObjectL( *iLocationObjectDef, Object::KAutomaticUri ); CleanupStack::PushL( locationObject ); TTime timestamp( 0 ); @@ -863,18 +1329,21 @@ 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() )) { - locationObject->AddReal64PropertyL( latitudeDef, aLocationData.iPosition.Latitude() ); - locationObject->AddReal64PropertyL( longitudeDef, 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() ); + } if ( !Math::IsNaN( aLocationData.iPosition.Altitude() ) ) { - locationObject->AddReal64PropertyL( altitudeDef, aLocationData.iPosition.Altitude() ); + locationObject->AddReal64PropertyL( *iAltitudeDef, aLocationData.iPosition.Altitude() ); } if ( !Math::IsNaN( aLocationData.iCourse.Course() ) ) { @@ -890,47 +1359,56 @@ } // network related properties - if ( aLocationData.iNetworkInfo.iAreaKnown ) + if ( aLocationData.iNetworkInfo.iAccess != CTelephony::ENetworkAccessUnknown ) + { + 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 ) { - if ( aLocationData.iNetworkInfo.iAccess != CTelephony::ENetworkAccessUnknown ) - { - locationObject->AddUint32PropertyL( cellIdDef, aLocationData.iNetworkInfo.iCellId ); - - } - if ( aLocationData.iNetworkInfo.iLocationAreaCode != 0 && - aLocationData.iNetworkInfo.iAccess != CTelephony::ENetworkAccessUnknown ) - { - locationObject->AddUint32PropertyL( locationCodeDef, - aLocationData.iNetworkInfo.iLocationAreaCode ); - - } - if ( aLocationData.iNetworkInfo.iCountryCode.Length() > 0 ) - { - locationObject->AddTextPropertyL( countryCodeDef, - aLocationData.iNetworkInfo.iCountryCode ); - - } - if ( aLocationData.iNetworkInfo.iNetworkId.Length() > 0 ) - { - locationObject->AddTextPropertyL(networkCodeDef, aLocationData.iNetworkInfo.iNetworkId); - - } + LOG1("Areacode - %d", aLocationData.iNetworkInfo.iLocationAreaCode); + locationObject->AddUint32PropertyL( locationCodeDef, + aLocationData.iNetworkInfo.iLocationAreaCode ); + } +#ifdef _DEBUG + TLex lexer( aLocationData.iNetworkInfo.iCountryCode ); + TUint countryCode = 0; + + User::LeaveIfError( lexer.Val( countryCode, EDecimal) ); + LOG1("Country code - %d", countryCode); + + //Set mobile 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 ) + { + locationObject->AddTextPropertyL( countryCodeDef, + aLocationData.iNetworkInfo.iCountryCode ); } + if ( aLocationData.iNetworkInfo.iNetworkId.Length() > 0 ) + { + locationObject->AddTextPropertyL(networkCodeDef, aLocationData.iNetworkInfo.iNetworkId); + } + // Add the location object to the database. locationObjectId = iMdeSession->AddObjectL( *locationObject ); - - iLastLocationId = locationObjectId; - iLastLocation = aLocationData; + LOG1("Location id - %d", locationObjectId); + CleanupStack::PopAndDestroy( locationObject ); + LOG( "CLocationRecord::DoCreateLocationL(), end" ); - CleanupStack::PopAndDestroy( locationObject ); - - LOG("CLocationRecord::DoCreateLocationL - end"); - return locationObjectId; } - +// -------------------------------------------------------------------------- +// CLocationRecord::CreateRelationL +// -------------------------------------------------------------------------- +// TItemId CLocationRecord::CreateRelationL( const TUint& aObjectId, const TUint& aLocationId ) { LOG("CLocationRecord::CreateRelationL - start"); @@ -968,131 +1446,748 @@ LOG( "CLocationRecord::::ReadCenRepValueL(), end" ); } + +// -------------------------------------------------------------------------- +// CLocationRecord::HandleQueryNewResults +// -------------------------------------------------------------------------- +// void CLocationRecord::HandleQueryNewResults(CMdEQuery& /*aQuery*/, TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/) { } + +// -------------------------------------------------------------------------- +// CLocationRecord::HandleQueryCompleted +// -------------------------------------------------------------------------- +// void CLocationRecord::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) { LOG("CLocationRecord::HandleQueryCompleted - start"); const TInt count = aQuery.Count(); LOG1("CLocationRecord::HandleQueryCompleted count: %d", count); - - CMdENamespaceDef* namespaceDef = NULL; + + if ( aError != KErrNone ) + { + HandleQueryFailure(); + } + + else if ( &aQuery == iLocationQuery ) + { + + TRAPD(err,HandleLocationQueryL( aQuery )); + if(err != KErrNone) + { + // unable to process the first node.. + // remove this and process the next. - TRAP_IGNORE( namespaceDef = &iMdeSession->GetDefaultNamespaceDefL() ); - if ( namespaceDef ) + // reset the flag + HandleQueryFailure(); + } + + } + else if ( &aQuery == iNetLocationQuery ) { - CMdEObjectDef* locationObjectDef = NULL; + TRAPD(err,HandleNetLocationQueryL( aQuery )); + if(err != KErrNone) + { + // unable to process the first node.. + // remove this and process the next. + HandleQueryFailure(); + } + + } - TRAP_IGNORE( locationObjectDef = &namespaceDef->GetObjectDefL( Location::KLocationObject ) ); - if ( locationObjectDef ) - { - CMdEPropertyDef* latitudeDef = NULL; - CMdEPropertyDef* longitudeDef = NULL; - CMdEPropertyDef* altitudeDef = NULL; - - TRAP_IGNORE( - latitudeDef = &locationObjectDef->GetPropertyDefL( - Location::KLatitudeProperty ); - longitudeDef = &locationObjectDef->GetPropertyDefL( - Location::KLongitudeProperty ); - altitudeDef = &locationObjectDef->GetPropertyDefL( - Location::KAltitudeProperty ); - ); +#ifdef LOC_REVERSEGEOCODE + else if ( &aQuery == iImageQuery ) + { + if(aQuery.Count() > 0) + { + + CMdERelation& relation = static_cast( aQuery.ResultItem( 0 ) ); + + TItemId imageId = relation.LeftObjectId(); + + TRAPD(err, GetTagsL( imageId ) ); + if(err != KErrNone) + { + // unable to process the first node.. + // remove this and process the next. + + // reset the flag + HandleQueryFailure(); + } + } + else + { + HandleQueryFailure(); + } + } + + else if ( &aQuery == iTagQuery ) + { + TRAPD(err, HandleTagQueryL( aQuery ) ); + + GeoTaggingCompleted(); + if(err != KErrNone) + { + // unable to process the first node.. + // remove this and process the next. + + // reset the flag + HandleQueryFailure(); + } + } +#endif //LOC_REVERSEGEOCODE + else + { + // execution should not come over here...still take recovery action. + HandleQueryFailure(); + } + GeoTaggingCompleted(); + LOG( "CLocationRecord::HandleQueryCompleted(), end" ); + } - if( latitudeDef && longitudeDef && altitudeDef ) - { - TBool created = EFalse; - for ( TInt i = 0; i < count; i++ ) - { - LOG1("CLocationRecord::HandleQueryCompleted check item: %d", i); - CMdEItem& item = aQuery.ResultItem(i); - CMdEObject& locationObject = static_cast(item); - - CMdEProperty* latProp = NULL; - CMdEProperty* lonProp = NULL; - CMdEProperty* altProp = NULL; - - locationObject.Property( *latitudeDef, latProp, 0 ); - locationObject.Property( *longitudeDef, lonProp, 0 ); - locationObject.Property( *altitudeDef, altProp, 0 ); - - if ( latProp && lonProp ) - { - TReal32 distance; - TCoordinate newCoords; - if ( altProp ) - { - TRAP_IGNORE( newCoords = TCoordinate( latProp->Real64ValueL(), lonProp->Real64ValueL(), (TReal32)altProp->Real64ValueL() ) ); - } - else - { - TRAP_IGNORE( newCoords = TCoordinate( latProp->Real64ValueL(), lonProp->Real64ValueL() ) ); - } - - const TInt err = iLocationData.iPosition.Distance(newCoords, distance); - - if ( distance < iLocationDelta ) - { - LOG("CLocationRecord::HandleQueryCompleted - match found in db"); - TRAPD( err, CreateRelationL( iObjectId, locationObject.Id() ) ); - if( err == KErrNone) - { - created = ETrue; - i = count; - } - else - { - aError = err; - } - } - } - } +// -------------------------------------------------------------------------- +// CLocationRecord::HandleQueryFailure() +// handle MDS query sceenario +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleQueryFailure() + { + LOG( "CLocationRecord::HandleQueryFailure(), begin" ); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + if ( iMediaItems.Count() > 0 ) + { + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + iMediaItems.Remove(0); + delete firstPtr; + iMediaItems.Compress(); + HandleFindLocationFromDB(); + } + LOG( "CLocationRecord::HandleQueryFailure(), end" ); + } - if ( !created && aError == KErrNone ) - { - LOG("CLocationRecord::HandleQueryCompleted - no match found in db, create new"); - TInt locationId( 0 ); - TRAPD( err, locationId = DoCreateLocationL( iLocationData ) ); - LOG1("CLocationRecord::HandleQueryCompleted - DoCreateLocationL err: %d", err); - if( err == KErrNone ) - { - TRAP( err, CreateRelationL( iObjectId, locationId )); - LOG1("CLocationRecord::HandleQueryCompleted - CreateRelationL err: %d", err); - } - } - } +// -------------------------------------------------------------------------- +// CLocationRecord::HandleFindLocationFromDB() +// handle find location from DB within the non leaving method +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleFindLocationFromDB() + { + LOG( "CLocationRecord::HandleFindLocationFromDB(), begin" ); + if ( iMediaItems.Count() > 0 ) + { + TInt trapErr = KErrNone; + TRAP(trapErr,FindLocationFromDBL()); + // no memory, don't proceed further + // other error sceenario, we can move the node to the end and process the next + if(trapErr != KErrNoMemory && trapErr != KErrNone) + { + // other than no memory + TInt numberOfNodes = iMediaItems.Count(); + LOG1("media count - %d\n", numberOfNodes); + while(--numberOfNodes >= 0 && + trapErr != KErrNoMemory && + trapErr != KErrNone) + { + // first remove the node + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + iMediaItems.Remove(0); + // move this to last + iMediaItems.Append(firstPtr); + iMediaItems.Compress(); + trapErr = KErrNone; + // process for the next till we reached the last node. + TRAP(trapErr,FindLocationFromDBL()); + } + } + } + LOG( "CLocationRecord::HandleFindLocationFromDB(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::HandleLocationQuery() +// handle if only gps info available +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleLocationQueryL( CMdEQuery& aQuery ) + { + LOG( "CLocationRecord::HandleLocationQueryL(), begin" ); + TInt error = KErrNone; + TUint locationId( 0 ); + if ( iMediaItems.Count() <= 0 ) + { + LOG("CLocationRecord::HandleLocationQueryL. No media items to process"); + return; + } + + TLocationData locationData = iMediaItems[0]->iLocationData; + + const TInt count = aQuery.Count(); + //find any location matches + for ( TInt i = 0; i < count; i++ ) + { + LOG1("CLocationRecord::HandleLocationQueryL check item: %d", i); + CMdEItem& item = aQuery.ResultItem(i); + CMdEObject& locationObject = static_cast(item); + + CMdEProperty* latProp = NULL; + CMdEProperty* lonProp = NULL; + CMdEProperty* altProp = NULL; + + locationObject.Property( *iLatitudeDef, latProp, 0 ); + locationObject.Property( *iLongitudeDef, lonProp, 0 ); + locationObject.Property( *iAltitudeDef, altProp, 0 ); + + if ( latProp && lonProp ) + { + TReal32 distance; + TCoordinate newCoords; + + TReal64 lat = latProp->Real64ValueL(); + TReal64 lon = lonProp->Real64ValueL(); + if ( altProp ) + { + TReal32 alt = (TReal32)altProp->Real64ValueL(); + newCoords = TCoordinate( lat, lon, alt ); + } + else + { + newCoords = TCoordinate( lat, lon ); + } + + locationData.iPosition.Distance(newCoords, distance); + + if ( distance < iLocationDelta ) + { + i = count; + locationId = locationObject.Id(); + iMediaItems[0]->iLocationId = locationId; + break; + } } } + + + if ( locationId ) + { + TRAP( error, CreateRelationL( iMediaItems[0]->iObjectId, locationId ) ); + +#ifdef LOC_REVERSEGEOCODE + if( error == KErrNone) + { + //find out if image for this location is tagged already + GetRelatedImageL( locationId ); + } +#else + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + iMediaItems.Remove(0); + delete firstPtr; + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + if ( iMediaItems.Count() > 0 ) + { + FindLocationFromDBL(); + } +#endif //LOC_REVERSEGEOCODE + } + else + { + + if((iMediaItems[0]->iFlag & KDownloadMediaFile) > 0) + { + locationData.iNetworkInfo.iCellId = 0; + locationData.iNetworkInfo.iAccess = CTelephony::ENetworkAccessUnknown; + locationData.iNetworkInfo.iLocationAreaCode = 0; + locationData.iNetworkInfo.iCountryCode.Zero(); + locationData.iNetworkInfo.iNetworkId.Zero(); + } + TRAP( error, locationId = DoCreateLocationL( locationData ) ); - LOG("CLocationRecord::HandleQueryCompleted - end"); + if ( error == KErrNone ) + { + iMediaItems[0]->iLocationId = locationId; + TRAP( error, CreateRelationL( iMediaItems[0]->iObjectId, locationId )); + } + + TLocationSnapshotItem* item = iMediaItems[0]; + if((iMediaItems[0]->iFlag & KSnapMediaFile) > 0) + { + iLastMediaItem = *(iMediaItems[0]); + } + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + if ( error == KErrNone ) + { + //Find the address by coordinate, results a call to ReverseGeocodeComplete() +#ifdef LOC_REVERSEGEOCODE + iLocationItems.Append( item ); + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationItems[0]->iLocationData.iPosition, + iConnectionOption); + } + } +#else + // free resources + delete item; +#endif //LOC_REVERSEGEOCODE + } + else + { + // free resources + delete item; + } + + if ( iMediaItems.Count() > 0 ) + { + FindLocationFromDBL(); + } + } + LOG( "CLocationRecord::HandleLocationQueryL(), end" ); + } +// -------------------------------------------------------------------------- +// CLocationRecord::HandleNetLocationQuery() +// handle if only network info available +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleNetLocationQueryL( CMdEQuery& aQuery ) + { + LOG( "CLocationRecord::HandleNetLocationQueryL(), begin" ); + TInt error = KErrNone; + TUint locationId( 0 ); + if ( iMediaItems.Count() <= 0 ) + { + LOG("CLocationRecord::HandleNetLocationQueryL(), End. No media items to process\n"); + return; + } + if( aQuery.Count() ) + { + CMdEItem& item = aQuery.ResultItem(0); + CMdEObject& locationObject = static_cast(item); + locationId = locationObject.Id(); + + TRAP( error, CreateRelationL( iMediaItems[0]->iObjectId, locationId ) ); +#ifdef LOC_REVERSEGEOCODE + //check if found location object has lat, long + CMdEProperty* latProp = NULL; + CMdEProperty* lonProp = NULL; + CMdEProperty* cellIdProp = NULL; + CMdEProperty* areadCodeProp = NULL; + CMdEProperty* countryProp = NULL; + CMdEProperty* networkCodeProp = NULL; + if ( error == KErrNone ) + { + + CMdEPropertyDef& cellIdDef = iLocationObjectDef->GetPropertyDefL( + Location::KCellIdProperty ); + CMdEPropertyDef& locationAreadCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KLocationAreaCodeProperty ); + CMdEPropertyDef& countryCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KCountryCodeProperty ); + CMdEPropertyDef& networkCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KNetworkCodeProperty ); + + locationObject.Property( *iLatitudeDef, latProp, 0 ); + locationObject.Property( *iLongitudeDef, lonProp, 0 ); + + locationObject.Property( cellIdDef, cellIdProp, 0 ); + locationObject.Property( locationAreadCodeDef, areadCodeProp, 0 ); + locationObject.Property( countryCodeDef, countryProp, 0 ); + locationObject.Property( networkCodeDef, networkCodeProp, 0 ); + } + + if( (latProp && lonProp) + || (cellIdProp && areadCodeProp && countryProp && networkCodeProp) ) + { + //find out if image for this location is tagged already + GetRelatedImageL( locationId ); + } + else +#endif //LOC_REVERSEGEOCODE + { + // no geo info.. remove the item and proceed for the next. + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + iMediaItems.Remove(0); + delete firstPtr; + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + if ( iMediaItems.Count() > 0 ) + { + FindLocationFromDBL(); + } + } + } + else + { +#ifdef LOC_GEOTAGGING_CELLID + LOG1("Media handling flag = %d", iMediaHandlingFlag); + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0) + { + iMediaHandlingFlag |= KSnapGeoConvertInPendingState; + } + else + { + // go for cell id based geo coding. + if(iGeoConverter == NULL) + { + iGeoConverter = CGeoConverter::NewL(*this); + } + iGeoConverter->ConvertL(iMediaItems[0]->iLocationData.iNetworkInfo); + iMediaHandlingFlag |= KSnapGeoConvertInProgress; + iMediaHandlingFlag &= ~KSnapGeoConvertInPendingState; + } +#else + // cell id based geo tagging is not supported.. go for remapping. + locationId = DoCreateLocationL( iMediaItems[0]->iLocationData ); + iMediaItems[0]->iLocationId = locationId; + TItemId relationId = CreateRelationL( iMediaItems[0]->iObjectId, locationId ); + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + + // Go for remapping.. get locationdata from trail with object time + TTime timestamp = GetMdeObjectTimeL( iMediaItems[0]->iObjectId ); + TRemapItem remapItem; + remapItem.iObjectId = iMediaItems[0]->iObjectId; + remapItem.iTime = timestamp; + remapItem.iLocationId = locationId; + remapItem.iRelationId = relationId; + iRemapper->Append( remapItem ); + + iMediaItems.Remove(0); + delete firstPtr; + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + if ( iMediaItems.Count() > 0 ) + { + FindLocationFromDBL(); + } +#endif + } +#ifdef LOC_REVERSEGEOCODE + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 || + (iMediaHandlingFlag & KReverseGeoCodingInProgress) > 0) +#else + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0) +#endif //LOC_REVERSEGEOCODE + { + // stop n/w info change listener, since device may connect to n/w + // and local trail will receive so many call backs on current n/w info change. + iNetworkInfoChangeListener->StopNwInfoChangeNotifier(); + } + else + { + iNetworkInfoChangeListener->StartNwInfoChangeNotifier(); + } + LOG( "CLocationRecord::HandleNetLocationQueryL(), end" ); + + } + + +#ifdef LOC_GEOTAGGING_CELLID +// -------------------------------------------------------------------------- +// CLocationRecord::ConversionCompletedL() +// -------------------------------------------------------------------------- +// +void CLocationRecord::ConversionCompletedL( const TInt aError, TLocality& aPosition ) + { + + LOG1("CLocationRecord::ConversionCompletedL, begin. Error - %d", aError); + // reset the flag first + iMediaHandlingFlag &= ~KSnapGeoConvertInProgress; + LOG1("iRemapState - %d", iRemapState); + if(aError == KErrNone) + { + iConvertRetry = ETrue; + LOG("Conversion completed successfully"); + if(iRemapState == ERemapNwGeoConverterInProgress) + { + iNewItem.iLocationData.iPosition.SetCoordinate + ( aPosition.Latitude(), aPosition.Longitude(), aPosition.Altitude()); + iNewItem.iLocationData.iQuality = aPosition.HorizontalAccuracy(); + TItemId locationId = DoCreateLocationL( iNewItem.iLocationData ); + iRemapper->UpdateRelationsL( locationId ); +#ifdef LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + iRemapState = ERemapRevGeoCodeInProgress; + //Find the address by coordinate, results a call to ReverseGeocodeComplete() + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iNewItem.iLocationData.iPosition, iConnectionOption ); + } + } + else + { + // remap in reverse geocoding pending state. + iRemapState = ERemapRevGeoCodePending; + } +#endif //LOC_REVERSEGEOCODE + } + else if ( iMediaItems.Count() > 0 ) + { + + iMediaItems[0]->iLocationData.iPosition.SetCoordinate + ( aPosition.Latitude(), aPosition.Longitude(), aPosition.Altitude()); + iMediaItems[0]->iLocationData.iQuality = aPosition.HorizontalAccuracy(); + TLocationSnapshotItem* item = iMediaItems[0]; + TItemId locationId = DoCreateLocationL( iMediaItems[0]->iLocationData ); + iMediaItems[0]->iLocationId = locationId; + TItemId relationId = CreateRelationL( iMediaItems[0]->iObjectId, locationId ); + + // Go for remapping.. get locationdata from trail with object time + TTime timestamp = GetMdeObjectTimeL( iMediaItems[0]->iObjectId ); + TRemapItem remapItem; + remapItem.iObjectId = iMediaItems[0]->iObjectId; + remapItem.iTime = timestamp; + remapItem.iLocationId = locationId; + remapItem.iRelationId = relationId; + iRemapper->Append( remapItem ); + + if((iMediaItems[0]->iFlag & KSnapMediaFile) > 0) + { + iLastMediaItem = *(iMediaItems[0]); + } + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; +#ifdef LOC_REVERSEGEOCODE + iLocationItems.Append( item ); +#else + // free resource + delete item; +#endif + } + } + else + { + LOG1("Conversion error - %d", aError); + if(iConvertRetry) + { + LOG("Retry once"); + iConvertRetry = EFalse; + if(iRemapState == ERemapNwGeoConverterInProgress) + { + iRemapState = ERemapNwGeoConverterPending; + } + else if ( iMediaItems.Count() > 0 ) + { + iMediaHandlingFlag |= KSnapGeoConvertInPendingState; + } + } + else + { + if(iRemapState == ERemapNwGeoConverterInProgress) + { + iRemapState = ERemapProgressNone; + } + else if ( iMediaItems.Count() > 0 ) + { + TLocationSnapshotItem* item = iMediaItems[0]; + // Fails may be becuase of n/w reason..create location + relation so that we can handle at 3:00 AM. + TItemId locationId = DoCreateLocationL( iMediaItems[0]->iLocationData ); + iMediaItems[0]->iLocationId = locationId; + TItemId relationId = CreateRelationL( iMediaItems[0]->iObjectId, locationId ); + + // Go for remapping.. get locationdata from trail with object time + TTime timestamp = GetMdeObjectTimeL( iMediaItems[0]->iObjectId ); + TRemapItem remapItem; + remapItem.iObjectId = iMediaItems[0]->iObjectId; + remapItem.iTime = timestamp; + remapItem.iLocationId = locationId; + remapItem.iRelationId = relationId; + iRemapper->Append( remapItem ); + + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + delete item; + } + } + + } + + // check the remap item first. + if(iRemapState == ERemapNwGeoConverterPending) + { + // go for cell id based geo coding. + iRemapState = ERemapNwGeoConverterInProgress; + iGeoConverter->ConvertL(iNewItem.iLocationData.iNetworkInfo); + iMediaHandlingFlag |= KSnapGeoConvertInProgress; + } + //check for media queue pending request. + else if((iMediaHandlingFlag & KSnapGeoConvertInPendingState) > 0) + { + // previous media queue geo convert is in pending state. + // go for cell id based geo coding. + iGeoConverter->ConvertL(iMediaItems[0]->iLocationData.iNetworkInfo); + iMediaHandlingFlag |= KSnapGeoConvertInProgress; + iMediaHandlingFlag &= ~KSnapGeoConvertInPendingState; + } + // let's not use multiple access point. +#ifdef LOC_REVERSEGEOCODE + else if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress) && + iLocationItems.Count() > 0) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationItems[0]->iLocationData.iPosition, + iConnectionOption); + } + } + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 || + (iMediaHandlingFlag & KReverseGeoCodingInProgress) > 0) +#else + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0) +#endif //LOC_REVERSEGEOCODE + { + // stop n/w info change listener, since device may connect to n/w + // and local trail will receive so many call backs on current n/w info change. + iNetworkInfoChangeListener->StopNwInfoChangeNotifier(); + } + else + { + iNetworkInfoChangeListener->StartNwInfoChangeNotifier(); + } + FindLocationFromDBL(); + GeoTaggingCompleted(); + LOG("CLocationRecord::ConversionCompletedL, end"); + } + + +//------------------------------------------------------------------------ +// CLocationRecord::HandleConversionError +//------------------------------------------------------------------------ +// +void CLocationRecord::HandleConversionError(TInt aError) + { + LOG( "CLocationRecord::HandleConversionError(), begin" ); + ARG_USED(aError); + if(iRemapState == ERemapNwGeoConverterInProgress) + { + iRemapState = ERemapProgressNone; + } + else if ( iMediaItems.Count() > 0 ) + { + TLocationSnapshotItem* item = iMediaItems[0]; + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + delete item; + } + // let's not use multiple access point. +#ifdef LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress) && + iLocationItems.Count() > 0) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + if(iRevGeocoderPlugin) + { + TRAP_IGNORE(iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationItems[0]->iLocationData.iPosition, + iConnectionOption)); + } + } + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 || + (iMediaHandlingFlag & KReverseGeoCodingInProgress) > 0) +#else + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0) +#endif //LOC_REVERSEGEOCODE + { + // stop n/w info change listener, since device may connect to n/w + // and local trail will receive so many call backs on current n/w info change. + iNetworkInfoChangeListener->StopNwInfoChangeNotifier(); + } + else + { + iNetworkInfoChangeListener->StartNwInfoChangeNotifier(); + } + TRAP_IGNORE(FindLocationFromDBL()); + GeoTaggingCompleted(); + LOG( "CLocationRecord::HandleConversionError(), end" ); + } + +#endif // LOC_GEOTAGGING_CELLID + +// -------------------------------------------------------------------------- +// CLocationRecord::SetMdeSession +// -------------------------------------------------------------------------- +// EXPORT_C void CLocationRecord::SetMdeSession( CMdESession* aSession ) { + LOG( "CLocationRecord::SetMdeSession(), begin" ); iMdeSession = aSession; +#ifdef LOC_REVERSEGEOCODE + iTagCreator->SetSession( aSession ); +#endif TRAPD(err, iRemapper->InitialiseL( aSession )); if( err != KErrNone ) { delete iRemapper; iRemapper = NULL; } + TRAP(err, InitialiseL() ); + LOG( "CLocationRecord::SetMdeSession(), end" ); } +// -------------------------------------------------------------------------- +// CLocationRecord::InitialiseL +// -------------------------------------------------------------------------- +// +void CLocationRecord::InitialiseL() + { + LOG( "CLocationRecord::InitialiseL(), begin" ); + // namespace defaults + iNamespaceDef = &iMdeSession->GetDefaultNamespaceDefL(); + + // location object definitions + iLocationObjectDef = &iNamespaceDef->GetObjectDefL( Location::KLocationObject ); + iLatitudeDef = &iLocationObjectDef->GetPropertyDefL( Location::KLatitudeProperty ); + iLongitudeDef = &iLocationObjectDef->GetPropertyDefL( Location::KLongitudeProperty ); + iAltitudeDef = &iLocationObjectDef->GetPropertyDefL( Location::KAltitudeProperty ); + LOG( "CLocationRecord::InitialiseL(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::StartTimerL +// -------------------------------------------------------------------------- +// void CLocationRecord::StartTimerL() { - LOG("CLocationRecord::StartTimerL"); + LOG("CLocationRecord::StartTimerL,begin"); if( !iNetworkInfoTimer->IsActive() ) { iNetworkInfoTimer->Start( iInterval, iInterval, TCallBack( UpdateNetworkInfo, this ) ); } + LOG( "CLocationRecord::StartL(), end" ); } + +// -------------------------------------------------------------------------- +// CLocationRecord::GetMdeObjectTimeL +// -------------------------------------------------------------------------- +// TTime CLocationRecord::GetMdeObjectTimeL( TItemId aObjectId ) { + LOG( "CLocationRecord::GetMdeObjectTimeL(), begin" ); CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL( Object::KBaseObject ); @@ -1114,11 +2209,78 @@ return timeValue; } + + +// -------------------------------------------------------------------------- +// CLocationRecord::RemappingNeeded +// -------------------------------------------------------------------------- +// EXPORT_C TBool CLocationRecord::RemappingNeeded() { - return iRemapper->ItemsInQueue(); + return ( iRemapper->ItemsInQueue() + && (iRemapState == ERemapProgressNone)); } + + + +// -------------------------------------------------------------------------- +// CLocationRecord::FindLocationWithSameNetInfoL() +// check any location object already exists with same network info +// -------------------------------------------------------------------------- +// +void CLocationRecord::FindLocationWithSameNetInfoL() + { + LOG( "CLocationRecord::FindLocationWithSameNetInfoL(), begin" ); + if(iMediaItems[0]->iLocationData.iNetworkInfo.iCellId > 0 && + iMediaItems[0]->iLocationData.iNetworkInfo.iCountryCode.Length() > 0 && + iMediaItems[0]->iLocationData.iNetworkInfo.iNetworkId.Length() > 0) + { + CMdEPropertyDef& cellIdDef = iLocationObjectDef->GetPropertyDefL( + Location::KCellIdProperty ); + CMdEPropertyDef& locationCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KLocationAreaCodeProperty ); + CMdEPropertyDef& countryCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KCountryCodeProperty ); + CMdEPropertyDef& networkCodeDef = iLocationObjectDef->GetPropertyDefL( + Location::KNetworkCodeProperty ); + + if(iNetLocationQuery) + { + iNetLocationQuery->RemoveObserver(*this); + iNetLocationQuery->Cancel(); + delete iNetLocationQuery; + iNetLocationQuery = NULL; + } + iNetLocationQuery = iMdeSession->NewObjectQueryL( *iNamespaceDef, *iLocationObjectDef, this ); + CMdELogicCondition& cond = iNetLocationQuery->Conditions(); + cond.SetOperator( ELogicConditionOperatorAnd ); + + cond.AddPropertyConditionL( cellIdDef, + TMdEUintEqual( iMediaItems[0]->iLocationData.iNetworkInfo.iCellId) ); + cond.AddPropertyConditionL( locationCodeDef, + TMdEUintEqual( iMediaItems[0]->iLocationData.iNetworkInfo.iLocationAreaCode) ); + cond.AddPropertyConditionL( countryCodeDef, ETextPropertyConditionCompareEquals, + iMediaItems[0]->iLocationData.iNetworkInfo.iCountryCode ); + cond.AddPropertyConditionL( networkCodeDef, ETextPropertyConditionCompareEquals, + iMediaItems[0]->iLocationData.iNetworkInfo.iNetworkId ); + + iNetLocationQuery->FindL(1, 1); + iMediaHandlingFlag |= KLocationQueryInProgress; + } + else + { + TLocationSnapshotItem* firstPtr = iMediaItems[0]; + iMediaItems.Remove(0); + delete firstPtr; + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + FindLocationFromDBL(); + } + LOG( "CLocationRecord::FindLocationWithSameNetInfoL(), end" ); + + } + EXPORT_C TBool CLocationRecord::IsLowBattery() { LOG("CLocationRecord::IsLowBattery()"); @@ -1135,7 +2297,527 @@ { return ETrue; } + } + +// -------------------------------------------------------------------------- +// CLocationRecord::GeoTaggingCompleted +// -------------------------------------------------------------------------- +// +void CLocationRecord::GeoTaggingCompleted() + { + LOG( "CLocationRecord::GeoTaggingCompleted(), begin" ); + if((iMediaItems.Count() == 0) +#ifdef LOC_REVERSEGEOCODE + && (iLocationItems.Count() == 0) +#endif //LOC_REVERSEGEOCODE + ) + { + LOG("Geo tagging completed"); + iGeoTaggerObserver.GeoTaggingCompleted(KErrNone); + // fallback to silent +#ifdef LOC_REVERSEGEOCODE + iConnectionOption = ESilent; +#endif //LOC_REVERSEGEOCODE + } + LOG( "CLocationRecord::GeoTaggingCompleted(), end" ); + } + + + + +// -------------------------------------------------------------------------- +// CLocationRecord::TaggingInProgress +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CLocationRecord::TaggingInProgress() + { + LOG( "CLocationRecord::TaggingInProgress(), begin" ); + TBool retVal = EFalse; +#ifdef LOC_REVERSEGEOCODE + if( ((iMediaItems.Count() > 0) || (iLocationItems.Count() > 0) ) + && (iRevGeocoderPlugin && iRevGeocoderPlugin->SilentConnectionAllowed())) +#else + if( iMediaItems.Count() > 0 ) + +#endif //LOC_REVERSEGEOCODE + { +#ifdef LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + // start geocoding + + if (iLocationItems.Count() > 0 ) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + + TRAP_IGNORE( iRevGeocoderPlugin->GetAddressByCoordinateL( + iLocationItems[0]->iLocationData.iPosition, + iConnectionOption) ); + + retVal = ETrue; + } + } + else + { + retVal = ETrue; + } +#endif //LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KLocationQueryInProgress)) + { + if(iMediaItems.Count() > 0) + { + HandleFindLocationFromDB(); + retVal = ETrue; + } + } + else + { + retVal = ETrue; + } + } + else + { + // Flash the array to avoid double tagging by photos & localrail. + } + LOG( "CLocationRecord::TaggingInProgress(), end" ); + return retVal; + } + + +// ---------------------------------------------------------------------------- +// CLocationRecord::GetCurrentRegisteredNw() +// ---------------------------------------------------------------------------- +EXPORT_C RMobilePhone::TMobilePhoneNetworkInfoV2& CLocationRecord::GetCurrentRegisteredNw() + { + LOG( "CLocationRecord::GetCurrentRegisteredNw ,begin" ); + return iNetworkInfoChangeListener->GetCurrentRegisterNw(); + } + +// -------------------------------------------------------------------------- +// CLocationRecord::StartGeoTagging +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CLocationRecord::StartGeoTagging(const TConnectionOption aConnectionOption) + { + LOG( "CLocationRecord::StartGeoTagging(), begin" ); + TBool retVal = EFalse; + ARG_USED(aConnectionOption); + if((iMediaItems.Count() > 0) +#ifdef LOC_REVERSEGEOCODE + || (iLocationItems.Count() > 0) +#endif //LOC_REVERSEGEOCODE + ) + { +#ifdef LOC_REVERSEGEOCODE + iConnectionOption = aConnectionOption; + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress)) + { + // start geocoding + if (iLocationItems.Count() > 0 ) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + if(iRevGeocoderPlugin) + { + TRAP_IGNORE( iRevGeocoderPlugin->GetAddressByCoordinateL( + iLocationItems[0]->iLocationData.iPosition, + iConnectionOption) ); + } + retVal = ETrue; + } + } + else + { + retVal = ETrue; + } +#endif //LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KLocationQueryInProgress)) + { + if(iMediaItems.Count() > 0) + { + HandleFindLocationFromDB(); + retVal = ETrue; + } + } + else + { + retVal = ETrue; + } + } + LOG( "CLocationRecord::StartGeoTagging(), end" ); + return retVal; + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::CancelGeoTagging +// -------------------------------------------------------------------------- +// +EXPORT_C void CLocationRecord::CancelGeoTagging() + { +#ifdef LOC_REVERSEGEOCODE + LOG1( "CLocationRecord::CancelGeoTagging(), Connetion opt - %d", + iConnectionOption ); + // set this to default connection. + iConnectionOption = ESilent; +#endif //LOC_REVERSEGEOCODE + } + + +#ifdef LOC_REVERSEGEOCODE + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GetRelatedImages() +// Find any image, already related to this location object +// -------------------------------------------------------------------------- +// +void CLocationRecord::GetRelatedImageL(TItemId aLocID) + { + LOG( "CLocationRecord::GetRelatedImageL(), begin" ); + CMdEObjectDef& imageObjDef = iNamespaceDef->GetObjectDefL( Image::KImageObject ); + if(iImageQuery) + { + iImageQuery->RemoveObserver(*this); + iImageQuery->Cancel(); + delete iImageQuery; + iImageQuery = NULL; + } + + iImageQuery = iMdeSession->NewRelationQueryL( *iNamespaceDef, this ); + User::LeaveIfNull( iImageQuery ); + + iImageQuery->SetResultMode( EQueryResultModeItem ); + + // both left and right condition must match + CMdERelationCondition& filterCond = iImageQuery->Conditions(). + AddRelationConditionL( ERelationConditionSideRight ); + + // left one must be any image object. + filterCond.LeftL().AddObjectConditionL( imageObjDef ); + + // right one must be this location object + filterCond.RightL().AddObjectConditionL( aLocID ); + + iImageQuery->FindL(1, 1); // results to a call to HandleQueryCompleted() + LOG( "CLocationRecord::GetRelatedImageL(), end" ); } + + +// -------------------------------------------------------------------------- +// CLocationRecord::ReverseGeocodeComplete() +// Get address details like country, city.. +// Create country and city tags and attach to the current image/video object +// -------------------------------------------------------------------------- +// +void CLocationRecord::ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ) + { + LOG( "CLocationRecord::ReverseGeocodeComplete(), begin" ); + TItemId countryTagId(0); + TItemId cityTagId(0); + + iMediaHandlingFlag &= (~KReverseGeoCodingInProgress); + TLocationSnapshotItem* snapshotItem = NULL; + LOG1("Error - %d", aErrorcode); + if( aErrorcode == KErrNone ) + { + iLastReverseGeocodeFails = EFalse; + TPtrC countryPtr( aAddressInfo.GetCountryName() ); + TPtrC cityPtr( aAddressInfo.GetCity() ); + TRAP_IGNORE( iTagCreator->CreateLocationTagsL( countryPtr, countryTagId, + cityPtr, cityTagId ) ); + if ( iRemapState == ERemapRevGeoCodeInProgress) + { + TRAP_IGNORE( iRemapper->AttachGeoTagsL( iTagCreator, countryTagId, cityTagId ) ); + iRemapState = ERemapProgressNone; + } + else + { + if(iLocationItems.Count() > 0) + { + iLocationItems[0]->iCountryTagId = countryTagId; + iLocationItems[0]->iCityTagId = cityTagId; + iLastLocationItem = (*iLocationItems[0]); + + TRAP_IGNORE( iTagCreator->AttachTagsL( + iLocationItems[0]->iObjectId, countryTagId, cityTagId ) ); + if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 + && iLastMediaItem.iLocationId == iLastLocationItem.iLocationId ) + { + LOG("Updating country/city\n"); + iLastMediaItem.iCountryTagId = countryTagId; + iLastMediaItem.iCityTagId = cityTagId; + } + + } + } + //check other items in the array has same location + for ( TInt index = iLocationItems.Count() - 1; index > 0; index--) + { + if ( iLocationItems[index]->iLocationId == iLastLocationItem.iLocationId ) + { + LOG1("Attached tags in for - %d\n", index); + TRAP_IGNORE( iTagCreator->AttachTagsL( + iLocationItems[index]->iObjectId, countryTagId, cityTagId ) ); + snapshotItem = iLocationItems[index]; + iLocationItems.Remove(index); + delete snapshotItem; + } + } + } + else + { + //handle error + LOG("Reverse geo coding fails"); + iLastReverseGeocodeFails = ETrue; + } + + //irrespective of error or not, remove current(first) item to proceed further + if ( iLocationItems.Count() > 0 ) + { + snapshotItem = iLocationItems[0]; + iLocationItems.Remove(0); + delete snapshotItem; + iLocationItems.Compress(); + } + if (aErrorcode == KErrNone) + { + if(iRemapState == ERemapRevGeoCodePending) + { + if(iRevGeocoderPlugin) + { + TRAPD(err, iRevGeocoderPlugin->GetAddressByCoordinateL( iNewItem.iLocationData.iPosition, iConnectionOption );) + if(err == KErrNone) + { + // Remap geo coding in pending state + iRemapState = ERemapRevGeoCodeInProgress; + //Find the address by coordinate, results a call to ReverseGeocodeComplete() + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + } + } + } + else if(iLocationItems.Count() > 0) + { + if(iRevGeocoderPlugin) + { + TRAPD(err, iRevGeocoderPlugin->GetAddressByCoordinateL( + iLocationItems[0]->iLocationData.iPosition, + iConnectionOption) ); + if(err == KErrNone) + { + // queue is not empty process the next. + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + } + } + } + } + + GeoTaggingCompleted(); + if((iMediaHandlingFlag & KSnapGeoConvertInProgress) > 0 || + (iMediaHandlingFlag & KReverseGeoCodingInProgress) > 0) + { + // stop n/w info change listener, since device may connect to n/w + // and local trail will receive so many call backs on current n/w info change. + iNetworkInfoChangeListener->StopNwInfoChangeNotifier(); + } + else + { + iNetworkInfoChangeListener->StartNwInfoChangeNotifier(); + } + LOG( "CLocationRecord::ReverseGeocodeComplete(), end" ); + } + + +// ---------------------------------------------------------------------------- +// CLocationRecord::IsRegisteredAtHomeNetwork() +// ---------------------------------------------------------------------------- +TBool CLocationRecord::IsRegisteredAtHomeNetwork() + { + LOG( "CLocationRecord::IsRegisteredAtHomeNetwork" ); + return iGeoTaggerObserver.IsRegisteredAtHomeNetwork(); + } + +// ---------------------------------------------------------------------------- +// CLocationRecord::GetHomeNetworkInfo() +// ---------------------------------------------------------------------------- +const RMobilePhone::TMobilePhoneNetworkInfoV1& + CLocationRecord::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) + { + LOG( "CLocationRecord::GetHomeNetworkInfo" ); + return iGeoTaggerObserver.GetHomeNetworkInfo(aHomeNwInfoAvailableFlag); + } + +// ---------------------------------------------------------------------------- +// CLocationRecord::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CLocationRecord::GetCurrentRegisterNw() + { + LOG( "CLocationRecord::GetCurrentRegisterNw ,begin" ); + return GetCurrentRegisteredNw(); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::HandleTagQuery() +// handle if only gps info available +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleTagQueryL( CMdEQuery& aQuery ) + { + LOG( "CLocationRecord::HandleTagQueryL(), begin" ); + TItemId countryTagId = 0; + TItemId cityTagId = 0; + TRAPD( error, FindCountryAndCityTagL( aQuery, countryTagId, cityTagId ) ); + if ( error == KErrNone ) + { + LOG1("Media count - %d\n", iMediaItems.Count()); + if ( !countryTagId && !cityTagId ) + { + if ( iMediaItems.Count() > 0 ) + { + iLocationItems.Append( iMediaItems[0] ); + if((iMediaItems[0]->iFlag & KSnapMediaFile) > 0) + { + iLastMediaItem = *(iMediaItems[0]); + } + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + } + +#ifdef LOC_REVERSEGEOCODE + if(!(iMediaHandlingFlag & KReverseGeoCodingInProgress) && + iLocationItems.Count() > 0) + { + iMediaHandlingFlag |= KReverseGeoCodingInProgress; + if(iRevGeocoderPlugin) + { + iRevGeocoderPlugin->GetAddressByCoordinateL + ( iLocationItems[0]->iLocationData.iPosition, + iConnectionOption); + } + } +#endif //LOC_REVERSEGEOCODE + } + else + { + + iTagCreator->AttachTagsL( iMediaItems[0]->iObjectId, countryTagId, cityTagId ); + if ( iMediaItems.Count() > 0 ) + { + iMediaItems[0]->iCountryTagId = countryTagId; + iMediaItems[0]->iCityTagId = cityTagId; + TLocationSnapshotItem* item = iMediaItems[0]; + if((iMediaItems[0]->iFlag & KSnapMediaFile) > 0) + { + iLastMediaItem = *item; + } + iMediaItems.Remove(0); + iMediaItems.Compress(); + iMediaHandlingFlag &= ~KLocationQueryInProgress; + delete item; + } + } + + } + if ( iMediaItems.Count() > 0 ) + { + FindLocationFromDBL(); + } + LOG( "CLocationRecord::HandleTagQueryL(), end" ); + } + + +// -------------------------------------------------------------------------- +// CLocationRecord::FindCountryAndCityTagL() +// Go through all attached tags to get location tags only +// -------------------------------------------------------------------------- +// +void CLocationRecord::FindCountryAndCityTagL( CMdEQuery& aQuery, + TItemId& aCountryTagId, TItemId& aCityTagId ) + { + LOG( "CLocationRecord::FindCountryAndCityTagL(), begin" ); + TItemId tagId = 0; + CMdEObject* object = NULL; + TInt error = KErrNone; + + const TInt count = aQuery.Count(); + + for ( TInt i = 0; i < count; i++ ) + { + CMdERelation& relation = static_cast( aQuery.ResultItem( i ) ); + + tagId = relation.RightObjectId(); + TRAP_IGNORE( object = iMdeSession->GetObjectL( tagId ) ); + + if ( !aCountryTagId ) + { + error = object->Uri().Find( KCountry ); + //just make sure 'country' appears first in the tag uri + if ( error == KErrNone ) + { + aCountryTagId = tagId; + continue; + } + } + + if ( !aCityTagId ) + { + error = object->Uri().Find( KCity ); + if ( error == KErrNone ) + { + aCityTagId = tagId; + } + } + + if ( aCountryTagId && aCityTagId ) + { + i = count; + } + } + LOG( "CLocationRecord::FindCountryAndCityTagL(), end" ); + + } + +// -------------------------------------------------------------------------- +// CLocationRecord::GetTagsL() +// -------------------------------------------------------------------------- +// +void CLocationRecord::GetTagsL( TItemId aImageID ) + { + LOG( "CLocationRecord::GetTagsL(), begin" ); + CMdEObjectDef& tagObjectDef = iNamespaceDef->GetObjectDefL( Tag::KTagObject ); + + if(iTagQuery) + { + iTagQuery->RemoveObserver(*this); + iTagQuery->Cancel(); + delete iTagQuery; + iTagQuery = NULL; + } + + iTagQuery = iMdeSession->NewRelationQueryL( *iNamespaceDef, this ); + User::LeaveIfNull( iTagQuery ); + + iTagQuery->SetResultMode( EQueryResultModeItem ); + + // both left and right condition must match + CMdERelationCondition& filterCond = iTagQuery->Conditions(). + AddRelationConditionL( ERelationConditionSideRight ); + + // left one must be this image object. + filterCond.LeftL().AddObjectConditionL( aImageID ); + + // right one must be tag object + filterCond.RightL().AddObjectConditionL( tagObjectDef ); + + iTagQuery->FindL(); // results to a call to HandleQueryCompleted() + LOG( "CLocationRecord::GetTagsL(), end" ); + } + + +#endif //LOC_REVERSEGEOCODE + // End of file + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/cnetworkinfo.cpp --- a/locationmanager/locationtrail/src/cnetworkinfo.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/cnetworkinfo.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -20,6 +20,9 @@ #include "cnetworkinfo.h" #include "locationmanagerdebug.h" + + + // -------------------------------------------------------------------------- // CNetworkInfo::NewL // -------------------------------------------------------------------------- @@ -31,7 +34,6 @@ CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); - LOG( "CNetworkInfo::NewL(), end" ); return self; } @@ -41,12 +43,13 @@ // CNetworkInfo::CNetworkInfo( MNetworkInfoObserver* aTrail ) : CActive( CActive::EPriorityStandard ), - iFirstTime( EFalse ), - iTelephony( NULL ), - iNetworkInfoV1Pckg( iNetworkInfoV1 ) + iTrail ( aTrail ), + iMobilePhone(aTrail->GetMobilePhone4NwInfo()), + iState( ENetworkInfoNoOptState ), + + iMMNetworkInfoPckg( iMMNetworkInfo ) { CActiveScheduler::Add( this ); - iTrail = aTrail; } // -------------------------------------------------------------------------- @@ -56,17 +59,7 @@ void CNetworkInfo::ConstructL() { LOG( "CNetworkInfo::ConstructL(), begin" ); - iFirstTime = ETrue; - iTelephony = CTelephony::NewL(); - iTelephony->GetCurrentNetworkInfo(iStatus, iNetworkInfoV1Pckg); - LOG( "CNetworkInfo::ConstructL(), iTelephony->GetCurrentNetworkInfo called" ); - - if ( IsActive() ) - { - Cancel(); - } - SetActive(); - + StartNwInfoChangeNotifier(); LOG( "CNetworkInfo::ConstructL(), end" ); } @@ -76,8 +69,8 @@ // EXPORT_C CNetworkInfo::~CNetworkInfo() { + // we are not owning RMobilePhone obj.. DON'T CLOSE it. Cancel(); - delete iTelephony; } // -------------------------------------------------------------------------- @@ -90,25 +83,61 @@ } // -------------------------------------------------------------------------- +// CNetworkInfo::StartNwInfoChangeNotifier +// -------------------------------------------------------------------------- +// +EXPORT_C void CNetworkInfo::StartNwInfoChangeNotifier() + { + LOG( "CNetworkInfo::StartNwInfoChangeNotifier(), begin" ); + if ( !IsActive()) + { + // get current n/w info first and from RunL start notifier + iState = ENetworkInfoOptGetState; + + iMobilePhone.GetCurrentNetwork(iStatus, iMMNetworkInfoPckg, iMMArea); + SetActive(); + } + + LOG( "CNetworkInfo::StartNwInfoChangeNotifier(), end" ); + } + +// -------------------------------------------------------------------------- +// CNetworkInfo::StopNwInfoChangeNotifier +// -------------------------------------------------------------------------- +// +EXPORT_C void CNetworkInfo::StopNwInfoChangeNotifier() + { + LOG( "CNetworkInfo::StopNwInfoChangeNotifier(), begin" ); + Cancel(); + iState = ENetworkInfoNoOptState; + LOG( "CNetworkInfo::StopNwInfoChangeNotifier(), end" ); + } + +// -------------------------------------------------------------------------- // CNetworkInfo::RunL // -------------------------------------------------------------------------- // void CNetworkInfo::RunL() { LOG( "CNetworkInfo::RunL(), begin" ); - iFirstTime = EFalse; - iTrail->NetworkInfo( iNetworkInfoV1, iStatus.Int() ); - LOG( "CNetworkInfo::RunL(), iTrail->NetworkInfo called" ); - - iTelephony->NotifyChange(iStatus, CTelephony::ECurrentNetworkInfoChange, iNetworkInfoV1Pckg); - LOG( "CNetworkInfo::RunL(), iTelephony->NotifyChange called" ); - - if ( IsActive() ) + // reset the flag first + iState = ENetworkInfoNoOptState; + if(iStatus == KErrNone) + { + // convert the network info to CTelephony network info. just to give backward compatibility + MapNetworkInfo(&iNetworkInfoV1, &iMMNetworkInfo, &iMMArea); + } + if(iTrail) + { + iTrail->NetworkInfo( iNetworkInfoV1, iStatus.Int() ); + } + // listen to n/w info change + if ( !IsActive() ) { - Cancel(); - } - SetActive(); - + iState = ENetworkInfoOptNotifyState; + iMobilePhone.NotifyCurrentNetworkChange(iStatus,iMMNetworkInfoPckg, iMMArea); + SetActive(); + } LOG( "CNetworkInfo::RunL(), end" ); } @@ -118,21 +147,190 @@ // void CNetworkInfo::DoCancel() { - LOG( "CNetworkInfo::DoCancel(), begin" ); - if ( IsActive() ) - { - if ( iFirstTime ) + LOG1( "CNetworkInfo::DoCancel(), begin. State - %d", iState); + switch ( iState ) + { + case ENetworkInfoOptGetState: { - LOG( "CNetworkInfo::DoCancel(), cancelling CTelephony::EGetCurrentNetworkInfoCancel" ); - iTelephony->CancelAsync( CTelephony::EGetCurrentNetworkInfoCancel ); + LOG( "Cancel get current n/w info change" ); + iMobilePhone.CancelAsyncRequest( EMobilePhoneGetCurrentNetwork); + break; } - else + case ENetworkInfoOptNotifyState: { - LOG( "CNetworkInfo::DoCancel(), cancelling CTelephony::ECurrentNetworkInfoChangeCancel" ); - iTelephony->CancelAsync( CTelephony::ECurrentNetworkInfoChangeCancel ); - } - } + LOG( "Cancel current n/w info change" ); + iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyCurrentNetworkChange); + break; + } + default: + break; + } + iState = ENetworkInfoNoOptState; LOG( "CNetworkInfo::DoCancel(), end" ); } +// -------------------------------------------------------------------------- +// CNetworkInfo::MapNetworkInfo +// -------------------------------------------------------------------------- +// +EXPORT_C void CNetworkInfo::MapNetworkInfo(CTelephony::TNetworkInfoV1* aTelNetworkInfo, + RMobilePhone::TMobilePhoneNetworkInfoV2* aMMNetworkInfo, + RMobilePhone::TMobilePhoneLocationAreaV1* aMMArea) + { + LOG( "CNetworkInfo::MapNetworkInfo(), begin" ); + switch(aMMNetworkInfo->iMode) + { + case RMobilePhone::ENetworkModeUnknown: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeUnknown; + break; + case RMobilePhone::ENetworkModeUnregistered: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeUnregistered; + break; + case RMobilePhone::ENetworkModeGsm: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeGsm; + break; + case RMobilePhone::ENetworkModeAmps: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeAmps; + break; + case RMobilePhone::ENetworkModeCdma95: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeCdma95; + break; + case RMobilePhone::ENetworkModeCdma2000: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeCdma2000; + break; + case RMobilePhone::ENetworkModeWcdma: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeWcdma; + break; + case RMobilePhone::ENetworkModeTdcdma: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeTdcdma; + break; + default: + aTelNetworkInfo->iMode=CTelephony::ENetworkModeUnknown; + } + + switch(aMMNetworkInfo->iStatus) + { + case RMobilePhone::ENetworkStatusUnknown: + aTelNetworkInfo->iStatus=CTelephony::ENetworkStatusUnknown; + break; + case RMobilePhone::ENetworkStatusAvailable: + aTelNetworkInfo->iStatus=CTelephony::ENetworkStatusAvailable; + break; + case RMobilePhone::ENetworkStatusCurrent: + aTelNetworkInfo->iStatus=CTelephony::ENetworkStatusCurrent; + break; + case RMobilePhone::ENetworkStatusForbidden: + aTelNetworkInfo->iStatus=CTelephony::ENetworkStatusForbidden; + break; + default: + aTelNetworkInfo->iStatus=CTelephony::ENetworkStatusUnknown; + } + + switch(aMMNetworkInfo->iBandInfo) + { + case RMobilePhone::EBandUnknown: + aTelNetworkInfo->iBandInfo=CTelephony::EBandUnknown; + break; + case RMobilePhone::E800BandA: + aTelNetworkInfo->iBandInfo=CTelephony::E800BandA; + break; + case RMobilePhone::E800BandB: + aTelNetworkInfo->iBandInfo=CTelephony::E800BandB; + break; + case RMobilePhone::E800BandC: + aTelNetworkInfo->iBandInfo=CTelephony::E800BandC; + break; + case RMobilePhone::E1900BandA: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandA; + break; + case RMobilePhone::E1900BandB: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandB; + break; + case RMobilePhone::E1900BandC: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandC; + break; + case RMobilePhone::E1900BandD: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandD; + break; + case RMobilePhone::E1900BandE: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandE; + break; + case RMobilePhone::E1900BandF: + aTelNetworkInfo->iBandInfo=CTelephony::E1900BandF; + break; + default: + aTelNetworkInfo->iBandInfo=CTelephony::EBandUnknown; + } + + aTelNetworkInfo->iCountryCode.Copy(aMMNetworkInfo->iCountryCode); + aTelNetworkInfo->iNetworkId.Copy(aMMNetworkInfo->iNetworkId); + aTelNetworkInfo->iDisplayTag.Copy(aMMNetworkInfo->iDisplayTag); + + TInt maxLength = aTelNetworkInfo->iShortName.MaxLength(); + if (aMMNetworkInfo->iShortName.Length() > maxLength) + { + aTelNetworkInfo->iShortName.Copy(aMMNetworkInfo->iShortName.Ptr(), maxLength); + } + else + { + aTelNetworkInfo->iShortName.Copy(aMMNetworkInfo->iShortName); + } + + maxLength = aTelNetworkInfo->iLongName.MaxLength(); + + if (aMMNetworkInfo->iLongName.Length() > maxLength) + { + aTelNetworkInfo->iLongName.Copy(aMMNetworkInfo->iLongName.Ptr(), maxLength); + } + else + { + aTelNetworkInfo->iLongName.Copy(aMMNetworkInfo->iLongName); + } + + aTelNetworkInfo->iCdmaSID.Copy(aMMNetworkInfo->iCdmaSID); + + if(aMMArea) + { + aTelNetworkInfo->iAreaKnown=aMMArea->iAreaKnown; + aTelNetworkInfo->iLocationAreaCode=aMMArea->iLocationAreaCode; + aTelNetworkInfo->iCellId=aMMArea->iCellId; + } + else + { + aTelNetworkInfo->iAreaKnown=EFalse; + aTelNetworkInfo->iLocationAreaCode=0; + aTelNetworkInfo->iCellId=0; + } + + //check which paramater class version this is. + switch(aMMNetworkInfo->iAccess) + { + case RMobilePhone::ENetworkAccessUnknown: + aTelNetworkInfo->iAccess=CTelephony::ENetworkAccessUnknown; + break; + case RMobilePhone::ENetworkAccessGsm: + aTelNetworkInfo->iAccess=CTelephony::ENetworkAccessGsm; + break; + case RMobilePhone::ENetworkAccessGsmCompact: + aTelNetworkInfo->iAccess=CTelephony::ENetworkAccessGsmCompact; + break; + case RMobilePhone::ENetworkAccessUtran: + aTelNetworkInfo->iAccess=CTelephony::ENetworkAccessUtran; + break; + default: + aTelNetworkInfo->iAccess=CTelephony::ENetworkAccessUnknown; + } + + LOG( "CNetworkInfo::MapNetworkInfo(), end" ); + } + +// ---------------------------------------------------------------------------- +// CNetworkInfo::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CNetworkInfo::GetCurrentRegisterNw() + { + return iMMNetworkInfo; + } + // End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/cpositioninfo.cpp --- a/locationmanager/locationtrail/src/cpositioninfo.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/cpositioninfo.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -43,7 +43,8 @@ // CPositionInfo::CPositionInfo( MPositionInfoObserver* aTrail ) : CActive( CActive::EPriorityStandard ), - iFirstInterval( ETrue ) + iState( EPositionOptStateNone ), + iConnectedPositionServer(EFalse) { LOG( "CPositionInfo::CPositionInfo()"); CActiveScheduler::Add( this ); @@ -75,9 +76,7 @@ // EXPORT_C CPositionInfo::~CPositionInfo() { - Cancel(); - iPositioner.Close(); - iPosServer.Close(); + Stop(); } // -------------------------------------------------------------------------- @@ -96,34 +95,41 @@ void CPositionInfo::StartL( RLocationTrail::TTrailCaptureSetting aCaptureSetting, TInt aUpdateInterval ) { LOG( "CPositionInfo::StartL(), begin" ); - + if(IsActive()) + { + Cancel(); + } iTrailCaptureSetting = aCaptureSetting; iUpdateInterval = aUpdateInterval; - iFirstInterval = ETrue; - iPositionInfo = TPositionSatelliteInfo(); + iState = EPositionOptStateNone; - // Set update interval. - iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) ); - // Set time out level. - iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds( KFirstTimeOut) ); - // Positions which have time stamp below KMaxAge can be reused - iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) ); - // Disables location framework to send partial position data - iUpdateOptions.SetAcceptPartialUpdates( EFalse ); + iPositionInfo = TPositionSatelliteInfo(); if ( aCaptureSetting == RLocationTrail::ECaptureAll ) { - User::LeaveIfError( iPosServer.Connect() ); - User::LeaveIfError( iPositioner.Open( iPosServer ) ); - User::LeaveIfError( iPositioner.SetRequestor( CRequestor::ERequestorService, - CRequestor::EFormatApplication, KRequestor ) ); - User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) ); - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); + if(!iConnectedPositionServer) + { + // Positions which have time stamp below KMaxAge can be reused + iUpdateOptions.SetMaxUpdateAge( TTimeIntervalMicroSeconds(KMaxAge) ); + // Disables location framework to send partial position data + iUpdateOptions.SetAcceptPartialUpdates( EFalse ); + User::LeaveIfError( iPosServer.Connect() ); + CleanupClosePushL(iPosServer); + User::LeaveIfError( iPositioner.Open( iPosServer ) ); + CleanupClosePushL(iPositioner); + User::LeaveIfError( iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, KRequestor ) ); + iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds (iUpdateInterval) ); + iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut ) ); + User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) ); + CleanupStack::Pop(2); // iPositioner, iPosServer + iConnectedPositionServer = ETrue; + } + iState = EPositionOptStateGetLastKnownPosition; + iPositioner.GetLastKnownPosition( iPositionInfo, iStatus ); + SetActive(); } - - SetActive(); - - if ( aCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) + else if ( aCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) { TRequestStatus* status = &iStatus; User::RequestComplete( status, KErrNone ); @@ -138,19 +144,25 @@ // void CPositionInfo::NextPosition() { - iPositionInfo = TPositionSatelliteInfo(); // Clear position info. - if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll ) - { - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); - } - - SetActive(); - - if ( iTrailCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - } + LOG( "CPositionInfo::NextPosition(), begin" ); + if(!IsActive() && iConnectedPositionServer) + { + LOG("Not active"); + iPositionInfo = TPositionSatelliteInfo(); // Clear position info. + if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll ) + { + iState = EPositionOptStateNotifyUpdate; + iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); + SetActive(); + } + else if ( iTrailCaptureSetting == RLocationTrail::ECaptureNetworkInfo ) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + LOG( "CPositionInfo::NextPosition(), end" ); } // -------------------------------------------------------------------------- @@ -159,10 +171,17 @@ // void CPositionInfo::Stop() { + LOG( "CPositionInfo::Stop(), begin" ); Cancel(); - - iPositioner.Close(); - iPosServer.Close(); + if(iConnectedPositionServer) + { + iPositioner.Close(); + iPosServer.Close(); + iConnectedPositionServer = EFalse; + } + // reset the state + iState = EPositionOptStateNone; + LOG( "CPositionInfo::Stop(), end" ); } // -------------------------------------------------------------------------- @@ -171,22 +190,39 @@ // void CPositionInfo::RunL() { - iTrail->Position( iPositionInfo, iStatus.Int() ); - - if ( iFirstInterval && IsActive() ) + LOG( "CPositionInfo::RunL(), begin" ); + if(iState == EPositionOptStateGetLastKnownPosition) + { + // get last location.. check the time and if it's within the limit, pass to trail. + const TTimeIntervalSeconds KMaxAllowedLastKnownPosition(60*5); // 5 mins + TTimeIntervalSeconds interval; + TTime now; + TPosition lastPosition; + iPositionInfo.GetPosition(lastPosition); + now.UniversalTime(); + now.SecondsFrom(lastPosition.Time(), interval); + if(iStatus.Int() == KErrNone && interval < KMaxAllowedLastKnownPosition) + { + LOG("Last know position is recent one"); + iTrail->Position( iPositionInfo, iStatus.Int() ); + } + else + { + LOG("Old last know position. Drop it.."); + } + } + else + { + // notify response.. always pass to trail + iTrail->Position( iPositionInfo, iStatus.Int() ); + } + + if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll && + iState != EPositionOptStateNone) { - Cancel(); - LOG("CPositionInfo::RunL() - First Time"); - iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds (iUpdateInterval) ); - iUpdateOptions.SetUpdateTimeOut( TTimeIntervalMicroSeconds(KUpdateTimeOut ) ); - if ( iTrailCaptureSetting == RLocationTrail::ECaptureAll ) - { - User::LeaveIfError( iPositioner.SetUpdateOptions( iUpdateOptions ) ); - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); - } - SetActive(); - iFirstInterval = EFalse; + NextPosition(); } + LOG( "CPositionInfo::RunL(), end" ); } // -------------------------------------------------------------------------- @@ -195,11 +231,37 @@ // void CPositionInfo::DoCancel() { - LOG( "CPositionInfo::DoCancel()" ); - if ( IsActive() ) + LOG( "CPositionInfo::DoCancel(), begin" ); + switch(iState) { - iPositioner.CancelRequest( EPositionerNotifyPositionUpdate ); + case EPositionOptStateGetLastKnownPosition: + { + iPositioner.CancelRequest( EPositionerGetLastKnownPosition ); + break; + } + case EPositionOptStateNotifyUpdate: + { + iPositioner.CancelRequest( EPositionerNotifyPositionUpdate ); + break; + } + default: + break; } + iState = EPositionOptStateNone; + LOG( "CPositionInfo::DoCancel(), end" ); + } + + +// -------------------------------------------------------------------------- +// CPositionInfo::HandleRemapComplete +// -------------------------------------------------------------------------- +// +void CPositionInfo::HandleRemapComplete() + { + LOG( "CPositionInfo::HandleRemapComplete()" ); + // Don't call notify update from RunL + iState = EPositionOptStateNone; } // End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/ctracklog.cpp --- a/locationmanager/locationtrail/src/ctracklog.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/ctracklog.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -68,6 +68,7 @@ EXPORT_C CTrackLog::~CTrackLog() { delete iGpxConverter; + iGpxConverter = NULL; iFs.Close(); } @@ -201,6 +202,7 @@ if ( err == KErrNone ) { delete lastCoords; + lastCoords = NULL; lastCoords = new TCoordinate( aTrailItem.iLocationData.iPosition ); iBoundaries->distance += distance; } @@ -221,6 +223,8 @@ RFile64 file; RFileWriteStream writer; + CleanupClosePushL( writer ); + TInt err; err = file.Open( iFs, iTmpFileName, EFileRead ); if ( err != KErrNone ) @@ -247,8 +251,6 @@ writer.Sink()->SeekL( MStreamBuf::EWrite, TStreamPos( endpos )); } - CleanupClosePushL( writer ); - TInt count = iTrackLogItemArray.Count(); for( TInt i = 0; i < count; i++ ) @@ -306,7 +308,9 @@ } } delete filename; + filename = NULL; delete files; + files = NULL; } void CTrackLog::ReadCenRepValueL(TInt aKey, TInt& aValue) diff -r 63c982fb92f2 -r b73252188534 locationmanager/locationtrail/src/locationremappingao.cpp --- a/locationmanager/locationtrail/src/locationremappingao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/locationtrail/src/locationremappingao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -24,6 +24,11 @@ using namespace MdeConstants; + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::NewL() +// -------------------------------------------------------------------------- +// CLocationRemappingAO* CLocationRemappingAO::NewL() { LOG( "CLocationRemappingAO::NewL" ); // DEBUG INFO @@ -35,6 +40,10 @@ return self; } +// -------------------------------------------------------------------------- +// CLocationRemappingAO::ConstructL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::ConstructL() { LOG( "CLocationRemappingAO::ConstructL" ); // DEBUG INFO @@ -49,6 +58,10 @@ } } +// -------------------------------------------------------------------------- +// CLocationRemappingAO::~CLocationRemappingAO() +// -------------------------------------------------------------------------- +// CLocationRemappingAO::~CLocationRemappingAO() { LOG( "CLocationRemappingAO::~CLocationRemappingAO" ); // DEBUG INFO @@ -59,6 +72,10 @@ iObjects.ResetAndDestroy(); } +// -------------------------------------------------------------------------- +// CLocationRemappingAO::CLocationRemappingAO() +// -------------------------------------------------------------------------- +// CLocationRemappingAO::CLocationRemappingAO() : CActive( CActive::EPriorityStandard ), iState ( EIdle ), iContinue( EFalse ), @@ -71,7 +88,10 @@ // No implementation required } - +// -------------------------------------------------------------------------- +// CLocationRemappingAO::InitialiseL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::InitialiseL(CMdESession* aMdEClient) { LOG( "CLocationRemappingAO::Initialise start" ); // DEBUG INFO @@ -97,21 +117,41 @@ LOG( "CLocationRemappingAO::Initialise end" ); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::Append() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::Append( TRemapItem aItem ) { iRemapItems.Append( aItem ); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::ResetQueue() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::ResetQueue() { iRemapItems.Reset(); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::ItemsInQueue() +// -------------------------------------------------------------------------- +// TBool CLocationRemappingAO::ItemsInQueue() { return iRemapItems.Count() > 0; } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::CheckQueue() +// -------------------------------------------------------------------------- +// TBool CLocationRemappingAO::CheckQueue() { LOG( "CLocationRemappingAO::CheckQueue - start" ); @@ -165,13 +205,21 @@ return create; } - +// -------------------------------------------------------------------------- +// CLocationRemappingAO::StopRemapping() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::StopRemapping() { LOG( "CLocationRemappingAO::StopRemapping" ); // DEBUG INFO NextState(EIdle); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::StartRemappingObjects() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::StartRemappingObjects( const TLocationData& aLocationData ) { iLocationData = aLocationData; @@ -185,6 +233,11 @@ NextState( ERemapObjects ); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::NextState() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::NextState(TMappingState aState) { LOG1( "CLocationRemappingAO::NextState - state: %d", aState ); // DEBUG INFO @@ -198,6 +251,11 @@ } } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::DoCancel() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::DoCancel() { LOG( "CLocationRemappingAO::DoCancel" ); // DEBUG INFO @@ -205,6 +263,11 @@ NextState(EIdle); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::RunError() +// -------------------------------------------------------------------------- +// TInt CLocationRemappingAO::RunError( TInt aError ) { if (aError != KErrNone) @@ -216,6 +279,11 @@ return KErrNone; } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::RunL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::RunL() { LOG1( "CCameraTrailMonitorAO::RunL iStatus: %d", iStatus.Int() ); // DEBUG INFO @@ -252,7 +320,10 @@ } } - +// -------------------------------------------------------------------------- +// CLocationRemappingAO::RemapObjectsL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::RemapObjectsL() { LOG( "CLocationRemappingAO::RemapObjects - start" ); // DEBUG INFO @@ -314,12 +385,14 @@ relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId ); if(relation) - { + { + CleanupStack::PushL(relation); TTime timestamp( 0 ); timestamp.UniversalTime(); relation->SetLastModifiedDate( timestamp ); iMdEClient->UpdateRelationL( *relation ); + CleanupStack::PopAndDestroy(relation); } } @@ -331,6 +404,11 @@ LOG( "CLocationRemappingAO::RemapObjects - end" ); } + +// -------------------------------------------------------------------------- +// CLocationRemappingAO::CommitObjectsL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::CommitObjectsL() { LOG( "CLocationRemappingAO::CommitObjects" ); // DEBUG INFO @@ -360,7 +438,10 @@ LOG( "CLocationRemappingAO::ReadTimeFromCenRepL(), end" ); } - +// -------------------------------------------------------------------------- +// CLocationRemappingAO::UpdateRelationsL() +// -------------------------------------------------------------------------- +// void CLocationRemappingAO::UpdateRelationsL( TItemId aLocationId ) { LOG("CLocationRemappingAO::UpdateRelationsL - start"); @@ -381,14 +462,16 @@ iRemapItems[i].iObjectId, aLocationId, 0 ); iMdEClient->AddRelationL( *relationObject ); CleanupStack::PopAndDestroy( relationObject ); - LOG("CLocationRemappingAO::UpdateRelationsL - new relation created"); + LOG("new relation created"); } else { CMdERelation* relationObject = iMdEClient->GetRelationL( iRemapItems[i].iRelationId ); + CleanupStack::PushL(relationObject); relationObject->SetRightObjectIdL( aLocationId ); iMdEClient->UpdateRelationL( *relationObject ); - LOG("CLocationRemappingAO::UpdateRelationsL - old relation updated"); + CleanupStack::PopAndDestroy(relationObject); + LOG("old relation updated"); } iRemapItems.Remove( i ); } @@ -396,6 +479,30 @@ LOG("CLocationRemappingAO::UpdateRelationsL - end"); } +#ifdef LOC_REVERSEGEOCODE +// -------------------------------------------------------------------------- +// CLocationRemapping::AttachGeoTagsL +// -------------------------------------------------------------------------- +// +void CLocationRemappingAO::AttachGeoTagsL( CTagCreator *aTagCreator, + const TItemId aCountryTagId, const TItemId aCityTagId ) + { + LOG("CLocationRemapping::AttachGeoTagsL - start"); + + TInt count = iObjectIds.Count() - 1; + for( TInt i = count; i >= 0; i-- ) + { + aTagCreator->AttachTagsL( iObjectIds[i], aCountryTagId, aCityTagId ); + } + + iObjectIds.Reset(); + + LOG("CLocationRemapping::AttachGeoTagsL - end"); + } + +#endif //LOC_REVERSEGEOCODE + + // -------------------------------------------------------------------------- // TRemapItem constructor // -------------------------------------------------------------------------- @@ -409,3 +516,4 @@ } +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/group/locationmanagerserver.mmp --- a/locationmanager/server/group/locationmanagerserver.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/server/group/locationmanagerserver.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -18,19 +18,22 @@ #include #include +#include "../../inc/locplatsupport.mmh" VERSION 10.0 TARGETTYPE exe TARGET locationmanagerserver.exe UID 0 0x200071BE +EPOCSTACKSIZE 0x5000 + #ifdef WINS EPOCHEAPSIZE 1000 2500000 #else EPOCHEAPSIZE 1000 5000000 #endif -CAPABILITY CAP_SERVER +CAPABILITY CAP_SERVER Location VENDORID VID_DEFAULT USERINCLUDE ../inc @@ -38,11 +41,30 @@ USERINCLUDE ../../../inc USERINCLUDE ../../locationtrail/inc +#ifdef _LOC_REVERSEGEOCODE +MACRO LOC_REVERSEGEOCODE +USERINCLUDE ../../tagcreator/inc +USERINCLUDE ../../ReverseGeocode/inc +#endif + +#ifdef _LOC_GEOTAGGING_CELLID +MACRO LOC_GEOTAGGING_CELLID +USERINCLUDE ../../geoconverter/inc +#endif + + +SYSTEMINCLUDE /epoc32/include/platform/lbs +SYSTEMINCLUDE /epoc32/include/stdapis +SYSTEMINCLUDE /epoc32/include/ecom +MW_LAYER_SYSTEMINCLUDE + SOURCEPATH ../src SOURCE clocationmanagerserver.cpp SOURCE clocationmanagersession.cpp +SOURCE clocationgeotagtimerao.cpp +SOURCE clocationservertimerhandler.cpp +SOURCE nwregistrationstatushandler.cpp -MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY efsrv.lib @@ -52,9 +74,19 @@ LIBRARY centralrepository.lib LIBRARY mdeclient.lib LIBRARY mdccommon.lib +LIBRARY libc.lib +LIBRARY ecom.lib +LIBRARY etel.lib +LIBRARY etelmm.lib +LIBRARY commsdat.lib + +LIBRARY geotagger.lib PAGED BYTEPAIRCOMPRESSTARGET OPTION ARMCC -O3 -OTime EPOCPROCESSPRIORITY background + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/inc/clocationgeotagtimerao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/inc/clocationgeotagtimerao.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: 3AM geo tagger handler +* +*/ + +#ifndef __CLOCATIONGEOTAGTIMERAO_H__ +#define __CLOCATIONGEOTAGTIMERAO_H__ + + +// INCLUDES +#include +#include +#include +#include + +class CLocationGeoTagTimerAO : public CTimer, + public MGeoTaggerObserver +{ + +public: + /** + * 1st phase constructor. + * @param aMdeSession, CMdESession reference + */ + static CLocationGeoTagTimerAO* NewL(CMdESession& aMdeSession, + MGeoTaggerObserver& aObserver); + + /** + * Destructor + */ + ~CLocationGeoTagTimerAO(); + + /** + * Start 3AM timer + */ + void StartTimer(); + + +protected: + /* + * @see CActive::RunL() + */ + void RunL(); + // MGeoTaggerObserver + /** + * This method is used for notifying that the Geo Tagging is Completed, from MGeoTaggerObserver + * @param aError, TInt value to indicate if there is any error in geotagging + * @return None. + */ + void GeoTaggingCompleted( const TInt aError ); + + /** + * This method is used for notifying completion of query for pending geo tags from MGeoTaggerObserver + * @param aError, TInt value to indicate if there is any error in geotagging + * @return None. + */ + void PendingGeoTagReqComplete( const TInt aError ); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + TBool IsRegisteredAtHomeNetwork(); + + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); + +private: + + /** + * 2nd Phase constructor + */ + void ConstructL(); + + /** + * CLocationGeoTagTimerAO + * Constructor + * @param aMdeSession, CMdESession reference + * @return None. + */ + CLocationGeoTagTimerAO(CMdESession& aMdeSession, MGeoTaggerObserver& aObserver); + +private: + CGeoTagger* iGeoTagger; + CMdESession& iMdeSession; + MGeoTaggerObserver& iObserver; +}; + + +#endif /*__CLOCATIONGEOTAGTIMERAO_H__*/ + +// End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/inc/clocationmanagerserver.h --- a/locationmanager/server/inc/clocationmanagerserver.h Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/server/inc/clocationmanagerserver.h Thu Aug 19 10:20:41 2010 +0300 @@ -24,6 +24,9 @@ #include #include #include +#ifdef LOC_REVERSEGEOCODE +#include +#endif //LOC_REVERSEGEOCODE #include "rlocationtrail.h" #include "rlocationobjectmanipulator.h" @@ -35,9 +38,13 @@ #include "mdequery.h" #include "mderelationquery.h" #include "locationmanagerdefs.h" - +#include "clocationservertimerhandler.h" class CMdESession; +class CLocationGeoTagTimerAO; +class CGeoTagger; +class REComSession; +class CNwRegistrationStatusHandler; // Total number of ranges const TUint KLocationManagerRangeCount = 1; @@ -85,7 +92,9 @@ public MMdESessionObserver, public MMdEQueryObserver, public MMdEObjectObserver, - public MGpxConversionObserver + public MGpxConversionObserver, + public MGeoTaggerObserver, + public MLocationServerTimerObserver { private: struct TMessageQuery @@ -259,30 +268,122 @@ * @return None. */ void RemoveLocationObjectL(TUint& aObjectId); + + /** + * Copies the location object + * @param aSource source location object + * @param aTargets target location object + * @param aQuery message query type + + */ void CopyLocationObjectL( TItemId aSource, const RArray& aTargets, TMessageQuery& aQuery ); + + /** + * Copies the location object + * @param aSource The source location object + * @param aTargets target location object + * @param aQuery message query type + */ void CopyLocationObjectL( const TDesC& aSource, const RArray& aTargets, TMessageQuery& aQuery ); - + + /** + * checks if the session is ready + * @return ETrue if Session is ready + */ TBool IsSessionReady(); - + + /** + * Start track log + * + * @return The itemId + */ TItemId StartTrackLogL(); - + + /** + * Stop track log + * + */ void StopTrackLogL(); - + + /** + * IsTrackLogRecording + * + * @param aRec + */ void IsTrackLogRecording( TBool &aRec ); + /** + * Retrieve track log status + * + * @param aRecording + * @param aFixQuality + */ TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality); - + + /** + * Delete track log + * + * @param aUri + */ TInt DeleteTrackLogL(const TDesC& aUri); - + + /** + * Track log name + * + * @param aFileName name of file used to track log + */ TInt TrackLogName(TFileName& aFileName); + /** + * Gets the location trail capture settings + * @param aCaptureSetting The location trail capture settings + */ void GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting ); - + + /** + * Adds an observer for Gpx conversion + * @param aObserver the observer for Gpx conversion + */ void AddGpxObserver( MGpxConversionObserver* aObserver ); + /** + * Copy location by Id + * @param aMessage + */ void InitCopyLocationByIdL( const RMessage2& aMessage ); + + /** + * Copy Location by Uri + * @param aMessage + */ void InitCopyLocationByURIL( const RMessage2& aMessage ); + /** + * Handles tag pending request + * + * @param aMessage IPC message + */ + void TagPendingRequestL( const RMessage2& aMessage ); + + /** + * Cancels the tag pending request + * @param aMessage IPC message + */ + void CancelTagPendingRequest( const RMessage2& aMessage ); + + /** + * Cancels the geotagging request + * @param aMessage IPC message + */ + void CancelGeoTaggingRequest( const RMessage2& aMessage ); + + + /** + * Handle starts geotagging request + * @param aMessage IPC message + */ + void StartGeoTaggingL( const RMessage2& aMessage ); + public: // from MLocationTrailObserver. /** * Callback method to get notification about trail state change. @@ -340,6 +441,52 @@ void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength, TTime aStart, TTime aEnd ); +protected: //From MGeoTaggerObserver + + /** + * This method is called on completion of geotagging + * and also completes start geotagging IPC message + * @param aError The err code for geotagging if any + */ + void GeoTaggingCompleted( const TInt aError ); + /** + * This method is used for notifying completion of query for pending geo tags + * @param aError The err code for geotagging if any + */ + void PendingGeoTagReqComplete( const TInt aError ); + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw(); + + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag); + + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + TBool IsRegisteredAtHomeNetwork(); + +public: //MLocationServerTimerObserver + /** + * Timer call back + * @param aLocationServerTimerType timer type + * @param aErrorCode error code + */ + void LocationServerTimerCallBackL + (const TLocationServerTimerType aLocationServerTimerType, const TInt aErrorCode); private: /** * C++ constructor. @@ -350,7 +497,11 @@ * 2nd phase constructor. */ void ConstructL(); - + + /** + * Copies the location + * @param aQuery The query + */ void CopyLocationL( CMdEQuery& aQuery ); /** @@ -359,7 +510,10 @@ */ void CancelRequests(RArray& aMessagesList); - + /** + * cancels the list of copy requests + * @param aMessageList the list of query + */ void CancelCopyRequests(RArray& aMessageList); /** @@ -396,21 +550,49 @@ * @param aAny, a pointer to CLocationRecord object * @return Error code */ - static TInt PositioningStopTimeout( TAny* aAny ); + void PositioningStopTimeout(); /** * Callback function to check if files were added to remapping queue with delay * @param aAny, a pointer to CLocationRecord object * @return Error code */ - static TInt CheckForRemappingCallback( TAny* aAny ); + void CheckForRemappingCallback(); + /** * Stops location trail and deletes the positioning stop timer. */ void StopRecording(); + + /** + * Complete notify request + * + * @param aEventType, returns the event type + * @param aError, return error type for this call. + */ + void CompleteNotifyRequest( TEventTypes aEventType, TInt aError ); + + /** + * Get supported TSY name + *@param aTsyName - buffer to store the supported tsy name + */ + void GetCommDbTSYnameL(TDes& aTsyName); + + /** + * Initialize etel to access modem parameters + */ + void InitialisePhoneL(); + + /** + * Retrieve home network + */ + void RetrieveHomeNetwork(); - void CompleteNotifyRequest( TEventTypes aEventType, TInt aError ); + /** + * Stop the server (if possible) + */ + void StopServer(); private: /** @@ -466,7 +648,7 @@ * A timer to stop location trail. * Own. */ - CPeriodic* iTimer; + CLocationServerTimerHandler* iTimer; TBool iClientSwitch; TInt iSessionCount; @@ -478,12 +660,28 @@ TInt iLocManStopRemapDelay; RLocationTrail::TTrailCaptureSetting iCaptureSetting; - TBool iRemoveLocation; + TBool iRemoveLocation; /** * A flag for state of waiting for position stop timeout. */ TBool iWaitForPositioningStopTimeout; + RTelServer iTelServer; + RMobilePhone iPhone; + TBool iTelServerIsOpen; + TBool iPhoneIsOpen; + CNwRegistrationStatusHandler *iNwRegistrationStatusHandler; + RMobilePhone::TMobilePhoneNetworkInfoV1 iHomeNetwork; + TBool iHomeNwInfoAvailableFlag; + + CLocationGeoTagTimerAO* iGeoTagTimer; + +#ifdef LOC_REVERSEGEOCODE + CGeoTagger* iGeoTaggingPendingReqObj; + RMessage2 iTagPendingMessage; + RMessage2 iGeoTaggingMessage; + REComSession* iEcomSession; +#endif //LOC_REVERSEGEOCODE }; diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/inc/clocationservertimerhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/inc/clocationservertimerhandler.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: helper class to handle location server tiimer related functionality +* +*/ + +#ifndef __CLOCATIONSERVERTIMERHANDLER_H__ +#define __CLOCATIONSERVERTIMERHANDLER_H__ + + +// INCLUDES +#include +#include + + +/* +* Timer Observer class +*/ + +class MLocationServerTimerObserver + { +public: + typedef enum + { + EStopRecording = 0x1, // Stop recording + EPositioningStopTimeout, // Stop positioning + ELocGeneralPurpose // generic purpose + }TLocationServerTimerType; + /** + * Timer call back + * @param aLocationServerTimerType timer type + * @param aErrorCode error code + */ + virtual void LocationServerTimerCallBackL + (const TLocationServerTimerType aLocationServerTimerType, const TInt aErrorCode) = 0; + }; + +/* +* Helper class for location server related to timer functionality. +*/ +class CLocationServerTimerHandler : public CTimer + { + +public: + /** + * 1st phase constructor. + * @param aLocationServerTimerObserver timer observer + */ + static CLocationServerTimerHandler* NewL(MLocationServerTimerObserver& aLocationServerTimerObserver); + + /** + * Destructor + */ + ~CLocationServerTimerHandler(); + + /** + * start a timer for predefined period + * @param anInterval timer value + * @param aLocationServerTimerType timer type + */ + void StartTimer(const TTimeIntervalMicroSeconds32 anInterval, + const MLocationServerTimerObserver::TLocationServerTimerType aLocationServerTimerType); + + +protected: + /* + * @see CActive::RunL() + */ + void RunL(); +private: + /** + * 2nd Phase constructor + */ + void ConstructL(); + /** + * CLocationServerTimerHandler + * Constructor + * @param aLocationServerTimerObserver timer observer + * @return None. + */ + CLocationServerTimerHandler(MLocationServerTimerObserver& aLocationServerTimerObserver); + + + +private: + MLocationServerTimerObserver& iLocationServerTimerObserver; + MLocationServerTimerObserver::TLocationServerTimerType iLocationServerTimerType; + }; + + +#endif /*__CLOCATIONSERVERTIMERHANDLER_H__*/ + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/inc/nwregistrationstatushandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/inc/nwregistrationstatushandler.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Helper class to retrieve UE network registration status +* +*/ + +#ifndef __NW_REGISTRATION_STATUS_HANDLER_H__ +#define __NW_REGISTRATION_STATUS_HANDLER_H__ + + +// INCLUDES +#include +#include +#include + +NONSHARABLE_CLASS(CNwRegistrationStatusHandler) : public CActive +{ + +public: + + /** + * 1st phase constructor + * @param aMobilePhone an instance of the RMobilePhone to get the current network + */ + static CNwRegistrationStatusHandler* NewL(RMobilePhone& aMobilePhone); + + /** + * destructor + */ + ~CNwRegistrationStatusHandler(); + + /** + * Register for getting the n/w registration change notification + * starts notifying the current network changes + */ + void StartNotifier(); + + /** + * Retrieve network registration status + * @return the mobilephone reg status + */ + + RMobilePhone::TMobilePhoneRegistrationStatus GetNetworkRegistrationStatus() const; + +protected: + + /** + * RunL + * from CActive + */ + void RunL(); + + /** + * DoCancel + * from CActive + */ + void DoCancel(); + private: + + /** + * Second phase construction + */ + void ConstructL(); + CNwRegistrationStatusHandler(RMobilePhone& aMobilePhone); + + + +private: + typedef enum + { + ERegStatusOptStateNone = 0x00, + ERegStatusOptStateGet, + ERegStatusOptStateNotify + }TRegStatusOptState; + + /** + * An instance of the RMobilePhone to get the current network + */ + RMobilePhone& iMobilePhone; + + /** + * Indicates the network registration status + */ + RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus; + TRegStatusOptState iState; +}; + + +#endif /*__NW_REGISTRATION_STATUS_HANDLER_H__*/ + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS Location Manager Server + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/sis/locationmanagerserver_stub.sis Binary file locationmanager/server/sis/locationmanagerserver_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"LocationManagerServer Patch"},(0x200071BE), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"locationmanagerserver"}, (0x200071BE), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/src/clocationgeotagtimerao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/src/clocationgeotagtimerao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements geotagging 3AM timer +* +*/ + +#include "clocationgeotagtimerao.h" +#include +#include +#include +#include "locationmanagerdebug.h" + + + +//Time at which the geotagging should be triggered( 3.00 AM ) +const TInt GEOTAGGING_TIME_IN_HOURS = 3; +//Hour specified in minutes +const TInt HOUR_VALUE_IN_MINUTES = 60; +//Hour specified in seconds +const TInt HOUR_VALUE_IN_SECONDS = 3600; + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::CLocationGeoTagTimerAO +// -------------------------------------------------------------------------- +// +CLocationGeoTagTimerAO::CLocationGeoTagTimerAO(CMdESession& aMdeSession, + MGeoTaggerObserver& aObserver): + CTimer(EPriorityStandard ), + iGeoTagger(NULL), + iMdeSession(aMdeSession), + iObserver(aObserver) +{ + +} + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO +// -------------------------------------------------------------------------- +// +CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO() + { + LOG ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), begin"); + if(iGeoTagger) + { + delete iGeoTagger; + iGeoTagger = NULL; + } + LOG ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), end"); + } + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::NewL +// -------------------------------------------------------------------------- +// +CLocationGeoTagTimerAO* CLocationGeoTagTimerAO::NewL(CMdESession& aMdeSession, + MGeoTaggerObserver& aObserver) + { + CLocationGeoTagTimerAO* self = + new( ELeave ) CLocationGeoTagTimerAO(aMdeSession, aObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + + return self; + } + + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::ConstructL +// -------------------------------------------------------------------------- +// +void CLocationGeoTagTimerAO::ConstructL() + { + LOG ("CLocationGeoTagTimerAO::ConstructL(), begin"); + CActiveScheduler::Add(this); + CTimer::ConstructL(); + LOG ("CLocationGeoTagTimerAO::ConstructL(), end"); + } + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::StartTimer +// -------------------------------------------------------------------------- +// +void CLocationGeoTagTimerAO::StartTimer() + { + LOG ("CLocationGeoTagTimerAO::StartTimer(), begin"); + if(!IsActive()) + { + TTime hometime; + hometime.HomeTime(); + + //Get the current time in Hour,Minute, Second + TDateTime currentDateTime = hometime.DateTime(); + TInt currentHr = currentDateTime.Hour(); + TInt currentMin = currentDateTime.Minute(); + TInt currentSec = currentDateTime.Second(); + + //3 AM in seconds + TInt targetTimeInSeconds = GEOTAGGING_TIME_IN_HOURS * HOUR_VALUE_IN_SECONDS; + 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 ) + { + timeDifference = targetTimeInSeconds - + ( ( currentHr * HOUR_VALUE_IN_SECONDS ) + ( currentMin * HOUR_VALUE_IN_MINUTES ) + currentSec ); + } + else + { + timeDifference = ( 24 * HOUR_VALUE_IN_SECONDS - ( + ( currentHr * HOUR_VALUE_IN_SECONDS ) + ( currentMin * HOUR_VALUE_IN_MINUTES ) + currentSec ) ) + + targetTimeInSeconds ; + } + + //Add the time difference to current time to set the target time ( 3.00 AM ) + TTimeIntervalSeconds interval( timeDifference ); + TTime timeToSet; + timeToSet.HomeTime(); + timeToSet+= interval; + + + At( timeToSet ); + } + LOG ("CLocationGeoTagTimerAO::StartTimer(), end"); + } + + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::RunL +// -------------------------------------------------------------------------- +// +void CLocationGeoTagTimerAO::RunL( ) + { + LOG ("CLocationGeoTagTimerAO::RunL(), begin"); + TInt status = iStatus.Int(); + LOG1 ("Timedout error - %d", status); + + switch( status ) + { + case KErrNone: + { + //Trigger the reverse geocoding and start the timer again + //Create the instance of geotagger class + 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"); + } + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::GeoTaggingCompleted +// -------------------------------------------------------------------------- +// +void CLocationGeoTagTimerAO::GeoTaggingCompleted( const TInt aError ) + { + LOG ("CLocationGeoTagTimerAO::GeoTaggingCompleted(), begin"); + StartTimer(); + iObserver.GeoTaggingCompleted(aError); + LOG ("CLocationGeoTagTimerAO::GeoTaggingCompleted(), end"); + } + +// -------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::PendingGeoTagReqComplete +// -------------------------------------------------------------------------- +// +void CLocationGeoTagTimerAO::PendingGeoTagReqComplete( const TInt aError ) + { + LOG ("CLocationGeoTagTimerAO::PendingGeoTagReqComplete()"); + // do nothing. + iObserver.PendingGeoTagReqComplete(aError); + } + +// ---------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CLocationGeoTagTimerAO::GetCurrentRegisterNw() + { + LOG( "CLocationGeoTagTimerAO::GetCurrentRegisterNw ,begin" ); + return iObserver.GetCurrentRegisterNw(); + } + + +// ---------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::IsRegisteredAtHomeNetwork() +// ---------------------------------------------------------------------------- +TBool CLocationGeoTagTimerAO::IsRegisteredAtHomeNetwork() + { + LOG( "CLocationGeoTagTimerAO::IsRegisteredAtHomeNetwork" ); + return iObserver.IsRegisteredAtHomeNetwork(); + } + +// ---------------------------------------------------------------------------- +// CLocationGeoTagTimerAO::GetHomeNetworkInfo() +// ---------------------------------------------------------------------------- +const RMobilePhone::TMobilePhoneNetworkInfoV1& + CLocationGeoTagTimerAO::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) + { + LOG( "CLocationGeoTagTimerAO::GetHomeNetworkInfo" ); + return iObserver.GetHomeNetworkInfo(aHomeNwInfoAvailableFlag); + } + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/src/clocationmanagerserver.cpp --- a/locationmanager/server/src/clocationmanagerserver.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/server/src/clocationmanagerserver.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -17,6 +17,10 @@ #include #include +#include +#include +#include +#include #include "clocationmanagerserver.h" #include "clocationmanagersession.h" @@ -29,8 +33,12 @@ #include "mdeobjectdef.h" #include "mdepropertydef.h" #include "mdcserializationbuffer.h" +#include "clocationgeotagtimerao.h" +#include "nwregistrationstatushandler.h" using namespace MdeConstants; +using namespace CommsDat; + // -------------------------------------------------------------------------- // RunServerL @@ -68,6 +76,7 @@ { TRAP( ret, RunServerL() ); delete cleanup; + cleanup = NULL; } return ret; } @@ -91,9 +100,10 @@ // -------------------------------------------------------------------------- // CLocationManagerServer::CLocationManagerServer() - : CPolicyServer( CActive::EPriorityStandard, + : CPolicyServer( KLocManagerSessionPriority, KLocationManagerPolicy, ESharableSessions ), + iASW(NULL), iTimer( NULL ), iSessionReady( EFalse ), iTagId( 0 ), @@ -101,7 +111,16 @@ iLocManStopRemapDelay( 0 ), iCaptureSetting( RLocationTrail::EOff ), iRemoveLocation( EFalse ), - iWaitForPositioningStopTimeout ( EFalse ) + iWaitForPositioningStopTimeout ( EFalse ), + iTelServerIsOpen(EFalse), + iPhoneIsOpen(EFalse), + iNwRegistrationStatusHandler(NULL), + iHomeNwInfoAvailableFlag(EFalse), + iGeoTagTimer(NULL) +#ifdef LOC_REVERSEGEOCODE + ,iGeoTaggingPendingReqObj(NULL) + ,iEcomSession(NULL) +#endif //LOC_REVERSEGEOCODE { } @@ -115,18 +134,22 @@ LOG ("CLocationManagerServer::ConstructL() begin"); StartL( KLocServerName ); + + // initialize etel + InitialisePhoneL(); - RProcess process; - process.SetPriority( EPriorityBackground ); - process.Close(); - +#ifdef LOC_REVERSEGEOCODE + iEcomSession = &(REComSession::OpenL()); +#endif //LOC_REVERSEGEOCODE + iASW = new (ELeave) CActiveSchedulerWait(); - iMdeSession = CMdESession::NewL( *this ); - iLocationRecord = CLocationRecord::NewL(); + + iNwRegistrationStatusHandler = CNwRegistrationStatusHandler::NewL(iPhone); + + iLocationRecord = CLocationRecord::NewL(*this, iPhone); iTrackLog = CTrackLog::NewL(); - - iASW->Start(); - + iMdeSession = CMdESession::NewL( *this ); + iLocationRecord->SetObserver( this ); iLocationRecord->SetAddObserver( iTrackLog ); @@ -134,34 +157,55 @@ iTrackLog->AddGpxObserver( this ); CRepository* repository = CRepository::NewLC( KRepositoryUid ); - TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); - - LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay:%d", iLocManStopDelay); + TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); + + LOG1("iLocManStopDelay:%d", iLocManStopDelay); if ( err != KErrNone ) - { - LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay err:%d", err); + { + LOG1("iLocManStopDelay err:%d", err); iLocManStopDelay = KLocationTrailShutdownDelay; - } + } err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay ); CleanupStack::PopAndDestroy( repository ); - LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay:%d", iLocManStopRemapDelay); + LOG1("iLocManStopRemapDelay:%d", iLocManStopRemapDelay); if ( err != KErrNone ) { - LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay err:%d", err); + LOG1("iLocManStopRemapDelay err:%d", err); iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; } - - TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); - if ( error != KErrNone ) + + if( !iSessionReady ) + { + iASW->Start(); + } + + delete iASW; + iASW = NULL; + + if( iSessionReady ) { - LOG("CLocationManagerServer::ConstructL - iTimer not created"); - iTimer = NULL; - } - + LOG("Session is ready to give service"); + //Create the instance of the geotagging timer object + // Create timer, if n/w or reverse geo code based feature flag is enabled +#if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) + iGeoTagTimer = CLocationGeoTagTimerAO::NewL(*iMdeSession, *this); + //Schedule a task for geotagging every day at 3.00 AM + iGeoTagTimer->StartTimer(); +#endif + } + else + { + LOG("Unable to open MDE session. Closing.."); + User::Leave( KErrCouldNotConnect ); + } + + RProcess process; + process.SetPriority( EPriorityBackground ); + process.Close(); LOG ("CLocationManagerServer::ConstructL() end"); } @@ -173,13 +217,30 @@ // CLocationManagerServer::~CLocationManagerServer() { + LOG("CLocationManagerServer::~CLocationManagerServer ,begin"); +#if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) + delete iGeoTagTimer; + iGeoTagTimer = NULL; +#endif +#ifdef LOC_REVERSEGEOCODE + delete iGeoTaggingPendingReqObj; + iGeoTaggingPendingReqObj = NULL; +#endif //LOC_REVERSEGEOCODE + delete iLocationRecord; + iLocationRecord = NULL; delete iTrackLog; + iTrackLog = NULL; delete iTimer; - //delete iRelationQuery; + iTimer = NULL; + delete iRelationQuery; + iRelationQuery = NULL; delete iASW; + iASW = NULL; delete iMdeSession; - + iMdeSession = NULL; + delete iNwRegistrationStatusHandler; + iNwRegistrationStatusHandler = NULL; iTargetObjectIds.Close(); CancelRequests(iNotifReqs); iNotifReqs.Close(); @@ -190,9 +251,115 @@ CancelCopyRequests(iCopyReqs); iCopyReqs.Close(); iSessionCount = 0; + if(iPhoneIsOpen) + { + iPhoneIsOpen = EFalse; // not required + iPhone.Close(); + } + if(iTelServerIsOpen) + { + iTelServerIsOpen = EFalse; + iTelServer.Close(); + } +#ifdef LOC_REVERSEGEOCODE + if(iEcomSession) + { + iEcomSession->Close(); + } +#endif //LOC_REVERSEGEOCODE + LOG("CLocationManagerServer::~CLocationManagerServer ,end"); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GetCommDbTSYnameL +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::GetCommDbTSYnameL(TDes& aTsyName) + { + LOG( "CLocationManagerServer::GetCommDbTSYnameL(), begin" ); +#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY + CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); +#else + CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); +#endif + CleanupStack::PushL(db); + + CMDBField* globalSettingField = new(ELeave) CMDBField(KCDTIdBearerAvailabilityCheckTSY); + CleanupStack::PushL(globalSettingField); + globalSettingField->SetRecordId(1); + globalSettingField->SetMaxLengthL(KMaxTextLength); + globalSettingField->LoadL(*db); + aTsyName = *globalSettingField; + CleanupStack::PopAndDestroy(globalSettingField); + + CleanupStack::PopAndDestroy(db); + LOG( "CLocationManagerServer::GetCommDbTSYnameL(), end" ); + } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::InitialisePhoneL // -------------------------------------------------------------------------- -// CLocationManagerServer::CompleteRequests() +// +void CLocationManagerServer::InitialisePhoneL() + { + LOG( "CLocationManagerServer::InitialisePhoneL(), begin" ); + User::LeaveIfError(iTelServer.Connect()); + iTelServerIsOpen = ETrue; + TBuf tsyName; + GetCommDbTSYnameL(tsyName); + + User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName)); + + TInt numPhones; + User::LeaveIfError(iTelServer.EnumeratePhones(numPhones)); + + TInt phoneIndx; + TInt ret = KErrHardwareNotAvailable; + + for(phoneIndx=0; phoneIndx& aMessageList) @@ -211,6 +378,10 @@ aMessageList.Reset(); } +// -------------------------------------------------------------------------- +// CLocationManagerServer::CancelCopyRequests +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CancelCopyRequests(RArray& aMessageList) { const TInt count = aMessageList.Count(); @@ -227,10 +398,14 @@ aMessageList.Reset(); } - +// -------------------------------------------------------------------------- +// CLocationManagerServer::HandleSessionOpened +// -------------------------------------------------------------------------- +// void CLocationManagerServer::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError) { - if ( iASW->IsStarted() ) + LOG ("CLocationManagerServer::HandleSessionOpened() start"); + if ( iASW && iASW->IsStarted() ) { iASW->AsyncStop(); } @@ -249,18 +424,31 @@ } } -void CLocationManagerServer::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/) + +// -------------------------------------------------------------------------- +// CLocationManagerServer::HandleSessionError +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::HandleSessionError(CMdESession& /*aSession*/, TInt aError) { + LOG1 ("CLocationManagerServer::HandleSessionError() start, Error - %d", aError); + ARG_USED(aError); iSessionReady = EFalse; delete iMdeSession; iMdeSession = NULL; - if ( iASW->IsStarted() ) + if ( iASW && iASW->IsStarted() ) { iASW->AsyncStop(); } } + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::IsSessionReady +// -------------------------------------------------------------------------- +// TBool CLocationManagerServer::IsSessionReady() { return iSessionReady; @@ -302,11 +490,9 @@ // void CLocationManagerServer::RemoveSession() { + LOG1( "CLocationManagerServer::RemoveSession. Session count - %d", iSessionCount); iSessionCount--; - if ( !iSessionCount ) - { - CActiveScheduler::Stop(); - } + StopServer(); } // -------------------------------------------------------------------------- @@ -334,7 +520,8 @@ if ( iTimer ) { - iTimer->Cancel(); + delete iTimer; + iTimer = NULL; } iLocationRecord->StartL( aCaptureSetting ); @@ -355,24 +542,19 @@ if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping ) { - if(!iTimer) + if(iTimer == NULL) { - TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); - if ( error != KErrNone ) - { - LOG("CLocationManagerServer::StopGPSPositioningL() - iTimer not created"); - iTimer = NULL; - } - } - if(iTimer) + TRAP_IGNORE(iTimer = CLocationServerTimerHandler::NewL(*this)); + } + if ( iTimer == NULL) { - iTimer->Cancel(); - iLocationRecord->SetStateToStopping(); - iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( CheckForRemappingCallback, this ) ); - } + // If timer can't be created we stop the location trail immediately. + iLocationRecord->Stop(); + } else { - iLocationRecord->Stop(); + iLocationRecord->SetStateToStopping(); + iTimer->StartTimer( iLocManStopDelay * 1000000, MLocationServerTimerObserver::EStopRecording); } } @@ -389,48 +571,61 @@ LOG( "CLocationManagerServer::StopRecording()" ); iWaitForPositioningStopTimeout = EFalse; iLocationRecord->Stop(); - if(iTimer) - { - iTimer->Cancel(); - } - + } + +// -------------------------------------------------------------------------- +// CLocationUtilityServer::LocationServerTimerCallBackL +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::LocationServerTimerCallBackL + (const TLocationServerTimerType aLocationServerTimerType, const TInt /*aErrorCode*/) + { + LOG1( "CLocationManagerServer::LocationServerTimerCallBackL, begin, Type - %d", + aLocationServerTimerType); + switch(aLocationServerTimerType) + { + case MLocationServerTimerObserver::EStopRecording: + CheckForRemappingCallback(); + break; + case MLocationServerTimerObserver::EPositioningStopTimeout: + PositioningStopTimeout(); + break; + case MLocationServerTimerObserver::ELocGeneralPurpose: + default: + // execution shouldn't come over here. + LOG("Invalid timer type"); + break; + } + LOG( "CLocationManagerServer::LocationServerTimerCallBackL, end" ); } // -------------------------------------------------------------------------- // CLocationUtilityServer::PositioningStopTimeout // -------------------------------------------------------------------------- // -TInt CLocationManagerServer::PositioningStopTimeout( TAny* aAny ) +void CLocationManagerServer::PositioningStopTimeout() { LOG( "CLocationManagerServer::PositioningStopTimeout" ); - CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny ); - self->StopRecording(); - - return KErrNone; + StopRecording(); } // -------------------------------------------------------------------------- -// CLocationUtilityServer::PositioningStopTimeout +// CLocationUtilityServer::CheckForRemappingCallback // -------------------------------------------------------------------------- // -TInt CLocationManagerServer::CheckForRemappingCallback( TAny* aAny ) +void CLocationManagerServer::CheckForRemappingCallback() { - LOG( "CLocationManagerServer::CheckForRemappingCallback" ); - CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny ); - - self->iTimer->Cancel(); - - if ( self->iLocationRecord->RemappingNeeded() && !self->iLocationRecord->IsLowBattery()) + LOG( "CLocationManagerServer::CheckForRemappingCallback, begin" ); + if ( iLocationRecord->RemappingNeeded() && !iLocationRecord->IsLowBattery()) { - self->iTimer->Start( self->iLocManStopRemapDelay * 1000000, 0, TCallBack( PositioningStopTimeout, self ) ); - self->iWaitForPositioningStopTimeout = ETrue; + iTimer->StartTimer( iLocManStopRemapDelay * 1000000, MLocationServerTimerObserver::EPositioningStopTimeout); + iWaitForPositioningStopTimeout = ETrue; } else { - self->StopRecording(); + StopRecording(); } - - return KErrNone; + LOG( "CLocationManagerServer::CheckForRemappingCallback, end" ); } // -------------------------------------------------------------------------- @@ -548,7 +743,7 @@ } // -------------------------------------------------------------------------- -// CLocationManagerServer::GetCurrentCellId +// CLocationManagerServer::GetCurrentNetworkInfo // -------------------------------------------------------------------------- // void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) @@ -630,6 +825,11 @@ LOG( "CLocationManagerServer::CurrentLocation(), end" ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GPSSignalQualityChanged +// -------------------------------------------------------------------------- +// void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) { LOG( "CLocationManagerServer::GPSSignalQualityChanged" ); @@ -677,7 +877,10 @@ } - +// -------------------------------------------------------------------------- +// CLocationManagerServer::CancelTrackLogNotificationRequest +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CancelTrackLogNotificationRequest( const TInt aHandle ) { LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), begin" ); @@ -704,6 +907,11 @@ LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), end" ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CreateLocationObjectL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData, const TUint& aObjectId ) { @@ -715,13 +923,21 @@ iLocationRecord->CreateLocationObjectL( aLocationData, aObjectId ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::LocationSnapshotL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::LocationSnapshotL( const TUint& aObjectId ) { + LOG( "CLocationManagerServer::LocationSnapshotL(), begin" ); if ( !IsSessionReady() ) { + LOG( "Session is not ready" ); User::Leave( KErrNotReady ); } iLocationRecord->LocationSnapshotL( aObjectId ); + LOG( "CLocationManagerServer::LocationSnapshotL(), end" ); } // -------------------------------------------------------------------------- @@ -757,6 +973,11 @@ iRelationQuery->FindL( 1, 1 ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CopyLocationObjectL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CopyLocationObjectL( TItemId aSource, const RArray& aTargets, TMessageQuery& aMessageQuery ) { @@ -818,6 +1039,11 @@ } } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CopyLocationObjectL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CopyLocationObjectL( const TDesC& aSource, const RArray& aTargets, TMessageQuery& aQuery ) { @@ -839,13 +1065,24 @@ CopyLocationObjectL( source, iTargetObjectIds, aQuery ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::HandleQueryNewResults +// -------------------------------------------------------------------------- +// void CLocationManagerServer::HandleQueryNewResults( CMdEQuery& /*aQuery*/, TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/ ) { } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::HandleQueryCompleted +// -------------------------------------------------------------------------- +// void CLocationManagerServer::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) { + LOG("CLocationManagerServer::HandleQueryCompleted"); if ( iRemoveLocation ) { if( aQuery.Count() > 0 && aError == KErrNone ) @@ -879,6 +1116,7 @@ } iCopyReqs[i].iMessage.Complete( aError ); delete iCopyReqs[i].iQuery; + iCopyReqs[i].iQuery = NULL; iCopyReqs.Remove( i ); break; } @@ -889,6 +1127,11 @@ iTargetObjectIds.Reset(); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::NewLC +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CopyLocationL( CMdEQuery& aQuery ) { CMdEObjectDef& locationDef = aQuery.NamespaceDef().GetObjectDefL( Location::KLocationObject ); @@ -920,12 +1163,18 @@ { iCopyReqs[i].iMessage.Complete( KErrNone ); delete iCopyReqs[i].iQuery; + iCopyReqs[i].iQuery = NULL; iCopyReqs.Remove( i ); break; } } } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::InitCopyLocationByIdL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::InitCopyLocationByIdL( const RMessage2& aMessage ) { const TInt KParamSourceId = 0; @@ -959,6 +1208,11 @@ CleanupStack::PopAndDestroy(&targetIds); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::InitCopyLocationByURIL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::InitCopyLocationByURIL( const RMessage2& aMessage ) { LOG( "CLocationManagerSession::CopyLocationDataByUriL begin" ); @@ -1008,8 +1262,14 @@ LOG( "CLocationManagerSession::CopyLocationDataByUriL end" ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StartTrackLogL +// -------------------------------------------------------------------------- +// TItemId CLocationManagerServer::StartTrackLogL() { + LOG("CLocationManagerServer::StartTrackLogL"); if ( iTrackLog->IsRecording() ) { User::Leave( KErrInUse ); @@ -1026,8 +1286,14 @@ return iTagId; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StopTrackLogL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::StopTrackLogL() { + LOG("CLocationManagerServer::StopTrackLogL"); if ( iTrackLog->IsRecording() ) { iTrackLog->StopRecordingL(); @@ -1040,8 +1306,14 @@ } } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CompleteNotifyRequest +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CompleteNotifyRequest( TEventTypes aEventType, TInt aError ) { + LOG("CLocationManagerServer::CompleteNotifyRequest"); const TInt KEventTypeParam = 2; TPckg wrapEventType( aEventType ); @@ -1059,19 +1331,35 @@ iTrackLogNotifyReqs.Reset(); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::IsTrackLogRecording +// -------------------------------------------------------------------------- +// void CLocationManagerServer::IsTrackLogRecording( TBool &aRec ) { aRec = iTrackLog->IsRecording(); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GpxFileCreated +// -------------------------------------------------------------------------- +// void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength, TTime aStart, TTime aEnd ) { TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CreateTrackLogTagL +// -------------------------------------------------------------------------- +// TItemId CLocationManagerServer::CreateTrackLogTagL() { + LOG("CLocationManagerServer::CreateTrackLogTagL"); if ( !IsSessionReady() ) { User::Leave( KErrNotReady ); @@ -1104,9 +1392,15 @@ return tagId; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CreateTrackLogL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::CreateTrackLogL( TItemId aTagId, const TDesC& aUri, TReal32 aLength, TTime aStart, TTime aEnd ) { + LOG("CLocationManagerServer::CreateTrackLogL"); if ( !IsSessionReady() ) { User::Leave( KErrNotReady ); @@ -1153,6 +1447,11 @@ CleanupStack::PopAndDestroy( trackLog ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GetTrackLogStatus +// -------------------------------------------------------------------------- +// TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) { if ( !iTrackLog ) @@ -1165,6 +1464,11 @@ return KErrNone; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::DeleteTrackLogL +// -------------------------------------------------------------------------- +// TInt CLocationManagerServer::DeleteTrackLogL( const TDesC& aUri ) { LOG( "CLocationManagerServer::DeleteTrackLogL enter" ); @@ -1205,6 +1509,11 @@ return err; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::TrackLogName +// -------------------------------------------------------------------------- +// TInt CLocationManagerServer::TrackLogName( TFileName& aFileName ) { if ( iTrackLog->IsRecording() ) @@ -1215,11 +1524,21 @@ return KErrNotFound; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::GetCaptureSetting +// -------------------------------------------------------------------------- +// void CLocationManagerServer::GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting ) { aCaptureSetting = iCaptureSetting; } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::HandleObjectNotification +// -------------------------------------------------------------------------- +// void CLocationManagerServer::HandleObjectNotification( CMdESession& /*aSession*/, TObserverNotificationType aType, const RArray& aObjectIdArray ) @@ -1234,6 +1553,11 @@ TRAP_IGNORE( LinkObjectToTrackLogTagL( aObjectIdArray ) ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StartListeningTagRemovalsL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::StartListeningTagRemovalsL() { if ( !IsSessionReady() ) @@ -1249,6 +1573,11 @@ CleanupStack::Pop( condition ); } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StartListeningObjectCreationsL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::StartListeningObjectCreationsL() { if ( !IsSessionReady() ) @@ -1271,6 +1600,11 @@ } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::LinkObjectToTrackLogTagL +// -------------------------------------------------------------------------- +// void CLocationManagerServer::LinkObjectToTrackLogTagL( const RArray& aObjectIdArray ) { CMdERelationDef& containsRelDef = iMdeSession->GetDefaultNamespaceDefL() @@ -1288,21 +1622,299 @@ } } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::AddGpxObserver +// -------------------------------------------------------------------------- +// void CLocationManagerServer::AddGpxObserver( MGpxConversionObserver* aObserver ) { iTrackLog->AddGpxObserver( aObserver ); } +// -------------------------------------------------------------------------- +// CLocationManagerServer::RemapedCompleted() +// -------------------------------------------------------------------------- +// void CLocationManagerServer::RemapedCompleted() { LOG( "CLocationManagerServer::RemapedCompleted()" ); StopRecording(); } +// -------------------------------------------------------------------------- +// CLocationManagerServer::WaitForPositioningStopTimeout() +// -------------------------------------------------------------------------- +// TBool CLocationManagerServer::WaitForPositioningStopTimeout() { LOG( "CLocationManagerServer::WaitForPositioningStopTimeout()" ); return iWaitForPositioningStopTimeout; } +// -------------------------------------------------------------------------- +// CLocationManagerServer::GeoTaggingCompleted +// -------------------------------------------------------------------------- +// + +void CLocationManagerServer::GeoTaggingCompleted( const TInt aError ) + { + LOG("CLocationManagerServer::GeoTaggingCompleted ,begin"); + ARG_USED(aError); + // do nothing because we are only handling pending request for this object. +#ifdef LOC_REVERSEGEOCODE + if(!iGeoTaggingMessage.IsNull()) + { + LOG("Completing the request"); + iGeoTaggingMessage.Complete(aError); + iGeoTaggingMessage = RMessage2 (); + } +#endif //LOC_REVERSEGEOCODE + StopServer(); + LOG("CLocationManagerServer::GeoTaggingCompleted ,end"); + } + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StopServer +// -------------------------------------------------------------------------- +// + +void CLocationManagerServer::StopServer() + { + LOG("CLocationManagerServer::StopServer ,begin"); + // once geo tagging completed, check whether, we can terminate the server + // dont't stop this process if + // 1. when client are connected. + // 2. 3AM timer is going on. + // 3. Tagging is in progress. + if ( !iSessionCount +#if defined(LOC_REVERSEGEOCODE) || defined(LOC_GEOTAGGING_CELLID) + && iGeoTagTimer == NULL +#endif + && iLocationRecord + && !iLocationRecord->TaggingInProgress()) + { + // Nothing in progress. shutdown the server + LOG("Stop the schedular"); + CActiveScheduler::Stop(); + } + LOG("CLocationManagerServer::StopServer ,end"); + } + +// -------------------------------------------------------------------------- +// CLocationManagerServer::PendingGeoTagReqComplete +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::PendingGeoTagReqComplete( const TInt aError ) + { + LOG("CLocationManagerServer::PendingGeoTagReqComplete ,begin"); + ARG_USED(aError); +#ifdef LOC_REVERSEGEOCODE + if(!iTagPendingMessage.IsNull()) + { + + TGeoTaggingSatus pendingGeoTagEntry = EGeoTagCmpt; + switch(aError) + { + case KErrNotFound: + pendingGeoTagEntry = EGeoTaggingPending; + LOG("Geo tagging pending"); + break; + case KErrInUse: + pendingGeoTagEntry = EGeoTaggingGoingOn; + LOG("Geo tagging going on"); + break; + default: + break; + } + + TPckg pendingGeoTagEntryPkg( pendingGeoTagEntry ); + TRAPD(err, iTagPendingMessage.WriteL( 0, pendingGeoTagEntryPkg )); + iTagPendingMessage.Complete((err == KErrNone) ? KErrNone : err); + iTagPendingMessage = RMessage2 (); + } +#endif //LOC_REVERSEGEOCODE + LOG("CLocationManagerServer::PendingGeoTagReqComplete ,end"); + } + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::TagPendingRequestL +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::TagPendingRequestL( const RMessage2& aMessage ) + { + LOG("CLocationManagerServer::TagPendingRequestL ,begin"); + // Only one request at a time +#ifdef LOC_REVERSEGEOCODE + if(iTagPendingMessage.IsNull() && iGeoTaggingMessage.IsNull()) + { + iTagPendingMessage = RMessage2( aMessage ); + // search for pending entry. + //Create the instance of geotagger class + TBool tagProgress = iLocationRecord->TaggingInProgress(); + if(tagProgress) + { + LOG("Tagging is going on.\n"); + // Let UI to send start geo tagging command. + PendingGeoTagReqComplete(KErrNotFound); + } + else + { + LOG("Tagging is not going on.\n"); + if(iGeoTaggingPendingReqObj == NULL) + { + iGeoTaggingPendingReqObj = CGeoTagger::NewL( this, NULL ); + } + iGeoTaggingPendingReqObj->PendingGeoTagsL( tagProgress); + } + } + else + { + LOG("Server busy\n"); + aMessage.Complete(KErrServerBusy); + } +#else + aMessage.Complete(KErrNotSupported); +#endif //LOC_REVERSEGEOCODE + LOG("CLocationManagerServer::TagPendingRequestL ,end"); + } + + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CancelTagPendingRequest +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::CancelTagPendingRequest( const RMessage2& aMessage ) + { + LOG("CLocationManagerServer::CancelTagPendingRequest ,begin"); + // Only one request at a time +#ifdef LOC_REVERSEGEOCODE + if(!iTagPendingMessage.IsNull()) + { + iTagPendingMessage.Complete(KErrCancel); + iLocationRecord->CancelGeoTagging(); + } + aMessage.Complete(KErrNone); +#else + aMessage.Complete(KErrNotSupported); +#endif //LOC_REVERSEGEOCODE + } + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::CancelGeoTaggingRequest +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::CancelGeoTaggingRequest( const RMessage2& aMessage ) + { + LOG("CLocationManagerServer::CancelGeoTaggingRequest ,begin"); + // Only one request at a time +#ifdef LOC_REVERSEGEOCODE + if(!iGeoTaggingMessage.IsNull()) + { + iGeoTaggingMessage.Complete(KErrCancel); + iGeoTaggingMessage = RMessage2 (); + iLocationRecord->CancelGeoTagging(); + } + aMessage.Complete(KErrNone); +#else + aMessage.Complete(KErrNotSupported); +#endif //LOC_REVERSEGEOCODE + } + + +// -------------------------------------------------------------------------- +// CLocationManagerServer::StartGeoTaggingL +// -------------------------------------------------------------------------- +// +void CLocationManagerServer::StartGeoTaggingL( const RMessage2& aMessage ) + { + LOG("CLocationManagerServer::StartGeoTaggingL ,begin"); +#ifdef LOC_REVERSEGEOCODE + if(iGeoTaggingMessage.IsNull() && iTagPendingMessage.IsNull()) + { + iGeoTaggingMessage = RMessage2( aMessage ); + // search for pending entry. + //Create the instance of geotagger class + if(!iLocationRecord->StartGeoTagging(EInteractive)) + { + if(iGeoTaggingPendingReqObj == NULL) + { + iGeoTaggingPendingReqObj = CGeoTagger::NewL( this, NULL ); + } + iGeoTaggingPendingReqObj->CreateGeoTagsL((TConnectionOption)(aMessage.Int0())); + } + } + else + { + LOG("Server busy\n"); + aMessage.Complete(KErrServerBusy); + } +#else + aMessage.Complete(KErrNotSupported); +#endif //LOC_REVERSEGEOCODE + } + + +// ---------------------------------------------------------------------------- +// CLocationManagerServer::GetCurrentRegisterNw() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneNetworkInfoV2& CLocationManagerServer::GetCurrentRegisterNw() + { + LOG( "CLocationManagerServer::GetCurrentRegisterNw ,begin" ); + return iLocationRecord->GetCurrentRegisteredNw(); + } + +// ---------------------------------------------------------------------------- +// CLocationManagerServer::RetrieveHomeNetwork() +// ---------------------------------------------------------------------------- +void CLocationManagerServer::RetrieveHomeNetwork() + { + LOG("CLocationManagerServer::RetrieveHomeNetwork ,begin"); + if(iHomeNwInfoAvailableFlag) + { + RMobilePhone::TMobilePhoneNetworkInfoV1Pckg homeNetworkPckg( iHomeNetwork ); + + TRequestStatus status( KErrNone ); + + iPhone.GetHomeNetwork(status, homeNetworkPckg); + User::WaitForRequest( status ); + if(status.Int() == KErrNone) + { + iHomeNwInfoAvailableFlag = ETrue; + } + } + LOG("CLocationManagerServer::RetrieveHomeNetwork ,end"); + } + +// ---------------------------------------------------------------------------- +// CLocationManagerServer::GetHomeNetworkInfo() +// ---------------------------------------------------------------------------- +const RMobilePhone::TMobilePhoneNetworkInfoV1& + CLocationManagerServer::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) + { + LOG("CLocationManagerServer::RetrieveHomeNetwork ,begin"); + if(!iHomeNwInfoAvailableFlag) + { + RetrieveHomeNetwork(); + } + aHomeNwInfoAvailableFlag = iHomeNwInfoAvailableFlag; + return iHomeNetwork; + } + + +// ---------------------------------------------------------------------------- +// CLocationManagerServer::IsRegisteredAtHomeNetwork() +// ---------------------------------------------------------------------------- +TBool CLocationManagerServer::IsRegisteredAtHomeNetwork() + { + LOG( "CLocationManagerServer::IsRegisteredAtHomeNetwork" ); + return (iNwRegistrationStatusHandler && + (iNwRegistrationStatusHandler->GetNetworkRegistrationStatus() + == RMobilePhone::ERegisteredOnHomeNetwork)); + } + // End of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/src/clocationmanagersession.cpp --- a/locationmanager/server/src/clocationmanagersession.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/server/src/clocationmanagersession.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -48,7 +48,12 @@ CLocationManagerSession::~CLocationManagerSession() { LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" ); - TRAP_IGNORE(Server().StopGPSPositioningL()); + // don't call stop GPS positioning from here... + // we are expecting the application to start and stop else on server terminate, we will do the same. + // this is not okay when user takes a photograph and then transfer photo using BT/PC . + // at this point, it will stop the trail for camera where as camera session is still valid. + + Server().CancelNotificationRequest( iNotificationHandle ); Server().CancelLocationRequest( iLocationHandle ); Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle ); @@ -86,22 +91,15 @@ // void CLocationManagerSession::ServiceL( const RMessage2& aMessage ) { - LOG( "CLocationManagerSession::ServiceL" ); - _LIT( KSemaphore, "LocManSynchSemaphore" ); - RSemaphore semaphore; - const TInt result = semaphore.OpenGlobal( KSemaphore ); - LOG1( "CLocationManagerSession::ServiceL - semaphore open result: %d", result ); + LOG( "CLocationManagerSession::ServiceL, begin" ); + LOG1("Message id - %d", aMessage.Function()); iMessage = RMessage2( aMessage ); - if ( result == KErrNone ) - { - semaphore.Signal(); - semaphore.Close(); - } TRAPD( err, DispatchMessageL( aMessage ) ); if ( err != KErrNone ) { aMessage.Complete( err ); } + LOG( "CLocationManagerSession::ServiceL, end" ); } // -------------------------------------------------------------------------- @@ -180,6 +178,18 @@ case ELocManCancelTrackLogNotify: CancelTrackLogNotificationRequest( aMessage ); break; + case ELocManTagPending: + Server().TagPendingRequestL(aMessage); + break; + case ELocManStartGeoTaging: + Server().StartGeoTaggingL(aMessage); + break; + case ELocManCancelTagPendingReq: + Server().CancelTagPendingRequest(aMessage); + break; + case ELocManCancelGeoTaggingReq: + Server().CancelGeoTaggingRequest(aMessage); + break; default: aMessage.Complete( KErrArgument ); break; @@ -494,7 +504,7 @@ } // -------------------------------------------------------------------------- -// CLocationManagerSession::GpsQualityChange +// CLocationManagerSession::RegisterTrackLogObserver // -------------------------------------------------------------------------- // void CLocationManagerSession::RegisterTrackLogObserver( const RMessage2& aMessage ) @@ -503,6 +513,11 @@ TRAP_IGNORE( Server().AddTrackLogNotificationRequestL( aMessage ) ); } + +// -------------------------------------------------------------------------- +// CLocationManagerSession::GetCaptureSettingL +// -------------------------------------------------------------------------- +// void CLocationManagerSession::GetCaptureSettingL( const RMessage2& aMessage ) { TInt KParamCaptureSetting = 0; diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/src/clocationservertimerhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/src/clocationservertimerhandler.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implements helper class to handle location server tiimer related functionality +* +*/ + +#include "clocationservertimerhandler.h" +#include "locationmanagerdebug.h" + + + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::CLocationServerTimerHandler +// -------------------------------------------------------------------------- +// +CLocationServerTimerHandler::CLocationServerTimerHandler + (MLocationServerTimerObserver& aLocationServerTimerObserver): + CTimer(EPriorityStandard ), + iLocationServerTimerObserver(aLocationServerTimerObserver), + iLocationServerTimerType(MLocationServerTimerObserver::ELocGeneralPurpose) + { + } + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::~CLocationServerTimerHandler +// -------------------------------------------------------------------------- +// +CLocationServerTimerHandler::~CLocationServerTimerHandler() + { + LOG ("CLocationServerTimerHandler::~CLocationServerTimerHandler(), begin"); + Cancel(); + LOG ("CLocationServerTimerHandler::~CLocationServerTimerHandler(), end"); + } + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::NewL +// -------------------------------------------------------------------------- +// +CLocationServerTimerHandler* CLocationServerTimerHandler::NewL(MLocationServerTimerObserver& aLocationServerTimerObserver) + { + CLocationServerTimerHandler* self = + new( ELeave ) CLocationServerTimerHandler(aLocationServerTimerObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; + } + + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::ConstructL +// -------------------------------------------------------------------------- +// +void CLocationServerTimerHandler::ConstructL() + { + LOG ("CLocationServerTimerHandler::ConstructL(), begin"); + CActiveScheduler::Add(this); + CTimer::ConstructL(); + LOG ("CLocationServerTimerHandler::ConstructL(), end"); + } + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::StartTimer +// -------------------------------------------------------------------------- +// +void CLocationServerTimerHandler::StartTimer(const TTimeIntervalMicroSeconds32 anInterval, + const MLocationServerTimerObserver::TLocationServerTimerType aLocationServerTimerType) + { + LOG ("CLocationServerTimerHandler::StartTimer(), begin"); + if(!IsActive()) + { + LOG1("Starting timer of type - %d", aLocationServerTimerType); + // not active. + iLocationServerTimerType = aLocationServerTimerType; + After( anInterval ); + } + LOG ("CLocationServerTimerHandler::StartTimer(), end"); + } + + +// -------------------------------------------------------------------------- +// CLocationServerTimerHandler::RunL +// -------------------------------------------------------------------------- +// +void CLocationServerTimerHandler::RunL( ) + { + LOG ("CLocationServerTimerHandler::RunL(), begin"); + TInt status = iStatus.Int(); + LOG1("Error code - %d", status); + iLocationServerTimerObserver.LocationServerTimerCallBackL + (iLocationServerTimerType,status); + LOG ("CLocationServerTimerHandler::RunL(), end"); + } + + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/server/src/nwregistrationstatushandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/server/src/nwregistrationstatushandler.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Network registration status handler +* +*/ + + +#include "nwregistrationstatushandler.h" +#include "locationmanagerdebug.h" + + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::CNwRegistrationStatusHandler() +// ---------------------------------------------------------------------------- +CNwRegistrationStatusHandler::CNwRegistrationStatusHandler(RMobilePhone& aMobilePhone): + CActive(EPriorityStandard ), + iMobilePhone(aMobilePhone), + iRegistrationStatus(RMobilePhone::ERegistrationUnknown), + iState(ERegStatusOptStateNone) + { + } + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::~CNwRegistrationStatusHandler() +// ---------------------------------------------------------------------------- +CNwRegistrationStatusHandler::~CNwRegistrationStatusHandler() + { + LOG("CNwRegistrationStatusHandler::~CNwRegistrationStatusHandler"); + Cancel(); + } + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::NewL() +// ---------------------------------------------------------------------------- +CNwRegistrationStatusHandler* CNwRegistrationStatusHandler::NewL(RMobilePhone& aMobilePhone) + { + LOG("CNwRegistrationStatusHandler::NewL ,begin"); + CNwRegistrationStatusHandler* self = new( ELeave ) CNwRegistrationStatusHandler(aMobilePhone); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); //self + + return self; + } + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::ConstructL() +// ---------------------------------------------------------------------------- +void CNwRegistrationStatusHandler::ConstructL() + { + LOG("CNwRegistrationStatusHandler::ConstructL ,begin"); + CActiveScheduler::Add(this); + iMobilePhone.GetNetworkRegistrationStatus(iStatus, iRegistrationStatus); + iState = ERegStatusOptStateGet; + SetActive(); + LOG("CNwRegistrationStatusHandler::ConstructL ,end"); + } + + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::GetNetworkRegistrationStatus() +// ---------------------------------------------------------------------------- +RMobilePhone::TMobilePhoneRegistrationStatus CNwRegistrationStatusHandler::GetNetworkRegistrationStatus() const + { + return iRegistrationStatus; + } + + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::StartNotifier() +// ---------------------------------------------------------------------------- +void CNwRegistrationStatusHandler::StartNotifier() + { + LOG("CNwRegistrationStatusHandler::StartNotifier ,begin"); + if(!IsActive()) + { + iState = ERegStatusOptStateNotify; + iMobilePhone.NotifyNetworkRegistrationStatusChange(iStatus, iRegistrationStatus); + SetActive(); + } + else + { + // already active. + LOG("N/W registration status handler already active"); + } + LOG("CNwRegistrationStatusHandler::StartNotifier ,end"); + } + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::RunL() +// ---------------------------------------------------------------------------- +void CNwRegistrationStatusHandler::RunL( ) + { + LOG("CNwRegistrationStatusHandler::RunL"); + LOG1("Status - %d", iStatus.Int()); + StartNotifier(); + } + +// ---------------------------------------------------------------------------- +// CNwRegistrationStatusHandler::DoCancel() +// ---------------------------------------------------------------------------- +void CNwRegistrationStatusHandler::DoCancel( ) + { + LOG("CNwRegistrationStatusHandler::DoCancel"); + switch(iState) + { + case ERegStatusOptStateGet: + { + iMobilePhone.CancelAsyncRequest(EMobilePhoneGetNetworkRegistrationStatus); + break; + } + case ERegStatusOptStateNotify: + { + iMobilePhone.CancelAsyncRequest(EMobilePhoneNotifyNetworkRegistrationStatusChange); + break; + } + default: + // execution shouldn't come over here + LOG1("CNwRegistrationStatusHandler::DoCancel, in wrong state - %d", iState); + break; + } + } + + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/sis/locutildebug.pkg --- a/locationmanager/sis/locutildebug.pkg Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/sis/locutildebug.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -28,7 +28,34 @@ ;:"Nokia" :"Vendor" -"S:\EPOC32\RELEASE\ARMV5\UDEB\locationutilityserver.exe" -"!:\sys\bin\locationutilityserver.exe" -"S:\EPOC32\RELEASE\ARMV5\UDEB\LocationTrail.dll" -"!:\sys\bin\LocationTrail.dll" -"S:\EPOC32\RELEASE\ARMV5\UDEB\locationutility.dll" -"!:\sys\bin\locationutility.dll" -"S:\EPOC32\RELEASE\ARMV5\UDEB\Loc.exe" -"!:\sys\bin\Loc.exe" \ No newline at end of file +"\EPOC32\RELEASE\ARMV5\UDEB\locationutilityserver.exe" -"!:\sys\bin\locationutilityserver.exe" +"\EPOC32\RELEASE\ARMV5\UDEB\LocationTrail.dll" -"!:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\locationutility.dll" -"!:\sys\bin\locationutility.dll" +"\EPOC32\RELEASE\ARMV5\UDEB\Loc.exe" -"!:\sys\bin\Loc.exe" + + +; Geo converter +"\EPOC32\RELEASE\ARMV5\UDEB\geoconverter.dll" -"!:\sys\bin\geoconverter.dll" + +;#include "..\inc\locplatsupport.mmh" +;#ifdef _LOC_REVERSEGEOCODE +;MACRO LOC_REVERSEGEOCODE +; Reverse geocode +;"\EPOC32\RELEASE\ARMV5\UDEB\ReverseGeocode.dll" -"!:\sys\bin\ReverseGeocode.dll" + +; Tag creator +;"\EPOC32\RELEASE\ARMV5\UDEB\tagcreator.dll" -"!:\sys\bin\tagcreator.dll" + +; Geo tagger +;"\EPOC32\RELEASE\ARMV5\UDEB\geotagger.dll" -"!:\sys\bin\geotagger.dll" + +; Reverse geocode plugin +;"\epoc32\RELEASE\armv5\UDEB\ReverseGeoCoderPlugin.dll"-"!:\sys\bin\ReverseGeoCoderPlugin.dll" +;"\epoc32\data\z\resource\plugins\reversegeocoderplugin.rsc"-"!:\resource\plugins\reversegeocoderplugin.rsc" + +;#endif + + + +; End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/sis/package.pkg --- a/locationmanager/sis/package.pkg Thu Jul 15 19:07:24 2010 +0300 +++ b/locationmanager/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -28,4 +28,7 @@ ;Files "\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" "\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" -"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" \ No newline at end of file +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" + +; End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/sis/package_cellid_reverse_geocode_enabled.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/sis/package_cellid_reverse_geocode_enabled.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,53 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"Location Manager Patch"},(0x200071BE), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" + +; Reverse geocode +"\EPOC32\RELEASE\ARMV5\UREL\ReverseGeocode.dll" -"c:\sys\bin\ReverseGeocode.dll" + +; Tag creator +"\EPOC32\RELEASE\ARMV5\UREL\tagcreator.dll" -"c:\sys\bin\tagcreator.dll" + +; Geo tagger +"\EPOC32\RELEASE\ARMV5\UREL\geotagger.dll" -"c:\sys\bin\geotagger.dll" + +; Geo converter +"\EPOC32\RELEASE\ARMV5\UREL\geoconverter.dll" -"c:\sys\bin\geoconverter.dll" + + +; Reverse geocode plugin +"\epoc32\RELEASE\armv5\UREL\ReverseGeoCoderPlugin.dll"-"c:\sys\bin\ReverseGeoCoderPlugin.dll" +"\epoc32\data\z\resource\plugins\reversegeocoderplugin.rsc"-"c:\resource\plugins\reversegeocoderplugin.rsc" + + +; End of file + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/sis/package_cellidenabled.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/sis/package_cellidenabled.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,39 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"Location Manager Patch"},(0x200071BE), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" + +; Geo converter +"\EPOC32\RELEASE\ARMV5\UREL\geoconverter.dll" -"c:\sys\bin\geoconverter.dll" + + +; End of file + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/bwincw/tagcreatorwinscw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/bwincw/tagcreatorwinscw.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,7 @@ +EXPORTS + ?CreateLocationTagsL@CTagCreator@@QAEXABVTPtrC16@@AAK01@Z @ 1 NONAME ; void CTagCreator::CreateLocationTagsL(class TPtrC16 const &, unsigned long &, class TPtrC16 const &, unsigned long &) + ?SetSession@CTagCreator@@QAEXPAVCMdESession@@@Z @ 2 NONAME ; void CTagCreator::SetSession(class CMdESession *) + ?AttachTagsL@CTagCreator@@QAEXKKK@Z @ 3 NONAME ; void CTagCreator::AttachTagsL(unsigned long, unsigned long, unsigned long) + ?NewL@CTagCreator@@SAPAV1@XZ @ 4 NONAME ; class CTagCreator * CTagCreator::NewL(void) + ??1CTagCreator@@UAE@XZ @ 5 NONAME ; CTagCreator::~CTagCreator(void) + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/eabi/tagcreatorarm.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/eabi/tagcreatorarm.def Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,8 @@ +EXPORTS + _ZN11CTagCreator10SetSessionEP11CMdESession @ 1 NONAME + _ZN11CTagCreator11AttachTagsLEmmm @ 2 NONAME + _ZN11CTagCreator19CreateLocationTagsLERK7TPtrC16RmS2_S3_ @ 3 NONAME + _ZN11CTagCreator4NewLEv @ 4 NONAME + _ZTI11CTagCreator @ 5 NONAME + _ZTV11CTagCreator @ 6 NONAME + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +tagcreator.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/group/tagcreator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/group/tagcreator.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + +#include +#include +VERSION 10.0 +TARGET tagcreator.dll +TARGETTYPE DLL +UID 0x1000008d 0x2002701E + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +#if defined(WINSCW) +deffile ../bwincw/tagcreatorwinscw.def +#elif defined(EABI) +deffile ../eabi/tagcreatorarm.def +#endif +nostrictdef + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../ReverseGeocode/inc + + + +SOURCEPATH ../src +SOURCE ctagcreator.cpp + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY mdeclient.lib +LIBRARY estor.lib +LIBRARY platformenv.lib + + +PAGED +BYTEPAIRCOMPRESSTARGET +OPTION ARMCC -O3 -OTime + +// End of file + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/inc/ctagcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/inc/ctagcreator.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class for creating country and city tags for media files. +* +*/ + + +#ifndef C_TAGCREATOR_H +#define C_TAGCREATOR_H + +#include "mdesession.h" +#include "mdenamespacedef.h" +#include + +/** + * + * @since S60 9.2 + */ +class CTagCreator : public CBase + { +public: + /** + * 2-phased constructor. + */ + IMPORT_C static CTagCreator* NewL( ); + + /** + * C++ destructor. + */ + IMPORT_C virtual ~CTagCreator(); + + /** + * Attach country and city tags to an image file/object. + * @param aObjectId, object Id for image/video to be tagged. + * @param aCountryTagId, a country tag Id. + * @param aCityTagId, a city tag Id. + * @return None. + */ + IMPORT_C void AttachTagsL( const TUint32 aObjectId, const TItemId aCountryTagId, + const TItemId aCityTagId ); + /** + * Creates country and city tags. + * @param aCountry, a country name. + * @param aCountryTagId, reference to a country tag Id. + * @param aCity, a city name. + * @param aCityTagId, a reference to a city tag Id. + * @return None. + */ + IMPORT_C void CreateLocationTagsL( const TPtrC& aCountry, TItemId& aCountryTagId, + const TPtrC& aCity, TItemId& aCityTagId ); + + /** + * Sets the CMdESession for tag creation + * @param aSession the CMdESession object + */ + IMPORT_C void SetSession( CMdESession* aSession ); + +public: + + /** + * Creates a tag for the country + * @param aCountry country name + * @param aCity city name + * @param aCountryTagId The country tag Id + */ + void CreateTagForCountryL( const TPtrC& aCountry, + TItemId& aCountryTagId ); + + /** + * Creates a tag for the city + * @param aCountry The country name + * @param aCity The city name + * @param aCityTagId The city tag Id + */ + void CreateTagForCityL( const TPtrC& aCountry, const TPtrC& aCity, TItemId& aCityTagId); + +private: + /** + * C++ constructor. + */ + CTagCreator( ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Creates a tag object and adds it to the database + * @param aTitle The title associated with the tag + * @param aUri The uri associated with the tag + * @return The itemId of the newly created tag in the database + */ + TUint32 CreateTagL( const TPtrC& aTitle, + const TPtrC& aUri, + MdeConstants::Tag::TTagType aTagType ); + /** + * Finds if a tag with the given uri exists + * @param aUri The uri by which the tag is to be searched + * @return The ItemId of the tag if it exists,0 otherwise + */ + + TUint32 TagExistsL( const TPtrC& aUri ); + +private: + + /** + * iMdeSession + * an instance of the CMdESession + */ + CMdESession* iMdeSession; + + }; + +#endif // C_TAGCREATOR_H + +// End of file. diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/sis/depends.xml Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,24 @@ + + + + + 1 + MdS Location Manager + Upgrade package for MdS Tag Creator + + + + S60 + + 5 + 0 + + 2009 + 16 + + + + + + \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/sis/package.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/sis/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,29 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"TagCreator Patch"},(0x2002701E), 2, 0, 0, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\EPOC32\RELEASE\ARMV5\UREL\tagcreator.dll" -"c:\sys\bin\tagcreator.dll" \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/sis/stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/sis/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,30 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;Header +# {"tagcreator"}, (0x2002701E), 1, 0, 0, TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Files + + diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/sis/tagcreator_stub.sis Binary file locationmanager/tagcreator/sis/tagcreator_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 locationmanager/tagcreator/src/ctagcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmanager/tagcreator/src/ctagcreator.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class for creating country and city tags for media files +* +*/ + +#include "ctagcreator.h" +#include "locationmanagerdebug.h" + +#include "mdccommon.h" +#include "mdeobjectdef.h" +#include "mdepropertydef.h" +#include "mderelation.h" +#include "mdequery.h" +#include "mdeconstants.h" + +using namespace MdeConstants; + +_LIT ( KCountry, "country:"); // country:finland +_LIT ( KCity, "city:"); // city:helsinki|country:finland +_LIT ( KSeparator, "|" ); // Separator for city tag. Separate city and country. + +// -------------------------------------------------------------------------- +// CTagCreator::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CTagCreator* CTagCreator::NewL( ) + { + LOG( "CTagCreator::NewL(), begin" ); + CTagCreator* self = new (ELeave) CTagCreator( ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + LOG( "CTagCreator::NewL(), end" ); + return self; + } + +// -------------------------------------------------------------------------- +// CTagCreator::CTagCreator +// -------------------------------------------------------------------------- +// +CTagCreator::CTagCreator( ) + { + + } + +// -------------------------------------------------------------------------- +// CTagCreator::ConstructL +// -------------------------------------------------------------------------- +// +void CTagCreator::ConstructL() + { + + } + +// -------------------------------------------------------------------------- +// CTagCreator::~CTagCreator +// -------------------------------------------------------------------------- +// +CTagCreator::~CTagCreator() + { + + } + +// -------------------------------------------------------------------------- +// CTagCreator::SetMdeSession() +// -------------------------------------------------------------------------- +// +EXPORT_C void CTagCreator::SetSession(CMdESession* aSession) + { + iMdeSession = aSession; + } + +// --------------------------------------------------------------------------- +// CTagCreator::CreateTagForCountryL() +// --------------------------------------------------------------------------- +// +void CTagCreator::CreateTagForCountryL( const TPtrC& aCountry, + TItemId& aCountryTagId ) + { + LOG( "CTagCreator::CreateTagForCountryL - begin" ); + + // Crete new string for uri, -> country:India. + TUint totalLength = ( aCountry.Length() + KCountry().Length() ); + HBufC* buf = HBufC::NewLC( totalLength ); + TPtr uriPtr = buf->Des(); + _LIT(KCountryUriFormat, "%S%S"); + uriPtr.Format(KCountryUriFormat, &(KCountry()), &aCountry); + + // Check if there is allready tag for current country. + aCountryTagId = TagExistsL( uriPtr ); + + if( !aCountryTagId ) + { + // No tag, create tag for country. + aCountryTagId = CreateTagL( aCountry, uriPtr, MdeConstants::Tag::ESystemDefineCountryTags); + } + + CleanupStack::PopAndDestroy( buf ); + + LOG( "CTagCreator::CreateTagForCountryL - end" ); + } + +// --------------------------------------------------------------------------- +// CTagCreator::CreateTagForCityL() +// --------------------------------------------------------------------------- +// +void CTagCreator::CreateTagForCityL( const TPtrC& aCountry, const TPtrC& aCity, TItemId& aCityTagId ) + { + LOG( "CTagCreator::CreateTagForCityL - begin" ); + + // Crete new string for uri, -> city:bangalore|country:india + TUint totalLength = ( aCity.Length() + KCity.iTypeLength + + aCountry.Length() + KCountry.iTypeLength + KSeparator.iTypeLength ); + + HBufC* buf = HBufC::NewLC( totalLength ); + TPtr uriPtr = buf->Des(); + _LIT(KCityCountryUriFormat, "%S%S%S%S%S"); + uriPtr.Format(KCityCountryUriFormat, + &(KCity()), + &aCity, + &(KSeparator()), + &(KCountry()), + &aCountry); + + // Check if there is allready tag for current city. + aCityTagId = TagExistsL( uriPtr ); + + if( !aCityTagId ) + { + // No tag, create tag for city. + aCityTagId = CreateTagL( aCity, uriPtr, MdeConstants::Tag::ESystemDefineCityTags); + } + + CleanupStack::PopAndDestroy( buf ); + + LOG( "CTagCreator::CreateTagForCityL - end" ); + } + +// --------------------------------------------------------------------------- +// CTagCreator::CreateTagL +// --------------------------------------------------------------------------- +// +TUint32 CTagCreator::CreateTagL( const TPtrC& aTitle, + const TPtrC& aUri, + MdeConstants::Tag::TTagType aTagType) + { + LOG( "CTagCreator::CreateTagL - begin" ); + + CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); + // Create tag object. + CMdEObjectDef& tagObjectDef = defaultNamespace.GetObjectDefL( Tag::KTagObject ); + + CMdEObject* tagObject = NULL; + tagObject = iMdeSession->NewObjectLC( tagObjectDef, aUri ); + + // Type defs. + CMdEPropertyDef& creationDef = tagObjectDef.GetPropertyDefL( + Object::KCreationDateProperty ); + CMdEPropertyDef& modifiedDef = tagObjectDef.GetPropertyDefL( + Object::KLastModifiedDateProperty ); + CMdEPropertyDef& sizeDef = tagObjectDef.GetPropertyDefL( + Object::KSizeProperty ); + CMdEPropertyDef& itemTypeDef = tagObjectDef.GetPropertyDefL( + Object::KItemTypeProperty ); + CMdEPropertyDef& titleDef = tagObjectDef.GetPropertyDefL( + Object::KTitleProperty ); + + // Set propertys. + TTime universalTime; + universalTime.UniversalTime(); + + // Creation time. + tagObject->AddTimePropertyL( creationDef, universalTime ); + + // Modification time. + tagObject->AddTimePropertyL( modifiedDef, universalTime ); + + // Size + tagObject->AddUint32PropertyL( sizeDef, aTagType); + + // ItemType. + tagObject->AddTextPropertyL( itemTypeDef, Tag::KTagItemType ); + + // Title, for country. + if ( aTitle.Length() > 0 ) + { + tagObject->AddTextPropertyL( titleDef, aTitle ); // Add title + } + + // Finally add to database. + TItemId itemId = iMdeSession->AddObjectL( *tagObject ); + + CleanupStack::PopAndDestroy( tagObject ); + + LOG( "CTagCreator::CreateTagL - end" ); + + return itemId; + } + +// --------------------------------------------------------------------------- +// CTagCreator::TagExistsL +// --------------------------------------------------------------------------- +// +TUint32 CTagCreator::TagExistsL( const TPtrC& aUri ) + { + LOG( "CTagCreator::TagExistsL - begin" ); + + CMdEObject* mdeObject = NULL; + mdeObject = iMdeSession->GetObjectL( aUri ) ; // Just to find out if it exists. + + if( mdeObject ) + { + LOG( "CTagCreator::TagExistsL - returning object id" ); + return mdeObject->Id(); + } + else + { + LOG( "CTagCreator::TagExistsL - No object, return 0" ); + return 0; + } + } + +// --------------------------------------------------------------------------- +// CGeoTagger::AttachTagsL +// Create relationship to country and city tag +// --------------------------------------------------------------------------- +// +EXPORT_C void CTagCreator::AttachTagsL( const TUint32 aObjectId, const TItemId aCountryTagId, + const TItemId aCityTagId ) + { + LOG( "CGeoTagger::AttachTagsL" ); + CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); + // contains relation definition + CMdERelationDef& containsRelDef = defaultNamespace.GetRelationDefL( + Relations::KContains ); + + // Create relation between country tag and media object (image/video). + CMdERelation* relationObject = NULL; + if ( aCountryTagId ) + { + relationObject = iMdeSession->NewRelationLC ( containsRelDef, + aObjectId, aCountryTagId, 0 ); + + if ( !relationObject ) + { + LOG( "CGeoTagger::AttachTagsL - Couldn't create relation object!" ); + User::Leave ( KErrBadHandle ); + } + + iMdeSession->AddRelationL( *relationObject ); + + CleanupStack::PopAndDestroy( relationObject ); + } + + // Create relation between city tag and media object (image/video). + if ( aCityTagId ) + { + relationObject = iMdeSession->NewRelationLC ( containsRelDef, + aObjectId, aCityTagId, 0 ); + + if ( !relationObject) + { + LOG( "CGeoTagger::AttachTagsL - Couldn't create relation object!" ); + User::Leave ( KErrBadHandle ); + } + + iMdeSession->AddRelationL( *relationObject ); + + CleanupStack::PopAndDestroy( relationObject ); + } + + LOG( "CGeoTagger::AttachTagsL - end" ); + } + +// --------------------------------------------------------------------------- +// CGeoTagger::CreateLocationTagsL +// Create country and city tags +// --------------------------------------------------------------------------- +// +EXPORT_C void CTagCreator::CreateLocationTagsL( const TPtrC& aCountry, TItemId& aCountryTagId, + const TPtrC& aCity, TItemId& aCityTagId) + { + LOG( "CGeoTagger::CreateLocationTagsL" ); + if( aCountry.Length() > 0 ) + { + CreateTagForCountryL( aCountry, aCountryTagId ); + } + + if( aCity.Length() > 0 ) + { + CreateTagForCityL( aCountry, aCity, aCityTagId ); + } + } + +// End of file diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/group/bld.inf --- a/mds_plat/location_manager_api/group/bld.inf Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -16,6 +16,7 @@ */ #include +#include "../../../locationmanager/inc/locplatsupport.mmh" PRJ_PLATFORMS DEFAULT @@ -28,6 +29,9 @@ ../inc/rlocationobjectmanipulator.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationobjectmanipulator.h) ../inc/locationdatatype.h MW_LAYER_PLATFORM_EXPORT_PATH(locationdatatype.h) ../inc/locationeventdef.h MW_LAYER_PLATFORM_EXPORT_PATH(locationeventdef.h) +../inc/geotagobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(geotagobserver.h) +../inc/rlocationgeotagger.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationgeotagger.h) +../inc/geotagger.h MW_LAYER_PLATFORM_EXPORT_PATH(geotagger.h) PRJ_MMPFILES diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/inc/geotagger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/geotagger.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#ifndef GEOTAGGER_H_ +#define GEOTAGGER_H_ + +#include +#include +#include +#include + + +/** + * GeoTagger converts a given cell ID(CGI Info) to geo-coordinates. + * Does reverse geocoding to get country and city name. + * Creates country and city tag for image/video files. + * @since S60 9.2 + */ + +NONSHARABLE_CLASS(CGeoTagger) : public CBase + { +public: + /** + * 2-phased constructor. + */ + IMPORT_C static CGeoTagger* NewL(MGeoTaggerObserver* aObserver, CMdESession* aMdeSession = NULL ); + +public: //exported API + /** + * Harvests location tags. + * @param aObserver, observer for geotagging. + * @return None. + */ + virtual void CreateGeoTagsL( const TConnectionOption = ESilent ) = 0; + + /** + * Is there any untagged photos with location info?. + * @return None. + */ + virtual void PendingGeoTagsL( TBool aTagInProgress ) = 0; + }; + +#endif // GEOTAGGER_H_ + +// End of file. + diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/inc/geotagobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/geotagobserver.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#ifndef GEOTAGOBSERVER_H_ +#define GEOTAGOBSERVER_H_ + +#include +#include +#include + +enum TConnectionOption + { + ESilent=0, + EInteractive + }; + +typedef enum + { + EGeoTaggingPending = 0x01, + EGeoTaggingGoingOn, + EGeoTagCmpt + }TGeoTaggingSatus; + + +class MGeoTaggerObserver + { +public: + /** + * This method is used for notifying completion of geotagging + */ + virtual void GeoTaggingCompleted( const TInt aError ) = 0; + + /** + * This method is used for notifying completion of query for pending geo tags + */ + virtual void PendingGeoTagReqComplete( const TInt aError ) = 0; + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + virtual RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw() = 0; + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + virtual TBool IsRegisteredAtHomeNetwork() = 0; + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + virtual const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) = 0; + + }; + + +#endif // GEOTAGOBSERVER_H_ + +// End of file. diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/inc/locationdatatype.h --- a/mds_plat/location_manager_api/inc/locationdatatype.h Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/inc/locationdatatype.h Thu Aug 19 10:20:41 2010 +0300 @@ -20,6 +20,8 @@ #include #include +const TInt KMaxCountryName = 128; +typedef TBuf TCountryName; /* * TLocationData encapsulates all location data. */ @@ -28,7 +30,7 @@ TPosition iPosition; CTelephony::TNetworkInfoV1 iNetworkInfo; TCourse iCourse; - TBuf<100> iCountry; + TCountryName iCountry; TUint iSatellites; TReal32 iQuality; }; diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/inc/rlocationgeotagger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rlocationgeotagger.h Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Location Trail. +* +*/ + +#ifndef R_RLOCATIONGEOTAGGER_H +#define R_RLOCATIONGEOTAGGER_H + +#include +#include +#include +#include +#include +#include + + +/** + * RLocationManager class is used for creating a Location Manager session. + * Location Manager is used to start and stop the location trail, retrieve + * location information and write the location information to images. + * + * @lib LocationManager.lib + * @since S60 9.2 + */ +NONSHARABLE_CLASS( RLocationGeoTagger ) : public RLocationManager + { +public: + +public: + IMPORT_C RLocationGeoTagger(); + + IMPORT_C ~RLocationGeoTagger(); + + + /** + * Is there any geo tag pending state. (Asynchronous call) + * @param aStatus - request status. + * @param aTagPendingFlag - tag pending flag (ETrue if few entry is yet to be tagged else EFalse) + * @return None + */ + IMPORT_C void GeoTagStaus( TRequestStatus& aStatus, + TGeoTaggingSatus& aTagPendingFlag ); + + /** + * Cancel tag pending request + * @return None + */ + IMPORT_C void CancelTagPendingRequest(); + + /** + * Cancel geo tagging request + * @return None + */ + IMPORT_C void CancelGeoTaggingRequest(); + + /** + * Start geo tagging. + * @param aConnectionOption - connection option (ESilent/EInteractive). + * @return None + */ + IMPORT_C void StartGeoTagging(TRequestStatus& aStatus, const TConnectionOption aConnectionOption ); + +private: + TPckg *iTagPendingData; + }; + +#endif // R_RLOCATIONGEOTAGGER_H + +//End of File diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter_reverse_geocode.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter_reverse_geocode.cfg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,345 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Location Manager API tests +# + +// --------------------------------------------------------------------------- +// Location Manager API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Location Manager Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test Connect +test Close +delete test +[Endtest] + +[Test] +title Location Trail Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test TrailClose +delete test +[Endtest] + +[Test] +title Start-Stop Location Trail +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrailTests +test TrailClose +delete test +[Endtest] + +[Test] +title Get Location Trail State +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test GetTrailState +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Location Trail Notification Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test LocationTrailNotifyTest +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Retrieve Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test RetrieveLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Current Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test CurrentLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Create Location Object Manipulator +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test TearDownOM +delete test +[Endtest] + +[Test] +title Create Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Location Snapshot +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Remove Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By ID +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByID +test CloseOM +test CopyByIDDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By URI +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByURI +test CloseOM +test CopyByURIDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Tracklog Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording +timeout 80000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Observer test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +test AddObserver +test AddObserver +test RemoveObserver +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording 2 +timeout 240000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +test GetFile +test GetStatus +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test DeleteFile +test GetStatus2 +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Crash Test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test CrashLocationManager +test RemoveObserver +test TearDownTrackLog +delete test +create LocationManagerTestScripter test2 +test2 SetupTrackLog +test2 AddObserver +request Recording +test2 StartTrackLog +wait Recording +test2 StopTrackLog +test2 RemoveObserver +test2 TearDownTrackLog +delete test2 +[Endtest] + +[Test] +title StartGeoTagging Test +create LocationManagerTestScripter test +#test ConnectGeoTaggerL +test StartGeoTaggingL +test CloseGeoTaggerL +delete test +[Endtest] + + +[Test] +title TagComplete Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagCompleteStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagPending Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagPendingStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagGoingOn Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagGoingOnStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + + +[Test] +title TagComplete Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagCompleteStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagPending Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagPendingStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagGoingOn Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagGoingOnStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title CancelGeoTagging +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test CancelGeoTaggingL +test CloseGeoTaggerL +delete test +[Endtest] \ No newline at end of file diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.mmp --- a/mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -18,6 +18,7 @@ #include #include +#include "../../../../locationmanager/inc/locplatsupport.mmh" TARGET LocationManagerTestScripter.dll TARGETTYPE dll @@ -28,6 +29,10 @@ DEFFILE LocationManagerTestScripter.DEF +#ifdef _LOC_REVERSEGEOCODE +MACRO LOC_REVERSEGEOCODE +#endif + SOURCEPATH ../src SOURCE LocationManagerTestScripter.cpp SOURCE LocationManagerTestScripterBlocks.cpp diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/group/bld.inf --- a/mds_plat/location_manager_api/tsrc/group/bld.inf Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/group/bld.inf Thu Aug 19 10:20:41 2010 +0300 @@ -15,6 +15,8 @@ * */ +#include "../../../../locationmanager/inc/locplatsupport.mmh" + PRJ_PLATFORMS DEFAULT @@ -26,5 +28,10 @@ LocationManagerTestScripter.mmp PRJ_TESTEXPORTS +#ifdef _LOC_REVERSEGEOCODE +../conf/LocationManagerTestScripter_reverse_geocode.cfg /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.cfg +#else ../conf/LocationManagerTestScripter.cfg /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.cfg +#endif + ../init/LocationManagerTestScripter.ini /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.ini diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/inc/LocationManagerTestScripter.h --- a/mds_plat/location_manager_api/tsrc/inc/LocationManagerTestScripter.h Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/inc/LocationManagerTestScripter.h Thu Aug 19 10:20:41 2010 +0300 @@ -31,6 +31,10 @@ #include "mdccommon.h" #include "mdesession.h" +#ifdef LOC_REVERSEGEOCODE +#include "rlocationgeotagger.h" +#endif //LOC_REVERSEGEOCODE + // CONSTANTS // Logging path _LIT( KLocationManagerTestScripterLogPath, "\\logs\\testframework\\LocationManagerTestScripter\\" ); @@ -136,7 +140,19 @@ TInt GetStatus2L( CStifItemParser& aItem ); //ADD NEW METHOD DEC HERE //[TestMethods] - Do not remove - + +#ifdef LOC_REVERSEGEOCODE + TInt ConnectGeoTaggerL( CStifItemParser& /*aItem*/ ); + TInt CloseGeoTaggerL( CStifItemParser& /*aItem*/ ); + TInt StartGeoTaggingL( CStifItemParser& aItem ); + + TInt TestGeoTagCompleteStatusL( CStifItemParser& aItem ); + TInt TestGeoTagPendingStatusL( CStifItemParser& aItem ); + TInt TestGeoTagGoingOnStatusL( CStifItemParser& aItem ); + + TInt CancelGeoTaggingL( CStifItemParser& aItem ) ; +#endif //LOC_REVERSEGEOCODE + public: // From MTrackLogObserver void TrackLogStarted(TInt aError); void TrackLogStopped(TInt aError); @@ -155,7 +171,11 @@ CMdESession* iMdeSession; CActiveSchedulerWait* iASW; - + +#ifdef LOC_REVERSEGEOCODE + RLocationGeoTagger iLocationGeoTagger; + TBool iLocGeoTaggerConnected; +#endif //LOC_REVERSEGEOCODE }; #endif // LOCATIONMANAGERTESTSCRIPTER_H diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripter.cpp --- a/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripter.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripter.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -43,6 +43,11 @@ // void CLocationManagerTestScripter::ConstructL() { + +#ifdef LOC_REVERSEGEOCODE + iLocGeoTaggerConnected = EFalse; +#endif //LOC_REVERSEGEOCODE + //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripterBlocks.cpp --- a/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripterBlocks.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripterBlocks.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -88,9 +88,16 @@ ENTRY( "DeleteFile" , CLocationManagerTestScripter::DeleteFileL ), ENTRY( "GetStatus" , CLocationManagerTestScripter::GetStatusL ), ENTRY( "GetStatus2" , CLocationManagerTestScripter::GetStatus2L ) - //ADD NEW ENTRY HERE - // [test cases entries] - Do not remove +#ifdef LOC_REVERSEGEOCODE + ,ENTRY( "ConnectGeoTaggerL", CLocationManagerTestScripter::ConnectGeoTaggerL ) + ,ENTRY( "CloseGeoTaggerL", CLocationManagerTestScripter::CloseGeoTaggerL ) + ,ENTRY( "StartGeoTaggingL", CLocationManagerTestScripter::StartGeoTaggingL ) + ,ENTRY( "TestGeoTagCompleteStatusL", CLocationManagerTestScripter::TestGeoTagCompleteStatusL ) + ,ENTRY( "TestGeoTagPendingStatusL", CLocationManagerTestScripter::TestGeoTagPendingStatusL ) + ,ENTRY( "TestGeoTagGoingOnStatusL", CLocationManagerTestScripter::TestGeoTagGoingOnStatusL ) + ,ENTRY( "CancelGeoTaggingL", CLocationManagerTestScripter::CancelGeoTaggingL ) +#endif //LOC_REVERSEGEOCODE }; const TInt count = sizeof( KFunctions ) / diff -r 63c982fb92f2 -r b73252188534 mds_plat/location_manager_api/tsrc/src/RLocationObjectManipulatorTest.cpp --- a/mds_plat/location_manager_api/tsrc/src/RLocationObjectManipulatorTest.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/location_manager_api/tsrc/src/RLocationObjectManipulatorTest.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -334,5 +334,212 @@ aLocationData.iQuality = 1; } -// End of file + +#ifdef LOC_REVERSEGEOCODE +TInt CLocationManagerTestScripter::ConnectGeoTaggerL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "ConnectGeoTaggerL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if(!iLocGeoTaggerConnected) + { + User::LeaveIfError( iLocationGeoTagger.Connect() ); + } + + iLocGeoTaggerConnected = ETrue; + return KErrNone; + } + +TInt CLocationManagerTestScripter::CloseGeoTaggerL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "CloseGeoTaggerL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iLocationGeoTagger.Close() ; + iLocGeoTaggerConnected = EFalse; + + return KErrNone; + } + + +TInt CLocationManagerTestScripter::StartGeoTaggingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter StartGeoTagging" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + //rav + + if(!iLocGeoTaggerConnected) + { + User::LeaveIfError( iLocationGeoTagger.Connect() ); + } + + iLocGeoTaggerConnected = ETrue; + + + + TRequestStatus status(KRequestPending); + TConnectionOption conOption(ESilent); + iLocationGeoTagger.StartGeoTagging(status,conOption); + User::WaitForRequest( status ); + + _LIT( KMsg3, " status.Int() =%d" ); + iLog->Log( KMsg3,status.Int() ); + + TL( status.Int() == KErrNone ); + + + _LIT( KMsg2, "Exit StartGeoTagging" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagCompleteStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagCompleteStatusL( CStifItemParser& /*aItem*/) + { + _LIT( KMsg1, "TestGeoTagCompleteStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTaggingPending; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + TL(tagPendingFlag == EGeoTagCmpt); + + _LIT( KMsg2, "TestGeoTagCompleteStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagPendingStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagPendingStatusL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "TestGeoTagPendingStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt fntype; + aItem.GetNextInt(fntype); + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTagCmpt; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + if(fntype == 0 ) + { + //for geotagged photos the tag status will be pending + TL(tagPendingFlag == EGeoTaggingPending); + } + else + { + //for geotagged photos the tag status will be pending + TL(tagPendingFlag == EGeoTagCmpt); + } + + _LIT( KMsg2, "TestGeoTagPendingStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagGoingOnStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagGoingOnStatusL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "TestGeoTagGoingOnStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt fntype; + aItem.GetNextInt(fntype); + + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTagCmpt; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + if(fntype == 0 ) + { + if(tagPendingFlag == EGeoTaggingPending) + { + TConnectionOption conOption(ESilent); + status = KRequestPending; + iLocationGeoTagger.StartGeoTagging(status,conOption); + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + TL(tagPendingFlag == EGeoTaggingGoingOn); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + } + } + else + { + TL(tagPendingFlag == EGeoTagCmpt); + } + + _LIT( KMsg2, "TestGeoTagGoingOnStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + + +TInt CLocationManagerTestScripter::CancelGeoTaggingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter CancelGeoTaggingL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status(KRequestPending); + TConnectionOption conOption(ESilent); + iLocationGeoTagger.StartGeoTagging(status,conOption); + iLocationGeoTagger.CancelGeoTaggingRequest(); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + + _LIT( KMsg2, "CancelGeoTaggingL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + + } +#endif //LOC_REVERSEGEOCODE + + // End of file diff -r 63c982fb92f2 -r b73252188534 mds_plat/metadata_engine_api/inc/mdeconstants.h --- a/mds_plat/metadata_engine_api/inc/mdeconstants.h Thu Jul 15 19:07:24 2010 +0300 +++ b/mds_plat/metadata_engine_api/inc/mdeconstants.h Thu Aug 19 10:20:41 2010 +0300 @@ -130,6 +130,12 @@ { _LIT( KTagObject, "Tag" ); _LIT( KTagItemType, "application/vnd.nokia.mde.tag" ); + enum TTagType + { + EUserDefineTags = 0, + ESystemDefineCityTags = 1, + ESystemDefineCountryTags = 2 + }; } namespace MediaObject diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/group/mdeclient.mmp --- a/metadataengine/client/group/mdeclient.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/group/mdeclient.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -32,7 +32,7 @@ #if defined(WINSCW) deffile ../bwincw/mdeclientu.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/mdeclientu.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeasynchronousfindao.cpp --- a/metadataengine/client/src/mdeasynchronousfindao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeasynchronousfindao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -132,8 +132,10 @@ Cancel(); // Causes call to DoCancel() delete iDistinctResults; + iDistinctResults = NULL; delete iConditionBuffer; + iConditionBuffer = NULL; iResultList.ResetAndDestroy(); iResultList.Close(); diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeevent.cpp --- a/metadataengine/client/src/mdeevent.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeevent.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -70,7 +70,9 @@ CMdEEvent::~CMdEEvent() { delete iSource; + iSource = NULL; delete iParticipant; + iParticipant = NULL; } CMdEEvent* CMdEEvent::NewL(CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef ) diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeeventcondition.cpp --- a/metadataengine/client/src/mdeeventcondition.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeeventcondition.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -94,10 +94,15 @@ CMdEEventCondition::~CMdEEventCondition() { delete iCreationTimeRange; + iCreationTimeRange = NULL; delete iObjectConditions; + iObjectConditions = NULL; delete iSourceConditions; + iSourceConditions = NULL; delete iParticipantConditions; + iParticipantConditions = NULL; delete iURI; + iURI = NULL; } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeharvestersession.cpp --- a/metadataengine/client/src/mdeharvestersession.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeharvestersession.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -45,6 +45,7 @@ { iHarvestingPrioritizationChunk.Close(); delete iHarvestingPrioritizationSerializationBuffer; + iHarvestingPrioritizationSerializationBuffer = NULL; } void CMdEHarvesterSession::ConstructL() @@ -112,12 +113,20 @@ } // Note: CopyLC doesn't push anything to cleanup stack - uri->Des().CopyLC( aUri ); + TRAPD(err, uri->Des().CopyLC( aUri )); + if(err != KErrNone) + { + delete uri; + uri = NULL; + return EFalse; + } + const TBool ret = iSession->EngineSession().DoSetFileToPresent( - aMediaId, *uri, aFileInfo ); + aMediaId, *uri, aFileInfo ); delete uri; + uri = NULL; return ret; } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdenotifierao.cpp --- a/metadataengine/client/src/mdenotifierao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdenotifierao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -66,6 +66,7 @@ { Cancel(); // Causes call to DoCancel() delete iDataBuffer; + iDataBuffer = NULL; iIdArray.Close(); iRelationItemArray.Close(); } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeobject.cpp --- a/metadataengine/client/src/mdeobject.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeobject.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -582,6 +582,7 @@ CMdEProperty* oldProperty = iPropertyArray[f]; iPropertyArray[f] = &aProperty; delete oldProperty; + oldProperty = NULL; } else if (err < KErrNone) { @@ -743,6 +744,7 @@ CMdEProperty* oldProperty = iPropertyArray[f]; iPropertyArray[f] = aObject.iPropertyArray[i]; delete oldProperty; + oldProperty = NULL; } else if (err < KErrNone) { @@ -817,6 +819,7 @@ if ( prop->Removed() ) { delete prop; + prop = NULL; iPropertyArray.Remove( i ); continue; } @@ -1055,6 +1058,7 @@ CMdEProperty* oldProperty = newObject->iPropertyArray[f]; newObject->iPropertyArray[f] = property; delete oldProperty; + oldProperty = NULL; } else if (err < KErrNone) { diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeobjectcondition.cpp --- a/metadataengine/client/src/mdeobjectcondition.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeobjectcondition.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -144,15 +144,18 @@ CMdEObjectCondition::~CMdEObjectCondition() { delete iString; + iString = NULL; if( iObjectIds ) { iObjectIds->Close(); delete iObjectIds; + iObjectIds = NULL; } delete iRange; + iRange = NULL; } EXPORT_C const CMdEObjectDef* CMdEObjectCondition::ObjectDef() const diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdeproperty.cpp --- a/metadataengine/client/src/mdeproperty.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdeproperty.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -95,6 +95,7 @@ if (iDef.PropertyType() == EPropertyText) { delete iValue.iText; + iValue.iText = NULL; } } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdequery.cpp --- a/metadataengine/client/src/mdequery.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdequery.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -46,13 +46,15 @@ // This will destroy the entire conditions tree. delete iConditions; - + iConditions = NULL; + // Destroy all result items this query instance owns. for( TInt i = iResults.Count() - 1; i >=0; i-- ) { if(iResults[i].iOwned) { delete iResults[i].iItem; + iResults[i].iItem = NULL; } } @@ -77,6 +79,7 @@ iObservers.Close(); delete iDistinctResults; + iDistinctResults = NULL; } @@ -154,6 +157,7 @@ if(iResults[i].iOwned) { delete iResults[i].iItem; + iResults[i].iItem = NULL; } } iResults.Reset(); diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdequerycriteriaserialization.cpp --- a/metadataengine/client/src/mdequerycriteriaserialization.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdequerycriteriaserialization.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -86,6 +86,7 @@ if( iOwnSerializedBuffer ) { delete iSerializedBuffer; + iSerializedBuffer = NULL; } } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdequeryimpl.cpp --- a/metadataengine/client/src/mdequeryimpl.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdequeryimpl.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -70,6 +70,7 @@ iAsyncFind->Cancel(); delete iAsyncFind; + iAsyncFind = NULL; } } @@ -152,6 +153,7 @@ CMdERelationQueryImpl::~CMdERelationQueryImpl() { delete iAsyncFind; + iAsyncFind = NULL; } @@ -226,6 +228,7 @@ CMdEEventQueryImpl::~CMdEEventQueryImpl() { delete iAsyncFind; + iAsyncFind = NULL; } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mderelationcondition.cpp --- a/metadataengine/client/src/mderelationcondition.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mderelationcondition.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -85,14 +85,19 @@ CMdERelationCondition::~CMdERelationCondition() { delete iLeftCondition; + iLeftCondition = NULL; delete iRightCondition; + iRightCondition = NULL; delete iParameterRange; + iParameterRange = NULL; delete iLastModifiedDateRange; + iLastModifiedDateRange = NULL; if( iRelationIds ) { iRelationIds->Close(); delete iRelationIds; + iRelationIds = NULL; } } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdesessionimpl.cpp --- a/metadataengine/client/src/mdesessionimpl.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdesessionimpl.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -241,6 +241,7 @@ iSessionObserver = NULL; delete iSchemaBuffer; + iSchemaBuffer = NULL; iNotifiers.ResetAndDestroy(); iNotifiers.Close(); @@ -254,8 +255,10 @@ iNamespaceDefs.Close(); delete iSessionStartupAO; + iSessionStartupAO = NULL; delete iAsyncHandler; + iAsyncHandler = NULL; } void CMdESessionImpl::ConstructL() @@ -359,7 +362,8 @@ { User::Leave( KErrMdENotLocked ); } - items.Append( obj ); + + items.AppendL( obj ); } UpdateItemsL(items); @@ -536,6 +540,7 @@ } delete iSchemaBuffer; + iSchemaBuffer = NULL; iSchemaBuffer = schemaBuffer; @@ -2694,6 +2699,7 @@ { const TInt index = iNotifiers.Find( aNotifier ); delete aNotifier; + aNotifier = NULL; iNotifiers.Remove( index ); } diff -r 63c982fb92f2 -r b73252188534 metadataengine/client/src/mdetextpropertycondition.cpp --- a/metadataengine/client/src/mdetextpropertycondition.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/client/src/mdetextpropertycondition.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -62,6 +62,7 @@ CMdETextPropertyCondition::~CMdETextPropertyCondition() { delete iText; + iText = NULL; } TUint32 CMdETextPropertyCondition::InternalQueryOptimizationFlags(TUint32& aFlags) diff -r 63c982fb92f2 -r b73252188534 metadataengine/common/group/mdccommon.mmp --- a/metadataengine/common/group/mdccommon.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/common/group/mdccommon.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -29,7 +29,7 @@ #if defined(WINSCW) deffile ../bwincw/mdccommonu.def -#elif defined(ARMCC) +#elif defined(EABI) deffile ../eabi/mdccommonu.def #endif nostrictdef diff -r 63c982fb92f2 -r b73252188534 metadataengine/common/src/mdcserializationbuffer.cpp --- a/metadataengine/common/src/mdcserializationbuffer.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/common/src/mdcserializationbuffer.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -163,6 +163,7 @@ CMdCSerializationBuffer::~CMdCSerializationBuffer() { delete iHeapBuffer; + iHeapBuffer = NULL; } EXPORT_C TPtr8 CMdCSerializationBuffer::Buffer() const diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/group/mdsserver.mmp --- a/metadataengine/server/group/mdsserver.mmp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/group/mdsserver.mmp Thu Aug 19 10:20:41 2010 +0300 @@ -93,7 +93,6 @@ LIBRARY flogger.lib LIBRARY hash.lib LIBRARY inetprotutil.lib -LIBRARY platformenv.lib UNPAGED diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/inc/mdslogger.h --- a/metadataengine/server/inc/mdslogger.h Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/inc/mdslogger.h Thu Aug 19 10:20:41 2010 +0300 @@ -159,7 +159,7 @@ #define __DEFINE_LOGGER class CMdSLogger* gLogger; #define __USES_LOGGER extern CMdSLogger* gLogger; #define __INIT_LOGGER gLogger = CMdSLogger::NewInstanceL(); - #define __DESTROY_LOGGER {if(gLogger){delete gLogger;gLogger=NULL;}} + #define __DESTROY_LOGGER {if(gLogger){delete gLogger; gLogger=NULL;}} #define __LOGLB(CATEGORY,A) {if (gLogger->IsActive(CATEGORY)) { gLogger->LogLit( _L(A) ); }} #define __LOG(CATEGORY,A) {if (gLogger->IsActive(CATEGORY)) { gLogger->LogLit( A ); }} #ifdef MDE_FILE_LOGGING @@ -177,7 +177,7 @@ {__LOG( ELogQuery, INFO); \ CMdsClauseBuffer* queryText = gLogger->DescribeFullL(BUFFER,ROWDATA); \ if ( queryText ) { __LOG( ELogQuery, queryText->ConstBufferL() ); \ - delete queryText;} } + delete queryText; queryText = NULL;} } #else //LOG_QUERY #define __LOGQUERY_16(INFO, BUFFER, ROWDATA) #endif //LOG_QUERY diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/inc/mdspreferences.h --- a/metadataengine/server/inc/mdspreferences.h Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/inc/mdspreferences.h Thu Aug 19 10:20:41 2010 +0300 @@ -225,7 +225,7 @@ EPreferenceExtraSortAsc | EPreferenceExtraSortDesc; - CMdsClauseBuffer* sortBuffer = CMdsClauseBuffer::NewLC( 8 ); // estimated minimum lenght for sort rules + CMdsClauseBuffer* sortBuffer = CMdsClauseBuffer::NewLC( 12 ); // minimum reserved lenght for sort rules // check if there is some order rules if( KSortFlags & aFlags ) diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/inc/mdsserversession.h --- a/metadataengine/server/inc/mdsserversession.h Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/inc/mdsserversession.h Thu Aug 19 10:20:41 2010 +0300 @@ -427,6 +427,7 @@ ~CNotificationCacheItem() { delete iData; + iData = NULL; } public: diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsclausebuffer.cpp --- a/metadataengine/server/src/mdsclausebuffer.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsclausebuffer.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -54,6 +54,7 @@ CMdsClauseBuffer::~CMdsClauseBuffer() { delete iBuffer; + iBuffer = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsfindengine.cpp --- a/metadataengine/server/src/mdsfindengine.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsfindengine.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -133,7 +133,9 @@ CMdSFindEngine::~CMdSFindEngine() { delete iSerializedCriteria; + iSerializedCriteria = NULL; delete iSequence; + iSequence = NULL; } // --------------------------------------------------------------------------- diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsfindsqlclause.cpp --- a/metadataengine/server/src/mdsfindsqlclause.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsfindsqlclause.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -61,6 +61,7 @@ CMdSFindSqlClause::~CMdSFindSqlClause() { delete iQueryBuf; + iQueryBuf = NULL; iResultRow.Close(); iVariables.Close(); @@ -76,6 +77,7 @@ iSourceObjectDefs->Close(); delete iSourceObjectDefs; + iSourceObjectDefs = NULL; } } diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsgetimeiao.cpp --- a/metadataengine/server/src/mdsgetimeiao.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsgetimeiao.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -47,6 +47,7 @@ Cancel(); delete iTelephony; + iTelephony = NULL; } TInt64 CMdsGetImeiAO::GetIMEI() diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsimportexport.cpp --- a/metadataengine/server/src/mdsimportexport.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsimportexport.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -118,6 +118,7 @@ CMdsImportExport::~CMdsImportExport() { delete iConverter; + iConverter = NULL; #ifdef _DEBUG if( iLogEnabled ) @@ -129,8 +130,10 @@ iFs.Close(); delete iBuffer; + iBuffer = NULL; delete iSchema; + iSchema = NULL; } /** diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsitemdef.cpp --- a/metadataengine/server/src/mdsitemdef.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsitemdef.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -52,6 +52,7 @@ CMdsItemDef::~CMdsItemDef() { delete iName; + iName = NULL; } TUint32 CMdsItemDef::RequiredBufferSize() diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsmaintenanceengine.cpp --- a/metadataengine/server/src/mdsmaintenanceengine.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsmaintenanceengine.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -16,8 +16,6 @@ */ // INCLUDE FILES -#include - #include "mdsmaintenanceengine.h" #include "mdslogger.h" #include "mdsmanipulationengine.h" @@ -79,6 +77,7 @@ CMdSMaintenanceEngine::~CMdSMaintenanceEngine() { delete iMaintenance; + iMaintenance = NULL; } // ------------------------------------------------ @@ -117,7 +116,17 @@ void CMdSMaintenanceEngine::InstallL( CMdSManipulationEngine& aManipulate, CMdsSchema& aSchema ) { __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 ); - if ( !(iMaintenance->ValidateL( ) ) ) + + TBool isValid(EFalse); + TRAPD(err, isValid = iMaintenance->ValidateL( )); + + if(err == KErrCorrupt) + { + DeleteDatabase(); + User::Leave( err ); + } + + else if ( !isValid ) { // Pump up priority to load the MDS DB up as fast as possible to // enable client side session connections @@ -272,31 +281,6 @@ User::LeaveIfError( fs.Volume( volumeInfo, EDriveC ) ); MMdsPreferences::InsertL( KCMediaIdKey, MMdsPreferences::EPreferenceValueSet, (TUint32) volumeInfo.iUniqueID ); - - TInt drive( -1 ); - TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) ); - if( massStorageError == KErrNone ) - { - TVolumeInfo massStorageVolumeInfo; - massStorageError = fs.Volume( massStorageVolumeInfo, drive ); - if( massStorageError == KErrNone ) - { - const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID ); - massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); - if( massStorageError == KErrNone ) - { - massStorageError = fs.Volume( massStorageVolumeInfo, drive ); - // Update mass storage media id if the mass storage is not memory card - if( massStorageError == KErrNone && - massStorageVolumeInfo.iUniqueID != massStorageMediaId && - massStorageMediaId != 0 ) - { - MMdsPreferences::InsertL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, - (TUint32) massStorageMediaId ); - } - } - } - } CleanupStack::PopAndDestroy( &fs ); } diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsmanipulationengine.cpp --- a/metadataengine/server/src/mdsmanipulationengine.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsmanipulationengine.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -93,8 +93,10 @@ CMdSManipulationEngine::~CMdSManipulationEngine() { delete iManipulate; + iManipulate = NULL; delete iGarbageCollector; + iGarbageCollector = NULL; } // --------------------------------------------------------------------------- @@ -153,7 +155,7 @@ CleanupClosePushL(objStmt); RMdSTransaction transaction( connection ); - CleanupClosePushL(transaction); + CleanupClosePushL (transaction ); const TInt beginError( transaction.Error() ); if( beginError != KErrNone ) { @@ -1072,13 +1074,19 @@ CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL(); RMdSTransaction transaction( connection ); CleanupClosePushL( transaction ); - User::LeaveIfError( transaction.Error() ); + const TInt beginError( transaction.Error() ); + if( beginError != KErrNone ) + { + CleanupStack::PopAndDestroy( &transaction ); + } iManipulate->CheckMassStorageMediaIdL( aMediaId ); - transaction.CommitL(); - - CleanupStack::PopAndDestroy( &transaction ); + if( beginError == KErrNone ) + { + transaction.CommitL(); + CleanupStack::PopAndDestroy( &transaction ); + } } void CMdSManipulationEngine::AddRelationDefL( TDefId aNamespaceId, const TDesC& aRelationDefName ) diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsnotifier.cpp --- a/metadataengine/server/src/mdsnotifier.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsnotifier.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -80,6 +80,7 @@ CMdSNotifier::~CMdSNotifier() { delete iComparator; + iComparator = NULL; const TInt count = iEntries.Count(); @@ -586,7 +587,9 @@ } delete e.iSerializedCondition; + e.iSerializedCondition = NULL; delete e.iDataBuffer; + e.iDataBuffer = NULL; iEntries.Remove( i ); } } diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsschema.cpp --- a/metadataengine/server/src/mdsschema.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsschema.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -78,6 +78,7 @@ iProperties.Close(); delete iBaseObject; + iBaseObject = NULL; } void CMdsSchema::Reset() diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsserver.cpp --- a/metadataengine/server/src/mdsserver.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsserver.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -403,6 +403,7 @@ // TRAP InstallL - first time for if there has been schema update, and // the DB version is too old. Delete the DB and try to recreate it TRAPD( error, iMaintenance->InstallL( *iManipulate, *iSchema ) ); + if( error == KErrCorrupt ) { delete iSchema; @@ -419,6 +420,7 @@ // during update, and the first attempt to recreate the DB fails. // Then schema file in rom is used for final attempt to recreate the DB TRAP( error, iMaintenance->InstallL( *iManipulate, *iSchema ) ); + if( error == KErrCorrupt ) { delete iSchema; @@ -487,19 +489,30 @@ iClientThread.Close(); delete iBURWatcher; + iBURWatcher = NULL; delete iDiskSpaceGarbageCollectorNotifier; + iDiskSpaceGarbageCollectorNotifier = NULL; delete iDiskFullNotifier; + iDiskFullNotifier = NULL; delete iManipulate; + iManipulate = NULL; delete iSchema; + iSchema = NULL; delete iNotifier; + iNotifier = NULL; delete iLockList; + iLockList = NULL; delete iMaintenance; + iMaintenance = NULL; delete iDefaultDBConnection; + iDefaultDBConnection = NULL; delete iHarvestingPrioritizationSerializationBuffer; + iHarvestingPrioritizationSerializationBuffer = NULL; iHarvestingPrioritizationChunk.Close(); delete iShutdownObserver; + iShutdownObserver = NULL; __LOGLB( ELogAlways, "Server stop" ); __DESTROY_LOGGER; @@ -947,6 +960,7 @@ { TRAP(result, CMdSServer::ThreadFunctionL()); delete cleanup; + cleanup = NULL; } __UHEAP_MARKEND; return result; diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdsserversession.cpp --- a/metadataengine/server/src/mdsserversession.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdsserversession.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -601,7 +601,7 @@ CleanupStack::Pop( find ); - iFindEngines.Append( find ); + iFindEngines.AppendL( find ); } // --------------------------------------------------------------------------- @@ -641,7 +641,7 @@ CleanupStack::Pop( find ); - iFindEngines.Append( find ); + iFindEngines.AppendL( find ); } // --------------------------------------------------------------------------- @@ -678,6 +678,7 @@ else if( findEngine->IsComplete() ) { delete findEngine; + findEngine = NULL; iFindEngines.Remove( feIndex ); @@ -708,6 +709,7 @@ findEngine->Cancel( aError ); delete findEngine; + findEngine = NULL; iFindEngines.Remove( i ); @@ -864,6 +866,7 @@ if ( serverRequest != EAsyncFindSetReady ) { delete findEngine; + findEngine = NULL; iFindEngines.Remove( findEngineIndex ); iFindEngines.Compress(); diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdssqldbmaintenance.cpp --- a/metadataengine/server/src/mdssqldbmaintenance.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdssqldbmaintenance.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -50,15 +50,153 @@ TBool CMdSSqlDbMaintenance::ValidateL( ) { + //validate content of critical tables _LIT( KValidateTableExistence, "SELECT COUNT(*) FROM MdE_Preferences;" ); + _LIT( KValidateObjectDef, "SELECT COUNT(*) FROM ObjectDef;" ); + _LIT( KValidatePropertyDef, "SELECT COUNT(*) FROM PropertyDef;" ); + _LIT( KValidateRelationDef, "SELECT COUNT(*) FROM RelationDef;" ); + _LIT( KValidateCol2Prop, "SELECT COUNT(*) FROM Col2Prop;" ); + TInt test(KErrNone); + TUint32 count(0); + + RRowData emptyRowData; + CleanupClosePushL( emptyRowData ); + RMdsStatement validationQuery; CleanupClosePushL( validationQuery ); - RRowData emptyRowData; - CleanupClosePushL( emptyRowData ); + CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL(); - TRAPD( test, connection.ExecuteQueryL( KValidateTableExistence, validationQuery, emptyRowData ) ); - CleanupStack::PopAndDestroy( 2, &validationQuery ); + + TRAP( test, connection.ExecuteQueryL( KValidateTableExistence, validationQuery, emptyRowData ) ); + if(test == KErrNone) + { + emptyRowData.AppendL( TColumn( count ) ); + TRAP( test, connection.NextRowL(validationQuery, emptyRowData)); + if(test == KErrNone) + { + emptyRowData.Column(0).Get( count ); + + if(count <= 0) + { + test = KErrCorrupt; + } + } + } + + CleanupStack::PopAndDestroy( &validationQuery ); + emptyRowData.Reset(); + + RMdsStatement objectDefQuery; + CleanupClosePushL( objectDefQuery ); + + if( test == KErrNone ) + { + TRAP( test, connection.ExecuteQueryL( KValidateObjectDef, objectDefQuery, emptyRowData ) ); + + if(test == KErrNone) + { + emptyRowData.AppendL( TColumn( count ) ); + TRAP( test, connection.NextRowL(objectDefQuery, emptyRowData)); + if(test == KErrNone) + { + emptyRowData.Column(0).Get( count ); + + if(count <= 0) + { + test = KErrCorrupt; + } + } + } + } + + CleanupStack::PopAndDestroy( &objectDefQuery ); + emptyRowData.Reset(); + + RMdsStatement propertyDefQuery; + CleanupClosePushL( propertyDefQuery ); + + if( test == KErrNone ) + { + TRAP( test, connection.ExecuteQueryL( KValidatePropertyDef, propertyDefQuery, emptyRowData ) ); + if(test == KErrNone) + { + emptyRowData.AppendL( TColumn( count ) ); + TRAP( test, connection.NextRowL(propertyDefQuery, emptyRowData)); + if(test == KErrNone) + { + emptyRowData.Column(0).Get( count ); + + if(count <= 0) + { + test = KErrCorrupt; + } + } + } + } + + CleanupStack::PopAndDestroy( &propertyDefQuery ); + emptyRowData.Reset(); + + RMdsStatement relationDefQuery; + CleanupClosePushL( relationDefQuery ); + + if( test == KErrNone ) + { + TRAP( test, connection.ExecuteQueryL( KValidateRelationDef, relationDefQuery, emptyRowData ) ); + if(test == KErrNone) + { + emptyRowData.AppendL( TColumn( count ) ); + TRAP( test, connection.NextRowL(relationDefQuery, emptyRowData)); + + if(test == KErrNone) + { + emptyRowData.Column(0).Get( count ); + + if(count <= 0) + { + test = KErrCorrupt; + } + } + } + } + + CleanupStack::PopAndDestroy( &relationDefQuery ); + emptyRowData.Reset(); + + RMdsStatement col2propQuery; + CleanupClosePushL( col2propQuery ); + + if( test == KErrNone ) + { + TRAP( test, connection.ExecuteQueryL( KValidateCol2Prop, col2propQuery, emptyRowData ) ); + if(test == KErrNone) + { + emptyRowData.AppendL( TColumn( count ) ); + TRAP( test, connection.NextRowL(col2propQuery, emptyRowData)); + + if(test == KErrNone) + { + emptyRowData.Column(0).Get( count ); + + if(count <= 0) + + { + test = KErrCorrupt; + } + } + } + } + CleanupStack::PopAndDestroy( &col2propQuery ); + emptyRowData.Reset(); + + CleanupStack::PopAndDestroy( &emptyRowData ); + + if(test == KErrCorrupt ) + { + User::Leave( test ); + } + return ( test == KErrNone ); } diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdssqlfindoperation.cpp --- a/metadataengine/server/src/mdssqlfindoperation.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdssqlfindoperation.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -86,7 +86,9 @@ iQueryId.Close(); delete iResults; + iResults = NULL; delete iFindClause; + iFindClause = NULL; } TInt CMdSSqlFindOperation::ExecuteL() diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdssqliteconnection.cpp --- a/metadataengine/server/src/mdssqliteconnection.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdssqliteconnection.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -48,6 +48,7 @@ CloseDb(); delete iDbFileName; + iDbFileName = NULL; iNotFinishFindQuery = NULL; } @@ -543,6 +544,11 @@ if (err != KErrNone) { _LIT( KMdsTransactionBegin, "Transaction begin error" ); + if( !iNotFinishFindQuery ) + { + iEnableTransaction = ETrue; + } + iTransactionOngoing = EFalse; TraceAndLeaveL( KMdsTransactionBegin, err ); } CleanupStack::PopAndDestroy( &emptyRow ); @@ -581,16 +587,16 @@ RRowData emptyRow; CleanupClosePushL( emptyRow ); TRAPD( err, ExecuteL(KRollback, emptyRow) ); + if (err != KErrNone) + { + _LIT( KMdsTransactionRollback, "Transaction rollback error" ); + TraceAndLeaveL( KMdsTransactionRollback, err ); + } if( !iNotFinishFindQuery ) { iEnableTransaction = ETrue; } iTransactionOngoing = EFalse; - if (err != KErrNone) - { - _LIT( KMdsTransactionRollback, "Transaction rollback error" ); - TraceAndLeaveL( KMdsTransactionRollback, err ); - } CleanupStack::PopAndDestroy( &emptyRow ); } diff -r 63c982fb92f2 -r b73252188534 metadataengine/server/src/mdssqlobjectmanipulate.cpp --- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -71,6 +71,7 @@ CMdSIdentifierGenerator::~CMdSIdentifierGenerator() { delete iDigest; + iDigest = NULL; } void CMdSIdentifierGenerator::ConstructL( ) @@ -178,11 +179,14 @@ for (TInt i = 0; i < count; ++i) { delete iBuffers[i].iBuffer; + iBuffers[i].iBuffer = NULL; } iBuffers.Close(); delete iGenerator; + iGenerator = NULL; delete iUri; + iUri = NULL; } CMdSSqlObjectManipulate::CMdSSqlObjectManipulate( const CMdsSchema& aSchema, diff -r 63c982fb92f2 -r b73252188534 rom/mds_cellid_reverse_geocode_enabled.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/mds_cellid_reverse_geocode_enabled.iby Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Metadata system iby file (for ROM image creation) +* +* +*/ + + +#ifndef __METADATA_IBY__ +#define __METADATA_IBY__ + +// sql is mandatory for mds +#include + +rem - MdE binaries +file=ABI_DIR\BUILD_DIR\mdeclient.dll SHARED_LIB_DIR\mdeclient.dll +file=ABI_DIR\BUILD_DIR\mdccommon.dll SHARED_LIB_DIR\mdccommon.dll +file=ABI_DIR\BUILD_DIR\!mdsserver.exe PROGRAMS_DIR\!mdsserver.exe + +rem - MdE data files +data=EPOCROOT##epoc32\data\z\Private\200009F3\schema.mde PRIVATE\200009F3\schema.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\defaultimportfile.mde PRIVATE\200009F3\defaultimportfile.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\backup_registration.xml PRIVATE\200009F3\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\backup_registration.xml PRIVATE\200009F5\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\mappings.db PRIVATE\200009F5\mappings.db + +rem - Harvester and Context Engine binaries +file=ABI_DIR\BUILD_DIR\HarvesterPluginInterface.dll SHARED_LIB_DIR\HarvesterPluginInterface.dll +file=ABI_DIR\BUILD_DIR\HarvesterClient.dll SHARED_LIB_DIR\HarvesterClient.dll +file=ABI_DIR\BUILD_DIR\HarvesterServer.exe PROGRAMS_DIR\HarvesterServer.exe +file=ABI_DIR\BUILD_DIR\harvestercommon.dll SHARED_LIB_DIR\harvestercommon.dll +file=ABI_DIR\BUILD_DIR\harvesterdata.dll SHARED_LIB_DIR\harvesterdata.dll +file=ABI_DIR\BUILD_DIR\mdsfileserverplugin.pxt SHARED_LIB_DIR\mdsfileserverplugin.pxt +ECOM_PLUGIN(HarvesterImagePlugin.dll,HarvesterImagePlugin.rsc) +ECOM_PLUGIN(HarvesterVideoPlugin.dll,HarvesterVideoPlugin.rsc) +ECOM_PLUGIN(HarvesterMessagePlugin.dll,HarvesterMessagePlugin.rsc) +ECOM_PLUGIN(harvesteromadrmplugin.dll,harvesteromadrmplugin.rsc) +ECOM_PLUGIN(harvesterwmvplugin.dll,harvesterwmvplugin.rsc) +ECOM_PLUGIN(harvesterrtpplugin.dll,harvesterrtpplugin.rsc) +ECOM_PLUGIN(harvesteraudioplugin.dll,harvesteraudioplugin.rsc) + +rem - Blacklist server binaries +file=ABI_DIR\BUILD_DIR\!blacklistserver.exe PROGRAMS_DIR\!blacklistserver.exe +file=ABI_DIR\BUILD_DIR\blacklistclient.dll SHARED_LIB_DIR\blacklistclient.dll + +file=ABI_DIR\BUILD_DIR\MonitorPluginInterface.dll SHARED_LIB_DIR\MonitorPluginInterface.dll +ECOM_PLUGIN(MMCMonitorPlugin.dll,MMCMonitorPlugin.rsc) +ECOM_PLUGIN(FileMonitorPlugin.dll,FileMonitorPlugin.rsc) +ECOM_PLUGIN(MessageMonitorPlugin.dll,MessageMonitorPlugin.rsc) +ECOM_PLUGIN(mdsoomplugin.dll,mdsoomplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ContextPluginInterface.dll SHARED_LIB_DIR\ContextPluginInterface.dll +file=ABI_DIR\BUILD_DIR\ContextEngine.dll SHARED_LIB_DIR\ContextEngine.dll +ECOM_PLUGIN(locationcontextplugin.dll,locationcontextplugin.rsc) +ECOM_PLUGIN(calendarcontextplugin.dll,calendarcontextplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ComposerPluginInterface.dll SHARED_LIB_DIR\ComposerPluginInterface.dll +ECOM_PLUGIN(ComposerImagePlugin.dll,ComposerImagePlugin.rsc) + +// Location Manager +REM locationmanager +file=ABI_DIR\BUILD_DIR\locationmanager.dll SHARED_LIB_DIR\locationmanager.dll + +REM locationmanagerserver +file=ABI_DIR\BUILD_DIR\locationmanagerserver.exe PROGRAMS_DIR\locationmanagerserver.exe + +REM watchdog +file=ABI_DIR\BUILD_DIR\mdswatchdog.exe PROGRAMS_DIR\mdswatchdog.exe + +REM locationtrail +file=ABI_DIR\BUILD_DIR\locationtrail.dll SHARED_LIB_DIR\locationtrail.dll + +REM ReverseGeocode +file=ABI_DIR\BUILD_DIR\ReverseGeocode.dll SHARED_LIB_DIR\ReverseGeocode.dll + +REM Reverse geocoder plugin +ECOM_PLUGIN(ReverseGeoCoderPlugin.dll,reversegeocoderplugin.rsc) + +REM tagcreator +file=ABI_DIR\BUILD_DIR\tagcreator.dll SHARED_LIB_DIR\tagcreator.dll + +REM geotagger +file=ABI_DIR\BUILD_DIR\geotagger.dll SHARED_LIB_DIR\geotagger.dll + +REM geoconverter +file=ABI_DIR\BUILD_DIR\geoconverter.dll SHARED_LIB_DIR\geoconverter.dll + +REM Location Manager data files +data=ZPRIVATE\10202BE9\200071BE.txt "PRIVATE\10202BE9\200071BE.txt" + +REM Harvester Cen Repo file +data=ZPRIVATE\10202BE9\200009FE.txt "PRIVATE\10202BE9\200009FE.txt" + +REM MdS version CenRep file +data=ZPRIVATE\10202BE9\200009F3.txt "PRIVATE\10202BE9\200009F3.txt" + +REM Harvester MMC plugin CenRep file +data=ZPRIVATE\10202BE9\20007183.txt "PRIVATE\10202BE9\20007183.txt" + +data=ZSYSTEM\install\contentlistingframework_stub.sis system\install\contentlistingframework_stub.sis +data=ZSYSTEM\install\contextengine_stub.sis system\install\contextengine_stub.sis +data=ZSYSTEM\install\blacklistserver_stub.sis system\install\blacklistserver_stub.sis +data=ZSYSTEM\install\composerplugins_stub.sis system\install\composerplugins_stub.sis +data=ZSYSTEM\install\harvester_stub.sis system\install\harvester_stub.sis +data=ZSYSTEM\install\harvesterplugins_stub.sis system\install\harvesterplugins_stub.sis +data=ZSYSTEM\install\monitorplugins_stub.sis system\install\monitorplugins_stub.sis +data=ZSYSTEM\install\locationmanager_stub.sis system\install\locationmanager_stub.sis +data=ZSYSTEM\install\metadataengine_stub.sis system\install\metadataengine_stub.sis +data=ZSYSTEM\install\mds_stub.sis system\install\mds_stub.sis +data=ZSYSTEM\install\mdswatchdog_stub.sis system\install\mdswatchdog_stub.sis + +data=ZSYSTEM\install\locationmanagerclient_stub.sis system\install\locationmanagerclient_stub.sis +data=ZSYSTEM\install\locationtrail_stub.sis system\install\locationtrail_stub.sis +data=ZSYSTEM\install\locationmanagerserver_stub.sis system\install\locationmanagerserver_stub.sis + +data=ZSYSTEM\install\ReverseGeocode_stub.sis system\install\ReverseGeocode_stub.sis +data=ZSYSTEM\install\ReverseGeoCoderPlugin_stub.sis system\install\ReverseGeoCoderPlugin_stub.sis +data=ZSYSTEM\install\tagcreator_stub.sis system\install\tagcreator_stub.sis +data=ZSYSTEM\install\geotagger_stub.sis system\install\geotagger_stub.sis +data=ZSYSTEM\install\geoconverter_stub.sis system\install\geoconverter_stub.sis + + + +#endif //__METADATA_IBY__ diff -r 63c982fb92f2 -r b73252188534 rom/mds_cellidenabled.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/mds_cellidenabled.iby Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Metadata system iby file (for ROM image creation) +* +* +*/ + + +#ifndef __METADATA_IBY__ +#define __METADATA_IBY__ + +// sql is mandatory for mds +#include + +rem - MdE binaries +file=ABI_DIR\BUILD_DIR\mdeclient.dll SHARED_LIB_DIR\mdeclient.dll +file=ABI_DIR\BUILD_DIR\mdccommon.dll SHARED_LIB_DIR\mdccommon.dll +file=ABI_DIR\BUILD_DIR\!mdsserver.exe PROGRAMS_DIR\!mdsserver.exe + +rem - MdE data files +data=EPOCROOT##epoc32\data\z\Private\200009F3\schema.mde PRIVATE\200009F3\schema.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\defaultimportfile.mde PRIVATE\200009F3\defaultimportfile.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\backup_registration.xml PRIVATE\200009F3\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\backup_registration.xml PRIVATE\200009F5\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\mappings.db PRIVATE\200009F5\mappings.db + +rem - Harvester and Context Engine binaries +file=ABI_DIR\BUILD_DIR\HarvesterPluginInterface.dll SHARED_LIB_DIR\HarvesterPluginInterface.dll +file=ABI_DIR\BUILD_DIR\HarvesterClient.dll SHARED_LIB_DIR\HarvesterClient.dll +file=ABI_DIR\BUILD_DIR\HarvesterServer.exe PROGRAMS_DIR\HarvesterServer.exe +file=ABI_DIR\BUILD_DIR\harvestercommon.dll SHARED_LIB_DIR\harvestercommon.dll +file=ABI_DIR\BUILD_DIR\harvesterdata.dll SHARED_LIB_DIR\harvesterdata.dll +file=ABI_DIR\BUILD_DIR\mdsfileserverplugin.pxt SHARED_LIB_DIR\mdsfileserverplugin.pxt +ECOM_PLUGIN(HarvesterImagePlugin.dll,HarvesterImagePlugin.rsc) +ECOM_PLUGIN(HarvesterVideoPlugin.dll,HarvesterVideoPlugin.rsc) +ECOM_PLUGIN(HarvesterMessagePlugin.dll,HarvesterMessagePlugin.rsc) +ECOM_PLUGIN(harvesteromadrmplugin.dll,harvesteromadrmplugin.rsc) +ECOM_PLUGIN(harvesterwmvplugin.dll,harvesterwmvplugin.rsc) +ECOM_PLUGIN(harvesterrtpplugin.dll,harvesterrtpplugin.rsc) +ECOM_PLUGIN(harvesteraudioplugin.dll,harvesteraudioplugin.rsc) + +rem - Blacklist server binaries +file=ABI_DIR\BUILD_DIR\!blacklistserver.exe PROGRAMS_DIR\!blacklistserver.exe +file=ABI_DIR\BUILD_DIR\blacklistclient.dll SHARED_LIB_DIR\blacklistclient.dll + +file=ABI_DIR\BUILD_DIR\MonitorPluginInterface.dll SHARED_LIB_DIR\MonitorPluginInterface.dll +ECOM_PLUGIN(MMCMonitorPlugin.dll,MMCMonitorPlugin.rsc) +ECOM_PLUGIN(FileMonitorPlugin.dll,FileMonitorPlugin.rsc) +ECOM_PLUGIN(MessageMonitorPlugin.dll,MessageMonitorPlugin.rsc) +ECOM_PLUGIN(mdsoomplugin.dll,mdsoomplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ContextPluginInterface.dll SHARED_LIB_DIR\ContextPluginInterface.dll +file=ABI_DIR\BUILD_DIR\ContextEngine.dll SHARED_LIB_DIR\ContextEngine.dll +ECOM_PLUGIN(locationcontextplugin.dll,locationcontextplugin.rsc) +ECOM_PLUGIN(calendarcontextplugin.dll,calendarcontextplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ComposerPluginInterface.dll SHARED_LIB_DIR\ComposerPluginInterface.dll +ECOM_PLUGIN(ComposerImagePlugin.dll,ComposerImagePlugin.rsc) + +// Location Manager +REM locationmanager +file=ABI_DIR\BUILD_DIR\locationmanager.dll SHARED_LIB_DIR\locationmanager.dll + +REM locationmanagerserver +file=ABI_DIR\BUILD_DIR\locationmanagerserver.exe PROGRAMS_DIR\locationmanagerserver.exe + +REM watchdog +file=ABI_DIR\BUILD_DIR\mdswatchdog.exe PROGRAMS_DIR\mdswatchdog.exe + +REM locationtrail +file=ABI_DIR\BUILD_DIR\locationtrail.dll SHARED_LIB_DIR\locationtrail.dll + +REM geoconverter +file=ABI_DIR\BUILD_DIR\geoconverter.dll SHARED_LIB_DIR\geoconverter.dll + +REM geotagger +file=ABI_DIR\BUILD_DIR\geotagger.dll SHARED_LIB_DIR\geotagger.dll + + +REM Location Manager data files +data=ZPRIVATE\10202BE9\200071BE.txt "PRIVATE\10202BE9\200071BE.txt" + +REM Harvester Cen Repo file +data=ZPRIVATE\10202BE9\200009FE.txt "PRIVATE\10202BE9\200009FE.txt" + +REM MdS version CenRep file +data=ZPRIVATE\10202BE9\200009F3.txt "PRIVATE\10202BE9\200009F3.txt" + +REM Harvester MMC plugin CenRep file +data=ZPRIVATE\10202BE9\20007183.txt "PRIVATE\10202BE9\20007183.txt" + +data=ZSYSTEM\install\contentlistingframework_stub.sis system\install\contentlistingframework_stub.sis +data=ZSYSTEM\install\contextengine_stub.sis system\install\contextengine_stub.sis +data=ZSYSTEM\install\blacklistserver_stub.sis system\install\blacklistserver_stub.sis +data=ZSYSTEM\install\composerplugins_stub.sis system\install\composerplugins_stub.sis +data=ZSYSTEM\install\harvester_stub.sis system\install\harvester_stub.sis +data=ZSYSTEM\install\harvesterplugins_stub.sis system\install\harvesterplugins_stub.sis +data=ZSYSTEM\install\monitorplugins_stub.sis system\install\monitorplugins_stub.sis +data=ZSYSTEM\install\locationmanager_stub.sis system\install\locationmanager_stub.sis +data=ZSYSTEM\install\metadataengine_stub.sis system\install\metadataengine_stub.sis +data=ZSYSTEM\install\mds_stub.sis system\install\mds_stub.sis +data=ZSYSTEM\install\mdswatchdog_stub.sis system\install\mdswatchdog_stub.sis + +data=ZSYSTEM\install\locationmanagerclient_stub.sis system\install\locationmanagerclient_stub.sis +data=ZSYSTEM\install\locationtrail_stub.sis system\install\locationtrail_stub.sis +data=ZSYSTEM\install\locationmanagerserver_stub.sis system\install\locationmanagerserver_stub.sis +data=ZSYSTEM\install\geotagger_stub.sis system\install\geotagger_stub.sis +data=ZSYSTEM\install\geoconverter_stub.sis system\install\geoconverter_stub.sis +#endif //__METADATA_IBY__ diff -r 63c982fb92f2 -r b73252188534 rom/mds_reverse_geocode_enabled_only.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rom/mds_reverse_geocode_enabled_only.iby Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Metadata system iby file (for ROM image creation) +* +* +*/ + + +#ifndef __METADATA_IBY__ +#define __METADATA_IBY__ + +// sql is mandatory for mds +#include + +rem - MdE binaries +file=ABI_DIR\BUILD_DIR\mdeclient.dll SHARED_LIB_DIR\mdeclient.dll +file=ABI_DIR\BUILD_DIR\mdccommon.dll SHARED_LIB_DIR\mdccommon.dll +file=ABI_DIR\BUILD_DIR\!mdsserver.exe PROGRAMS_DIR\!mdsserver.exe + +rem - MdE data files +data=EPOCROOT##epoc32\data\z\Private\200009F3\schema.mde PRIVATE\200009F3\schema.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\defaultimportfile.mde PRIVATE\200009F3\defaultimportfile.mde +data=EPOCROOT##epoc32\data\z\Private\200009F3\backup_registration.xml PRIVATE\200009F3\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\backup_registration.xml PRIVATE\200009F5\backup_registration.xml +data=EPOCROOT##epoc32\data\z\Private\200009F5\mappings.db PRIVATE\200009F5\mappings.db + +rem - Harvester and Context Engine binaries +file=ABI_DIR\BUILD_DIR\HarvesterPluginInterface.dll SHARED_LIB_DIR\HarvesterPluginInterface.dll +file=ABI_DIR\BUILD_DIR\HarvesterClient.dll SHARED_LIB_DIR\HarvesterClient.dll +file=ABI_DIR\BUILD_DIR\HarvesterServer.exe PROGRAMS_DIR\HarvesterServer.exe +file=ABI_DIR\BUILD_DIR\harvestercommon.dll SHARED_LIB_DIR\harvestercommon.dll +file=ABI_DIR\BUILD_DIR\harvesterdata.dll SHARED_LIB_DIR\harvesterdata.dll +file=ABI_DIR\BUILD_DIR\mdsfileserverplugin.pxt SHARED_LIB_DIR\mdsfileserverplugin.pxt +ECOM_PLUGIN(HarvesterImagePlugin.dll,HarvesterImagePlugin.rsc) +ECOM_PLUGIN(HarvesterVideoPlugin.dll,HarvesterVideoPlugin.rsc) +ECOM_PLUGIN(HarvesterMessagePlugin.dll,HarvesterMessagePlugin.rsc) +ECOM_PLUGIN(harvesteromadrmplugin.dll,harvesteromadrmplugin.rsc) +ECOM_PLUGIN(harvesterwmvplugin.dll,harvesterwmvplugin.rsc) +ECOM_PLUGIN(harvesterrtpplugin.dll,harvesterrtpplugin.rsc) +ECOM_PLUGIN(harvesteraudioplugin.dll,harvesteraudioplugin.rsc) + +rem - Blacklist server binaries +file=ABI_DIR\BUILD_DIR\!blacklistserver.exe PROGRAMS_DIR\!blacklistserver.exe +file=ABI_DIR\BUILD_DIR\blacklistclient.dll SHARED_LIB_DIR\blacklistclient.dll + +file=ABI_DIR\BUILD_DIR\MonitorPluginInterface.dll SHARED_LIB_DIR\MonitorPluginInterface.dll +ECOM_PLUGIN(MMCMonitorPlugin.dll,MMCMonitorPlugin.rsc) +ECOM_PLUGIN(FileMonitorPlugin.dll,FileMonitorPlugin.rsc) +ECOM_PLUGIN(MessageMonitorPlugin.dll,MessageMonitorPlugin.rsc) +ECOM_PLUGIN(mdsoomplugin.dll,mdsoomplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ContextPluginInterface.dll SHARED_LIB_DIR\ContextPluginInterface.dll +file=ABI_DIR\BUILD_DIR\ContextEngine.dll SHARED_LIB_DIR\ContextEngine.dll +ECOM_PLUGIN(locationcontextplugin.dll,locationcontextplugin.rsc) +ECOM_PLUGIN(calendarcontextplugin.dll,calendarcontextplugin.rsc) + +file=ABI_DIR\BUILD_DIR\ComposerPluginInterface.dll SHARED_LIB_DIR\ComposerPluginInterface.dll +ECOM_PLUGIN(ComposerImagePlugin.dll,ComposerImagePlugin.rsc) + +// Location Manager +REM locationmanager +file=ABI_DIR\BUILD_DIR\locationmanager.dll SHARED_LIB_DIR\locationmanager.dll + +REM locationmanagerserver +file=ABI_DIR\BUILD_DIR\locationmanagerserver.exe PROGRAMS_DIR\locationmanagerserver.exe + +REM watchdog +file=ABI_DIR\BUILD_DIR\mdswatchdog.exe PROGRAMS_DIR\mdswatchdog.exe + +REM locationtrail +file=ABI_DIR\BUILD_DIR\locationtrail.dll SHARED_LIB_DIR\locationtrail.dll + +REM ReverseGeocode +file=ABI_DIR\BUILD_DIR\ReverseGeocode.dll SHARED_LIB_DIR\ReverseGeocode.dll + +REM Reverse geocoder plugin +ECOM_PLUGIN(ReverseGeoCoderPlugin.dll,reversegeocoderplugin.rsc) + +REM tagcreator +file=ABI_DIR\BUILD_DIR\tagcreator.dll SHARED_LIB_DIR\tagcreator.dll + +REM geotagger +file=ABI_DIR\BUILD_DIR\geotagger.dll SHARED_LIB_DIR\geotagger.dll + +REM Location Manager data files +data=ZPRIVATE\10202BE9\200071BE.txt "PRIVATE\10202BE9\200071BE.txt" + +REM Harvester Cen Repo file +data=ZPRIVATE\10202BE9\200009FE.txt "PRIVATE\10202BE9\200009FE.txt" + +REM MdS version CenRep file +data=ZPRIVATE\10202BE9\200009F3.txt "PRIVATE\10202BE9\200009F3.txt" + +REM Harvester MMC plugin CenRep file +data=ZPRIVATE\10202BE9\20007183.txt "PRIVATE\10202BE9\20007183.txt" + +data=ZSYSTEM\install\contentlistingframework_stub.sis system\install\contentlistingframework_stub.sis +data=ZSYSTEM\install\contextengine_stub.sis system\install\contextengine_stub.sis +data=ZSYSTEM\install\blacklistserver_stub.sis system\install\blacklistserver_stub.sis +data=ZSYSTEM\install\composerplugins_stub.sis system\install\composerplugins_stub.sis +data=ZSYSTEM\install\harvester_stub.sis system\install\harvester_stub.sis +data=ZSYSTEM\install\harvesterplugins_stub.sis system\install\harvesterplugins_stub.sis +data=ZSYSTEM\install\monitorplugins_stub.sis system\install\monitorplugins_stub.sis +data=ZSYSTEM\install\locationmanager_stub.sis system\install\locationmanager_stub.sis +data=ZSYSTEM\install\metadataengine_stub.sis system\install\metadataengine_stub.sis +data=ZSYSTEM\install\mds_stub.sis system\install\mds_stub.sis +data=ZSYSTEM\install\mdswatchdog_stub.sis system\install\mdswatchdog_stub.sis + +data=ZSYSTEM\install\locationmanagerclient_stub.sis system\install\locationmanagerclient_stub.sis +data=ZSYSTEM\install\locationtrail_stub.sis system\install\locationtrail_stub.sis +data=ZSYSTEM\install\locationmanagerserver_stub.sis system\install\locationmanagerserver_stub.sis +data=ZSYSTEM\install\ReverseGeocode_stub.sis system\install\ReverseGeocode_stub.sis +data=ZSYSTEM\install\ReverseGeoCoderPlugin_stub.sis system\install\ReverseGeoCoderPlugin_stub.sis +data=ZSYSTEM\install\tagcreator_stub.sis system\install\tagcreator_stub.sis +data=ZSYSTEM\install\geotagger_stub.sis system\install\geotagger_stub.sis +#endif //__METADATA_IBY__ diff -r 63c982fb92f2 -r b73252188534 sis/mds/mds_stub.sis Binary file sis/mds/mds_stub.sis has changed diff -r 63c982fb92f2 -r b73252188534 sis/mds/package.pkg --- a/sis/mds/package.pkg Thu Jul 15 19:07:24 2010 +0300 +++ b/sis/mds/package.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 21, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 26, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r 63c982fb92f2 -r b73252188534 sis/mds/package_cellid_reverse_geocode_enabled.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sis/mds/package_cellid_reverse_geocode_enabled.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,117 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 26, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\udeb\mdsiadstop.exe"-"c:\sys\bin\mdsiadstop.exe",FILERUN,RB,RW + +; CenRep +"..\..\clfwrapper\conf\102828AC.txt"-"c:\private\10202be9\102828AC.txt" +"..\..\harvester\common\data\200009FE.txt"-"c:\private\10202be9\200009FE.txt" +"..\..\locationmanager\data\200071BE.txt"-"c:\private\10202be9\200071BE.txt" + +; contextengine +"\EPOC32\RELEASE\ARMV5\UREL\contextengine.dll" -"c:\sys\bin\contextengine.dll" +"\EPOC32\RELEASE\ARMV5\UREL\contextplugininterface.dll" -"c:\sys\bin\contextplugininterface.dll" +"\EPOC32\RELEASE\ARMV5\UREL\calendarcontextplugin.dll" -"c:\sys\bin\calendarcontextplugin.dll" +"\epoc32\data\z\resource\plugins\calendarcontextplugin.rsc" -"c:\resource\plugins\calendarcontextplugin.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\locationcontextplugin.dll" -"c:\sys\bin\locationcontextplugin.dll" +"\epoc32\data\z\resource\plugins\locationcontextplugin.rsc" -"c:\resource\plugins\locationcontextplugin.rsc" + +; clf wrapper +"\EPOC32\RELEASE\ARMV5\UREL\MediaCollectionManager.dll" -"c:\sys\bin\MediaCollectionManager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ContentListingFramework.dll" -"c:\sys\bin\ContentListingFramework.dll" + +; blacklist +"\EPOC32\RELEASE\ARMV5\UREL\!blacklistserver.exe" -"c:\sys\bin\!blacklistserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\blacklistclient.dll" -"c:\sys\bin\blacklistclient.dll" + +; composer plugins +"\epoc32\RELEASE\armv5\UREL\composerplugininterface.dll"-"c:\sys\bin\composerplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\composerimageplugin.dll"-"c:\sys\bin\composerimageplugin.dll" +"\epoc32\data\z\resource\plugins\composerimageplugin.rsc"-"c:\resource\plugins\composerimageplugin.rsc" + +; harvester +"\epoc32\RELEASE\armv5\UREL\harvesterclient.dll" -"c:\sys\bin\harvesterclient.dll" +"\epoc32\RELEASE\armv5\UREL\harvestercommon.dll" -"c:\sys\bin\harvestercommon.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterdata.dll" -"c:\sys\bin\harvesterdata.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterplugininterface.dll" -"c:\sys\bin\harvesterplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterserver.exe" -"c:\sys\bin\harvesterserver.exe" + +; harvester plugins +"\epoc32\RELEASE\armv5\UREL\harvesteraudioplugin.dll"-"c:\sys\bin\harvesteraudioplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteraudioplugin.rsc"-"c:\resource\plugins\harvesteraudioplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterimageplugin.dll"-"c:\sys\bin\harvesterimageplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterimageplugin.rsc"-"c:\resource\plugins\harvesterimageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestermessageplugin.dll"-"c:\sys\bin\harvestermessageplugin.dll" +"\epoc32\data\z\resource\plugins\harvestermessageplugin.rsc"-"c:\resource\plugins\harvestermessageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesteromadrmplugin.dll"-"c:\sys\bin\harvesteromadrmplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteromadrmplugin.rsc"-"c:\resource\plugins\harvesteromadrmplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterrtpplugin.dll"-"c:\sys\bin\harvesterrtpplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterrtpplugin.rsc"-"c:\resource\plugins\harvesterrtpplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestervideoplugin.dll"-"c:\sys\bin\harvestervideoplugin.dll" +"\epoc32\data\z\resource\plugins\harvestervideoplugin.rsc"-"c:\resource\plugins\harvestervideoplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterwmvplugin.dll"-"c:\sys\bin\harvesterwmvplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterwmvplugin.rsc"-"c:\resource\plugins\harvesterwmvplugin.rsc" + +; monitor plugins +"\epoc32\RELEASE\armv5\UREL\monitorplugininterface.dll"-"c:\sys\bin\monitorplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\mdsfileserverplugin.pxt"-"c:\sys\bin\mdsfileserverplugin.pxt" +"\epoc32\RELEASE\armv5\UREL\filemonitorplugin.dll"-"c:\sys\bin\filemonitorplugin.dll" +"\epoc32\data\z\resource\plugins\filemonitorplugin.rsc"-"c:\resource\plugins\filemonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\MessageMonitorPlugin.dll"-"c:\sys\bin\MessageMonitorPlugin.dll" +"\epoc32\data\z\resource\plugins\MessageMonitorPlugin.rsc"-"c:\resource\plugins\MessageMonitorPlugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mmcmonitorplugin.dll"-"c:\sys\bin\mmcmonitorplugin.dll" +"\epoc32\data\z\resource\plugins\mmcmonitorplugin.rsc"-"c:\resource\plugins\mmcmonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mdsoomplugin.dll"-"c:\sys\bin\mdsoomplugin.dll" +"\epoc32\data\z\resource\plugins\mdsoomplugin.rsc"-"c:\resource\plugins\mdsoomplugin.rsc" + +; location manager +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\geoconverter.dll" -"c:\sys\bin\geoconverter.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ReverseGeocode.dll" -"c:\sys\bin\ReverseGeocode.dll" +"\EPOC32\RELEASE\ARMV5\UREL\tagcreator.dll" -"c:\sys\bin\tagcreator.dll" +"\EPOC32\RELEASE\ARMV5\UREL\geotagger.dll" -"c:\sys\bin\geotagger.dll" +"\epoc32\RELEASE\armv5\UREL\ReverseGeoCoderPlugin.dll"-"c:\sys\bin\ReverseGeoCoderPlugin.dll" +"\epoc32\data\z\resource\plugins\reversegeocoderplugin.rsc"-"c:\resource\plugins\reversegeocoderplugin.rsc" + +; metadata engine +"\EPOC32\RELEASE\ARMV5\UREL\mdeclient.dll" -"c:\sys\bin\mdeclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\mdccommon.dll" -"c:\sys\bin\mdccommon.dll" +"\EPOC32\RELEASE\ARMV5\UREL\!mdsserver.exe" -"c:\sys\bin\!mdsserver.exe" + +"\epoc32\release\armv5\udeb\mdswatchdog.exe"-"c:\sys\bin\mdswatchdog.exe" + +"\epoc32\data\z\Private\200009F3\schema.mde"-"c:\PRIVATE\200009F3\schema.mde" +"\epoc32\data\z\Private\200009F3\defaultimportfile.mde"-"c:\PRIVATE\200009F3\defaultimportfile.mde" +"\epoc32\data\z\Private\200009F3\backup_registration.xml"-"c:\PRIVATE\200009F3\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\backup_registration.xml"-"c:\PRIVATE\200009F5\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\mappings.db"-"c:\PRIVATE\200009F5\mappings.db" + +"\epoc32\release\armv5\udeb\mdsiadrestart.exe"-"c:\sys\bin\mdsiadrestart.exe",FILERUN,RB,RW + diff -r 63c982fb92f2 -r b73252188534 sis/mds/package_cellidenabled.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sis/mds/package_cellidenabled.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,113 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 26, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\udeb\mdsiadstop.exe"-"c:\sys\bin\mdsiadstop.exe",FILERUN,RB,RW + +; CenRep +"..\..\clfwrapper\conf\102828AC.txt"-"c:\private\10202be9\102828AC.txt" +"..\..\harvester\common\data\200009FE.txt"-"c:\private\10202be9\200009FE.txt" +"..\..\locationmanager\data\200071BE.txt"-"c:\private\10202be9\200071BE.txt" + +; contextengine +"\EPOC32\RELEASE\ARMV5\UREL\contextengine.dll" -"c:\sys\bin\contextengine.dll" +"\EPOC32\RELEASE\ARMV5\UREL\contextplugininterface.dll" -"c:\sys\bin\contextplugininterface.dll" +"\EPOC32\RELEASE\ARMV5\UREL\calendarcontextplugin.dll" -"c:\sys\bin\calendarcontextplugin.dll" +"\epoc32\data\z\resource\plugins\calendarcontextplugin.rsc" -"c:\resource\plugins\calendarcontextplugin.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\locationcontextplugin.dll" -"c:\sys\bin\locationcontextplugin.dll" +"\epoc32\data\z\resource\plugins\locationcontextplugin.rsc" -"c:\resource\plugins\locationcontextplugin.rsc" + +; clf wrapper +"\EPOC32\RELEASE\ARMV5\UREL\MediaCollectionManager.dll" -"c:\sys\bin\MediaCollectionManager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ContentListingFramework.dll" -"c:\sys\bin\ContentListingFramework.dll" + +; blacklist +"\EPOC32\RELEASE\ARMV5\UREL\!blacklistserver.exe" -"c:\sys\bin\!blacklistserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\blacklistclient.dll" -"c:\sys\bin\blacklistclient.dll" + +; composer plugins +"\epoc32\RELEASE\armv5\UREL\composerplugininterface.dll"-"c:\sys\bin\composerplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\composerimageplugin.dll"-"c:\sys\bin\composerimageplugin.dll" +"\epoc32\data\z\resource\plugins\composerimageplugin.rsc"-"c:\resource\plugins\composerimageplugin.rsc" + +; harvester +"\epoc32\RELEASE\armv5\UREL\harvesterclient.dll" -"c:\sys\bin\harvesterclient.dll" +"\epoc32\RELEASE\armv5\UREL\harvestercommon.dll" -"c:\sys\bin\harvestercommon.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterdata.dll" -"c:\sys\bin\harvesterdata.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterplugininterface.dll" -"c:\sys\bin\harvesterplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterserver.exe" -"c:\sys\bin\harvesterserver.exe" + +; harvester plugins +"\epoc32\RELEASE\armv5\UREL\harvesteraudioplugin.dll"-"c:\sys\bin\harvesteraudioplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteraudioplugin.rsc"-"c:\resource\plugins\harvesteraudioplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterimageplugin.dll"-"c:\sys\bin\harvesterimageplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterimageplugin.rsc"-"c:\resource\plugins\harvesterimageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestermessageplugin.dll"-"c:\sys\bin\harvestermessageplugin.dll" +"\epoc32\data\z\resource\plugins\harvestermessageplugin.rsc"-"c:\resource\plugins\harvestermessageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesteromadrmplugin.dll"-"c:\sys\bin\harvesteromadrmplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteromadrmplugin.rsc"-"c:\resource\plugins\harvesteromadrmplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterrtpplugin.dll"-"c:\sys\bin\harvesterrtpplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterrtpplugin.rsc"-"c:\resource\plugins\harvesterrtpplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestervideoplugin.dll"-"c:\sys\bin\harvestervideoplugin.dll" +"\epoc32\data\z\resource\plugins\harvestervideoplugin.rsc"-"c:\resource\plugins\harvestervideoplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterwmvplugin.dll"-"c:\sys\bin\harvesterwmvplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterwmvplugin.rsc"-"c:\resource\plugins\harvesterwmvplugin.rsc" + +; monitor plugins +"\epoc32\RELEASE\armv5\UREL\monitorplugininterface.dll"-"c:\sys\bin\monitorplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\mdsfileserverplugin.pxt"-"c:\sys\bin\mdsfileserverplugin.pxt" +"\epoc32\RELEASE\armv5\UREL\filemonitorplugin.dll"-"c:\sys\bin\filemonitorplugin.dll" +"\epoc32\data\z\resource\plugins\filemonitorplugin.rsc"-"c:\resource\plugins\filemonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\MessageMonitorPlugin.dll"-"c:\sys\bin\MessageMonitorPlugin.dll" +"\epoc32\data\z\resource\plugins\MessageMonitorPlugin.rsc"-"c:\resource\plugins\MessageMonitorPlugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mmcmonitorplugin.dll"-"c:\sys\bin\mmcmonitorplugin.dll" +"\epoc32\data\z\resource\plugins\mmcmonitorplugin.rsc"-"c:\resource\plugins\mmcmonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mdsoomplugin.dll"-"c:\sys\bin\mdsoomplugin.dll" +"\epoc32\data\z\resource\plugins\mdsoomplugin.rsc"-"c:\resource\plugins\mdsoomplugin.rsc" + +; location manager +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\geoconverter.dll" -"c:\sys\bin\geoconverter.dll" +"\EPOC32\RELEASE\ARMV5\UREL\geotagger.dll" -"c:\sys\bin\geotagger.dll" + +; metadata engine +"\EPOC32\RELEASE\ARMV5\UREL\mdeclient.dll" -"c:\sys\bin\mdeclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\mdccommon.dll" -"c:\sys\bin\mdccommon.dll" +"\EPOC32\RELEASE\ARMV5\UREL\!mdsserver.exe" -"c:\sys\bin\!mdsserver.exe" + +"\epoc32\release\armv5\udeb\mdswatchdog.exe"-"c:\sys\bin\mdswatchdog.exe" + +"\epoc32\data\z\Private\200009F3\schema.mde"-"c:\PRIVATE\200009F3\schema.mde" +"\epoc32\data\z\Private\200009F3\defaultimportfile.mde"-"c:\PRIVATE\200009F3\defaultimportfile.mde" +"\epoc32\data\z\Private\200009F3\backup_registration.xml"-"c:\PRIVATE\200009F3\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\backup_registration.xml"-"c:\PRIVATE\200009F5\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\mappings.db"-"c:\PRIVATE\200009F5\mappings.db" + +"\epoc32\release\armv5\udeb\mdsiadrestart.exe"-"c:\sys\bin\mdsiadrestart.exe",FILERUN,RB,RW + diff -r 63c982fb92f2 -r b73252188534 sis/mds/package_reverse_geocode_enabled_only.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sis/mds/package_reverse_geocode_enabled_only.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -0,0 +1,116 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 26, TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\udeb\mdsiadstop.exe"-"c:\sys\bin\mdsiadstop.exe",FILERUN,RB,RW + +; CenRep +"..\..\clfwrapper\conf\102828AC.txt"-"c:\private\10202be9\102828AC.txt" +"..\..\harvester\common\data\200009FE.txt"-"c:\private\10202be9\200009FE.txt" +"..\..\locationmanager\data\200071BE.txt"-"c:\private\10202be9\200071BE.txt" + +; contextengine +"\EPOC32\RELEASE\ARMV5\UREL\contextengine.dll" -"c:\sys\bin\contextengine.dll" +"\EPOC32\RELEASE\ARMV5\UREL\contextplugininterface.dll" -"c:\sys\bin\contextplugininterface.dll" +"\EPOC32\RELEASE\ARMV5\UREL\calendarcontextplugin.dll" -"c:\sys\bin\calendarcontextplugin.dll" +"\epoc32\data\z\resource\plugins\calendarcontextplugin.rsc" -"c:\resource\plugins\calendarcontextplugin.rsc" +"\EPOC32\RELEASE\ARMV5\UREL\locationcontextplugin.dll" -"c:\sys\bin\locationcontextplugin.dll" +"\epoc32\data\z\resource\plugins\locationcontextplugin.rsc" -"c:\resource\plugins\locationcontextplugin.rsc" + +; clf wrapper +"\EPOC32\RELEASE\ARMV5\UREL\MediaCollectionManager.dll" -"c:\sys\bin\MediaCollectionManager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\ContentListingFramework.dll" -"c:\sys\bin\ContentListingFramework.dll" + +; blacklist +"\EPOC32\RELEASE\ARMV5\UREL\!blacklistserver.exe" -"c:\sys\bin\!blacklistserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\blacklistclient.dll" -"c:\sys\bin\blacklistclient.dll" + +; composer plugins +"\epoc32\RELEASE\armv5\UREL\composerplugininterface.dll"-"c:\sys\bin\composerplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\composerimageplugin.dll"-"c:\sys\bin\composerimageplugin.dll" +"\epoc32\data\z\resource\plugins\composerimageplugin.rsc"-"c:\resource\plugins\composerimageplugin.rsc" + +; harvester +"\epoc32\RELEASE\armv5\UREL\harvesterclient.dll" -"c:\sys\bin\harvesterclient.dll" +"\epoc32\RELEASE\armv5\UREL\harvestercommon.dll" -"c:\sys\bin\harvestercommon.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterdata.dll" -"c:\sys\bin\harvesterdata.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterplugininterface.dll" -"c:\sys\bin\harvesterplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\harvesterserver.exe" -"c:\sys\bin\harvesterserver.exe" + +; harvester plugins +"\epoc32\RELEASE\armv5\UREL\harvesteraudioplugin.dll"-"c:\sys\bin\harvesteraudioplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteraudioplugin.rsc"-"c:\resource\plugins\harvesteraudioplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterimageplugin.dll"-"c:\sys\bin\harvesterimageplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterimageplugin.rsc"-"c:\resource\plugins\harvesterimageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestermessageplugin.dll"-"c:\sys\bin\harvestermessageplugin.dll" +"\epoc32\data\z\resource\plugins\harvestermessageplugin.rsc"-"c:\resource\plugins\harvestermessageplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesteromadrmplugin.dll"-"c:\sys\bin\harvesteromadrmplugin.dll" +"\epoc32\data\z\resource\plugins\harvesteromadrmplugin.rsc"-"c:\resource\plugins\harvesteromadrmplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterrtpplugin.dll"-"c:\sys\bin\harvesterrtpplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterrtpplugin.rsc"-"c:\resource\plugins\harvesterrtpplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvestervideoplugin.dll"-"c:\sys\bin\harvestervideoplugin.dll" +"\epoc32\data\z\resource\plugins\harvestervideoplugin.rsc"-"c:\resource\plugins\harvestervideoplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\harvesterwmvplugin.dll"-"c:\sys\bin\harvesterwmvplugin.dll" +"\epoc32\data\z\resource\plugins\harvesterwmvplugin.rsc"-"c:\resource\plugins\harvesterwmvplugin.rsc" + +; monitor plugins +"\epoc32\RELEASE\armv5\UREL\monitorplugininterface.dll"-"c:\sys\bin\monitorplugininterface.dll" +"\epoc32\RELEASE\armv5\UREL\mdsfileserverplugin.pxt"-"c:\sys\bin\mdsfileserverplugin.pxt" +"\epoc32\RELEASE\armv5\UREL\filemonitorplugin.dll"-"c:\sys\bin\filemonitorplugin.dll" +"\epoc32\data\z\resource\plugins\filemonitorplugin.rsc"-"c:\resource\plugins\filemonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\MessageMonitorPlugin.dll"-"c:\sys\bin\MessageMonitorPlugin.dll" +"\epoc32\data\z\resource\plugins\MessageMonitorPlugin.rsc"-"c:\resource\plugins\MessageMonitorPlugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mmcmonitorplugin.dll"-"c:\sys\bin\mmcmonitorplugin.dll" +"\epoc32\data\z\resource\plugins\mmcmonitorplugin.rsc"-"c:\resource\plugins\mmcmonitorplugin.rsc" +"\epoc32\RELEASE\armv5\UREL\mdsoomplugin.dll"-"c:\sys\bin\mdsoomplugin.dll" +"\epoc32\data\z\resource\plugins\mdsoomplugin.rsc"-"c:\resource\plugins\mdsoomplugin.rsc" + +; location manager +"\EPOC32\RELEASE\ARMV5\UREL\LocationTrail.dll" -"c:\sys\bin\LocationTrail.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanager.dll" -"c:\sys\bin\locationmanager.dll" +"\EPOC32\RELEASE\ARMV5\UREL\locationmanagerserver.exe" -"c:\sys\bin\locationmanagerserver.exe" +"\EPOC32\RELEASE\ARMV5\UREL\ReverseGeocode.dll" -"c:\sys\bin\ReverseGeocode.dll" +"\EPOC32\RELEASE\ARMV5\UREL\tagcreator.dll" -"c:\sys\bin\tagcreator.dll" +"\EPOC32\RELEASE\ARMV5\UREL\geotagger.dll" -"c:\sys\bin\geotagger.dll" +"\epoc32\RELEASE\armv5\UREL\ReverseGeoCoderPlugin.dll"-"c:\sys\bin\ReverseGeoCoderPlugin.dll" +"\epoc32\data\z\resource\plugins\reversegeocoderplugin.rsc"-"c:\resource\plugins\reversegeocoderplugin.rsc" + +; metadata engine +"\EPOC32\RELEASE\ARMV5\UREL\mdeclient.dll" -"c:\sys\bin\mdeclient.dll" +"\EPOC32\RELEASE\ARMV5\UREL\mdccommon.dll" -"c:\sys\bin\mdccommon.dll" +"\EPOC32\RELEASE\ARMV5\UREL\!mdsserver.exe" -"c:\sys\bin\!mdsserver.exe" + +"\epoc32\release\armv5\udeb\mdswatchdog.exe"-"c:\sys\bin\mdswatchdog.exe" + +"\epoc32\data\z\Private\200009F3\schema.mde"-"c:\PRIVATE\200009F3\schema.mde" +"\epoc32\data\z\Private\200009F3\defaultimportfile.mde"-"c:\PRIVATE\200009F3\defaultimportfile.mde" +"\epoc32\data\z\Private\200009F3\backup_registration.xml"-"c:\PRIVATE\200009F3\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\backup_registration.xml"-"c:\PRIVATE\200009F5\backup_registration.xml" +"\epoc32\data\z\Private\200009F5\mappings.db"-"c:\PRIVATE\200009F5\mappings.db" + +"\epoc32\release\armv5\udeb\mdsiadrestart.exe"-"c:\sys\bin\mdsiadrestart.exe",FILERUN,RB,RW + diff -r 63c982fb92f2 -r b73252188534 sis/mds/package_separate.pkg --- a/sis/mds/package_separate.pkg Thu Jul 15 19:07:24 2010 +0300 +++ b/sis/mds/package_separate.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 21, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 26, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r 63c982fb92f2 -r b73252188534 sis/mds/stub.pkg --- a/sis/mds/stub.pkg Thu Jul 15 19:07:24 2010 +0300 +++ b/sis/mds/stub.pkg Thu Aug 19 10:20:41 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Metadata System"}, (0x200009F5), 9, 20, 21, TYPE=SA +#{"Metadata System"}, (0x200009F5), 9, 20, 26, TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r 63c982fb92f2 -r b73252188534 watchdog/src/watchdog.cpp --- a/watchdog/src/watchdog.cpp Thu Jul 15 19:07:24 2010 +0300 +++ b/watchdog/src/watchdog.cpp Thu Aug 19 10:20:41 2010 +0300 @@ -161,8 +161,10 @@ // CWatchdog::~CWatchdog() { - delete iShutdownObserver; + delete iShutdownObserver; + iShutdownObserver = NULL; delete iSelfShutdownObserver; + iSelfShutdownObserver = NULL; Cancel(); } @@ -304,5 +306,6 @@ } delete cleanupStack; + cleanupStack = NULL; return err; }