|
1 // Copyright (c) 2004-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 #include <cobexsendoperation.h> |
|
17 #include <obexclientmtm.h> |
|
18 |
|
19 |
|
20 EXPORT_C CObexSendOperation::CObexSendOperation(CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus) : |
|
21 CMsvSendOperation(aMsvSession, aObserverRequestStatus) |
|
22 { |
|
23 } |
|
24 |
|
25 EXPORT_C const TDesC8& CObexSendOperation::TranslateProgress(const TDesC8& aProgress) |
|
26 { |
|
27 TObexMtmProgress obexProgress; |
|
28 TPckg<TObexMtmProgress> obexProgressBuf(obexProgress); |
|
29 obexProgressBuf.Copy(aProgress); |
|
30 |
|
31 // default progress |
|
32 iProgress().iProgressMax = 0; |
|
33 iProgress().iProgress = 0; |
|
34 |
|
35 // translate obex progress to standard send progress |
|
36 switch (obexProgress.iSendState) |
|
37 { |
|
38 case TObexMtmProgress::ENullOp: |
|
39 case TObexMtmProgress::EUserCancelled: |
|
40 case TObexMtmProgress::ESendError: |
|
41 iProgress().iState = ESendStateFailed; |
|
42 break; |
|
43 case TObexMtmProgress::EDisconnected: |
|
44 iProgress().iState = ESendStateWaitingToSend; |
|
45 break; |
|
46 case TObexMtmProgress::EConnect: |
|
47 case TObexMtmProgress::EConnectAttemptComplete: |
|
48 iProgress().iState = ESendStateConnecting; |
|
49 break; |
|
50 case TObexMtmProgress::EInitialise: |
|
51 case TObexMtmProgress::EInitialised: |
|
52 iProgress().iState = ESendStateInPreparation; |
|
53 break; |
|
54 case TObexMtmProgress::ESendObject: |
|
55 iProgress().iState = ESendStateSending; |
|
56 iProgress().iProgressMax = obexProgress.iTotalEntryCount; |
|
57 iProgress().iProgress = obexProgress.iEntriesDone; |
|
58 break; |
|
59 case TObexMtmProgress::ESendNextObject: |
|
60 iProgress().iState = ESendStateSending; |
|
61 iProgress().iProgressMax = obexProgress.iCurrentEntrySize; |
|
62 iProgress().iProgress = obexProgress.iCurrentBytesTrans; |
|
63 break; |
|
64 case TObexMtmProgress::ESendComplete: |
|
65 iProgress().iState = ESendStateDone; |
|
66 break; |
|
67 case TObexMtmProgress::EMovedToSent: |
|
68 iProgress().iState = ESendStateDone; |
|
69 break; |
|
70 } |
|
71 // get error |
|
72 iProgress().iError = obexProgress.iError; |
|
73 return iProgress; |
|
74 } |