connectivitymodules/SeCon/plugins/ftp/src/sconftppluginutils.cpp
branchRCL_3
changeset 42 0aa8cc770c8a
parent 40 453dfc402455
child 43 4a793f564d72
equal deleted inserted replaced
40:453dfc402455 42:0aa8cc770c8a
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  File Transfer Profile Plug-in utilities
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <obexconstants.h>
       
    21 #include "sconftppluginutils.h"
       
    22 #include "debug.h"
       
    23 
       
    24 // ============================= MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TFTPpluginUtils::ConvertFTPResponseCode( TInt aError )
       
    28 // Converts Symbian error code to OBEX error code
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 TInt TFTPpluginUtils::ConvertFTPResponseCode( TInt aError )
       
    32 	{
       
    33 	LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : begin Code  %d", aError );
       
    34 	TInt obexErr ( KErrIrObexRespBadRequest );
       
    35 	switch( aError )
       
    36 		{
       
    37 		case KErrNone:
       
    38 			obexErr = KErrNone;
       
    39 			break;
       
    40 		case KErrNotFound:
       
    41 			obexErr = KErrIrObexRespNotFound;
       
    42 			break;
       
    43 		case KErrGeneral:
       
    44 		case KErrCancel:
       
    45 			obexErr = KErrIrObexRespBadRequest;
       
    46 			break;
       
    47 		case KErrNoMemory:
       
    48 			obexErr = KErrIrObexRespDatabaseFull;
       
    49 			break;
       
    50 		case KErrNotSupported:
       
    51 			obexErr = KErrIrObexRespNotImplemented;
       
    52 			break;
       
    53 		case KErrArgument:
       
    54 		case KErrTotalLossOfPrecision:
       
    55 		case KErrBadHandle:
       
    56 		case KErrOverflow:
       
    57 		case KErrUnderflow:
       
    58 		case KErrAlreadyExists:
       
    59 			obexErr = KErrIrObexRespConflict;
       
    60 			break;
       
    61 		case KErrPathNotFound:
       
    62 		case KErrDied:
       
    63 			obexErr = KErrIrObexRespNotFound;
       
    64 			break;
       
    65 		case KErrInUse:
       
    66 			obexErr = KErrIrObexRespTimedOut;
       
    67 			break;
       
    68 		case KErrServerTerminated:
       
    69 			obexErr = KErrIrObexRespNotFound;
       
    70 			break;
       
    71 		case KErrServerBusy:
       
    72 		case KErrCompletion:
       
    73 		case KErrNotReady:
       
    74 		case KErrUnknown:
       
    75 		case KErrCorrupt:
       
    76 			obexErr = KErrIrObexRespForbidden;
       
    77 			break;
       
    78 		case KErrAccessDenied:
       
    79 		case KErrLocked:
       
    80 			obexErr = KErrIrObexRespUnauthorized;
       
    81 			break;
       
    82 		case KErrWrite:
       
    83 		case KErrDisMounted:
       
    84 		case KErrEof:
       
    85 			obexErr = KErrIrObexRespForbidden;
       
    86 			break;
       
    87 		case KErrDiskFull:
       
    88 			obexErr = KErrIrObexRespDatabaseFull;
       
    89 			break;
       
    90 		case KErrBadDriver:
       
    91 		case KErrBadName:
       
    92 			obexErr = KErrIrObexRespPreCondFailed;
       
    93 			break;
       
    94 		case KErrCommsLineFail:
       
    95 		case KErrCommsFrame:
       
    96 		case KErrCommsOverrun:
       
    97 		case KErrCommsParity:
       
    98 		case KErrTimedOut:
       
    99 		case KErrCouldNotConnect:
       
   100 		case KErrCouldNotDisconnect:
       
   101 		case KErrBadLibraryEntryPoint:
       
   102 		case KErrBadDescriptor:
       
   103 		case KErrAbort:
       
   104 			obexErr = KErrIrObexRespForbidden;
       
   105 			break;
       
   106 		case KErrTooBig:
       
   107 			obexErr = KErrIrObexRespReqEntityTooLarge;
       
   108 			break;
       
   109 		case KErrDivideByZero:
       
   110 		case KErrBadPower:
       
   111 		case KErrDirFull:
       
   112 		case KErrHardwareNotAvailable:
       
   113 			obexErr = KErrIrObexRespForbidden;
       
   114 			break;
       
   115 		case KErrDisconnected: // System is shutting down
       
   116 		    obexErr = KErrIrObexRespMethodNotAllowed;
       
   117 		    break;
       
   118 		default:
       
   119 			obexErr = KErrIrObexRespBadRequest;
       
   120 			break;
       
   121 		};
       
   122 	LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : returned %d", obexErr );
       
   123 	return obexErr;
       
   124 };
       
   125 
       
   126 //End of file
       
   127 
       
   128 
       
   129