|
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 "obexerrorengine.h" |
|
22 #include "OBEXUTIL.H" |
|
23 |
|
24 CObexErrorEngine* CObexErrorEngine::NewL() |
|
25 { |
|
26 CObexErrorEngine* self = new (ELeave) CObexErrorEngine; |
|
27 return self; |
|
28 } |
|
29 |
|
30 CObexErrorEngine::CObexErrorEngine() |
|
31 { |
|
32 iLastError = ENoError; |
|
33 } |
|
34 |
|
35 /** |
|
36 Function used to retreive an extended error code for the last completed client operation. |
|
37 |
|
38 @param aErrorSet The set of errors that the resolved error will lie within. |
|
39 @return An extended error code that lies within the error set specified. |
|
40 */ |
|
41 TUint CObexErrorEngine::LastError(TObexClientErrorResolutionSetType aErrorSet) const |
|
42 { |
|
43 TUint ret = 0; |
|
44 |
|
45 if (aErrorSet == EObexClientBasicErrorResolutionSet) |
|
46 { |
|
47 switch (iLastError) |
|
48 { |
|
49 case ENoError: |
|
50 { |
|
51 ret = EObexRequestAccepted; |
|
52 } |
|
53 break; |
|
54 |
|
55 case EAlreadyConnected: |
|
56 case EChallengeRejected: |
|
57 case EChallengeAbsent: |
|
58 case EBadConnectionId: |
|
59 case EErrorResponseFromServer: |
|
60 { |
|
61 ret = EObexRequestNotAccepted; |
|
62 } |
|
63 break; |
|
64 |
|
65 case EResponseTimeout: |
|
66 { |
|
67 ret = EObexRequestTimeout; |
|
68 } |
|
69 break; |
|
70 |
|
71 case ECannotInsertConnectInfo: |
|
72 case EPrepareConnectPacketIncorrectState: |
|
73 case EResponseWhileWriting: |
|
74 case ECannotExtractConnectInfo: |
|
75 case ECannotProcessChallenge: |
|
76 case EUnexpectedChallengeResponse: |
|
77 case EBadOpcodeInConnectPacket: |
|
78 case EAborted: |
|
79 case ECannotInitialiseObject: |
|
80 case ECannotSetConnectionId: |
|
81 case ECannotPreparePacket: |
|
82 case EMultipacketResponse: |
|
83 case ECannotExtractFinalPutHeader: |
|
84 case EPutOutOfSync: |
|
85 case EGetPrematureSuccess: |
|
86 case EGetResponseParseError: |
|
87 { |
|
88 ret = EObexRequestLocalInterruption; |
|
89 } |
|
90 break; |
|
91 |
|
92 case ETransportUpFailed: |
|
93 case EOpOutstandingOnTransportDown: |
|
94 case EDisconnected: |
|
95 { |
|
96 ret = EObexRequestLinkInterruption; |
|
97 } |
|
98 break; |
|
99 |
|
100 default: |
|
101 { |
|
102 IrOBEXUtil::Fault(EUnderlyingErrorUnrecognised); |
|
103 } |
|
104 } |
|
105 } |
|
106 else |
|
107 { |
|
108 IrOBEXUtil::Fault(EErrorSetUnrecognised); |
|
109 } |
|
110 |
|
111 return ret; |
|
112 } |
|
113 |
|
114 void CObexErrorEngine::SetLastError(TObexClientUnderlyingError aError) |
|
115 { |
|
116 iLastError = aError; |
|
117 } |