applayerprotocols/ftpengine/ftpprot/SETERROR.CPP
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Active object to set an error asynchronously
       
    15 // Author:	Philippe Gabriel
       
    16 // Set an error condition to be reported asynchronously
       
    17 // so the client get the error condition from the scheduler
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file SETERROR.CPP
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #include "debug.h"
       
    27 #include "seterror.h"
       
    28 
       
    29 CFTPSetError::CFTPSetError(MSetErrorNotifier *aNotifier
       
    30 #if defined(__EPOCCONSOLETRACE__)
       
    31 						,CConsoleBase* aDebugConsole		
       
    32 #elif defined(__EPOCFILETRACE__)
       
    33 						,RFile*	aDebugFile
       
    34 #endif						   
       
    35 						):CActive(CActive::EPriorityStandard)
       
    36 	{
       
    37 #if defined(__EPOCCONSOLETRACE__)
       
    38 	__FTPDebugConsole = aDebugConsole;
       
    39 #elif defined(__EPOCFILETRACE__)
       
    40 	__FTPDebugFile = aDebugFile;
       
    41 #endif
       
    42 	iNotifier = aNotifier;
       
    43 	}
       
    44 
       
    45 
       
    46 CFTPSetError* CFTPSetError::NewL(MSetErrorNotifier *aNotifier
       
    47 #if defined(__EPOCCONSOLETRACE__)
       
    48 						,CConsoleBase* aDebugConsole		
       
    49 #elif defined(__EPOCFILETRACE__)
       
    50 						,RFile*	aDebugFile
       
    51 #endif	
       
    52 						)
       
    53 	{
       
    54 	CFTPSetError* self = new (ELeave) CFTPSetError(aNotifier
       
    55 #if defined(__EPOCCONSOLETRACE__)
       
    56 												,aDebugConsole		
       
    57 #elif defined(__EPOCFILETRACE__)
       
    58 												,aDebugFile
       
    59 #endif	
       
    60 		);
       
    61 	CActiveScheduler::Add(self);
       
    62 	return self;
       
    63 	} 
       
    64 
       
    65 void CFTPSetError::DoCancel()
       
    66 {
       
    67 }
       
    68 
       
    69 void CFTPSetError::RunL()
       
    70 	{
       
    71 	FTPPROTDEBUG(_DBGFtpseterr,_L("CFTPSetError::RunL called "));
       
    72 	switch (iStatus.Int())
       
    73 		{
       
    74 		case KErrNone:
       
    75 			FTPPROTDEBUG(_DBGFtpseterr,_L("iStatus: NoError\n"));
       
    76 			// Call Upper layer notifier
       
    77 			iNotifier->SetErrorNotifier(iError);
       
    78 			break;
       
    79 		default:
       
    80 			__ASSERT_DEBUG(FALSE, User::Panic(_L("CFtpSetError"), 0));
       
    81 			break;
       
    82 		}
       
    83 	} 
       
    84 
       
    85 CFTPSetError::~CFTPSetError()
       
    86 	{
       
    87 	FTPPROTDEBUG(_DBGFtpseterr,_L("CFTPSetError::~CFTPSetError called\n"));
       
    88 	}
       
    89 
       
    90 void CFTPSetError::SetError(const TInt aError)
       
    91 	{
       
    92 	TRequestStatus* p=&iStatus;	
       
    93 	iError = aError;
       
    94 	// Complete immediately
       
    95 	SetActive();
       
    96 	User::RequestComplete(p, KErrNone);
       
    97 	}