obex/obexextensionapi/src/obexerrorextension.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2005-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include <obex/extensionapis/obexclienterrorresolver.h>
       
    22 #include <obex/internal/mobexclienterrorresolver.h>
       
    23 
       
    24 /**
       
    25 Factory function for CObexClientErrorResolver.  Will leave if the associated CObexClient
       
    26 does not support this extension type.
       
    27 
       
    28 @param aClient Reference to the instance of CObexClient being extended.
       
    29 @return A pointer to a new CObexClientErrorResolver object.
       
    30 */
       
    31 EXPORT_C CObexClientErrorResolver* CObexClientErrorResolver::NewL(CObexClient& aClient)
       
    32 	{
       
    33 	return NewL(aClient, EObexClientBasicErrorResolutionSet);
       
    34 	}
       
    35 
       
    36 /**
       
    37 Factory function for CObexClientErrorResolver.  Will leave if the associated CObexClient
       
    38 does not support this extension type.
       
    39 
       
    40 @param aClient Reference to the instance of CObexClient being extended.
       
    41 @param aErrorSet The set of errors that the resolved error will lie within.
       
    42 @return A pointer to a new CObexClientErrorResolver object.
       
    43 */
       
    44 EXPORT_C CObexClientErrorResolver* CObexClientErrorResolver::NewL(CObexClient& aClient, TObexClientErrorResolutionSetType aErrorSet)
       
    45 	{
       
    46 	CObexClientErrorResolver* self = new (ELeave)CObexClientErrorResolver(aClient, aErrorSet);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL();
       
    49 	CleanupStack::Pop();
       
    50 	return self;
       
    51 	}
       
    52 
       
    53 /**
       
    54 Function used to retreive an extended error code for the last completed client operation.
       
    55 
       
    56 @return An extended error code that lies within the error set specified at construction time.
       
    57 */
       
    58 EXPORT_C TUint CObexClientErrorResolver::LastError() const
       
    59 	{
       
    60 	return iClientErrorResolver->LastError(iErrorSet);
       
    61 	}
       
    62 
       
    63 CObexClientErrorResolver::CObexClientErrorResolver(CObexClient& aClient, TObexClientErrorResolutionSetType aErrorSet)
       
    64 	: iObexClient(aClient), iErrorSet(aErrorSet)
       
    65 	{
       
    66 	}
       
    67 
       
    68 void CObexClientErrorResolver::ConstructL()
       
    69 	{
       
    70 	iClientErrorResolver = static_cast<MObexClientErrorResolver*>(iObexClient.ExtensionInterface(KObexClientErrorResolverInterface));
       
    71 	User::LeaveIfNull(iClientErrorResolver);
       
    72 	}