DirectPrint/DirectPrintServer/src/directprintserverjobguard.cpp
author Steven Cao <steven.1.cao@nokia.com>
Tue, 11 May 2010 14:10:02 +0800
changeset 15 2275db202402
parent 12 613a5ff70823
permissions -rw-r--r--
Pickup K3's code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     1
/*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     2
* Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     3
* All rights reserved.
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     4
* This component and the accompanying materials are made available
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     6
* which accompanies this distribution, and is available
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     8
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     9
* Initial Contributors:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    10
* Kanrikogaku Kenkyusho, Ltd. - Initial contribution
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    11
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    12
* Contributors:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    13
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    14
* Description:  
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    15
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    16
*/
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    17
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    18
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    19
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    20
#include "directprintserverjobguard.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    21
#include "directprintbody.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    22
#include "clog.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    23
#include "directprintmessage.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    24
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    25
CDirectPrintServerJobGuard* CDirectPrintServerJobGuard::NewL( CDirectPrintBody& aEngine )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    26
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    27
	CDirectPrintServerJobGuard* self = new ( ELeave ) CDirectPrintServerJobGuard( aEngine );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    28
	CleanupStack::PushL( self );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    29
	self->ConstructL();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    30
	CleanupStack::Pop();    // self
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    31
	return self;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    32
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    33
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    34
CDirectPrintServerJobGuard::CDirectPrintServerJobGuard( CDirectPrintBody& aEngine )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    35
	: iEngine( aEngine )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    36
	, iRequestActive( EFalse )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    37
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    38
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    39
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    40
CDirectPrintServerJobGuard::~CDirectPrintServerJobGuard()
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    41
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    42
	LOG("CDirectPrintServerJobGuard::~CDirectPrintServerJobGuard begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    43
	iImages.ResetAndDestroy();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    44
	iImages.Close();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    45
	iBuffer.Close();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    46
	LOG("CDirectPrintServerJobGuard::~CDirectPrintServerJobGuard end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    47
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    48
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    49
void CDirectPrintServerJobGuard::ConstructL()
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    50
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    51
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    52
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    53
void CDirectPrintServerJobGuard::PrepareL( TDpMessage& aMessage )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    54
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    55
	LOG("CDirectPrintServerJobGuard::PrepareL begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    56
	TInt len = aMessage.GetDesLength( 0 );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    57
	HBufC* buf = HBufC::NewLC( len );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    58
	TPtr ptr( buf->Des() );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    59
	aMessage.ReadL( 0, ptr );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    60
	iImages.AppendL( buf );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    61
	CleanupStack::Pop(); // buf
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    62
	LOG("CDirectPrintServerJobGuard::PrepareL end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    63
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    64
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    65
void CDirectPrintServerJobGuard::Stop()	
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    66
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    67
	LOG("CDirectPrintServerJobGuard::Stop begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    68
	iImages.ResetAndDestroy();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    69
	if( iRequestActive )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    70
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    71
		LOG("CDirectPrintServerJobGuard::Stop cancelling...");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    72
		iMessage->Complete( KErrCancel );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    73
		iRequestActive = EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    74
		}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    75
	LOG("CDirectPrintServerJobGuard::Stop end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    76
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    77
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    78
TInt CDirectPrintServerJobGuard::CreateL( TDpMessage& aMessage )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    79
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    80
	LOG("CDirectPrintServerJobGuard::CreateL begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    81
	iRequestActive = EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    82
	iBuffer.Reset();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    83
	TInt printer = aMessage.Int0();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    84
	TInt err = iEngine.CreatePrintJobL( printer, iImages, *this );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    85
	LOG1("CDirectPrintServerJobGuard::CreateL err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    86
	if( err )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    87
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    88
		iImages.ResetAndDestroy();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    89
		}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    90
	LOG1("CDirectPrintServerJobGuard::CreateL return: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    91
	return err;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    92
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    93
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    94
void CDirectPrintServerJobGuard::ContinueCreateL( TDpMessage& aMessage )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    95
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    96
	LOG("CDirectPrintServerJobGuard::ContinueCreateL begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    97
	if( iMessage ) iMessage->SetDisposable( ETrue );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    98
	iMessage = &aMessage;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    99
	iRequestActive = ETrue;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   100
	if( iBuffer.Count() )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   101
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   102
		LOG("CDirectPrintServerJobGuard::ContinueCreateL before ProcessL");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   103
		Process();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   104
		LOG("CDirectPrintServerJobGuard::ContinueCreateL after ProcessL");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   105
		}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   106
	LOG("CDirectPrintServerJobGuard::ContinueCreateL end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   107
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   108
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   109
void CDirectPrintServerJobGuard::PrintJobProgressEvent(TInt aStatus, TInt aPercentCompletion, TInt aJobStateCode)
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   110
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   111
	LOG("CDirectPrintServerJobGuard::PrintJobProgressEvent begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   112
	LOG1("CDirectPrintServerJobGuard::PrintJobProgressEvent aStatus: %d", aStatus);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   113
	LOG1("CDirectPrintServerJobGuard::PrintJobProgressEvent aPercentCompletion: %d", aPercentCompletion);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   114
	LOG1("CDirectPrintServerJobGuard::PrintJobProgressEvent aJobStateCode: %d", aJobStateCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   115
	TDirectPrintJobGuardData data;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   116
	data.iCb = TDirectPrintJobGuardData::EProgressEventCb;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   117
	data.iStatus = aStatus;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   118
	data.iPercentCompletion = aPercentCompletion;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   119
	data.iJobStateCode = aJobStateCode;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   120
	TRAPD( err, DoPreProcessL( data ) );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   121
	LOG1("CDirectPrintServerJobGuard::PrintJobProgressEvent DoPreProcessL's TRAP err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   122
	Process( err );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   123
	LOG("CDirectPrintServerJobGuard::PrintJobProgressEvent end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   124
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   125
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   126
void CDirectPrintServerJobGuard::PrintJobErrorEvent(TInt aError, TInt aErrorStringCode)
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   127
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   128
	LOG("CDirectPrintServerJobGuard::PrintJobErrorEvent begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   129
	LOG1("CDirectPrintServerJobGuard::PrintJobErrorEvent aError: %d", aError);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   130
	LOG1("CDirectPrintServerJobGuard::PrintJobErrorEvent aErrorStringCode: %d", aErrorStringCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   131
	TDirectPrintJobGuardData data;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   132
	data.iCb = TDirectPrintJobGuardData::EErrorEventCb;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   133
	data.iError = aError;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   134
	data.iErrorStringCode = aErrorStringCode;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   135
	TRAPD( err, DoPreProcessL( data ) );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   136
	LOG1("CDirectPrintServerJobGuard::PrintJobErrorEvent DoPreProcessL's TRAP err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   137
	Process( err );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   138
	LOG("CDirectPrintServerJobGuard::PrintJobErrorEvent end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   139
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   140
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   141
void CDirectPrintServerJobGuard::PrinterStatusEvent(TInt aError, TInt aErrorStringCode)
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   142
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   143
	LOG("CDirectPrintServerJobGuard::PrinterStatusEvent begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   144
	LOG1("CDirectPrintServerJobGuard::PrinterStatusEvent aError: %d", aError);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   145
	LOG1("CDirectPrintServerJobGuard::PrinterStatusEvent aErrorStringCode: %d", aErrorStringCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   146
	TDirectPrintJobGuardData data;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   147
	data.iCb = TDirectPrintJobGuardData::EStatusEventCb;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   148
	data.iError = aError;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   149
	data.iErrorStringCode = aErrorStringCode;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   150
	TRAPD( err, DoPreProcessL( data ) );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   151
	LOG1("CDirectPrintServerJobGuard::PrinterStatusEvent DoPreProcessL's TRAP err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   152
	Process( err );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   153
	LOG("CDirectPrintServerJobGuard::PrinterStatusEvent end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   154
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   155
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   156
void CDirectPrintServerJobGuard::PreviewImageEvent(TInt aFsBitmapHandle)
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   157
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   158
	LOG("CDirectPrintServerJobGuard::PreviewImageEvent begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   159
	LOG1("CDirectPrintServerJobGuard::PreviewImageEvent aFsBitmapHandle: %d", aFsBitmapHandle);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   160
	TDirectPrintJobGuardData data;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   161
	data.iCb = TDirectPrintJobGuardData::EImageEventCb;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   162
	data.iFsBitmapHandle = aFsBitmapHandle;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   163
	TRAPD( err, DoPreProcessL( data ) );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   164
	LOG1("CDirectPrintServerJobGuard::PreviewImageEvent DoPreProcessL's TRAP err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   165
	Process( err );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   166
	LOG("CDirectPrintServerJobGuard::PreviewImageEvent end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   167
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   168
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   169
void CDirectPrintServerJobGuard::DoPreProcessL( const TDirectPrintJobGuardData& aData )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   170
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   171
	LOG("CDirectPrintServerJobGuard::DoPreProcessL begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   172
	User::LeaveIfError( iBuffer.Append( aData ) );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   173
	LOG("CDirectPrintServerJobGuard::DoPreProcessL end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   174
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   175
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   176
void CDirectPrintServerJobGuard::DoProcessL()
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   177
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   178
	LOG("CDirectPrintServerJobGuard::ProcessL begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   179
	if( iBuffer.Count() && iRequestActive )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   180
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   181
		LOG("CDirectPrintServerJobGuard::DoProcessL step 1");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   182
		TPtr8 ptr(reinterpret_cast<TUint8*>(&(iBuffer[0])), sizeof(iBuffer[0]), sizeof(iBuffer[0]));
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   183
		LOG("CDirectPrintServerJobGuard::DoProcessL step 2");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   184
		iMessage->WriteL( 0, ptr );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   185
		LOG("CDirectPrintServerJobGuard::DoProcessL step 3");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   186
		iMessage->Complete( KErrNone );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   187
		LOG("CDirectPrintServerJobGuard::DoProcessL step 4");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   188
		iRequestActive = EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   189
		LOG("CDirectPrintServerJobGuard::DoProcessL step 5");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   190
		iBuffer.Remove( 0 );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   191
		LOG("CDirectPrintServerJobGuard::DoProcessL step 6");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   192
		}	
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   193
	LOG("CDirectPrintServerJobGuard::ProcessL end");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   194
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   195
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   196
void CDirectPrintServerJobGuard::Process( TInt aErr )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   197
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   198
	LOG("CDirectPrintServerJobGuard::Process begin");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   199
	if( aErr )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   200
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   201
		LOG1("CDirectPrintServerJobGuard::Process aErr: %d", aErr);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   202
		iMessage->Complete( aErr );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   203
		iRequestActive = EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   204
		}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   205
	else
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   206
		{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   207
		LOG("CDirectPrintServerJobGuard::Process calling DoProcessL");
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   208
		TRAPD( err, DoProcessL() );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   209
		LOG1("CDirectPrintServerJobGuard::Process DoProcessL's TRAP err: %d", err);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   210
		if( err )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   211
			{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   212
			iMessage->Complete( err );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   213
			iRequestActive = EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   214
			}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   215
		}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   216
	LOG("CDirectPrintServerJobGuard::Process end");	
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   217
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   218
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   219
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   220
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   221
// DEPRECATED
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   222
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   223
void CDirectPrintServerJobGuard::ShowMessageL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   224
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   225
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   226
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   227
TBool CDirectPrintServerJobGuard::AskYesNoQuestionL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   228
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   229
	return EFalse;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   230
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   231
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   232
const TDesC& CDirectPrintServerJobGuard::AskForInputL( TInt /*aMsgLine1Code*/, TInt /*aMsgLine2Code*/ )
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   233
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   234
	return KNullDesC;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   235
	}
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   236
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   237
//  End of File