1 /* |
|
2 * Copyright (c) 2002-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: Receives obex object via InfraRed, used to receive files |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CFILEMANAGERIRRECEIVER_H |
|
21 #define CFILEMANAGERIRRECEIVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <obex.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CObexServer; |
|
29 class CObexBufObject; |
|
30 class MFileManagerProcessObserver; |
|
31 class CFileManagerEngine; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Handles the file receiving via infrared |
|
36 * |
|
37 * @lib FileManagerEngine.lib |
|
38 * @since 2.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS(CFileManagerIRReceiver) : public CBase, |
|
41 public MObexServerNotify |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 */ |
|
48 IMPORT_C static CFileManagerIRReceiver* NewL( |
|
49 MFileManagerProcessObserver& aObserver, |
|
50 const TDesC& aPath, |
|
51 CFileManagerEngine& aEngine ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 IMPORT_C ~CFileManagerIRReceiver(); |
|
57 |
|
58 /** |
|
59 * Receives file through IR and stores it to |
|
60 * iPath location. Filename is get from |
|
61 * sent file and not included in iPath. |
|
62 */ |
|
63 IMPORT_C void ReceiveFileL(); |
|
64 |
|
65 /** |
|
66 * Stops receive process and discards all received data. |
|
67 */ |
|
68 IMPORT_C void StopReceiving(); |
|
69 |
|
70 public: // From MObexServerNotify |
|
71 /** |
|
72 * @see MObexServerNotify |
|
73 */ |
|
74 void ErrorIndication (TInt aError); |
|
75 /** |
|
76 * @see MObexServerNotify |
|
77 */ |
|
78 void TransportUpIndication (); |
|
79 /** |
|
80 * @see MObexServerNotify |
|
81 */ |
|
82 void TransportDownIndication (); |
|
83 /** |
|
84 * @see MObexServerNotify |
|
85 */ |
|
86 TBool TargetHeaderReceived(TDesC8& aTargetHeader); |
|
87 /** |
|
88 * @see MObexServerNotify |
|
89 */ |
|
90 TInt ObexConnectIndication( |
|
91 const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo ); |
|
92 /** |
|
93 * @see MObexServerNotify |
|
94 */ |
|
95 void ObexDisconnectIndication (const TDesC8& aInfo); |
|
96 /** |
|
97 * @see MObexServerNotify |
|
98 */ |
|
99 CObexBufObject* PutRequestIndication (); |
|
100 /** |
|
101 * @see MObexServerNotify |
|
102 */ |
|
103 TInt PutPacketIndication (); |
|
104 /** |
|
105 * @see MObexServerNotify |
|
106 */ |
|
107 TInt PutCompleteIndication (); |
|
108 /** |
|
109 * @see MObexServerNotify |
|
110 */ |
|
111 CObexBufObject* GetRequestIndication( |
|
112 CObexBaseObject* aRequiredObject ); |
|
113 /** |
|
114 * @see MObexServerNotify |
|
115 */ |
|
116 TInt GetPacketIndication (); |
|
117 /** |
|
118 * @see MObexServerNotify |
|
119 */ |
|
120 TInt GetCompleteIndication (); |
|
121 /** |
|
122 * @see MObexServerNotify |
|
123 */ |
|
124 TInt SetPathIndication( |
|
125 const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo ); |
|
126 /** |
|
127 * @see MObexServerNotify |
|
128 */ |
|
129 void AbortIndication (); |
|
130 private: |
|
131 /** |
|
132 * C++ default constructor. |
|
133 */ |
|
134 CFileManagerIRReceiver( |
|
135 MFileManagerProcessObserver& aObserver, |
|
136 CFileManagerEngine& aEngine, |
|
137 RFs& aFs ); |
|
138 |
|
139 /** |
|
140 * By default Symbian 2nd phase constructor is private. |
|
141 */ |
|
142 void ConstructL( const TDesC& aPath ); |
|
143 |
|
144 /** |
|
145 * Resets inactivity timer. |
|
146 */ |
|
147 void ResetInactivityTimer(); |
|
148 |
|
149 /** |
|
150 * Stops inactivity timer. |
|
151 */ |
|
152 void StopInactivityTimer(); |
|
153 |
|
154 /** |
|
155 * Handles inactivity timeout. |
|
156 */ |
|
157 static TInt InactivityTimeout( TAny* aPtr ); |
|
158 |
|
159 /** |
|
160 * Closes connection on timeout. |
|
161 */ |
|
162 void CloseConnection(); |
|
163 |
|
164 private: |
|
165 // Caller is informed about starting and stopping of the process. Also |
|
166 // the processed percentage is updated with this observer. |
|
167 MFileManagerProcessObserver& iObserver; |
|
168 |
|
169 // Own: Handles the obex object transfer |
|
170 CObexServer* iObexServer; |
|
171 |
|
172 // Own: Obex object of the received file |
|
173 CObexBufObject* iObexBufObject; |
|
174 |
|
175 // Own: Destination directory where the received file will be stored |
|
176 HBufC* iTempFile; |
|
177 |
|
178 // Ref. For checking file exists situation |
|
179 CFileManagerEngine& iEngine; |
|
180 |
|
181 // Error code |
|
182 TInt iError; |
|
183 |
|
184 // Is disk space already checked |
|
185 TBool iDiskSpaceChecked; |
|
186 |
|
187 // is there enought space |
|
188 TBool iEnoughSpace; |
|
189 |
|
190 // Ref: File server session |
|
191 RFs& iFs; |
|
192 |
|
193 // Own: temp buffer |
|
194 CBufFlat* iBuffer; |
|
195 |
|
196 // Own: Inactivity timer |
|
197 CPeriodic* iInactivityTimer; |
|
198 |
|
199 }; |
|
200 |
|
201 #endif // CFILEMANAGERIRRECEIVER_H |
|
202 |
|
203 // End of File |
|