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: PC Connectivity Plug-in Utils implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <obexconstants.h> |
|
21 #include "sconpcconnpluginutils.h" |
|
22 #include "debug.h" |
|
23 |
|
24 // ============================= MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError ) |
|
28 // Converts Symbian error code to OBEX error code |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 TInt TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError ) |
|
32 { |
|
33 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError )\ |
|
34 : begin, aError: %d", aError ); |
|
35 TInt obexErr ( KErrIrObexRespBadRequest ); |
|
36 switch( aError ) |
|
37 { |
|
38 case KErrNone: |
|
39 obexErr = KErrNone; |
|
40 break; |
|
41 case KErrNotFound: |
|
42 obexErr = KErrIrObexRespNotFound; |
|
43 break; |
|
44 case KErrGeneral: |
|
45 case KErrCancel: |
|
46 obexErr = KErrIrObexRespBadRequest; |
|
47 break; |
|
48 case KErrNoMemory: |
|
49 obexErr = KErrIrObexRespDatabaseFull; |
|
50 break; |
|
51 case KErrNotSupported: |
|
52 obexErr = KErrIrObexRespNotImplemented; |
|
53 break; |
|
54 case KErrArgument: |
|
55 case KErrTotalLossOfPrecision: |
|
56 case KErrBadHandle: |
|
57 case KErrOverflow: |
|
58 case KErrUnderflow: |
|
59 case KErrAlreadyExists: |
|
60 obexErr = KErrIrObexRespConflict; |
|
61 break; |
|
62 case KErrPathNotFound: |
|
63 case KErrDied: |
|
64 obexErr = KErrIrObexRespNotFound; |
|
65 break; |
|
66 case KErrInUse: |
|
67 obexErr = KErrIrObexRespTimedOut; |
|
68 break; |
|
69 case KErrServerTerminated: |
|
70 obexErr = KErrIrObexRespNotFound; |
|
71 break; |
|
72 case KErrServerBusy: |
|
73 case KErrCompletion: |
|
74 case KErrNotReady: |
|
75 case KErrUnknown: |
|
76 case KErrCorrupt: |
|
77 obexErr = KErrIrObexRespForbidden; |
|
78 break; |
|
79 case KErrAccessDenied: |
|
80 case KErrLocked: |
|
81 obexErr = KErrIrObexRespUnauthorized; |
|
82 break; |
|
83 case KErrWrite: |
|
84 case KErrDisMounted: |
|
85 case KErrEof: |
|
86 obexErr = KErrIrObexRespForbidden; |
|
87 break; |
|
88 case KErrDiskFull: |
|
89 obexErr = KErrIrObexRespDatabaseFull; |
|
90 break; |
|
91 case KErrBadDriver: |
|
92 case KErrBadName: |
|
93 obexErr = KErrIrObexRespPreCondFailed; |
|
94 break; |
|
95 case KErrCommsLineFail: |
|
96 case KErrCommsFrame: |
|
97 case KErrCommsOverrun: |
|
98 case KErrCommsParity: |
|
99 case KErrTimedOut: |
|
100 case KErrCouldNotConnect: |
|
101 case KErrCouldNotDisconnect: |
|
102 case KErrBadLibraryEntryPoint: |
|
103 case KErrBadDescriptor: |
|
104 case KErrAbort: |
|
105 obexErr = KErrIrObexRespForbidden; |
|
106 break; |
|
107 case KErrTooBig: |
|
108 obexErr = KErrIrObexRespReqEntityTooLarge; |
|
109 break; |
|
110 case KErrDivideByZero: |
|
111 case KErrBadPower: |
|
112 case KErrDirFull: |
|
113 case KErrHardwareNotAvailable: |
|
114 obexErr = KErrIrObexRespForbidden; |
|
115 break; |
|
116 case KErrDisconnected: // System is shutting down |
|
117 obexErr = KErrIrObexRespMethodNotAllowed; |
|
118 break; |
|
119 default: |
|
120 obexErr = KErrIrObexRespBadRequest; |
|
121 break; |
|
122 }; |
|
123 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( \ |
|
124 TInt aError ) returned : %d", obexErr ); |
|
125 return obexErr; |
|
126 }; |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError ) |
|
130 // Converts Symbian error code to OBEX error code |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 TInt TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError ) |
|
134 { |
|
135 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode( TInt \ |
|
136 aError ) : begin, aError: %d", aError ); |
|
137 |
|
138 TInt obexErr ( KErrIrObexRespInternalError ); |
|
139 switch( aError ) |
|
140 { |
|
141 case KErrNone: |
|
142 obexErr = KErrNone; |
|
143 break; |
|
144 case KErrNotFound: |
|
145 obexErr = KErrIrObexRespNotFound; |
|
146 break; |
|
147 case KErrGeneral: |
|
148 case KErrCancel: |
|
149 obexErr = KErrIrObexRespInternalError; |
|
150 break; |
|
151 case KErrNoMemory: |
|
152 obexErr = KErrIrObexRespDatabaseFull; |
|
153 break; |
|
154 case KErrNotSupported: |
|
155 obexErr = KErrIrObexRespUnsupMediaType; |
|
156 break; |
|
157 case KErrArgument: |
|
158 case KErrTotalLossOfPrecision: |
|
159 case KErrBadHandle: |
|
160 case KErrOverflow: |
|
161 case KErrUnderflow: |
|
162 obexErr = KErrIrObexRespPreCondFailed; |
|
163 break; |
|
164 case KErrAlreadyExists: |
|
165 obexErr = KErrIrObexRespConflict; |
|
166 break; |
|
167 case KErrPathNotFound: |
|
168 case KErrDied: |
|
169 case KErrInUse: |
|
170 obexErr = KErrIrObexRespTimedOut; |
|
171 break; |
|
172 case KErrServerTerminated: |
|
173 obexErr = KErrIrObexRespPreCondFailed; |
|
174 break; |
|
175 case KErrServerBusy: |
|
176 obexErr = KErrIrObexRespConflict; |
|
177 break; |
|
178 case KErrCompletion: |
|
179 case KErrNotReady: |
|
180 case KErrUnknown: |
|
181 case KErrCorrupt: |
|
182 obexErr = KErrIrObexRespInternalError; |
|
183 break; |
|
184 case KErrAccessDenied: |
|
185 case KErrLocked: |
|
186 obexErr = KErrIrObexRespUnauthorized; |
|
187 break; |
|
188 case KErrWrite: |
|
189 case KErrDisMounted: |
|
190 case KErrEof: |
|
191 obexErr = KErrIrObexRespInternalError; |
|
192 break; |
|
193 case KErrDiskFull: |
|
194 obexErr = KErrIrObexRespDatabaseFull; |
|
195 break; |
|
196 case KErrBadDriver: |
|
197 case KErrBadName: |
|
198 obexErr = KErrIrObexRespNotFound; |
|
199 break; |
|
200 case KErrCommsLineFail: |
|
201 case KErrCommsFrame: |
|
202 case KErrCommsOverrun: |
|
203 case KErrCommsParity: |
|
204 case KErrTimedOut: |
|
205 case KErrCouldNotConnect: |
|
206 case KErrCouldNotDisconnect: |
|
207 case KErrBadLibraryEntryPoint: |
|
208 case KErrBadDescriptor: |
|
209 case KErrAbort: |
|
210 case KErrTooBig: |
|
211 case KErrDivideByZero: |
|
212 case KErrBadPower: |
|
213 case KErrDirFull: |
|
214 case KErrHardwareNotAvailable: |
|
215 obexErr = KErrIrObexRespInternalError; |
|
216 break; |
|
217 default: |
|
218 obexErr = KErrIrObexRespInternalError; |
|
219 break; |
|
220 }; |
|
221 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode(\ |
|
222 TInt aError ) returned : %d", obexErr ); |
|
223 return obexErr; |
|
224 }; |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError ) |
|
228 // Converts Symbian error code to OBEX error code |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 TInt TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError ) |
|
232 { |
|
233 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt \ |
|
234 aError ) : begin, aError: %d", aError ); |
|
235 |
|
236 TInt obexErr ( KErrIrObexRespInternalError ); |
|
237 switch( aError ) |
|
238 { |
|
239 case KErrNone: |
|
240 obexErr = KErrIrObexRespSuccess; |
|
241 break; |
|
242 case KErrNotFound: |
|
243 case KErrPathNotFound: |
|
244 obexErr = KErrIrObexRespNotFound; |
|
245 break; |
|
246 case KErrAccessDenied: |
|
247 obexErr = KErrIrObexRespForbidden; |
|
248 break; |
|
249 case KErrNoMemory: |
|
250 case KErrDiskFull: |
|
251 obexErr = KErrIrObexRespDatabaseFull; |
|
252 break; |
|
253 case KErrInUse: |
|
254 case KErrLocked: |
|
255 obexErr = KErrIrObexRespConflict; |
|
256 break; |
|
257 case KErrNotSupported: |
|
258 obexErr = KErrIrObexRespNotImplemented; |
|
259 break; |
|
260 case KErrAlreadyExists: |
|
261 obexErr = KErrIrObexRespNotModified; |
|
262 break; |
|
263 |
|
264 default: |
|
265 obexErr = KErrIrObexRespInternalError; |
|
266 break; |
|
267 }; |
|
268 LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode(\ |
|
269 TInt aError ) returned : %d", obexErr ); |
|
270 return obexErr; |
|
271 }; |
|
272 |
|
273 //End of file |
|
274 |
|