harvesterplugins/media/image/src/imageplugin.cpp
author hgs
Fri, 15 Oct 2010 11:45:38 +0530
changeset 27 7a8855317cbd
parent 26 367228f82b66
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Media Image harvester plugin implementation
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "imageplugin.h"
27
hgs
parents: 26
diff changeset
    20
#include <e32base.h>
hgs
parents: 26
diff changeset
    21
#include <s32file.h>
hgs
parents: 26
diff changeset
    22
#include <bautils.h>
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "harvesterserverlogger.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include "common.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include "csearchdocument.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include "ccpixindexer.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "mdeharvester.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include "mdeobjectqueuemanager.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "mdsmediamonitor.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "mdssessionobjectutils.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "cpixmediaimagedoc.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "cpixindexerutils.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "mmcmonitor.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "cpixmdedbmanager.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "mdsitementity.h"
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
#include "OstTraceDefinitions.h"
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    37
#ifdef OST_TRACE_COMPILER_IN_USE
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
#include "imagepluginTraces.h"
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    39
#endif
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    40
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
//Constants
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
_LIT(KPathTrailer, "\\root\\media\\image");
27
hgs
parents: 26
diff changeset
    44
_LIT(KManagerFileName, "ImageStore.temp");
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
//***** MEDAI AUDIO*****
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
#define MEDIA_QBASEAPPCLASS   "@0:root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#define LMEDIA_QBASEAPPCLASS  L"@0:root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#define MEDIAAPPCLASS   "root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#define LMEDIAAPPCLASS  L"root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
#define MEDIAGENERICAPPCLASS   ":root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
#define LMEDIAGENERICAPPCLASS  L":root media image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
#define DATABASEPATH           "\\root\\media\\image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
#define LDATABASEPATH           "\\root\\media\\image"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
CImagePlugin* CImagePlugin::NewL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
	{
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
	CImagePlugin* instance = CImagePlugin::NewLC();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    CleanupStack::Pop(instance);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    return instance;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
CImagePlugin* CImagePlugin::NewLC()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
	{
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
	CImagePlugin* instance = new (ELeave) CImagePlugin();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    CleanupStack::PushL(instance);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    instance->ConstructL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    return instance;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
CImagePlugin::CImagePlugin()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
	{
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
	//No implementation required. 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
	//Necessary things done in ConstructL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    count = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
# endif	
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
CImagePlugin::~CImagePlugin()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
	{
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
	delete iMdeHarvester;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
	delete iMdsMonitor;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
	delete iObjectJobQueueManager;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
	delete iMdsUtils;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
	delete iImageDocument;
19
08315a312857 201033_03
hgs
parents: 13
diff changeset
    92
	if ( iIndexerUtil )
08315a312857 201033_03
hgs
parents: 13
diff changeset
    93
	   TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
	delete iIndexerUtil;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
	delete iMMcMonitor;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
	delete iDBManager;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
	delete iMdsItem;
27
hgs
parents: 26
diff changeset
    98
	iFs.Close();
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
	
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
void CImagePlugin::ConstructL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
	{
27
hgs
parents: 26
diff changeset
   104
    iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);    
hgs
parents: 26
diff changeset
   105
    // connect to file system
hgs
parents: 26
diff changeset
   106
    User::LeaveIfError(iFs.Connect());    
hgs
parents: 26
diff changeset
   107
    // Load the configuration
hgs
parents: 26
diff changeset
   108
    TFileName pathWithoutDrive;
hgs
parents: 26
diff changeset
   109
    iFs.CreatePrivatePath(EDriveC);
hgs
parents: 26
diff changeset
   110
    iFilePath = _L("C:");        
hgs
parents: 26
diff changeset
   111
    iFs.PrivatePath( pathWithoutDrive );
hgs
parents: 26
diff changeset
   112
    iFilePath.Append(pathWithoutDrive);
hgs
parents: 26
diff changeset
   113
    iFilePath.Append(KManagerFileName);
hgs
parents: 26
diff changeset
   114
    iObjectJobQueueManager->SetFilePath(iFilePath);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
void CImagePlugin::StartPluginL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
	{
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   120
    OstTraceFunctionEntry0( CIMAGEPLUGIN_STARTPLUGINL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    CPIXLOGSTRING("CImagePlugin::StartPluginL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
	// Define this base application class, use default location
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
	iIndexerUtil = CCPixIndexerUtils::NewL(iSearchSession);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
	//Test well before use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
	TBuf<KMaxFileName> databasePathTemp;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
	databasePathTemp.Append(KPathTrailer);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
	iIndexerUtil->MountAllAvailableDriveL(_L(MEDIAGENERICAPPCLASS),databasePathTemp);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
	//Instantiate all monitoring and harvesting class here
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
	iMdsUtils = CMdsSessionObjectUtils::NewL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
	iMdsUtils->InitializeL(); //Create valid session in it
26
hgs
parents: 19
diff changeset
   131
	//iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
	iMdeHarvester = CMdeHarvester::NewL(iMdsUtils->GetSession(),
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
	                                    this,iObjectJobQueueManager);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
	iMdsMonitor = CMdsMediaMonitor::NewL(iMdsUtils->GetSession(),iObjectJobQueueManager);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
	iMMcMonitor = CMMCMonitorUtil::NewL(this);//Observer is self
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
	iMMcMonitor->StartMonitoring();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
	//Start Monitoring now
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
	iMdsMonitor->StartMonitoringL(MdeConstants::Image::KImageObject);//Start monitoring Image objects
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
	iImageDocument = CCPIXMediaImageDoc::NewL(); //Doc fetcher
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
	// Start harvester for this plugin
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
	iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
	TUid uidOfPlugin = {0x20029ABB};
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
	iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
	iMdsItem = CMDSEntity::NewL();
27
hgs
parents: 26
diff changeset
   145
	if( BaflUtils::FileExists(iFs,iFilePath) )
hgs
parents: 26
diff changeset
   146
	        LoadL();
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   147
	OstTraceFunctionExit0( CIMAGEPLUGIN_STARTPLUGINL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
	}
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
void CImagePlugin::HarvestingCompletedL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    UpdatePerformaceDataL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
#endif 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
void CImagePlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   160
    OstTraceFunctionEntry0( CIMAGEPLUGIN_STARTHARVESTINGL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    //iIndexer->ResetL();//reset any indexes if exist already
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
    CPIXLOGSTRING("CImagePlugin::StartHarvestingL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
    iDBManager->ResetL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
    iIndexerUtil->ResetAllL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
    //Start Media harvesting here
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
#ifdef __PERFORMANCE_DATA  
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
    iStartTime.UniversalTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
#endif  
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    iMdeHarvester->DoHarvesetL(MdeConstants::Image::KImageObject);//Start Harvesting
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   170
    OstTraceFunctionExit0( CIMAGEPLUGIN_STARTHARVESTINGL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
//handle MMC event for the Drive
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
void CImagePlugin::HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    TBuf<KMaxFileName> databasePathTemp;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    databasePathTemp.Append(KPathTrailer);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    if(aMMCInsertRemoval) //MMC inserted
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
        //Test well before use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
        iIndexerUtil->MountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),databasePathTemp);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
        //reset indexes existing first
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
        //With new Implementation no need to reset
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
        //iIndexerUtil->GetIndexerFromDrive(aDrive)->ResetL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
    else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
        //MMC is removed but we can not reset index here as Media physically not avilable so
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
        // we have to do at the time of insertion only
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
        //Unmount drive and also reset the index as we anyhow has to reindex on insertion back 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
        iIndexerUtil->UnMountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),ETrue);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
void CImagePlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
    //Get the object from object utils and get the CPIX document and add delete or update
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   198
    OstTrace1( TRACE_NORMAL, CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;aObjId=%d", aObjId );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): aObjId = %d ", aObjId );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    // creating CSearchDocument object with unique ID for this application
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
    TBuf<KMaxFileName> docid_str;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
    if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
        //The caller should always handle leave of HandleMdeItemL
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
        if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
            {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   207
            OstTrace0( TRACE_NORMAL, DUP1_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Already harvested returning" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Already harvested returning");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
            return;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
            }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
        CMdEObject& object= iMdsUtils->GetObjectL(aObjId,MdeConstants::Image::KImageObject);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
        CMdENamespaceDef& defaultNamespaceDef = iMdsUtils->GetSession()->GetDefaultNamespaceDefL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
        CMdEObjectDef& audioObjDef = defaultNamespaceDef.GetObjectDefL(MdeConstants::Image::KImageObject);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
        CSearchDocument* index_item = iImageDocument->GetCpixDocumentL(object,_L(MEDIAAPPCLASS),audioObjDef);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
        iIndexer = iIndexerUtil->GetIndexerFromMediaId(object.MediaId());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
        if(!iIndexer)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
            delete index_item;
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   219
            OstTrace0( TRACE_NORMAL, DUP2_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Indexer not found" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer not found");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
            return;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
            }
26
hgs
parents: 19
diff changeset
   223
        OstTrace0( TRACE_NORMAL, DUP12_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::Indexing Image" );
hgs
parents: 19
diff changeset
   224
        
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
        // Send for indexing
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
        if (aActionType == ECPixAddAction)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
            ++count;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
# endif
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   231
            OstTrace0( TRACE_NORMAL, DUP3_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Indexer found calling AddL" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
            CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer found calling AddL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
            //First check if it already exist in database
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
            TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
            if (err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
                    //Add entity to database for later use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
                    iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
                    iMdsItem->Setkey(aObjId);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
                    iMdsItem->SetUri(iImageDocument->GetUri());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
                    TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
                    iMdsItem->SetDrive(drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   245
                OstTrace0( TRACE_NORMAL, DUP4_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Added." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
                CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
            else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
                {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   250
                OstTrace1( TRACE_NORMAL, DUP5_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in adding", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
                CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in adding.", err);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
            }
13
hgs
parents: 2
diff changeset
   254
        else
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
            //If DocID for e.g \image\something.jpeg itself changes the we have to compare
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
            //existing URI with new one and Remove that first and Update to avoid 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
            //Duplicate entries
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
            iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
            TRAPD(err, iDBManager->GetItemL(aObjId,*iMdsItem));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
            if (err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
                //Get the drivenumber from the syncDB to delete the appropriate docId 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
                //in case an item is moved to different drive, delete from the old drive first and later update.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
                //comparing the absolute paths along with the root drives
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
                if(iMdsItem->GetPath().Compare(object.Uri()) != 0)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
                    CCPixIndexer *tempIndexer;            
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
                    tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
                    tempIndexer->DeleteL(iMdsItem->Uri());
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   271
                    OstTrace0( TRACE_NORMAL, DUP6_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Deleted existing URI for update" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted existing URI for update");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
                TRAPD(error, iIndexer->UpdateL(*index_item));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
                if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
                    //Add as new
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
                    iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
                    TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
                    iMdsItem->Set(aObjId,iImageDocument->GetUri(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
                    iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   283
                    OstTrace0( TRACE_NORMAL, DUP7_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Updated." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Updated.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
                else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
                    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   288
                    OstTrace1( TRACE_NORMAL, DUP8_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in updating", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
                    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in updating.", error);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
            //If a media item is added when downloading or streaming begins, add event is surpassed
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
            //by update or delete event because of delay introduced on monitered object by objectqueue manager
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
            //So add the Item first, when GetItemL() leaves with item not found
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
            else if(err == KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
                TRAPD(error, iIndexer->UpdateL(*index_item));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
                if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
                    //Add entity to database for later use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
                    iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
                    iMdsItem->Setkey(aObjId);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
                    iMdsItem->SetUri(iImageDocument->GetUri());//Use the Absolute URI
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
                    TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
                    iMdsItem->SetDrive(drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   308
                    OstTrace0( TRACE_NORMAL, DUP9_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Added Item before Update." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added Item before Update.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
                }                       
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
            }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
        delete index_item;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
        iIndexer = NULL;//Assign to null not pointing to any memory
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
    else if (aActionType == ECPixRemoveAction)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
        //We can not get media id of removed doc from MDS as it is deleed so we have to remove from 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
        //all available Indexers
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
        // Remove the document
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
        //Get the Item from SyncDB for removed Item
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
        iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
        TRAPD(error, iDBManager->GetItemL(aObjId,*iMdsItem));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
        if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
            iIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());//Get Indexer from drive
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
            if(iIndexer) //If indexer found delete
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
               {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
               docid_str.Copy(iMdsItem->Uri());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
               TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
               if (err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
                   {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   333
                    OstTrace0( TRACE_NORMAL, DUP10_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Deleted." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
                    CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
                   }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
               else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
                   {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   338
                    OstTrace1( TRACE_NORMAL, DUP11_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in deleting", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
                    CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in deleting.", err);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
                   }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
               }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
            //delete entry from database
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
            iDBManager->RemoveL(iMdsItem->Key());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
            }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
        iIndexer = NULL;//Assign to null not pointing to any memory
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
        }    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
26
hgs
parents: 19
diff changeset
   349
void CImagePlugin::PausePluginL()
hgs
parents: 19
diff changeset
   350
    {
hgs
parents: 19
diff changeset
   351
    OstTraceFunctionEntry0( CIMAGEPLUGIN_PAUSEPLUGINL_ENTRY );
hgs
parents: 19
diff changeset
   352
    iObjectJobQueueManager->PauseL();
hgs
parents: 19
diff changeset
   353
    OstTraceFunctionExit0( CIMAGEPLUGIN_PAUSEPLUGINL_EXIT );
hgs
parents: 19
diff changeset
   354
    }
hgs
parents: 19
diff changeset
   355
hgs
parents: 19
diff changeset
   356
void CImagePlugin::ResumePluginL()
hgs
parents: 19
diff changeset
   357
    {
27
hgs
parents: 26
diff changeset
   358
    OstTraceFunctionEntry0( CIMAGEPLUGIN_RESUMEPLUGINL_ENTRY );    
26
hgs
parents: 19
diff changeset
   359
    iObjectJobQueueManager->ResumeL();    
hgs
parents: 19
diff changeset
   360
    OstTraceFunctionExit0( CIMAGEPLUGIN_RESUMEPLUGINL_EXIT );
hgs
parents: 19
diff changeset
   361
    }
hgs
parents: 19
diff changeset
   362
27
hgs
parents: 26
diff changeset
   363
void CImagePlugin::SaveL()
hgs
parents: 26
diff changeset
   364
    {
hgs
parents: 26
diff changeset
   365
    iObjectJobQueueManager->LoadQueuedItems();    
hgs
parents: 26
diff changeset
   366
    }
hgs
parents: 26
diff changeset
   367
hgs
parents: 26
diff changeset
   368
void CImagePlugin::LoadL()
hgs
parents: 26
diff changeset
   369
    {
hgs
parents: 26
diff changeset
   370
    iObjectJobQueueManager->SaveQueuedItems();
hgs
parents: 26
diff changeset
   371
    }
hgs
parents: 26
diff changeset
   372
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
void CImagePlugin::UpdateLogL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
    UpdatePerformaceDataL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
void CImagePlugin::UpdatePerformaceDataL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
    TTime now;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
   
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
    iCompleteTime.UniversalTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
    RFs fileSession;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
    RFile perfFile;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
    User::LeaveIfError(fileSession.Connect ());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
    /* Open file if it exists, otherwise create it and write content in it */
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
    if(perfFile.Open(fileSession, _L("c:\\data\\ImagePerf.txt"), EFileWrite))
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
    User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\ImagePerf.txt"), EFileWrite));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
    HBufC8 *heap = HBufC8::NewL(100);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
    TPtr8 ptr = heap->Des();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
    now.HomeTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
    TBuf<100> timeString;             
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
                
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
    now.FormatL(timeString,KOwnTimeFormat);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
    ptr.AppendNum(now.DateTime().Day());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
    ptr.Append(_L("/"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
    ptr.AppendNum(now.DateTime().Month());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
    ptr.Append(_L("/"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
    ptr.AppendNum(now.DateTime().Year());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    ptr.Append(_L(":"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    ptr.Append(timeString);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    ptr.Append(_L("--"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    ptr.AppendNum(count);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
    ptr.Append( _L(" :Time took for Harvesting Image is : "));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
    ptr.AppendNum(timeDiff.Int64()/1000) ;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    ptr.Append(_L(" MilliSeonds \n"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
    TInt myInt = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
    perfFile.Seek(ESeekEnd,myInt);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
    perfFile.Write (ptr);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
    perfFile.Close ();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
    fileSession.Close ();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
    delete heap;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
#endif
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
// End of file