harvesterplugins/media/video/src/videoplugin.cpp
changeset 27 7a8855317cbd
parent 26 367228f82b66
equal deleted inserted replaced
26:367228f82b66 27:7a8855317cbd
    16 */
    16 */
    17 
    17 
    18 //  Include Files
    18 //  Include Files
    19 #include "videoplugin.h" //CVideoPlugin
    19 #include "videoplugin.h" //CVideoPlugin
    20 #include <e32base.h>
    20 #include <e32base.h>
       
    21 #include <s32file.h>
       
    22 #include <bautils.h>
    21 #include "harvesterserverlogger.h"
    23 #include "harvesterserverlogger.h"
    22 #include "common.h"
    24 #include "common.h"
    23 #include "csearchdocument.h"
    25 #include "csearchdocument.h"
    24 #include "ccpixindexer.h"
    26 #include "ccpixindexer.h"
    25 #include "mdeharvester.h"
    27 #include "mdeharvester.h"
    37 #endif
    39 #endif
    38 
    40 
    39 
    41 
    40 //Constants
    42 //Constants
    41 _LIT(KPathTrailer, "\\root\\media\\video");
    43 _LIT(KPathTrailer, "\\root\\media\\video");
       
    44 _LIT(KManagerFileName, "VideoStore.temp");
    42 #define MEDIA_QBASEAPPCLASS   "@0:root media video"
    45 #define MEDIA_QBASEAPPCLASS   "@0:root media video"
    43 #define LMEDIA_QBASEAPPCLASS  L"@0:root media video"
    46 #define LMEDIA_QBASEAPPCLASS  L"@0:root media video"
    44 #define MEDIAAPPCLASS   "root media video"
    47 #define MEDIAAPPCLASS   "root media video"
    45 #define LMEDIAAPPCLASS  L"root media video"
    48 #define LMEDIAAPPCLASS  L"root media video"
    46 
    49 
    85       TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
    88       TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
    86     delete iIndexerUtil;
    89     delete iIndexerUtil;
    87     delete iMMcMonitor;
    90     delete iMMcMonitor;
    88     delete iDBManager;
    91     delete iDBManager;
    89     delete iMdsItem;
    92     delete iMdsItem;
       
    93 	iFs.Close();
    90     }
    94     }
    91 
    95 
    92 void CVideoPlugin::ConstructL()
    96 void CVideoPlugin::ConstructL()
    93     {
    97     {
    94     iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
    98     iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
    95     }
    99     // connect to file system
       
   100     User::LeaveIfError(iFs.Connect());    
       
   101     // Load the configuration
       
   102     TFileName pathWithoutDrive;
       
   103     iFs.CreatePrivatePath(EDriveC);
       
   104     iFilePath = _L("C:");        
       
   105     iFs.PrivatePath( pathWithoutDrive );
       
   106     iFilePath.Append(pathWithoutDrive);
       
   107     iFilePath.Append(KManagerFileName);
       
   108     iObjectJobQueueManager->SetFilePath(iFilePath);
       
   109 	}
    96 
   110 
    97 void CVideoPlugin::StartPluginL()
   111 void CVideoPlugin::StartPluginL()
    98     {
   112     {
    99     OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTPLUGINL_ENTRY );
   113     OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTPLUGINL_ENTRY );
   100     //Define the basic application class 
   114     //Define the basic application class 
   118     // Start harvester for this plugin
   132     // Start harvester for this plugin
   119     iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
   133     iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
   120     TUid uidOfPlugin = {0x20029ABA};
   134     TUid uidOfPlugin = {0x20029ABA};
   121     iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
   135     iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
   122     iMdsItem = CMDSEntity::NewL();
   136     iMdsItem = CMDSEntity::NewL();
       
   137     if( BaflUtils::FileExists(iFs,iFilePath) )
       
   138                 LoadL();
   123     OstTraceFunctionExit0( CVIDEOPLUGIN_STARTPLUGINL_EXIT );
   139     OstTraceFunctionExit0( CVIDEOPLUGIN_STARTPLUGINL_EXIT );
   124     }
   140     }
   125 
   141 
   126 void CVideoPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
   142 void CVideoPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
   127     {
   143     {
   329     }
   345     }
   330 
   346 
   331 void CVideoPlugin::ResumePluginL()
   347 void CVideoPlugin::ResumePluginL()
   332     {
   348     {
   333     OstTraceFunctionEntry0( CVIDEOPLUGIN_RESUMEPLUGINL_ENTRY );
   349     OstTraceFunctionEntry0( CVIDEOPLUGIN_RESUMEPLUGINL_ENTRY );
       
   350     if( BaflUtils::FileExists( iFs, iFilePath ))
       
   351          BaflUtils::DeleteFile( iFs, iFilePath );
   334     iObjectJobQueueManager->ResumeL();
   352     iObjectJobQueueManager->ResumeL();
   335     OstTraceFunctionExit0( CVIDEOPLUGIN_RESUMEPLUGINL_EXIT );
   353     OstTraceFunctionExit0( CVIDEOPLUGIN_RESUMEPLUGINL_EXIT );
       
   354     }
       
   355 
       
   356 void CVideoPlugin::LoadL()
       
   357     {
       
   358     iObjectJobQueueManager->LoadQueuedItems();    
       
   359     }
       
   360 
       
   361 void CVideoPlugin::SaveL()
       
   362     {
       
   363     iObjectJobQueueManager->SaveQueuedItems();
   336     }
   364     }
   337 
   365 
   338 #ifdef __PERFORMANCE_DATA
   366 #ifdef __PERFORMANCE_DATA
   339 void CVideoPlugin::UpdateLogL()
   367 void CVideoPlugin::UpdateLogL()
   340     {
   368     {